@linzjs/step-ag-grid 21.2.1 → 22.0.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.
- package/dist/GridTheme.scss +4 -0
- package/dist/src/components/Grid.d.ts +2 -1
- package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuItem.d.ts +1 -1
- package/dist/src/react-menu3/components/SubMenu.d.ts +1 -1
- package/dist/src/react-menu3/utils/withHovering.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +8 -7
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +28 -27
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +31 -31
- package/src/components/Grid.tsx +13 -9
- package/src/components/GridCell.tsx +1 -1
- package/src/components/PostSortRowsHook.ts +2 -2
- package/src/react-menu3/utils/withHovering.tsx +15 -8
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +18 -15
- package/src/styles/GridTheme.scss +4 -0
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { LuiMiniSpinner, LuiStatusSpinner, LuiIcon, LuiButton, LuiCheckboxInput, LuiButtonGroup } from '@linzjs/lui';
|
|
3
3
|
import { RowHighlightPosition } from 'ag-grid-community';
|
|
4
4
|
import { AgGridReact } from 'ag-grid-react';
|
|
5
5
|
import { negate, isEmpty, findIndex, defer as defer$1, debounce as debounce$1, xorBy, last, difference, omit, sortBy, delay, partition, pick, groupBy, fromPairs, toPairs, isEqual, compact, filter, sumBy, pull, remove, castArray, flatten } from 'lodash-es';
|
|
6
|
-
import React, { useRef, useEffect, useLayoutEffect, createContext, useContext, forwardRef, useCallback, useState, useMemo, memo, useReducer, cloneElement, useImperativeHandle, Fragment } from 'react';
|
|
6
|
+
import React, { useRef, useEffect, useLayoutEffect, createContext, useContext, forwardRef, useCallback, useState, useMemo, memo, useReducer, cloneElement, useImperativeHandle, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -334,9 +334,9 @@ const usePostSortRowsHook = ({ setStaleGrid }) => {
|
|
|
334
334
|
}
|
|
335
335
|
const newSortOrder = JSON.stringify(copyCurrentSortSettings());
|
|
336
336
|
let sortOrderChanged = newSortOrder != lastSortOrderHash.current;
|
|
337
|
-
const quickFilter = api.
|
|
337
|
+
const quickFilter = api.getQuickFilter();
|
|
338
338
|
if (previousQuickFilter.current != quickFilter) {
|
|
339
|
-
previousQuickFilter.current = quickFilter;
|
|
339
|
+
previousQuickFilter.current = quickFilter ?? "";
|
|
340
340
|
sortOrderChanged = true;
|
|
341
341
|
}
|
|
342
342
|
if (isEmpty(previousRowSortIndex)) {
|
|
@@ -658,7 +658,7 @@ const withHovering = (name, WrappedComponent) => {
|
|
|
658
658
|
const Component = memo(WrappedComponent);
|
|
659
659
|
const WithHovering = forwardRef((props, ref) => {
|
|
660
660
|
const menuItemRef = useRef(null);
|
|
661
|
-
return (jsx(Component, { ...props, menuItemRef: menuItemRef, externalRef: ref, isHovering: useContext(HoverItemContext) === menuItemRef.current }));
|
|
661
|
+
return (jsx(Fragment, { children: jsx(Component, { ...props, menuItemRef: menuItemRef, externalRef: ref, isHovering: useContext(HoverItemContext) === menuItemRef.current }) }));
|
|
662
662
|
});
|
|
663
663
|
WithHovering.displayName = `WithHovering(${name})`;
|
|
664
664
|
return WithHovering;
|
|
@@ -1993,7 +1993,7 @@ function MenuFr({ "aria-label": ariaLabel, menuButton, instanceRef, onMenuChange
|
|
|
1993
1993
|
openMenu,
|
|
1994
1994
|
closeMenu: () => toggleMenu(false),
|
|
1995
1995
|
}));
|
|
1996
|
-
return (jsxs(Fragment, { children: [renderButton, jsx(ControlledMenu, { ...restProps, ...stateProps, "aria-label": ariaLabel || (typeof button.props.children === "string" ? button.props.children : "Menu"), anchorRef: buttonRef, ref: externalRef, onClose: handleClose, skipOpen: skipOpen })] }));
|
|
1996
|
+
return (jsxs(Fragment$1, { children: [renderButton, jsx(ControlledMenu, { ...restProps, ...stateProps, "aria-label": ariaLabel || (typeof button.props.children === "string" ? button.props.children : "Menu"), anchorRef: buttonRef, ref: externalRef, onClose: handleClose, skipOpen: skipOpen })] }));
|
|
1997
1997
|
}
|
|
1998
1998
|
const Menu = forwardRef(MenuFr);
|
|
1999
1999
|
|
|
@@ -2329,14 +2329,14 @@ const useGridContextMenu = ({ contextMenuSelectRow, contextMenu: ContextMenu, })
|
|
|
2329
2329
|
return {
|
|
2330
2330
|
openMenu,
|
|
2331
2331
|
cellContextMenu,
|
|
2332
|
-
component: ContextMenu ? (jsx(Fragment
|
|
2332
|
+
component: ContextMenu ? (jsx(Fragment, { children: jsx(ControlledMenu, { anchorPoint: anchorPoint, state: isOpen ? "open" : "closed", direction: "right", onClose: closeMenu, children: isOpen && (jsx(ContextMenu, { selectedRows: selectedRowsRef.current, clickedRow: clickedRowRef.current, colDef: clickedColDefRef.current, close: closeMenu })) }) })) : null,
|
|
2333
2333
|
};
|
|
2334
2334
|
};
|
|
2335
2335
|
|
|
2336
2336
|
/**
|
|
2337
2337
|
* Wrapper for AgGrid to add commonly used functionality.
|
|
2338
2338
|
*/
|
|
2339
|
-
const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, singleClickEdit = false, rowData, rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 : 40, ...params }) => {
|
|
2339
|
+
const Grid = ({ "data-testid": dataTestId, defaultPostSort = true, rowSelection = "multiple", suppressColumnVirtualization = true, theme = "ag-theme-step-default", sizeColumns = "auto", selectColumnPinned = null, contextMenuSelectRow = false, singleClickEdit = false, rowData, rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 : 40, ...params }) => {
|
|
2340
2340
|
const { gridReady, gridRenderState, setApis, ensureRowVisible, getFirstRowId, selectRowsById, focusByRowById, ensureSelectedRowIsVisible, autoSizeColumns, sizeColumnsToFit, externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync, isExternalFilterPresent, doesExternalFilterPass, setOnCellEditingComplete, getColDef, showNoRowsOverlay, prePopupOps, stopEditing, } = useContext(GridContext);
|
|
2341
2341
|
const { checkUpdating, updatedDep, updatingCols } = useContext(GridUpdatingContext);
|
|
2342
2342
|
const gridDivRef = useRef(null);
|
|
@@ -2539,6 +2539,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2539
2539
|
exportable: false,
|
|
2540
2540
|
},
|
|
2541
2541
|
checkboxSelection: params.selectable,
|
|
2542
|
+
headerClass: params.onRowDragEnd ? "ag-header-select-draggable" : undefined,
|
|
2542
2543
|
headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
|
|
2543
2544
|
suppressHeaderKeyboardEvent: (e) => {
|
|
2544
2545
|
if (!params.selectable)
|
|
@@ -2811,13 +2812,13 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2811
2812
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
2812
2813
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
2813
2814
|
const headerRowCount = columnDefs.some((c) => c.children) ? 2 : 1;
|
|
2814
|
-
return (jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, "theme-specific", staleGrid && "Grid-sortIsStale", gridReady && rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, {
|
|
2815
|
+
return (jsxs("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, "theme-specific", staleGrid && "Grid-sortIsStale", gridReady && rowData && autoSized && "Grid-ready"), children: [gridContextMenu.component, jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { rowHeight: rowHeight, animateRows: params.animateRows ?? false, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
|
|
2815
2816
|
setInitialContentSize();
|
|
2816
2817
|
}, onRowDataUpdated: onRowDataChanged, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: { minWidth: 48, ...omit(params.defaultColDef, ["editable"]) }, columnDefs: columnDefsAdjusted, rowData: rowData, noRowsOverlayComponent: (event) => {
|
|
2817
2818
|
let rowCount = 0;
|
|
2818
2819
|
event.api.forEachNode(() => rowCount++);
|
|
2819
2820
|
return (jsx(GridNoRowsOverlay, { loading: !rowData || params.loading === true, rowCount: rowCount, headerRowHeight: headerRowCount * rowHeight, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText, noRowsMatchingOverlayText: params.noRowsMatchingOverlayText }));
|
|
2820
|
-
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, onRowDragLeave: onRowDragLeave, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData }) })] }));
|
|
2821
|
+
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, onRowDragLeave: onRowDragLeave, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData }) })] }));
|
|
2821
2822
|
};
|
|
2822
2823
|
|
|
2823
2824
|
const GridPopoverContext = createContext({
|
|
@@ -2897,14 +2898,14 @@ const GridCellRenderer = (props) => {
|
|
|
2897
2898
|
warningText = warningText.join("\n");
|
|
2898
2899
|
if (Array.isArray(infoText))
|
|
2899
2900
|
infoText = infoText.join("\n");
|
|
2900
|
-
return checkUpdating(colDef.field ?? colDef.colId ?? "", props.data.id) ? (jsx(GridLoadableCell, {})) : (jsxs(Fragment
|
|
2901
|
+
return checkUpdating(colDef.field ?? colDef.colId ?? "", props.data.id) ? (jsx(GridLoadableCell, {})) : (jsxs(Fragment, { children: [!!warningText && (jsx(GridIcon, { icon: "ic_warning_outline", title: typeof warningText === "string" ? warningText : "Warning" })), !!infoText && jsx(GridIcon, { icon: "ic_info_outline", title: typeof infoText === "string" ? infoText : "Info" }), jsx("div", { className: "GridCell-container", children: colDef.cellRendererParams?.originalCellRenderer ? (jsx(colDef.cellRendererParams.originalCellRenderer, { ...props })) : (jsx("span", { title: props.valueFormatted ?? undefined, children: props.valueFormatted })) }), fnOrVar(colDef.editable, props) && rendererParams?.rightHoverElement && (jsx("div", { className: "GridCell-hoverRight", children: rendererParams?.rightHoverElement }))] }));
|
|
2901
2902
|
};
|
|
2902
2903
|
const suppressCellKeyboardEvents = (e) => {
|
|
2903
2904
|
const shortcutKeys = e.colDef.cellRendererParams?.shortcutKeys ?? {};
|
|
2904
2905
|
const exec = shortcutKeys[e.event.key];
|
|
2905
2906
|
if (exec && !e.editing && !e.event.repeat && e.event.type === "keydown") {
|
|
2906
2907
|
const editable = fnOrVar(e.colDef?.editable, e);
|
|
2907
|
-
return editable ? exec(e) ?? true : true;
|
|
2908
|
+
return editable ? (exec(e) ?? true) : true;
|
|
2908
2909
|
}
|
|
2909
2910
|
// It's important that aggrid doesn't trigger edit on enter
|
|
2910
2911
|
// as the incorrect selected rows will be returned
|
|
@@ -3325,7 +3326,7 @@ var css_248z$2 = ".FormError-helpText{color:#6b6966;font-size:.75rem;font-weight
|
|
|
3325
3326
|
styleInject(css_248z$2);
|
|
3326
3327
|
|
|
3327
3328
|
const FormError = (props) => {
|
|
3328
|
-
return (jsxs(Fragment
|
|
3329
|
+
return (jsxs(Fragment, { children: [props.error && (jsx("span", { className: "LuiTextInput-error", style: { paddingLeft: 0 }, children: props.error })), props.helpText && !props.error && jsx("span", { className: "FormError-helpText", children: props.helpText })] }));
|
|
3329
3330
|
};
|
|
3330
3331
|
|
|
3331
3332
|
function escapeStringRegexp(string) {
|
|
@@ -3513,7 +3514,7 @@ const useGridPopoverHook = (props) => {
|
|
|
3513
3514
|
}
|
|
3514
3515
|
}, [cancelEdit, props, stopEditing, updateValue]);
|
|
3515
3516
|
const popoverWrapper = useCallback((children) => {
|
|
3516
|
-
return (jsx(Fragment
|
|
3517
|
+
return (jsx(Fragment, { children: anchorRef.current && (jsxs(ControlledMenu, { state: isOpen ? "open" : "closed", portal: true, unmountOnClose: true, anchorRef: anchorRef, saveButtonRef: saveButtonRef, menuClassName: "step-ag-grid-react-menu", onClose: (event) => {
|
|
3517
3518
|
// Prevent menu from closing when modals are invoked
|
|
3518
3519
|
if (event.reason === CloseReason.BLUR)
|
|
3519
3520
|
return;
|
|
@@ -3649,19 +3650,19 @@ const GridFormDropDown = (props) => {
|
|
|
3649
3650
|
});
|
|
3650
3651
|
let lastHeader = null;
|
|
3651
3652
|
let showHeader = null;
|
|
3652
|
-
return popoverWrapper(jsxs(Fragment
|
|
3653
|
+
return popoverWrapper(jsxs(Fragment, { children: [props.filtered && (jsxs("div", { className: "GridFormDropDown-filter", children: [jsx(FocusableItem, { className: "filter-item", onFocus: () => {
|
|
3653
3654
|
setSelectedItem(null);
|
|
3654
3655
|
setSubSelectedValue(null);
|
|
3655
3656
|
subComponentIsValid.current = true;
|
|
3656
3657
|
}, children: ({ ref }) => (jsxs("div", { style: { display: "flex", flexDirection: "column", width: "100%" }, children: [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 &&
|
|
3657
|
-
!(filteredValues && filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: (e) => setFilter(e.target.value) }), props.filterHelpText && isNotEmpty(filter) && (jsx(FormError, { error: null, helpText: props.filterHelpText }))] })) }), jsx(MenuDivider, {}, `$$divider_filter`)] })), jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormDropDown-options", children: jsxs(Fragment
|
|
3658
|
+
!(filteredValues && filteredValues.length === 1 && !filteredValues[0].subComponent), onChange: (e) => setFilter(e.target.value) }), props.filterHelpText && isNotEmpty(filter) && (jsx(FormError, { error: null, helpText: props.filterHelpText }))] })) }), jsx(MenuDivider, {}, `$$divider_filter`)] })), jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormDropDown-options", children: jsxs(Fragment, { children: [options && (isEmpty(options) || (filteredValues && isEmpty(filteredValues))) && (jsx(MenuItem, { className: "GridPopoverEditDropDown-noOptions", disabled: true, children: props.noOptionsMessage ?? "No Options" }, `${fieldToString(field)}-empty`)), options?.map((item, index) => {
|
|
3658
3659
|
showHeader = null;
|
|
3659
3660
|
if (item.value === MenuSeparatorString) {
|
|
3660
3661
|
return jsx(MenuDivider, {}, `$$divider_${index}`);
|
|
3661
3662
|
}
|
|
3662
3663
|
else if (item.value === MenuHeaderString) {
|
|
3663
3664
|
lastHeader = jsx(MenuHeader, { children: item.label }, `$$header_${index}`);
|
|
3664
|
-
return jsx(Fragment
|
|
3665
|
+
return jsx(Fragment, {});
|
|
3665
3666
|
}
|
|
3666
3667
|
else {
|
|
3667
3668
|
if (lastHeader) {
|
|
@@ -3669,7 +3670,7 @@ const GridFormDropDown = (props) => {
|
|
|
3669
3670
|
lastHeader = null;
|
|
3670
3671
|
}
|
|
3671
3672
|
}
|
|
3672
|
-
return ((!filteredValues || filteredValues.includes(item)) && (jsxs(Fragment, { children: [showHeader, jsxs("div", { children: [jsxs(MenuItem, { disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: () => {
|
|
3673
|
+
return ((!filteredValues || filteredValues.includes(item)) && (jsxs(Fragment$1, { children: [showHeader, jsxs("div", { children: [jsxs(MenuItem, { disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", value: item.value, onFocus: () => {
|
|
3673
3674
|
if (selectedItem !== item) {
|
|
3674
3675
|
setSelectedItem(item);
|
|
3675
3676
|
setSubSelectedValue(null);
|
|
@@ -3862,7 +3863,7 @@ const GridFormMessage = (props) => {
|
|
|
3862
3863
|
setMessage(await props.message(selectedRows));
|
|
3863
3864
|
})().then();
|
|
3864
3865
|
}, [props, selectedRows]);
|
|
3865
|
-
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: message === null, className: clsx("GridFormMessage-container", props.className), children: jsx(Fragment
|
|
3866
|
+
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: message === null, className: clsx("GridFormMessage-container", props.className), children: jsx(Fragment, { children: message }) }));
|
|
3866
3867
|
};
|
|
3867
3868
|
|
|
3868
3869
|
const GridFormMultiSelect = (props) => {
|
|
@@ -3942,10 +3943,10 @@ const GridFormMultiSelect = (props) => {
|
|
|
3942
3943
|
invalid,
|
|
3943
3944
|
save,
|
|
3944
3945
|
});
|
|
3945
|
-
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormMultiSelect-container", children: options && (jsxs(Fragment
|
|
3946
|
+
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormMultiSelect-container", children: options && (jsxs(Fragment, { children: [props.filtered && (jsx(FilterInput, { headerGroups, options, setOptions, filter, setFilter, triggerSave, filterHelpText: props.filterHelpText, onSelectFilter: props.onSelectFilter, filterPlaceholder: props.filterPlaceholder })), headerGroups &&
|
|
3946
3947
|
(isEmpty(headerGroups) || !toPairs(headerGroups).some(([_, options]) => !isEmpty(options))) && (jsx(MenuItem, { className: "GridMultiSelect-noOptions", disabled: true, children: props.noOptionsMessage ?? "No Options" }, "noOptions")), headerGroups && !isEmpty(headerGroups) && (jsx("div", { className: "GridFormMultiSelect-options", children: headers.map((header, index) => {
|
|
3947
3948
|
const subOptions = headerGroups[`${header.filter}`];
|
|
3948
|
-
return (!isEmpty(subOptions) && (jsxs(Fragment, { children: [header.header && jsx(MenuHeader, { children: header.header }), subOptions.map((item, index) => item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, `div_${index}`)) : (jsxs(Fragment, { children: [jsx(MenuRadioItem, { item: item, options: options, setOptions: setOptions, onChecked: () => {
|
|
3949
|
+
return (!isEmpty(subOptions) && (jsxs(Fragment$1, { children: [header.header && jsx(MenuHeader, { children: header.header }), subOptions.map((item, index) => item.value === MenuSeparatorString ? (jsx(MenuDivider, {}, `div_${index}`)) : (jsxs(Fragment$1, { children: [jsx(MenuRadioItem, { item: item, options: options, setOptions: setOptions, onChecked: () => {
|
|
3949
3950
|
// Default to focus on first input in subComponent
|
|
3950
3951
|
defer$1(() => {
|
|
3951
3952
|
firstInputSubComponent.current?.focus();
|
|
@@ -4025,7 +4026,7 @@ const FilterInput = (props) => {
|
|
|
4025
4026
|
lastKeyWasEnter.current = false;
|
|
4026
4027
|
}
|
|
4027
4028
|
}, [addCustomFilterValue, filter, onSelectFilter, setFilter, toggleSelectAllVisible, triggerSave]);
|
|
4028
|
-
return (jsxs(Fragment
|
|
4029
|
+
return (jsxs(Fragment, { children: [jsx(FocusableItem, { className: "filter-item", children: (_) => (jsxs("div", { style: { width: "100%" }, className: "GridFormMultiSelect-filter", children: [jsx("input", { className: "LuiTextInput-input", type: "text", placeholder: filterPlaceholder ?? "Filter...", "data-testid": "filteredMenu-free-text-input", value: filter, "data-disableenterautosave": true, "data-allowtabtosave": true, onChange: (e) => setFilter(e.target.value), onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }), filterHelpText && (jsx(FormError, { error: null, helpText: typeof filterHelpText === "function" ? filterHelpText(filter.trim(), options) : filterHelpText }))] })) }, "filter"), jsx(MenuDivider, {}, `$$divider_filter`)] }));
|
|
4029
4030
|
};
|
|
4030
4031
|
const MenuRadioItem = (props) => {
|
|
4031
4032
|
const { item, options, setOptions } = props;
|
|
@@ -4040,7 +4041,7 @@ const MenuRadioItem = (props) => {
|
|
|
4040
4041
|
toggleValue(item);
|
|
4041
4042
|
}
|
|
4042
4043
|
item.checked && props.onChecked && props.onChecked();
|
|
4043
|
-
}, children: jsx(LuiCheckboxInput, { isChecked: item.checked ?? false, value: `${item.value}`, label: jsxs(Fragment
|
|
4044
|
+
}, children: jsx(LuiCheckboxInput, { isChecked: item.checked ?? false, value: `${item.value}`, label: jsxs(Fragment, { children: [item.warning && jsx(GridIcon, { icon: "ic_warning_outline", title: item.warning }), item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)] }), inputProps: {
|
|
4044
4045
|
onClick: (e) => {
|
|
4045
4046
|
// Click is handled by MenuItem onClick
|
|
4046
4047
|
e.preventDefault();
|
|
@@ -4135,20 +4136,20 @@ const GridFormMultiSelectGrid = (props) => {
|
|
|
4135
4136
|
setOptions([...options]);
|
|
4136
4137
|
}
|
|
4137
4138
|
}, [options, setOptions]);
|
|
4138
|
-
return popoverWrapper(jsx(Fragment
|
|
4139
|
+
return popoverWrapper(jsx(Fragment, { children: jsx("div", { className: "Grid-popoverContainer", children: jsx("div", { style: {
|
|
4139
4140
|
display: "grid",
|
|
4140
4141
|
gridAutoFlow: "column",
|
|
4141
4142
|
gridTemplateRows: `repeat(${props.maxRowCount ?? 10}, auto)`,
|
|
4142
4143
|
maxWidth: "calc(min(100vw,500px))",
|
|
4143
4144
|
overflowX: "auto",
|
|
4144
4145
|
}, children: options &&
|
|
4145
|
-
options.map((o) => (jsx(Fragment
|
|
4146
|
+
options.map((o) => (jsx(Fragment, { children: jsx(MenuItem, { onClick: (e) => {
|
|
4146
4147
|
// Global react-menu MenuItem handler handles tabs
|
|
4147
4148
|
if (e.key !== "Tab" && e.key !== "Enter") {
|
|
4148
4149
|
e.keepOpen = true;
|
|
4149
4150
|
toggleValue(o);
|
|
4150
4151
|
}
|
|
4151
|
-
}, children: jsx(LuiCheckboxInput, { isChecked: !!o.checked ?? false, isIndeterminate: o.checked === "partial", value: `${o.value}`, label: jsxs(Fragment
|
|
4152
|
+
}, children: jsx(LuiCheckboxInput, { isChecked: !!o.checked ?? false, isIndeterminate: o.checked === "partial", value: `${o.value}`, label: jsxs(Fragment, { children: [o.warning && jsx(GridIcon, { icon: "ic_warning_outline", title: o.warning }, "$$icon$$"), jsx("span", { className: "GridMultiSelectGrid-Label", children: o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`) }, "$$label$$")] }), inputProps: {
|
|
4152
4153
|
onClick: (e) => {
|
|
4153
4154
|
// Click is handled by MenuItem onClick
|
|
4154
4155
|
e.preventDefault();
|
|
@@ -4234,7 +4235,7 @@ const GridFormPopoverMenu = (props) => {
|
|
|
4234
4235
|
invalid: () => subComponentSelected && !subComponentIsValid.current,
|
|
4235
4236
|
save,
|
|
4236
4237
|
});
|
|
4237
|
-
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormPopupMenu", children: jsx(Fragment
|
|
4238
|
+
return popoverWrapper(jsx(ComponentLoadingWrapper, { loading: !options, className: "GridFormPopupMenu", children: jsx(Fragment, { children: isEmpty(options) ? (jsx(MenuItem, { className: "GridPopoverMenu-noOptions", disabled: true, children: "No actions" }, `GridPopoverMenu-empty`)) : (options?.map((item, index) => item.label === "__isMenuSeparator__" ? (jsx(MenuDivider, {}, `$$divider_${index}`)) : (!item.hidden && (jsxs(Fragment$1, { children: [item.subMenu ? (jsx(SubMenu, { disabled: !!item.disabled, label: item.label, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", children: jsx(item.subMenu, {}) }, `${item.label}`)) : (jsx(MenuItem, { onClick: (e) => onMenuItemClick(e, item), disabled: !!item.disabled, title: item.disabled && typeof item.disabled !== "boolean" ? item.disabled : "", children: item.label }, `${item.label}`)), item.subComponent && subComponentSelected === item && (jsx(FocusableItem, { className: "LuiDeprecatedForms", children: () => (jsx(GridSubComponentContext.Provider, { value: {
|
|
4238
4239
|
context: {},
|
|
4239
4240
|
data,
|
|
4240
4241
|
value: subSelectedValue,
|