@linzjs/step-ag-grid 23.0.1 → 24.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/src/components/ComponentLoadingWrapper.d.ts +1 -1
- package/dist/src/components/Grid.d.ts +17 -17
- package/dist/src/components/GridCell.d.ts +9 -9
- package/dist/src/components/GridCellFiller.d.ts +2 -2
- package/dist/src/components/GridCellMultiEditor.d.ts +6 -6
- package/dist/src/components/GridCellMultiSelectClassRules.d.ts +1 -1
- package/dist/src/components/GridIcon.d.ts +2 -2
- package/dist/src/components/GridNoRowsOverlay.d.ts +1 -1
- package/dist/src/components/GridPopoverHook.d.ts +2 -2
- package/dist/src/components/GridWrapper.d.ts +1 -1
- package/dist/src/components/PostSortRowsHook.d.ts +1 -1
- package/dist/src/components/clickInputWhenContainingCellClicked.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +5 -5
- package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +2 -2
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridFilter/index.d.ts +7 -7
- package/dist/src/components/gridFilter/useGridFilter.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +8 -8
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormMessage.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +5 -5
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -3
- package/dist/src/components/gridForm/index.d.ts +10 -10
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -1
- package/dist/src/components/gridHeader/index.d.ts +1 -1
- package/dist/src/components/gridHook/index.d.ts +1 -1
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +4 -4
- package/dist/src/components/gridPopoverEdit/index.d.ts +11 -11
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +5 -5
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -1
- package/dist/src/components/gridRender/index.d.ts +2 -2
- package/dist/src/components/gridUtil.d.ts +1 -1
- package/dist/src/components/index.d.ts +19 -19
- package/dist/src/contexts/GridContext.d.ts +4 -4
- package/dist/src/contexts/GridContextProvider.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContext.d.ts +3 -3
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +4 -4
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/index.d.ts +17 -17
- package/dist/src/lui/ActionButton.d.ts +9 -9
- package/dist/src/lui/FormError.d.ts +2 -2
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/lui/TextInputFormatted.d.ts +2 -2
- package/dist/src/lui/reactUtils.d.ts +1 -1
- package/dist/src/lui/stateDeferredHook.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +2 -2
- package/dist/src/react-menu3/components/FocusableItem.d.ts +3 -3
- package/dist/src/react-menu3/components/Menu.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuButton.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuDivider.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuItem.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
- package/dist/src/react-menu3/components/SubMenu.d.ts +5 -5
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +2 -2
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +1 -1
- package/dist/src/react-menu3/contexts/SettingsContext.d.ts +2 -2
- package/dist/src/react-menu3/hooks/index.d.ts +9 -9
- package/dist/src/react-menu3/hooks/useBEM.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemEffect.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItemState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useItems.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useMenuChange.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +1 -1
- package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +1 -1
- package/dist/src/react-menu3/index.d.ts +11 -11
- package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/index.d.ts +3 -3
- package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +1 -1
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +4 -4
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +5 -5
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +2 -2
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +5 -5
- package/dist/src/react-menu3/style-utils/index.d.ts +1 -1
- package/dist/src/react-menu3/types.d.ts +15 -15
- package/dist/src/react-menu3/utils/constants.d.ts +1 -1
- package/dist/src/react-menu3/utils/index.d.ts +3 -3
- package/dist/src/react-menu3/utils/utils.d.ts +5 -5
- package/dist/src/react-menu3/utils/withHovering.d.ts +1 -1
- package/dist/src/utils/testQuick.d.ts +2 -2
- package/dist/src/utils/testUtil.d.ts +2 -2
- package/dist/src/utils/textValidator.d.ts +2 -2
- package/dist/step-ag-grid.cjs.js +966 -952
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +968 -954
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +26 -41
- package/src/components/ComponentLoadingWrapper.tsx +5 -6
- package/src/components/Grid.tsx +85 -83
- package/src/components/GridCell.test.tsx +15 -15
- package/src/components/GridCell.tsx +46 -44
- package/src/components/GridCellFiller.tsx +5 -4
- package/src/components/GridCellMultiEditor.tsx +7 -7
- package/src/components/GridCellMultiSelectClassRules.tsx +3 -3
- package/src/components/GridIcon.tsx +6 -7
- package/src/components/GridLoadableCell.tsx +2 -2
- package/src/components/GridNoRowsOverlay.tsx +8 -8
- package/src/components/GridPopoverHook.tsx +16 -16
- package/src/components/GridWrapper.tsx +2 -2
- package/src/components/PostSortRowsHook.ts +11 -11
- package/src/components/clickInputWhenContainingCellClicked.tsx +5 -5
- package/src/components/gridFilter/GridFilterButtons.tsx +8 -9
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +25 -26
- package/src/components/gridFilter/GridFilterDownloadCsvButton.tsx +12 -13
- package/src/components/gridFilter/GridFilterHeaderIconButton.tsx +9 -10
- package/src/components/gridFilter/GridFilterQuick.tsx +6 -6
- package/src/components/gridFilter/GridFilters.tsx +1 -1
- package/src/components/gridFilter/index.ts +7 -7
- package/src/components/gridFilter/useGridFilter.ts +3 -3
- package/src/components/gridForm/GridFormDropDown.tsx +56 -52
- package/src/components/gridForm/GridFormEditBearing.tsx +12 -12
- package/src/components/gridForm/GridFormMessage.tsx +10 -10
- package/src/components/gridForm/GridFormMultiSelect.tsx +53 -51
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +25 -26
- package/src/components/gridForm/GridFormPopoverMenu.tsx +32 -29
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +10 -10
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +8 -8
- package/src/components/gridForm/GridFormTextArea.tsx +11 -11
- package/src/components/gridForm/GridFormTextInput.tsx +11 -11
- package/src/components/gridForm/index.ts +10 -10
- package/src/components/gridHeader/GridHeaderSelect.tsx +9 -9
- package/src/components/gridHeader/index.ts +1 -1
- package/src/components/gridHook/index.ts +1 -1
- package/src/components/gridHook/useGridContextMenu.tsx +7 -7
- package/src/components/gridPopoverEdit/GridButton.tsx +13 -12
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +19 -18
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +7 -6
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +9 -9
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +8 -7
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +6 -6
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +4 -4
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +4 -4
- package/src/components/gridPopoverEdit/index.ts +11 -11
- package/src/components/gridRender/GridRenderGenericCell.tsx +5 -5
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +8 -9
- package/src/components/gridRender/index.ts +2 -2
- package/src/components/gridUtil.ts +3 -3
- package/src/components/index.ts +19 -19
- package/src/contexts/GridContext.tsx +52 -46
- package/src/contexts/GridContextProvider.test.tsx +14 -14
- package/src/contexts/GridContextProvider.tsx +42 -41
- package/src/contexts/GridPopoverContext.tsx +10 -7
- package/src/contexts/GridPopoverContextProvider.tsx +12 -10
- package/src/contexts/GridSubComponentContext.ts +6 -5
- package/src/contexts/GridUpdatingContext.tsx +5 -4
- package/src/contexts/GridUpdatingContextProvider.tsx +3 -3
- package/src/index.ts +17 -21
- package/src/lui/ActionButton.tsx +42 -41
- package/src/lui/FormError.tsx +4 -4
- package/src/lui/TextAreaInput.tsx +9 -9
- package/src/lui/TextInputFormatted.tsx +11 -11
- package/src/lui/reactUtils.test.tsx +8 -8
- package/src/lui/reactUtils.tsx +2 -2
- package/src/lui/stateDeferredHook.tsx +3 -5
- package/src/lui/timeoutHook.test.tsx +5 -5
- package/src/lui/timeoutHook.tsx +1 -1
- package/src/react-app-env.d.ts +1 -1
- package/src/react-menu3/components/ControlledMenu.tsx +48 -48
- package/src/react-menu3/components/FocusableItem.tsx +7 -7
- package/src/react-menu3/components/Menu.tsx +11 -11
- package/src/react-menu3/components/MenuButton.tsx +4 -4
- package/src/react-menu3/components/MenuDivider.tsx +4 -4
- package/src/react-menu3/components/MenuGroup.tsx +5 -5
- package/src/react-menu3/components/MenuHeader.tsx +4 -4
- package/src/react-menu3/components/MenuItem.tsx +14 -14
- package/src/react-menu3/components/MenuList.tsx +55 -55
- package/src/react-menu3/components/MenuRadioGroup.tsx +7 -7
- package/src/react-menu3/components/SubMenu.tsx +24 -24
- package/src/react-menu3/contexts/EventHandlersContext.ts +2 -2
- package/src/react-menu3/contexts/HoverItemContext.ts +1 -1
- package/src/react-menu3/contexts/ItemSettingsContext.ts +1 -1
- package/src/react-menu3/contexts/MenuListContext.ts +2 -2
- package/src/react-menu3/contexts/MenuListItemContext.ts +2 -2
- package/src/react-menu3/contexts/RadioGroupContext.ts +2 -2
- package/src/react-menu3/contexts/SettingsContext.ts +2 -2
- package/src/react-menu3/hooks/index.ts +9 -9
- package/src/react-menu3/hooks/useBEM.ts +4 -4
- package/src/react-menu3/hooks/useCombinedRef.ts +2 -2
- package/src/react-menu3/hooks/useIsomorphicLayoutEffect.ts +4 -4
- package/src/react-menu3/hooks/useItemEffect.ts +3 -3
- package/src/react-menu3/hooks/useItemState.ts +5 -5
- package/src/react-menu3/hooks/useItems.ts +8 -8
- package/src/react-menu3/hooks/useMenuChange.ts +3 -3
- package/src/react-menu3/hooks/useMenuState.ts +5 -5
- package/src/react-menu3/hooks/useMenuStateAndFocus.ts +4 -4
- package/src/react-menu3/index.ts +11 -11
- package/src/react-menu3/positionUtils/getPositionHelpers.ts +2 -2
- package/src/react-menu3/positionUtils/index.ts +3 -3
- package/src/react-menu3/positionUtils/placeArrowHorizontal.ts +1 -1
- package/src/react-menu3/positionUtils/placeArrowVertical.ts +1 -1
- package/src/react-menu3/positionUtils/placeLeftorRight.ts +13 -13
- package/src/react-menu3/positionUtils/placeToporBottom.ts +15 -15
- package/src/react-menu3/positionUtils/positionContextMenu.ts +4 -4
- package/src/react-menu3/positionUtils/positionMenu.ts +14 -14
- package/src/react-menu3/style-utils/index.ts +24 -24
- package/src/react-menu3/types.ts +15 -15
- package/src/react-menu3/utils/constants.ts +33 -33
- package/src/react-menu3/utils/index.ts +3 -4
- package/src/react-menu3/utils/propTypes2.ts +10 -10
- package/src/react-menu3/utils/utils.ts +14 -14
- package/src/react-menu3/utils/withHovering.tsx +3 -3
- package/src/stories/components/ActionButton.stories.tsx +23 -24
- package/src/stories/grid/FormTest.tsx +15 -16
- package/src/stories/grid/GridDragRow.stories.tsx +33 -34
- package/src/stories/grid/GridFilterButtons.stories.tsx +32 -33
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +9 -10
- package/src/stories/grid/GridNonEditableRow.stories.tsx +40 -41
- package/src/stories/grid/GridPinnedRow.stories.tsx +25 -26
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +33 -32
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +21 -22
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +18 -19
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +50 -49
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +25 -26
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +93 -94
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +62 -63
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +28 -28
- package/src/stories/grid/GridReadOnly.stories.tsx +66 -67
- package/src/stories/grid/GridViewList.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +37 -38
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +25 -26
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +31 -31
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +47 -48
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +44 -45
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +19 -20
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +21 -22
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +40 -41
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +14 -15
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +10 -11
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +20 -21
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +16 -17
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +13 -14
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +13 -14
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +68 -71
- package/src/stories/react-menu/ReactMenu.stories.tsx +26 -26
- package/src/utils/bearing.test.ts +44 -44
- package/src/utils/bearing.ts +20 -20
- package/src/utils/deferredPromise.ts +1 -1
- package/src/utils/storybookTestUtil.ts +2 -2
- package/src/utils/testQuick.ts +15 -14
- package/src/utils/testUtil.ts +31 -36
- package/src/utils/textMatcher.test.ts +9 -9
- package/src/utils/textMatcher.ts +8 -8
- package/src/utils/textValidator.test.ts +56 -56
- package/src/utils/textValidator.ts +11 -11
- package/src/utils/util.test.ts +20 -20
- package/src/utils/util.ts +7 -7
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LuiCheckboxInput, LuiIcon } from '@linzjs/lui';
|
|
2
|
+
import { ColDef } from 'ag-grid-community';
|
|
3
|
+
import { isEmpty } from 'lodash-es';
|
|
4
|
+
import { ReactElement, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
3
5
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ClickEvent } from "../../react-menu3/types";
|
|
9
|
-
import { GridFilterHeaderIconButton } from "./GridFilterHeaderIconButton";
|
|
10
|
-
import { ColDef } from "ag-grid-community";
|
|
6
|
+
import { GridContext } from '../../contexts/GridContext';
|
|
7
|
+
import { Menu, MenuDivider, MenuItem } from '../../react-menu3';
|
|
8
|
+
import { ClickEvent } from '../../react-menu3/types';
|
|
9
|
+
import { GridFilterHeaderIconButton } from './GridFilterHeaderIconButton';
|
|
11
10
|
|
|
12
11
|
export interface GridFilterColumnsToggleProps {
|
|
13
12
|
saveState?: boolean;
|
|
@@ -21,13 +20,13 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
21
20
|
() =>
|
|
22
21
|
isEmpty(getColumnIds())
|
|
23
22
|
? null // Grid hasn't been initialised yet
|
|
24
|
-
:
|
|
23
|
+
: 'stepAgGrid_invisibleColumnIds_' + getColumnIds().join('_'),
|
|
25
24
|
[getColumnIds],
|
|
26
25
|
);
|
|
27
26
|
|
|
28
27
|
// infer the invisible ids from colDefs
|
|
29
28
|
const resetColumns = useCallback(
|
|
30
|
-
() => setInvisibleColumnIds(getColumnIds(
|
|
29
|
+
() => setInvisibleColumnIds(getColumnIds('initialHide')),
|
|
31
30
|
[getColumnIds, setInvisibleColumnIds],
|
|
32
31
|
);
|
|
33
32
|
|
|
@@ -40,10 +39,10 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
40
39
|
if (!stored) {
|
|
41
40
|
resetColumns();
|
|
42
41
|
} else {
|
|
43
|
-
const invisibleIds = JSON.parse(stored ??
|
|
42
|
+
const invisibleIds = JSON.parse(stored ?? '[]');
|
|
44
43
|
if (!Array.isArray(invisibleIds)) {
|
|
45
44
|
console.error(`stored invisible ids not an array: ${stored}`);
|
|
46
|
-
} else if (!invisibleIds.every((id) => typeof id ===
|
|
45
|
+
} else if (!invisibleIds.every((id) => typeof id === 'string')) {
|
|
47
46
|
console.error(`stored invisible ids not strings: ${stored}`);
|
|
48
47
|
} else {
|
|
49
48
|
invisibleIds && setInvisibleColumnIds(invisibleIds);
|
|
@@ -81,30 +80,30 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
81
80
|
|
|
82
81
|
return (
|
|
83
82
|
<Menu
|
|
84
|
-
menuButton={<GridFilterHeaderIconButton icon={
|
|
85
|
-
menuClassName={
|
|
83
|
+
menuButton={<GridFilterHeaderIconButton icon={'ic_columns'} title={'Column visibility'} />}
|
|
84
|
+
menuClassName={'step-ag-grid-react-menu'}
|
|
86
85
|
portal={true}
|
|
87
86
|
unmountOnClose={true}
|
|
88
87
|
>
|
|
89
|
-
<div className={
|
|
90
|
-
{getColumns(
|
|
88
|
+
<div className={'GridFilterColumnsToggle-container'}>
|
|
89
|
+
{getColumns('headerName').map((col) => (
|
|
91
90
|
<MenuItem
|
|
92
|
-
key={col.colId ??
|
|
91
|
+
key={col.colId ?? 'no_col_id'}
|
|
93
92
|
disabled={isNonManageableColumn(col)}
|
|
94
93
|
onClick={(e: ClickEvent) => {
|
|
95
94
|
// Global react-menu MenuItem handler handles tabs
|
|
96
|
-
if (e.key !==
|
|
95
|
+
if (e.key !== 'Tab') {
|
|
97
96
|
e.keepOpen = true;
|
|
98
|
-
if (e.key !==
|
|
97
|
+
if (e.key !== 'Enter') {
|
|
99
98
|
toggleColumn(col.colId);
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
}}
|
|
103
102
|
>
|
|
104
103
|
<LuiCheckboxInput
|
|
105
|
-
isChecked={!!invisibleColumnIds && !invisibleColumnIds.includes(col.colId ??
|
|
104
|
+
isChecked={!!invisibleColumnIds && !invisibleColumnIds.includes(col.colId ?? '')}
|
|
106
105
|
value={`${col.colId}`}
|
|
107
|
-
label={col.headerName ??
|
|
106
|
+
label={col.headerName ?? ''}
|
|
108
107
|
isDisabled={isNonManageableColumn(col)}
|
|
109
108
|
inputProps={{
|
|
110
109
|
onClick: (e) => {
|
|
@@ -122,16 +121,16 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
122
121
|
</div>
|
|
123
122
|
<MenuDivider key={`$$divider_reset_columns`} />
|
|
124
123
|
<MenuItem
|
|
125
|
-
key={
|
|
124
|
+
key={'$$reset_columns'}
|
|
126
125
|
onClick={(e: ClickEvent) => {
|
|
127
126
|
// Global react-menu MenuItem handler handles tabs
|
|
128
|
-
if (e.key !==
|
|
129
|
-
e.keepOpen = e.key !==
|
|
127
|
+
if (e.key !== 'Tab') {
|
|
128
|
+
e.keepOpen = e.key !== 'Enter';
|
|
130
129
|
resetColumns();
|
|
131
130
|
}
|
|
132
131
|
}}
|
|
133
132
|
>
|
|
134
|
-
<LuiIcon name={
|
|
133
|
+
<LuiIcon name={'ic_regenerate'} alt={'Reset columns'} size={'md'} className={'MenuItem-icon'} />
|
|
135
134
|
Reset columns
|
|
136
135
|
</MenuItem>
|
|
137
136
|
</Menu>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { LuiMiniSpinner } from '@linzjs/lui';
|
|
2
|
+
import { CsvExportParams } from 'ag-grid-community';
|
|
3
|
+
import { delay } from 'lodash-es';
|
|
4
|
+
import { useContext } from 'react';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import { useStateDeferred } from "../../lui/stateDeferredHook";
|
|
9
|
-
import { GridFilterHeaderIconButton } from "./GridFilterHeaderIconButton";
|
|
6
|
+
import { GridContext } from '../../contexts/GridContext';
|
|
7
|
+
import { useStateDeferred } from '../../lui/stateDeferredHook';
|
|
8
|
+
import { GridFilterHeaderIconButton } from './GridFilterHeaderIconButton';
|
|
10
9
|
|
|
11
10
|
export const GridFilterDownloadCsvButton = (csvExportParams: CsvExportParams) => {
|
|
12
11
|
const { downloadCsv } = useContext(GridContext);
|
|
@@ -27,15 +26,15 @@ export const GridFilterDownloadCsvButton = (csvExportParams: CsvExportParams) =>
|
|
|
27
26
|
<LuiMiniSpinner
|
|
28
27
|
size={22}
|
|
29
28
|
divProps={{
|
|
30
|
-
role:
|
|
31
|
-
[
|
|
32
|
-
style: { width: 42, display:
|
|
29
|
+
role: 'status',
|
|
30
|
+
['aria-label']: 'Downloading...',
|
|
31
|
+
style: { width: 42, display: 'flex', justifyContent: 'center' },
|
|
33
32
|
}}
|
|
34
33
|
/>
|
|
35
34
|
) : (
|
|
36
35
|
<GridFilterHeaderIconButton
|
|
37
|
-
icon={
|
|
38
|
-
title={
|
|
36
|
+
icon={'ic_csv_file'}
|
|
37
|
+
title={'Download CSV'}
|
|
39
38
|
onClick={handleDownloadClick}
|
|
40
39
|
disabled={downloading}
|
|
41
40
|
/>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { IconName, IconSize } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
|
|
1
|
+
import { LuiButton, LuiIcon } from '@linzjs/lui';
|
|
2
|
+
import { IconName, IconSize } from '@linzjs/lui/dist/components/LuiIcon/LuiIcon';
|
|
3
|
+
import { ButtonHTMLAttributes, forwardRef, MouseEvent } from 'react';
|
|
5
4
|
|
|
6
5
|
export interface GridFilterHeaderIconButtonProps {
|
|
7
6
|
icon: IconName;
|
|
@@ -13,20 +12,20 @@ export interface GridFilterHeaderIconButtonProps {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export const GridFilterHeaderIconButton = forwardRef<HTMLButtonElement, GridFilterHeaderIconButtonProps>(
|
|
16
|
-
function columnsButton({ icon, title, onClick, buttonProps, disabled = false, size =
|
|
15
|
+
function columnsButton({ icon, title, onClick, buttonProps, disabled = false, size = 'md' }, ref) {
|
|
17
16
|
return (
|
|
18
17
|
<LuiButton
|
|
19
18
|
{...buttonProps}
|
|
20
|
-
type={
|
|
21
|
-
level={
|
|
22
|
-
className={
|
|
19
|
+
type={'button'}
|
|
20
|
+
level={'tertiary'}
|
|
21
|
+
className={'lui-button-icon-only'}
|
|
23
22
|
ref={ref}
|
|
24
|
-
buttonProps={{
|
|
23
|
+
buttonProps={{ 'aria-label': title }}
|
|
25
24
|
title={title}
|
|
26
25
|
onClick={onClick}
|
|
27
26
|
disabled={disabled}
|
|
28
27
|
>
|
|
29
|
-
<LuiIcon name={icon} alt={
|
|
28
|
+
<LuiIcon name={icon} alt={'Menu'} size={size} />
|
|
30
29
|
</LuiButton>
|
|
31
30
|
);
|
|
32
31
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LuiIcon } from
|
|
2
|
-
import { useContext, useEffect, useState } from
|
|
1
|
+
import { LuiIcon } from '@linzjs/lui';
|
|
2
|
+
import { useContext, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import { GridContext } from
|
|
4
|
+
import { GridContext } from '../../contexts/GridContext';
|
|
5
5
|
|
|
6
6
|
export interface GridFilterQuickProps {
|
|
7
7
|
quickFilterPlaceholder?: string;
|
|
@@ -10,7 +10,7 @@ export interface GridFilterQuickProps {
|
|
|
10
10
|
|
|
11
11
|
export const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }: GridFilterQuickProps) => {
|
|
12
12
|
const { setQuickFilter } = useContext(GridContext);
|
|
13
|
-
const [quickFilterValue, setQuickFilterValue] = useState(defaultValue ??
|
|
13
|
+
const [quickFilterValue, setQuickFilterValue] = useState(defaultValue ?? '');
|
|
14
14
|
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
setQuickFilter(quickFilterValue);
|
|
@@ -19,13 +19,13 @@ export const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }: GridFi
|
|
|
19
19
|
return (
|
|
20
20
|
<div className="GridFilterQuick-container">
|
|
21
21
|
<div className="GridFilterQuick-icon">
|
|
22
|
-
<LuiIcon name={
|
|
22
|
+
<LuiIcon name={'ic_search'} alt={'Search'} size={'md'} />
|
|
23
23
|
</div>
|
|
24
24
|
<input
|
|
25
25
|
aria-label="Search"
|
|
26
26
|
className="GridFilterQuick-input"
|
|
27
27
|
type="text"
|
|
28
|
-
placeholder={quickFilterPlaceholder ??
|
|
28
|
+
placeholder={quickFilterPlaceholder ?? 'Search'}
|
|
29
29
|
value={quickFilterValue}
|
|
30
30
|
onChange={(event) => {
|
|
31
31
|
setQuickFilterValue(event.target.value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from './GridFilterButtons';
|
|
2
|
+
export * from './GridFilterColumnsToggle';
|
|
3
|
+
export * from './GridFilterDownloadCsvButton';
|
|
4
|
+
export * from './GridFilterHeaderIconButton';
|
|
5
|
+
export * from './GridFilterQuick';
|
|
6
|
+
export * from './GridFilters';
|
|
7
|
+
export * from './useGridFilter';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useContext, useEffect } from
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
import { GridContext, GridFilterExternal } from
|
|
4
|
-
import { GridBaseRow } from
|
|
3
|
+
import { GridContext, GridFilterExternal } from '../../contexts/GridContext';
|
|
4
|
+
import { GridBaseRow } from '../Grid';
|
|
5
5
|
|
|
6
6
|
export const useGridFilter = <TData extends GridBaseRow>(filter: GridFilterExternal<TData> | undefined) => {
|
|
7
7
|
const { addExternalFilter, removeExternalFilter } = useContext(GridContext);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import debounce from
|
|
2
|
-
import { isEmpty } from
|
|
3
|
-
import { Fragment, ReactElement, useCallback, useEffect, useMemo, useRef, useState } from
|
|
1
|
+
import debounce from 'debounce-promise';
|
|
2
|
+
import { isEmpty } from 'lodash-es';
|
|
3
|
+
import { Fragment, ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import { useGridPopoverContext } from
|
|
6
|
-
import { GridSubComponentContext } from
|
|
7
|
-
import { FormError } from
|
|
8
|
-
import { FocusableItem, MenuDivider, MenuHeader, MenuItem } from
|
|
9
|
-
import { ClickEvent } from
|
|
10
|
-
import { textMatch } from
|
|
11
|
-
import { isNotEmpty } from
|
|
12
|
-
import { ComponentLoadingWrapper } from
|
|
13
|
-
import { GridBaseRow } from
|
|
14
|
-
import { CellEditorCommon } from
|
|
15
|
-
import { useGridPopoverHook } from
|
|
5
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
6
|
+
import { GridSubComponentContext } from '../../contexts/GridSubComponentContext';
|
|
7
|
+
import { FormError } from '../../lui/FormError';
|
|
8
|
+
import { FocusableItem, MenuDivider, MenuHeader, MenuItem } from '../../react-menu3';
|
|
9
|
+
import { ClickEvent } from '../../react-menu3/types';
|
|
10
|
+
import { textMatch } from '../../utils/textMatcher';
|
|
11
|
+
import { isNotEmpty } from '../../utils/util';
|
|
12
|
+
import { ComponentLoadingWrapper } from '../ComponentLoadingWrapper';
|
|
13
|
+
import { GridBaseRow } from '../Grid';
|
|
14
|
+
import { CellEditorCommon } from '../GridCell';
|
|
15
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
16
16
|
|
|
17
17
|
export interface GridPopoutEditDropDownSelectedItem<TData extends GridBaseRow, TValue> {
|
|
18
18
|
// Note the row that was clicked on will be first
|
|
19
19
|
selectedRows: TData[];
|
|
20
|
-
selectedRowIds: TData[
|
|
20
|
+
selectedRowIds: TData['id'][];
|
|
21
21
|
value: TValue;
|
|
22
22
|
subComponentValue?: any;
|
|
23
23
|
}
|
|
@@ -29,10 +29,10 @@ interface FinalSelectOption {
|
|
|
29
29
|
subComponent?: (props: any, ref: any) => any;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const MenuSeparatorString =
|
|
32
|
+
export const MenuSeparatorString = '_____MENU_SEPARATOR_____';
|
|
33
33
|
export const MenuSeparator = Object.freeze({ value: MenuSeparatorString });
|
|
34
34
|
|
|
35
|
-
export const MenuHeaderString =
|
|
35
|
+
export const MenuHeaderString = '_____MENU_HEADER_____';
|
|
36
36
|
export const MenuHeaderItem = (title: string) => {
|
|
37
37
|
return { label: title, value: MenuHeaderString };
|
|
38
38
|
};
|
|
@@ -41,22 +41,26 @@ export type SelectOption = null | string | FinalSelectOption;
|
|
|
41
41
|
|
|
42
42
|
export interface GridFormDropDownProps<TData extends GridBaseRow, TValue> extends CellEditorCommon {
|
|
43
43
|
// This overrides CellEditorCommon to provide some common class options
|
|
44
|
-
className?:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
|
48
|
-
|
|
49
|
-
|
|
|
44
|
+
className?: // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
45
|
+
| 'GridPopoverEditDropDown-containerSmall'
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
47
|
+
| 'GridPopoverEditDropDown-containerMedium'
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
49
|
+
| 'GridPopoverEditDropDown-containerLarge'
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
51
|
+
| 'GridPopoverEditDropDown-containerUnlimited'
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
53
|
+
| 'GridPopoverEditDropDown-containerAutoWidth'
|
|
50
54
|
| string
|
|
51
55
|
| undefined;
|
|
52
56
|
// local means the use the local filter, otherwise it's expected options will be passed a function that takes a filter
|
|
53
|
-
filtered?:
|
|
57
|
+
filtered?: 'local' | 'reload';
|
|
54
58
|
filterDefaultValue?: string;
|
|
55
59
|
filterPlaceholder?: string;
|
|
56
60
|
filterHelpText?: string;
|
|
57
61
|
noOptionsMessage?: string;
|
|
58
|
-
onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void
|
|
59
|
-
onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void
|
|
62
|
+
onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void> | void;
|
|
63
|
+
onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void> | void;
|
|
60
64
|
options:
|
|
61
65
|
| SelectOption[]
|
|
62
66
|
| ((selectedRows: TData[], filter?: string) => Promise<SelectOption[] | undefined> | SelectOption[] | undefined)
|
|
@@ -64,14 +68,14 @@ export interface GridFormDropDownProps<TData extends GridBaseRow, TValue> extend
|
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
const fieldToString = (field: any) => {
|
|
67
|
-
return typeof field
|
|
71
|
+
return typeof field === 'symbol' ? field.toString() : `${field}`;
|
|
68
72
|
};
|
|
69
73
|
|
|
70
74
|
export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridFormDropDownProps<TData, TValue>) => {
|
|
71
75
|
const { selectedRows, field, data } = useGridPopoverContext<TData>();
|
|
72
76
|
|
|
73
77
|
// Save triggers during async action processing which triggers another selectItem(), this ref blocks that
|
|
74
|
-
const [filter, setFilter] = useState(props.filterDefaultValue ??
|
|
78
|
+
const [filter, setFilter] = useState(props.filterDefaultValue ?? '');
|
|
75
79
|
const [filteredValues, setFilteredValues] = useState<any[]>();
|
|
76
80
|
const [options, setOptions] = useState<FinalSelectOption[] | null>(null);
|
|
77
81
|
const subComponentIsValid = useRef(false);
|
|
@@ -83,7 +87,7 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
83
87
|
const selectItemHandler = useCallback(
|
|
84
88
|
async (value: any, subComponentValue?: any): Promise<boolean> => {
|
|
85
89
|
const hasChanged =
|
|
86
|
-
selectedRows.some((row) => row[field
|
|
90
|
+
selectedRows.some((row) => row[field] !== value) ||
|
|
87
91
|
(subComponentValue !== undefined && subComponentInitialValue.current !== JSON.stringify(subComponentValue));
|
|
88
92
|
if (hasChanged) {
|
|
89
93
|
if (props.onSelectedItem) {
|
|
@@ -94,7 +98,7 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
94
98
|
subComponentValue,
|
|
95
99
|
});
|
|
96
100
|
} else {
|
|
97
|
-
selectedRows.forEach((row) => (row[field] = value
|
|
101
|
+
selectedRows.forEach((row) => (row[field] = value));
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
return true;
|
|
@@ -107,13 +111,13 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
107
111
|
if (options) return;
|
|
108
112
|
let optionsConf = props.options;
|
|
109
113
|
|
|
110
|
-
(async () => {
|
|
111
|
-
if (typeof optionsConf
|
|
114
|
+
void (async () => {
|
|
115
|
+
if (typeof optionsConf === 'function') {
|
|
112
116
|
optionsConf = await optionsConf(selectedRows, filter);
|
|
113
117
|
}
|
|
114
118
|
if (optionsConf !== undefined) {
|
|
115
119
|
const optionsList = optionsConf?.map((item) =>
|
|
116
|
-
item == null || typeof item
|
|
120
|
+
item == null || typeof item === 'string'
|
|
117
121
|
? ({
|
|
118
122
|
value: item,
|
|
119
123
|
label: item,
|
|
@@ -129,16 +133,16 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
129
133
|
|
|
130
134
|
// Local filtering.
|
|
131
135
|
useEffect(() => {
|
|
132
|
-
if (props.filtered ==
|
|
136
|
+
if (props.filtered == 'local') {
|
|
133
137
|
if (options == null) return;
|
|
134
138
|
setFilteredValues(
|
|
135
139
|
options
|
|
136
140
|
.map((option) => {
|
|
137
|
-
if (option.label != null && typeof option.label !==
|
|
138
|
-
console.error(
|
|
141
|
+
if (option.label != null && typeof option.label !== 'string') {
|
|
142
|
+
console.error('Cannot filter non-string labels', option);
|
|
139
143
|
return undefined;
|
|
140
144
|
}
|
|
141
|
-
return textMatch((option.label as string) ||
|
|
145
|
+
return textMatch((option.label as string) || '', filter) ? option : undefined;
|
|
142
146
|
})
|
|
143
147
|
.filter((r) => r !== undefined),
|
|
144
148
|
);
|
|
@@ -157,9 +161,9 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
157
161
|
|
|
158
162
|
// Reload filtering.
|
|
159
163
|
useEffect(() => {
|
|
160
|
-
if (previousFilter.current != filter && props.filtered ==
|
|
164
|
+
if (previousFilter.current != filter && props.filtered == 'reload') {
|
|
161
165
|
previousFilter.current = filter;
|
|
162
|
-
reSearchOnFilterChange()
|
|
166
|
+
void reSearchOnFilterChange();
|
|
163
167
|
}
|
|
164
168
|
}, [filter, props, reSearchOnFilterChange]);
|
|
165
169
|
|
|
@@ -202,9 +206,9 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
202
206
|
return popoverWrapper(
|
|
203
207
|
<>
|
|
204
208
|
{props.filtered && (
|
|
205
|
-
<div className={
|
|
209
|
+
<div className={'GridFormDropDown-filter'}>
|
|
206
210
|
<FocusableItem
|
|
207
|
-
className={
|
|
211
|
+
className={'filter-item'}
|
|
208
212
|
onFocus={() => {
|
|
209
213
|
setSelectedItem(null);
|
|
210
214
|
setSubSelectedValue(null);
|
|
@@ -212,13 +216,13 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
212
216
|
}}
|
|
213
217
|
>
|
|
214
218
|
{({ ref }: any) => (
|
|
215
|
-
<div style={{ display:
|
|
219
|
+
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
|
|
216
220
|
<input
|
|
217
|
-
className={
|
|
221
|
+
className={'LuiTextInput-input'}
|
|
218
222
|
ref={ref}
|
|
219
223
|
type="text"
|
|
220
|
-
placeholder={props.filterPlaceholder ??
|
|
221
|
-
data-testid={
|
|
224
|
+
placeholder={props.filterPlaceholder ?? 'Filter...'}
|
|
225
|
+
data-testid={'filteredMenu-free-text-input'}
|
|
222
226
|
defaultValue={filter}
|
|
223
227
|
data-allowtabtosave={true}
|
|
224
228
|
data-disableenterautosave={
|
|
@@ -236,15 +240,15 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
236
240
|
<MenuDivider key={`$$divider_filter`} />
|
|
237
241
|
</div>
|
|
238
242
|
)}
|
|
239
|
-
<ComponentLoadingWrapper loading={!options} className={
|
|
243
|
+
<ComponentLoadingWrapper loading={!options} className={'GridFormDropDown-options'}>
|
|
240
244
|
<>
|
|
241
245
|
{options && (isEmpty(options) || (filteredValues && isEmpty(filteredValues))) && (
|
|
242
246
|
<MenuItem
|
|
243
247
|
key={`${fieldToString(field)}-empty`}
|
|
244
|
-
className={
|
|
248
|
+
className={'GridPopoverEditDropDown-noOptions'}
|
|
245
249
|
disabled={true}
|
|
246
250
|
>
|
|
247
|
-
{props.noOptionsMessage ??
|
|
251
|
+
{props.noOptionsMessage ?? 'No Options'}
|
|
248
252
|
</MenuItem>
|
|
249
253
|
)}
|
|
250
254
|
{options?.map((item: FinalSelectOption, index) => {
|
|
@@ -268,7 +272,7 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
268
272
|
<MenuItem
|
|
269
273
|
key={`${fieldToString(field)}-${index}`}
|
|
270
274
|
disabled={!!item.disabled}
|
|
271
|
-
title={item.disabled && typeof item.disabled !==
|
|
275
|
+
title={item.disabled && typeof item.disabled !== 'boolean' ? item.disabled : ''}
|
|
272
276
|
value={item.value}
|
|
273
277
|
onFocus={() => {
|
|
274
278
|
if (selectedItem !== item) {
|
|
@@ -285,11 +289,11 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
285
289
|
}}
|
|
286
290
|
>
|
|
287
291
|
{item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
|
|
288
|
-
{item.subComponent ?
|
|
292
|
+
{item.subComponent ? '...' : ''}
|
|
289
293
|
</MenuItem>
|
|
290
294
|
|
|
291
295
|
{item.subComponent && selectedItem === item && (
|
|
292
|
-
<FocusableItem className={
|
|
296
|
+
<FocusableItem className={'LuiDeprecatedForms'} key={`${String(item.label)}_subcomponent`}>
|
|
293
297
|
{() => (
|
|
294
298
|
<GridSubComponentContext.Provider
|
|
295
299
|
value={{
|
|
@@ -312,7 +316,7 @@ export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridF
|
|
|
312
316
|
}}
|
|
313
317
|
>
|
|
314
318
|
{item.subComponent && (
|
|
315
|
-
<div className={
|
|
319
|
+
<div className={'subComponent'}>
|
|
316
320
|
<item.subComponent />
|
|
317
321
|
</div>
|
|
318
322
|
)}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useCallback, useMemo, useState } from
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useGridPopoverContext } from
|
|
4
|
-
import { TextInputFormatted } from
|
|
5
|
-
import { bearingNumberParser, bearingStringValidator } from
|
|
6
|
-
import { GridBaseRow } from
|
|
7
|
-
import { CellEditorCommon } from
|
|
8
|
-
import { useGridPopoverHook } from
|
|
3
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
4
|
+
import { TextInputFormatted } from '../../lui/TextInputFormatted';
|
|
5
|
+
import { bearingNumberParser, bearingStringValidator } from '../../utils/bearing';
|
|
6
|
+
import { GridBaseRow } from '../Grid';
|
|
7
|
+
import { CellEditorCommon } from '../GridCell';
|
|
8
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
9
9
|
|
|
10
10
|
export interface GridFormEditBearingProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
11
11
|
formatValue?: (value: any) => string;
|
|
@@ -19,7 +19,7 @@ export const GridFormEditBearing = <TData extends GridBaseRow>(props: GridFormEd
|
|
|
19
19
|
|
|
20
20
|
// This clears out any scientific precision
|
|
21
21
|
const defaultValue = useMemo(
|
|
22
|
-
() => (initialValue == null ?
|
|
22
|
+
() => (initialValue == null ? '' : parseFloat(parseFloat(initialValue).toFixed(10)).toString()),
|
|
23
23
|
[initialValue],
|
|
24
24
|
);
|
|
25
25
|
|
|
@@ -39,7 +39,7 @@ export const GridFormEditBearing = <TData extends GridBaseRow>(props: GridFormEd
|
|
|
39
39
|
return await props.onSave({ selectedRows, value: parsedValue });
|
|
40
40
|
} else {
|
|
41
41
|
if (field == null) {
|
|
42
|
-
console.error(
|
|
42
|
+
console.error('field is not defined in ColDef');
|
|
43
43
|
} else {
|
|
44
44
|
selectedRows.forEach((row) => {
|
|
45
45
|
row[field] = parsedValue as any;
|
|
@@ -57,7 +57,7 @@ export const GridFormEditBearing = <TData extends GridBaseRow>(props: GridFormEd
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
return popoverWrapper(
|
|
60
|
-
<div className={
|
|
60
|
+
<div className={'GridFormEditBearing-input'}>
|
|
61
61
|
<TextInputFormatted
|
|
62
62
|
value={defaultValue}
|
|
63
63
|
onChange={(e) => {
|
|
@@ -67,11 +67,11 @@ export const GridFormEditBearing = <TData extends GridBaseRow>(props: GridFormEd
|
|
|
67
67
|
placeholder={props.placeHolder}
|
|
68
68
|
formatted={
|
|
69
69
|
bearingStringValidator(value, props.range) || !props.formatValue
|
|
70
|
-
?
|
|
70
|
+
? '?'
|
|
71
71
|
: props.formatValue(bearingNumberParser(value))
|
|
72
72
|
}
|
|
73
73
|
error={bearingStringValidator(value, props.range)}
|
|
74
|
-
helpText={
|
|
74
|
+
helpText={'Press enter or tab to save'}
|
|
75
75
|
/>
|
|
76
76
|
</div>,
|
|
77
77
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import clsx from
|
|
2
|
-
import { ReactElement, useEffect, useState } from
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { ReactElement, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useGridPopoverContext } from
|
|
5
|
-
import { ComponentLoadingWrapper } from
|
|
6
|
-
import { GridBaseRow } from
|
|
7
|
-
import { CellEditorCommon } from
|
|
8
|
-
import { useGridPopoverHook } from
|
|
4
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
5
|
+
import { ComponentLoadingWrapper } from '../ComponentLoadingWrapper';
|
|
6
|
+
import { GridBaseRow } from '../Grid';
|
|
7
|
+
import { CellEditorCommon } from '../GridCell';
|
|
8
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
9
9
|
|
|
10
10
|
export interface GridFormMessageProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
11
11
|
message: (selectedRows: TData[]) => Promise<string | ReactElement> | string | ReactElement;
|
|
@@ -18,13 +18,13 @@ export const GridFormMessage = <TData extends GridBaseRow>(props: GridFormMessag
|
|
|
18
18
|
const { popoverWrapper } = useGridPopoverHook({ className: props.className });
|
|
19
19
|
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
(async () => {
|
|
21
|
+
void (async () => {
|
|
22
22
|
setMessage(await props.message(selectedRows));
|
|
23
|
-
})()
|
|
23
|
+
})();
|
|
24
24
|
}, [props, selectedRows]);
|
|
25
25
|
|
|
26
26
|
return popoverWrapper(
|
|
27
|
-
<ComponentLoadingWrapper loading={message === null} className={clsx(
|
|
27
|
+
<ComponentLoadingWrapper loading={message === null} className={clsx('GridFormMessage-container', props.className)}>
|
|
28
28
|
<>{message}</>
|
|
29
29
|
</ComponentLoadingWrapper>,
|
|
30
30
|
);
|