@linzjs/step-ag-grid 7.3.0 → 7.3.2
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.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/src/contexts/GridContext.d.ts +1 -1
- package/dist/step-ag-grid.esm.js +25 -16
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +3 -1
- package/src/components/gridForm/GridFormMultiSelect.tsx +3 -1
- package/src/components/gridForm/GridFormPopoverMenu.tsx +3 -1
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormTextArea.tsx +1 -1
- package/src/components/gridForm/GridFormTextInput.tsx +4 -1
- package/src/contexts/GridContext.tsx +2 -1
- package/src/contexts/GridContextProvider.tsx +5 -3
- package/src/utils/testUtil.ts +24 -14
package/package.json
CHANGED
|
@@ -328,7 +328,9 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
328
328
|
}}
|
|
329
329
|
>
|
|
330
330
|
{item.subComponent && (
|
|
331
|
-
<
|
|
331
|
+
<div className={"subComponent"}>
|
|
332
|
+
<item.subComponent key={`${fieldToString(field)}-${index}_subcomponent_inner`} />
|
|
333
|
+
</div>
|
|
332
334
|
)}
|
|
333
335
|
</GridSubComponentContext.Provider>
|
|
334
336
|
)}
|
|
@@ -149,7 +149,9 @@ export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridForm
|
|
|
149
149
|
triggerSave,
|
|
150
150
|
}}
|
|
151
151
|
>
|
|
152
|
-
<
|
|
152
|
+
<div className={"subComponent"}>
|
|
153
|
+
<item.subComponent />
|
|
154
|
+
</div>
|
|
153
155
|
</GridSubComponentContext.Provider>
|
|
154
156
|
)
|
|
155
157
|
}
|
|
@@ -35,7 +35,7 @@ export const GridFormSubComponentTextArea = <RowType extends GridBaseRow>(
|
|
|
35
35
|
}, [setValid, invalid, value]);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<div className={clsx("FreeTextInput
|
|
38
|
+
<div className={clsx("FreeTextInput", props.className)}>
|
|
39
39
|
<TextAreaInput
|
|
40
40
|
className={"free-text-input"}
|
|
41
41
|
value={value}
|
|
@@ -50,7 +50,7 @@ export const GridFormTextArea = <RowType extends GridBaseRow>(props: GridFormTex
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
return popoverWrapper(
|
|
53
|
-
<div style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}>
|
|
53
|
+
<div className={"subComponent"} style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}>
|
|
54
54
|
<TextAreaInput
|
|
55
55
|
value={value}
|
|
56
56
|
onChange={(e) => setValue(e.target.value)}
|
|
@@ -50,7 +50,10 @@ export const GridFormTextInput = <RowType extends GridBaseRow>(props: GridFormTe
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
return popoverWrapper(
|
|
53
|
-
<div
|
|
53
|
+
<div
|
|
54
|
+
style={{ display: "flex", flexDirection: "row", width: props.width ?? 240 }}
|
|
55
|
+
className={"FormTest subComponent"}
|
|
56
|
+
>
|
|
54
57
|
<TextInputFormatted
|
|
55
58
|
value={value}
|
|
56
59
|
onChange={(e) => setValue(e.target.value)}
|
|
@@ -15,7 +15,7 @@ export interface GridContextType {
|
|
|
15
15
|
selectRowsByIdWithFlash: (rowIds?: number[]) => void;
|
|
16
16
|
flashRows: (rowIds?: number[]) => void;
|
|
17
17
|
flashRowsDiff: (updateFn: () => Promise<any>) => Promise<void>;
|
|
18
|
-
ensureRowVisible: (id: number) =>
|
|
18
|
+
ensureRowVisible: (id: number | string) => boolean;
|
|
19
19
|
ensureSelectedRowIsVisible: () => void;
|
|
20
20
|
sizeColumnsToFit: () => void;
|
|
21
21
|
stopEditing: () => void;
|
|
@@ -67,6 +67,7 @@ export const GridContext = createContext<GridContextType>({
|
|
|
67
67
|
},
|
|
68
68
|
ensureRowVisible: () => {
|
|
69
69
|
console.error("no context provider for ensureRowVisible");
|
|
70
|
+
return true;
|
|
70
71
|
},
|
|
71
72
|
ensureSelectedRowIsVisible: () => {
|
|
72
73
|
console.error("no context provider for ensureSelectedRowIsVisible");
|
|
@@ -200,10 +200,12 @@ export const GridContextProvider = (props: GridContextProps): ReactElement => {
|
|
|
200
200
|
);
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
const ensureRowVisible = (id: number):
|
|
204
|
-
gridApiOp((gridApi) => {
|
|
203
|
+
const ensureRowVisible = (id: number | string): boolean => {
|
|
204
|
+
return gridApiOp((gridApi) => {
|
|
205
205
|
const node = gridApi.getRowNode(`${id}`);
|
|
206
|
-
|
|
206
|
+
if (!node) return false;
|
|
207
|
+
gridApi.ensureNodeVisible(node);
|
|
208
|
+
return true;
|
|
207
209
|
});
|
|
208
210
|
};
|
|
209
211
|
|
package/src/utils/testUtil.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { act, waitFor, within } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
3
|
import { findQuick, getAllQuick, getMatcher, getQuick, queryQuick } from "./testQuick";
|
|
4
|
+
import { wait } from "./util";
|
|
4
5
|
|
|
5
6
|
export const findRow = async (rowId: number | string, within?: HTMLElement): Promise<HTMLDivElement> => {
|
|
6
7
|
return findQuick<HTMLDivElement>({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
@@ -41,10 +42,13 @@ export const cellContains = async (
|
|
|
41
42
|
text: string | RegExp,
|
|
42
43
|
within?: HTMLElement,
|
|
43
44
|
) => {
|
|
44
|
-
return await waitFor(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
return await waitFor(
|
|
46
|
+
async () => {
|
|
47
|
+
const row = await findRow(rowId, within);
|
|
48
|
+
return await findQuick({ tagName: `[col-id='${colId}']`, text }, row);
|
|
49
|
+
},
|
|
50
|
+
{ timeout: 10000 },
|
|
51
|
+
);
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
export const selectCell = async (rowId: string | number, colId: string, within?: HTMLElement): Promise<void> => {
|
|
@@ -58,8 +62,8 @@ export const editCell = async (rowId: number | string, colId: string, within?: H
|
|
|
58
62
|
await act(async () => {
|
|
59
63
|
const cell = await findCell(rowId, colId, within);
|
|
60
64
|
userEvent.dblClick(cell);
|
|
61
|
-
await findOpenMenu();
|
|
62
65
|
});
|
|
66
|
+
await findOpenMenu();
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
const findOpenMenu = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
|
|
@@ -73,13 +77,16 @@ export const queryMenuOption = async (menuOptionText: string | RegExp): Promise<
|
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
export const findMenuOption = async (menuOptionText: string | RegExp): Promise<HTMLElement> => {
|
|
76
|
-
return await waitFor(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
return await waitFor(
|
|
81
|
+
async () => {
|
|
82
|
+
const menuOption = await queryMenuOption(menuOptionText);
|
|
83
|
+
if (menuOption == null) {
|
|
84
|
+
throw Error(`Unable to find menu option ${menuOptionText}`);
|
|
85
|
+
}
|
|
86
|
+
return menuOption;
|
|
87
|
+
},
|
|
88
|
+
{ timeout: 10000 },
|
|
89
|
+
);
|
|
83
90
|
};
|
|
84
91
|
|
|
85
92
|
export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
|
|
@@ -96,6 +103,7 @@ export const openAndClickMenuOption = async (
|
|
|
96
103
|
within?: HTMLElement,
|
|
97
104
|
): Promise<void> => {
|
|
98
105
|
await editCell(rowId, colId, within);
|
|
106
|
+
await wait(100);
|
|
99
107
|
await clickMenuOption(menuOptionText);
|
|
100
108
|
};
|
|
101
109
|
|
|
@@ -123,13 +131,15 @@ export const clickMultiSelectOption = async (value: string): Promise<void> => {
|
|
|
123
131
|
|
|
124
132
|
export const typeOtherInput = async (value: string): Promise<void> => {
|
|
125
133
|
const openMenu = await findOpenMenu();
|
|
126
|
-
const otherInput = await findQuick({ tagName: "input[type='text']" }, openMenu);
|
|
134
|
+
const otherInput = await findQuick({ classes: ".subComponent", child: { tagName: "input[type='text']" } }, openMenu);
|
|
135
|
+
userEvent.clear(otherInput);
|
|
127
136
|
userEvent.type(otherInput, value);
|
|
128
137
|
};
|
|
129
138
|
|
|
130
139
|
export const typeOtherTextArea = async (value: string): Promise<void> => {
|
|
131
140
|
const openMenu = await findOpenMenu();
|
|
132
|
-
const otherTextArea = await findQuick({ tagName: "textarea" }, openMenu);
|
|
141
|
+
const otherTextArea = await findQuick({ classes: ".subComponent", child: { tagName: "textarea" } }, openMenu);
|
|
142
|
+
userEvent.clear(otherTextArea);
|
|
133
143
|
userEvent.type(otherTextArea, value);
|
|
134
144
|
};
|
|
135
145
|
|