@linzjs/step-ag-grid 17.9.0 → 17.10.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": "17.9.0",
5
+ "version": "17.10.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -3,7 +3,7 @@ import { Fragment, ReactElement, useCallback, useEffect, useRef, useState } from
3
3
 
4
4
  import { useGridPopoverContext } from "../../contexts/GridPopoverContext";
5
5
  import { GridSubComponentContext } from "../../contexts/GridSubComponentContext";
6
- import { FocusableItem, MenuDivider, MenuItem } from "../../react-menu3";
6
+ import { FocusableItem, MenuDivider, MenuItem, SubMenu } from "../../react-menu3";
7
7
  import { ClickEvent } from "../../react-menu3/types";
8
8
  import { ComponentLoadingWrapper } from "../ComponentLoadingWrapper";
9
9
  import { GridBaseRow } from "../Grid";
@@ -29,6 +29,7 @@ export interface SelectedMenuOptionResult<RowType extends GridBaseRow> extends M
29
29
 
30
30
  export interface MenuOption<RowType extends GridBaseRow> {
31
31
  label: ReactElement | string | MenuSeparatorType;
32
+ subMenu?: () => ReactElement;
32
33
  action?: (props: { selectedRows: RowType[]; menuOption: SelectedMenuOptionResult<RowType> }) => Promise<void>;
33
34
  disabled?: string | boolean;
34
35
  hidden?: boolean;
@@ -135,14 +136,25 @@ export const GridFormPopoverMenu = <RowType extends GridBaseRow>(props: GridForm
135
136
  ) : (
136
137
  !item.hidden && (
137
138
  <Fragment key={`${item.label}`}>
138
- <MenuItem
139
- key={`${item.label}`}
140
- onClick={(e: ClickEvent) => onMenuItemClick(e, item)}
141
- disabled={!!item.disabled}
142
- title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
143
- >
144
- {item.label as ReactElement | string}
145
- </MenuItem>
139
+ {item.subMenu ? (
140
+ <SubMenu
141
+ key={`${item.label}`}
142
+ disabled={!!item.disabled}
143
+ label={item.label as string}
144
+ title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
145
+ >
146
+ <item.subMenu />
147
+ </SubMenu>
148
+ ) : (
149
+ <MenuItem
150
+ key={`${item.label}`}
151
+ onClick={(e: ClickEvent) => onMenuItemClick(e, item)}
152
+ disabled={!!item.disabled}
153
+ title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
154
+ >
155
+ {item.label as ReactElement | string}
156
+ </MenuItem>
157
+ )}
146
158
  {item.subComponent && subComponentSelected === item && (
147
159
  <FocusableItem className={"LuiDeprecatedForms"} key={`${item.label}_subcomponent`}>
148
160
  {() => (
@@ -23,6 +23,7 @@ import {
23
23
  GridProps,
24
24
  GridUpdatingContextProvider,
25
25
  GridWrapper,
26
+ MenuItem,
26
27
  useGridFilter,
27
28
  wait,
28
29
  } from "../..";
@@ -171,6 +172,10 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
171
172
  await wait(1500);
172
173
  },
173
174
  },
175
+ {
176
+ label: "Sub menu...",
177
+ subMenu: () => <MenuItem>Find...</MenuItem>,
178
+ },
174
179
  {
175
180
  label: "Disabled item",
176
181
  disabled: "Disabled for test",