@linzjs/step-ag-grid 23.0.0 → 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,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LuiCheckboxInput } from '@linzjs/lui';
|
|
2
|
+
import { defer, fromPairs, groupBy, isEmpty, pick, toPairs } from 'lodash-es';
|
|
2
3
|
import React, {
|
|
3
4
|
Dispatch,
|
|
4
5
|
ForwardedRef,
|
|
@@ -11,22 +12,20 @@ import React, {
|
|
|
11
12
|
useMemo,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
|
-
} from
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
29
|
-
import { MenuSeparatorString } from "./GridFormDropDown";
|
|
15
|
+
} from 'react';
|
|
16
|
+
|
|
17
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
18
|
+
import { GridSubComponentContext } from '../../contexts/GridSubComponentContext';
|
|
19
|
+
import { FormError } from '../../lui/FormError';
|
|
20
|
+
import { FocusableItem, MenuDivider, MenuHeader, MenuItem } from '../../react-menu3';
|
|
21
|
+
import { ClickEvent } from '../../react-menu3/types';
|
|
22
|
+
import { textMatch } from '../../utils/textMatcher';
|
|
23
|
+
import { ComponentLoadingWrapper } from '../ComponentLoadingWrapper';
|
|
24
|
+
import { GridBaseRow } from '../Grid';
|
|
25
|
+
import { CellEditorCommon } from '../GridCell';
|
|
26
|
+
import { GridIcon } from '../GridIcon';
|
|
27
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
28
|
+
import { MenuSeparatorString } from './GridFormDropDown';
|
|
30
29
|
|
|
31
30
|
type HeaderGroupType = Record<string, MultiSelectOption[]> | undefined;
|
|
32
31
|
|
|
@@ -51,11 +50,14 @@ export interface GridFormMultiSelectSaveProps<TData extends GridBaseRow> {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
export interface GridFormMultiSelectProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
54
|
-
className?:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
|
58
|
-
|
|
53
|
+
className?: // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
54
|
+
| 'GridMultiSelect-containerSmall'
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
56
|
+
| 'GridMultiSelect-containerMedium'
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
58
|
+
| 'GridMultiSelect-containerLarge'
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
60
|
+
| 'GridMultiSelect-containerUnlimited'
|
|
59
61
|
| string
|
|
60
62
|
| undefined;
|
|
61
63
|
filtered?: boolean;
|
|
@@ -76,8 +78,8 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
76
78
|
const optionsInitialising = useRef(false);
|
|
77
79
|
const firstInputSubComponent = useRef<HTMLInputElement | null>(null);
|
|
78
80
|
|
|
79
|
-
const [filter, setFilter] = useState(
|
|
80
|
-
const [initialValues, setInitialValues] = useState(
|
|
81
|
+
const [filter, setFilter] = useState('');
|
|
82
|
+
const [initialValues, setInitialValues] = useState('');
|
|
81
83
|
const [options, setOptions] = useState<MultiSelectOption[]>();
|
|
82
84
|
|
|
83
85
|
const invalid = useCallback(() => {
|
|
@@ -114,8 +116,8 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
114
116
|
if (options || optionsInitialising.current) return;
|
|
115
117
|
optionsInitialising.current = true;
|
|
116
118
|
|
|
117
|
-
(async () => {
|
|
118
|
-
const optionsList = typeof props.options ===
|
|
119
|
+
void (async () => {
|
|
120
|
+
const optionsList = typeof props.options === 'function' ? await props.options(selectedRows) : props.options;
|
|
119
121
|
setInitialValues(JSON.stringify(optionsList));
|
|
120
122
|
setOptions(optionsList);
|
|
121
123
|
optionsInitialising.current = false;
|
|
@@ -129,7 +131,7 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
129
131
|
if (!options) return undefined;
|
|
130
132
|
const result = groupBy(
|
|
131
133
|
options.filter((o) => textMatch(o.label, filter) && o.value != null),
|
|
132
|
-
|
|
134
|
+
'filter',
|
|
133
135
|
);
|
|
134
136
|
// remove leading/trailing/duplicate dividers
|
|
135
137
|
return fromPairs(
|
|
@@ -154,7 +156,7 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
154
156
|
) as HeaderGroupType;
|
|
155
157
|
}, [filter, options]);
|
|
156
158
|
|
|
157
|
-
const headers: GridFormMultiSelectGroup[] = useMemo(() => props.headers ?? [{ header:
|
|
159
|
+
const headers: GridFormMultiSelectGroup[] = useMemo(() => props.headers ?? [{ header: '' }], [props.headers]);
|
|
158
160
|
|
|
159
161
|
const { popoverWrapper, triggerSave } = useGridPopoverHook({
|
|
160
162
|
className: props.className,
|
|
@@ -163,7 +165,7 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
163
165
|
});
|
|
164
166
|
|
|
165
167
|
return popoverWrapper(
|
|
166
|
-
<ComponentLoadingWrapper loading={!options} className={
|
|
168
|
+
<ComponentLoadingWrapper loading={!options} className={'GridFormMultiSelect-container'}>
|
|
167
169
|
{options && (
|
|
168
170
|
<>
|
|
169
171
|
{props.filtered && (
|
|
@@ -176,12 +178,12 @@ export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMu
|
|
|
176
178
|
)}
|
|
177
179
|
{headerGroups &&
|
|
178
180
|
(isEmpty(headerGroups) || !toPairs(headerGroups).some(([_, options]) => !isEmpty(options))) && (
|
|
179
|
-
<MenuItem key={
|
|
180
|
-
{props.noOptionsMessage ??
|
|
181
|
+
<MenuItem key={'noOptions'} className={'GridMultiSelect-noOptions'} disabled={true}>
|
|
182
|
+
{props.noOptionsMessage ?? 'No Options'}
|
|
181
183
|
</MenuItem>
|
|
182
184
|
)}
|
|
183
185
|
{headerGroups && !isEmpty(headerGroups) && (
|
|
184
|
-
<div className={
|
|
186
|
+
<div className={'GridFormMultiSelect-options'}>
|
|
185
187
|
{headers.map((header, index) => {
|
|
186
188
|
const subOptions = headerGroups[`${header.filter}`];
|
|
187
189
|
return (
|
|
@@ -280,7 +282,7 @@ const FilterInput = (props: {
|
|
|
280
282
|
|
|
281
283
|
const filterTrimmed = filter.trim();
|
|
282
284
|
if (isEmpty(filterTrimmed)) {
|
|
283
|
-
triggerSave()
|
|
285
|
+
void triggerSave();
|
|
284
286
|
return;
|
|
285
287
|
}
|
|
286
288
|
|
|
@@ -290,18 +292,18 @@ const FilterInput = (props: {
|
|
|
290
292
|
if (preFilterOptions === JSON.stringify(options)) return;
|
|
291
293
|
|
|
292
294
|
setOptions([...options]);
|
|
293
|
-
setFilter(
|
|
295
|
+
setFilter('');
|
|
294
296
|
}, [filter, onSelectFilter, options, setFilter, setOptions, triggerSave]);
|
|
295
297
|
|
|
296
298
|
const handleKeyDown = useCallback((e: KeyboardEvent) => {
|
|
297
|
-
if (e.key ===
|
|
299
|
+
if (e.key === 'Enter') {
|
|
298
300
|
enterHasBeenPressed.current = true;
|
|
299
301
|
}
|
|
300
302
|
}, []);
|
|
301
303
|
|
|
302
304
|
const handleKeyUp = useCallback(
|
|
303
305
|
(e: KeyboardEvent) => {
|
|
304
|
-
if (e.key ===
|
|
306
|
+
if (e.key === 'Enter') {
|
|
305
307
|
e.stopPropagation();
|
|
306
308
|
e.preventDefault();
|
|
307
309
|
|
|
@@ -309,14 +311,14 @@ const FilterInput = (props: {
|
|
|
309
311
|
else if (enterHasBeenPressed.current) {
|
|
310
312
|
const filterTrimmed = filter.trim();
|
|
311
313
|
if (isEmpty(filterTrimmed)) {
|
|
312
|
-
triggerSave()
|
|
314
|
+
void triggerSave();
|
|
313
315
|
return;
|
|
314
316
|
}
|
|
315
317
|
onSelectFilter && addCustomFilterValue();
|
|
316
318
|
}
|
|
317
319
|
lastKeyWasEnter.current = true;
|
|
318
|
-
} else if (e.key ===
|
|
319
|
-
lastKeyWasEnter.current && setFilter(
|
|
320
|
+
} else if (e.key === 'Control') {
|
|
321
|
+
lastKeyWasEnter.current && setFilter('');
|
|
320
322
|
lastKeyWasEnter.current = false;
|
|
321
323
|
} else {
|
|
322
324
|
lastKeyWasEnter.current = false;
|
|
@@ -327,14 +329,14 @@ const FilterInput = (props: {
|
|
|
327
329
|
|
|
328
330
|
return (
|
|
329
331
|
<>
|
|
330
|
-
<FocusableItem className={
|
|
332
|
+
<FocusableItem className={'filter-item'} key={'filter'}>
|
|
331
333
|
{(_: any) => (
|
|
332
|
-
<div style={{ width:
|
|
334
|
+
<div style={{ width: '100%' }} className={'GridFormMultiSelect-filter'}>
|
|
333
335
|
<input
|
|
334
|
-
className={
|
|
336
|
+
className={'LuiTextInput-input'}
|
|
335
337
|
type="text"
|
|
336
|
-
placeholder={filterPlaceholder ??
|
|
337
|
-
data-testid={
|
|
338
|
+
placeholder={filterPlaceholder ?? 'Filter...'}
|
|
339
|
+
data-testid={'filteredMenu-free-text-input'}
|
|
338
340
|
value={filter}
|
|
339
341
|
data-disableenterautosave={true}
|
|
340
342
|
data-allowtabtosave={true}
|
|
@@ -346,7 +348,7 @@ const FilterInput = (props: {
|
|
|
346
348
|
<FormError
|
|
347
349
|
error={null}
|
|
348
350
|
helpText={
|
|
349
|
-
typeof filterHelpText ===
|
|
351
|
+
typeof filterHelpText === 'function' ? filterHelpText(filter.trim(), options) : filterHelpText
|
|
350
352
|
}
|
|
351
353
|
/>
|
|
352
354
|
)}
|
|
@@ -378,7 +380,7 @@ const MenuRadioItem = (props: {
|
|
|
378
380
|
<MenuItem
|
|
379
381
|
onClick={(e: ClickEvent) => {
|
|
380
382
|
// Global react-menu MenuItem handler handles tabs
|
|
381
|
-
if (e.key !==
|
|
383
|
+
if (e.key !== 'Tab' && e.key !== 'Enter') {
|
|
382
384
|
e.keepOpen = true;
|
|
383
385
|
toggleValue(item);
|
|
384
386
|
}
|
|
@@ -390,7 +392,7 @@ const MenuRadioItem = (props: {
|
|
|
390
392
|
value={`${item.value}`}
|
|
391
393
|
label={
|
|
392
394
|
<>
|
|
393
|
-
{item.warning && <GridIcon icon={
|
|
395
|
+
{item.warning && <GridIcon icon={'ic_warning_outline'} title={item.warning} />}
|
|
394
396
|
{item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
|
|
395
397
|
</>
|
|
396
398
|
}
|
|
@@ -427,8 +429,8 @@ function MenuSubComponentFr(
|
|
|
427
429
|
|
|
428
430
|
useEffect(() => {
|
|
429
431
|
if (focusableRef.current) {
|
|
430
|
-
const firstInputElement = focusableRef.current.querySelectorAll(
|
|
431
|
-
if (typeof ref ===
|
|
432
|
+
const firstInputElement = focusableRef.current.querySelectorAll('input')[0] ?? null;
|
|
433
|
+
if (typeof ref === 'function') {
|
|
432
434
|
ref(firstInputElement);
|
|
433
435
|
} else if (ref) {
|
|
434
436
|
ref.current = firstInputElement;
|
|
@@ -437,7 +439,7 @@ function MenuSubComponentFr(
|
|
|
437
439
|
}, [ref]);
|
|
438
440
|
|
|
439
441
|
return (
|
|
440
|
-
<FocusableItem className={
|
|
442
|
+
<FocusableItem className={'LuiDeprecatedForms'} key={`${item.value}_subcomponent`} ref={focusableRef}>
|
|
441
443
|
{() => (
|
|
442
444
|
<GridSubComponentContext.Provider
|
|
443
445
|
value={{
|
|
@@ -454,7 +456,7 @@ function MenuSubComponentFr(
|
|
|
454
456
|
triggerSave,
|
|
455
457
|
}}
|
|
456
458
|
>
|
|
457
|
-
<div className={
|
|
459
|
+
<div className={'subComponent'}>{item.subComponent && <item.subComponent />}</div>
|
|
458
460
|
</GridSubComponentContext.Provider>
|
|
459
461
|
)}
|
|
460
462
|
</FocusableItem>
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
1
|
+
import { LuiCheckboxInput } from '@linzjs/lui';
|
|
2
|
+
import { isEqual } from 'lodash-es';
|
|
3
|
+
import { ReactElement, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
6
|
+
import { MenuItem } from '../../react-menu3';
|
|
7
|
+
import { ClickEvent } from '../../react-menu3/types';
|
|
8
|
+
import { GridBaseRow } from '../Grid';
|
|
9
|
+
import { CellEditorCommon } from '../GridCell';
|
|
10
|
+
import { GridIcon } from '../GridIcon';
|
|
11
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
13
12
|
|
|
14
13
|
export interface MultiSelectGridOption {
|
|
15
14
|
value: any;
|
|
16
15
|
label?: string | ReactElement;
|
|
17
|
-
checked?: boolean |
|
|
16
|
+
checked?: boolean | 'partial';
|
|
18
17
|
canSelectPartial?: boolean;
|
|
19
18
|
warning?: string | undefined;
|
|
20
19
|
}
|
|
@@ -96,9 +95,9 @@ export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
|
96
95
|
if (options || optionsInitialising.current) return;
|
|
97
96
|
optionsInitialising.current = true;
|
|
98
97
|
|
|
99
|
-
(async () => {
|
|
100
|
-
const optionsList = typeof props.options ===
|
|
101
|
-
setInitialValues(optionsList.map((o) => ({ ...o, label:
|
|
98
|
+
void (async () => {
|
|
99
|
+
const optionsList = typeof props.options === 'function' ? await props.options(selectedRows) : props.options;
|
|
100
|
+
setInitialValues(optionsList.map((o) => ({ ...o, label: '' })));
|
|
102
101
|
setOptions(optionsList);
|
|
103
102
|
optionsInitialising.current = false;
|
|
104
103
|
})();
|
|
@@ -107,7 +106,7 @@ export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
|
107
106
|
const toggleValue = useCallback(
|
|
108
107
|
(item: MultiSelectGridOption) => {
|
|
109
108
|
if (options) {
|
|
110
|
-
item.checked = item.checked === true && item.canSelectPartial ?
|
|
109
|
+
item.checked = item.checked === true && item.canSelectPartial ? 'partial' : !item.checked;
|
|
111
110
|
setOptions([...options]);
|
|
112
111
|
}
|
|
113
112
|
},
|
|
@@ -116,14 +115,14 @@ export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
|
116
115
|
|
|
117
116
|
return popoverWrapper(
|
|
118
117
|
<>
|
|
119
|
-
<div className={
|
|
118
|
+
<div className={'Grid-popoverContainer'}>
|
|
120
119
|
<div
|
|
121
120
|
style={{
|
|
122
|
-
display:
|
|
123
|
-
gridAutoFlow:
|
|
121
|
+
display: 'grid',
|
|
122
|
+
gridAutoFlow: 'column',
|
|
124
123
|
gridTemplateRows: `repeat(${props.maxRowCount ?? 10}, auto)`,
|
|
125
|
-
maxWidth:
|
|
126
|
-
overflowX:
|
|
124
|
+
maxWidth: 'calc(min(100vw,500px))',
|
|
125
|
+
overflowX: 'auto',
|
|
127
126
|
}}
|
|
128
127
|
>
|
|
129
128
|
{options &&
|
|
@@ -133,7 +132,7 @@ export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
|
133
132
|
key={JSON.stringify(o.value)}
|
|
134
133
|
onClick={(e: ClickEvent) => {
|
|
135
134
|
// Global react-menu MenuItem handler handles tabs
|
|
136
|
-
if (e.key !==
|
|
135
|
+
if (e.key !== 'Tab' && e.key !== 'Enter') {
|
|
137
136
|
e.keepOpen = true;
|
|
138
137
|
toggleValue(o);
|
|
139
138
|
}
|
|
@@ -141,12 +140,12 @@ export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
|
141
140
|
>
|
|
142
141
|
<LuiCheckboxInput
|
|
143
142
|
isChecked={!!o.checked}
|
|
144
|
-
isIndeterminate={o.checked ===
|
|
143
|
+
isIndeterminate={o.checked === 'partial'}
|
|
145
144
|
value={`${o.value}`}
|
|
146
145
|
label={
|
|
147
146
|
<>
|
|
148
|
-
{o.warning && <GridIcon key={
|
|
149
|
-
<span key={
|
|
147
|
+
{o.warning && <GridIcon key={'$$icon$$'} icon={'ic_warning_outline'} title={o.warning} />}
|
|
148
|
+
<span key={'$$label$$'} className={'GridMultiSelectGrid-Label'}>
|
|
150
149
|
{o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`)}
|
|
151
150
|
</span>
|
|
152
151
|
</>
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { isEmpty } from
|
|
2
|
-
import { Fragment, ReactElement, useCallback, useEffect, useRef, useState } from
|
|
3
|
-
|
|
4
|
-
import { useGridPopoverContext } from
|
|
5
|
-
import { GridSubComponentContext } from
|
|
6
|
-
import { FocusableItem, MenuDivider, MenuItem, SubMenu } from
|
|
7
|
-
import { ClickEvent } from
|
|
8
|
-
import { ComponentLoadingWrapper } from
|
|
9
|
-
import { GridBaseRow } from
|
|
10
|
-
import { CellEditorCommon } from
|
|
11
|
-
import { useGridPopoverHook } from
|
|
1
|
+
import { isEmpty } from 'lodash-es';
|
|
2
|
+
import { Fragment, ReactElement, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
5
|
+
import { GridSubComponentContext } from '../../contexts/GridSubComponentContext';
|
|
6
|
+
import { FocusableItem, MenuDivider, MenuItem, SubMenu } from '../../react-menu3';
|
|
7
|
+
import { ClickEvent } from '../../react-menu3/types';
|
|
8
|
+
import { ComponentLoadingWrapper } from '../ComponentLoadingWrapper';
|
|
9
|
+
import { GridBaseRow } from '../Grid';
|
|
10
|
+
import { CellEditorCommon } from '../GridCell';
|
|
11
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
12
12
|
|
|
13
13
|
export interface GridFormPopoverMenuProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
14
|
-
options: (selectedRows: TData[]) => Promise<MenuOption<TData>[]
|
|
15
|
-
defaultAction?: (props: {
|
|
14
|
+
options: (selectedRows: TData[]) => Promise<MenuOption<TData>[]> | MenuOption<TData>[];
|
|
15
|
+
defaultAction?: (props: {
|
|
16
|
+
selectedRows: TData[];
|
|
17
|
+
menuOption: SelectedMenuOptionResult<TData>;
|
|
18
|
+
}) => Promise<void> | void;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
/** Menu configuration types **/
|
|
19
|
-
const __isMenuSeparator__ =
|
|
22
|
+
const __isMenuSeparator__ = '__isMenuSeparator__';
|
|
20
23
|
export const PopoutMenuSeparator = Object.freeze({ label: __isMenuSeparator__ });
|
|
21
24
|
|
|
22
25
|
interface MenuSeparatorType {
|
|
@@ -53,7 +56,7 @@ export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPo
|
|
|
53
56
|
const defaultAction = useCallback(
|
|
54
57
|
async (params: { selectedRows: TData[]; menuOption: SelectedMenuOptionResult<TData> }) => {
|
|
55
58
|
if (props.defaultAction) await props.defaultAction(params);
|
|
56
|
-
else console.error(`No action specified for ${params.menuOption.label} menu options`);
|
|
59
|
+
else console.error(`No action specified for ${String(params.menuOption.label)} menu options`);
|
|
57
60
|
},
|
|
58
61
|
[props],
|
|
59
62
|
);
|
|
@@ -64,8 +67,8 @@ export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPo
|
|
|
64
67
|
optionsInitialising.current = true;
|
|
65
68
|
const optionsConf = props.options ?? [];
|
|
66
69
|
|
|
67
|
-
(async () => {
|
|
68
|
-
const newOptions = typeof optionsConf
|
|
70
|
+
void (async () => {
|
|
71
|
+
const newOptions = typeof optionsConf === 'function' ? await optionsConf(selectedRows) : optionsConf;
|
|
69
72
|
setOptions(newOptions);
|
|
70
73
|
if (!props.defaultAction) {
|
|
71
74
|
const anyOptionsAreMissingAction = newOptions.some((option) => !option.action);
|
|
@@ -100,7 +103,7 @@ export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPo
|
|
|
100
103
|
} else {
|
|
101
104
|
subComponentIsValid.current = true;
|
|
102
105
|
setSubSelectedValue(null);
|
|
103
|
-
await updateValue(async () => actionClick(item), e.key ===
|
|
106
|
+
await updateValue(async () => actionClick(item), e.key === 'Tab' ? (e.shiftKey ? -1 : 1) : 0);
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
[actionClick, subComponentSelected, updateValue],
|
|
@@ -123,40 +126,40 @@ export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPo
|
|
|
123
126
|
});
|
|
124
127
|
|
|
125
128
|
return popoverWrapper(
|
|
126
|
-
<ComponentLoadingWrapper loading={!options} className={
|
|
129
|
+
<ComponentLoadingWrapper loading={!options} className={'GridFormPopupMenu'}>
|
|
127
130
|
<>
|
|
128
131
|
{isEmpty(options) ? (
|
|
129
|
-
<MenuItem key={`GridPopoverMenu-empty`} className={
|
|
132
|
+
<MenuItem key={`GridPopoverMenu-empty`} className={'GridPopoverMenu-noOptions'} disabled={true}>
|
|
130
133
|
No actions
|
|
131
134
|
</MenuItem>
|
|
132
135
|
) : (
|
|
133
136
|
options?.map((item, index) =>
|
|
134
|
-
item.label ===
|
|
137
|
+
item.label === '__isMenuSeparator__' ? (
|
|
135
138
|
<MenuDivider key={`$$divider_${index}`} />
|
|
136
139
|
) : (
|
|
137
140
|
!item.hidden && (
|
|
138
|
-
<Fragment key={`${item.label}`}>
|
|
141
|
+
<Fragment key={`${String(item.label)}`}>
|
|
139
142
|
{item.subMenu ? (
|
|
140
143
|
<SubMenu
|
|
141
|
-
key={`${item.label}`}
|
|
144
|
+
key={`${String(item.label)}`}
|
|
142
145
|
disabled={!!item.disabled}
|
|
143
146
|
label={item.label as string}
|
|
144
|
-
title={item.disabled && typeof item.disabled !==
|
|
147
|
+
title={item.disabled && typeof item.disabled !== 'boolean' ? item.disabled : ''}
|
|
145
148
|
>
|
|
146
149
|
<item.subMenu />
|
|
147
150
|
</SubMenu>
|
|
148
151
|
) : (
|
|
149
152
|
<MenuItem
|
|
150
|
-
key={`${item.label}`}
|
|
151
|
-
onClick={(e: ClickEvent) => onMenuItemClick(e, item)}
|
|
153
|
+
key={`${String(item.label)}`}
|
|
154
|
+
onClick={(e: ClickEvent) => void onMenuItemClick(e, item)}
|
|
152
155
|
disabled={!!item.disabled}
|
|
153
|
-
title={item.disabled && typeof item.disabled !==
|
|
156
|
+
title={item.disabled && typeof item.disabled !== 'boolean' ? item.disabled : ''}
|
|
154
157
|
>
|
|
155
158
|
{item.label as ReactElement | string}
|
|
156
159
|
</MenuItem>
|
|
157
160
|
)}
|
|
158
161
|
{item.subComponent && subComponentSelected === item && (
|
|
159
|
-
<FocusableItem className={
|
|
162
|
+
<FocusableItem className={'LuiDeprecatedForms'} key={`${String(item.label)}_subcomponent`}>
|
|
160
163
|
{() => (
|
|
161
164
|
<GridSubComponentContext.Provider
|
|
162
165
|
value={{
|
|
@@ -172,7 +175,7 @@ export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPo
|
|
|
172
175
|
triggerSave,
|
|
173
176
|
}}
|
|
174
177
|
>
|
|
175
|
-
<div className={
|
|
178
|
+
<div className={'subComponent'}>{item.subComponent && <item.subComponent />}</div>
|
|
176
179
|
</GridSubComponentContext.Provider>
|
|
177
180
|
)}
|
|
178
181
|
</FocusableItem>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import clsx from
|
|
2
|
-
import { ReactElement, useCallback, useContext, useEffect } from
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { ReactElement, useCallback, useContext, useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
import { GridSubComponentContext } from
|
|
5
|
-
import { TextAreaInput } from
|
|
6
|
-
import { TextInputValidator, TextInputValidatorProps } from
|
|
7
|
-
import { GridBaseRow } from
|
|
8
|
-
import { CellEditorCommon } from
|
|
4
|
+
import { GridSubComponentContext } from '../../contexts/GridSubComponentContext';
|
|
5
|
+
import { TextAreaInput } from '../../lui/TextAreaInput';
|
|
6
|
+
import { TextInputValidator, TextInputValidatorProps } from '../../utils/textValidator';
|
|
7
|
+
import { GridBaseRow } from '../Grid';
|
|
8
|
+
import { CellEditorCommon } from '../GridCell';
|
|
9
9
|
|
|
10
10
|
export interface GridSubComponentTextAreaProps<TData extends GridBaseRow>
|
|
11
11
|
extends TextInputValidatorProps<TData>,
|
|
@@ -22,7 +22,7 @@ export const GridFormSubComponentTextArea = <TData extends GridBaseRow>(
|
|
|
22
22
|
): ReactElement => {
|
|
23
23
|
const { value, data, setValue, setValid, context } = useContext(GridSubComponentContext);
|
|
24
24
|
|
|
25
|
-
const helpText = props.helpText ??
|
|
25
|
+
const helpText = props.helpText ?? 'Press tab to save';
|
|
26
26
|
|
|
27
27
|
// If is not initialised yet as it's just been created then set the default value
|
|
28
28
|
useEffect(() => {
|
|
@@ -36,9 +36,9 @@ export const GridFormSubComponentTextArea = <TData extends GridBaseRow>(
|
|
|
36
36
|
}, [setValid, invalid, value]);
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<div className={clsx(
|
|
39
|
+
<div className={clsx('FreeTextInput', props.className)}>
|
|
40
40
|
<TextAreaInput
|
|
41
|
-
className={
|
|
41
|
+
className={'free-text-input'}
|
|
42
42
|
value={value}
|
|
43
43
|
onChange={(e) => setValue(e.target.value)}
|
|
44
44
|
error={invalid()}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ReactElement, useCallback, useContext, useEffect } from
|
|
1
|
+
import { ReactElement, useCallback, useContext, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
import { GridSubComponentContext } from
|
|
4
|
-
import { TextInputFormatted } from
|
|
5
|
-
import { TextInputValidator, TextInputValidatorProps } from
|
|
6
|
-
import { GridBaseRow } from
|
|
7
|
-
import { CellEditorCommon } from
|
|
3
|
+
import { GridSubComponentContext } from '../../contexts/GridSubComponentContext';
|
|
4
|
+
import { TextInputFormatted } from '../../lui/TextInputFormatted';
|
|
5
|
+
import { TextInputValidator, TextInputValidatorProps } from '../../utils/textValidator';
|
|
6
|
+
import { GridBaseRow } from '../Grid';
|
|
7
|
+
import { CellEditorCommon } from '../GridCell';
|
|
8
8
|
|
|
9
9
|
export interface GridFormSubComponentTextInputProps<TData extends GridBaseRow>
|
|
10
10
|
extends TextInputValidatorProps<TData>,
|
|
@@ -20,7 +20,7 @@ export const GridFormSubComponentTextInput = <TData extends GridBaseRow>(
|
|
|
20
20
|
): ReactElement => {
|
|
21
21
|
const { value, setValue, setValid, data, context } = useContext(GridSubComponentContext);
|
|
22
22
|
|
|
23
|
-
const helpText = props.helpText ??
|
|
23
|
+
const helpText = props.helpText ?? 'Press enter or tab to save';
|
|
24
24
|
|
|
25
25
|
// If is not initialised yet as it's just been created then set the default value
|
|
26
26
|
useEffect(() => {
|
|
@@ -40,7 +40,7 @@ export const GridFormSubComponentTextInput = <TData extends GridBaseRow>(
|
|
|
40
40
|
onChange={(e) => setValue(e.target.value)}
|
|
41
41
|
helpText={helpText}
|
|
42
42
|
placeholder={props.placeholder}
|
|
43
|
-
style={{ width:
|
|
43
|
+
style={{ width: '100%' }}
|
|
44
44
|
allowTabToSave={true}
|
|
45
45
|
/>
|
|
46
46
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactElement, useCallback, useMemo, useState } from
|
|
1
|
+
import { ReactElement, useCallback, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useGridPopoverContext } from
|
|
4
|
-
import { TextAreaInput } from
|
|
5
|
-
import { TextInputValidator, TextInputValidatorProps } from
|
|
6
|
-
import { GridBaseRow } from
|
|
7
|
-
import { CellEditorCommon } from
|
|
8
|
-
import { useGridPopoverHook } from
|
|
3
|
+
import { useGridPopoverContext } from '../../contexts/GridPopoverContext';
|
|
4
|
+
import { TextAreaInput } from '../../lui/TextAreaInput';
|
|
5
|
+
import { TextInputValidator, TextInputValidatorProps } from '../../utils/textValidator';
|
|
6
|
+
import { GridBaseRow } from '../Grid';
|
|
7
|
+
import { CellEditorCommon } from '../GridCell';
|
|
8
|
+
import { useGridPopoverHook } from '../GridPopoverHook';
|
|
9
9
|
|
|
10
10
|
export interface GridFormTextAreaProps<TData extends GridBaseRow>
|
|
11
11
|
extends TextInputValidatorProps<TData>,
|
|
@@ -19,10 +19,10 @@ export interface GridFormTextAreaProps<TData extends GridBaseRow>
|
|
|
19
19
|
export const GridFormTextArea = <TData extends GridBaseRow>(props: GridFormTextAreaProps<TData>): ReactElement => {
|
|
20
20
|
const { field, value: initialVale, data } = useGridPopoverContext<TData>();
|
|
21
21
|
|
|
22
|
-
const initValue = useMemo(() => (initialVale == null ?
|
|
22
|
+
const initValue = useMemo(() => (initialVale == null ? '' : `${initialVale}`), [initialVale]);
|
|
23
23
|
const [value, setValue] = useState(initValue);
|
|
24
24
|
|
|
25
|
-
const helpText = props.helpText ??
|
|
25
|
+
const helpText = props.helpText ?? 'Press tab to save';
|
|
26
26
|
|
|
27
27
|
const invalid = useCallback(() => TextInputValidator(props, value, data, {}), [props, value, data]);
|
|
28
28
|
|
|
@@ -51,12 +51,12 @@ export const GridFormTextArea = <TData extends GridBaseRow>(props: GridFormTextA
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
return popoverWrapper(
|
|
54
|
-
<div className={
|
|
54
|
+
<div className={'subComponent'} style={{ display: 'flex', flexDirection: 'row', width: props.width ?? 240 }}>
|
|
55
55
|
<TextAreaInput
|
|
56
56
|
value={value}
|
|
57
57
|
onChange={(e) => setValue(e.target.value)}
|
|
58
58
|
error={invalid()}
|
|
59
|
-
placeholder={props.placeholder ??
|
|
59
|
+
placeholder={props.placeholder ?? 'Type here'}
|
|
60
60
|
helpText={helpText}
|
|
61
61
|
/>
|
|
62
62
|
</div>,
|