@linzjs/step-ag-grid 20.0.0 → 21.0.1
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/index.css +3 -4
- 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 +4651 -4651
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +4651 -4651
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/dist/vite.config.d.ts +2 -0
- package/package.json +23 -22
- package/src/components/Grid.tsx +10 -9
- 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 +7 -7
- 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/gridHeader/GridHeaderSelect.tsx +10 -8
- 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 +9 -9
- package/src/contexts/GridContextProvider.test.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +32 -36
- package/src/contexts/GridPopoverContext.tsx +6 -6
- package/src/stories/grid/GridDragRow.stories.tsx +13 -7
- 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 +12 -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/styles/Grid.scss +3 -6
- package/src/utils/testUtil.ts +49 -7
- package/src/utils/textValidator.ts +5 -5
- package/src/utils/util.ts +1 -1
package/src/utils/testUtil.ts
CHANGED
|
@@ -17,6 +17,43 @@ export const countRows = async (within?: HTMLElement): Promise<number> => {
|
|
|
17
17
|
return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export const findRowByIndex = async (rowIndex: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
|
|
21
|
+
await waitFor(async () => {
|
|
22
|
+
expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
//if this is not wrapped in an act console errors are logged during testing
|
|
25
|
+
let row!: HTMLDivElement;
|
|
26
|
+
await act(async () => {
|
|
27
|
+
row = await findQuick<HTMLDivElement>(
|
|
28
|
+
{ tagName: `.ag-center-cols-container div[row-index='${rowIndex}']:not(:empty)` },
|
|
29
|
+
within,
|
|
30
|
+
);
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
let combineChildren = [...Array.from(row.children)];
|
|
33
|
+
|
|
34
|
+
const leftCols = queryQuick<HTMLDivElement>(
|
|
35
|
+
{ tagName: `.ag-pinned-left-cols-container div[row-index='${rowIndex}']` },
|
|
36
|
+
within,
|
|
37
|
+
);
|
|
38
|
+
if (leftCols) {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
combineChildren = [...Array.from(leftCols.children), ...combineChildren];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const rightCols = queryQuick<HTMLDivElement>(
|
|
44
|
+
{ tagName: `.ag-pinned-right-cols-container div[row-index='${rowIndex}']` },
|
|
45
|
+
within,
|
|
46
|
+
);
|
|
47
|
+
if (rightCols) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
combineChildren = [...Array.from(rightCols.children), ...combineChildren];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
row.replaceChildren(...combineChildren);
|
|
53
|
+
});
|
|
54
|
+
return row;
|
|
55
|
+
};
|
|
56
|
+
|
|
20
57
|
export const findRow = async (rowId: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
|
|
21
58
|
await waitFor(async () => {
|
|
22
59
|
expect(getAllQuick({ classes: ".ag-row" }).length > 0).toBe(true);
|
|
@@ -29,7 +66,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
|
|
|
29
66
|
within,
|
|
30
67
|
);
|
|
31
68
|
// @ts-ignore
|
|
32
|
-
let combineChildren = [...row.children];
|
|
69
|
+
let combineChildren = [...Array.from(row.children)];
|
|
33
70
|
|
|
34
71
|
const leftCols = queryQuick<HTMLDivElement>(
|
|
35
72
|
{ tagName: `.ag-pinned-left-cols-container div[row-id='${rowId}']` },
|
|
@@ -37,7 +74,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
|
|
|
37
74
|
);
|
|
38
75
|
if (leftCols) {
|
|
39
76
|
// @ts-ignore
|
|
40
|
-
combineChildren = [...leftCols.children, ...combineChildren];
|
|
77
|
+
combineChildren = [...Array.from(leftCols.children), ...combineChildren];
|
|
41
78
|
}
|
|
42
79
|
|
|
43
80
|
const rightCols = queryQuick<HTMLDivElement>(
|
|
@@ -46,7 +83,7 @@ export const findRow = async (rowId: number | string, within?: HTMLElement): Pro
|
|
|
46
83
|
);
|
|
47
84
|
if (rightCols) {
|
|
48
85
|
// @ts-ignore
|
|
49
|
-
combineChildren = [...rightCols.children, ...combineChildren];
|
|
86
|
+
combineChildren = [...Array.from(rightCols.children), ...combineChildren];
|
|
50
87
|
}
|
|
51
88
|
|
|
52
89
|
row.replaceChildren(...combineChildren);
|
|
@@ -108,9 +145,14 @@ export const selectCell = async (rowId: string | number, colId: string, within?:
|
|
|
108
145
|
};
|
|
109
146
|
|
|
110
147
|
export const editCell = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<void> => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
148
|
+
await waitFor(
|
|
149
|
+
async () => {
|
|
150
|
+
const cell = await findCell(rowId, colId, within);
|
|
151
|
+
await user.dblClick(cell);
|
|
152
|
+
await waitFor(findOpenPopover, { timeout: 1000 });
|
|
153
|
+
},
|
|
154
|
+
{ timeout: 10000 },
|
|
155
|
+
);
|
|
114
156
|
};
|
|
115
157
|
|
|
116
158
|
export const isCellReadOnly = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<boolean> => {
|
|
@@ -118,7 +160,7 @@ export const isCellReadOnly = async (rowId: number | string, colId: string, with
|
|
|
118
160
|
return cell.className.includes("GridCell-readonly");
|
|
119
161
|
};
|
|
120
162
|
|
|
121
|
-
export const findOpenPopover =
|
|
163
|
+
export const findOpenPopover = () => findQuick({ classes: ".szh-menu--state-open" });
|
|
122
164
|
|
|
123
165
|
export const queryMenuOption = async (menuOptionText: string | RegExp): Promise<HTMLElement | null> => {
|
|
124
166
|
const openMenu = await findOpenPopover();
|
|
@@ -3,11 +3,11 @@ import { ReactElement } from "react";
|
|
|
3
3
|
import { GridBaseRow } from "../components/Grid";
|
|
4
4
|
import { isFloat, stringByteLengthIsInvalid } from "./util";
|
|
5
5
|
|
|
6
|
-
export interface TextInputValidatorProps<
|
|
6
|
+
export interface TextInputValidatorProps<TData extends GridBaseRow> {
|
|
7
7
|
required?: boolean;
|
|
8
8
|
maxLength?: number;
|
|
9
9
|
maxBytes?: number;
|
|
10
|
-
invalid?: (value: string, data:
|
|
10
|
+
invalid?: (value: string, data: TData, context: any) => ReactElement | string | null;
|
|
11
11
|
numberFormat?: {
|
|
12
12
|
precision?: number;
|
|
13
13
|
scale?: number;
|
|
@@ -19,10 +19,10 @@ export interface TextInputValidatorProps<RowType extends GridBaseRow> {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const TextInputValidator = <
|
|
23
|
-
props: TextInputValidatorProps<
|
|
22
|
+
export const TextInputValidator = <TData extends GridBaseRow>(
|
|
23
|
+
props: TextInputValidatorProps<TData>,
|
|
24
24
|
value: string | null,
|
|
25
|
-
data:
|
|
25
|
+
data: TData,
|
|
26
26
|
context: any,
|
|
27
27
|
) => {
|
|
28
28
|
if (value == null) return null;
|
package/src/utils/util.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const hasParentClass = function (className: string, child: Node) {
|
|
|
44
44
|
export const stringByteLengthIsInvalid = (str: string, maxBytes: number) =>
|
|
45
45
|
new TextEncoder().encode(str).length > maxBytes;
|
|
46
46
|
|
|
47
|
-
export const fnOrVar = (fn: any, param
|
|
47
|
+
export const fnOrVar = (fn: any, param?: any) => (typeof fn === "function" ? fn(param) : fn);
|
|
48
48
|
|
|
49
49
|
export const sanitiseFileName = (filename: string): string => {
|
|
50
50
|
const valid = filename
|