File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 handleDoubleClick ,
77 getScrollOfScrollableElement ,
88 isSelectionKey ,
9+ getCompatibleCellAndTemplate ,
910} from "../../core" ;
1011import {
1112 KeyboardEvent ,
@@ -50,6 +51,8 @@ export class DefaultBehavior extends Behavior {
5051 location : PointerLocation ,
5152 state : State
5253 ) : Behavior {
54+ const { cell } = getCompatibleCellAndTemplate ( state , location ) ;
55+
5356 // changing behavior will disable all keyboard event handlers
5457 const target = event . target as HTMLDivElement ;
5558 if (
@@ -58,7 +61,7 @@ export class DefaultBehavior extends Behavior {
5861 ( event . pointerType === "touch" &&
5962 ( target . className === "rg-touch-column-resize-handle" ||
6063 target . className === "rg-resize-handle" ) ) ) &&
61- location . row . idx === 0 &&
64+ ( location . row . idx === 0 || cell . type === "header" ) &&
6265 location . column . resizable &&
6366 location . cellX >
6467 location . column . width -
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ export const CellRenderer: React.FC<CellRendererProps> = ({
134134 } ) }
135135 >
136136 { cellTemplate . render ( cellToRender , isMobile ? isInEditMode : false , onCellChanged ) }
137- { location . row . idx === 0 && location . column . resizable && < ResizeColumnHandle /> }
137+ { location . row . idx === 0 || ( cell . type === 'header' && state . props ?. enableColumnResizeOnAllHeaders ) ) && location . column . resizable && < ResizeColumnHandle /> }
138138 { location . column . idx === 0 && location . row . resizable && < ResizeRowHandle /> }
139139 { state . enableGroupIdRender && cell ?. groupId !== undefined && ! ( isInEditMode && isMobile ) && (
140140 < span className = "rg-groupId" > { cell . groupId } </ span >
Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ export type SelectionMode =
3535export interface ReactGridProps {
3636 /** Array of `Column`s */
3737 readonly columns : Column [ ] ;
38- /** Array of `Row`s */
38+ /** Array of `Row`s */
3939 readonly rows : Row < Cell > [ ] ;
40+ /** Enables column resizing on all header cells */
41+ readonly enableColumnResizeOnAllHeaders ?: boolean ;
4042 /** Object that contains available custom cell templates */
4143 readonly customCellTemplates ?: CellTemplates ;
4244 /** Focus position (managed constantly by outer app) */
Original file line number Diff line number Diff line change @@ -549,6 +549,7 @@ export const TestGrid: React.FC<TestGridProps> = (props) => {
549549 rows = { rows }
550550 columns = { columns }
551551 initialFocusLocation = { config . initialFocusLocation }
552+ enableColumnResizeOnAllHeaders = { config . enableColumnResizeOnAllHeaders }
552553 focusLocation = { enableFrozenFocus ? config . focusLocation : undefined }
553554 // onCellsChanged={handleChangesTest2} // TODO This handler should be allowed
554555 onCellsChanged = { handleChanges }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export const config: TestConfig = {
88 pinToBody : false ,
99 additionalContent : false ,
1010 flexRow : false ,
11+ enableColumnResizeOnAllHeaders : false ,
1112
1213 rgViewportHeight : 600 ,
1314 rgViewportWidth : 1150 ,
@@ -197,6 +198,8 @@ export interface TestConfig {
197198 additionalContent : boolean ;
198199 flexRow : boolean ;
199200
201+ enableColumnResizeOnAllHeaders : boolean ;
202+
200203 rgViewportHeight : number ;
201204 rgViewportWidth : number ;
202205 margin : string ;
You can’t perform that action at this time.
0 commit comments