@linzjs/step-ag-grid 18.0.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/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": "18.0.0",
5
+ "version": "18.1.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -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>
@@ -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}>
@@ -89,3 +89,12 @@
89
89
  max-width: 400px;
90
90
  }
91
91
 
92
+ .ag-floating-top-container .ag-row {
93
+ background-color: colors.$hint;
94
+ }
95
+
96
+ .ag-floating-bottom-container .ag-row {
97
+ background-color: colors.$hint;
98
+ }
99
+
100
+