@linzjs/step-ag-grid 16.0.0 → 17.0.1

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.
Files changed (102) hide show
  1. package/dist/GridTheme.scss +138 -106
  2. package/dist/index.css +1 -8
  3. package/dist/node_modules/@linzjs/lui/dist/assets/svg-content.d.ts +7 -0
  4. package/dist/src/components/ComponentLoadingWrapper.d.ts +3 -4
  5. package/dist/src/components/Grid.d.ts +2 -2
  6. package/dist/src/components/GridCell.d.ts +5 -5
  7. package/dist/src/components/GridCellMultiEditor.d.ts +2 -2
  8. package/dist/src/components/GridNoRowsOverlay.d.ts +3 -2
  9. package/dist/src/components/GridPopoverHook.d.ts +3 -3
  10. package/dist/src/components/GridWrapper.d.ts +2 -3
  11. package/dist/src/components/PostSortRowsHook.d.ts +1 -1
  12. package/dist/src/components/gridFilter/GridFilterButtons.d.ts +2 -2
  13. package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +2 -2
  14. package/dist/src/components/gridFilter/GridFilters.d.ts +2 -5
  15. package/dist/src/components/gridForm/GridFormDropDown.d.ts +2 -2
  16. package/dist/src/components/gridForm/GridFormMessage.d.ts +2 -2
  17. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +2 -2
  18. package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +3 -3
  19. package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +2 -2
  20. package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +2 -2
  21. package/dist/src/components/gridForm/GridFormTextArea.d.ts +2 -2
  22. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +2 -2
  23. package/dist/src/contexts/GridContext.d.ts +4 -4
  24. package/dist/src/contexts/GridContextProvider.d.ts +2 -6
  25. package/dist/src/contexts/GridPopoverContextProvider.d.ts +2 -3
  26. package/dist/src/contexts/GridUpdatingContextProvider.d.ts +2 -6
  27. package/dist/src/lui/ActionButton.d.ts +2 -2
  28. package/dist/src/lui/FormError.d.ts +2 -2
  29. package/dist/src/lui/TextAreaInput.d.ts +3 -3
  30. package/dist/src/lui/TextInputFormatted.d.ts +3 -3
  31. package/dist/src/react-menu3/components/FocusableItem.d.ts +2 -2
  32. package/dist/src/react-menu3/utils/withHovering.d.ts +2 -2
  33. package/dist/src/utils/textValidator.d.ts +3 -3
  34. package/dist/step-ag-grid.cjs.js +39 -17
  35. package/dist/step-ag-grid.cjs.js.map +1 -1
  36. package/dist/step-ag-grid.esm.js +39 -17
  37. package/dist/step-ag-grid.esm.js.map +1 -1
  38. package/package.json +45 -45
  39. package/src/components/ComponentLoadingWrapper.tsx +9 -6
  40. package/src/components/Grid.tsx +19 -10
  41. package/src/components/GridCell.tsx +5 -5
  42. package/src/components/GridCellMultiEditor.tsx +2 -2
  43. package/src/components/GridNoRowsOverlay.tsx +4 -2
  44. package/src/components/GridPopoverHook.tsx +4 -4
  45. package/src/components/GridWrapper.tsx +2 -3
  46. package/src/components/PostSortRowsHook.ts +4 -4
  47. package/src/components/gridFilter/GridFilterButtons.tsx +2 -2
  48. package/src/components/gridFilter/GridFilterColumnsToggle.tsx +2 -2
  49. package/src/components/gridFilter/GridFilters.tsx +4 -6
  50. package/src/components/gridForm/GridFormDropDown.tsx +4 -4
  51. package/src/components/gridForm/GridFormMessage.tsx +3 -3
  52. package/src/components/gridForm/GridFormMultiSelect.tsx +2 -1
  53. package/src/components/gridForm/GridFormPopoverMenu.tsx +4 -4
  54. package/src/components/gridForm/GridFormSubComponentTextArea.tsx +2 -2
  55. package/src/components/gridForm/GridFormSubComponentTextInput.tsx +2 -2
  56. package/src/components/gridForm/GridFormTextArea.tsx +2 -2
  57. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +1 -1
  58. package/src/components/gridRender/GridRenderGenericCell.tsx +2 -1
  59. package/src/contexts/GridContext.tsx +4 -4
  60. package/src/contexts/GridContextProvider.tsx +33 -22
  61. package/src/contexts/GridPopoverContextProvider.tsx +2 -3
  62. package/src/contexts/GridUpdatingContextProvider.tsx +2 -6
  63. package/src/lui/ActionButton.tsx +2 -2
  64. package/src/lui/FormError.tsx +3 -1
  65. package/src/lui/TextAreaInput.tsx +3 -3
  66. package/src/lui/TextInputFormatted.tsx +3 -3
  67. package/src/lui/reactUtils.test.tsx +3 -3
  68. package/src/react-menu3/components/FocusableItem.tsx +2 -2
  69. package/src/react-menu3/utils/utils.ts +1 -1
  70. package/src/react-menu3/utils/withHovering.tsx +2 -2
  71. package/src/stories/grid/FormTest.tsx +2 -2
  72. package/src/stories/grid/GridFilterButtons.stories.tsx +8 -1
  73. package/src/stories/grid/GridNoRowsOverlay.stories.tsx +8 -8
  74. package/src/stories/grid/GridNonEditableRow.stories.tsx +9 -2
  75. package/src/stories/grid/GridPopoutContextMenu.stories.tsx +8 -1
  76. package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +8 -1
  77. package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +8 -1
  78. package/src/stories/grid/GridPopoverEditBearing.stories.tsx +7 -0
  79. package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +7 -0
  80. package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +7 -0
  81. package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +8 -0
  82. package/src/stories/grid/GridReadOnly.stories.tsx +10 -2
  83. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +2 -2
  84. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +7 -2
  85. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +7 -2
  86. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +1 -1
  87. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +2 -2
  88. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +4 -3
  89. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +3 -3
  90. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +3 -3
  91. package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +1 -1
  92. package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +1 -1
  93. package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +1 -1
  94. package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +2 -2
  95. package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +1 -1
  96. package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +1 -1
  97. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +4 -0
  98. package/src/styles/ComponentLoadingWrapper.scss +1 -4
  99. package/src/styles/Grid.scss +0 -4
  100. package/src/styles/GridTheme.scss +138 -106
  101. package/src/utils/testUtil.ts +3 -0
  102. package/src/utils/textValidator.ts +3 -1
