@linzjs/step-ag-grid 17.0.7 → 17.2.0

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.
@@ -1,6 +1,6 @@
1
1
  import { ForwardedRef, MutableRefObject } from "react";
2
2
  import { ControlledMenuProps } from "../types";
3
- export declare const ControlledMenuFr: ({ "aria-label": ariaLabel, className, containerProps, initialMounted, unmountOnClose, transition, transitionTimeout, boundingBoxRef, boundingBoxPadding, reposition, submenuOpenDelay, submenuCloseDelay, skipOpen, viewScroll, portal, theming, onItemClick, onClose, saveButtonRef, closeMenuExclusionClassName, ...restProps }: ControlledMenuProps & {
3
+ export declare const ControlledMenuFr: ({ "aria-label": ariaLabel, className, containerProps, initialMounted, unmountOnClose, transition, transitionTimeout, boundingBoxRef, boundingBoxPadding, reposition, submenuOpenDelay, submenuCloseDelay, skipOpen, viewScroll, portal, theming, onItemClick, onClose, saveButtonRef, ...restProps }: ControlledMenuProps & {
4
4
  saveButtonRef?: MutableRefObject<HTMLButtonElement | null> | undefined;
5
5
  }, externalRef: ForwardedRef<HTMLUListElement>) => import("react/jsx-runtime").JSX.Element | null;
6
6
  export declare const ControlledMenu: import("react").ForwardRefExoticComponent<Omit<ControlledMenuProps & {
@@ -397,9 +397,5 @@ export interface ControlledMenuProps extends RootMenuProps, ExtraMenuProps {
397
397
  * Event fired when menu is about to close.
398
398
  */
399
399
  onClose?: EventHandler<MenuCloseEvent>;
400
- /**
401
- * When clicking outside the menu to close, anything with this class will not cause a close.
402
- */
403
- closeMenuExclusionClassName?: string;
404
400
  }
405
401
  export {};
@@ -1709,7 +1709,7 @@ const MenuList = ({ ariaLabel, menuClassName, menuStyle, arrowClassName, arrowSt
1709
1709
  }, ref: arrowRef })), jsxRuntime.jsx(MenuListContext.Provider, { value: listContext, children: jsxRuntime.jsx(MenuListItemContext.Provider, { value: itemContext, children: jsxRuntime.jsx(HoverItemContext.Provider, { value: hoverItem, children: children }) }) })] }));
1710
1710
  };
1711
1711
 
1712
- 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, closeMenuExclusionClassName, ...restProps }, externalRef) => {
1712
+ 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) => {
1713
1713
  const containerRef = React.useRef();
1714
1714
  const scrollNodesRef = React.useRef({});
1715
1715
  const { anchorRef, state } = restProps;
@@ -1736,8 +1736,7 @@ const ControlledMenuFr = ({ "aria-label": ariaLabel, className, containerProps,
1736
1736
  reposition,
1737
1737
  viewScroll,
1738
1738
  ]);
1739
- const isWithinMenu = React.useCallback((target) => hasParentClass("szh-menu--state-open", target) ||
1740
- (closeMenuExclusionClassName && hasParentClass(closeMenuExclusionClassName, target)), [closeMenuExclusionClassName]);
1739
+ const isWithinMenu = React.useCallback((target) => hasParentClass("szh-menu--state-open", target), []);
1741
1740
  const handleScreenEventForSave = React.useCallback((ev) => {
1742
1741
  if (!isWithinMenu(ev.target)) {
1743
1742
  ev.preventDefault();
@@ -3429,7 +3428,7 @@ const useGridPopoverHook = (props) => {
3429
3428
  if (event.reason === CloseReason.BLUR)
3430
3429
  return;
3431
3430
  triggerSave(event.reason).then();
3432
- }, viewScroll: "auto", dontShrinkIfDirectionIsTop: true, className: props.className, closeMenuExclusionClassName: "ReactModal__Content", children: [saving && ( // This is the overlay that prevents editing when the editor is saving
3431
+ }, viewScroll: "auto", dontShrinkIfDirectionIsTop: true, className: props.className, children: [saving && ( // This is the overlay that prevents editing when the editor is saving
3433
3432
  jsxRuntime.jsx("div", { className: "ComponentLoadingWrapper-saveOverlay" })), children, jsxRuntime.jsx("button", { ref: saveButtonRef, "data-reason": "", onClick: (e) => {
3434
3433
  let reason = e.currentTarget.getAttribute("data-reason") ?? undefined;
3435
3434
  if (props.dontSaveOnExternalClick && reason === CloseReason.BLUR) {
@@ -3780,6 +3779,7 @@ const GridFormMultiSelect = (props) => {
3780
3779
  const { selectedRows, data } = useGridPopoverContext();
3781
3780
  const subComponentIsValidRef = React.useRef({});
3782
3781
  const optionsInitialising = React.useRef(false);
3782
+ const firstInputSubComponent = React.useRef(null);
3783
3783
  const [filter, setFilter] = React.useState("");
3784
3784
  const [initialValues, setInitialValues] = React.useState("");
3785
3785
  const [options, setOptions] = React.useState();
@@ -3855,7 +3855,12 @@ const GridFormMultiSelect = (props) => {
3855
3855
  return popoverWrapper(jsxRuntime.jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormMultiSelect-container", children: options && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.filtered && (jsxRuntime.jsx(FilterInput, { ...{ headerGroups, options, setOptions, filter, setFilter, triggerSave }, filterHelpText: props.filterHelpText, onSelectFilter: props.onSelectFilter, filterPlaceholder: props.filterPlaceholder })), headerGroups &&
3856
3856
  (lodashEs.isEmpty(headerGroups) || !lodashEs.toPairs(headerGroups).some(([_, options]) => !lodashEs.isEmpty(options))) && (jsxRuntime.jsx(MenuItem, { className: "GridMultiSelect-noOptions", disabled: true, children: props.noOptionsMessage ?? "No Options" }, "noOptions")), headerGroups && !lodashEs.isEmpty(headerGroups) && (jsxRuntime.jsx("div", { className: "GridFormMultiSelect-options", children: headers.map((header, index) => {
3857
3857
  const subOptions = headerGroups[`${header.filter}`];
3858
- return (!lodashEs.isEmpty(subOptions) && (jsxRuntime.jsxs(React.Fragment, { children: [header.header && jsxRuntime.jsx(MenuHeader, { children: header.header }), subOptions.map((item, index) => item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, `div_${index}`)) : (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(MenuRadioItem, { item: item, options: options, setOptions: setOptions }), item.checked && item.subComponent && (jsxRuntime.jsx(MenuSubComponent, { ...{ item, options, setOptions, data, triggerSave }, subComponentIsValid: subComponentIsValidRef.current }))] }, `val_${item.value}`)))] }, `group_${index}`)));
3858
+ return (!lodashEs.isEmpty(subOptions) && (jsxRuntime.jsxs(React.Fragment, { children: [header.header && jsxRuntime.jsx(MenuHeader, { children: header.header }), subOptions.map((item, index) => item.value === MenuSeparatorString ? (jsxRuntime.jsx(MenuDivider, {}, `div_${index}`)) : (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx(MenuRadioItem, { item: item, options: options, setOptions: setOptions, onChecked: () => {
3859
+ // Default to focus on first input in subComponent
3860
+ lodashEs.defer(() => {
3861
+ firstInputSubComponent.current?.focus();
3862
+ });
3863
+ } }), item.checked && item.subComponent && (jsxRuntime.jsx(MenuSubComponent, { ...{ item, options, setOptions, data, triggerSave }, ref: firstInputSubComponent, subComponentIsValid: subComponentIsValidRef.current }))] }, `val_${item.value}`)))] }, `group_${index}`)));
3859
3864
  }) }))] })) }));
