File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -641,8 +641,32 @@ export class BasicMouseHandler implements DataGrid.IMouseHandler {
641
641
return ;
642
642
}
643
643
}
644
-
645
- grid . resizeColumn ( colRegion , colIndex , null ) ;
644
+ const cs = grid . selectionModel ?. currentSelection ( ) ;
645
+ const cv = grid . currentViewport ;
646
+ const rowCount = grid . selectionModel ?. dataModel . rowCount ( 'body' ) ?? 0 ;
647
+ if (
648
+ colRegion == 'body' &&
649
+ cs != null &&
650
+ cv != null &&
651
+ cs . r1 == 0 &&
652
+ cs . r2 == rowCount - 1
653
+ ) {
654
+ // One or more columns are selected
655
+ let c1 = Math . max ( Math . min ( cs . c1 , cs . c2 ) , cv . firstColumn ) ;
656
+ let c2 = Math . min ( Math . max ( cs . c1 , cs . c2 ) , cv . lastColumn ) ;
657
+ if ( c1 <= colIndex && colIndex <= c2 ) {
658
+ // When we double-click one of the selected column headers, resize all visible selected columns.
659
+ for ( let ci = c1 ; ci <= c2 ; ci ++ ) {
660
+ grid . resizeColumn ( colRegion , ci , null ) ;
661
+ }
662
+ } else {
663
+ // When we double-click the column header outside the selection, resize only the clicked column.
664
+ grid . resizeColumn ( colRegion , colIndex , null ) ;
665
+ }
666
+ } else {
667
+ // When no columns are selected, resize only the clicked column.
668
+ grid . resizeColumn ( colRegion , colIndex , null ) ;
669
+ }
646
670
}
647
671
}
648
672
You can’t perform that action at this time.
0 commit comments