@linzjs/step-ag-grid 8.0.0 → 8.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 +4 -0
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -0
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +3 -4
- package/dist/src/components/gridPopoverEdit/GridPopoverMenu.d.ts +2 -2
- package/dist/src/lui/ActionButton.d.ts +2 -1
- package/dist/step-ag-grid.esm.js +69 -52
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +86 -71
- package/src/components/gridForm/GridFormPopoverMenu.tsx +53 -46
- package/src/components/gridPopoverEdit/GridPopoverMenu.tsx +3 -3
- package/src/lui/ActionButton.tsx +3 -1
- package/src/react-menu3/styles/index.scss +4 -0
- package/src/stories/components/ActionButton.stories.tsx +11 -0
- package/src/stories/grid/gridForm/GridFormDropDown.stories.tsx +85 -36
- package/src/stories/grid/gridForm/GridFormEditBearing.stories.tsx +1 -3
- package/src/stories/grid/gridForm/GridFormEditBearingCorrection.stories.tsx +1 -3
- package/src/stories/grid/gridForm/GridFormMessage.stories.tsx +32 -0
- package/src/stories/grid/gridForm/GridFormPopoverMenu.stories.tsx +55 -0
- package/src/stories/grid/gridForm/reactMenuTest.scss +0 -3
package/package.json
CHANGED
|
@@ -45,8 +45,9 @@ export interface GridFormPopoutDropDownProps<RowType extends GridBaseRow> extend
|
|
|
45
45
|
| "GridPopoverEditDropDown-containerUnlimited"
|
|
46
46
|
| string
|
|
47
47
|
| undefined;
|
|
48
|
-
// local means the
|
|
48
|
+
// local means the use the local filter, otherwise it's expected options will be passed a function that takes a filter
|
|
49
49
|
filtered?: "local" | "reload";
|
|
50
|
+
filterDefaultValue?: string;
|
|
50
51
|
filterPlaceholder?: string;
|
|
51
52
|
filterHelpText?: string;
|
|
52
53
|
noOptionsMessage?: string;
|
|
@@ -66,7 +67,7 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
66
67
|
const { selectedRows, field, data } = useGridPopoverContext<RowType>();
|
|
67
68
|
|
|
68
69
|
// Save triggers during async action processing which triggers another selectItem(), this ref blocks that
|
|
69
|
-
const [filter, setFilter] = useState("");
|
|
70
|
+
const [filter, setFilter] = useState(props.filterDefaultValue ?? "");
|
|
70
71
|
const [filteredValues, setFilteredValues] = useState<any[]>();
|
|
71
72
|
const [options, setOptions] = useState<FinalSelectOption[] | null>(null);
|
|
72
73
|
const subComponentIsValid = useRef(false);
|
|
@@ -143,7 +144,7 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
143
144
|
}
|
|
144
145
|
}, [props.filtered, filter, options]);
|
|
145
146
|
|
|
146
|
-
const
|
|
147
|
+
const reSearchOnFilterChange = useMemo(
|
|
147
148
|
() =>
|
|
148
149
|
debounce(() => {
|
|
149
150
|
setOptions(null);
|
|
@@ -157,9 +158,9 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
157
158
|
useEffect(() => {
|
|
158
159
|
if (previousFilter.current != filter && props.filtered == "reload") {
|
|
159
160
|
previousFilter.current = filter;
|
|
160
|
-
|
|
161
|
+
reSearchOnFilterChange().then();
|
|
161
162
|
}
|
|
162
|
-
}, [filter, props,
|
|
163
|
+
}, [filter, props, reSearchOnFilterChange]);
|
|
163
164
|
|
|
164
165
|
/**
|
|
165
166
|
* Saves are wrapped in updateValue and triggered by blur events
|
|
@@ -193,6 +194,9 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
193
194
|
save,
|
|
194
195
|
});
|
|
195
196
|
|
|
197
|
+
let lastHeader: JSX.Element | null = null;
|
|
198
|
+
let showHeader: JSX.Element | null = null;
|
|
199
|
+
|
|
196
200
|
return popoverWrapper(
|
|
197
201
|
<>
|
|
198
202
|
{props.filtered && (
|
|
@@ -237,76 +241,87 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormPop
|
|
|
237
241
|
{props.noOptionsMessage ?? "No Options"}
|
|
238
242
|
</MenuItem>
|
|
239
243
|
)}
|
|
240
|
-
{options?.map((item: FinalSelectOption, index) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
{options?.map((item: FinalSelectOption, index) => {
|
|
245
|
+
showHeader = null;
|
|
246
|
+
if (item.value === MenuSeparatorString) {
|
|
247
|
+
return <MenuDivider key={`$$divider_${index}`} />;
|
|
248
|
+
} else if (item.value === MenuHeaderString) {
|
|
249
|
+
lastHeader = <MenuHeader key={`$$header_${index}`}>{item.label}</MenuHeader>;
|
|
250
|
+
return <></>;
|
|
251
|
+
} else {
|
|
252
|
+
if (lastHeader) {
|
|
253
|
+
showHeader = lastHeader;
|
|
254
|
+
lastHeader = null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return (
|
|
246
258
|
(!filteredValues || filteredValues.includes(item)) && (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
<>
|
|
260
|
+
{showHeader}
|
|
261
|
+
<div key={`menu-wrapper-${index}`}>
|
|
262
|
+
<MenuItem
|
|
263
|
+
key={`${fieldToString(field)}-${index}`}
|
|
264
|
+
disabled={!!item.disabled}
|
|
265
|
+
title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
|
|
266
|
+
value={item.value}
|
|
267
|
+
onFocus={() => {
|
|
256
268
|
setSelectedItem(item);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
if (item.subComponent) {
|
|
270
|
+
setSelectedItem(item);
|
|
271
|
+
subComponentIsValid.current = true;
|
|
272
|
+
subComponentInitialValue.current = null;
|
|
273
|
+
} else {
|
|
274
|
+
setSubSelectedValue(null);
|
|
275
|
+
subComponentIsValid.current = true;
|
|
276
|
+
}
|
|
277
|
+
}}
|
|
278
|
+
onClick={(e: ClickEvent) => {
|
|
279
|
+
if (item.subComponent) {
|
|
280
|
+
e.keepOpen = true;
|
|
281
|
+
}
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
{item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
|
|
285
|
+
{item.subComponent ? "..." : ""}
|
|
286
|
+
</MenuItem>
|
|
273
287
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
{item.subComponent && selectedItem === item && (
|
|
289
|
+
<FocusableItem className={"LuiDeprecatedForms"} key={`${item.label}_subcomponent`}>
|
|
290
|
+
{(ref: MenuInstance) => (
|
|
291
|
+
<GridSubComponentContext.Provider
|
|
292
|
+
value={{
|
|
293
|
+
context: { options },
|
|
294
|
+
data,
|
|
295
|
+
value: subSelectedValue,
|
|
296
|
+
setValue: (value: any) => {
|
|
297
|
+
setSubSelectedValue(value);
|
|
298
|
+
if (subComponentInitialValue.current === null) {
|
|
299
|
+
// copy the default value of the subcomponent so we can change detect on save
|
|
300
|
+
subComponentInitialValue.current = JSON.stringify(value);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
setValid: (valid: boolean) => {
|
|
304
|
+
subComponentIsValid.current = valid;
|
|
305
|
+
},
|
|
306
|
+
triggerSave: async () => {
|
|
307
|
+
ref.closeMenu();
|
|
308
|
+
},
|
|
309
|
+
}}
|
|
310
|
+
>
|
|
311
|
+
{item.subComponent && (
|
|
312
|
+
<div className={"subComponent"}>
|
|
313
|
+
<item.subComponent key={`${fieldToString(field)}-${index}_subcomponent_inner`} />
|
|
314
|
+
</div>
|
|
315
|
+
)}
|
|
316
|
+
</GridSubComponentContext.Provider>
|
|
317
|
+
)}
|
|
318
|
+
</FocusableItem>
|
|
319
|
+
)}
|
|
320
|
+
</div>
|
|
321
|
+
</>
|
|
307
322
|
)
|
|
308
|
-
)
|
|
309
|
-
)}
|
|
323
|
+
);
|
|
324
|
+
})}
|
|
310
325
|
</>
|
|
311
326
|
</ComponentLoadingWrapper>
|
|
312
327
|
</>,
|
|
@@ -8,13 +8,14 @@ import { GridSubComponentContext } from "../../contexts/GridSubComponentContext"
|
|
|
8
8
|
import { ClickEvent } from "../../react-menu3/types";
|
|
9
9
|
import { useGridPopoverContext } from "../../contexts/GridPopoverContext";
|
|
10
10
|
|
|
11
|
-
export interface
|
|
11
|
+
export interface GridFormPopoverMenuProps<RowType extends GridBaseRow> extends CellEditorCommon {
|
|
12
12
|
options: (selectedRows: RowType[]) => Promise<MenuOption<RowType>[]>;
|
|
13
13
|
defaultAction?: (props: { selectedRows: RowType[]; menuOption: SelectedMenuOptionResult<RowType> }) => Promise<void>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/** Menu configuration types **/
|
|
17
|
-
|
|
17
|
+
const __isMenuSeparator__ = "__isMenuSeparator__";
|
|
18
|
+
export const PopoutMenuSeparator = Object.freeze({ label: __isMenuSeparator__ });
|
|
18
19
|
|
|
19
20
|
interface MenuSeparatorType {
|
|
20
21
|
__isMenuSeparator__: boolean;
|
|
@@ -36,7 +37,7 @@ export interface MenuOption<RowType extends GridBaseRow> {
|
|
|
36
37
|
* NOTE: If the popout menu doesn't appear on single click when also selecting row it's because
|
|
37
38
|
* you need a useMemo around your columnDefs
|
|
38
39
|
*/
|
|
39
|
-
export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props:
|
|
40
|
+
export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridFormPopoverMenuProps<RowType>) => {
|
|
40
41
|
const { selectedRows, updateValue, data } = useGridPopoverContext<RowType>();
|
|
41
42
|
|
|
42
43
|
const optionsInitialising = useRef(false);
|
|
@@ -119,49 +120,55 @@ export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridForm
|
|
|
119
120
|
return popoverWrapper(
|
|
120
121
|
<ComponentLoadingWrapper loading={!options} className={"GridFormPopupMenu"}>
|
|
121
122
|
<>
|
|
122
|
-
{options?.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
123
|
+
{options?.length === 0 ? (
|
|
124
|
+
<MenuItem key={`GridPopoverMenu-empty`} className={"GridPopoverMenu-noOptions"} disabled={true}>
|
|
125
|
+
No actions
|
|
126
|
+
</MenuItem>
|
|
127
|
+
) : (
|
|
128
|
+
options?.map((item, index) =>
|
|
129
|
+
item.label === "__isMenuSeparator__" ? (
|
|
130
|
+
<MenuDivider key={`$$divider_${index}`} />
|
|
131
|
+
) : (
|
|
132
|
+
!item.hidden && (
|
|
133
|
+
<Fragment key={`${item.label}`}>
|
|
134
|
+
<MenuItem
|
|
135
|
+
key={`${item.label}`}
|
|
136
|
+
onClick={(e: ClickEvent) => onMenuItemClick(e, item)}
|
|
137
|
+
disabled={!!item.disabled}
|
|
138
|
+
title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
|
|
139
|
+
>
|
|
140
|
+
{item.label as JSX.Element | string}
|
|
141
|
+
</MenuItem>
|
|
142
|
+
{item.subComponent && subComponentSelected === item && (
|
|
143
|
+
<FocusableItem className={"LuiDeprecatedForms"} key={`${item.label}_subcomponent`}>
|
|
144
|
+
{(_: any) =>
|
|
145
|
+
item.subComponent && (
|
|
146
|
+
<GridSubComponentContext.Provider
|
|
147
|
+
value={{
|
|
148
|
+
context: {},
|
|
149
|
+
data,
|
|
150
|
+
value: subSelectedValue,
|
|
151
|
+
setValue: (value: any) => {
|
|
152
|
+
setSubSelectedValue(value);
|
|
153
|
+
},
|
|
154
|
+
setValid: (valid: boolean) => {
|
|
155
|
+
subComponentIsValid.current = valid;
|
|
156
|
+
},
|
|
157
|
+
triggerSave,
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<div className={"subComponent"}>
|
|
161
|
+
<item.subComponent />
|
|
162
|
+
</div>
|
|
163
|
+
</GridSubComponentContext.Provider>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
</FocusableItem>
|
|
167
|
+
)}
|
|
168
|
+
</Fragment>
|
|
169
|
+
)
|
|
170
|
+
),
|
|
171
|
+
)
|
|
165
172
|
)}
|
|
166
173
|
</>
|
|
167
174
|
</ComponentLoadingWrapper>,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridBaseRow } from "../Grid";
|
|
2
2
|
import { ColDefT, GenericCellEditorProps, GridCell } from "../GridCell";
|
|
3
|
-
import { GridFormPopoverMenu,
|
|
3
|
+
import { GridFormPopoverMenu, GridFormPopoverMenuProps } from "../gridForm/GridFormPopoverMenu";
|
|
4
4
|
import { GridRenderPopoutMenuCell } from "../gridRender/GridRenderPopoutMenuCell";
|
|
5
5
|
import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
6
6
|
|
|
@@ -9,9 +9,9 @@ import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
|
9
9
|
*/
|
|
10
10
|
export const GridPopoverMenu = <RowType extends GridBaseRow>(
|
|
11
11
|
colDef: GenericCellColDef<RowType>,
|
|
12
|
-
custom: GenericCellEditorProps<
|
|
12
|
+
custom: GenericCellEditorProps<GridFormPopoverMenuProps<RowType>>,
|
|
13
13
|
): ColDefT<RowType> =>
|
|
14
|
-
GridCell<RowType,
|
|
14
|
+
GridCell<RowType, GridFormPopoverMenuProps<RowType>>(
|
|
15
15
|
{
|
|
16
16
|
minWidth: 40,
|
|
17
17
|
maxWidth: 40,
|
package/src/lui/ActionButton.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export interface ActionButtonProps {
|
|
|
21
21
|
onClick: () => Promise<void> | void;
|
|
22
22
|
level?: LuiButtonProps["level"];
|
|
23
23
|
style?: CSSProperties;
|
|
24
|
+
disabled?: boolean;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Kept this less than one second, so I don't have issues with waitFor as it defaults to 1s
|
|
@@ -30,6 +31,7 @@ export const ActionButton = ({
|
|
|
30
31
|
icon,
|
|
31
32
|
name,
|
|
32
33
|
inProgressName,
|
|
34
|
+
disabled,
|
|
33
35
|
dataTestId,
|
|
34
36
|
style,
|
|
35
37
|
className,
|
|
@@ -83,7 +85,7 @@ export const ActionButton = ({
|
|
|
83
85
|
setInProgress(false);
|
|
84
86
|
}
|
|
85
87
|
}}
|
|
86
|
-
disabled={localInProgress}
|
|
88
|
+
disabled={localInProgress || disabled}
|
|
87
89
|
>
|
|
88
90
|
{iconPosition === "right" && buttonText}
|
|
89
91
|
{localInProgress ? (
|
|
@@ -39,6 +39,17 @@ const ActionButtonTemplate: ComponentStory<typeof ActionButton> = () => {
|
|
|
39
39
|
className={"ActionButton-fill"}
|
|
40
40
|
style={{ maxWidth: 160 }}
|
|
41
41
|
/>
|
|
42
|
+
<br />
|
|
43
|
+
<ActionButton
|
|
44
|
+
icon={"ic_arrow_forward_right"}
|
|
45
|
+
name={"Disabled"}
|
|
46
|
+
onClick={performAction}
|
|
47
|
+
iconPosition={"right"}
|
|
48
|
+
level={"secondary"}
|
|
49
|
+
className={"ActionButton-fill"}
|
|
50
|
+
style={{ maxWidth: 160 }}
|
|
51
|
+
disabled={true}
|
|
52
|
+
/>
|
|
42
53
|
</>
|
|
43
54
|
);
|
|
44
55
|
};
|
|
@@ -1,60 +1,109 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
// Force react-menu not to render static inline not absolute
|
|
4
|
-
import "./reactMenuTest.scss";
|
|
5
3
|
|
|
6
4
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
7
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
GridFormDropDown,
|
|
7
|
+
GridFormPopoutDropDownProps,
|
|
8
|
+
MenuHeaderItem,
|
|
9
|
+
} from "../../../components/gridForm/GridFormDropDown";
|
|
8
10
|
import { GridContextProvider } from "../../../contexts/GridContextProvider";
|
|
9
11
|
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
10
12
|
import { useRef } from "react";
|
|
13
|
+
import { GridBaseRow } from "../../../components/Grid";
|
|
11
14
|
|
|
12
15
|
export default {
|
|
13
|
-
title: "GridForm /
|
|
16
|
+
title: "GridForm / Testing",
|
|
14
17
|
component: GridFormDropDown,
|
|
15
18
|
args: {},
|
|
16
19
|
} as ComponentMeta<typeof GridFormDropDown>;
|
|
17
20
|
|
|
18
21
|
const Template: ComponentStory<typeof GridFormDropDown> = (props) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const configs: [string, GridFormPopoutDropDownProps<GridBaseRow>, string?][] = [
|
|
23
|
+
["No options", { options: [] }],
|
|
24
|
+
["Custom no options", { options: [], noOptionsMessage: "Custom no options" }],
|
|
25
|
+
[
|
|
26
|
+
"Enabled and disabled",
|
|
27
|
+
{
|
|
28
|
+
options: [
|
|
29
|
+
{ label: "Enabled", value: 1 },
|
|
30
|
+
{ label: "Disabled", value: 0, disabled: true },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
"Headers",
|
|
36
|
+
{
|
|
37
|
+
options: [
|
|
38
|
+
MenuHeaderItem("Header 1"),
|
|
39
|
+
{ label: "Option 1", value: 1 },
|
|
40
|
+
MenuHeaderItem("Header 2"),
|
|
41
|
+
{ label: "Option 2", value: 2 },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
"Filter",
|
|
47
|
+
{
|
|
48
|
+
filtered: "local",
|
|
49
|
+
options: [
|
|
50
|
+
MenuHeaderItem("Header 1"),
|
|
51
|
+
{ label: "Option 1", value: 1 },
|
|
52
|
+
MenuHeaderItem("Header 2"),
|
|
53
|
+
{ label: "Option 2", value: 2 },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
"Filter custom placeholder",
|
|
59
|
+
{
|
|
60
|
+
filtered: "local",
|
|
61
|
+
filterPlaceholder: "Custom placeholder",
|
|
62
|
+
filterHelpText: "Filter help text",
|
|
63
|
+
options: [MenuHeaderItem("Header 1"), { label: "Option 1", value: 1 }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"Filter help text and default filter text",
|
|
68
|
+
{
|
|
69
|
+
filtered: "local",
|
|
70
|
+
filterHelpText: "Filter help text",
|
|
71
|
+
filterDefaultValue: "filter",
|
|
72
|
+
options: [
|
|
73
|
+
MenuHeaderItem("Header 1"),
|
|
74
|
+
{ label: "Filter match", value: 1 },
|
|
75
|
+
MenuHeaderItem("ERROR! this header should not be visible"),
|
|
76
|
+
{ label: "ERROR! this option should not be visible", value: 2 },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
];
|
|
81
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
82
|
+
const anchorRefs = configs.map(() => useRef<HTMLHeadingElement>(null));
|
|
22
83
|
|
|
23
84
|
return (
|
|
24
85
|
<div className={"react-menu-inline-test"}>
|
|
25
86
|
<GridContextProvider>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<GridPopoverContext.Provider value={{ anchorRef: anchorRef3 } as any as GridPopoverContextType<any>}>
|
|
44
|
-
<GridFormDropDown
|
|
45
|
-
{...props}
|
|
46
|
-
options={[
|
|
47
|
-
MenuHeaderItem("Header 1"),
|
|
48
|
-
{ label: "Option 1", value: 1 },
|
|
49
|
-
MenuHeaderItem("Header 2"),
|
|
50
|
-
{ label: "Option 2", value: 2 },
|
|
51
|
-
]}
|
|
52
|
-
/>
|
|
53
|
-
</GridPopoverContext.Provider>
|
|
87
|
+
{configs.map((config, index) => (
|
|
88
|
+
<div key={`${index}`}>
|
|
89
|
+
<h6 ref={anchorRefs[index]}>{config[0]}</h6>
|
|
90
|
+
<GridPopoverContext.Provider
|
|
91
|
+
value={
|
|
92
|
+
{
|
|
93
|
+
anchorRef: anchorRefs[index],
|
|
94
|
+
data: { value: config[2] },
|
|
95
|
+
value: config[2],
|
|
96
|
+
field: "value",
|
|
97
|
+
} as any as GridPopoverContextType<any>
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
<GridFormDropDown {...props} {...config[1]} />
|
|
101
|
+
</GridPopoverContext.Provider>
|
|
102
|
+
</div>
|
|
103
|
+
))}
|
|
54
104
|
</GridContextProvider>
|
|
55
105
|
</div>
|
|
56
106
|
);
|
|
57
107
|
};
|
|
58
108
|
|
|
59
109
|
export const GridFormDropDown_ = Template.bind({});
|
|
60
|
-
GridFormDropDown_.args = { options: [] };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
// Force react-menu not to render static inline not absolute
|
|
4
|
-
import "./reactMenuTest.scss";
|
|
5
3
|
|
|
6
4
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
7
5
|
import { GridFormEditBearing } from "../../../components/gridForm/GridFormEditBearing";
|
|
@@ -11,7 +9,7 @@ import { useRef } from "react";
|
|
|
11
9
|
import { GridPopoverEditBearingEditorParams } from "../../../components/gridPopoverEdit/GridPopoverEditBearing";
|
|
12
10
|
|
|
13
11
|
export default {
|
|
14
|
-
title: "GridForm /
|
|
12
|
+
title: "GridForm / Testing",
|
|
15
13
|
component: GridFormEditBearing,
|
|
16
14
|
args: {},
|
|
17
15
|
} as ComponentMeta<typeof GridFormEditBearing>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
2
|
import "@linzjs/lui/dist/fonts";
|
|
3
|
-
// Force react-menu not to render static inline not absolute
|
|
4
|
-
import "./reactMenuTest.scss";
|
|
5
3
|
|
|
6
4
|
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
7
5
|
import { GridFormEditBearing } from "../../../components/gridForm/GridFormEditBearing";
|
|
@@ -11,7 +9,7 @@ import { useRef } from "react";
|
|
|
11
9
|
import { GridPopoverEditBearingCorrectionEditorParams } from "../../../components/gridPopoverEdit/GridPopoverEditBearing";
|
|
12
10
|
|
|
13
11
|
export default {
|
|
14
|
-
title: "GridForm /
|
|
12
|
+
title: "GridForm / Testing",
|
|
15
13
|
component: GridFormEditBearing,
|
|
16
14
|
args: {},
|
|
17
15
|
} as ComponentMeta<typeof GridFormEditBearing>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "@linzjs/lui/dist/scss/base.scss";
|
|
2
|
+
import "@linzjs/lui/dist/fonts";
|
|
3
|
+
|
|
4
|
+
import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
|
|
5
|
+
import { GridFormMessage } from "../../../components/gridForm/GridFormMessage";
|
|
6
|
+
import { GridContextProvider } from "../../../contexts/GridContextProvider";
|
|
7
|
+
import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
|
|
8
|
+
import { useRef } from "react";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "GridForm / Testing",
|
|
12
|
+
component: GridFormMessage,
|
|
13
|
+
args: {},
|
|
14
|
+
} as ComponentMeta<typeof GridFormMessage>;
|
|
15
|
+
|
|
16
|
+
const Template: ComponentStory<typeof GridFormMessage> = (props) => {
|
|
17
|
+
const anchorRef1 = useRef<HTMLHeadingElement>(null);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={"react-menu-inline-test"}>
|
|
21
|
+
<GridContextProvider>
|
|
22
|
+
<h6 ref={anchorRef1}>Standard Message</h6>
|
|
23
|
+
<GridPopoverContext.Provider value={{ anchorRef: anchorRef1 } as any as GridPopoverContextType<any>}>
|
|
24
|
+
<GridFormMessage {...props} message={() => <span>This is a message</span>} />
|
|
25
|
+
</GridPopoverContext.Provider>
|
|
26
|
+
</GridContextProvider>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const GridFormMessage_ = Template.bind({});
|
|
32
|
+
GridFormMessage_.args = {};
|