@@ -1,7 +1,3 @@
1
- import { ReactNode } from "react";
2
- interface UpdatingContextProviderProps {
3
- children: ReactNode;
4
- }
1
+ import { PropsWithChildren } from "react";
5
2
  export type GridUpdatingContextStatus = Record<string, (number | string)[] | undefined>;
6
- export declare const GridUpdatingContextProvider: (props: UpdatingContextProviderProps) => import("react/jsx-runtime").JSX.Element;
7
- export {};
3
+ export declare const GridUpdatingContextProvider: (props: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import "./ActionButton.scss";
2
- import { CSSProperties } from "react";
2
+ import { CSSProperties, ReactElement } from "react";
3
3
  import { LuiButtonProps } from "@linzjs/lui/dist/components/LuiButton/LuiButton";
4
4
  import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
5
5
  export interface ActionButtonProps {
@@ -17,4 +17,4 @@ export interface ActionButtonProps {
17
17
  style?: CSSProperties;
18
18
  disabled?: boolean;
19
19
  }
20
- export declare const ActionButton: ({ icon, name, inProgressName, disabled, dataTestId, style, className, title, onClick, size, iconPosition, level, "aria-label": ariaLabel, }: ActionButtonProps) => JSX.Element;
20
+ export declare const ActionButton: ({ icon, name, inProgressName, disabled, dataTestId, style, className, title, onClick, size, iconPosition, level, "aria-label": ariaLabel, }: ActionButtonProps) => ReactElement;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
1
  import "./FormError.scss";
2
+ import { ReactElement } from "react";
3
3
  export interface FormErrorProps {
4
4
  helpText?: string;
5
- error?: JSX.Element | string | boolean | null;
5
+ error?: ReactElement | string | boolean | null;
6
6
  }
7
7
  export declare const FormError: (props: FormErrorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
- import { InputHTMLAttributes } from "react";
1
+ import { InputHTMLAttributes, ReactElement } from "react";
2
2
  export declare const useGenerateOrDefaultId: (idFromProps?: string) => string;
3
3
  export interface LuiTextAreaInputProps extends InputHTMLAttributes<HTMLTextAreaElement> {
4
4
  value: string;
5
- label?: JSX.Element | string;
5
+ label?: ReactElement | string;
6
6
  mandatory?: boolean;
7
7
  helpText?: string;
8
- error?: JSX.Element | string | boolean | null;
8
+ error?: ReactElement | string | boolean | null;
9
9
  allowTabToSave?: boolean;
10
10
  }
11
11
  export declare const TextAreaInput: (props: LuiTextAreaInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import "./TextInputFormatted.scss";
2
- import { DetailedHTMLProps, InputHTMLAttributes } from "react";
2
+ import { DetailedHTMLProps, InputHTMLAttributes, ReactElement } from "react";
3
3
  export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
4
4
  value: string;
5
5
  helpText?: string;
6
- error?: JSX.Element | string | boolean | null;
6
+ error?: ReactElement | string | boolean | null;
7
7
  formatted?: string;
8
8
  allowTabToSave?: boolean;
9
9
  }
10
- export declare const TextInputFormatted: (props: LuiTextInputProps) => JSX.Element;
10
+ export declare const TextInputFormatted: (props: LuiTextInputProps) => ReactElement;
@@ -1,9 +1,9 @@
1
- import { LegacyRef } from "react";
1
+ import { LegacyRef, ReactElement } from "react";
2
2
  import { BaseProps } from "../types";
3
3
  import { withHoveringResultProps } from "../utils/withHovering";
4
4
  export interface FocusableItemProps extends BaseProps, withHoveringResultProps {
5
5
  disabled?: boolean;
6
- children: (ref: LegacyRef<any>) => JSX.Element;
6
+ children: (ref: LegacyRef<any>) => ReactElement;
7
7
  }
8
8
  export declare const FocusableItemFr: ({ className, disabled, children, isHovering, menuItemRef, externalRef, ...restProps }: FocusableItemProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const FocusableItem: import("react").ForwardRefExoticComponent<Omit<FocusableItemProps, "ref"> & import("react").RefAttributes<unknown>>;
@@ -1,7 +1,7 @@
1
- import { MutableRefObject, PropsWithRef } from "react";
1
+ import { MutableRefObject, PropsWithRef, ReactElement } from "react";
2
2
  export interface withHoveringResultProps {
3
3
  isHovering?: boolean;
4
4
  externalRef?: MutableRefObject<any>;
5
5
  menuItemRef?: MutableRefObject<HTMLLIElement>;
6
6
  }
7
- export declare const withHovering: <T>(name: string, WrappedComponent: (props: T) => JSX.Element) => import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<PropsWithRef<T>> & import("react").RefAttributes<unknown>>;
7
+ export declare const withHovering: <T>(name: string, WrappedComponent: (props: T) => ReactElement) => import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<PropsWithRef<T>> & import("react").RefAttributes<unknown>>;
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from "react";
2
2
  import { GridBaseRow } from "../components/Grid";
3
3
  export interface TextInputValidatorProps<RowType extends GridBaseRow> {
4
4
  required?: boolean;
5
5
  maxLength?: number;
6
6
  maxBytes?: number;
7
- invalid?: (value: string, data: RowType, context: any) => JSX.Element | string | null;
7
+ invalid?: (value: string, data: RowType, context: any) => ReactElement | string | null;
8
8
  numberFormat?: {
9
9
  precision?: number;
10
10
  scale?: number;
@@ -15,4 +15,4 @@ export interface TextInputValidatorProps<RowType extends GridBaseRow> {
15
15
  notZero?: boolean;
16
16
  };
17
17
  }
18
- export declare const TextInputValidator: <RowType extends GridBaseRow>(props: TextInputValidatorProps<RowType>, value: string | null, data: RowType, context: any) => string | JSX.Element | null;
18
+ export declare const TextInputValidator: <RowType extends GridBaseRow>(props: TextInputValidatorProps<RowType>, value: string | null, data: RowType, context: any) => string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -893,6 +893,10 @@ const getEndStatus = (status, unmountOnExit) => {
893
893
  }
894
894
  };
895
895
  const getTimeout = timeout => typeof timeout === 'object' ? [timeout.enter, timeout.exit] : [timeout, timeout];
896
+ const nextTick = (transitState, status) => setTimeout(() => {
897
+ // Reading document.body.offsetTop can force browser to repaint before transition to the next state
898
+ isNaN(document.body.offsetTop) || transitState(status + 1);
899
+ }, 0);
896
900
 
897
901
  const updateState = (status, setState, latestState, timeoutId, onChange) => {
898
902
  clearTimeout(timeoutId.current);
@@ -934,7 +938,7 @@ const useTransition = ({
934
938
  break;
935
939
  case PRE_ENTER:
936
940
  case PRE_EXIT:
937
- timeoutId.current = setTimeout(() => transitState(status + 1), 0);
941
+ timeoutId.current = nextTick(transitState, status);
938
942
  break;
939
943
  }
940
944
  };
@@ -2337,13 +2341,14 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
2337
2341
  /**
2338
2342
  * Wrapper for AgGrid to add commonly used functionality.
2339
2343
  */
2340
- const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-alpine", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, ...params }) => {
2344
+ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, ...params }) => {
2341
2345
  const { gridReady, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnCellEditingComplete, getColDef, } = React.useContext(GridContext);
2342
2346
  const { checkUpdating, updatedDep, updatingCols } = React.useContext(GridUpdatingContext);
2343
2347
  const { prePopupOps } = React.useContext(GridContext);
2344
2348
  const gridDivRef = React.useRef(null);
2345
2349
  const lastSelectedIds = React.useRef([]);
2346
2350
  const [staleGrid, setStaleGrid] = React.useState(false);
2351
+ const [autoSized, setAutoSized] = React.useState(false);
2347
2352
  const postSortRows = usePostSortRowsHook({ setStaleGrid });
2348
2353
  /**
2349
2354
  * onContentSize should only be called at maximum twice.
@@ -2385,6 +2390,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2385
2390
  if (sizeColumns !== "none") {
2386
2391
  sizeColumnsToFit();
2387
2392
  }
2393
+ setAutoSized(true);
2388
2394
  needsAutoSize.current = false;
2389
2395
  }, [autoSizeColumns, params, sizeColumns, sizeColumnsToFit]);
2390
2396
  const lastOwnerDocumentRef = React.useRef();
@@ -2727,7 +2733,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2727
2733
  }
2728
2734
  }, [sizeColumns, sizeColumnsToFit]);
2729
2735
  /**
2730
- * Set of column Id's that are prevented from auto-sizing as they are user set
2736
+ * Set of column I'd's that are prevented from auto-sizing as they are user set
2731
2737
  */
2732
2738
  const userSizedColIds = React.useRef(new Set());
2733
2739
  /**
@@ -2749,9 +2755,9 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2749
2755
  const gridContextMenu = useGridContextMenu({ contextMenu: params.contextMenu, contextMenuSelectRow });
2750
2756
  // This is setting a ref in the GridContext so won't be triggering an update loop
2751
2757
  setOnCellEditingComplete(params.onCellEditingComplete);
2752
- return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready"), children: [gridContextMenu.component, jsxRuntime.jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsxRuntime.jsx(agGridReact.AgGridReact, { rowHeight: params.rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
2758
+ return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsxRuntime.jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsxRuntime.jsx(agGridReact.AgGridReact, { rowHeight: params.rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
2753
2759
  setInitialContentSize();
2754
- }, onRowDataChanged: onRowDataChanged, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: { minWidth: 48, ...lodashEs.omit(params.defaultColDef, ["editable"]) }, columnDefs: columnDefsAdjusted, rowData: params.rowData, noRowsOverlayComponent: (event) => {
2760
+ }, onRowDataUpdated: onRowDataChanged, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: { minWidth: 48, ...lodashEs.omit(params.defaultColDef, ["editable"]) }, columnDefs: columnDefsAdjusted, rowData: params.rowData, noRowsOverlayComponent: (event) => {
2755
2761
  let rowCount = 0;
2756
2762
  event.api.forEachNode(() => rowCount++);
2757
2763
  return (jsxRuntime.jsx(GridNoRowsOverlay, { rowCount: rowCount, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText }));
@@ -3065,7 +3071,7 @@ const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }) => {
3065
3071
  } }) }));
3066
3072
  };
3067
3073
 
3068
- const GridFilters = ({ children }) => jsxRuntime.jsx("div", { className: "Grid-container-filters", children: children });
3074
+ const GridFilters = ({ children }) => (jsxRuntime.jsx("div", { className: "Grid-container-filters", children: children }));
3069
3075
 
3070
3076
  /**
3071
3077
  * Defers state change up to a minimum time since last state change.
@@ -4441,7 +4447,7 @@ const GridPopoverEditDropDown = (colDef, props) => GridCell(colDef, {
4441
4447
  });
4442
4448
 
4443
4449
  const GridPopoverMessage = (colDef, props) => GridCell({
4444
- resizable: false,
4450
+ resizable: true,
4445
4451
  ...colDef,
4446
4452
  cellRendererParams: {
4447
4453
  singleClickEdit: true,
@@ -4626,7 +4632,13 @@ const GridContextProvider = (props) => {
4626
4632
  const gridHasNotUpdated = gridRowIdsNotUpdatedYet || gridRowIdsNotChangedYet;
4627
4633
  // After retry count expires we give-up and deselect all rows, then select any subset of rows that have updated
4628
4634
  if (gridHasNotUpdated && retryCount > 0) {
4629
- lodashEs.delay(() => _selectRowsWithOptionalFlash({ rowIds, select, flash, ifNoCellFocused, retryCount: retryCount - 1 }), 250);
4635
+ lodashEs.delay(() => _selectRowsWithOptionalFlash({
4636
+ rowIds,
4637
+ select,
4638
+ flash,
4639
+ ifNoCellFocused,
4640
+ retryCount: retryCount - 1,
4641
+ }), 250);
4630
4642
  return;
4631
4643
  }
4632
4644
  const rowsThatNeedSelecting = lodashEs.sortBy(rowNodes.filter((node) => !node.isSelected()), (node) => node.data.id);
@@ -4727,13 +4739,14 @@ const GridContextProvider = (props) => {
4727
4739
  const autoSizeColumns = React.useCallback(({ skipHeader, colIds, userSizedColIds } = {}) => {
4728
4740
  if (!columnApi)
4729
4741
  return null;
4730
- const colIdsSet = colIds instanceof Set ? colIds : new Set(colIds ?? []);
4731
- columnApi.getColumnState().forEach((col) => {
4732
- const colId = col.colId;
4733
- if ((lodashEs.isEmpty(colIdsSet) || colIdsSet.has(colId)) && !userSizedColIds?.has(colId)) {
4734
- columnApi.autoSizeColumn(colId, skipHeader);
4735
- }
4742
+ const colIdsSet = colIds instanceof Set ? colIds : new Set(colIds);
4743
+ const colsToResize = columnApi.getColumnState().filter((colState) => {
4744
+ const colId = colState.colId;
4745
+ return (lodashEs.isEmpty(colIdsSet) || colIdsSet.has(colId)) && !userSizedColIds?.has(colId) && !colState.flex;
4736
4746
  });
4747
+ if (!lodashEs.isEmpty(colsToResize)) {
4748
+ columnApi.autoSizeColumns(colsToResize.map((colState) => colState.colId), skipHeader);
4749
+ }
4737
4750
  return {
4738
4751
  width: lodashEs.sumBy(columnApi.getColumnState().filter((col) => !col.hide), "width"),
4739
4752
  };
@@ -4742,7 +4755,7 @@ const GridContextProvider = (props) => {
4742
4755
  * Resize columns to fit container
4743
4756
  */
4744
4757
  const sizeColumnsToFit = React.useCallback(() => {
4745
- gridApi && gridApi.sizeColumnsToFit();
4758
+ gridApi?.sizeColumnsToFit();
4746
4759
  }, [gridApi]);
4747
4760
  const stopEditing = React.useCallback(() => {
4748
4761
  if (!gridApi)
@@ -4874,8 +4887,14 @@ const GridContextProvider = (props) => {
4874
4887
  });
4875
4888
  }, [gridApiOp, modifyUpdating, selectNextEditableCell]);
4876
4889
  const redrawRows = React.useCallback((rowNodes) => {
4877
- gridApiOp((gridApi) => gridApi.redrawRows(rowNodes ? { rowNodes } : undefined));
4878
- }, [gridApiOp]);
4890
+ // redraw rows can throw exceptions in jest, so we ignore them
4891
+ try {
4892
+ gridApi && gridApi.redrawRows(rowNodes ? { rowNodes } : undefined);
4893
+ }
4894
+ catch (ex) {
4895
+ console.error(ex);
4896
+ }
4897
+ }, [gridApi]);
4879
4898
  // waitForExternallySelectedItemsToBeInSync can't use the state as it won't be updated during function execution
4880
4899
  const externallySelectedItemsAreInSyncRef = React.useRef(false);
4881
4900
  React.useEffect(() => {
@@ -25511,6 +25530,9 @@ const countRows = async (within) => {
25511
25530
  return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
25512
25531
  };
25513
25532
  const findRow = async (rowId, within) => {
25533
+ await waitForWrapper(async () => {
25534
+ expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
25535
+ });
25514
25536
  return await findQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
25515
25537
  };
25516
25538
  const queryRow = async (rowId, within) => {