@linzjs/step-ag-grid 30.3.0 → 30.4.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 (32) hide show
  1. package/dist/src/components/gridForm/GridFormInlineTextInput.d.ts +5 -0
  2. package/dist/src/contexts/GridPopoverContext.d.ts +1 -1
  3. package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +2 -2
  4. package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +2 -2
  5. package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +2 -2
  6. package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +2 -2
  7. package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +3 -3
  8. package/dist/src/react-menu3/types.d.ts +1 -1
  9. package/dist/step-ag-grid.cjs +35 -24
  10. package/dist/step-ag-grid.cjs.map +1 -1
  11. package/dist/step-ag-grid.esm.js +35 -24
  12. package/dist/step-ag-grid.esm.js.map +1 -1
  13. package/package.json +2 -2
  14. package/src/components/Grid.tsx +3 -3
  15. package/src/components/gridForm/GridFormInlineTextInput.tsx +9 -1
  16. package/src/contexts/GridContextProvider.tsx +3 -3
  17. package/src/contexts/GridPopoverContext.tsx +2 -2
  18. package/src/contexts/GridUpdatingContextProvider.tsx +10 -7
  19. package/src/lui/reactUtils.tsx +1 -1
  20. package/src/lui/timeoutHook.tsx +1 -1
  21. package/src/react-menu3/components/ControlledMenu.tsx +3 -3
  22. package/src/react-menu3/components/SubMenu.tsx +1 -1
  23. package/src/react-menu3/hooks/useItemState.ts +1 -1
  24. package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +2 -2
  25. package/src/react-menu3/positionUtils/placeArrowVertical.ts +2 -2
  26. package/src/react-menu3/positionUtils/placeLeftorRight.ts +2 -2
  27. package/src/react-menu3/positionUtils/placeToporBottom.ts +2 -2
  28. package/src/react-menu3/positionUtils/positionMenu.ts +3 -3
  29. package/src/react-menu3/types.ts +1 -1
  30. package/src/stories/grid/GridInlineText.stories.tsx +99 -18
  31. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +12 -3
  32. package/src/utils/deferredPromise.ts +2 -2
@@ -10,6 +10,11 @@ export interface GridFormInlineTextInput<TData extends GridBaseRow> extends Text
10
10
  selectedRowIds: TData['id'][];
11
11
  value: string;
12
12
  }) => MaybePromise<boolean>;
13
+ onChange?: (props: {
14
+ selectedRows: TData[];
15
+ selectedRowIds: TData['id'][];
16
+ value: string;
17
+ }) => void;
13
18
  helpText?: string;
14
19
  }