3860
3865
  };
3861
3866
  const FilterInput = (props) => {
@@ -3944,6 +3949,7 @@ const MenuRadioItem = (props) => {
3944
3949
  e.keepOpen = true;
3945
3950
  toggleValue(item);
3946
3951
  }
3952
+ item.checked && props.onChecked && props.onChecked();
3947
3953
  }, children: jsxRuntime.jsx(lui.LuiCheckboxInput, { isChecked: item.checked ?? false, value: `${item.value}`, label: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.warning && jsxRuntime.jsx(GridIcon, { icon: "ic_warning_outline", title: item.warning }), item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)] }), inputProps: {
3948
3954
  onClick: (e) => {
3949
3955
  // Click is handled by MenuItem onClick
@@ -3954,9 +3960,22 @@ const MenuRadioItem = (props) => {
3954
3960
  /*Do nothing, change handled by menuItem*/
3955
3961
  } }) }));
3956
3962
  };
3957
- const MenuSubComponent = (props) => {
3963
+ const MenuSubComponent = React.forwardRef(MenuSubComponentFr);
3964
+ function MenuSubComponentFr(props, ref) {
3958
3965
  const { data, item, options, setOptions, subComponentIsValid, triggerSave } = props;
3959
- return (jsxRuntime.jsx(FocusableItem, { className: "LuiDeprecatedForms", children: () => (jsxRuntime.jsx(GridSubComponentContext.Provider, { value: {
3966
+ const focusableRef = React.useRef(null);
3967
+ React.useEffect(() => {
3968
+ if (focusableRef.current) {
3969
+ const firstInputElement = focusableRef.current.querySelectorAll("input")[0] ?? null;
3970
+ if (typeof ref === "function") {
3971
+ ref(firstInputElement);
3972
+ }
3973
+ else if (ref) {
3974
+ ref.current = firstInputElement;
3975
+ }
3976
+ }
3977
+ }, [ref]);
3978
+ return (jsxRuntime.jsx(FocusableItem, { className: "LuiDeprecatedForms", ref: focusableRef, children: () => (jsxRuntime.jsx(GridSubComponentContext.Provider, { value: {
3960
3979
  context: { options },
3961
3980
  data,
3962
3981
  value: item.subValue,
@@ -3969,7 +3988,7 @@ const MenuSubComponent = (props) => {
3969
3988
  },
3970
3989
  triggerSave,
3971
3990
  }, children: jsxRuntime.jsx("div", { className: "subComponent", children: item.subComponent && jsxRuntime.jsx(item.subComponent, {}) }) })) }, `${item.value}_subcomponent`));
3972
- };
3991
+ }
3973
3992
 
3974
3993
  const GridFormMultiSelectGrid = (props) => {
3975
3994
  const { selectedRows } = useGridPopoverContext();