@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/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": "8.0.0",
5
+ "version": "8.1.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -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 filter won't change if it's reloaded, reload means it does change
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 researchOnFilterChange = useMemo(
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
- researchOnFilterChange().then();
161
+ reSearchOnFilterChange().then();
161
162
  }
162
- }, [filter, props, researchOnFilterChange]);
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
- item.value === MenuSeparatorString ? (
242
- <MenuDivider key={`$$divider_${index}`} />
243
- ) : item.value === MenuHeaderString ? (
244
- <MenuHeader key={`$$header_${index}`}>{item.label}</MenuHeader>
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
- <div key={`menu-wrapper-${index}`}>
248
- <MenuItem
249
- key={`${fieldToString(field)}-${index}`}
250
- disabled={!!item.disabled}
251
- title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
252
- value={item.value}
253
- onFocus={() => {
254
- setSelectedItem(item);
255
- if (item.subComponent) {
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
- subComponentIsValid.current = true;
258
- subComponentInitialValue.current = null;
259
- } else {
260
- setSubSelectedValue(null);
261
- subComponentIsValid.current = true;
262
- }
263
- }}
264
- onClick={(e: ClickEvent) => {
265
- if (item.subComponent) {
266
- e.keepOpen = true;
267
- }
268
- }}
269
- >
270
- {item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
271
- {item.subComponent ? "..." : ""}
272
- </MenuItem>
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
- {item.subComponent && selectedItem === item && (
275
- <FocusableItem className={"LuiDeprecatedForms"} key={`${item.label}_subcomponent`}>
276
- {(ref: MenuInstance) => (
277
- <GridSubComponentContext.Provider
278
- value={{
279
- context: { options },
280
- data,
281
- value: subSelectedValue,
282
- setValue: (value: any) => {
283
- setSubSelectedValue(value);
284
- if (subComponentInitialValue.current === null) {
285
- // copy the default value of the sub-component so we can change detect on save
286
- subComponentInitialValue.current = JSON.stringify(value);
287
- }
288
- },
289
- setValid: (valid: boolean) => {
290
- subComponentIsValid.current = valid;
291
- },
292
- triggerSave: async () => {
293
- ref.closeMenu();
294
- },
295
- }}
296
- >
297
- {item.subComponent && (
298
- <div className={"subComponent"}>
299
- <item.subComponent key={`${fieldToString(field)}-${index}_subcomponent_inner`} />
300
- </div>
301
- )}
302
- </GridSubComponentContext.Provider>
303
- )}
304
- </FocusableItem>
305
- )}
306
- </div>
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 GridFormPopoutMenuProps<RowType extends GridBaseRow> extends CellEditorCommon {
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
- export const PopoutMenuSeparator = Object.freeze({ __isMenuSeparator__: true });
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: GridFormPopoutMenuProps<RowType>) => {
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?.map((item, index) =>
123
- item.label === PopoutMenuSeparator ? (
124
- <MenuDivider key={`$$divider_${index}`} />
125
- ) : (
126
- !item.hidden && (
127
- <Fragment key={`${item.label}`}>
128
- <MenuItem
129
- key={`${item.label}`}
130
- onClick={(e: ClickEvent) => onMenuItemClick(e, item)}
131
- disabled={!!item.disabled}
132
- title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
133
- >
134
- {item.label as JSX.Element | string}
135
- </MenuItem>
136
- {item.subComponent && subComponentSelected === item && (
137
- <FocusableItem className={"LuiDeprecatedForms"} key={`${item.label}_subcomponent`}>
138
- {(_: any) =>
139
- item.subComponent && (
140
- <GridSubComponentContext.Provider
141
- value={{
142
- context: {},
143
- data,
144
- value: subSelectedValue,
145
- setValue: (value: any) => {
146
- setSubSelectedValue(value);
147
- },
148
- setValid: (valid: boolean) => {
149
- subComponentIsValid.current = valid;
150
- },
151
- triggerSave,
152
- }}
153
- >
154
- <div className={"subComponent"}>
155
- <item.subComponent />
156
- </div>
157
- </GridSubComponentContext.Provider>
158
- )
159
- }
160
- </FocusableItem>
161
- )}
162
- </Fragment>
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, GridFormPopoutMenuProps } from "../gridForm/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<GridFormPopoutMenuProps<RowType>>,
12
+ custom: GenericCellEditorProps<GridFormPopoverMenuProps<RowType>>,
13
13
  ): ColDefT<RowType> =>
14
- GridCell<RowType, GridFormPopoutMenuProps<RowType>>(
14
+ GridCell<RowType, GridFormPopoverMenuProps<RowType>>(
15
15
  {
16
16
  minWidth: 40,
17
17
  maxWidth: 40,
@@ -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 ? (
@@ -71,3 +71,7 @@
71
71
  text-transform: uppercase;
72
72
  }
73
73
  }
74
+
75
+ .react-menu-inline-test .szh-menu-container, .react-menu-inline-test .szh-menu {
76
+ position: static !important;
77
+ }
@@ -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 { GridFormDropDown, MenuHeaderItem } from "../../../components/gridForm/GridFormDropDown";
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 / Samples",
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 anchorRef1 = useRef<HTMLHeadingElement>(null);
20
- const anchorRef2 = useRef<HTMLHeadingElement>(null);
21
- const anchorRef3 = useRef<HTMLHeadingElement>(null);
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
- <h6 ref={anchorRef1}>No options</h6>
27
- <GridPopoverContext.Provider value={{ anchorRef: anchorRef1 } as any as GridPopoverContextType<any>}>
28
- <GridFormDropDown {...props} options={[]} />
29
- </GridPopoverContext.Provider>
30
-
31
- <h6 ref={anchorRef2}>Enabled and disabled</h6>
32
- <GridPopoverContext.Provider value={{ anchorRef: anchorRef2 } as any as GridPopoverContextType<any>}>
33
- <GridFormDropDown
34
- {...props}
35
- options={[
36
- { label: "Enabled", value: 1 },
37
- { label: "Disabled", value: 0, disabled: true },
38
- ]}
39
- />
40
- </GridPopoverContext.Provider>
41
-
42
- <h6 ref={anchorRef3}>Headers</h6>
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 / Samples",
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 / Samples",
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 = {};