15
20
  export declare const GridFormInlineTextInput: <TData extends GridBaseRow>(props: GridFormInlineTextInput<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { RefObject } from 'react';
2
2
  import { GridBaseRow } from '../components/types';
3
3
  export interface GridPopoverContextType<TData extends GridBaseRow> {
4
- anchorRef: RefObject<Element>;
4
+ anchorRef: RefObject<Element | undefined>;
5
5
  saving: boolean;
6
6
  setSaving: (saving: boolean) => void;
7
7
  stopEditing: () => void;
@@ -1,6 +1,6 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  export declare const placeArrowHorizontal: (p: {
3
- arrowRef: MutableRefObject<HTMLElement | null>;
3
+ arrowRef: RefObject<HTMLElement | undefined>;
4
4
  menuX: number;
5
5
  anchorRect: DOMRect;
6
6
  containerRect: DOMRect;
@@ -1,6 +1,6 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  export declare const placeArrowVertical: (p: {
3
- arrowRef: MutableRefObject<HTMLElement | null>;
3
+ arrowRef: RefObject<HTMLElement | undefined>;
4
4
  menuY: number;
5
5
  anchorRect: DOMRect;
6
6
  containerRect: DOMRect;
@@ -1,4 +1,4 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  import { MenuDirection } from '../types';
3
3
  import { getPositionHelpers } from './getPositionHelpers';
4
4
  export interface placeLeftorRightParams {
@@ -6,7 +6,7 @@ export interface placeLeftorRightParams {
6
6
  placeLeftorRightY: number;
7
7
  placeLeftX: number;
8
8
  placeRightX: number;
9
- arrowRef: MutableRefObject<HTMLElement | null>;
9
+ arrowRef: RefObject<HTMLElement | undefined>;
10
10
  arrow?: boolean;
11
11
  direction: MenuDirection;
12
12
  position: 'auto' | 'anchor' | 'initial';
@@ -1,4 +1,4 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  import { MenuDirection } from '../types';
3
3
  import { getPositionHelpers } from './getPositionHelpers';
4
4
  export interface placeToporBottomParams {
@@ -6,7 +6,7 @@ export interface placeToporBottomParams {
6
6
  placeToporBottomX: number;
7
7
  placeTopY: number;
8
8
  placeBottomY: number;
9
- arrowRef: MutableRefObject<HTMLElement | null>;
9
+ arrowRef: RefObject<HTMLElement | undefined>;
10
10
  arrow?: boolean;
11
11
  direction: 'left' | 'right' | 'top' | 'bottom';
12
12
  position: 'auto' | 'anchor' | 'initial';
@@ -1,11 +1,11 @@
1
- import { MutableRefObject } from 'react';
1
+ import { RefObject } from 'react';
2
2
  import { MenuDirection } from '../types';
3
3
  import { getPositionHelpers } from './getPositionHelpers';
4
4
  interface positionMenuProps {
5
5
  offsetX: number;
6
6
  offsetY: number;
7
- arrowRef: MutableRefObject<HTMLDivElement | null>;
8
- anchorRef: MutableRefObject<Element | null>;
7
+ arrowRef: RefObject<HTMLDivElement | undefined>;
8
+ anchorRef: RefObject<Element | undefined>;
9
9
  arrow?: boolean;
10
10
  direction: MenuDirection;
11
11
  position: 'auto' | 'anchor' | 'initial';
@@ -367,7 +367,7 @@ export interface ControlledMenuProps extends RootMenuProps, ExtraMenuProps {
367
367
  *
368
368
  * *Don't set this prop for context menu*
369
369
  */
370
- anchorRef?: React.RefObject<Element>;
370
+ anchorRef?: React.RefObject<Element | undefined>;
371
371
  skipOpen?: React.MutableRefObject<boolean>;
372
372
  /**
373
373
  * If `true`, the menu list element will gain focus after menu is open.
@@ -58931,7 +58931,7 @@ const MenuListItemContext = React13.createContext({
58931
58931
  const useItemState = (menuItemRef, focusRef, isHovering, isDisabled) => {
58932
58932
  const { submenuCloseDelay } = React13.useContext(ItemSettingsContext);
58933
58933
  const { isParentOpen, isSubmenuOpen, dispatch, updateItems } = React13.useContext(MenuListItemContext);
58934
- const timeoutId = React13.useRef();
58934
+ const timeoutId = React13.useRef(undefined);
58935
58935
  const setHover = () => {
58936
58936
  !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, menuItemRef?.current, 0);
58937
58937
  };
@@ -59824,7 +59824,7 @@ const MenuList = ({ ariaLabel, menuClassName, menuStyle, arrowClassName, arrowSt
59824
59824
  };
59825
59825
 
59826
59826
  const ControlledMenuFr = ({ 'aria-label': ariaLabel, className, containerProps, initialMounted, unmountOnClose, transition, transitionTimeout, boundingBoxRef, boundingBoxPadding, reposition = 'auto', submenuOpenDelay = 300, submenuCloseDelay = 150, skipOpen, viewScroll = 'initial', portal, theming, onItemClick, onClose, saveButtonRef, ...restProps }, externalRef) => {
59827
- const containerRef = React13.useRef();
59827
+ const containerRef = React13.useRef(undefined);
59828
59828
  const scrollNodesRef = React13.useRef({});
59829
59829
  const { anchorRef, state } = restProps;
59830
59830
  const settings = React13.useMemo(() => ({
@@ -59886,8 +59886,8 @@ const ControlledMenuFr = ({ 'aria-label': ariaLabel, className, containerProps,
59886
59886
  ev.stopPropagation();
59887
59887
  }
59888
59888
  }, [isWithinMenu]);
59889
- const lastTabDownEl = React13.useRef();
59890
- const lastEnterDownEl = React13.useRef();
59889
+ const lastTabDownEl = React13.useRef(undefined);
59890
+ const lastEnterDownEl = React13.useRef(undefined);
59891
59891
  const handleKeyboardTabAndEnter = React13.useCallback((isDown) => (ev) => {
59892
59892
  const thisDocument = anchorRef?.current ? anchorRef?.current.ownerDocument : document;
59893
59893
  const activeElement = thisDocument.activeElement;
@@ -60312,7 +60312,7 @@ const SubMenuFr = ({ 'aria-label': ariaLabel, className, disabled, direction, la
60312
60312
  const isDisabled = !!disabled;
60313
60313
  const isOpen = isMenuOpen(state);
60314
60314
  const containerRef = React13.useRef(null);
60315
- const timeoutId = React13.useRef();
60315
+ const timeoutId = React13.useRef(undefined);
60316
60316
  const stopTimer = () => {
60317
60317
  if (timeoutId.current) {
60318
60318
  clearTimeout(timeoutId.current);
@@ -61110,7 +61110,7 @@ maxInitialWidth,
61110
61110
  }, [propStartCellEditing]);
61111
61111
  const { updatedDep, anyUpdating, updatingCols } = React13.useContext(GridUpdatingContext);
61112
61112
  const gridDivRef = React13.useRef(null);
61113
- const lastSelectedIds = React13.useRef();
61113
+ const lastSelectedIds = React13.useRef(undefined);
61114
61114
  const [staleGrid, setStaleGrid] = React13.useState(false);
61115
61115
  const [autoSized, setAutoSized] = React13.useState(false);
61116
61116
  const postSortRows = usePostSortRowsHook({ setStaleGrid });
@@ -61196,7 +61196,7 @@ maxInitialWidth,
61196
61196
  initialContentSizeInProgressRef.current = false;
61197
61197
  }
61198
61198
  }, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns, sizeColumnsToFit]);
61199
- const lastOwnerDocumentRef = React13.useRef();
61199
+ const lastOwnerDocumentRef = React13.useRef(undefined);
61200
61200
  const wasVisibleRef = React13.useRef(false);
61201
61201
  /**
61202
61202
  * Auto-size windows that had deferred auto-size
@@ -61677,7 +61677,7 @@ maxInitialWidth,
61677
61677
  el.classList.remove('ag-row-highlight-below');
61678
61678
  });
61679
61679
  }, []);
61680
- const gridElementRef = React13.useRef();
61680
+ const gridElementRef = React13.useRef(undefined);
61681
61681
  const onRowDragMove = React13.useCallback((event) => {
61682
61682
  if (startDragYRef.current === null) {
61683
61683
  startDragYRef.current = event.y;
@@ -61839,7 +61839,7 @@ const NotAGridValueFormatterCall = {
61839
61839
  };
61840
61840
 
61841
61841
  const GridPopoverContext = React13.createContext({
61842
- anchorRef: { current: null },
61842
+ anchorRef: { current: undefined },
61843
61843
  saving: false,
61844
61844
  setSaving: () => { },
61845
61845
  stopEditing: () => { },
@@ -62321,7 +62321,7 @@ const GridFilterColumnsToggle = ({ saveState = true }) => {
62321
62321
  * but there's no way to enforce that, so it would lead to bugs.
62322
62322
  */
62323
62323
  const useTimeoutHook = () => {
62324
- const timeout = React13.useRef();
62324
+ const timeout = React13.useRef(undefined);
62325
62325
  /**
62326
62326
  * Clear any pending timeouts.
62327
62327
  */
@@ -62511,7 +62511,7 @@ const FormError = (props) => {
62511
62511
  * @param value Value to track.
62512
62512
  */
62513
62513
  const usePrevious = (value) => {
62514
- const ref = React13.useRef();
62514
+ const ref = React13.useRef(undefined);
62515
62515
  React13.useEffect(() => {
62516
62516
  ref.current = value;
62517
62517
  }, [value]);
@@ -63179,7 +63179,14 @@ const GridFormInlineTextInput = (props) => {
63179
63179
  input?.removeEventListener('keydown', tabRecorder, { capture: true });
63180
63180
  };
63181
63181
  }, [tabRecorder]);
63182
- return (jsxRuntime.jsx("div", { className: clsx('GridFormInlineTextInput', invalid() && 'GridFormInlineTextInput-error'), title: String(invalid() ?? ''), children: jsxRuntime.jsx("input", { ref: inputRef, type: 'text', value: value, onChange: (e) => setValue(e.target.value), placeholder: props.placeholder ?? 'Type here', onBlur: () => {
63182
+ return (jsxRuntime.jsx("div", { className: clsx('GridFormInlineTextInput', invalid() && 'GridFormInlineTextInput-error'), title: String(invalid() ?? ''), children: jsxRuntime.jsx("input", { ref: inputRef, type: 'text', value: value, onChange: (e) => {
63183
+ setValue(e.target.value);
63184
+ if (props.onChange) {
63185
+ const selectedRows = getSelectedRows();
63186
+ const selectedRowIds = selectedRows.map((data) => data.id);
63187
+ props.onChange({ selectedRows, selectedRowIds, value: e.target.value });
63188
+ }
63189
+ }, placeholder: props.placeholder ?? 'Type here', onBlur: () => {
63183
63190
  void triggerSave(CloseReason.BLUR);
63184
63191
  }, onKeyUp: (e) => {
63185
63192
  if (e.key === 'Enter') {
@@ -63926,11 +63933,11 @@ const GridContextProvider = (props) => {
63926
63933
  const [gridReady, setGridReady] = React13.useState(false);
63927
63934
  const [quickFilter, _setQuickFilter] = React13.useState('');
63928
63935
  const [invisibleColumnIds, _setInvisibleColumnIds] = React13.useState();
63929
- const testId = React13.useRef();
63936
+ const testId = React13.useRef(undefined);
63930
63937
  const hasExternallySelectedItemsRef = React13.useRef(false);
63931
63938
  const enableMultilineBulkEditRef = React13.useRef(false);
63932
63939
  const idsBeforeUpdate = React13.useRef([]);
63933
- const prePopupFocusedCell = React13.useRef();
63940
+ const prePopupFocusedCell = React13.useRef(undefined);
63934
63941
  const [externallySelectedItemsAreInSync, _setExternallySelectedItemsAreInSync] = React13.useState(false);
63935
63942
  const externalFilters = React13.useRef([]);
63936
63943
  // waitForExternallySelectedItemsToBeInSync can't use the state as it won't be updated during function execution
@@ -64341,7 +64348,7 @@ const GridContextProvider = (props) => {
64341
64348
  startCellEditingInProgressRef.current = false;
64342
64349
  }
64343
64350
  }, [anyUpdating, gridApi, prePopupOps, setExternallySelectedItemsAreInSync, waitForExternallySelectedItemsToBeInSync]);
64344
- const bulkEditingCompleteCallbackRef = React13.useRef();
64351
+ const bulkEditingCompleteCallbackRef = React13.useRef(undefined);
64345
64352
  const onBulkEditingComplete = React13.useCallback(async () => {
64346
64353
  await bulkEditingCompleteCallbackRef.current?.();
64347
64354
  }, []);
@@ -64659,13 +64666,17 @@ const GridUpdatingContextProvider = (props) => {
64659
64666
  const fieldUpdatingIds = updatingBlocks.current[field] ?? (updatingBlocks.current[field] = []);
64660
64667
  fieldUpdatingIds.push(idRef);
64661
64668
  });
64662
- resetUpdating();
64663
- await fn();
64664
- lodashEs.castArray(fields).forEach((field) => {
64665
- const fieldUpdatingIds = updatingBlocks.current[field];
64666
- lodashEs.remove(fieldUpdatingIds, (idList) => idList === idRef);
64667
- });
64668
- resetUpdating();
64669
+ try {
64670
+ resetUpdating();
64671
+ await fn();
64672
+ }
64673
+ finally {
64674
+ lodashEs.castArray(fields).forEach((field) => {
64675
+ const fieldUpdatingIds = updatingBlocks.current[field];
64676
+ lodashEs.remove(fieldUpdatingIds, (idList) => idList === idRef);
64677
+ });
64678
+ resetUpdating();
64679
+ }
64669
64680
  }, [resetUpdating]);
64670
64681
  const anyUpdating = React13.useCallback(() => {
64671
64682
  return !lodashEs.isEmpty(updating.current);
@@ -64713,8 +64724,8 @@ const ActionButton = ({ icon, name, inProgressName, disabled, dataTestId, style,
64713
64724
  };
64714
64725
 
64715
64726
  const useDeferredPromise = () => {
64716
- const promiseResolve = React13.useRef();
64717
- const promiseReject = React13.useRef();
64727
+ const promiseResolve = React13.useRef(undefined);
64728
+ const promiseReject = React13.useRef(undefined);
64718
64729
  // End promise on unload
64719
64730
  React13.useEffect(() => {
64720
64731
  return () => {