@linzjs/step-ag-grid 17.9.0 → 17.11.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/src/components/Grid.d.ts +1 -0
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +1 -0
- package/dist/step-ag-grid.cjs.js +2 -2
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +2 -2
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +2 -0
- package/src/components/gridForm/GridFormPopoverMenu.tsx +21 -9
- package/src/stories/grid/GridReadOnly.stories.tsx +5 -0
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>
|
|
@@ -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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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",
|