@linzjs/step-ag-grid 17.0.7 → 17.1.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.
@@ -3780,6 +3780,7 @@ const GridFormMultiSelect = (props) => {
3780
3780
  const { selectedRows, data } = useGridPopoverContext();
3781
3781
  const subComponentIsValidRef = React.useRef({});
3782
3782
  const optionsInitialising = React.useRef(false);
3783
+ const firstInputSubComponent = React.useRef(null);
3783
3784
  const [filter, setFilter] = React.useState("");
3784
3785
  const [initialValues, setInitialValues] = React.useState("");
3785
3786
  const [options, setOptions] = React.useState();
@@ -3855,7 +3856,12 @@ const GridFormMultiSelect = (props) => {
3855
3856
  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
3857
  (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
3858
  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}`)));
3859
+ 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: () => {
3860
+ // Default to focus on first input in subComponent
3861
+ lodashEs.defer(() => {
3862
+ firstInputSubComponent.current?.focus();
3863
+ });
3864
+ } }), item.checked && item.subComponent && (jsxRuntime.jsx(MenuSubComponent, { ...{ item, options, setOptions, data, triggerSave }, ref: firstInputSubComponent, subComponentIsValid: subComponentIsValidRef.current }))] }, `val_${item.value}`)))] }, `group_${index}`)));
3859
3865
  }) }))] })) }));
3860
3866
  };
3861
3867
  const FilterInput = (props) => {
@@ -3944,6 +3950,7 @@ const MenuRadioItem = (props) => {
3944
3950
  e.keepOpen = true;
3945
3951
  toggleValue(item);
3946
3952
  }
3953
+ item.checked && props.onChecked && props.onChecked();
3947
3954
  }, 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
3955
  onClick: (e) => {
3949
3956
  // Click is handled by MenuItem onClick
@@ -3954,9 +3961,22 @@ const MenuRadioItem = (props) => {
3954
3961
  /*Do nothing, change handled by menuItem*/
3955
3962
  } }) }));
3956
3963
  };
3957
- const MenuSubComponent = (props) => {
3964
+ const MenuSubComponent = React.forwardRef(MenuSubComponentFr);
3965
+ function MenuSubComponentFr(props, ref) {
3958
3966
  const { data, item, options, setOptions, subComponentIsValid, triggerSave } = props;
3959
- return (jsxRuntime.jsx(FocusableItem, { className: "LuiDeprecatedForms", children: () => (jsxRuntime.jsx(GridSubComponentContext.Provider, { value: {
3967
+ const focusableRef = React.useRef(null);
3968
+ React.useEffect(() => {
3969
+ if (focusableRef.current) {
3970
+ const firstInputElement = focusableRef.current.querySelectorAll("input")[0] ?? null;
3971
+ if (typeof ref === "function") {
3972
+ ref(firstInputElement);
3973
+ }
3974
+ else if (ref) {
3975
+ ref.current = firstInputElement;
3976
+ }
3977
+ }
3978
+ }, [ref]);
3979
+ return (jsxRuntime.jsx(FocusableItem, { className: "LuiDeprecatedForms", ref: focusableRef, children: () => (jsxRuntime.jsx(GridSubComponentContext.Provider, { value: {
3960
3980
  context: { options },
3961
3981
  data,
3962
3982
  value: item.subValue,
@@ -3969,7 +3989,7 @@ const MenuSubComponent = (props) => {
3969
3989
  },
3970
3990
  triggerSave,
3971
3991
  }, children: jsxRuntime.jsx("div", { className: "subComponent", children: item.subComponent && jsxRuntime.jsx(item.subComponent, {}) }) })) }, `${item.value}_subcomponent`));
3972
- };
3992
+ }
3973
3993
 
3974
3994
  const GridFormMultiSelectGrid = (props) => {
3975
3995
  const { selectedRows } = useGridPopoverContext();