@linzjs/step-ag-grid 17.13.0 → 18.1.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/index.css +8 -0
- package/dist/src/components/Grid.d.ts +2 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/step-ag-grid.cjs.js +55959 -25655
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +55996 -25641
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +20 -20
- package/src/components/Grid.tsx +4 -0
- package/src/index.ts +0 -1
- package/src/stories/grid/GridPinnedRow.stories.tsx +105 -0
- package/src/stories/grid/GridReadOnly.stories.tsx +0 -19
- package/src/styles/Grid.scss +9 -0
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": "
|
|
5
|
+
"version": "18.1.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -27,17 +27,16 @@
|
|
|
27
27
|
"node": ">=18"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@linzjs/lui": ">=
|
|
31
|
-
"ag-grid-
|
|
32
|
-
"ag-grid-react": ">=29",
|
|
30
|
+
"@linzjs/lui": ">=21",
|
|
31
|
+
"ag-grid-react": "~29",
|
|
33
32
|
"lodash-es": ">=4",
|
|
34
33
|
"react": ">=18",
|
|
35
34
|
"react-dom": ">=18"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@linzjs/lui": ">=
|
|
39
|
-
"ag-grid-community": "
|
|
40
|
-
"ag-grid-react": "
|
|
37
|
+
"@linzjs/lui": ">=21",
|
|
38
|
+
"ag-grid-community": "~29",
|
|
39
|
+
"ag-grid-react": "~29",
|
|
41
40
|
"clsx": "^2.0.0",
|
|
42
41
|
"debounce-promise": "^3.1.2",
|
|
43
42
|
"lodash-es": ">=4",
|
|
@@ -89,20 +88,20 @@
|
|
|
89
88
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
90
89
|
"@semantic-release/changelog": "^6.0.3",
|
|
91
90
|
"@semantic-release/git": "^10.0.1",
|
|
92
|
-
"@storybook/addon-essentials": "^7.4
|
|
93
|
-
"@storybook/addon-interactions": "^7.4
|
|
91
|
+
"@storybook/addon-essentials": "^7.6.4",
|
|
92
|
+
"@storybook/addon-interactions": "^7.6.4",
|
|
94
93
|
"@storybook/addon-postcss": "^2.0.0",
|
|
95
94
|
"@storybook/jest": "^0.2.3",
|
|
96
|
-
"@storybook/preset-create-react-app": "^7.4
|
|
97
|
-
"@storybook/react": "^7.4
|
|
98
|
-
"@storybook/react-webpack5": "^7.4
|
|
99
|
-
"@storybook/test-runner": "^0.
|
|
95
|
+
"@storybook/preset-create-react-app": "^7.6.4",
|
|
96
|
+
"@storybook/react": "^7.6.4",
|
|
97
|
+
"@storybook/react-webpack5": "^7.6.4",
|
|
98
|
+
"@storybook/test-runner": "^0.16.0",
|
|
100
99
|
"@storybook/testing-library": "^0.2.2",
|
|
101
100
|
"@testing-library/dom": "^9.3.3",
|
|
102
|
-
"@testing-library/jest-dom": "^
|
|
103
|
-
"@testing-library/react": "^14.
|
|
101
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
102
|
+
"@testing-library/react": "^14.1.2",
|
|
104
103
|
"@testing-library/user-event": "^14.5.1",
|
|
105
|
-
"@trivago/prettier-plugin-sort-imports": "^4.
|
|
104
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
106
105
|
"@types/debounce-promise": "^3.1.7",
|
|
107
106
|
"@types/jest": "^29.5.5",
|
|
108
107
|
"@types/lodash-es": "^4.17.9",
|
|
@@ -113,9 +112,10 @@
|
|
|
113
112
|
"@typescript-eslint/parser": "^5.62.0",
|
|
114
113
|
"babel-jest": "^29.7.0",
|
|
115
114
|
"babel-preset-react-app": "^10.0.1",
|
|
116
|
-
"chromatic": "^
|
|
115
|
+
"chromatic": "^10.1.0",
|
|
117
116
|
"conventional-changelog-conventionalcommits": "^6.1.0",
|
|
118
117
|
"css-loader": "^6.8.1",
|
|
118
|
+
"esbuild": "^0.19.9",
|
|
119
119
|
"eslint": "^8.51.0",
|
|
120
120
|
"eslint-config-prettier": "^9.0.0",
|
|
121
121
|
"eslint-config-react-app": "^7.0.1",
|
|
@@ -147,15 +147,15 @@
|
|
|
147
147
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
148
148
|
"sass": "1.66.1",
|
|
149
149
|
"sass-loader": "^13.3.2",
|
|
150
|
-
"semantic-release": "^22.0.
|
|
151
|
-
"storybook": "^7.4
|
|
150
|
+
"semantic-release": "^22.0.10",
|
|
151
|
+
"storybook": "^7.6.4",
|
|
152
152
|
"storybook-css-modules-preset": "^1.1.1",
|
|
153
153
|
"style-loader": "^3.3.3",
|
|
154
154
|
"stylelint": "^15.10.3",
|
|
155
155
|
"stylelint-config-recommended-scss": "^12.0.0",
|
|
156
156
|
"stylelint-config-standard": "^34.0.0",
|
|
157
157
|
"stylelint-prettier": "^3.0.0",
|
|
158
|
-
"stylelint-scss": "^5.
|
|
158
|
+
"stylelint-scss": "^5.3.2",
|
|
159
159
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
160
160
|
"typescript": "^4.9.5"
|
|
161
161
|
},
|
package/src/components/Grid.tsx
CHANGED
|
@@ -105,6 +105,8 @@ export interface GridProps {
|
|
|
105
105
|
|
|
106
106
|
loading?: boolean;
|
|
107
107
|
suppressCellFocus?: boolean;
|
|
108
|
+
pinnedTopRowData?: GridOptions["pinnedTopRowData"];
|
|
109
|
+
pinnedBottomRowData?: GridOptions["pinnedBottomRowData"];
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/**
|
|
@@ -738,6 +740,8 @@ export const Grid = ({
|
|
|
738
740
|
onRowDragEnd={onRowDragEnd}
|
|
739
741
|
onRowDragLeave={onRowDragLeave}
|
|
740
742
|
suppressCellFocus={params.suppressCellFocus}
|
|
743
|
+
pinnedTopRowData={params.pinnedTopRowData}
|
|
744
|
+
pinnedBottomRowData={params.pinnedBottomRowData}
|
|
741
745
|
/>
|
|
742
746
|
</div>
|
|
743
747
|
</div>
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import "../../styles/GridTheme.scss";
|
|
2
|
+
import "../../styles/index.scss";
|
|
3
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
4
|
+
|
|
5
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
6
|
+
import { useMemo, useState } from "react";
|
|
7
|
+
|
|
8
|
+
import "@linzjs/lui/dist/fonts";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
ColDefT,
|
|
12
|
+
Grid,
|
|
13
|
+
GridCell,
|
|
14
|
+
GridContextProvider,
|
|
15
|
+
GridProps,
|
|
16
|
+
GridUpdatingContextProvider,
|
|
17
|
+
GridWrapper,
|
|
18
|
+
} from "../..";
|
|
19
|
+
import { waitForGridReady } from "../../utils/storybookTestUtil";
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
title: "Components / Grids",
|
|
23
|
+
component: Grid,
|
|
24
|
+
args: {
|
|
25
|
+
selectable: false,
|
|
26
|
+
},
|
|
27
|
+
// Storybook hangs otherwise
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
source: {
|
|
31
|
+
type: "code",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
decorators: [
|
|
36
|
+
(Story) => (
|
|
37
|
+
<div style={{ maxWidth: 1024, height: 260, display: "flex", flexDirection: "column" }}>
|
|
38
|
+
<GridUpdatingContextProvider>
|
|
39
|
+
<GridContextProvider>
|
|
40
|
+
<Story />
|
|
41
|
+
</GridContextProvider>
|
|
42
|
+
</GridUpdatingContextProvider>
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
],
|
|
46
|
+
} as Meta<typeof Grid>;
|
|
47
|
+
|
|
48
|
+
interface ITestRow {
|
|
49
|
+
id: number;
|
|
50
|
+
name: string;
|
|
51
|
+
position: string;
|
|
52
|
+
age: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface ITestPinnedRow {
|
|
56
|
+
name: string;
|
|
57
|
+
position: string;
|
|
58
|
+
age: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const PinnedRowTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
62
|
+
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
63
|
+
() => [
|
|
64
|
+
GridCell({
|
|
65
|
+
field: "name",
|
|
66
|
+
headerName: "Name",
|
|
67
|
+
}),
|
|
68
|
+
GridCell({
|
|
69
|
+
field: "position",
|
|
70
|
+
headerName: "Position",
|
|
71
|
+
}),
|
|
72
|
+
GridCell({
|
|
73
|
+
field: "age",
|
|
74
|
+
headerName: "Age",
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
[],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const [rowData] = useState<ITestRow[]>([
|
|
81
|
+
{ id: 1, name: "Opeyemi", position: "Tester", age: 30 },
|
|
82
|
+
{ id: 2, name: "Johnie", position: "Developer", age: 21 },
|
|
83
|
+
{ id: 3, name: "Laxmi", position: "Manager", age: 65 },
|
|
84
|
+
{ id: 4, name: "Salama", position: "Developer", age: 22 },
|
|
85
|
+
{ id: 5, name: "Husni", position: "Developer", age: 24 },
|
|
86
|
+
]);
|
|
87
|
+
const [pinnedBottomRowData] = useState<ITestPinnedRow[]>([{ name: "Total Age", position: "", age: 170 }]);
|
|
88
|
+
const [pinnedTopRowData] = useState<ITestPinnedRow[]>([{ name: "Min Age", position: "", age: 21 }]);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<GridWrapper maxHeight={400}>
|
|
92
|
+
<Grid
|
|
93
|
+
data-testid={"readonly"}
|
|
94
|
+
{...props}
|
|
95
|
+
selectable={false}
|
|
96
|
+
columnDefs={columnDefs}
|
|
97
|
+
rowData={rowData}
|
|
98
|
+
pinnedTopRowData={pinnedTopRowData}
|
|
99
|
+
pinnedBottomRowData={pinnedBottomRowData}
|
|
100
|
+
/>
|
|
101
|
+
</GridWrapper>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
export const PinnedRow = PinnedRowTemplate.bind({});
|
|
105
|
+
PinnedRow.play = waitForGridReady;
|
|
@@ -220,25 +220,6 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
|
220
220
|
{ id: 1001, position: "Developer", age: 12, height: `5'3"`, desc: "Develops application", dd: "2" },
|
|
221
221
|
{ id: 1002, position: "Manager", age: 65, height: `5'9"`, desc: "Manages", dd: "3" },
|
|
222
222
|
]);
|
|
223
|
-
/*
|
|
224
|
-
Testing
|
|
225
|
-
const [loading, setLoading] = useState(false);
|
|
226
|
-
|
|
227
|
-
useTimeout(() => {
|
|
228
|
-
setRowData([
|
|
229
|
-
{ id: 1000, position: "Tester", age: 30, height: `6'4"`, desc: "Tests application", dd: "1" },
|
|
230
|
-
{ id: 1001, position: "Developer", age: 12, height: `5'3"`, desc: "Develops application", dd: "2" },
|
|
231
|
-
{ id: 1002, position: "Manager", age: 65, height: `5'9"`, desc: "Manages", dd: "3" },
|
|
232
|
-
]);
|
|
233
|
-
}, 5000);
|
|
234
|
-
|
|
235
|
-
useTimeout(() => {
|
|
236
|
-
setLoading(true);
|
|
237
|
-
}, 7000);
|
|
238
|
-
|
|
239
|
-
useTimeout(() => {
|
|
240
|
-
setLoading(false);
|
|
241
|
-
}, 9000);*/
|
|
242
223
|
|
|
243
224
|
return (
|
|
244
225
|
<GridWrapper maxHeight={400}>
|