@linzjs/step-ag-grid 20.0.0 → 21.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 +9 -9
- package/dist/src/components/Grid.d.ts +80 -80
- package/dist/src/components/GridCell.d.ts +63 -27
- package/dist/src/components/GridCell.test.d.ts +1 -1
- package/dist/src/components/GridCellFiller.d.ts +5 -4
- package/dist/src/components/GridCellMultiEditor.d.ts +18 -18
- package/dist/src/components/GridCellMultiSelectClassRules.d.ts +2 -2
- package/dist/src/components/GridIcon.d.ts +9 -9
- package/dist/src/components/GridLoadableCell.d.ts +1 -1
- package/dist/src/components/GridNoRowsOverlay.d.ts +9 -9
- package/dist/src/components/GridPopoverHook.d.ts +12 -12
- package/dist/src/components/GridWrapper.d.ts +5 -5
- package/dist/src/components/PostSortRowsHook.d.ts +11 -11
- package/dist/src/components/gridFilter/GridFilterButtons.d.ts +16 -16
- package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +5 -5
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +2 -2
- package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +11 -11
- package/dist/src/components/gridFilter/GridFilterQuick.d.ts +5 -5
- package/dist/src/components/gridFilter/GridFilters.d.ts +2 -2
- package/dist/src/components/gridFilter/index.d.ts +7 -7
- package/dist/src/components/gridFilter/useGridFilter.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +37 -37
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +12 -12
- package/dist/src/components/gridForm/GridFormMessage.d.ts +7 -7
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +36 -36
- package/dist/src/components/gridForm/GridFormMultiSelectGrid.d.ts +24 -24
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +36 -36
- package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +12 -12
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +11 -11
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +14 -14
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +14 -14
- package/dist/src/components/gridForm/index.d.ts +10 -10
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +7 -7
- 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 +19 -19
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +16 -16
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +8 -8
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +5 -5
- package/dist/src/components/gridPopoverEdit/index.d.ts +9 -9
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +16 -37
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +2 -2
- package/dist/src/components/gridRender/index.d.ts +2 -2
- package/dist/src/components/gridUtil.d.ts +3 -3
- package/dist/src/components/index.d.ts +18 -18
- package/dist/src/contexts/GridContext.d.ts +67 -67
- package/dist/src/contexts/GridContextProvider.d.ts +15 -15
- package/dist/src/contexts/GridContextProvider.test.d.ts +1 -1
- package/dist/src/contexts/GridPopoverContext.d.ts +15 -15
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +7 -7
- package/dist/src/contexts/GridSubComponentContext.d.ts +10 -10
- package/dist/src/contexts/GridUpdatingContext.d.ts +8 -8
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +3 -3
- package/dist/src/index.d.ts +17 -17
- package/dist/src/lui/ActionButton.d.ts +20 -20
- package/dist/src/lui/FormError.d.ts +7 -7
- package/dist/src/lui/TextAreaInput.d.ts +11 -11
- package/dist/src/lui/TextInputFormatted.d.ts +10 -10
- package/dist/src/lui/reactUtils.d.ts +6 -6
- package/dist/src/lui/reactUtils.test.d.ts +1 -1
- package/dist/src/lui/stateDeferredHook.d.ts +4 -4
- package/dist/src/lui/timeoutHook.d.ts +14 -14
- package/dist/src/lui/timeoutHook.test.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +8 -8
- package/dist/src/react-menu3/components/FocusableItem.d.ts +9 -9
- package/dist/src/react-menu3/components/Menu.d.ts +16 -16
- package/dist/src/react-menu3/components/MenuButton.d.ts +8 -8
- package/dist/src/react-menu3/components/MenuDivider.d.ts +3 -3
- package/dist/src/react-menu3/components/MenuGroup.d.ts +12 -12
- package/dist/src/react-menu3/components/MenuHeader.d.ts +4 -4
- package/dist/src/react-menu3/components/MenuItem.d.ts +59 -59
- package/dist/src/react-menu3/components/MenuList.d.ts +2 -2
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +25 -25
- package/dist/src/react-menu3/components/SubMenu.d.ts +110 -110
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +7 -7
- package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +2 -2
- package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +5 -5
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +9 -9
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +11 -11
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +7 -7
- package/dist/src/react-menu3/contexts/SettingsContext.d.ts +20 -20
- package/dist/src/react-menu3/hooks/index.d.ts +9 -9
- package/dist/src/react-menu3/hooks/useBEM.d.ts +10 -10
- package/dist/src/react-menu3/hooks/useCombinedRef.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useIsomorphicLayoutEffect.d.ts +3 -3
- package/dist/src/react-menu3/hooks/useItemEffect.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useItemState.d.ts +7 -7
- package/dist/src/react-menu3/hooks/useItems.d.ts +7 -7
- package/dist/src/react-menu3/hooks/useMenuChange.d.ts +2 -2
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +23 -14
- package/dist/src/react-menu3/hooks/useMenuStateAndFocus.d.ts +2 -2
- package/dist/src/react-menu3/index.d.ts +11 -11
- package/dist/src/react-menu3/positionUtils/getPositionHelpers.d.ts +11 -11
- package/dist/src/react-menu3/positionUtils/index.d.ts +3 -3
- package/dist/src/react-menu3/positionUtils/placeArrowHorizontal.d.ts +8 -8
- package/dist/src/react-menu3/positionUtils/placeArrowVertical.d.ts +8 -8
- package/dist/src/react-menu3/positionUtils/placeLeftorRight.d.ts +19 -19
- package/dist/src/react-menu3/positionUtils/placeToporBottom.d.ts +19 -19
- package/dist/src/react-menu3/positionUtils/positionContextMenu.d.ts +13 -13
- package/dist/src/react-menu3/positionUtils/positionMenu.d.ts +26 -26
- package/dist/src/react-menu3/style-utils/index.d.ts +11 -11
- package/dist/src/react-menu3/types.d.ts +401 -401
- package/dist/src/react-menu3/utils/constants.d.ts +54 -54
- package/dist/src/react-menu3/utils/index.d.ts +3 -3
- package/dist/src/react-menu3/utils/propTypes2.d.ts +56 -56
- package/dist/src/react-menu3/utils/utils.d.ts +37 -37
- package/dist/src/react-menu3/utils/withHovering.d.ts +7 -7
- package/dist/src/utils/bearing.d.ts +19 -19
- package/dist/src/utils/bearing.test.d.ts +1 -1
- package/dist/src/utils/deferredPromise.d.ts +5 -5
- package/dist/src/utils/storybookTestUtil.d.ts +3 -3
- package/dist/src/utils/testQuick.d.ts +62 -62
- package/dist/src/utils/testUtil.d.ts +46 -45
- package/dist/src/utils/textMatcher.d.ts +13 -13
- package/dist/src/utils/textMatcher.test.d.ts +1 -1
- package/dist/src/utils/textValidator.d.ts +18 -18
- package/dist/src/utils/textValidator.test.d.ts +1 -1
- package/dist/src/utils/util.d.ts +8 -8
- package/dist/src/utils/util.test.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +4652 -4651
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +4652 -4651
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/dist/vite.config.d.ts +2 -0
- package/package.json +21 -20
- package/src/components/Grid.tsx +4 -4
- package/src/components/GridCell.test.tsx +2 -3
- package/src/components/GridCell.tsx +75 -23
- package/src/components/GridCellFiller.tsx +2 -1
- package/src/components/GridCellMultiEditor.tsx +9 -9
- package/src/components/GridCellMultiSelectClassRules.tsx +4 -4
- package/src/components/GridPopoverHook.tsx +4 -4
- package/src/components/PostSortRowsHook.ts +2 -2
- package/src/components/gridFilter/GridFilterButtons.tsx +6 -6
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +2 -5
- package/src/components/gridFilter/GridFilterDownloadCsvButton.tsx +1 -1
- package/src/components/gridFilter/useGridFilter.ts +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +9 -9
- package/src/components/gridForm/GridFormEditBearing.tsx +5 -5
- package/src/components/gridForm/GridFormMessage.tsx +4 -4
- package/src/components/gridForm/GridFormMultiSelect.tsx +9 -9
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +11 -11
- package/src/components/gridForm/GridFormPopoverMenu.tsx +13 -13
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +4 -4
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +4 -4
- package/src/components/gridForm/GridFormTextArea.tsx +6 -6
- package/src/components/gridForm/GridFormTextInput.tsx +7 -7
- package/src/components/gridHook/useGridContextMenu.tsx +8 -8
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +6 -6
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelectGrid.ts +6 -6
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +16 -16
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +6 -6
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +5 -5
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +5 -5
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +5 -4
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +5 -5
- package/src/components/gridRender/GridRenderGenericCell.tsx +6 -36
- package/src/contexts/GridContext.tsx +7 -7
- package/src/contexts/GridContextProvider.test.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +10 -10
- package/src/contexts/GridPopoverContext.tsx +6 -6
- package/src/stories/grid/GridDragRow.stories.tsx +4 -4
- package/src/stories/grid/GridNonEditableRow.stories.tsx +2 -3
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +2 -2
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +1 -1
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +2 -2
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +3 -3
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +2 -2
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +2 -2
- package/src/stories/grid/GridReadOnly.stories.tsx +6 -6
- package/src/stories/grid/GridViewList.stories.tsx +5 -7
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +3 -3
- package/src/utils/testUtil.ts +49 -7
- package/src/utils/textValidator.ts +5 -5
- package/src/utils/util.ts +1 -1
|
@@ -45,12 +45,12 @@ export interface GridFormMultiSelectGroup {
|
|
|
45
45
|
filter?: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export interface GridFormMultiSelectSaveProps<
|
|
49
|
-
selectedRows:
|
|
48
|
+
export interface GridFormMultiSelectSaveProps<TData extends GridBaseRow> {
|
|
49
|
+
selectedRows: TData[];
|
|
50
50
|
selectedOptions: MultiSelectOption[];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export interface GridFormMultiSelectProps<
|
|
53
|
+
export interface GridFormMultiSelectProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
54
54
|
className?:
|
|
55
55
|
| "GridMultiSelect-containerSmall"
|
|
56
56
|
| "GridMultiSelect-containerMedium"
|
|
@@ -63,14 +63,14 @@ export interface GridFormMultiSelectProps<RowType extends GridBaseRow> extends C
|
|
|
63
63
|
filterHelpText?: string | ((filter: string, options: MultiSelectOption[]) => string | undefined);
|
|
64
64
|
noOptionsMessage?: string;
|
|
65
65
|
onSelectFilter?: (props: { filter: string; options: MultiSelectOption[] }) => void;
|
|
66
|
-
onSave?: (props: GridFormMultiSelectSaveProps<
|
|
66
|
+
onSave?: (props: GridFormMultiSelectSaveProps<TData>) => Promise<boolean>;
|
|
67
67
|
headers?: GridFormMultiSelectGroup[];
|
|
68
|
-
options: MultiSelectOption[] | ((selectedRows:
|
|
69
|
-
invalid?: (selectedRows:
|
|
68
|
+
options: MultiSelectOption[] | ((selectedRows: TData[]) => Promise<MultiSelectOption[]> | MultiSelectOption[]);
|
|
69
|
+
invalid?: (selectedRows: TData[], selectedOptions: MultiSelectOption[]) => boolean;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export const GridFormMultiSelect = <
|
|
73
|
-
const { selectedRows, data } = useGridPopoverContext<
|
|
72
|
+
export const GridFormMultiSelect = <TData extends GridBaseRow>(props: GridFormMultiSelectProps<TData>) => {
|
|
73
|
+
const { selectedRows, data } = useGridPopoverContext<TData>();
|
|
74
74
|
|
|
75
75
|
const subComponentIsValidRef = useRef<Record<string, boolean>>({});
|
|
76
76
|
const optionsInitialising = useRef(false);
|
|
@@ -95,7 +95,7 @@ export const GridFormMultiSelect = <RowType extends GridBaseRow>(props: GridForm
|
|
|
95
95
|
}, [options, props, selectedRows]);
|
|
96
96
|
|
|
97
97
|
const save = useCallback(
|
|
98
|
-
async (selectedRows:
|
|
98
|
+
async (selectedRows: TData[]): Promise<boolean> => {
|
|
99
99
|
if (!options || !props.onSave) return true;
|
|
100
100
|
|
|
101
101
|
// Any changes to save?
|
|
@@ -19,34 +19,34 @@ export interface MultiSelectGridOption {
|
|
|
19
19
|
warning?: string | undefined;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export interface GridFormMultiSelectGridSaveProps<
|
|
23
|
-
selectedRows:
|
|
22
|
+
export interface GridFormMultiSelectGridSaveProps<TData extends GridBaseRow> {
|
|
23
|
+
selectedRows: TData[];
|
|
24
24
|
addValues: any[];
|
|
25
25
|
removeValues: any[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export interface GridFormMultiSelectGridProps<
|
|
28
|
+
export interface GridFormMultiSelectGridProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
29
29
|
className?: string | undefined;
|
|
30
30
|
noOptionsMessage?: string;
|
|
31
|
-
onSave?: (props: GridFormMultiSelectGridSaveProps<
|
|
31
|
+
onSave?: (props: GridFormMultiSelectGridSaveProps<TData>) => Promise<boolean>;
|
|
32
32
|
options:
|
|
33
33
|
| MultiSelectGridOption[]
|
|
34
|
-
| ((selectedRows:
|
|
35
|
-
invalid?: (props: GridFormMultiSelectGridSaveProps<
|
|
34
|
+
| ((selectedRows: TData[]) => Promise<MultiSelectGridOption[]> | MultiSelectGridOption[]);
|
|
35
|
+
invalid?: (props: GridFormMultiSelectGridSaveProps<TData>) => boolean;
|
|
36
36
|
maxRowCount?: number;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export const GridFormMultiSelectGrid = <
|
|
40
|
-
props: GridFormMultiSelectGridProps<
|
|
39
|
+
export const GridFormMultiSelectGrid = <TData extends GridBaseRow>(
|
|
40
|
+
props: GridFormMultiSelectGridProps<TData>,
|
|
41
41
|
): ReactElement => {
|
|
42
|
-
const { selectedRows } = useGridPopoverContext<
|
|
42
|
+
const { selectedRows } = useGridPopoverContext<TData>();
|
|
43
43
|
const optionsInitialising = useRef(false);
|
|
44
44
|
|
|
45
45
|
const [initialValues, setInitialValues] = useState<MultiSelectGridOption[]>();
|
|
46
46
|
const [options, setOptions] = useState<MultiSelectGridOption[]>();
|
|
47
47
|
|
|
48
48
|
const genSave = useCallback(
|
|
49
|
-
(selectedRows:
|
|
49
|
+
(selectedRows: TData[]): GridFormMultiSelectGridSaveProps<TData> => {
|
|
50
50
|
if (!options) return { selectedRows, addValues: [], removeValues: [] };
|
|
51
51
|
|
|
52
52
|
const preChecked = (initialValues ?? []).filter((o) => o.checked).map((o) => o.value);
|
|
@@ -63,7 +63,7 @@ export const GridFormMultiSelectGrid = <RowType extends GridBaseRow>(
|
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const save = useCallback(
|
|
66
|
-
async (selectedRows:
|
|
66
|
+
async (selectedRows: TData[]): Promise<boolean> => {
|
|
67
67
|
if (!options || !props.onSave) return true;
|
|
68
68
|
// Any changes to save?
|
|
69
69
|
if (
|
|
@@ -10,9 +10,9 @@ import { GridBaseRow } from "../Grid";
|
|
|
10
10
|
import { CellEditorCommon } from "../GridCell";
|
|
11
11
|
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
12
12
|
|
|
13
|
-
export interface GridFormPopoverMenuProps<
|
|
14
|
-
options: (selectedRows:
|
|
15
|
-
defaultAction?: (props: { selectedRows:
|
|
13
|
+
export interface GridFormPopoverMenuProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
14
|
+
options: (selectedRows: TData[]) => Promise<MenuOption<TData>[]>;
|
|
15
|
+
defaultAction?: (props: { selectedRows: TData[]; menuOption: SelectedMenuOptionResult<TData> }) => Promise<void>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/** Menu configuration types **/
|
|
@@ -23,14 +23,14 @@ interface MenuSeparatorType {
|
|
|
23
23
|
__isMenuSeparator__: boolean;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export interface SelectedMenuOptionResult<
|
|
26
|
+
export interface SelectedMenuOptionResult<TData extends GridBaseRow> extends MenuOption<TData> {
|
|
27
27
|
subValue: any;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export interface MenuOption<
|
|
30
|
+
export interface MenuOption<TData extends GridBaseRow> {
|
|
31
31
|
label: ReactElement | string | MenuSeparatorType;
|
|
32
32
|
subMenu?: () => ReactElement;
|
|
33
|
-
action?: (props: { selectedRows:
|
|
33
|
+
action?: (props: { selectedRows: TData[]; menuOption: SelectedMenuOptionResult<TData> }) => Promise<void>;
|
|
34
34
|
disabled?: string | boolean;
|
|
35
35
|
hidden?: boolean;
|
|
36
36
|
subComponent?: (props: any) => ReactElement;
|
|
@@ -40,18 +40,18 @@ export interface MenuOption<RowType extends GridBaseRow> {
|
|
|
40
40
|
* NOTE: If the popout menu doesn't appear on single click when also selecting row it's because
|
|
41
41
|
* you need a useMemo around your columnDefs
|
|
42
42
|
*/
|
|
43
|
-
export const GridFormPopoverMenu = <
|
|
44
|
-
const { selectedRows, updateValue, data } = useGridPopoverContext<
|
|
43
|
+
export const GridFormPopoverMenu = <TData extends GridBaseRow>(props: GridFormPopoverMenuProps<TData>) => {
|
|
44
|
+
const { selectedRows, updateValue, data } = useGridPopoverContext<TData>();
|
|
45
45
|
|
|
46
46
|
const optionsInitialising = useRef(false);
|
|
47
|
-
const [options, setOptions] = useState<MenuOption<
|
|
47
|
+
const [options, setOptions] = useState<MenuOption<TData>[]>();
|
|
48
48
|
|
|
49
|
-
const [subComponentSelected, setSubComponentSelected] = useState<MenuOption<
|
|
49
|
+
const [subComponentSelected, setSubComponentSelected] = useState<MenuOption<TData> | null>(null);
|
|
50
50
|
const subComponentIsValid = useRef(false);
|
|
51
51
|
const [subSelectedValue, setSubSelectedValue] = useState<any>();
|
|
52
52
|
|
|
53
53
|
const defaultAction = useCallback(
|
|
54
|
-
async (params: { selectedRows:
|
|
54
|
+
async (params: { selectedRows: TData[]; menuOption: SelectedMenuOptionResult<TData> }) => {
|
|
55
55
|
if (props.defaultAction) await props.defaultAction(params);
|
|
56
56
|
else console.error(`No action specified for ${params.menuOption.label} menu options`);
|
|
57
57
|
},
|
|
@@ -80,7 +80,7 @@ export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridForm
|
|
|
80
80
|
}, [options, props.defaultAction, props.options, selectedRows]);
|
|
81
81
|
|
|
82
82
|
const actionClick = useCallback(
|
|
83
|
-
async (menuOption: MenuOption<
|
|
83
|
+
async (menuOption: MenuOption<TData>) => {
|
|
84
84
|
await (menuOption.action ?? defaultAction)({
|
|
85
85
|
selectedRows,
|
|
86
86
|
menuOption: { ...menuOption, subValue: subSelectedValue },
|
|
@@ -91,7 +91,7 @@ export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridForm
|
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
const onMenuItemClick = useCallback(
|
|
94
|
-
async (e: ClickEvent, item: MenuOption<
|
|
94
|
+
async (e: ClickEvent, item: MenuOption<TData>) => {
|
|
95
95
|
if (item.subComponent) {
|
|
96
96
|
subComponentIsValid.current = false;
|
|
97
97
|
setSubSelectedValue(null);
|
|
@@ -7,8 +7,8 @@ import { TextInputValidator, TextInputValidatorProps } from "../../utils/textVal
|
|
|
7
7
|
import { GridBaseRow } from "../Grid";
|
|
8
8
|
import { CellEditorCommon } from "../GridCell";
|
|
9
9
|
|
|
10
|
-
export interface GridSubComponentTextAreaProps<
|
|
11
|
-
extends TextInputValidatorProps<
|
|
10
|
+
export interface GridSubComponentTextAreaProps<TData extends GridBaseRow>
|
|
11
|
+
extends TextInputValidatorProps<TData>,
|
|
12
12
|
CellEditorCommon {
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
width?: string | number;
|
|
@@ -17,8 +17,8 @@ export interface GridSubComponentTextAreaProps<RowType extends GridBaseRow>
|
|
|
17
17
|
helpText?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export const GridFormSubComponentTextArea = <
|
|
21
|
-
props: GridSubComponentTextAreaProps<
|
|
20
|
+
export const GridFormSubComponentTextArea = <TData extends GridBaseRow>(
|
|
21
|
+
props: GridSubComponentTextAreaProps<TData>,
|
|
22
22
|
): ReactElement => {
|
|
23
23
|
const { value, data, setValue, setValid, context } = useContext(GridSubComponentContext);
|
|
24
24
|
|
|
@@ -6,8 +6,8 @@ import { TextInputValidator, TextInputValidatorProps } from "../../utils/textVal
|
|
|
6
6
|
import { GridBaseRow } from "../Grid";
|
|
7
7
|
import { CellEditorCommon } from "../GridCell";
|
|
8
8
|
|
|
9
|
-
export interface GridFormSubComponentTextInputProps<
|
|
10
|
-
extends TextInputValidatorProps<
|
|
9
|
+
export interface GridFormSubComponentTextInputProps<TData extends GridBaseRow>
|
|
10
|
+
extends TextInputValidatorProps<TData>,
|
|
11
11
|
CellEditorCommon {
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
width?: string | number;
|
|
@@ -15,8 +15,8 @@ export interface GridFormSubComponentTextInputProps<RowType extends GridBaseRow>
|
|
|
15
15
|
helpText?: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const GridFormSubComponentTextInput = <
|
|
19
|
-
props: GridFormSubComponentTextInputProps<
|
|
18
|
+
export const GridFormSubComponentTextInput = <TData extends GridBaseRow>(
|
|
19
|
+
props: GridFormSubComponentTextInputProps<TData>,
|
|
20
20
|
): ReactElement => {
|
|
21
21
|
const { value, setValue, setValid, data, context } = useContext(GridSubComponentContext);
|
|
22
22
|
|
|
@@ -7,17 +7,17 @@ import { GridBaseRow } from "../Grid";
|
|
|
7
7
|
import { CellEditorCommon } from "../GridCell";
|
|
8
8
|
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
9
9
|
|
|
10
|
-
export interface GridFormTextAreaProps<
|
|
11
|
-
extends TextInputValidatorProps<
|
|
10
|
+
export interface GridFormTextAreaProps<TData extends GridBaseRow>
|
|
11
|
+
extends TextInputValidatorProps<TData>,
|
|
12
12
|
CellEditorCommon {
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
width?: string | number;
|
|
15
|
-
onSave?: (props: { selectedRows:
|
|
15
|
+
onSave?: (props: { selectedRows: TData[]; value: string }) => Promise<boolean>;
|
|
16
16
|
helpText?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const GridFormTextArea = <
|
|
20
|
-
const { field, value: initialVale, data } = useGridPopoverContext<
|
|
19
|
+
export const GridFormTextArea = <TData extends GridBaseRow>(props: GridFormTextAreaProps<TData>): ReactElement => {
|
|
20
|
+
const { field, value: initialVale, data } = useGridPopoverContext<TData>();
|
|
21
21
|
|
|
22
22
|
const initValue = useMemo(() => (initialVale == null ? "" : `${initialVale}`), [initialVale]);
|
|
23
23
|
const [value, setValue] = useState(initValue);
|
|
@@ -27,7 +27,7 @@ export const GridFormTextArea = <RowType extends GridBaseRow>(props: GridFormTex
|
|
|
27
27
|
const invalid = useCallback(() => TextInputValidator(props, value, data, {}), [props, value, data]);
|
|
28
28
|
|
|
29
29
|
const save = useCallback(
|
|
30
|
-
async (selectedRows:
|
|
30
|
+
async (selectedRows: TData[]): Promise<boolean> => {
|
|
31
31
|
if (invalid()) return false;
|
|
32
32
|
|
|
33
33
|
const trimmedValue = value.trim();
|
|
@@ -7,28 +7,28 @@ import { GridBaseRow } from "../Grid";
|
|
|
7
7
|
import { CellEditorCommon } from "../GridCell";
|
|
8
8
|
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
9
9
|
|
|
10
|
-
export interface GridFormTextInputProps<
|
|
11
|
-
extends TextInputValidatorProps<
|
|
10
|
+
export interface GridFormTextInputProps<TData extends GridBaseRow>
|
|
11
|
+
extends TextInputValidatorProps<TData>,
|
|
12
12
|
CellEditorCommon {
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
units?: string;
|
|
15
15
|
width?: string | number;
|
|
16
|
-
onSave?: (props: { selectedRows:
|
|
16
|
+
onSave?: (props: { selectedRows: TData[]; value: string }) => Promise<boolean>;
|
|
17
17
|
helpText?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export const GridFormTextInput = <
|
|
21
|
-
const { field, value: initialVale, data } = useGridPopoverContext<
|
|
20
|
+
export const GridFormTextInput = <TData extends GridBaseRow>(props: GridFormTextInputProps<TData>) => {
|
|
21
|
+
const { field, value: initialVale, data } = useGridPopoverContext<TData>();
|
|
22
22
|
|
|
23
23
|
const helpText = props.helpText ?? "Press enter or tab to save";
|
|
24
24
|
|
|
25
25
|
const initValue = useMemo(() => (initialVale == null ? "" : `${initialVale}`), [initialVale]);
|
|
26
26
|
const [value, setValue] = useState(initValue);
|
|
27
27
|
|
|
28
|
-
const invalid = useCallback(() => TextInputValidator<
|
|
28
|
+
const invalid = useCallback(() => TextInputValidator<TData>(props, value, data, {}), [data, props, value]);
|
|
29
29
|
|
|
30
30
|
const save = useCallback(
|
|
31
|
-
async (selectedRows:
|
|
31
|
+
async (selectedRows: TData[]): Promise<boolean> => {
|
|
32
32
|
if (invalid()) return false;
|
|
33
33
|
|
|
34
34
|
const trimmedValue = value.trim();
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { ColDef } from "ag-grid-community";
|
|
2
|
-
import { CellContextMenuEvent } from "ag-grid-community
|
|
2
|
+
import { CellContextMenuEvent } from "ag-grid-community";
|
|
3
3
|
import { ReactElement, useCallback, useContext, useRef, useState } from "react";
|
|
4
4
|
|
|
5
5
|
import { GridContext } from "../../contexts/GridContext";
|
|
6
6
|
import { ControlledMenu } from "../../react-menu3";
|
|
7
7
|
import { GridBaseRow } from "../Grid";
|
|
8
8
|
|
|
9
|
-
export interface GridContextMenuComponentProps<
|
|
10
|
-
selectedRows:
|
|
11
|
-
clickedRow:
|
|
9
|
+
export interface GridContextMenuComponentProps<TData extends GridBaseRow> {
|
|
10
|
+
selectedRows: TData[];
|
|
11
|
+
clickedRow: TData;
|
|
12
12
|
colDef: ColDef;
|
|
13
13
|
close: () => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export type GridContextMenuComponent<
|
|
17
|
-
props: GridContextMenuComponentProps<
|
|
16
|
+
export type GridContextMenuComponent<TData extends GridBaseRow> = (
|
|
17
|
+
props: GridContextMenuComponentProps<TData>,
|
|
18
18
|
) => ReactElement | null;
|
|
19
19
|
|
|
20
|
-
export const useGridContextMenu = <
|
|
20
|
+
export const useGridContextMenu = <TData extends GridBaseRow>({
|
|
21
21
|
contextMenuSelectRow,
|
|
22
22
|
contextMenu: ContextMenu,
|
|
23
23
|
}: {
|
|
24
24
|
contextMenuSelectRow: boolean;
|
|
25
|
-
contextMenu?: GridContextMenuComponent<
|
|
25
|
+
contextMenu?: GridContextMenuComponent<TData>;
|
|
26
26
|
}) => {
|
|
27
27
|
const { redrawRows, prePopupOps, postPopupOps, getSelectedRows } = useContext(GridContext);
|
|
28
28
|
|
|
@@ -3,15 +3,15 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormMultiSelect, GridFormMultiSelectProps } from "../gridForm/GridFormMultiSelect";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoutEditMultiSelect = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
props: GenericCellEditorProps<GridFormMultiSelectProps<
|
|
9
|
-
): ColDefT<
|
|
10
|
-
GridCell(colDef, {
|
|
6
|
+
export const GridPopoutEditMultiSelect = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
props: GenericCellEditorProps<GridFormMultiSelectProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormMultiSelectProps<TData>>(colDef, {
|
|
11
11
|
editor: GridFormMultiSelect,
|
|
12
12
|
...props,
|
|
13
13
|
editorParams: {
|
|
14
14
|
className: "GridMultiSelect-containerMedium",
|
|
15
|
-
...(props.editorParams as GridFormMultiSelectProps<
|
|
15
|
+
...(props.editorParams as GridFormMultiSelectProps<TData>),
|
|
16
16
|
},
|
|
17
17
|
});
|
|
@@ -3,15 +3,15 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormMultiSelectGrid, GridFormMultiSelectGridProps } from "../gridForm/GridFormMultiSelectGrid";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoutEditMultiSelectGrid = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
props: GenericCellEditorProps<GridFormMultiSelectGridProps<
|
|
9
|
-
): ColDefT<
|
|
10
|
-
GridCell(colDef, {
|
|
6
|
+
export const GridPopoutEditMultiSelectGrid = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
props: GenericCellEditorProps<GridFormMultiSelectGridProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormMultiSelectGridProps<TData>>(colDef, {
|
|
11
11
|
editor: GridFormMultiSelectGrid,
|
|
12
12
|
...props,
|
|
13
13
|
editorParams: {
|
|
14
14
|
className: "GridMultiSelect-containerMedium",
|
|
15
|
-
...(props.editorParams as GridFormMultiSelectGridProps<
|
|
15
|
+
...(props.editorParams as GridFormMultiSelectGridProps<TData>),
|
|
16
16
|
},
|
|
17
17
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ValueFormatterParams } from "ag-grid-community
|
|
1
|
+
import { ValueFormatterParams } from "ag-grid-community";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
bearingCorrectionRangeValidator,
|
|
@@ -11,13 +11,13 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
11
11
|
import { GridFormEditBearing, GridFormEditBearingProps } from "../gridForm/GridFormEditBearing";
|
|
12
12
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
13
13
|
|
|
14
|
-
const GridPopoverEditBearingLike = <
|
|
15
|
-
colDef: GenericCellColDef<
|
|
16
|
-
props: GenericCellEditorProps<GridFormEditBearingProps<
|
|
14
|
+
const GridPopoverEditBearingLike = <TData extends GridBaseRow, TValue = any>(
|
|
15
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
16
|
+
props: GenericCellEditorProps<GridFormEditBearingProps<TData>> & {
|
|
17
17
|
editorParams: { formatValue: (value: any) => any };
|
|
18
18
|
},
|
|
19
|
-
): ColDefT<
|
|
20
|
-
GridCell(
|
|
19
|
+
): ColDefT<TData, TValue> =>
|
|
20
|
+
GridCell<TData, TValue, GridFormEditBearingProps<TData>>(
|
|
21
21
|
{
|
|
22
22
|
valueFormatter: (params: ValueFormatterParams) => props.editorParams?.formatValue(params.value) ?? "",
|
|
23
23
|
...colDef,
|
|
@@ -34,11 +34,11 @@ export const GridPopoverEditBearingEditorParams = {
|
|
|
34
34
|
range: bearingRangeValidator,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
export const GridPopoverEditBearing = <
|
|
38
|
-
colDef: GenericCellColDef<
|
|
39
|
-
props: GenericCellEditorProps<GridFormEditBearingProps<
|
|
40
|
-
): ColDefT<
|
|
41
|
-
GridPopoverEditBearingLike(colDef, {
|
|
37
|
+
export const GridPopoverEditBearing = <TData extends GridBaseRow, TValue = any>(
|
|
38
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
39
|
+
props: GenericCellEditorProps<GridFormEditBearingProps<TData>>,
|
|
40
|
+
): ColDefT<TData, TValue> =>
|
|
41
|
+
GridPopoverEditBearingLike<TData, TValue>(colDef, {
|
|
42
42
|
multiEdit: !!props.multiEdit,
|
|
43
43
|
editorParams: {
|
|
44
44
|
...GridPopoverEditBearingEditorParams,
|
|
@@ -52,11 +52,11 @@ export const GridPopoverEditBearingCorrectionEditorParams = {
|
|
|
52
52
|
range: bearingCorrectionRangeValidator,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export const GridPopoverEditBearingCorrection = <
|
|
56
|
-
colDef: GenericCellColDef<
|
|
57
|
-
props: GenericCellEditorProps<GridFormEditBearingProps<
|
|
58
|
-
): ColDefT<
|
|
59
|
-
GridPopoverEditBearingLike(colDef, {
|
|
55
|
+
export const GridPopoverEditBearingCorrection = <TData extends GridBaseRow, TValue = any>(
|
|
56
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
57
|
+
props: GenericCellEditorProps<GridFormEditBearingProps<TData>>,
|
|
58
|
+
): ColDefT<TData, TValue> =>
|
|
59
|
+
GridPopoverEditBearingLike<TData, TValue>(colDef, {
|
|
60
60
|
multiEdit: !!props.multiEdit,
|
|
61
61
|
editorParams: {
|
|
62
62
|
...GridPopoverEditBearingCorrectionEditorParams,
|
|
@@ -3,16 +3,16 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormDropDown, GridFormDropDownProps } from "../gridForm/GridFormDropDown";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoverEditDropDown = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
props: GenericCellEditorProps<GridFormDropDownProps<
|
|
9
|
-
): ColDefT<
|
|
10
|
-
GridCell(colDef, {
|
|
6
|
+
export const GridPopoverEditDropDown = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
props: GenericCellEditorProps<GridFormDropDownProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormDropDownProps<TData>>(colDef, {
|
|
11
11
|
editor: GridFormDropDown,
|
|
12
12
|
...props,
|
|
13
13
|
editorParams: {
|
|
14
14
|
// Defaults to large size container
|
|
15
15
|
className: "GridPopoverEditDropDown-containerLarge",
|
|
16
|
-
...(props.editorParams as GridFormDropDownProps<
|
|
16
|
+
...(props.editorParams as GridFormDropDownProps<TData>),
|
|
17
17
|
},
|
|
18
18
|
});
|
|
@@ -7,11 +7,11 @@ import { GridRenderPopoutMenuCell } from "../gridRender/GridRenderPopoutMenuCell
|
|
|
7
7
|
/**
|
|
8
8
|
* Popout burger menu
|
|
9
9
|
*/
|
|
10
|
-
export const GridPopoverMenu = <
|
|
11
|
-
colDef: GenericCellColDef<
|
|
12
|
-
custom: GenericCellEditorProps<GridFormPopoverMenuProps<
|
|
13
|
-
): ColDefT<
|
|
14
|
-
GridCell<
|
|
10
|
+
export const GridPopoverMenu = <TData extends GridBaseRow>(
|
|
11
|
+
colDef: GenericCellColDef<TData>,
|
|
12
|
+
custom: GenericCellEditorProps<GridFormPopoverMenuProps<TData>>,
|
|
13
|
+
): ColDefT<TData> =>
|
|
14
|
+
GridCell<TData, any, GridFormPopoverMenuProps<TData>>(
|
|
15
15
|
{
|
|
16
16
|
minWidth: 48,
|
|
17
17
|
maxWidth: 48,
|
|
@@ -3,11 +3,11 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormMessage, GridFormMessageProps } from "../gridForm/GridFormMessage";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoverMessage = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
props: GenericCellEditorProps<GridFormMessageProps<
|
|
9
|
-
): ColDefT<
|
|
10
|
-
GridCell(
|
|
6
|
+
export const GridPopoverMessage = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
props: GenericCellEditorProps<GridFormMessageProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormMessageProps<TData>>(
|
|
11
11
|
{
|
|
12
12
|
resizable: true,
|
|
13
13
|
...colDef,
|
|
@@ -3,7 +3,8 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormTextArea, GridFormTextAreaProps } from "../gridForm/GridFormTextArea";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoverTextArea = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
params: GenericCellEditorProps<GridFormTextAreaProps<
|
|
9
|
-
): ColDefT<
|
|
6
|
+
export const GridPopoverTextArea = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
params: GenericCellEditorProps<GridFormTextAreaProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormTextAreaProps<TData>>(colDef, { editor: GridFormTextArea, ...params });
|
|
@@ -3,11 +3,11 @@ import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
|
3
3
|
import { GridFormTextInput, GridFormTextInputProps } from "../gridForm/GridFormTextInput";
|
|
4
4
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
5
5
|
|
|
6
|
-
export const GridPopoverTextInput = <
|
|
7
|
-
colDef: GenericCellColDef<
|
|
8
|
-
params: GenericCellEditorProps<GridFormTextInputProps<
|
|
9
|
-
): ColDefT<
|
|
10
|
-
GridCell(colDef, {
|
|
6
|
+
export const GridPopoverTextInput = <TData extends GridBaseRow, TValue = any>(
|
|
7
|
+
colDef: GenericCellColDef<TData, TValue>,
|
|
8
|
+
params: GenericCellEditorProps<GridFormTextInputProps<TData>>,
|
|
9
|
+
): ColDefT<TData, TValue> =>
|
|
10
|
+
GridCell<TData, TValue, GridFormTextInputProps<TData>>(colDef, {
|
|
11
11
|
editor: GridFormTextInput,
|
|
12
12
|
...params,
|
|
13
13
|
});
|
|
@@ -1,49 +1,19 @@
|
|
|
1
1
|
import { ICellRendererParams } from "ag-grid-community";
|
|
2
|
-
import {
|
|
3
|
-
EditableCallbackParams,
|
|
4
|
-
SuppressKeyboardEventParams,
|
|
5
|
-
ValueFormatterParams,
|
|
6
|
-
ValueGetterParams,
|
|
7
|
-
} from "ag-grid-community/dist/lib/entities/colDef";
|
|
2
|
+
import { SuppressKeyboardEventParams } from "ag-grid-community";
|
|
8
3
|
import { ReactElement } from "react";
|
|
9
4
|
|
|
10
5
|
import { GridBaseRow } from "../Grid";
|
|
11
6
|
import { ColDefT } from "../GridCell";
|
|
12
7
|
|
|
13
|
-
export interface
|
|
14
|
-
data: RowType;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface RowEditableCallbackParams<RowType extends GridBaseRow> extends EditableCallbackParams {
|
|
18
|
-
data: RowType;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface RowValueFormatterParams<RowType extends GridBaseRow> extends ValueFormatterParams {
|
|
22
|
-
data: RowType;
|
|
23
|
-
}
|
|
24
|
-
export interface RowValueGetterParams<RowType extends GridBaseRow> extends ValueGetterParams {
|
|
25
|
-
data: RowType;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface RowValueGetterParams<RowType extends GridBaseRow> extends ValueGetterParams {
|
|
29
|
-
data: RowType;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface GenericCellColDef<RowType extends GridBaseRow> extends ColDefT<RowType> {
|
|
33
|
-
cellRenderer?: (params: RowICellRendererParams<RowType>) => any;
|
|
34
|
-
cellRendererParams?: GenericCellRendererParams<RowType>;
|
|
35
|
-
valueGetter?: string | ((params: RowValueGetterParams<RowType>) => any);
|
|
36
|
-
valueFormatter?: string | ((params: RowValueFormatterParams<RowType>) => string);
|
|
37
|
-
filterValueGetter?: string | ((params: RowValueGetterParams<RowType>) => string);
|
|
38
|
-
editable?: boolean | ((params: RowEditableCallbackParams<RowType>) => boolean);
|
|
8
|
+
export interface GenericCellColDef<TData extends GridBaseRow, TValue = any> extends ColDefT<TData, TValue> {
|
|
39
9
|
exportable?: boolean;
|
|
40
10
|
}
|
|
41
11
|
|
|
42
|
-
export interface GenericCellRendererParams<
|
|
12
|
+
export interface GenericCellRendererParams<TData extends GridBaseRow> {
|
|
43
13
|
singleClickEdit?: boolean;
|
|
44
14
|
rightHoverElement?: ReactElement | undefined;
|
|
45
|
-
editAction?: (selectedRows:
|
|
15
|
+
editAction?: (selectedRows: TData[]) => void;
|
|
46
16
|
shortcutKeys?: Record<string, ((params: SuppressKeyboardEventParams) => boolean | void) | undefined>;
|
|
47
|
-
warning?: (props:
|
|
48
|
-
info?: (props:
|
|
17
|
+
warning?: (props: ICellRendererParams<TData>) => string | string[] | boolean | null | undefined;
|
|
18
|
+
info?: (props: ICellRendererParams<TData>) => string | string[] | boolean | null | undefined;
|
|
49
19
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ColDef, ColumnApi, GridApi, IRowNode } from "ag-grid-community";
|
|
2
|
-
import { CsvExportParams } from "ag-grid-community
|
|
2
|
+
import { CsvExportParams } from "ag-grid-community";
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
|
|
5
5
|
import { ColDefT, GridBaseRow } from "../components";
|
|
6
6
|
|
|
7
|
-
export type GridFilterExternal<
|
|
7
|
+
export type GridFilterExternal<TData extends GridBaseRow> = (data: TData, rowNode: IRowNode) => boolean;
|
|
8
8
|
|
|
9
9
|
export interface AutoSizeColumnsProps {
|
|
10
10
|
skipHeader?: boolean;
|
|
@@ -15,13 +15,13 @@ export interface AutoSizeColumnsProps {
|
|
|
15
15
|
|
|
16
16
|
export type AutoSizeColumnsResult = { width: number } | null;
|
|
17
17
|
|
|
18
|
-
export interface GridContextType<
|
|
18
|
+
export interface GridContextType<TData extends GridBaseRow> {
|
|
19
19
|
gridReady: boolean;
|
|
20
20
|
gridRenderState: () => null | "empty" | "rows-visible";
|
|
21
21
|
getColDef: (colId?: string) => ColDef | undefined;
|
|
22
22
|
getColumns: (
|
|
23
23
|
filter?: keyof ColDef | ((r: ColDef) => boolean | undefined | null | number | string),
|
|
24
|
-
) => ColDefT<
|
|
24
|
+
) => ColDefT<TData, any>[];
|
|
25
25
|
getColumnIds: (filter?: keyof ColDef | ((r: ColDef) => boolean | undefined | null | number | string)) => string[];
|
|
26
26
|
setApis: (gridApi: GridApi | undefined, columnApi: ColumnApi | undefined, dataTestId?: string) => void;
|
|
27
27
|
prePopupOps: () => void;
|
|
@@ -57,8 +57,8 @@ export interface GridContextType<RowType extends GridBaseRow> {
|
|
|
57
57
|
externallySelectedItemsAreInSync: boolean;
|
|
58
58
|
setExternallySelectedItemsAreInSync: (inSync: boolean) => void;
|
|
59
59
|
waitForExternallySelectedItemsToBeInSync: () => Promise<void>;
|
|
60
|
-
addExternalFilter: (filter: GridFilterExternal<
|
|
61
|
-
removeExternalFilter: (filter: GridFilterExternal<
|
|
60
|
+
addExternalFilter: (filter: GridFilterExternal<TData>) => void;
|
|
61
|
+
removeExternalFilter: (filter: GridFilterExternal<TData>) => void;
|
|
62
62
|
isExternalFilterPresent: () => boolean;
|
|
63
63
|
doesExternalFilterPass: (node: IRowNode) => boolean;
|
|
64
64
|
invisibleColumnIds: string[] | undefined;
|
|
@@ -207,4 +207,4 @@ export const GridContext = createContext<GridContextType<any>>({
|
|
|
207
207
|
},
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
export const useGridContext = <
|
|
210
|
+
export const useGridContext = <TData extends GridBaseRow>() => useContext<GridContextType<TData>>(GridContext);
|