@@ -726,7 +726,11 @@ export interface DataEditorRef {
726726 /**
727727 * Gets the mouse args from pointer event position.
728728 */
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 ;
730734}
731735
732736const loadingCell : GridCell = {
@@ -1643,7 +1647,7 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
16431647 getCellContentRef . current = getCellContent ;
16441648 rowsRef . current = rows ;
16451649 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 > => {
16471651 const c = mangledCols [ col ] ;
16481652 if ( c ?. trailingRowOptions ?. disabled === true ) {
16491653 return ;
@@ -1929,13 +1933,18 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
19291933 }
19301934 } else if ( isMultiCol ) {
19311935 if ( selectedColumns . hasIndex ( col ) ) {
1936+ // If the column is already selected, deselect that column:
19321937 setSelectedColumns ( selectedColumns . remove ( col ) , undefined , isMultiKey ) ;
19331938 } else {
19341939 setSelectedColumns ( undefined , col , isMultiKey ) ;
19351940 }
19361941 lastSelectedColRef . current = col ;
19371942 } 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+ }
19391948 lastSelectedColRef . current = col ;
19401949 }
19411950 lastSelectedRowRef . current = undefined ;
@@ -3337,9 +3346,9 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
33373346 if ( onKeyDownIn !== undefined ) {
33383347 onKeyDownIn ( {
33393348 ...event ,
3340- ...event . location && {
3349+ ...( event . location && {
33413350 location : [ event . location [ 0 ] - rowMarkerOffset , event . location [ 1 ] ] as any ,
3342- } ,
3351+ } ) ,
33433352 cancel : ( ) => {
33443353 cancelled = true ;
33453354 } ,
@@ -3930,7 +3939,11 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
39303939 void normalSizeColumn ( col + rowMarkerOffset ) ;
39313940 }
39323941 } ,
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 => {
39343947 if ( gridRef ?. current === null ) {
39353948 return undefined ;
39363949 }
@@ -3939,12 +3952,12 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
39393952 if ( args === undefined ) {
39403953 return undefined ;
39413954 }
3942-
3955+
39433956 return {
39443957 ...args ,
39453958 location : [ args . location [ 0 ] - rowMarkerOffset , args . location [ 1 ] ] as any ,
39463959 } ;
3947- }
3960+ } ,
39483961 } ) ,
39493962 [ appendRow , normalSizeColumn , scrollRef , onCopy , onKeyDown , onPasteInternal , rowMarkerOffset , scrollTo ]
39503963 ) ;
0 commit comments