@linzjs/step-ag-grid 29.1.1 → 29.1.3

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 (32) hide show
  1. package/dist/src/components/Grid.d.ts +1 -1
  2. package/dist/src/components/GridPopoverHook.d.ts +2 -1
  3. package/dist/src/contexts/GridContext.d.ts +2 -2
  4. package/dist/src/index.d.ts +1 -0
  5. package/dist/src/utils/waitForCondition.d.ts +1 -0
  6. package/dist/step-ag-grid.cjs +89 -65
  7. package/dist/step-ag-grid.cjs.map +1 -1
  8. package/dist/step-ag-grid.esm.js +88 -66
  9. package/dist/step-ag-grid.esm.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/Grid.tsx +1 -1
  12. package/src/components/GridCell.tsx +34 -14
  13. package/src/components/GridPopoverHook.tsx +16 -17
  14. package/src/components/gridForm/GridFormDropDown.tsx +10 -3
  15. package/src/components/gridForm/GridFormMultiSelect.tsx +12 -4
  16. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +1 -0
  17. package/src/contexts/GridContext.tsx +2 -2
  18. package/src/contexts/GridContextProvider.tsx +41 -37
  19. package/src/index.ts +1 -0
  20. package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +1 -1
  21. package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +1 -1
  22. package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +1 -1
  23. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +4 -12
  24. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +5 -11
  25. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +4 -11
  26. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +8 -10
  27. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +5 -11
  28. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +5 -12
  29. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +4 -11
  30. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +4 -11
  31. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +56 -13
  32. package/src/utils/waitForCondition.tsx +17 -0
