@linzjs/step-ag-grid 1.5.4 → 2.0.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/README.md +117 -2
- package/{src/components → dist}/GridTheme.scss +37 -23
- package/dist/index.css +351 -0
- package/dist/index.js +625 -332
- package/dist/index.js.map +1 -1
- package/dist/src/components/ComponentLoadingWrapper.d.ts +1 -0
- package/dist/src/components/Grid.d.ts +0 -2
- package/dist/src/components/GridCell.d.ts +21 -27
- package/dist/src/components/GridPopoverHook.d.ts +5 -2
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +10 -4
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +5 -5
- package/dist/src/components/gridForm/GridFormMessage.d.ts +4 -5
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +5 -4
- package/dist/src/components/gridForm/GridFormPopoutMenu.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +3 -3
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +3 -3
- package/dist/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.d.ts +3 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverEditBearing.d.ts +5 -270
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +3 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +3 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMessage.d.ts +3 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverTextArea.d.ts +3 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverTextInput.d.ts +3 -2
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +4 -5
- package/dist/src/contexts/GridContext.d.ts +1 -1
- package/dist/src/contexts/GridPopoverContext.d.ts +17 -0
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +6 -0
- package/dist/src/contexts/{UpdatingContext.d.ts → GridUpdatingContext.d.ts} +2 -2
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +7 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -21
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +7 -0
- package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +2 -0
- package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +5 -0
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +9 -0
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +11 -0
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +7 -0
- package/dist/src/react-menu3/contexts/SettingsContext.d.ts +20 -0
- package/dist/src/react-menu3/index.d.ts +0 -1
- package/dist/src/react-menu3/utils/constants.d.ts +1 -50
- package/dist/step-ag-grid.esm.js +622 -312
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +39 -26
- package/src/components/ComponentLoadingWrapper.tsx +2 -1
- package/src/components/Grid.tsx +3 -8
- package/src/components/GridCell.tsx +62 -79
- package/src/components/GridLoadableCell.tsx +0 -1
- package/src/components/GridPopoverHook.tsx +18 -16
- package/src/components/gridForm/GridFormDropDown.tsx +47 -32
- package/src/components/gridForm/GridFormEditBearing.tsx +14 -14
- package/src/components/gridForm/GridFormMessage.tsx +11 -17
- package/src/components/gridForm/GridFormMultiSelect.tsx +89 -79
- package/src/components/gridForm/GridFormPopoutMenu.tsx +10 -11
- package/src/components/gridForm/GridFormTextArea.tsx +16 -17
- package/src/components/gridForm/GridFormTextInput.tsx +17 -17
- package/src/components/gridPopoverEdit/GridPopoutEditMultiSelect.ts +20 -15
- package/src/components/gridPopoverEdit/GridPopoverEditBearing.ts +53 -45
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +21 -15
- package/src/components/gridPopoverEdit/GridPopoverMenu.scss +4 -4
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +21 -23
- package/src/components/gridPopoverEdit/GridPopoverMessage.ts +18 -16
- package/src/components/gridPopoverEdit/GridPopoverTextArea.ts +12 -16
- package/src/components/gridPopoverEdit/GridPopoverTextInput.ts +15 -15
- package/src/components/gridRender/GridRenderGenericCell.tsx +5 -6
- package/src/components/gridRender/GridRenderPopoutMenuCell.tsx +2 -2
- package/src/contexts/GridContext.tsx +1 -1
- package/src/contexts/GridContextProvider.tsx +3 -5
- package/src/contexts/GridPopoverContext.tsx +26 -0
- package/src/contexts/GridPopoverContextProvider.tsx +54 -0
- package/src/contexts/{UpdatingContext.tsx → GridUpdatingContext.tsx} +2 -2
- package/src/contexts/{UpdatingContextProvider.tsx → GridUpdatingContextProvider.tsx} +8 -6
- package/src/index.ts +38 -0
- package/src/lui/TextInputFormatted.scss +1 -1
- package/src/react-menu3/README.md +66 -0
- package/src/react-menu3/components/ControlledMenu.tsx +9 -17
- package/src/react-menu3/components/FocusableItem.tsx +2 -9
- package/src/react-menu3/components/MenuGroup.tsx +2 -1
- package/src/react-menu3/components/MenuItem.tsx +3 -12
- package/src/react-menu3/components/MenuList.tsx +4 -4
- package/src/react-menu3/components/MenuRadioGroup.tsx +3 -22
- package/src/react-menu3/components/SubMenu.tsx +4 -4
- package/src/react-menu3/contexts/EventHandlersContext.ts +11 -0
- package/src/react-menu3/contexts/HoverItemContext.ts +3 -0
- package/src/react-menu3/contexts/ItemSettingsContext.ts +6 -0
- package/src/react-menu3/contexts/MenuListContext.ts +10 -0
- package/src/react-menu3/contexts/MenuListItemContext.ts +16 -0
- package/src/react-menu3/contexts/RadioGroupContext.ts +8 -0
- package/src/react-menu3/contexts/SettingsContext.ts +20 -0
- package/src/react-menu3/hooks/useItemState.ts +3 -1
- package/src/react-menu3/index.ts +0 -1
- package/src/react-menu3/styles/_var.scss +4 -4
- package/src/react-menu3/styles/core.scss +6 -6
- package/src/react-menu3/styles/index.scss +10 -7
- package/src/react-menu3/styles/theme-dark.scss +4 -2
- package/src/react-menu3/styles/transitions/slide.scss +8 -8
- package/src/react-menu3/utils/constants.ts +1 -74
- package/src/react-menu3/utils/withHovering.tsx +1 -1
- package/src/stories/components/FormTest.scss +1 -2
- package/src/stories/components/FormTest.tsx +4 -3
- package/src/stories/components/GridPopoutBearing.stories.tsx +30 -26
- package/src/stories/components/GridPopoutEditDropDown.stories.tsx +94 -51
- package/src/stories/components/GridPopoutEditGeneric.stories.tsx +18 -14
- package/src/stories/components/GridPopoutEditGenericTextArea.stories.tsx +78 -62
- package/src/stories/components/GridPopoutEditMultiSelect.stories.tsx +60 -52
- package/src/stories/components/GridReadOnly.stories.tsx +77 -64
- package/src/stories/components/ReactMenu.stories.tsx +0 -4
- package/src/{components → styles}/Grid.scss +9 -6
- package/src/styles/GridFormDropDown.scss +18 -0
- package/src/{components/gridForm → styles}/GridFormEditBearing.scss +0 -0
- package/src/styles/GridFormMultiSelect.scss +18 -0
- package/src/styles/GridRenderGenericCell.scss +15 -0
- package/src/styles/GridTheme.scss +108 -0
- package/src/styles/index.scss +2 -0
- package/src/styles/lui-overrides.scss +49 -0
- package/src/styles/react-menu-customisations.scss +135 -0
- package/dist/index.d.ts +0 -38
- package/dist/src/contexts/UpdatingContextProvider.d.ts +0 -7
- package/dist/src/stories/components/FormTest.d.ts +0 -13
- package/dist/src/stories/components/GridPopoutBearing.stories.d.ts +0 -9
- package/dist/src/stories/components/GridPopoutEditDropDown.stories.d.ts +0 -9
- package/dist/src/stories/components/GridPopoutEditGeneric.stories.d.ts +0 -9
- package/dist/src/stories/components/GridPopoutEditGenericTextArea.stories.d.ts +0 -9
- package/dist/src/stories/components/GridPopoutEditMultiSelect.stories.d.ts +0 -9
- package/dist/src/stories/components/GridReadOnly.stories.d.ts +0 -9
- package/dist/src/stories/components/ReactMenu.stories.d.ts +0 -8
- package/src/components/gridRender/GridRenderGenericCell.scss +0 -15
- package/src/lui-overrides.scss +0 -163
- package/src/react-menu3/style-utils.d.ts +0 -110
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../styles/index.scss";
|
|
4
|
+
import "../../styles/GridTheme.scss";
|
|
4
5
|
|
|
5
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
6
7
|
import { useMemo, useState } from "react";
|
|
7
|
-
import {
|
|
8
|
+
import { GridUpdatingContextProvider } from "@contexts/GridUpdatingContextProvider";
|
|
8
9
|
import { GridContextProvider } from "@contexts/GridContextProvider";
|
|
9
10
|
import { Grid, GridProps } from "@components/Grid";
|
|
10
|
-
import { GridCell } from "@components/GridCell";
|
|
11
|
+
import { ColDefT, GridCell } from "@components/GridCell";
|
|
11
12
|
import {
|
|
12
13
|
GridPopoverEditBearing,
|
|
13
14
|
GridPopoverEditBearingCorrection,
|
|
@@ -24,11 +25,11 @@ export default {
|
|
|
24
25
|
decorators: [
|
|
25
26
|
(Story) => (
|
|
26
27
|
<div style={{ width: 1200, height: 400, display: "flex" }}>
|
|
27
|
-
<
|
|
28
|
+
<GridUpdatingContextProvider>
|
|
28
29
|
<GridContextProvider>
|
|
29
30
|
<Story />
|
|
30
31
|
</GridContextProvider>
|
|
31
|
-
</
|
|
32
|
+
</GridUpdatingContextProvider>
|
|
32
33
|
</div>
|
|
33
34
|
),
|
|
34
35
|
],
|
|
@@ -42,7 +43,7 @@ interface ITestRow {
|
|
|
42
43
|
|
|
43
44
|
const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) => {
|
|
44
45
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
45
|
-
const columnDefs = useMemo(
|
|
46
|
+
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
46
47
|
() => [
|
|
47
48
|
GridCell({
|
|
48
49
|
field: "id",
|
|
@@ -50,31 +51,34 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
|
|
|
50
51
|
initialWidth: 65,
|
|
51
52
|
maxWidth: 85,
|
|
52
53
|
}),
|
|
53
|
-
GridPopoverEditBearing
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
GridPopoverEditBearing(
|
|
55
|
+
{
|
|
56
|
+
field: "bearing1",
|
|
57
|
+
headerName: "Bearing GCE",
|
|
58
|
+
cellRendererParams: {
|
|
59
|
+
warning: (props: any) => props.data.id == 1002 && "Testers are testing",
|
|
60
|
+
info: (props: any) => props.data.id == 1001 && "Developers are developing",
|
|
61
|
+
},
|
|
59
62
|
},
|
|
60
|
-
|
|
63
|
+
{
|
|
61
64
|
multiEdit: false,
|
|
62
|
-
placeHolder: "Enter Bearing",
|
|
63
65
|
},
|
|
64
|
-
|
|
65
|
-
GridPopoverEditBearingCorrection
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
),
|
|
67
|
+
GridPopoverEditBearingCorrection(
|
|
68
|
+
{
|
|
69
|
+
field: "bearingCorrection",
|
|
70
|
+
headerName: "Bearing Correction",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
editorParams: {
|
|
74
|
+
onSave: async (selectedRows, value: ITestRow["bearingCorrection"]) => {
|
|
75
|
+
await wait(1000);
|
|
76
|
+
selectedRows.forEach((row) => (row["bearingCorrection"] = value));
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
75
79
|
},
|
|
76
80
|
},
|
|
77
|
-
|
|
81
|
+
),
|
|
78
82
|
],
|
|
79
83
|
[],
|
|
80
84
|
);
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../styles/index.scss";
|
|
4
|
+
import "../../styles/GridTheme.scss";
|
|
4
5
|
|
|
5
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
6
|
-
import {
|
|
7
|
+
import { GridUpdatingContextProvider } from "@contexts/GridUpdatingContextProvider";
|
|
7
8
|
import { GridContextProvider } from "@contexts/GridContextProvider";
|
|
8
9
|
import { Grid, GridProps } from "@components/Grid";
|
|
9
10
|
import { useCallback, useMemo, useState } from "react";
|
|
10
|
-
import {
|
|
11
|
-
GridFormDropDown,
|
|
12
|
-
GridFormPopoutDropDownProps,
|
|
13
|
-
MenuSeparator,
|
|
14
|
-
MenuSeparatorString,
|
|
15
|
-
} from "@components/gridForm/GridFormDropDown";
|
|
16
|
-
import { ColDef } from "ag-grid-community";
|
|
11
|
+
import { MenuHeaderItem, MenuSeparator, MenuSeparatorString } from "@components/gridForm/GridFormDropDown";
|
|
17
12
|
import { wait } from "@utils/util";
|
|
18
|
-
import { GridCell } from "@components/GridCell";
|
|
13
|
+
import { ColDefT, GridCell } from "@components/GridCell";
|
|
19
14
|
import { GridPopoverEditDropDown } from "@components/gridPopoverEdit/GridPopoverEditDropDown";
|
|
20
15
|
|
|
21
16
|
export default {
|
|
@@ -28,11 +23,11 @@ export default {
|
|
|
28
23
|
decorators: [
|
|
29
24
|
(Story) => (
|
|
30
25
|
<div style={{ width: 1200, height: 400, display: "flex" }}>
|
|
31
|
-
<
|
|
26
|
+
<GridUpdatingContextProvider>
|
|
32
27
|
<GridContextProvider>
|
|
33
28
|
<Story />
|
|
34
29
|
</GridContextProvider>
|
|
35
|
-
</
|
|
30
|
+
</GridUpdatingContextProvider>
|
|
36
31
|
</div>
|
|
37
32
|
),
|
|
38
33
|
],
|
|
@@ -80,33 +75,40 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
80
75
|
[],
|
|
81
76
|
);
|
|
82
77
|
|
|
83
|
-
const columnDefs = useMemo(
|
|
84
|
-
() =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
79
|
+
() => [
|
|
80
|
+
GridCell({
|
|
81
|
+
field: "id",
|
|
82
|
+
headerName: "Id",
|
|
83
|
+
initialWidth: 65,
|
|
84
|
+
maxWidth: 85,
|
|
85
|
+
}),
|
|
86
|
+
GridPopoverEditDropDown(
|
|
87
|
+
{
|
|
93
88
|
field: "position",
|
|
94
89
|
initialWidth: 65,
|
|
95
90
|
maxWidth: 150,
|
|
96
91
|
headerName: "Position",
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
multiEdit: false,
|
|
95
|
+
editorParams: {
|
|
96
|
+
className: "Xxx",
|
|
99
97
|
options: ["Architect", "Developer", "Product Owner", "Scrum Master", "Tester", MenuSeparator, "(other)"],
|
|
100
|
-
multiEdit: false,
|
|
101
98
|
},
|
|
102
|
-
}
|
|
103
|
-
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
GridPopoverEditDropDown(
|
|
102
|
+
{
|
|
104
103
|
field: "position2",
|
|
105
104
|
maxWidth: 100,
|
|
106
105
|
headerName: "Multi-edit",
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
multiEdit: true,
|
|
109
|
+
editorParams: {
|
|
109
110
|
options: [
|
|
111
|
+
MenuHeaderItem("Header"),
|
|
110
112
|
{
|
|
111
113
|
value: "1",
|
|
112
114
|
label: "One",
|
|
@@ -117,27 +119,36 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
117
119
|
{ value: "3", label: "Three" },
|
|
118
120
|
],
|
|
119
121
|
},
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
+
},
|
|
123
|
+
),
|
|
124
|
+
GridPopoverEditDropDown(
|
|
125
|
+
{
|
|
122
126
|
field: "position3",
|
|
123
127
|
initialWidth: 65,
|
|
124
128
|
maxWidth: 150,
|
|
125
129
|
headerName: "Custom callback",
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
multiEdit: true,
|
|
133
|
+
editorParams: {
|
|
128
134
|
options: [null, "Architect", "Developer", "Product Owner", "Scrum Master", "Tester", "(other)"],
|
|
129
135
|
onSelectedItem: async (selected) => {
|
|
130
136
|
await wait(2000);
|
|
131
137
|
selected.selectedRows.forEach((row) => (row.position3 = selected.value));
|
|
132
138
|
},
|
|
133
139
|
},
|
|
134
|
-
}
|
|
135
|
-
|
|
140
|
+
},
|
|
141
|
+
),
|
|
142
|
+
GridPopoverEditDropDown(
|
|
143
|
+
{
|
|
136
144
|
field: "position",
|
|
137
145
|
initialWidth: 65,
|
|
138
146
|
maxWidth: 150,
|
|
139
147
|
headerName: "Options Fn",
|
|
140
|
-
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
multiEdit: false,
|
|
151
|
+
editorParams: {
|
|
141
152
|
filtered: "reload",
|
|
142
153
|
filterPlaceholder: "Search me...",
|
|
143
154
|
options: optionsFn,
|
|
@@ -148,44 +159,75 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
148
159
|
// eslint-disable-next-line no-console
|
|
149
160
|
console.log("optionsRequestCancelled");
|
|
150
161
|
},
|
|
151
|
-
multiEdit: false,
|
|
152
162
|
},
|
|
153
|
-
}
|
|
154
|
-
|
|
163
|
+
},
|
|
164
|
+
),
|
|
165
|
+
GridPopoverEditDropDown(
|
|
166
|
+
{
|
|
155
167
|
field: "position3",
|
|
156
168
|
initialWidth: 65,
|
|
157
169
|
maxWidth: 150,
|
|
158
170
|
headerName: "Filtered",
|
|
159
|
-
|
|
160
|
-
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
multiEdit: true,
|
|
174
|
+
editorParams: {
|
|
161
175
|
filtered: "local",
|
|
162
176
|
filterPlaceholder: "Filter this",
|
|
163
177
|
options: [null, "Architect", "Developer", "Product Owner", "Scrum Master", "Tester", "(other)"],
|
|
164
178
|
},
|
|
165
|
-
}
|
|
166
|
-
|
|
179
|
+
},
|
|
180
|
+
),
|
|
181
|
+
GridPopoverEditDropDown(
|
|
182
|
+
{
|
|
167
183
|
field: "position4",
|
|
168
184
|
initialWidth: 65,
|
|
169
185
|
maxWidth: 150,
|
|
170
186
|
headerName: "Filtered (object)",
|
|
171
187
|
valueGetter: (params) => params.data.position4?.desc,
|
|
172
|
-
|
|
173
|
-
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
multiEdit: true,
|
|
191
|
+
editorParams: {
|
|
174
192
|
filtered: "local",
|
|
175
193
|
filterPlaceholder: "Filter this",
|
|
176
194
|
options: optionsObjects.map((o) => {
|
|
177
195
|
return { value: o, label: o.desc, disabled: false };
|
|
178
196
|
}),
|
|
179
197
|
},
|
|
180
|
-
}
|
|
181
|
-
|
|
198
|
+
},
|
|
199
|
+
),
|
|
200
|
+
GridPopoverEditDropDown(
|
|
201
|
+
{
|
|
202
|
+
field: "code",
|
|
203
|
+
initialWidth: 65,
|
|
204
|
+
maxWidth: 150,
|
|
205
|
+
headerName: "Max height",
|
|
206
|
+
valueGetter: (params) => params.data.code,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
multiEdit: true,
|
|
210
|
+
editorParams: {
|
|
211
|
+
className: "GridPopoverEditDropDown-containerSmall",
|
|
212
|
+
filtered: "local",
|
|
213
|
+
filterPlaceholder: "Filter this",
|
|
214
|
+
options: Array.from(Array(30).keys()).map((o) => {
|
|
215
|
+
return { value: o, label: `${o}` };
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
),
|
|
220
|
+
GridPopoverEditDropDown(
|
|
221
|
+
{
|
|
182
222
|
field: "code",
|
|
183
223
|
initialWidth: 65,
|
|
184
224
|
maxWidth: 150,
|
|
185
225
|
headerName: "Filter Selectable",
|
|
186
226
|
valueGetter: (params) => params.data.code,
|
|
187
|
-
|
|
188
|
-
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
multiEdit: true,
|
|
230
|
+
editorParams: {
|
|
189
231
|
filtered: "local",
|
|
190
232
|
filterPlaceholder: "Filter this",
|
|
191
233
|
options: optionsObjects.map((o) => {
|
|
@@ -198,8 +240,9 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
198
240
|
selected.selectedRows.forEach((row) => (row.code = selected.value));
|
|
199
241
|
},
|
|
200
242
|
},
|
|
201
|
-
}
|
|
202
|
-
|
|
243
|
+
},
|
|
244
|
+
),
|
|
245
|
+
],
|
|
203
246
|
[optionsFn, optionsObjects],
|
|
204
247
|
);
|
|
205
248
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../styles/index.scss";
|
|
4
|
+
import "../../styles/GridTheme.scss";
|
|
4
5
|
|
|
5
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
6
|
-
import {
|
|
7
|
+
import { GridUpdatingContextProvider } from "@contexts/GridUpdatingContextProvider";
|
|
7
8
|
import { GridContextProvider } from "@contexts/GridContextProvider";
|
|
8
9
|
import { Grid, GridProps } from "@components/Grid";
|
|
9
10
|
import { useMemo, useState } from "react";
|
|
10
|
-
import { GridCell } from "@components/GridCell";
|
|
11
|
+
import { ColDefT, GridCell } from "@components/GridCell";
|
|
11
12
|
import { FormTest, IFormTestRow } from "./FormTest";
|
|
12
13
|
|
|
13
14
|
export default {
|
|
@@ -20,11 +21,11 @@ export default {
|
|
|
20
21
|
decorators: [
|
|
21
22
|
(Story) => (
|
|
22
23
|
<div style={{ width: 1200, height: 400, display: "flex" }}>
|
|
23
|
-
<
|
|
24
|
+
<GridUpdatingContextProvider>
|
|
24
25
|
<GridContextProvider>
|
|
25
26
|
<Story />
|
|
26
27
|
</GridContextProvider>
|
|
27
|
-
</
|
|
28
|
+
</GridUpdatingContextProvider>
|
|
28
29
|
</div>
|
|
29
30
|
),
|
|
30
31
|
],
|
|
@@ -32,7 +33,7 @@ export default {
|
|
|
32
33
|
|
|
33
34
|
const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridProps) => {
|
|
34
35
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
35
|
-
const columnDefs = useMemo(
|
|
36
|
+
const columnDefs: ColDefT<IFormTestRow>[] = useMemo(
|
|
36
37
|
() => [
|
|
37
38
|
GridCell({
|
|
38
39
|
field: "id",
|
|
@@ -40,15 +41,18 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
40
41
|
initialWidth: 65,
|
|
41
42
|
maxWidth: 85,
|
|
42
43
|
}),
|
|
43
|
-
GridCell(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
form: FormTest,
|
|
49
|
-
multiEdit: false,
|
|
44
|
+
GridCell(
|
|
45
|
+
{
|
|
46
|
+
field: "name",
|
|
47
|
+
headerName: "Popout Generic Edit",
|
|
48
|
+
maxWidth: 140,
|
|
50
49
|
},
|
|
51
|
-
|
|
50
|
+
{
|
|
51
|
+
multiEdit: true,
|
|
52
|
+
editor: FormTest,
|
|
53
|
+
editorParams: {},
|
|
54
|
+
},
|
|
55
|
+
),
|
|
52
56
|
],
|
|
53
57
|
[],
|
|
54
58
|
);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
import "../../
|
|
3
|
+
import "../../styles/index.scss";
|
|
4
|
+
import "../../styles/GridTheme.scss";
|
|
4
5
|
|
|
5
6
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
6
|
-
import {
|
|
7
|
+
import { GridUpdatingContextProvider } from "@contexts/GridUpdatingContextProvider";
|
|
7
8
|
import { GridContextProvider } from "@contexts/GridContextProvider";
|
|
8
9
|
import { Grid, GridProps } from "@components/Grid";
|
|
9
10
|
import { useMemo, useState } from "react";
|
|
10
|
-
import { GridCell } from "@components/GridCell";
|
|
11
|
+
import { ColDefT, GridCell } from "@components/GridCell";
|
|
11
12
|
import { IFormTestRow } from "./FormTest";
|
|
12
13
|
import { isFloat, wait } from "@utils/util";
|
|
13
14
|
import { GridPopoverTextArea } from "@components/gridPopoverEdit/GridPopoverTextArea";
|
|
@@ -23,11 +24,11 @@ export default {
|
|
|
23
24
|
decorators: [
|
|
24
25
|
(Story) => (
|
|
25
26
|
<div style={{ width: 1200, height: 400, display: "flex" }}>
|
|
26
|
-
<
|
|
27
|
+
<GridUpdatingContextProvider>
|
|
27
28
|
<GridContextProvider>
|
|
28
29
|
<Story />
|
|
29
30
|
</GridContextProvider>
|
|
30
|
-
</
|
|
31
|
+
</GridUpdatingContextProvider>
|
|
31
32
|
</div>
|
|
32
33
|
),
|
|
33
34
|
],
|
|
@@ -35,7 +36,7 @@ export default {
|
|
|
35
36
|
|
|
36
37
|
const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridProps) => {
|
|
37
38
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
38
|
-
const columnDefs = useMemo(
|
|
39
|
+
const columnDefs: ColDefT<IFormTestRow>[] = useMemo(
|
|
39
40
|
() => [
|
|
40
41
|
GridCell({
|
|
41
42
|
field: "id",
|
|
@@ -43,70 +44,85 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
43
44
|
initialWidth: 65,
|
|
44
45
|
maxWidth: 85,
|
|
45
46
|
}),
|
|
46
|
-
GridPopoverTextInput
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
required: true,
|
|
52
|
-
maxlength: 12,
|
|
53
|
-
placeholder: "Enter some text...",
|
|
54
|
-
validate: (value: string) => {
|
|
55
|
-
if (value === "never") return "The value 'never' is not allowed";
|
|
56
|
-
return null;
|
|
57
|
-
},
|
|
58
|
-
multiEdit: false,
|
|
59
|
-
onSave: async (selectedRows, value) => {
|
|
60
|
-
await wait(1000);
|
|
61
|
-
selectedRows.forEach((selectedRow) => (selectedRow["name"] = value));
|
|
62
|
-
return true;
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
GridPopoverTextInput<IFormTestRow>({
|
|
67
|
-
field: "distance",
|
|
68
|
-
headerName: "Number input",
|
|
69
|
-
maxWidth: 140,
|
|
70
|
-
valueFormatter: (params) => {
|
|
71
|
-
const v = params.data.distance;
|
|
72
|
-
return v != null ? `${v}${params.colDef.cellEditorParams.units}` : v;
|
|
47
|
+
GridPopoverTextInput(
|
|
48
|
+
{
|
|
49
|
+
field: "name",
|
|
50
|
+
headerName: "Text input",
|
|
51
|
+
maxWidth: 140,
|
|
73
52
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
53
|
+
{
|
|
54
|
+
multiEdit: true,
|
|
55
|
+
editorParams: {
|
|
56
|
+
required: true,
|
|
57
|
+
maxlength: 12,
|
|
58
|
+
placeholder: "Enter some text...",
|
|
59
|
+
validate: (value: string) => {
|
|
60
|
+
if (value === "never") return "The value 'never' is not allowed";
|
|
61
|
+
return null;
|
|
62
|
+
},
|
|
63
|
+
onSave: async (selectedRows, value) => {
|
|
64
|
+
await wait(1000);
|
|
65
|
+
selectedRows.forEach((selectedRow) => (selectedRow["name"] = value));
|
|
66
|
+
return true;
|
|
67
|
+
},
|
|
81
68
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
},
|
|
70
|
+
),
|
|
71
|
+
GridPopoverTextInput(
|
|
72
|
+
{
|
|
73
|
+
field: "distance",
|
|
74
|
+
headerName: "Number input",
|
|
75
|
+
maxWidth: 140,
|
|
76
|
+
valueFormatter: (params) => {
|
|
77
|
+
const v = params.data.distance;
|
|
78
|
+
return v != null ? `${v}${params.colDef.cellEditorParams.units}` : v;
|
|
87
79
|
},
|
|
88
80
|
},
|
|
89
|
-
|
|
90
|
-
GridPopoverTextArea<IFormTestRow>({
|
|
91
|
-
field: "plan",
|
|
92
|
-
headerName: "Text area",
|
|
93
|
-
maxWidth: 140,
|
|
94
|
-
cellEditorParams: {
|
|
95
|
-
required: true,
|
|
96
|
-
maxlength: 32,
|
|
97
|
-
placeholder: "Enter some text...",
|
|
81
|
+
{
|
|
98
82
|
multiEdit: true,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
83
|
+
editorParams: {
|
|
84
|
+
maxlength: 12,
|
|
85
|
+
placeholder: "Enter distance...",
|
|
86
|
+
units: "m",
|
|
87
|
+
validate: (value: string) => {
|
|
88
|
+
if (value.length && !isFloat(value)) return "Value must be a number";
|
|
89
|
+
return null;
|
|
90
|
+
},
|
|
91
|
+
onSave: async (selectedRows, value) => {
|
|
92
|
+
await wait(1000);
|
|
93
|
+
selectedRows.forEach(
|
|
94
|
+
(selectedRow) => (selectedRow["distance"] = value.length ? parseFloat(value) : null),
|
|
95
|
+
);
|
|
96
|
+
return true;
|
|
97
|
+
},
|
|
102
98
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
GridPopoverTextArea(
|
|
102
|
+
{
|
|
103
|
+
field: "plan",
|
|
104
|
+
headerName: "Text area",
|
|
105
|
+
maxWidth: 140,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
multiEdit: true,
|
|
109
|
+
editorParams: {
|
|
110
|
+
required: true,
|
|
111
|
+
maxlength: 32,
|
|
112
|
+
placeholder: "Enter some text...",
|
|
113
|
+
|
|
114
|
+
validate: (value: string) => {
|
|
115
|
+
if (value === "never") return "The value 'never' is not allowed";
|
|
116
|
+
return null;
|
|
117
|
+
},
|
|
118
|
+
onSave: async (selectedRows, value) => {
|
|
119
|
+
await wait(1000);
|
|
120
|
+
selectedRows.forEach((selectedRow) => (selectedRow["plan"] = value));
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
107
123
|
},
|
|
108
124
|
},
|
|
109
|
-
|
|
125
|
+
),
|
|
110
126
|
],
|
|
111
127
|
[],
|
|
112
128
|
);
|