@linzjs/step-ag-grid 19.0.0 → 19.1.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/step-ag-grid.cjs.js +46 -63
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +46 -63
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +52 -51
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +1 -1
- package/src/components/gridForm/GridFormMultiSelectGrid.tsx +2 -2
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +2 -2
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +37 -39
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +27 -17
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +27 -17
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +34 -39
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +34 -32
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +34 -25
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +27 -17
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +27 -17
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +6 -5
- package/src/stories/react-menu/ReactMenu.stories.tsx +5 -4
- package/src/utils/storybookTestUtil.ts +1 -2
- package/src/utils/testUtil.ts +9 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@linzjs/step-ag-grid",
|
|
3
3
|
"repository": "github:linz/step-ag-grid.git",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "19.
|
|
5
|
+
"version": "19.1.1",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"@linzjs/lui": ">=21",
|
|
38
38
|
"ag-grid-community": "~29",
|
|
39
39
|
"ag-grid-react": "~29",
|
|
40
|
-
"clsx": "^2.
|
|
40
|
+
"clsx": "^2.1.1",
|
|
41
41
|
"debounce-promise": "^3.1.2",
|
|
42
42
|
"lodash-es": ">=4",
|
|
43
43
|
"matcher": "^5.0.0",
|
|
44
44
|
"react": ">=18",
|
|
45
45
|
"react-dom": ">=18",
|
|
46
46
|
"react-transition-state": "^2.1.1",
|
|
47
|
-
"usehooks-ts": "^
|
|
47
|
+
"usehooks-ts": "^3.1.0",
|
|
48
48
|
"uuid": "^9.0.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
@@ -83,78 +83,79 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
86
|
-
"@
|
|
87
|
-
"@rollup/plugin-
|
|
86
|
+
"@chromatic-com/storybook": "^1.3.5",
|
|
87
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
88
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
88
89
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
89
90
|
"@semantic-release/changelog": "^6.0.3",
|
|
90
91
|
"@semantic-release/git": "^10.0.1",
|
|
91
|
-
"@storybook/addon-essentials": "^
|
|
92
|
-
"@storybook/addon-interactions": "^
|
|
92
|
+
"@storybook/addon-essentials": "^8.1.0",
|
|
93
|
+
"@storybook/addon-interactions": "^8.1.0",
|
|
93
94
|
"@storybook/addon-postcss": "^2.0.0",
|
|
94
|
-
"@storybook/
|
|
95
|
-
"@storybook/
|
|
96
|
-
"@storybook/react": "^
|
|
97
|
-
"@storybook/
|
|
98
|
-
"@storybook/test-runner": "^0.
|
|
99
|
-
"@
|
|
100
|
-
"@testing-library/dom": "^
|
|
101
|
-
"@testing-library/
|
|
102
|
-
"@testing-library/
|
|
103
|
-
"@testing-library/user-event": "^14.5.1",
|
|
95
|
+
"@storybook/preset-create-react-app": "^8.1.0",
|
|
96
|
+
"@storybook/react": "^8.1.0",
|
|
97
|
+
"@storybook/react-webpack5": "^8.1.0",
|
|
98
|
+
"@storybook/test": "^8.1.0",
|
|
99
|
+
"@storybook/test-runner": "^0.18.0",
|
|
100
|
+
"@testing-library/dom": "^10.1.0",
|
|
101
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
102
|
+
"@testing-library/react": "^15.0.7",
|
|
103
|
+
"@testing-library/user-event": "^14.5.2",
|
|
104
104
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
105
|
-
"@types/debounce-promise": "^3.1.
|
|
106
|
-
"@types/jest": "^29.5.
|
|
107
|
-
"@types/lodash-es": "^4.17.
|
|
108
|
-
"@types/node": "^18.
|
|
109
|
-
"@types/react": "^18.2
|
|
110
|
-
"@types/react-dom": "^18.
|
|
111
|
-
"@types/uuid": "^9.0.
|
|
112
|
-
"@typescript-eslint/
|
|
105
|
+
"@types/debounce-promise": "^3.1.9",
|
|
106
|
+
"@types/jest": "^29.5.12",
|
|
107
|
+
"@types/lodash-es": "^4.17.12",
|
|
108
|
+
"@types/node": "^18.19.33",
|
|
109
|
+
"@types/react": "^18.3.2",
|
|
110
|
+
"@types/react-dom": "^18.3.0",
|
|
111
|
+
"@types/uuid": "^9.0.8",
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
113
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
113
114
|
"babel-jest": "^29.7.0",
|
|
114
115
|
"babel-preset-react-app": "^10.0.1",
|
|
115
|
-
"chromatic": "^
|
|
116
|
+
"chromatic": "^11.3.2",
|
|
116
117
|
"conventional-changelog-conventionalcommits": "^6.1.0",
|
|
117
|
-
"css-loader": "^
|
|
118
|
-
"esbuild": "^0.
|
|
119
|
-
"eslint": "^8.
|
|
120
|
-
"eslint-config-prettier": "^9.
|
|
118
|
+
"css-loader": "^7.1.1",
|
|
119
|
+
"esbuild": "^0.21.2",
|
|
120
|
+
"eslint": "^8.57.0",
|
|
121
|
+
"eslint-config-prettier": "^9.1.0",
|
|
121
122
|
"eslint-config-react-app": "^7.0.1",
|
|
122
|
-
"eslint-plugin-deprecation": "^
|
|
123
|
-
"eslint-plugin-import": "^2.
|
|
124
|
-
"eslint-plugin-jest": "^
|
|
125
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
126
|
-
"eslint-plugin-prettier": "^
|
|
127
|
-
"eslint-plugin-react": "^7.
|
|
128
|
-
"eslint-plugin-react-hooks": "^4.6.
|
|
129
|
-
"eslint-plugin-storybook": "^0.
|
|
130
|
-
"eslint-plugin-testing-library": "^6.
|
|
123
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
124
|
+
"eslint-plugin-import": "^2.29.1",
|
|
125
|
+
"eslint-plugin-jest": "^28.5.0",
|
|
126
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
127
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
128
|
+
"eslint-plugin-react": "^7.34.1",
|
|
129
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
130
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
131
|
+
"eslint-plugin-testing-library": "^6.2.2",
|
|
131
132
|
"jest": "^29.7.0",
|
|
132
133
|
"jest-canvas-mock": "^2.5.2",
|
|
133
134
|
"jest-environment-jsdom": "^29.7.0",
|
|
134
135
|
"jest-expect-message": "^1.1.3",
|
|
135
136
|
"mkdirp": "^3.0.1",
|
|
136
137
|
"npm-run-all": "^4.1.5",
|
|
137
|
-
"postcss": "^8.4.
|
|
138
|
-
"postcss-loader": "^7.3.
|
|
138
|
+
"postcss": "^8.4.38",
|
|
139
|
+
"postcss-loader": "^7.3.4",
|
|
139
140
|
"postcss-scss": "^4.0.9",
|
|
140
|
-
"prettier": "^2.
|
|
141
|
+
"prettier": "^3.2.5",
|
|
141
142
|
"react-app-polyfill": "^3.0.0",
|
|
142
143
|
"react-scripts": "^5.0.1",
|
|
143
|
-
"rollup": "^4.
|
|
144
|
+
"rollup": "^4.17.2",
|
|
144
145
|
"rollup-plugin-copy": "^3.5.0",
|
|
145
146
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
146
147
|
"rollup-plugin-postcss": "^4.0.2",
|
|
147
148
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
148
|
-
"sass": "1.
|
|
149
|
-
"sass-loader": "^
|
|
150
|
-
"semantic-release": "^22.0.
|
|
151
|
-
"storybook": "^
|
|
149
|
+
"sass": "1.77.1",
|
|
150
|
+
"sass-loader": "^14.2.1",
|
|
151
|
+
"semantic-release": "^22.0.12",
|
|
152
|
+
"storybook": "^8.1.0",
|
|
152
153
|
"storybook-css-modules-preset": "^1.1.1",
|
|
153
|
-
"style-loader": "^
|
|
154
|
-
"stylelint": "
|
|
155
|
-
"stylelint-config-recommended-scss": "^
|
|
154
|
+
"style-loader": "^4.0.0",
|
|
155
|
+
"stylelint": "15.11.0",
|
|
156
|
+
"stylelint-config-recommended-scss": "^13.1.0",
|
|
156
157
|
"stylelint-config-standard": "^34.0.0",
|
|
157
|
-
"stylelint-prettier": "^
|
|
158
|
+
"stylelint-prettier": "^4.1.0",
|
|
158
159
|
"stylelint-scss": "^5.3.2",
|
|
159
160
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
160
161
|
"typescript": "^4.9.5"
|
|
@@ -92,7 +92,7 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
92
92
|
<div className={"GridFilterColumnsToggle-container"}>
|
|
93
93
|
{getColumns("headerName").map((col) => (
|
|
94
94
|
<MenuItem
|
|
95
|
-
key={col.colId}
|
|
95
|
+
key={col.colId ?? "no_col_id"}
|
|
96
96
|
disabled={isNonManageableColumn(col)}
|
|
97
97
|
onClick={(e: ClickEvent) => {
|
|
98
98
|
// Global react-menu MenuItem handler handles tabs
|
|
@@ -145,8 +145,8 @@ export const GridFormMultiSelectGrid = <RowType extends GridBaseRow>(
|
|
|
145
145
|
value={`${o.value}`}
|
|
146
146
|
label={
|
|
147
147
|
<>
|
|
148
|
-
{o.warning && <GridIcon icon={"ic_warning_outline"} title={o.warning} />}
|
|
149
|
-
<span className={"GridMultiSelectGrid-Label"}>
|
|
148
|
+
{o.warning && <GridIcon key={"$$icon$$"} icon={"ic_warning_outline"} title={o.warning} />}
|
|
149
|
+
<span key={"$$label$$"} className={"GridMultiSelectGrid-Label"}>
|
|
150
150
|
{o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`)}
|
|
151
151
|
</span>
|
|
152
152
|
</>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
|
|
3
|
-
import { expect } from "@storybook/jest";
|
|
4
3
|
import { Meta, StoryFn } from "@storybook/react";
|
|
5
|
-
import {
|
|
4
|
+
import { expect } from "@storybook/test";
|
|
5
|
+
import { within } from "@storybook/test";
|
|
6
6
|
|
|
7
7
|
import "@linzjs/lui/dist/fonts";
|
|
8
8
|
|
|
@@ -2,35 +2,26 @@ import "../../../react-menu3/styles/index.scss";
|
|
|
2
2
|
import "../../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
5
|
+
import { StoryFn } from "@storybook/react";
|
|
6
|
+
import { expect, fn, userEvent, within } from "@storybook/test";
|
|
7
|
+
import { GridPopoverContext } from "contexts/GridPopoverContext";
|
|
9
8
|
import { useRef } from "react";
|
|
10
9
|
|
|
11
10
|
import "@linzjs/lui/dist/fonts";
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
GridContextProvider,
|
|
15
|
-
GridFormDropDown,
|
|
16
|
-
GridFormDropDownProps,
|
|
17
|
-
GridFormSubComponentTextInput,
|
|
18
|
-
GridPopoutEditDropDownSelectedItem,
|
|
19
|
-
} from "../../..";
|
|
12
|
+
import { GridContext, GridFormDropDown, GridFormDropDownProps, GridFormSubComponentTextInput } from "../../..";
|
|
20
13
|
|
|
21
14
|
export default {
|
|
22
15
|
title: "GridForm / Interactions",
|
|
23
16
|
component: GridFormDropDown,
|
|
24
17
|
args: {},
|
|
25
|
-
}
|
|
18
|
+
};
|
|
26
19
|
|
|
27
|
-
const updateValue =
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const updateValue = fn(async (saveFn: (selectedRows: any[]) => Promise<boolean>, _tabDirection: 1 | 0 | -1) =>
|
|
21
|
+
saveFn([]),
|
|
22
|
+
);
|
|
30
23
|
|
|
31
|
-
const onSelectedItem =
|
|
32
|
-
.fn<Promise<void>, [GridPopoutEditDropDownSelectedItem<any>]>()
|
|
33
|
-
.mockImplementation(async () => undefined);
|
|
24
|
+
const onSelectedItem = fn(async () => {});
|
|
34
25
|
|
|
35
26
|
const Template: StoryFn<typeof GridFormDropDown> = (props: GridFormDropDownProps<any>) => {
|
|
36
27
|
const config: GridFormDropDownProps<any> = {
|
|
@@ -52,30 +43,37 @@ const Template: StoryFn<typeof GridFormDropDown> = (props: GridFormDropDownProps
|
|
|
52
43
|
|
|
53
44
|
return (
|
|
54
45
|
<div className={"react-menu-inline-test"}>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
<GridContext.Provider
|
|
47
|
+
value={
|
|
48
|
+
{
|
|
49
|
+
stopEditing: () => {},
|
|
50
|
+
cancelEdit: () => {},
|
|
51
|
+
} as any
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
<h6 ref={anchorRef}>Interaction test</h6>
|
|
55
|
+
<GridPopoverContext.Provider
|
|
56
|
+
value={{
|
|
57
|
+
anchorRef,
|
|
58
|
+
updateValue,
|
|
59
|
+
data: { value: "" },
|
|
60
|
+
value: "",
|
|
61
|
+
field: "value",
|
|
62
|
+
selectedRows: [],
|
|
63
|
+
formatValue: () => "",
|
|
64
|
+
saving: false,
|
|
65
|
+
setSaving: () => {},
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<GridFormDropDown {...props} {...config} />
|
|
69
|
+
</GridPopoverContext.Provider>
|
|
70
|
+
</GridContext.Provider>
|
|
74
71
|
</div>
|
|
75
72
|
);
|
|
76
73
|
};
|
|
77
74
|
|
|
78
|
-
|
|
75
|
+
//console.log({ extendedExpect });
|
|
76
|
+
export const GridFormDropDownInteractions_: typeof Template = Template.bind({});
|
|
79
77
|
GridFormDropDownInteractions_.play = async ({ canvasElement }) => {
|
|
80
78
|
const canvas = within(canvasElement);
|
|
81
79
|
|
|
@@ -114,7 +112,7 @@ GridFormDropDownInteractions_.play = async ({ canvasElement }) => {
|
|
|
114
112
|
// Test tab to save
|
|
115
113
|
updateValue.mockClear();
|
|
116
114
|
await userEvent.tab();
|
|
117
|
-
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 =
|
|
115
|
+
expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = tab
|
|
118
116
|
|
|
119
117
|
// Test shift+tab to save
|
|
120
118
|
updateValue.mockClear();
|
package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx
CHANGED
|
@@ -2,16 +2,15 @@ import "../../../react-menu3/styles/index.scss";
|
|
|
2
2
|
import "../../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
5
|
+
import { StoryFn } from "@storybook/react";
|
|
6
|
+
import { expect, fn, userEvent, within } from "@storybook/test";
|
|
7
|
+
import { GridPopoverContext } from "contexts/GridPopoverContext";
|
|
9
8
|
import { useRef } from "react";
|
|
10
9
|
|
|
11
10
|
import "@linzjs/lui/dist/fonts";
|
|
12
11
|
|
|
13
12
|
import {
|
|
14
|
-
|
|
13
|
+
GridContext,
|
|
15
14
|
GridFormEditBearing,
|
|
16
15
|
GridFormEditBearingProps,
|
|
17
16
|
GridPopoverEditBearingCorrectionEditorParams,
|
|
@@ -21,34 +20,45 @@ export default {
|
|
|
21
20
|
title: "GridForm / Interactions",
|
|
22
21
|
component: GridFormEditBearing,
|
|
23
22
|
args: {},
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
|
|
26
|
-
const updateValue =
|
|
25
|
+
const updateValue = fn();
|
|
27
26
|
|
|
28
27
|
const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearingProps<any>) => {
|
|
29
28
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<div className={"react-menu-inline-test"}>
|
|
33
|
-
<
|
|
32
|
+
<GridContext.Provider
|
|
33
|
+
value={
|
|
34
|
+
{
|
|
35
|
+
stopEditing: () => {},
|
|
36
|
+
cancelEdit: () => {},
|
|
37
|
+
} as any
|
|
38
|
+
}
|
|
39
|
+
>
|
|
34
40
|
<h6 ref={anchorRef}>Interaction Test</h6>
|
|
35
41
|
<GridPopoverContext.Provider
|
|
36
|
-
value={
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
value={{
|
|
43
|
+
anchorRef,
|
|
44
|
+
value: null,
|
|
45
|
+
updateValue,
|
|
46
|
+
formatValue: (value) => value,
|
|
47
|
+
setSaving: () => {},
|
|
48
|
+
saving: false,
|
|
49
|
+
selectedRows: [],
|
|
50
|
+
data: { value: "" },
|
|
51
|
+
field: "value",
|
|
52
|
+
}}
|
|
43
53
|
>
|
|
44
54
|
<GridFormEditBearing {...props} {...GridPopoverEditBearingCorrectionEditorParams} />
|
|
45
55
|
</GridPopoverContext.Provider>
|
|
46
|
-
</
|
|
56
|
+
</GridContext.Provider>
|
|
47
57
|
</div>
|
|
48
58
|
);
|
|
49
59
|
};
|
|
50
60
|
|
|
51
|
-
export const GridFormEditBearingCorrectionInteractions_ = Template.bind({});
|
|
61
|
+
export const GridFormEditBearingCorrectionInteractions_: typeof Template = Template.bind({});
|
|
52
62
|
GridFormEditBearingCorrectionInteractions_.play = async ({ canvasElement }) => {
|
|
53
63
|
const canvas = within(canvasElement);
|
|
54
64
|
|
|
@@ -2,16 +2,15 @@ import "../../../react-menu3/styles/index.scss";
|
|
|
2
2
|
import "../../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
5
|
+
import { StoryFn } from "@storybook/react";
|
|
6
|
+
import { expect, fn, userEvent, within } from "@storybook/test";
|
|
7
|
+
import { GridPopoverContext } from "contexts/GridPopoverContext";
|
|
9
8
|
import { useRef } from "react";
|
|
10
9
|
|
|
11
10
|
import "@linzjs/lui/dist/fonts";
|
|
12
11
|
|
|
13
12
|
import {
|
|
14
|
-
|
|
13
|
+
GridContext,
|
|
15
14
|
GridFormEditBearing,
|
|
16
15
|
GridFormEditBearingProps,
|
|
17
16
|
GridPopoverEditBearingEditorParams,
|
|
@@ -21,34 +20,45 @@ export default {
|
|
|
21
20
|
title: "GridForm / Interactions",
|
|
22
21
|
component: GridFormEditBearing,
|
|
23
22
|
args: {},
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
|
|
26
|
-
const updateValue =
|
|
25
|
+
const updateValue = fn();
|
|
27
26
|
|
|
28
27
|
const Template: StoryFn<typeof GridFormEditBearing> = (props: GridFormEditBearingProps<any>) => {
|
|
29
28
|
const anchorRef = useRef<HTMLHeadingElement>(null);
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<div className={"react-menu-inline-test"}>
|
|
33
|
-
<
|
|
32
|
+
<GridContext.Provider
|
|
33
|
+
value={
|
|
34
|
+
{
|
|
35
|
+
stopEditing: () => {},
|
|
36
|
+
cancelEdit: () => {},
|
|
37
|
+
} as any
|
|
38
|
+
}
|
|
39
|
+
>
|
|
34
40
|
<h6 ref={anchorRef}>Interaction Test</h6>
|
|
35
41
|
<GridPopoverContext.Provider
|
|
36
|
-
value={
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
value={{
|
|
43
|
+
anchorRef,
|
|
44
|
+
value: null,
|
|
45
|
+
updateValue,
|
|
46
|
+
formatValue: (value) => value,
|
|
47
|
+
setSaving: () => {},
|
|
48
|
+
saving: false,
|
|
49
|
+
selectedRows: [],
|
|
50
|
+
data: { value: "" },
|
|
51
|
+
field: "value",
|
|
52
|
+
}}
|
|
43
53
|
>
|
|
44
54
|
<GridFormEditBearing {...props} {...GridPopoverEditBearingEditorParams} />
|
|
45
55
|
</GridPopoverContext.Provider>
|
|
46
|
-
</
|
|
56
|
+
</GridContext.Provider>
|
|
47
57
|
</div>
|
|
48
58
|
);
|
|
49
59
|
};
|
|
50
60
|
|
|
51
|
-
export const GridFormEditBearingInteractions_ = Template.bind({});
|
|
61
|
+
export const GridFormEditBearingInteractions_: typeof Template = Template.bind({});
|
|
52
62
|
GridFormEditBearingInteractions_.play = async ({ canvasElement }) => {
|
|
53
63
|
const canvas = within(canvasElement);
|
|
54
64
|
|
|
@@ -2,36 +2,25 @@ import "../../../react-menu3/styles/index.scss";
|
|
|
2
2
|
import "../../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
5
|
+
import { StoryFn } from "@storybook/react";
|
|
6
|
+
import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
|
|
7
|
+
import { GridPopoverContext } from "contexts/GridPopoverContext";
|
|
9
8
|
import { useRef } from "react";
|
|
10
9
|
|
|
11
10
|
import "@linzjs/lui/dist/fonts";
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
GridContextProvider,
|
|
15
|
-
GridFormMultiSelectGrid,
|
|
16
|
-
GridFormMultiSelectGridProps,
|
|
17
|
-
GridFormMultiSelectGridSaveProps,
|
|
18
|
-
MultiSelectGridOption,
|
|
19
|
-
} from "../../..";
|
|
12
|
+
import { GridContext, GridFormMultiSelectGrid, GridFormMultiSelectGridProps, MultiSelectGridOption } from "../../..";
|
|
20
13
|
|
|
21
14
|
export default {
|
|
22
15
|
title: "GridForm / Interactions",
|
|
23
16
|
component: GridFormMultiSelectGrid,
|
|
24
17
|
args: {},
|
|
25
|
-
}
|
|
18
|
+
};
|
|
26
19
|
|
|
27
|
-
const updateValue =
|
|
28
|
-
.fn<void, [saveFn: (selectedRows: any[]) => Promise<boolean>, _tabDirection: 1 | 0 | -1]>()
|
|
29
|
-
.mockImplementation((saveFn: (selectedRows: any[]) => Promise<boolean>, _tabDirection: 1 | 0 | -1) => saveFn([]));
|
|
20
|
+
const updateValue = fn((saveFn: (selectedRows: any[]) => Promise<boolean>, _tabDirection: 1 | 0 | -1) => saveFn([]));
|
|
30
21
|
|
|
31
|
-
const onSave =
|
|
32
|
-
|
|
33
|
-
.mockImplementation(async () => true);
|
|
34
|
-
const onSelectFilter = jest.fn();
|
|
22
|
+
const onSave = fn(async () => true);
|
|
23
|
+
const onSelectFilter = fn();
|
|
35
24
|
|
|
36
25
|
let options: MultiSelectGridOption[] = [];
|
|
37
26
|
const Template: StoryFn<typeof GridFormMultiSelectGrid> = (props: GridFormMultiSelectGridProps<any>) => {
|
|
@@ -52,30 +41,36 @@ const Template: StoryFn<typeof GridFormMultiSelectGrid> = (props: GridFormMultiS
|
|
|
52
41
|
|
|
53
42
|
return (
|
|
54
43
|
<div className={"react-menu-inline-test"}>
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
44
|
+
<GridContext.Provider
|
|
45
|
+
value={
|
|
46
|
+
{
|
|
47
|
+
stopEditing: () => {},
|
|
48
|
+
cancelEdit: () => {},
|
|
49
|
+
} as any
|
|
50
|
+
}
|
|
51
|
+
>
|
|
52
|
+
<h6 ref={anchorRef}>Interaction test</h6>
|
|
53
|
+
<GridPopoverContext.Provider
|
|
54
|
+
value={{
|
|
55
|
+
anchorRef: anchorRef,
|
|
56
|
+
updateValue,
|
|
57
|
+
value: "",
|
|
58
|
+
selectedRows: [],
|
|
59
|
+
formatValue: (value) => value,
|
|
60
|
+
setSaving: () => {},
|
|
61
|
+
saving: false,
|
|
62
|
+
data: { value: "" },
|
|
63
|
+
field: "value",
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<GridFormMultiSelectGrid {...props} {...config} />
|
|
67
|
+
</GridPopoverContext.Provider>
|
|
68
|
+
</GridContext.Provider>
|
|
74
69
|
</div>
|
|
75
70
|
);
|
|
76
71
|
};
|
|
77
72
|
|
|
78
|
-
export const GridFormMultiSelectGridInteractions_ = Template.bind({});
|
|
73
|
+
export const GridFormMultiSelectGridInteractions_: typeof Template = Template.bind({});
|
|
79
74
|
GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
|
|
80
75
|
updateValue.mockClear();
|
|
81
76
|
onSave.mockClear();
|