@@ -65,7 +65,7 @@ export interface GridProps<TData extends GridBaseRow = GridBaseRow> {
65
65
  * When pressing tab whilst editing the grid will select and edit the next cell if available.
66
66
  * Once the last cell to edit closes this callback is called.
67
67
  */
68
- onBulkEditingComplete?: () => void;
68
+ onBulkEditingComplete?: () => Promise<void> | void;
69
69
  /**
70
70
  * Context menu definition if required.
71
71
  */
@@ -6,7 +6,8 @@ export interface GridPopoverHookProps<TData> {
6
6
  save?: (selectedRows: TData[]) => Promise<boolean>;
7
7
  dontSaveOnExternalClick?: boolean;
8
8
  }
9
- export declare const useGridPopoverHook: <TData extends GridBaseRow>(props: GridPopoverHookProps<TData>) => {
9
+ export declare const CancelPromise: () => Promise<boolean>;
10
+ export declare const useGridPopoverHook: <TData extends GridBaseRow>({ className, save, invalid, dontSaveOnExternalClick, }: GridPopoverHookProps<TData>) => {
10
11
  popoverWrapper: (children: ReactElement) => import("react/jsx-runtime").JSX.Element;
11
12
  triggerSave: (reason?: string) => Promise<void>;
12
13
  };
@@ -57,8 +57,8 @@ export interface GridContextType<TData extends GridBaseRow> {
57
57
  invisibleColumnIds: string[] | undefined;
58
58
  setInvisibleColumnIds: (colIds: string[]) => void;
59
59
  downloadCsv: (csvExportParams?: CsvExportParams) => void;
60
- onBulkEditingComplete: () => void;
61
- setOnBulkEditingComplete: (callback: (() => void) | undefined) => void;
60
+ onBulkEditingComplete: () => Promise<void> | void;
61
+ setOnBulkEditingComplete: (callback: (() => Promise<void> | void) | undefined) => void;
62
62
  showNoRowsOverlay: () => void;
63
63
  }
64
64
  export declare const GridContext: import("react").Context<GridContextType<any>>;
@@ -17,3 +17,4 @@ export * from './utils/deferredPromise';
17
17
  export * from './utils/textMatcher';
18
18
  export * from './utils/textValidator';
19
19
  export * from './utils/util';
20
+ export * from './utils/waitForCondition';
@@ -0,0 +1 @@
1
+ export declare const waitForCondition: (error: string, condition: () => boolean, timeoutMs: number) => Promise<boolean>;
@@ -3400,20 +3400,25 @@ const GridCell = (props, custom) => {
3400
3400
  sortable: true,
3401
3401
  resizable: true,
3402
3402
  valueSetter: custom?.editor ? blockValueSetter : undefined,
3403
- editable: props.editable ?? false,
3404
- ...(custom?.editor && {
3405
- cellClassRules: GridCellMultiSelectClassRules,
3406
- editable: props.editable ?? true,
3407
- cellEditor: GenericCellEditorComponentWrapper(custom?.editor),
3408
- }),
3403
+ editable: props.editable ?? !!custom?.editor,
3404
+ ...(custom?.editor
3405
+ ? {
3406
+ cellClassRules: GridCellMultiSelectClassRules,
3407
+ cellEditor: GenericCellEditorComponentWrapper(custom?.editor),
3408
+ }
3409
+ : {
3410
+ cellEditor: CellEditorToBlockEditing,
3411
+ }),
3409
3412
  suppressKeyboardEvent: suppressCellKeyboardEvents,
3410
- ...(custom?.editorParams && {
3411
- cellEditorParams: {
3412
- ...custom.editorParams,
3413
- multiEdit: custom.multiEdit,
3414
- preventAutoEdit: custom.preventAutoEdit ?? false,
3415
- },
3416
- }),
3413
+ ...(custom?.editorParams
3414
+ ? {
3415
+ cellEditorParams: {
3416
+ ...custom.editorParams,
3417
+ multiEdit: custom.multiEdit,
3418
+ preventAutoEdit: custom.preventAutoEdit ?? !custom?.editor,
3419
+ },
3420
+ }
3421
+ : { cellEditorParams: { preventAutoEdit: !custom?.editor } }),
3417
3422
  // If there's a valueFormatter and no filterValueGetter then create a filterValueGetter
3418
3423
  getQuickFilterText: filterValueGetter,
3419
3424
  // Default value formatter, otherwise react freaks out on objects
@@ -3430,6 +3435,19 @@ const GridCell = (props, custom) => {
3430
3435
  },
3431
3436
  };
3432
3437
  };
3438
+ /**
3439
+ * Ag-grid will start its own editor if editable is true and there is no cell editor
3440
+ * like in the case of a cell that is editable because it triggers a modal.
3441
+ * This will block that editor.
3442
+ */
3443
+ const CellEditorToBlockEditing = ({ stopEditing }) => {
3444
+ React.useEffect(() => {
3445
+ lodashEs.defer(() => {
3446
+ stopEditing();
3447
+ });
3448
+ }, [stopEditing]);
3449
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3450
+ };
3433
3451
  const GenericCellEditorComponentWrapper = (editor) => {
3434
3452
  const obj = { editor };
3435
3453
  return React.forwardRef(function GenericCellEditorComponentFr(cellEditorParams, _) {
@@ -3938,8 +3956,8 @@ const textMatch = (text, filter) => {
3938
3956
  negativeFilters.every((superFilter) => values.every((value) => isMatch(value, superFilter)))));
3939
3957
  };
3940
3958
 
3941
- const useGridPopoverHook = (props) => {
3942
- const { onBulkEditingComplete } = useGridContext();
3959
+ const CancelPromise = () => Promise.resolve(true);
3960
+ const useGridPopoverHook = ({ className, save, invalid, dontSaveOnExternalClick, }) => {
3943
3961
  const { anchorRef, saving, updateValue, stopEditing } = useGridPopoverContext();
3944
3962
  const saveButtonRef = React.useRef(null);
3945
3963
  const [isOpen, setOpen] = React.useState(false);
@@ -3948,24 +3966,18 @@ const useGridPopoverHook = (props) => {
3948
3966
  }, []);
3949
3967
  const triggerSave = React.useCallback(async (reason) => {
3950
3968
  if (reason == CloseReason.CANCEL) {
3969
+ await updateValue(CancelPromise, 0);
3951
3970
  stopEditing();
3952
- onBulkEditingComplete();
3953
3971
  return;
3954
3972
  }
3955
- if (props?.invalid?.()) {
3973
+ if (invalid?.()) {
3956
3974
  // Don't close, don't do anything it's invalid
3957
3975
  return;
3958
3976
  }
3959
- if (!props.save) {
3960
- // No save method so just close
3961
- stopEditing();
3962
- onBulkEditingComplete();
3963
- return;
3964
- }
3965
- if (await updateValue(props.save, reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)) {
3977
+ if (await updateValue(save ?? (() => Promise.resolve(true)), reason === CloseReason.TAB_FORWARD ? 1 : reason === CloseReason.TAB_BACKWARD ? -1 : 0)) {
3966
3978
  stopEditing();
3967
3979
  }
3968
- }, [onBulkEditingComplete, props, stopEditing, updateValue]);
3980
+ }, [invalid, save, stopEditing, updateValue]);
3969
3981
  const popoverWrapper = React.useCallback((children) => {
3970
3982
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: anchorRef.current && (jsxRuntime.jsxs(ControlledMenu, { state: isOpen ? 'open' : 'closed', portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: 'step-ag-grid-react-menu', onClose: (event) => {
3971
3983
  // Prevent menu from closing when modals are invoked
@@ -3973,15 +3985,15 @@ const useGridPopoverHook = (props) => {
3973
3985
  return;
3974
3986
  }
3975
3987
  void triggerSave(event.reason);
3976
- }, viewScroll: 'auto', dontShrinkIfDirectionIsTop: true, className: props.className, children: [saving && ( // This is the overlay that prevents editing when the editor is saving
3988
+ }, viewScroll: 'auto', dontShrinkIfDirectionIsTop: true, className: className, children: [saving && ( // This is the overlay that prevents editing when the editor is saving
3977
3989
  jsxRuntime.jsx("div", { className: 'ComponentLoadingWrapper-saveOverlay' })), children, jsxRuntime.jsx("button", { ref: saveButtonRef, "data-reason": '', onClick: (e) => {
3978
3990
  let reason = e.currentTarget.getAttribute('data-reason') ?? undefined;
3979
- if (props.dontSaveOnExternalClick && reason === CloseReason.BLUR) {
3991
+ if (dontSaveOnExternalClick && reason === CloseReason.BLUR) {
3980
3992
  reason = CloseReason.CANCEL;
3981
3993
  }
3982
3994
  void triggerSave(reason);
3983
3995
  }, style: { display: 'none' } })] })) }));
3984
- }, [anchorRef, isOpen, props.className, props.dontSaveOnExternalClick, saving, triggerSave]);
3996
+ }, [anchorRef, isOpen, className, dontSaveOnExternalClick, saving, triggerSave]);
3985
3997
  return {
3986
3998
  popoverWrapper,
3987
3999
  triggerSave,
@@ -3991,7 +4003,7 @@ const useGridPopoverHook = (props) => {
3991
4003
  const primitiveToSelectOption = (value) => {
3992
4004
  return {
3993
4005
  value: value,
3994
- label: value ? String(value) : '',
4006
+ label: value ? String(value) : '-',
3995
4007
  };
3996
4008
  };
3997
4009
  const MenuSeparatorString = '_____MENU_SEPARATOR_____';
@@ -4083,7 +4095,13 @@ const GridFormDropDown = (props) => {
4083
4095
  if (selectedItem === null) {
4084
4096
  if (props.onSelectFilter) {
4085
4097
  const { onSelectFilter } = props;
4086
- await onSelectFilter({ selectedRows, selectedRowIds: selectedRows.map((row) => row.id), value: filter });
4098
+ if (!lodashEs.isEmpty(filter)) {
4099
+ await onSelectFilter({
4100
+ selectedRows,
4101
+ selectedRowIds: selectedRows.map((row) => row.id),
4102
+ value: filter,
4103
+ });
4104
+ }
4087
4105
  return true;
4088
4106
  }
4089
4107
  else {
@@ -4113,7 +4131,7 @@ const GridFormDropDown = (props) => {
4113
4131
  setSubSelectedValue(null);
4114
4132
  subComponentIsValid.current = true;
4115
4133
  }, children: ({ ref }) => (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [jsxRuntime.jsx("input", { className: 'LuiTextInput-input', ref: ref, type: "text", placeholder: props.filterPlaceholder ?? 'Filter...', "data-testid": 'filteredMenu-free-text-input', defaultValue: filter, "data-allowtabtosave": true, "data-disableenterautosave": !props.onSelectFilter &&
4116
- !(filteredValues && filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: (e) => setFilter(e.target.value) }), props.filterHelpText && isNotEmpty(filter) && (jsxRuntime.jsx(FormError, { error: null, helpText: props.filterHelpText }))] })) }), jsxRuntime.jsx(MenuDivider, {}, `$$divider_filter`)] })), jsxRuntime.jsx(ComponentLoadingWrapper, { loading: !options, className: 'GridFormDropDown-options', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [options && (lodashEs.isEmpty(options) || (filteredValues && lodashEs.isEmpty(filteredValues))) && (jsxRuntime.jsx(MenuItem, { className: 'GridPopoverEditDropDown-noOptions', disabled: true, children: props.noOptionsMessage ?? 'No Options' }, `${fieldToString(field)}-empty`)), options?.map((item, index) => {
4134
+ !(filteredValues && filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: (e) => setFilter(e.target.value.trim()) }), props.filterHelpText && isNotEmpty(filter) && (jsxRuntime.jsx(FormError, { error: null, helpText: props.filterHelpText }))] })) }), jsxRuntime.jsx(MenuDivider, {}, `$$divider_filter`)] })), jsxRuntime.jsx(ComponentLoadingWrapper, { loading: !options, className: 'GridFormDropDown-options', children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [options && (lodashEs.isEmpty(options) || (filteredValues && lodashEs.isEmpty(filteredValues))) && (jsxRuntime.jsx(MenuItem, { className: 'GridPopoverEditDropDown-noOptions', disabled: true, children: props.noOptionsMessage ?? 'No Options' }, `${fieldToString(field)}-empty`)), options?.map((item, index) => {
4117
4135
  showHeader = null;
4118
4136
  if (item.value === MenuSeparatorString) {
4119
4137
  return jsxRuntime.jsx(MenuDivider, {}, `$$divider_${index}`);
@@ -4343,11 +4361,13 @@ const GridFormMultiSelect = (props) => {
4343
4361
  props.invalid(selectedRows, options.filter((o) => o.checked)));
4344
4362
  }, [options, props, selectedRows]);
4345
4363
  const save = React.useCallback(async (selectedRows) => {
4346
- if (!options || !props.onSave)
4364
+ if (!options || !props.onSave) {
4347
4365
  return true;
4366
+ }
4348
4367
  // Any changes to save?
4349
- if (initialValues === JSON.stringify(options))
4368
+ if (initialValues === JSON.stringify(options)) {
4350
4369
  return true;
4370
+ }
4351
4371
  return props.onSave({
4352
4372
  selectedRows,
4353
4373
  selectedOptions: options.filter((o) => o.checked),
@@ -4440,8 +4460,9 @@ const FilterInput = (props) => {
4440
4460
  setOptions([...options]);
4441
4461
  }, [filter, headerGroups, options, setOptions]);
4442
4462
  const addCustomFilterValue = React.useCallback(() => {
4443
- if (!options || !onSelectFilter)
4463
+ if (!options || !onSelectFilter) {
4444
4464
  return;
4465
+ }
4445
4466
  const filterTrimmed = filter.trim();
4446
4467
  if (lodashEs.isEmpty(filterTrimmed)) {
4447
4468
  void triggerSave();
@@ -4450,8 +4471,9 @@ const FilterInput = (props) => {
4450
4471
  const preFilterOptions = JSON.stringify(options);
4451
4472
  onSelectFilter({ filter: filterTrimmed, options });
4452
4473
  // Detect if options list changed and update
4453
- if (preFilterOptions === JSON.stringify(options))
4474
+ if (preFilterOptions === JSON.stringify(options)) {
4454
4475
  return;
4476
+ }
4455
4477
  setOptions([...options]);
4456
4478
  setFilter('');
4457
4479
  }, [filter, onSelectFilter, options, setFilter, setOptions, triggerSave]);
@@ -5046,6 +5068,7 @@ const GridPopoverMessage = (colDef, props) => GridCell({
5046
5068
  singleClickEdit: true,
5047
5069
  }, {
5048
5070
  editor: GridFormMessage,
5071
+ preventAutoEdit: true,
5049
5072
  ...props,
5050
5073
  });
5051
5074
 
@@ -5061,6 +5084,18 @@ const GridWrapper = ({ children, maxHeight }) => (jsxRuntime.jsx("div", { classN
5061
5084
  const getColId = (colDef) => colDef.colId ?? '';
5062
5085
  const isFlexColumn = (colDef) => !!colDef.flex && !isGridCellFiller(colDef);
5063
5086
 
5087
+ const waitForCondition = async (error, condition, timeoutMs) => {
5088
+ const endTime = Date.now() + timeoutMs;
5089
+ while (Date.now() < endTime) {
5090
+ if (condition()) {
5091
+ return true;
5092
+ }
5093
+ await wait(100);
5094
+ }
5095
+ console.warn(error);
5096
+ return false;
5097
+ };
5098
+
5064
5099
  /**
5065
5100
  * Context for AgGrid operations.
5066
5101
  * Make sure you wrap AgGrid in this.
@@ -5406,8 +5441,7 @@ const GridContextProvider = (props) => {
5406
5441
  startCellEditingInProgressRef.current = true;
5407
5442
  try {
5408
5443
  // Edit in progress so don't edit until finished, timeout waiting after 5s
5409
- if (!(await waitForCondition(() => !anyUpdating(), 5000))) {
5410
- console.error("Could not start edit because previous edit hasn't finished after 5 seconds");
5444
+ if (!(await waitForCondition('startCellEditing failed as update still in progress, waited for 15 seconds', () => !anyUpdating(), 15000))) {
5411
5445
  return;
5412
5446
  }
5413
5447
  const colDef = gridApi.getColumnDef(colId);
@@ -5429,11 +5463,12 @@ const GridContextProvider = (props) => {
5429
5463
  const rowIndex = rowNode.rowIndex;
5430
5464
  if (rowIndex != null) {
5431
5465
  lodashEs.defer(() => {
5432
- !gridApi.isDestroyed() &&
5466
+ if (!gridApi.isDestroyed()) {
5433
5467
  gridApi.startEditingCell({
5434
5468
  rowIndex,
5435
5469
  colKey: colId,
5436
5470
  });
5471
+ }
5437
5472
  });
5438
5473
  }
5439
5474
  }
@@ -5442,9 +5477,9 @@ const GridContextProvider = (props) => {
5442
5477
  }
5443
5478
  }, [anyUpdating, gridApi, prePopupOps, waitForExternallySelectedItemsToBeInSync]);
5444
5479
  const bulkEditingCompleteCallbackRef = React.useRef();
5445
- const onBulkEditingComplete = React.useCallback(() => {
5480
+ const onBulkEditingComplete = React.useCallback(async () => {
5446
5481
  resetFocusedCellAfterCellEditing();
5447
- bulkEditingCompleteCallbackRef.current?.();
5482
+ await bulkEditingCompleteCallbackRef.current?.();
5448
5483
  }, [resetFocusedCellAfterCellEditing]);
5449
5484
  const setOnBulkEditingComplete = React.useCallback((cellEditingCompleteCallback) => {
5450
5485
  bulkEditingCompleteCallbackRef.current = cellEditingCompleteCallback;
@@ -5475,8 +5510,10 @@ const GridContextProvider = (props) => {
5475
5510
  // Prevent resetting focus to original editing cell
5476
5511
  prePopupFocusedCell.current = undefined;
5477
5512
  const preRow = gridApi.getFocusedCell();
5513
+ // If we don't do this ag-grid will do its own continuation of an edit on tab, we don't want that as
5514
+ // we are managing it ourselves
5515
+ gridApi.stopEditing();
5478
5516
  if (tabDirection === 1) {
5479
- gridApi.stopEditing();
5480
5517
  gridApi.tabToNextCell();
5481
5518
  }
5482
5519
  else {
@@ -5513,29 +5550,25 @@ const GridContextProvider = (props) => {
5513
5550
  const selectedRows = props.selectedRows;
5514
5551
  let ok = false;
5515
5552
  await modifyUpdating(props.field ?? '', selectedRows.map((data) => data.id), async () => {
5516
- // MATT Disabled I don't believe these are needed anymore
5517
- // I've left them here just in case they are
5518
5553
  // Need to refresh to get spinners to work on all rows
5519
- // gridApi.refreshCells({ rowNodes: props.selectedRows as RowNode[], force: true });
5554
+ gridApi.refreshCells({ rowNodes: props.selectedRows, force: true });
5520
5555
  ok = await fnUpdate(selectedRows).catch((ex) => {
5521
5556
  console.error('Exception during modifyUpdating', ex);
5522
5557
  return false;
5523
5558
  });
5524
5559
  });
5525
- // MATT Disabled I don't believe these are needed anymore
5526
- // I've left them here just in case they are
5527
5560
  // async processes need to refresh their own rows
5528
- // gridApi.refreshCells({ rowNodes: selectedRows as RowNode[], force: true });
5561
+ gridApi.refreshCells({ rowNodes: selectedRows, force: true });
5529
5562
  if (gridApi.isDestroyed()) {
5530
5563
  return ok;
5531
5564
  }
5532
5565
  if (ok) {
5533
- const cell = gridApi.getFocusedCell();
5534
- if (cell && gridApi.getFocusedCell() == null) {
5535
- !gridApi.isDestroyed && gridApi.setFocusedCell(cell.rowIndex, cell.column);
5536
- }
5566
+ //const cell = gridApi.getFocusedCell();
5567
+ //if (cell && gridApi.getFocusedCell() == null) {
5568
+ // !gridApi.isDestroyed && gridApi.setFocusedCell(cell.rowIndex, cell.column);
5569
+ // }
5537
5570
  // This is needed to trigger postSortRowsHook
5538
- gridApi.refreshClientSideRowModel();
5571
+ !gridApi.isDestroyed && gridApi.refreshClientSideRowModel();
5539
5572
  }
5540
5573
  void (async () => {
5541
5574
  // Only focus next cell if user hasn't already manually changed focus
@@ -5545,11 +5578,11 @@ const GridContextProvider = (props) => {
5545
5578
  prePopupFocusedCell.current.rowIndex == postPopupFocusedCell.rowIndex &&
5546
5579
  prePopupFocusedCell.current.column.getColId() == postPopupFocusedCell.column.getColId()) {
5547
5580
  if (!tabDirection || !(await selectNextEditableCell(tabDirection))) {
5548
- onBulkEditingComplete();
5581
+ await onBulkEditingComplete();
5549
5582
  }
5550
5583
  }
5551
5584
  else {
5552
- onBulkEditingComplete();
5585
+ await onBulkEditingComplete();
5553
5586
  }
5554
5587
  })();
5555
5588
  return ok;
@@ -5733,17 +5766,6 @@ const downloadCsvUseValueFormattersProcessCellCallback = (params) => {
5733
5766
  // We add an extra encodeToString here just in case valueFormatter is returning non string values
5734
5767
  return encodeToString(result);
5735
5768
  };
5736
- const waitForCondition = async (condition, timeoutMs) => {
5737
- const endTime = Date.now() + timeoutMs;
5738
- while (Date.now() < endTime) {
5739
- if (condition()) {
5740
- return true;
5741
- }
5742
- await wait(100);
5743
- }
5744
- console.warn('waitForCondition failed');
5745
- return false;
5746
- };
5747
5769
 
5748
5770
  const GridUpdatingContextProvider = (props) => {
5749
5771
  const updatingBlocks = React.useRef({});
@@ -5872,6 +5894,7 @@ const useDeferredPromise = () => {
5872
5894
  };
5873
5895
 
5874
5896
  exports.ActionButton = ActionButton;
5897
+ exports.CancelPromise = CancelPromise;
5875
5898
  exports.ComponentLoadingWrapper = ComponentLoadingWrapper;
5876
5899
  exports.ControlledMenu = ControlledMenu;
5877
5900
  exports.Editor = Editor;
@@ -5973,4 +5996,5 @@ exports.useGridPopoverHook = useGridPopoverHook;
5973
5996
  exports.useMenuState = useMenuState;
5974
5997
  exports.usePostSortRowsHook = usePostSortRowsHook;
5975
5998
  exports.wait = wait;
5999
+ exports.waitForCondition = waitForCondition;
5976
6000
  //# sourceMappingURL=step-ag-grid.cjs.map