@@ -726,7 +726,11 @@ export interface DataEditorRef {
726
726
/**
727
727
* Gets the mouse args from pointer event position.
728
728
*/
729
- getMouseArgsForPosition : ( posX : number , posY : number , ev ?: MouseEvent | TouchEvent ) => GridMouseEventArgs | undefined
729
+ getMouseArgsForPosition : (
730
+ posX : number ,
731
+ posY : number ,
732
+ ev ?: MouseEvent | TouchEvent
733
+ ) => GridMouseEventArgs | undefined ;
730
734
}
731
735
732
736
const loadingCell : GridCell = {
@@ -1643,7 +1647,7 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
1643
1647
getCellContentRef . current = getCellContent ;
1644
1648
rowsRef . current = rows ;
1645
1649
const appendRow = React . useCallback (
1646
- async ( col : number , openOverlay : boolean = true , behavior ?: ScrollBehavior ) : Promise < void > => {
1650
+ async ( col : number , openOverlay : boolean = true , behavior ?: ScrollBehavior ) : Promise < void > => {
1647
1651
const c = mangledCols [ col ] ;
1648
1652
if ( c ?. trailingRowOptions ?. disabled === true ) {
1649
1653
return ;
@@ -1929,13 +1933,18 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
1929
1933
}
1930
1934
} else if ( isMultiCol ) {
1931
1935
if ( selectedColumns . hasIndex ( col ) ) {
1936
+ // If the column is already selected, deselect that column:
1932
1937
setSelectedColumns ( selectedColumns . remove ( col ) , undefined , isMultiKey ) ;
1933
1938
} else {
1934
1939
setSelectedColumns ( undefined , col , isMultiKey ) ;
1935
1940
}
1936
1941
lastSelectedColRef . current = col ;
1937
1942
} else if ( columnSelect !== "none" ) {
1938
- setSelectedColumns ( CompactSelection . fromSingleSelection ( col ) , undefined , isMultiKey ) ;
1943
+ if ( selectedColumns . hasIndex ( col ) ) {
1944
+ setSelectedColumns ( selectedColumns . remove ( col ) , undefined , isMultiKey ) ;
1945
+ } else {
1946
+ setSelectedColumns ( CompactSelection . fromSingleSelection ( col ) , undefined , isMultiKey ) ;
1947
+ }
1939
1948
lastSelectedColRef . current = col ;
1940
1949
}
1941
1950
lastSelectedRowRef . current = undefined ;
@@ -3337,9 +3346,9 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
3337
3346
if ( onKeyDownIn !== undefined ) {
3338
3347
onKeyDownIn ( {
3339
3348
...event ,
3340
- ...event . location && {
3349
+ ...( event . location && {
3341
3350
location : [ event . location [ 0 ] - rowMarkerOffset , event . location [ 1 ] ] as any ,
3342
- } ,
3351
+ } ) ,
3343
3352
cancel : ( ) => {
3344
3353
cancelled = true ;
3345
3354
} ,
@@ -3930,7 +3939,11 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
3930
3939
void normalSizeColumn ( col + rowMarkerOffset ) ;
3931
3940
}
3932
3941
} ,
3933
- getMouseArgsForPosition : ( posX : number , posY : number , ev ?: MouseEvent | TouchEvent ) : GridMouseEventArgs | undefined => {
3942
+ getMouseArgsForPosition : (
3943
+ posX : number ,
3944
+ posY : number ,
3945
+ ev ?: MouseEvent | TouchEvent
3946
+ ) : GridMouseEventArgs | undefined => {
3934
3947
if ( gridRef ?. current === null ) {
3935
3948
return undefined ;
3936
3949
}
@@ -3939,12 +3952,12 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
3939
3952
if ( args === undefined ) {
3940
3953
return undefined ;
3941
3954
}
3942
-
3955
+
3943
3956
return {
3944
3957
...args ,
3945
3958
location : [ args . location [ 0 ] - rowMarkerOffset , args . location [ 1 ] ] as any ,
3946
3959
} ;
3947
- }
3960
+ } ,
3948
3961
} ) ,
3949
3962
[ appendRow , normalSizeColumn , scrollRef , onCopy , onKeyDown , onPasteInternal , rowMarkerOffset , scrollTo ]
3950
3963
) ;
0 commit comments