@linzjs/step-ag-grid 17.7.0 → 17.8.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/GridNoRowsOverlay.d.ts +3 -1
- package/dist/step-ag-grid.cjs.js +1096 -703
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +1098 -705
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +47 -46
- package/src/components/Grid.tsx +21 -20
- package/src/components/GridNoRowsOverlay.tsx +27 -3
- package/src/stories/components/ActionButton.stories.tsx +3 -3
- package/src/stories/grid/GridDragRow.stories.tsx +3 -3
- package/src/stories/grid/GridFilterButtons.stories.tsx +3 -3
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +3 -3
- package/src/stories/grid/GridNonEditableRow.stories.tsx +3 -3
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +3 -3
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +3 -3
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +3 -3
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +3 -3
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +3 -3
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +3 -3
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +3 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +7 -8
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +3 -3
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +3 -3
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +3 -3
- package/src/stories/react-menu/ReactMenu.stories.tsx +3 -3
- package/dist/node_modules/@linzjs/lui/dist/assets/svg-content.d.ts +0 -7
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": "17.
|
|
5
|
+
"version": "17.8.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -28,23 +28,24 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@linzjs/lui": ">=18",
|
|
31
|
-
"ag-grid-community": ">=
|
|
32
|
-
"ag-grid-react": ">=
|
|
31
|
+
"ag-grid-community": ">=29",
|
|
32
|
+
"ag-grid-react": ">=29",
|
|
33
33
|
"lodash-es": ">=4",
|
|
34
|
-
"react": ">=
|
|
35
|
-
"react-dom": ">=
|
|
34
|
+
"react": ">=18",
|
|
35
|
+
"react-dom": ">=18"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@linzjs/lui": ">=18",
|
|
39
|
-
"ag-grid-community": ">=
|
|
40
|
-
"ag-grid-react": ">=
|
|
39
|
+
"ag-grid-community": ">=29",
|
|
40
|
+
"ag-grid-react": ">=29",
|
|
41
41
|
"clsx": "^2.0.0",
|
|
42
42
|
"debounce-promise": "^3.1.2",
|
|
43
43
|
"lodash-es": ">=4",
|
|
44
44
|
"matcher": "^5.0.0",
|
|
45
|
-
"react": ">=
|
|
46
|
-
"react-dom": ">=
|
|
45
|
+
"react": ">=18",
|
|
46
|
+
"react-dom": ">=18",
|
|
47
47
|
"react-transition-state": "^2.1.1",
|
|
48
|
+
"usehooks-ts": "^2.9.1",
|
|
48
49
|
"uuid": "^9.0.1"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
@@ -83,71 +84,71 @@
|
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
86
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
86
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
87
|
-
"@rollup/plugin-json": "^6.0.
|
|
88
|
-
"@rollup/plugin-node-resolve": "^15.2.
|
|
87
|
+
"@rollup/plugin-commonjs": "^25.0.5",
|
|
88
|
+
"@rollup/plugin-json": "^6.0.1",
|
|
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": "^7.
|
|
92
|
-
"@storybook/addon-interactions": "^7.
|
|
92
|
+
"@storybook/addon-essentials": "^7.4.6",
|
|
93
|
+
"@storybook/addon-interactions": "^7.4.6",
|
|
93
94
|
"@storybook/addon-postcss": "^2.0.0",
|
|
94
|
-
"@storybook/jest": "^0.
|
|
95
|
-
"@storybook/preset-create-react-app": "^7.
|
|
96
|
-
"@storybook/react": "^7.
|
|
97
|
-
"@storybook/react-webpack5": "^7.
|
|
95
|
+
"@storybook/jest": "^0.2.3",
|
|
96
|
+
"@storybook/preset-create-react-app": "^7.4.6",
|
|
97
|
+
"@storybook/react": "^7.4.6",
|
|
98
|
+
"@storybook/react-webpack5": "^7.4.6",
|
|
98
99
|
"@storybook/test-runner": "^0.13.0",
|
|
99
|
-
"@storybook/testing-library": "^0.2.
|
|
100
|
-
"@testing-library/dom": "^9.3.
|
|
100
|
+
"@storybook/testing-library": "^0.2.2",
|
|
101
|
+
"@testing-library/dom": "^9.3.3",
|
|
101
102
|
"@testing-library/jest-dom": "^5.17.0",
|
|
102
103
|
"@testing-library/react": "^14.0.0",
|
|
103
|
-
"@testing-library/user-event": "^14.
|
|
104
|
+
"@testing-library/user-event": "^14.5.1",
|
|
104
105
|
"@trivago/prettier-plugin-sort-imports": "^4.2.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.2.
|
|
111
|
-
"@types/uuid": "^9.0.
|
|
106
|
+
"@types/debounce-promise": "^3.1.7",
|
|
107
|
+
"@types/jest": "^29.5.5",
|
|
108
|
+
"@types/lodash-es": "^4.17.9",
|
|
109
|
+
"@types/node": "^18.18.4",
|
|
110
|
+
"@types/react": "^18.2.25",
|
|
111
|
+
"@types/react-dom": "^18.2.11",
|
|
112
|
+
"@types/uuid": "^9.0.5",
|
|
112
113
|
"@typescript-eslint/parser": "^5.62.0",
|
|
113
|
-
"babel-jest": "^29.
|
|
114
|
+
"babel-jest": "^29.7.0",
|
|
114
115
|
"babel-preset-react-app": "^10.0.1",
|
|
115
|
-
"chromatic": "^
|
|
116
|
+
"chromatic": "^7.2.3",
|
|
116
117
|
"conventional-changelog-conventionalcommits": "^6.1.0",
|
|
117
118
|
"css-loader": "^6.8.1",
|
|
118
|
-
"eslint": "^8.
|
|
119
|
+
"eslint": "^8.51.0",
|
|
119
120
|
"eslint-config-prettier": "^9.0.0",
|
|
120
121
|
"eslint-config-react-app": "^7.0.1",
|
|
121
|
-
"eslint-plugin-deprecation": "^1.
|
|
122
|
-
"eslint-plugin-import": "^2.28.
|
|
123
|
-
"eslint-plugin-jest": "^27.2
|
|
122
|
+
"eslint-plugin-deprecation": "^1.6.0",
|
|
123
|
+
"eslint-plugin-import": "^2.28.1",
|
|
124
|
+
"eslint-plugin-jest": "^27.4.2",
|
|
124
125
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
125
126
|
"eslint-plugin-prettier": "^4.2.1",
|
|
126
|
-
"eslint-plugin-react": "^7.33.
|
|
127
|
+
"eslint-plugin-react": "^7.33.2",
|
|
127
128
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
128
|
-
"eslint-plugin-storybook": "^0.6.
|
|
129
|
-
"eslint-plugin-testing-library": "^6.0.
|
|
130
|
-
"jest": "^29.
|
|
129
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
130
|
+
"eslint-plugin-testing-library": "^6.0.2",
|
|
131
|
+
"jest": "^29.7.0",
|
|
131
132
|
"jest-canvas-mock": "^2.5.2",
|
|
132
|
-
"jest-environment-jsdom": "^29.
|
|
133
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
133
134
|
"jest-expect-message": "^1.1.3",
|
|
134
135
|
"mkdirp": "^3.0.1",
|
|
135
136
|
"npm-run-all": "^4.1.5",
|
|
136
|
-
"postcss": "^8.4.
|
|
137
|
+
"postcss": "^8.4.31",
|
|
137
138
|
"postcss-loader": "^7.3.3",
|
|
138
|
-
"postcss-scss": "^4.0.
|
|
139
|
+
"postcss-scss": "^4.0.9",
|
|
139
140
|
"prettier": "^2.8.8",
|
|
140
141
|
"react-app-polyfill": "^3.0.0",
|
|
141
142
|
"react-scripts": "^5.0.1",
|
|
142
|
-
"rollup": "^
|
|
143
|
-
"rollup-plugin-copy": "^3.
|
|
143
|
+
"rollup": "^4.0.2",
|
|
144
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
144
145
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
145
146
|
"rollup-plugin-postcss": "^4.0.2",
|
|
146
|
-
"rollup-plugin-typescript2": "^0.
|
|
147
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
147
148
|
"sass": "1.66.1",
|
|
148
149
|
"sass-loader": "^13.3.2",
|
|
149
|
-
"semantic-release": "^
|
|
150
|
-
"storybook": "^7.
|
|
150
|
+
"semantic-release": "^22.0.5",
|
|
151
|
+
"storybook": "^7.4.6",
|
|
151
152
|
"storybook-css-modules-preset": "^1.1.1",
|
|
152
153
|
"style-loader": "^3.3.3",
|
|
153
154
|
"stylelint": "^15.10.3",
|
package/src/components/Grid.tsx
CHANGED
|
@@ -23,10 +23,10 @@ import { AgGridReact } from "ag-grid-react";
|
|
|
23
23
|
import clsx from "clsx";
|
|
24
24
|
import { defer, difference, isEmpty, last, omit, xorBy } from "lodash-es";
|
|
25
25
|
import { ReactElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
26
|
+
import { useInterval } from "usehooks-ts";
|
|
26
27
|
|
|
27
28
|
import { GridContext } from "../contexts/GridContext";
|
|
28
29
|
import { GridUpdatingContext } from "../contexts/GridUpdatingContext";
|
|
29
|
-
import { useIntervalHook } from "../lui/timeoutHook";
|
|
30
30
|
import { fnOrVar, isNotEmpty } from "../utils/util";
|
|
31
31
|
import { GridNoRowsOverlay } from "./GridNoRowsOverlay";
|
|
32
32
|
import { usePostSortRowsHook } from "./PostSortRowsHook";
|
|
@@ -116,7 +116,7 @@ export const Grid = ({
|
|
|
116
116
|
contextMenuSelectRow = false,
|
|
117
117
|
singleClickEdit = false,
|
|
118
118
|
rowData,
|
|
119
|
-
rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 :
|
|
119
|
+
rowHeight = theme === "ag-theme-step-default" ? 40 : theme === "ag-theme-step-compact" ? 36 : 40,
|
|
120
120
|
...params
|
|
121
121
|
}: GridProps): ReactElement => {
|
|
122
122
|
const {
|
|
@@ -202,23 +202,20 @@ export const Grid = ({
|
|
|
202
202
|
/**
|
|
203
203
|
* Auto-size windows that had deferred auto-size
|
|
204
204
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
needsAutoSize.current = true;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (needsAutoSize.current) {
|
|
216
|
-
needsAutoSize.current = false;
|
|
217
|
-
setInitialContentSize();
|
|
205
|
+
useInterval(() => {
|
|
206
|
+
// Check if window has been popped out and needs resize
|
|
207
|
+
const currentDocument = gridDivRef.current?.ownerDocument;
|
|
208
|
+
if (currentDocument !== lastOwnerDocumentRef.current) {
|
|
209
|
+
lastOwnerDocumentRef.current = currentDocument;
|
|
210
|
+
if (currentDocument) {
|
|
211
|
+
needsAutoSize.current = true;
|
|
218
212
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
213
|
+
}
|
|
214
|
+
if (needsAutoSize.current) {
|
|
215
|
+
needsAutoSize.current = false;
|
|
216
|
+
setInitialContentSize();
|
|
217
|
+
}
|
|
218
|
+
}, 200);
|
|
222
219
|
|
|
223
220
|
/**
|
|
224
221
|
* On data load select the first row of the grid if required.
|
|
@@ -611,12 +608,12 @@ export const Grid = ({
|
|
|
611
608
|
const clientSideRowModel = event.api.getModel() as IClientSideRowModel;
|
|
612
609
|
|
|
613
610
|
//position 0 means highlight above, 1 means below
|
|
614
|
-
const position = clientSideRowModel.getHighlightPosition(event.y, event.overNode as RowNode
|
|
611
|
+
const position = clientSideRowModel.getHighlightPosition(event.y, event.overNode as RowNode);
|
|
615
612
|
|
|
616
613
|
//we don't want to show the row highlight if it wouldn't result in the row moving
|
|
617
614
|
const targetIndex = event.overIndex + position - (event.node.rowIndex < event.overIndex ? 1 : 0);
|
|
618
615
|
if (event.node.rowIndex != targetIndex) {
|
|
619
|
-
clientSideRowModel.highlightRowAtPixel(event.node as RowNode
|
|
616
|
+
clientSideRowModel.highlightRowAtPixel(event.node as RowNode, event.y);
|
|
620
617
|
}
|
|
621
618
|
}
|
|
622
619
|
}, []);
|
|
@@ -650,6 +647,8 @@ export const Grid = ({
|
|
|
650
647
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
651
648
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
652
649
|
|
|
650
|
+
const headerRowCount = columnDefs.some((c) => (c as any).children) ? 2 : 1;
|
|
651
|
+
|
|
653
652
|
return (
|
|
654
653
|
<div
|
|
655
654
|
data-testid={dataTestId}
|
|
@@ -692,7 +691,9 @@ export const Grid = ({
|
|
|
692
691
|
event.api.forEachNode(() => rowCount++);
|
|
693
692
|
return (
|
|
694
693
|
<GridNoRowsOverlay
|
|
694
|
+
loading={!rowData}
|
|
695
695
|
rowCount={rowCount}
|
|
696
|
+
headerRowHeight={headerRowCount * rowHeight}
|
|
696
697
|
filteredRowCount={event.api.getDisplayedRowCount()}
|
|
697
698
|
noRowsOverlayText={params.noRowsOverlayText}
|
|
698
699
|
/>
|
|
@@ -1,11 +1,35 @@
|
|
|
1
|
+
import { LuiStatusSpinner } from "@linzjs/lui";
|
|
2
|
+
|
|
3
|
+
const GridLoadingOverlayComponent = (props: { headerRowHeight: number }) => (
|
|
4
|
+
<div
|
|
5
|
+
style={{
|
|
6
|
+
left: 0,
|
|
7
|
+
top: 0,
|
|
8
|
+
bottom: 0,
|
|
9
|
+
right: 0,
|
|
10
|
+
position: "absolute",
|
|
11
|
+
backgroundColor: "rgba(255,255,255,0.5)",
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<div style={{ height: "100%", position: "relative" }}>
|
|
15
|
+
<div style={{ position: "absolute", left: 0, top: props.headerRowHeight, right: 0, bottom: 0 }}>
|
|
16
|
+
<LuiStatusSpinner />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
|
|
1
22
|
export interface GridNoRowsOverlayProps {
|
|
23
|
+
loading: boolean;
|
|
2
24
|
rowCount: number | undefined | null;
|
|
3
25
|
filteredRowCount: number;
|
|
4
26
|
noRowsOverlayText: string | undefined;
|
|
27
|
+
headerRowHeight: number;
|
|
5
28
|
}
|
|
6
29
|
|
|
7
|
-
export const GridNoRowsOverlay = (
|
|
8
|
-
if (
|
|
9
|
-
if (
|
|
30
|
+
export const GridNoRowsOverlay = (props: GridNoRowsOverlayProps) => {
|
|
31
|
+
if (props.loading) return <GridLoadingOverlayComponent headerRowHeight={props.headerRowHeight} />;
|
|
32
|
+
if (props.rowCount === 0) return <div>{props.noRowsOverlayText ?? "There are currently no rows"}</div>;
|
|
33
|
+
if (props.filteredRowCount === 0) return <div>All rows have been filtered</div>;
|
|
10
34
|
return <span />;
|
|
11
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
|
|
6
6
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -12,9 +12,9 @@ export default {
|
|
|
12
12
|
title: "Components / ActionButton",
|
|
13
13
|
component: ActionButton,
|
|
14
14
|
args: {},
|
|
15
|
-
} as
|
|
15
|
+
} as Meta<typeof ActionButton>;
|
|
16
16
|
|
|
17
|
-
const ActionButtonTemplate:
|
|
17
|
+
const ActionButtonTemplate: StoryFn<typeof ActionButton> = () => {
|
|
18
18
|
const performAction = useCallback(async () => {
|
|
19
19
|
await wait(1000);
|
|
20
20
|
}, []);
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
</div>
|
|
48
48
|
),
|
|
49
49
|
],
|
|
50
|
-
} as
|
|
50
|
+
} as Meta<typeof Grid>;
|
|
51
51
|
|
|
52
52
|
interface ITestRow {
|
|
53
53
|
id: number;
|
|
@@ -58,7 +58,7 @@ interface ITestRow {
|
|
|
58
58
|
dd: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const GridDragRowTemplate:
|
|
61
|
+
const GridDragRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
62
62
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
63
63
|
() => [
|
|
64
64
|
GridCell({
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
</div>
|
|
36
36
|
),
|
|
37
37
|
],
|
|
38
|
-
} as
|
|
38
|
+
} as Meta<typeof Grid>;
|
|
39
39
|
|
|
40
40
|
interface ITestRow {
|
|
41
41
|
id: number;
|
|
@@ -43,7 +43,7 @@ interface ITestRow {
|
|
|
43
43
|
desc: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const GridFilterButtonsTemplate:
|
|
46
|
+
const GridFilterButtonsTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
47
47
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
48
48
|
() => [
|
|
49
49
|
GridCell({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
|
|
3
3
|
import { expect } from "@storybook/jest";
|
|
4
|
-
import {
|
|
4
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
5
5
|
import { within } from "@storybook/testing-library";
|
|
6
6
|
|
|
7
7
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -12,9 +12,9 @@ export default {
|
|
|
12
12
|
title: "Components / Grids / GridNoRowsOverlay",
|
|
13
13
|
component: GridNoRowsOverlay,
|
|
14
14
|
args: {},
|
|
15
|
-
} as
|
|
15
|
+
} as Meta<typeof GridNoRowsOverlay>;
|
|
16
16
|
|
|
17
|
-
const GridNoRowsOverlayTemplate:
|
|
17
|
+
const GridNoRowsOverlayTemplate: StoryFn<typeof GridNoRowsOverlay> = (params: GridNoRowsOverlayProps) => {
|
|
18
18
|
return <GridNoRowsOverlay {...params} />;
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { ColDef } from "ag-grid-community";
|
|
7
7
|
import { GridPopoverEditDropDown } from "components/gridPopoverEdit/GridPopoverEditDropDown";
|
|
8
8
|
import { GridPopoverTextArea } from "components/gridPopoverEdit/GridPopoverTextArea";
|
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
</div>
|
|
45
45
|
),
|
|
46
46
|
],
|
|
47
|
-
} as
|
|
47
|
+
} as Meta<typeof Grid>;
|
|
48
48
|
|
|
49
49
|
interface ITestRow {
|
|
50
50
|
id: number;
|
|
@@ -53,7 +53,7 @@ interface ITestRow {
|
|
|
53
53
|
desc: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const GridNonEditableRowTemplate:
|
|
56
|
+
const GridNonEditableRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
57
57
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
58
58
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
59
59
|
() => [
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { ReactElement, useCallback, useContext, useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
</div>
|
|
42
42
|
),
|
|
43
43
|
],
|
|
44
|
-
} as
|
|
44
|
+
} as Meta<typeof Grid>;
|
|
45
45
|
|
|
46
46
|
const ContextMenu = ({ clickedRow, colDef, close }: GridContextMenuComponentProps<IFormTestRow>): ReactElement => {
|
|
47
47
|
const onClick = useCallback(() => {
|
|
@@ -64,7 +64,7 @@ const ContextMenu = ({ clickedRow, colDef, close }: GridContextMenuComponentProp
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const GridPopoutContextMenuTemplate:
|
|
67
|
+
const GridPopoutContextMenuTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
68
68
|
const { selectRowsWithFlashDiff } = useContext(GridContext);
|
|
69
69
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
70
70
|
const [rowData, setRowData] = useState([
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -29,9 +29,9 @@ export default {
|
|
|
29
29
|
</div>
|
|
30
30
|
),
|
|
31
31
|
],
|
|
32
|
-
} as
|
|
32
|
+
} as Meta<typeof Grid>;
|
|
33
33
|
|
|
34
|
-
const GridPopoutEditGenericTemplate:
|
|
34
|
+
const GridPopoutEditGenericTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
35
35
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
36
36
|
const columnDefs: ColDefT<IFormTestRow>[] = useMemo(
|
|
37
37
|
() => [
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useCallback, useContext, useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -47,9 +47,9 @@ export default {
|
|
|
47
47
|
</div>
|
|
48
48
|
),
|
|
49
49
|
],
|
|
50
|
-
} as
|
|
50
|
+
} as Meta<typeof Grid>;
|
|
51
51
|
|
|
52
|
-
const GridPopoutEditGenericTemplate:
|
|
52
|
+
const GridPopoutEditGenericTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
53
53
|
const { selectRowsWithFlashDiff } = useContext(GridContext);
|
|
54
54
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
55
55
|
const [rowData, setRowData] = useState([
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
</div>
|
|
45
45
|
),
|
|
46
46
|
],
|
|
47
|
-
} as
|
|
47
|
+
} as Meta<typeof Grid>;
|
|
48
48
|
|
|
49
49
|
interface ITestRow {
|
|
50
50
|
id: number;
|
|
@@ -52,7 +52,7 @@ interface ITestRow {
|
|
|
52
52
|
bearing: string | number | null;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const GridPopoverEditBearingTemplate:
|
|
55
|
+
const GridPopoverEditBearingTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
56
56
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
57
57
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
58
58
|
() => [
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { useCallback, useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
</div>
|
|
49
49
|
),
|
|
50
50
|
],
|
|
51
|
-
} as
|
|
51
|
+
} as Meta<typeof Grid>;
|
|
52
52
|
|
|
53
53
|
interface ITestRow {
|
|
54
54
|
id: number;
|
|
@@ -65,7 +65,7 @@ interface ICode {
|
|
|
65
65
|
desc: string;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const GridEditDropDownTemplate:
|
|
68
|
+
const GridEditDropDownTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
69
69
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
70
70
|
|
|
71
71
|
const optionsFn = useCallback(async (selectedRows: ITestRow[], filter?: string) => {
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { isEmpty, partition } from "lodash-es";
|
|
7
7
|
import { useMemo, useState } from "react";
|
|
8
8
|
|
|
@@ -41,7 +41,7 @@ export default {
|
|
|
41
41
|
</div>
|
|
42
42
|
),
|
|
43
43
|
],
|
|
44
|
-
} as
|
|
44
|
+
} as Meta<typeof Grid>;
|
|
45
45
|
|
|
46
46
|
interface ITestRow {
|
|
47
47
|
id: number;
|
|
@@ -50,7 +50,7 @@ interface ITestRow {
|
|
|
50
50
|
position3: string | null;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const GridEditMultiSelectTemplate:
|
|
53
|
+
const GridEditMultiSelectTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
54
54
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
55
55
|
|
|
56
56
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(() => {
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { countBy, mergeWith, pull, range, union } from "lodash-es";
|
|
7
7
|
import { useMemo, useState } from "react";
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
</div>
|
|
33
33
|
),
|
|
34
34
|
],
|
|
35
|
-
} as
|
|
35
|
+
} as Meta<typeof Grid>;
|
|
36
36
|
|
|
37
37
|
interface ITestRow {
|
|
38
38
|
id: number;
|
|
@@ -40,7 +40,7 @@ interface ITestRow {
|
|
|
40
40
|
position2: string | null;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const GridEditMultiSelectGridTemplate:
|
|
43
|
+
const GridEditMultiSelectGridTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
44
44
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
45
45
|
|
|
46
46
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(() => {
|
|
@@ -2,7 +2,7 @@ import "../../styles/GridTheme.scss";
|
|
|
2
2
|
import "../../styles/index.scss";
|
|
3
3
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
6
|
import { ReactElement, useCallback, useMemo, useState } from "react";
|
|
7
7
|
|
|
8
8
|
import "@linzjs/lui/dist/fonts";
|
|
@@ -26,8 +26,7 @@ import {
|
|
|
26
26
|
useGridFilter,
|
|
27
27
|
wait,
|
|
28
28
|
} from "../..";
|
|
29
|
-
import { GridFilterColumnsToggle } from "../../components";
|
|
30
|
-
import { GridFilterDownloadCsvButton } from "../../components";
|
|
29
|
+
import { GridFilterColumnsToggle, GridFilterDownloadCsvButton } from "../../components";
|
|
31
30
|
import { GridCellFiller } from "../../components/GridCellFiller";
|
|
32
31
|
import { waitForGridReady } from "../../utils/storybookTestUtil";
|
|
33
32
|
|
|
@@ -60,7 +59,7 @@ export default {
|
|
|
60
59
|
</div>
|
|
61
60
|
),
|
|
62
61
|
],
|
|
63
|
-
} as
|
|
62
|
+
} as Meta<typeof Grid>;
|
|
64
63
|
|
|
65
64
|
interface ITestRow {
|
|
66
65
|
id: number;
|
|
@@ -71,7 +70,7 @@ interface ITestRow {
|
|
|
71
70
|
dd: string;
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
const GridReadOnlyTemplate:
|
|
73
|
+
const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
75
74
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
76
75
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
77
76
|
() => [
|
|
@@ -211,14 +210,14 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
|
|
|
211
210
|
[],
|
|
212
211
|
);
|
|
213
212
|
|
|
214
|
-
const [rowData] = useState([
|
|
213
|
+
const [rowData] = useState<ITestRow[]>([
|
|
215
214
|
{ id: 1000, position: "Tester", age: 30, height: `6'4"`, desc: "Tests application", dd: "1" },
|
|
216
215
|
{ id: 1001, position: "Developer", age: 12, height: `5'3"`, desc: "Develops application", dd: "2" },
|
|
217
216
|
{ id: 1002, position: "Manager", age: 65, height: `5'9"`, desc: "Manages", dd: "3" },
|
|
218
|
-
]
|
|
217
|
+
]);
|
|
219
218
|
|
|
220
219
|
return (
|
|
221
|
-
<GridWrapper maxHeight={
|
|
220
|
+
<GridWrapper maxHeight={400}>
|
|
222
221
|
<GridFilters>
|
|
223
222
|
<GridFilterQuick />
|
|
224
223
|
<GridFilterLessThan text="Age <" field={"age"} />
|