@@ -75,8 +75,12 @@ const getMousedownListener =
7575 datagrid . model ! . _edit_mode === "SELECT_COLUMN" )
7676 ) {
7777 datagrid . model ! . _selection_state . CURRENT_MOUSEDOWN_COORDINATES = { } ;
78- const meta = table . getMeta ( mouseEvent . target as Element ) ;
79- if ( meta && meta . x !== undefined && meta . y !== undefined ) {
78+ const meta = table . getMeta ( mouseEvent . target as HTMLElement ) ;
79+ if (
80+ meta ?. type === "body" &&
81+ meta . x !== undefined &&
82+ meta . y !== undefined
83+ ) {
8084 datagrid . model ! . _selection_state . CURRENT_MOUSEDOWN_COORDINATES =
8185 {
8286 x : meta . x ,
@@ -129,8 +133,12 @@ const getMouseoverListener =
129133 datagrid . model ! . _selection_state . CURRENT_MOUSEDOWN_COORDINATES
130134 . x !== undefined
131135 ) {
132- const meta = table . getMeta ( mouseEvent . target as Element ) ;
133- if ( meta && meta . x !== undefined && meta . y !== undefined ) {
136+ const meta = table . getMeta ( mouseEvent . target as HTMLElement ) ;
137+ if (
138+ meta ?. type === "body" &&
139+ meta . x !== undefined &&
140+ meta . y !== undefined
141+ ) {
134142 const potentialSelection : SelectionArea = {
135143 x0 : Math . min (
136144 meta . x ,
@@ -183,7 +191,7 @@ const getMouseupListener =
183191 datagrid . model ! . _edit_mode === "SELECT_ROW" ||
184192 datagrid . model ! . _edit_mode === "SELECT_COLUMN"
185193 ) {
186- const meta = table . getMeta ( mouseEvent . target as Element ) ;
194+ const meta = table . getMeta ( mouseEvent . target as HTMLElement ) ;
187195 if ( ! meta ) return ;
188196
189197 if (
@@ -195,6 +203,7 @@ const getMouseupListener =
195203 if (
196204 selected . x0 === selected . x1 &&
197205 selected . y0 === selected . y1 &&
206+ meta ?. type === "body" &&
198207 selected . x0 === meta . x &&
199208 selected . y0 === meta . y
200209 ) {
@@ -216,6 +225,7 @@ const getMouseupListener =
216225 . CURRENT_MOUSEDOWN_COORDINATES &&
217226 datagrid . model ! . _selection_state . CURRENT_MOUSEDOWN_COORDINATES
218227 . x !== undefined &&
228+ meta ?. type === "body" &&
219229 meta . x !== undefined &&
220230 meta . y !== undefined
221231 ) {
@@ -338,8 +348,8 @@ const applyMouseAreaSelection = (
338348 const tds = table . querySelectorAll ( "tbody td" ) ;
339349
340350 for ( const td of tds ) {
341- const meta = table . getMeta ( td ) ;
342- if ( ! meta ) continue ;
351+ const meta = table . getMeta ( td as HTMLElement ) ;
352+ if ( ! meta || meta . type !== "body" ) continue ;
343353 let rendered = false ;
344354 for ( const { x0, x1, y0, y1 } of selected ) {
345355 if (
@@ -372,15 +382,16 @@ const applyMouseAreaSelection = (
372382 const tds = table . querySelectorAll ( "tbody td" ) ;
373383
374384 for ( const td of tds ) {
375- const meta = table . getMeta ( td ) ;
385+ const meta = table . getMeta ( td as HTMLElement ) ;
376386 if ( ! meta ) continue ;
377387 let rendered = false ;
378388 for ( const { x0, x1, y0, y1 } of selected ) {
379389 if (
380390 x0 !== undefined &&
381391 y0 !== undefined &&
382392 x1 !== undefined &&
383- y1 !== undefined
393+ y1 !== undefined &&
394+ meta ?. type === "body"
384395 ) {
385396 if ( y0 <= meta . y && meta . y <= y1 ) {
386397 datagrid . model ! . _selection_state . dirty = true ;
@@ -401,15 +412,16 @@ const applyMouseAreaSelection = (
401412 const tds = table . querySelectorAll ( "tbody td" ) ;
402413
403414 for ( const td of tds ) {
404- const meta = table . getMeta ( td ) ;
415+ const meta = table . getMeta ( td as HTMLElement ) ;
405416 if ( ! meta ) continue ;
406417 let rendered = false ;
407418 for ( const { x0, x1, y0, y1 } of selected ) {
408419 if (
409420 x0 !== undefined &&
410421 y0 !== undefined &&
411422 x1 !== undefined &&
412- y1 !== undefined
423+ y1 !== undefined &&
424+ meta ?. type === "body"
413425 ) {
414426 if ( x0 <= meta . x && meta . x <= x1 ) {
415427 datagrid . model ! . _selection_state . dirty = true ;
0 commit comments