@linzjs/step-ag-grid 17.10.0 → 17.12.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/GridTheme.scss +66 -23
- package/dist/src/components/Grid.d.ts +1 -0
- package/dist/step-ag-grid.cjs.js +1 -1
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +1 -1
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +2 -0
- package/src/stories/grid/GridViewList.stories.tsx +124 -0
- package/src/styles/GridTheme.scss +66 -23
package/package.json
CHANGED
package/src/components/Grid.tsx
CHANGED
|
@@ -103,6 +103,7 @@ export interface GridProps {
|
|
|
103
103
|
singleClickEdit?: boolean;
|
|
104
104
|
|
|
105
105
|
loading?: boolean;
|
|
106
|
+
suppressCellFocus?: boolean;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
/**
|
|
@@ -734,6 +735,7 @@ export const Grid = ({
|
|
|
734
735
|
onRowDragMove={onRowDragMove}
|
|
735
736
|
onRowDragEnd={onRowDragEnd}
|
|
736
737
|
onRowDragLeave={onRowDragLeave}
|
|
738
|
+
suppressCellFocus={params.suppressCellFocus}
|
|
737
739
|
/>
|
|
738
740
|
</div>
|
|
739
741
|
</div>
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: "Components / Grids",
|
|
22
|
+
component: Grid,
|
|
23
|
+
// Storybook hangs otherwise
|
|
24
|
+
parameters: {
|
|
25
|
+
docs: {
|
|
26
|
+
source: {
|
|
27
|
+
type: "code",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
decorators: [
|
|
32
|
+
(Story) => (
|
|
33
|
+
<div style={{ maxWidth: 1024, height: 400, display: "flex", flexDirection: "column" }}>
|
|
34
|
+
<GridUpdatingContextProvider>
|
|
35
|
+
<GridContextProvider>
|
|
36
|
+
<Story />
|
|
37
|
+
</GridContextProvider>
|
|
38
|
+
</GridUpdatingContextProvider>
|
|
39
|
+
</div>
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
} as Meta<typeof Grid>;
|
|
43
|
+
|
|
44
|
+
interface ITestRow {
|
|
45
|
+
id: number;
|
|
46
|
+
position: string;
|
|
47
|
+
age: number;
|
|
48
|
+
height: string;
|
|
49
|
+
desc: string;
|
|
50
|
+
dd: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
54
|
+
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
55
|
+
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
56
|
+
() => [
|
|
57
|
+
GridCell({
|
|
58
|
+
field: "id",
|
|
59
|
+
headerName: "Id",
|
|
60
|
+
lockVisible: true,
|
|
61
|
+
resizable: false,
|
|
62
|
+
lockPosition: "left",
|
|
63
|
+
cellRenderer: (props) => {
|
|
64
|
+
return <a href={"#"}>{props.value}</a>;
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
GridCell({
|
|
68
|
+
field: "position",
|
|
69
|
+
headerName: "Position",
|
|
70
|
+
resizable: false,
|
|
71
|
+
lockPosition: "left",
|
|
72
|
+
cellRendererParams: {
|
|
73
|
+
warning: (props) => props.value === "Tester" && "Testers are testing",
|
|
74
|
+
info: (props) => props.value === "Developer" && "Developers are awesome",
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
GridCell({
|
|
78
|
+
field: "desc",
|
|
79
|
+
headerName: "Description",
|
|
80
|
+
resizable: false,
|
|
81
|
+
lockPosition: "left",
|
|
82
|
+
}),
|
|
83
|
+
GridCell({
|
|
84
|
+
field: "age",
|
|
85
|
+
headerName: "Age",
|
|
86
|
+
resizable: false,
|
|
87
|
+
lockPosition: "left",
|
|
88
|
+
}),
|
|
89
|
+
GridCell({
|
|
90
|
+
field: "height",
|
|
91
|
+
headerName: "Height",
|
|
92
|
+
resizable: false,
|
|
93
|
+
lockPosition: "left",
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
[],
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const [rowData] = useState<ITestRow[]>([
|
|
100
|
+
{ id: 1000, position: "Tester", age: 30, height: `6'4"`, desc: "Tests application", dd: "1" },
|
|
101
|
+
{ id: 1001, position: "Developer", age: 12, height: `5'3"`, desc: "Develops application", dd: "2" },
|
|
102
|
+
{ id: 1002, position: "Manager", age: 65, height: `5'9"`, desc: "Manages", dd: "3" },
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<GridWrapper maxHeight={400}>
|
|
107
|
+
<Grid
|
|
108
|
+
data-testid={"readonly"}
|
|
109
|
+
{...props}
|
|
110
|
+
selectable={false}
|
|
111
|
+
rowSelection={"single"}
|
|
112
|
+
externalSelectedItems={externalSelectedItems}
|
|
113
|
+
setExternalSelectedItems={setExternalSelectedItems}
|
|
114
|
+
columnDefs={columnDefs}
|
|
115
|
+
rowData={rowData}
|
|
116
|
+
sizeColumns={"fit"}
|
|
117
|
+
theme={"ag-theme-step-view-list-default"}
|
|
118
|
+
contextMenuSelectRow={false}
|
|
119
|
+
suppressCellFocus={true}
|
|
120
|
+
/>
|
|
121
|
+
</GridWrapper>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
export const ListViewGrid = GridReadOnlyTemplate.bind({});
|
|
@@ -20,6 +20,14 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
20
20
|
header-height: 40px,
|
|
21
21
|
font-size: calc($grid-base-font-size),
|
|
22
22
|
),
|
|
23
|
+
'step-view-list-default.theme-specific': (
|
|
24
|
+
extend-theme: alpine,
|
|
25
|
+
row-height: 60px,
|
|
26
|
+
header-height: 40px,
|
|
27
|
+
font-size: calc($grid-base-font-size),
|
|
28
|
+
header-background-color: lui.$iceberg,
|
|
29
|
+
cell-horizontal-border: none,
|
|
30
|
+
),
|
|
23
31
|
),
|
|
24
32
|
|
|
25
33
|
input-focus-border-color: lui.$sea,
|
|
@@ -52,28 +60,12 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
52
60
|
|
|
53
61
|
.ag-theme-step-default.theme-specific,
|
|
54
62
|
.ag-theme-step-compact.theme-specific {
|
|
55
|
-
.ag-text-area-input:focus {
|
|
56
|
-
border-color: lui.$sea;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ag-cell[col-id="selection"] {
|
|
60
|
-
display: flex; // Fix that when you click below checkbox it doesn't process a click
|
|
61
|
-
}
|
|
62
63
|
|
|
63
64
|
// fix alignment of cell content when grabber is present
|
|
64
65
|
.ag-header-cell-comp-wrapper {
|
|
65
66
|
justify-content: end;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
// Fix that when you click below checkbox it doesn't process a click
|
|
69
|
-
.ag-cell-wrapper > *:not(.ag-cell-value, .ag-group-value) {
|
|
70
|
-
height: auto;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.ag-row:last-of-type {
|
|
74
|
-
border-bottom: 1px solid lui.$dew;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
69
|
.ag-header-cell {
|
|
78
70
|
font-size: 14px;
|
|
79
71
|
font-weight: 600;
|
|
@@ -86,6 +78,28 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
80
|
|
|
81
|
+
.ag-header .ag-header-cell[aria-colindex="1"] {
|
|
82
|
+
padding-left: 17px;
|
|
83
|
+
padding-right: 15px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ag-text-area-input:focus {
|
|
87
|
+
border-color: lui.$sea;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ag-cell[col-id="selection"] {
|
|
91
|
+
display: flex; // Fix that when you click below checkbox it doesn't process a click
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Fix that when you click below checkbox it doesn't process a click
|
|
95
|
+
.ag-cell-wrapper > *:not(.ag-cell-value, .ag-group-value) {
|
|
96
|
+
height: auto;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ag-row:last-of-type {
|
|
100
|
+
border-bottom: 1px solid lui.$dew;
|
|
101
|
+
}
|
|
102
|
+
|
|
89
103
|
.ag-cell-label-container {
|
|
90
104
|
padding: 8px 0;
|
|
91
105
|
|
|
@@ -93,10 +107,6 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
93
107
|
height: fit-content;
|
|
94
108
|
}
|
|
95
109
|
|
|
96
|
-
.ag-header .ag-header-cell[aria-colindex="1"] {
|
|
97
|
-
padding-left: 17px;
|
|
98
|
-
padding-right: 15px;
|
|
99
|
-
}
|
|
100
110
|
|
|
101
111
|
.ag-cell[aria-colindex="1"] {
|
|
102
112
|
padding-left: lui.$unit-rg;
|
|
@@ -200,14 +210,14 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
200
210
|
height: 2px;
|
|
201
211
|
background-color: transparent;
|
|
202
212
|
}
|
|
203
|
-
|
|
213
|
+
|
|
204
214
|
.ag-row-highlight-above::after {
|
|
205
215
|
top:-3px; // moves the top highlight to the position of the bottom highlight
|
|
206
216
|
border-top: 2px dashed lui.$andrea;
|
|
207
217
|
}
|
|
208
218
|
|
|
209
219
|
.ag-row-highlight-above:first-of-type::after {
|
|
210
|
-
top:
|
|
220
|
+
top:0; // the first row highlight needs to in the normal position otherwise it is cut off by the top of the table
|
|
211
221
|
}
|
|
212
222
|
|
|
213
223
|
.ag-row-highlight-below::after {
|
|
@@ -225,7 +235,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
225
235
|
// box-shadow: -4px 0px 15px -4px rgba(0, 0, 0, 0.1);
|
|
226
236
|
// right: -4px;
|
|
227
237
|
// }
|
|
228
|
-
|
|
238
|
+
|
|
229
239
|
// div:after {
|
|
230
240
|
// box-shadow: 15px 0 15px -15px inset;
|
|
231
241
|
// right: -15px;
|
|
@@ -249,3 +259,36 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
249
259
|
clip-path: polygon(-20% 0%, 100% 0%, 100% 100%, -20% 100%);
|
|
250
260
|
}
|
|
251
261
|
}
|
|
262
|
+
|
|
263
|
+
.ag-theme-step-view-list-default.theme-specific {
|
|
264
|
+
|
|
265
|
+
.ag-header-cell {
|
|
266
|
+
font-size: 14px;
|
|
267
|
+
font-weight: 600;
|
|
268
|
+
|
|
269
|
+
// fix: Display descender line
|
|
270
|
+
padding: 0 12px;
|
|
271
|
+
|
|
272
|
+
.LuiIcon {
|
|
273
|
+
fill: lui.$surfie;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.ag-header .ag-header-cell[aria-colindex="1"] {
|
|
278
|
+
padding-left: 32px;
|
|
279
|
+
padding-right: 12px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.ag-header-group-cell {
|
|
283
|
+
font-weight: normal;
|
|
284
|
+
font-size: 22px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.ag-header-cell {
|
|
288
|
+
font-size: 14px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.ag-row .ag-cell[aria-colindex="1"] {
|
|
292
|
+
padding-left: 32px;
|
|
293
|
+
}
|
|
294
|
+
}
|