@linzjs/step-ag-grid 29.3.1 → 29.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2838,19 +2838,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
2838
2838
  // It should be impossible to get here
2839
2839
  console.error('Unknown value returned from hasGridRendered');
2840
2840
  }
2841
- // If there's no contentSize callback there'll be on onGridResize callback
2842
- // which is required to run sizeColumnsToFit.
2843
- // There's also the possibility that the panel was already the right size so didn't trigger onGridResize.
2844
- lodashEs.delay(() => {
2845
- if (requiresInitialSizeToFitRef.current) {
2846
- requiresInitialSizeToFitRef.current = false;
2847
- sizeColumnsToFit();
2848
- }
2849
- }, 50);
2850
2841
  }
2851
2842
  setAutoSized(true);
2852
2843
  needsAutoSize.current = false;
2853
- }, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns, sizeColumnsToFit]);
2844
+ }, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns]);
2854
2845
  const lastOwnerDocumentRef = React.useRef();
2855
2846
  const wasVisibleRef = React.useRef(false);
2856
2847
  /**
@@ -3147,6 +3138,9 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
3147
3138
  * Resize columns to fit if required on window/container resize
3148
3139
  */
3149
3140
  const onGridResize = React.useCallback((event) => {
3141
+ if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
3142
+ return;
3143
+ }
3150
3144
  if (sizeColumns !== 'none') {
3151
3145
  // Flex columns can expand to fit after resize, but they cannot shrink less than use resized value
3152
3146
  // Double click column resize handle to reset this behaviour
@@ -3157,7 +3151,6 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
3157
3151
  maxWidth: w,
3158
3152
  })),
3159
3153
  ];
3160
- requiresInitialSizeToFitRef.current = false;
3161
3154
  lodashEs.defer(() => event.api.sizeColumnsToFit({ columnLimits }));
3162
3155
  }
3163
3156
  }, [sizeColumns]);
@@ -3331,9 +3324,15 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
3331
3324
  ? {
3332
3325
  enableSelectionWithoutKeys: params.enableSelectionWithoutKeys ?? false,
3333
3326
  enableClickSelection: params.enableClickSelection ?? false,
3334
- mode: rowSelection == 'single' ? 'singleRow' : 'multiRow',
3327
+ mode: rowSelection === 'single' ? 'singleRow' : 'multiRow',
3328
+ }
3329
+ : undefined, onDisplayedColumnsChanged: () => {
3330
+ // This happens after an autosize event, if we don't wait for it size columns to fit doesn't work
3331
+ if (requiresInitialSizeToFitRef.current) {
3332
+ requiresInitialSizeToFitRef.current = false;
3333
+ sizeColumnsToFit();
3335
3334
  }
3336
- : undefined, rowHeight: rowHeight, animateRows: params.animateRows ?? false, rowClassRules: params.rowClassRules, getRowId: getRowId, onGridSizeChanged: onGridResize, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: setInitialContentSize, onRowDataUpdated: onRowDataChanged, onCellFocused: onCellFocused, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: defaultColDef, columnDefs: columnDefsAdjusted, selectionColumnDef: selectionColumnDef, rowData: rowData, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, quickFilterParser: quickFilterParser, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, noRowsOverlayComponent: noRowsOverlayComponent, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, onRowClicked: params.onRowClicked, onRowDoubleClicked: params.onRowDoubleClicked, suppressStartEditOnTab: true }) })] }));
3335
+ }, rowHeight: rowHeight, animateRows: params.animateRows ?? false, rowClassRules: params.rowClassRules, getRowId: getRowId, onGridSizeChanged: onGridResize, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: setInitialContentSize, onRowDataUpdated: onRowDataChanged, onCellFocused: onCellFocused, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: defaultColDef, columnDefs: columnDefsAdjusted, selectionColumnDef: selectionColumnDef, rowData: rowData, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, quickFilterParser: quickFilterParser, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, noRowsOverlayComponent: noRowsOverlayComponent, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, onRowClicked: params.onRowClicked, onRowDoubleClicked: params.onRowDoubleClicked, suppressStartEditOnTab: true }) })] }));
3337
3336
  };
3338
3337
  const quickFilterParser = (filterStr) => {
3339
3338
  // filter is exact matches exactly groups separated by commas