@linzjs/step-ag-grid 32.7.1 → 34.0.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/PostSortRowsHook.test.d.ts +1 -0
- package/dist/src/components/gridFilter/GridFilterColumnsMultiSelect.d.ts +6 -25
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +2 -1
- package/dist/src/utils/__tests__/storybookTestUtil.ts +1 -1
- package/dist/step-ag-grid.cjs +190 -206
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +190 -206
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +17 -17
- package/src/components/Grid.tsx +8 -10
- package/src/components/PostSortRowsHook.test.ts +300 -0
- package/src/components/PostSortRowsHook.ts +127 -24
- package/src/components/gridFilter/GridFilterColumnsMultiSelect.tsx +110 -199
- package/src/components/gridForm/GridFormTextInput.tsx +2 -1
- package/src/components/gridHook/useGridRangeSelection.ts +8 -6
- package/src/contexts/GridContextProvider.tsx +5 -9
- package/src/react-menu3/components/ControlledMenu.tsx +5 -3
- package/src/react-menu3/components/MenuList.tsx +7 -3
- package/src/react-menu3/hooks/useItems.ts +1 -1
- package/src/stories/components/ActionButton.stories.tsx +12 -11
- package/src/stories/decorators/withOpenInPanelDecorator.tsx +35 -0
- package/src/stories/grid/GridCopy.stories.tsx +38 -35
- package/src/stories/grid/GridDragRow.stories.tsx +41 -36
- package/src/stories/grid/GridFilterButtons.stories.tsx +25 -19
- package/src/stories/grid/GridFilterColumnsMultiSelect.stories.tsx +42 -37
- package/src/stories/grid/GridInlineText.stories.tsx +62 -49
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +28 -23
- package/src/stories/grid/GridNonEditableRow.stories.tsx +30 -24
- package/src/stories/grid/GridPinnedRow.stories.tsx +37 -31
- package/src/stories/grid/GridPopoutContextMenu.stories.tsx +29 -24
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +89 -82
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +27 -22
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +29 -24
- package/src/stories/grid/GridPopoverEditBearing.stories.tsx +30 -25
- package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +29 -24
- package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +29 -24
- package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +28 -24
- package/src/stories/grid/GridReadOnly.stories.tsx +56 -52
- package/src/stories/grid/GridSorting.stories.tsx +498 -86
- package/src/stories/grid/GridViewList.stories.tsx +31 -26
- package/src/stories/grid/GridViewSelectableList.stories.tsx +31 -26
- package/src/stories/grid/gridAutosize/GridAutoSize.stories.tsx +41 -37
- package/src/stories/grid/gridAutosize/GridFitSize.stories.tsx +40 -36
- package/src/stories/grid/gridAutosize/GridFitSizeFlex.stories.tsx +40 -36
- package/src/stories/grid/gridAutosize/ShowPanelResizingAgGrid/ShowPanelResizingStepAgGrid.tsx +14 -6
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +74 -74
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +59 -59
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +58 -58
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +62 -62
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +118 -118
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +107 -105
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +72 -64
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +82 -73
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +12 -13
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +12 -13
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +11 -13
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +11 -13
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +11 -13
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +11 -13
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +11 -13
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +11 -13
- package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +110 -107
- package/src/stories/react-menu/ReactMenu.stories.tsx +70 -73
- package/src/styles/GridLoadableCell.scss +1 -1
- package/src/utils/__tests__/storybookTestUtil.ts +1 -1
- package/src/utils/useSharedInterval.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { countBy, mergeWith, pull, range, union } from 'lodash-es';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
|
|
@@ -6,27 +6,7 @@ import { ColDefT, Grid, GridCell, GridContextProvider, GridProps, GridUpdatingCo
|
|
|
6
6
|
import { MultiSelectGridOption } from '../../components/gridForm/GridFormMultiSelectGrid';
|
|
7
7
|
import { GridPopoutEditMultiSelectGrid } from '../../components/gridPopoverEdit/GridPopoutEditMultiSelectGrid';
|
|
8
8
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Components / Grids',
|
|
13
|
-
component: Grid,
|
|
14
|
-
args: {
|
|
15
|
-
quickFilterValue: '',
|
|
16
|
-
selectable: true,
|
|
17
|
-
},
|
|
18
|
-
decorators: [
|
|
19
|
-
(Story) => (
|
|
20
|
-
<div style={{ width: 1024, height: 400 }}>
|
|
21
|
-
<GridUpdatingContextProvider>
|
|
22
|
-
<GridContextProvider>
|
|
23
|
-
<Story />
|
|
24
|
-
</GridContextProvider>
|
|
25
|
-
</GridUpdatingContextProvider>
|
|
26
|
-
</div>
|
|
27
|
-
),
|
|
28
|
-
],
|
|
29
|
-
} as Meta<typeof Grid>;
|
|
9
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
30
10
|
|
|
31
11
|
interface ITestRow {
|
|
32
12
|
id: number;
|
|
@@ -104,5 +84,29 @@ const GridEditMultiSelectGridTemplate: StoryFn<typeof Grid<ITestRow>> = (props:
|
|
|
104
84
|
);
|
|
105
85
|
};
|
|
106
86
|
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
const meta: Meta<typeof GridEditMultiSelectGridTemplate> = {
|
|
88
|
+
title: 'Components / Grids',
|
|
89
|
+
component: GridEditMultiSelectGridTemplate,
|
|
90
|
+
args: {
|
|
91
|
+
selectable: true,
|
|
92
|
+
},
|
|
93
|
+
decorators: [
|
|
94
|
+
(Story) => (
|
|
95
|
+
<div style={{ width: 1024, height: 400 }}>
|
|
96
|
+
<GridUpdatingContextProvider>
|
|
97
|
+
<GridContextProvider>
|
|
98
|
+
<Story />
|
|
99
|
+
</GridContextProvider>
|
|
100
|
+
</GridUpdatingContextProvider>
|
|
101
|
+
</div>
|
|
102
|
+
),
|
|
103
|
+
withOpenInPanelDecorator,
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
export default meta;
|
|
107
|
+
|
|
108
|
+
type Story = StoryObj<typeof meta>;
|
|
109
|
+
|
|
110
|
+
export const EditMultiSelectGrid: Story = {
|
|
111
|
+
play: waitForGridReady,
|
|
112
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { ReactElement, useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { expect, fn, screen, userEvent } from 'storybook/test';
|
|
4
4
|
|
|
@@ -25,37 +25,7 @@ import {
|
|
|
25
25
|
import { GridFilterColumnsToggle, GridFilterDownloadCsvButton } from '../../components';
|
|
26
26
|
import { GridCellFiller } from '../../components/GridCellFiller';
|
|
27
27
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
title: 'Components / Grids',
|
|
31
|
-
component: Grid,
|
|
32
|
-
args: {
|
|
33
|
-
quickFilter: true,
|
|
34
|
-
quickFilterValue: '',
|
|
35
|
-
quickFilterPlaceholder: 'Quick filter...',
|
|
36
|
-
selectable: false,
|
|
37
|
-
rowSelection: 'single',
|
|
38
|
-
},
|
|
39
|
-
// Storybook hangs otherwise
|
|
40
|
-
parameters: {
|
|
41
|
-
docs: {
|
|
42
|
-
source: {
|
|
43
|
-
type: 'code',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
decorators: [
|
|
48
|
-
(Story) => (
|
|
49
|
-
<div style={{ width: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
50
|
-
<GridUpdatingContextProvider>
|
|
51
|
-
<GridContextProvider>
|
|
52
|
-
<Story />
|
|
53
|
-
</GridContextProvider>
|
|
54
|
-
</GridUpdatingContextProvider>
|
|
55
|
-
</div>
|
|
56
|
-
),
|
|
57
|
-
],
|
|
58
|
-
} as Meta<typeof Grid>;
|
|
28
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
59
29
|
|
|
60
30
|
interface ITestRow {
|
|
61
31
|
id: number;
|
|
@@ -288,8 +258,41 @@ const GridFilterLessThan = (props: {
|
|
|
288
258
|
);
|
|
289
259
|
};
|
|
290
260
|
|
|
291
|
-
|
|
292
|
-
|
|
261
|
+
const meta: Meta<typeof GridReadOnlyTemplate> = {
|
|
262
|
+
title: 'Components / Grids',
|
|
263
|
+
component: GridReadOnlyTemplate,
|
|
264
|
+
args: {
|
|
265
|
+
selectable: false,
|
|
266
|
+
rowSelection: 'single',
|
|
267
|
+
},
|
|
268
|
+
// Storybook hangs otherwise
|
|
269
|
+
parameters: {
|
|
270
|
+
docs: {
|
|
271
|
+
source: {
|
|
272
|
+
type: 'code',
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
decorators: [
|
|
277
|
+
(Story) => (
|
|
278
|
+
<div style={{ width: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
279
|
+
<GridUpdatingContextProvider>
|
|
280
|
+
<GridContextProvider>
|
|
281
|
+
<Story />
|
|
282
|
+
</GridContextProvider>
|
|
283
|
+
</GridUpdatingContextProvider>
|
|
284
|
+
</div>
|
|
285
|
+
),
|
|
286
|
+
withOpenInPanelDecorator,
|
|
287
|
+
],
|
|
288
|
+
};
|
|
289
|
+
export default meta;
|
|
290
|
+
|
|
291
|
+
type Story = StoryObj<typeof meta>;
|
|
292
|
+
|
|
293
|
+
export const ReadOnlySingleSelection: Story = {
|
|
294
|
+
play: waitForGridReady,
|
|
295
|
+
};
|
|
293
296
|
|
|
294
297
|
interface IIgnoreReadOnlyRow {
|
|
295
298
|
id: number;
|
|
@@ -298,7 +301,7 @@ interface IIgnoreReadOnlyRow {
|
|
|
298
301
|
|
|
299
302
|
const disabledMenuItemAction = fn();
|
|
300
303
|
|
|
301
|
-
const IgnoreGridReadOnlyTemplate
|
|
304
|
+
const IgnoreGridReadOnlyTemplate = () => {
|
|
302
305
|
const columnDefs: ColDefT<IIgnoreReadOnlyRow>[] = useMemo(
|
|
303
306
|
() => [
|
|
304
307
|
GridCell<IIgnoreReadOnlyRow, IIgnoreReadOnlyRow['name']>({ field: 'name', headerName: 'Name' }),
|
|
@@ -336,25 +339,26 @@ const IgnoreGridReadOnlyTemplate: StoryFn<typeof Grid<IIgnoreReadOnlyRow>> = ()
|
|
|
336
339
|
);
|
|
337
340
|
};
|
|
338
341
|
|
|
339
|
-
export const ReadOnlyIgnoreGridReadOnlyColumn =
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
342
|
+
export const ReadOnlyIgnoreGridReadOnlyColumn: Story = {
|
|
343
|
+
render: IgnoreGridReadOnlyTemplate,
|
|
344
|
+
play: async ({ canvasElement }) => {
|
|
345
|
+
await waitForGridReady({ canvasElement });
|
|
343
346
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
const alwaysEnabledCell = canvasElement.querySelector('.ag-cell[col-id="alwaysEnabledActions"]');
|
|
348
|
+
await expect(alwaysEnabledCell).toBeInTheDocument();
|
|
349
|
+
await userEvent.click(alwaysEnabledCell as HTMLElement);
|
|
350
|
+
await expect(await screen.findByRole('menuitem', { name: 'Locate feature' })).toBeInTheDocument();
|
|
348
351
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
352
|
+
const disabledItem = await screen.findByRole('menuitem', { name: 'Other action' });
|
|
353
|
+
await expect(disabledItem).toHaveAttribute('aria-disabled', 'true');
|
|
354
|
+
await userEvent.click(disabledItem);
|
|
355
|
+
await expect(disabledMenuItemAction).not.toHaveBeenCalled();
|
|
353
356
|
|
|
354
|
-
|
|
357
|
+
await userEvent.keyboard('{Escape}');
|
|
355
358
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
359
|
+
const blockedCell = canvasElement.querySelector('.ag-cell[col-id="blockedActions"]');
|
|
360
|
+
await expect(blockedCell).toBeInTheDocument();
|
|
361
|
+
await userEvent.click(blockedCell as HTMLElement);
|
|
362
|
+
await expect(screen.queryByRole('menuitem', { name: 'Should not open' })).not.toBeInTheDocument();
|
|
363
|
+
},
|
|
360
364
|
};
|