@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 { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -13,37 +13,7 @@ import {
|
|
|
13
13
|
reorderRows,
|
|
14
14
|
} from '../..';
|
|
15
15
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
title: 'Components / Grids',
|
|
19
|
-
component: Grid,
|
|
20
|
-
args: {
|
|
21
|
-
quickFilter: true,
|
|
22
|
-
quickFilterValue: '',
|
|
23
|
-
quickFilterPlaceholder: 'Quick filter...',
|
|
24
|
-
selectable: false,
|
|
25
|
-
rowSelection: 'single',
|
|
26
|
-
},
|
|
27
|
-
// Storybook hangs otherwise
|
|
28
|
-
parameters: {
|
|
29
|
-
docs: {
|
|
30
|
-
source: {
|
|
31
|
-
type: 'code',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
decorators: [
|
|
36
|
-
(Story) => (
|
|
37
|
-
<div style={{ width: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
38
|
-
<GridUpdatingContextProvider>
|
|
39
|
-
<GridContextProvider>
|
|
40
|
-
<Story />
|
|
41
|
-
</GridContextProvider>
|
|
42
|
-
</GridUpdatingContextProvider>
|
|
43
|
-
</div>
|
|
44
|
-
),
|
|
45
|
-
],
|
|
46
|
-
} as Meta<typeof Grid>;
|
|
16
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
47
17
|
|
|
48
18
|
interface ITestRow {
|
|
49
19
|
id: number;
|
|
@@ -116,8 +86,41 @@ const GridDragRowTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<IT
|
|
|
116
86
|
);
|
|
117
87
|
};
|
|
118
88
|
|
|
119
|
-
|
|
120
|
-
|
|
89
|
+
const meta: Meta<typeof GridDragRowTemplate> = {
|
|
90
|
+
title: 'Components / Grids',
|
|
91
|
+
component: GridDragRowTemplate,
|
|
92
|
+
args: {
|
|
93
|
+
selectable: false,
|
|
94
|
+
rowSelection: 'single',
|
|
95
|
+
},
|
|
96
|
+
// Storybook hangs otherwise
|
|
97
|
+
parameters: {
|
|
98
|
+
docs: {
|
|
99
|
+
source: {
|
|
100
|
+
type: 'code',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
decorators: [
|
|
105
|
+
(Story) => (
|
|
106
|
+
<div style={{ width: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
107
|
+
<GridUpdatingContextProvider>
|
|
108
|
+
<GridContextProvider>
|
|
109
|
+
<Story />
|
|
110
|
+
</GridContextProvider>
|
|
111
|
+
</GridUpdatingContextProvider>
|
|
112
|
+
</div>
|
|
113
|
+
),
|
|
114
|
+
withOpenInPanelDecorator,
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
export default meta;
|
|
118
|
+
|
|
119
|
+
type Story = StoryObj<typeof meta>;
|
|
120
|
+
|
|
121
|
+
export const DragRowSingleSelection: Story = {
|
|
122
|
+
play: waitForGridReady,
|
|
123
|
+
};
|
|
121
124
|
|
|
122
125
|
const GridDragRowMultiTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
|
|
123
126
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
@@ -174,5 +177,7 @@ const GridDragRowMultiTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridPro
|
|
|
174
177
|
);
|
|
175
178
|
};
|
|
176
179
|
|
|
177
|
-
export const DragRowMultiSelection =
|
|
178
|
-
|
|
180
|
+
export const DragRowMultiSelection: Story = {
|
|
181
|
+
render: GridDragRowMultiTemplate,
|
|
182
|
+
play: waitForGridReady,
|
|
183
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -14,22 +14,7 @@ import {
|
|
|
14
14
|
GridWrapper,
|
|
15
15
|
} from '../..';
|
|
16
16
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
title: 'Components / Grids',
|
|
20
|
-
component: Grid,
|
|
21
|
-
decorators: [
|
|
22
|
-
(Story) => (
|
|
23
|
-
<div style={{ width: 1024, height: 400, display: 'flex' }}>
|
|
24
|
-
<GridUpdatingContextProvider>
|
|
25
|
-
<GridContextProvider>
|
|
26
|
-
<Story />
|
|
27
|
-
</GridContextProvider>
|
|
28
|
-
</GridUpdatingContextProvider>
|
|
29
|
-
</div>
|
|
30
|
-
),
|
|
31
|
-
],
|
|
32
|
-
} as Meta<typeof Grid>;
|
|
17
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
33
18
|
|
|
34
19
|
interface ITestRow {
|
|
35
20
|
id: number;
|
|
@@ -104,5 +89,26 @@ const GridFilterButtonsTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridPr
|
|
|
104
89
|
);
|
|
105
90
|
};
|
|
106
91
|
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
const meta: Meta<typeof GridFilterButtonsTemplate> = {
|
|
93
|
+
title: 'Components / Grids',
|
|
94
|
+
component: GridFilterButtonsTemplate,
|
|
95
|
+
decorators: [
|
|
96
|
+
(Story) => (
|
|
97
|
+
<div style={{ width: 1024, height: 400, display: 'flex' }}>
|
|
98
|
+
<GridUpdatingContextProvider>
|
|
99
|
+
<GridContextProvider>
|
|
100
|
+
<Story />
|
|
101
|
+
</GridContextProvider>
|
|
102
|
+
</GridUpdatingContextProvider>
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
withOpenInPanelDecorator,
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
export default meta;
|
|
109
|
+
|
|
110
|
+
type Story = StoryObj<typeof meta>;
|
|
111
|
+
|
|
112
|
+
export const _FilterButtonsExample: Story = {
|
|
113
|
+
play: waitForGridReady,
|
|
114
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Meta,
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import {
|
|
3
3
|
createCheckboxMultiFilterParams,
|
|
4
4
|
GridFilterColumnsMultiSelect,
|
|
5
5
|
} from '../../components/gridFilter/GridFilterColumnsMultiSelect';
|
|
6
|
-
import { useMemo, useState } from 'react';
|
|
6
|
+
import { useMemo, useState, ComponentType } from 'react';
|
|
7
7
|
import { expect, userEvent, within } from 'storybook/test';
|
|
8
8
|
|
|
9
9
|
import {
|
|
@@ -26,22 +26,7 @@ import {
|
|
|
26
26
|
waitForGridRows,
|
|
27
27
|
} from '../../utils/__tests__/storybookTestUtil';
|
|
28
28
|
import { findQuick } from '../../utils/__tests__/testQuick';
|
|
29
|
-
|
|
30
|
-
export default {
|
|
31
|
-
title: 'Components / Grids',
|
|
32
|
-
component: Grid,
|
|
33
|
-
decorators: [
|
|
34
|
-
(Story) => (
|
|
35
|
-
<div style={{ width: 1024, height: 400, display: 'flex' }}>
|
|
36
|
-
<GridUpdatingContextProvider>
|
|
37
|
-
<GridContextProvider>
|
|
38
|
-
<Story />
|
|
39
|
-
</GridContextProvider>
|
|
40
|
-
</GridUpdatingContextProvider>
|
|
41
|
-
</div>
|
|
42
|
-
),
|
|
43
|
-
],
|
|
44
|
-
} as Meta<typeof Grid>;
|
|
29
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
45
30
|
|
|
46
31
|
interface ITestRow {
|
|
47
32
|
id: number;
|
|
@@ -49,7 +34,7 @@ interface ITestRow {
|
|
|
49
34
|
desc: string;
|
|
50
35
|
}
|
|
51
36
|
|
|
52
|
-
const GridFilterColumnsMultiSelectTemplate
|
|
37
|
+
const GridFilterColumnsMultiSelectTemplate = (props: GridProps<ITestRow>) => {
|
|
53
38
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
54
39
|
() => [
|
|
55
40
|
GridCell({
|
|
@@ -126,26 +111,46 @@ const GridFilterColumnsMultiSelectTemplate: StoryFn<typeof Grid<ITestRow>> = (pr
|
|
|
126
111
|
);
|
|
127
112
|
};
|
|
128
113
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
114
|
+
const meta: Meta<typeof GridFilterColumnsMultiSelectTemplate> = {
|
|
115
|
+
title: 'Components / Grids',
|
|
116
|
+
component: GridFilterColumnsMultiSelectTemplate,
|
|
117
|
+
decorators: [
|
|
118
|
+
(Story: ComponentType) => (
|
|
119
|
+
<div style={{ width: 1024, height: 400, display: 'flex' }}>
|
|
120
|
+
<GridUpdatingContextProvider>
|
|
121
|
+
<GridContextProvider>
|
|
122
|
+
<Story />
|
|
123
|
+
</GridContextProvider>
|
|
124
|
+
</GridUpdatingContextProvider>
|
|
125
|
+
</div>
|
|
126
|
+
),
|
|
127
|
+
withOpenInPanelDecorator,
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
export default meta;
|
|
131
|
+
|
|
132
|
+
type Story = StoryObj<typeof meta>;
|
|
133
|
+
|
|
134
|
+
export const FilterColumnsMultiSelectExample: Story = {
|
|
135
|
+
play: async ({ canvasElement }) => {
|
|
136
|
+
await waitForGridReady({ canvasElement });
|
|
137
|
+
await waitForGridRows({ grid: canvasElement });
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
const setGridFilterAndCheckResultingRows = async (filterString: string, expected: string[] | null) => {
|
|
140
|
+
await filterGridUsingColumnFilter(filterString);
|
|
141
|
+
await wait(500);
|
|
142
|
+
if (expected !== null) {
|
|
143
|
+
await expect(gridColumnValues('id', canvasElement)).toEqual(expected);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await waitForGridReady({ canvasElement });
|
|
147
|
+
await expect(getNumberOfGridRows()).toEqual(0);
|
|
148
|
+
};
|
|
145
149
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
await setGridFilterAndCheckResultingRows('Tester', ['1001', '1002', '1004', '1005', '1006']);
|
|
151
|
+
await setGridFilterAndCheckResultingRows('Select All', ['1000', '1001', '1002', '1003', '1004', '1005', '1006']);
|
|
152
|
+
await setGridFilterAndCheckResultingRows('Select All', null); // Check that deselecting Select All filters out all rows
|
|
153
|
+
},
|
|
149
154
|
};
|
|
150
155
|
|
|
151
156
|
const filterGridUsingColumnFilter = async (filterString: string): Promise<void> => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import type { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useCallback, useContext, useMemo, useState } from 'react';
|
|
3
3
|
import { expect, screen, userEvent, within } from 'storybook/test';
|
|
4
4
|
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
wait,
|
|
17
17
|
} from '../..';
|
|
18
18
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
19
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
19
20
|
|
|
20
21
|
interface IFormTestRow {
|
|
21
22
|
id: number;
|
|
@@ -28,26 +29,6 @@ const initialRows: IFormTestRow[] = [
|
|
|
28
29
|
{ id: 1001, text1: 'b text1', text2: 'b text2' },
|
|
29
30
|
];
|
|
30
31
|
|
|
31
|
-
export default {
|
|
32
|
-
title: 'Components / Grids',
|
|
33
|
-
component: Grid,
|
|
34
|
-
args: {
|
|
35
|
-
quickFilterValue: '',
|
|
36
|
-
selectable: true,
|
|
37
|
-
},
|
|
38
|
-
decorators: [
|
|
39
|
-
(Story) => (
|
|
40
|
-
<div style={{ width: 1024, height: 400 }}>
|
|
41
|
-
<GridUpdatingContextProvider>
|
|
42
|
-
<GridContextProvider>
|
|
43
|
-
<Story />
|
|
44
|
-
</GridContextProvider>
|
|
45
|
-
</GridUpdatingContextProvider>
|
|
46
|
-
</div>
|
|
47
|
-
),
|
|
48
|
-
],
|
|
49
|
-
} as Meta<typeof Grid>;
|
|
50
|
-
|
|
51
32
|
const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
|
|
52
33
|
const { selectRowsWithFlashDiff } = useContext(GridContext);
|
|
53
34
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
@@ -68,7 +49,9 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
68
49
|
editorParams: {
|
|
69
50
|
placeholder: 'Enter some text...',
|
|
70
51
|
onSave: ({ selectedRowIds, value }) => {
|
|
71
|
-
setRowData(
|
|
52
|
+
setRowData((current) =>
|
|
53
|
+
current.map((data) => (selectedRowIds.includes(data.id) ? { ...data, text1: value } : data)),
|
|
54
|
+
);
|
|
72
55
|
return true;
|
|
73
56
|
},
|
|
74
57
|
},
|
|
@@ -89,14 +72,16 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
89
72
|
return null;
|
|
90
73
|
},
|
|
91
74
|
onSave: ({ selectedRowIds, value }) => {
|
|
92
|
-
setRowData(
|
|
75
|
+
setRowData((current) =>
|
|
76
|
+
current.map((data) => (selectedRowIds.includes(data.id) ? { ...data, text2: value } : data)),
|
|
77
|
+
);
|
|
93
78
|
return true;
|
|
94
79
|
},
|
|
95
80
|
},
|
|
96
81
|
},
|
|
97
82
|
),
|
|
98
83
|
GridPopoverMenu(
|
|
99
|
-
{},
|
|
84
|
+
{ colId: 'menu' },
|
|
100
85
|
{
|
|
101
86
|
multiEdit: true,
|
|
102
87
|
editorParams: {
|
|
@@ -121,25 +106,27 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
121
106
|
},
|
|
122
107
|
),
|
|
123
108
|
],
|
|
124
|
-
[
|
|
109
|
+
[],
|
|
125
110
|
);
|
|
126
111
|
|
|
127
112
|
const addRowAction = useCallback(async () => {
|
|
128
113
|
await wait(1000);
|
|
129
114
|
|
|
130
|
-
const lastRow = rowData[rowData.length - 1];
|
|
131
115
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
132
116
|
await selectRowsWithFlashDiff(async () => {
|
|
133
|
-
setRowData(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
117
|
+
setRowData((current) => {
|
|
118
|
+
const lastRow = current[current.length - 1];
|
|
119
|
+
return [
|
|
120
|
+
...current,
|
|
121
|
+
{
|
|
122
|
+
id: (lastRow?.id ?? 0) + 1,
|
|
123
|
+
text1: '?',
|
|
124
|
+
text2: '?',
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
});
|
|
141
128
|
});
|
|
142
|
-
}, [
|
|
129
|
+
}, [selectRowsWithFlashDiff]);
|
|
143
130
|
|
|
144
131
|
return (
|
|
145
132
|
<>
|
|
@@ -166,8 +153,32 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
166
153
|
);
|
|
167
154
|
};
|
|
168
155
|
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
const meta: Meta<typeof GridInlineTextTemplate> = {
|
|
157
|
+
title: 'Components / Grids',
|
|
158
|
+
component: GridInlineTextTemplate,
|
|
159
|
+
args: {
|
|
160
|
+
selectable: true,
|
|
161
|
+
},
|
|
162
|
+
decorators: [
|
|
163
|
+
(Story) => (
|
|
164
|
+
<div style={{ width: 1024, height: 400 }}>
|
|
165
|
+
<GridUpdatingContextProvider>
|
|
166
|
+
<GridContextProvider>
|
|
167
|
+
<Story />
|
|
168
|
+
</GridContextProvider>
|
|
169
|
+
</GridUpdatingContextProvider>
|
|
170
|
+
</div>
|
|
171
|
+
),
|
|
172
|
+
withOpenInPanelDecorator,
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
export default meta;
|
|
176
|
+
|
|
177
|
+
type Story = StoryObj<typeof meta>;
|
|
178
|
+
|
|
179
|
+
export const _EditInlineText: Story = {
|
|
180
|
+
play: waitForGridReady,
|
|
181
|
+
};
|
|
171
182
|
|
|
172
183
|
const InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
|
|
173
184
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
@@ -246,16 +257,18 @@ const InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (pro
|
|
|
246
257
|
);
|
|
247
258
|
};
|
|
248
259
|
|
|
249
|
-
export const _InlineText_ChangeEvents =
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
export const _InlineText_ChangeEvents: Story = {
|
|
261
|
+
render: InlineText_ChangeEventsTemplate,
|
|
262
|
+
play: async ({ canvasElement }) => {
|
|
263
|
+
await waitForGridReady({ canvasElement });
|
|
264
|
+
const canvas = within(canvasElement);
|
|
265
|
+
const saveButtons = canvas.getAllByTestId('inline-edit-save');
|
|
266
|
+
const saveButton = saveButtons[0];
|
|
267
|
+
await expect(saveButton).toBeDisabled();
|
|
268
|
+
const textCells = canvas.getAllByText('a text1');
|
|
269
|
+
await userEvent.click(textCells[0]);
|
|
270
|
+
const input = await screen.findByPlaceholderText('Enter some text...');
|
|
271
|
+
await userEvent.type(input, 'X');
|
|
272
|
+
await expect(saveButton).toBeEnabled();
|
|
273
|
+
},
|
|
261
274
|
};
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import { Meta,
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { expect, within } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { GridNoRowsOverlay, GridNoRowsOverlayProps } from '../../components';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
title: 'Components / Grids / GridNoRowsOverlay',
|
|
8
|
-
component: GridNoRowsOverlay,
|
|
9
|
-
args: {},
|
|
10
|
-
} as Meta<typeof GridNoRowsOverlay>;
|
|
11
|
-
|
|
12
|
-
const GridNoRowsOverlayTemplate: StoryFn<typeof GridNoRowsOverlay> = (params: GridNoRowsOverlayProps) => {
|
|
6
|
+
const GridNoRowsOverlayTemplate = (params: GridNoRowsOverlayProps) => {
|
|
13
7
|
return <GridNoRowsOverlay {...params} />;
|
|
14
8
|
};
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
_GridNoRowsEmpty.play = async ({ canvasElement }) => {
|
|
22
|
-
const canvas = within(canvasElement);
|
|
23
|
-
expect(await canvas.findByText('There are currently no rows')).toBeInTheDocument();
|
|
10
|
+
const meta: Meta<typeof GridNoRowsOverlayTemplate> = {
|
|
11
|
+
title: 'Components / Grids / GridNoRowsOverlay',
|
|
12
|
+
component: GridNoRowsOverlayTemplate,
|
|
13
|
+
args: {},
|
|
24
14
|
};
|
|
15
|
+
export default meta;
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const _GridNoRowsEmpty: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
rowCount: 0,
|
|
22
|
+
filteredRowCount: 0,
|
|
23
|
+
},
|
|
24
|
+
play: async ({ canvasElement }) => {
|
|
25
|
+
const canvas = within(canvasElement);
|
|
26
|
+
await expect(await canvas.findByText('There are currently no rows')).toBeInTheDocument();
|
|
27
|
+
},
|
|
30
28
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
|
|
30
|
+
export const _GridNoRowsFiltered: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
rowCount: 1,
|
|
33
|
+
filteredRowCount: 0,
|
|
34
|
+
},
|
|
35
|
+
play: async ({ canvasElement }) => {
|
|
36
|
+
const canvas = within(canvasElement);
|
|
37
|
+
await expect(await canvas.findByText('All rows have been filtered')).toBeInTheDocument();
|
|
38
|
+
},
|
|
34
39
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { GridPopoverEditDropDown } from '../../components/gridPopoverEdit/GridPopoverEditDropDown';
|
|
3
3
|
import { GridPopoverTextArea } from '../../components/gridPopoverEdit/GridPopoverTextArea';
|
|
4
4
|
import { useMemo, useState } from 'react';
|
|
@@ -18,27 +18,7 @@ import {
|
|
|
18
18
|
wait,
|
|
19
19
|
} from '../..';
|
|
20
20
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
title: 'Components / Grids',
|
|
24
|
-
component: Grid,
|
|
25
|
-
args: {
|
|
26
|
-
selectable: true,
|
|
27
|
-
rowSelection: 'single',
|
|
28
|
-
autoSelectFirstRow: true,
|
|
29
|
-
},
|
|
30
|
-
decorators: [
|
|
31
|
-
(Story) => (
|
|
32
|
-
<div style={{ width: 1024, height: 400 }}>
|
|
33
|
-
<GridUpdatingContextProvider>
|
|
34
|
-
<GridContextProvider>
|
|
35
|
-
<Story />
|
|
36
|
-
</GridContextProvider>
|
|
37
|
-
</GridUpdatingContextProvider>
|
|
38
|
-
</div>
|
|
39
|
-
),
|
|
40
|
-
],
|
|
41
|
-
} as Meta<typeof Grid>;
|
|
21
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
42
22
|
|
|
43
23
|
interface ITestRow {
|
|
44
24
|
id: number;
|
|
@@ -169,5 +149,31 @@ const GridNonEditableRowTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridP
|
|
|
169
149
|
);
|
|
170
150
|
};
|
|
171
151
|
|
|
172
|
-
|
|
173
|
-
|
|
152
|
+
const meta: Meta<typeof GridNonEditableRowTemplate> = {
|
|
153
|
+
title: 'Components / Grids',
|
|
154
|
+
component: GridNonEditableRowTemplate,
|
|
155
|
+
args: {
|
|
156
|
+
selectable: true,
|
|
157
|
+
rowSelection: 'single',
|
|
158
|
+
autoSelectFirstRow: true,
|
|
159
|
+
},
|
|
160
|
+
decorators: [
|
|
161
|
+
(Story) => (
|
|
162
|
+
<div style={{ width: 1024, height: 400 }}>
|
|
163
|
+
<GridUpdatingContextProvider>
|
|
164
|
+
<GridContextProvider>
|
|
165
|
+
<Story />
|
|
166
|
+
</GridContextProvider>
|
|
167
|
+
</GridUpdatingContextProvider>
|
|
168
|
+
</div>
|
|
169
|
+
),
|
|
170
|
+
withOpenInPanelDecorator,
|
|
171
|
+
],
|
|
172
|
+
};
|
|
173
|
+
export default meta;
|
|
174
|
+
|
|
175
|
+
type Story = StoryObj<typeof meta>;
|
|
176
|
+
|
|
177
|
+
export const _NonEditableRow: Story = {
|
|
178
|
+
play: waitForGridReady,
|
|
179
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta,
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useMemo, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -11,33 +11,7 @@ import {
|
|
|
11
11
|
GridWrapper,
|
|
12
12
|
} from '../..';
|
|
13
13
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
title: 'Components / Grids',
|
|
17
|
-
component: Grid,
|
|
18
|
-
args: {
|
|
19
|
-
selectable: false,
|
|
20
|
-
},
|
|
21
|
-
// Storybook hangs otherwise
|
|
22
|
-
parameters: {
|
|
23
|
-
docs: {
|
|
24
|
-
source: {
|
|
25
|
-
type: 'code',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
decorators: [
|
|
30
|
-
(Story) => (
|
|
31
|
-
<div style={{ width: 1024, height: 260, display: 'flex', flexDirection: 'column' }}>
|
|
32
|
-
<GridUpdatingContextProvider>
|
|
33
|
-
<GridContextProvider>
|
|
34
|
-
<Story />
|
|
35
|
-
</GridContextProvider>
|
|
36
|
-
</GridUpdatingContextProvider>
|
|
37
|
-
</div>
|
|
38
|
-
),
|
|
39
|
-
],
|
|
40
|
-
} as Meta<typeof Grid>;
|
|
14
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
41
15
|
|
|
42
16
|
interface ITestRow {
|
|
43
17
|
id: number;
|
|
@@ -52,7 +26,7 @@ interface ITestPinnedRow {
|
|
|
52
26
|
age: number;
|
|
53
27
|
}
|
|
54
28
|
|
|
55
|
-
const PinnedRowTemplate
|
|
29
|
+
const PinnedRowTemplate = (props: GridProps<ITestRow>) => {
|
|
56
30
|
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
57
31
|
() => [
|
|
58
32
|
GridCell({
|
|
@@ -95,5 +69,37 @@ const PinnedRowTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITes
|
|
|
95
69
|
</GridWrapper>
|
|
96
70
|
);
|
|
97
71
|
};
|
|
98
|
-
|
|
99
|
-
|
|
72
|
+
const meta: Meta<typeof PinnedRowTemplate> = {
|
|
73
|
+
title: 'Components / Grids',
|
|
74
|
+
component: PinnedRowTemplate,
|
|
75
|
+
args: {
|
|
76
|
+
selectable: false,
|
|
77
|
+
},
|
|
78
|
+
// Storybook hangs otherwise
|
|
79
|
+
parameters: {
|
|
80
|
+
docs: {
|
|
81
|
+
source: {
|
|
82
|
+
type: 'code',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
decorators: [
|
|
87
|
+
(Story) => (
|
|
88
|
+
<div style={{ width: 1024, height: 260, display: 'flex', flexDirection: 'column' }}>
|
|
89
|
+
<GridUpdatingContextProvider>
|
|
90
|
+
<GridContextProvider>
|
|
91
|
+
<Story />
|
|
92
|
+
</GridContextProvider>
|
|
93
|
+
</GridUpdatingContextProvider>
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
withOpenInPanelDecorator,
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
export default meta;
|
|
100
|
+
|
|
101
|
+
type Story = StoryObj<typeof meta>;
|
|
102
|
+
|
|
103
|
+
export const PinnedRow: Story = {
|
|
104
|
+
play: waitForGridReady,
|
|
105
|
+
};
|