@linzjs/step-ag-grid 32.7.0 → 33.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/gridFilter/GridFilterColumnsMultiSelect.d.ts +6 -25
- package/dist/step-ag-grid.cjs +115 -181
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +115 -181
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +17 -17
- package/src/components/Grid.tsx +6 -4
- package/src/components/gridFilter/GridFilterColumnsMultiSelect.tsx +110 -199
- package/src/components/gridHook/useGridRangeSelection.ts +8 -6
- package/src/react-menu3/components/ControlledMenu.tsx +5 -3
- package/src/react-menu3/components/MenuList.tsx +6 -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 +42 -35
- 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 +81 -79
- 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/useSharedInterval.ts +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LuiMessagingContextProvider } from '@linzjs/lui';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
2
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-vite';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -19,38 +19,7 @@ import { GridFilterColumnsToggle, GridFilterDownloadCsvButton } from '../../comp
|
|
|
19
19
|
import { GridCellFiller } from '../../components/GridCellFiller';
|
|
20
20
|
import { SeededRandomForTests } from '../../utils/__tests__/random';
|
|
21
21
|
import { waitForGridReady } from '../../utils/__tests__/storybookTestUtil';
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
title: 'Components / Grids',
|
|
25
|
-
component: Grid,
|
|
26
|
-
args: {
|
|
27
|
-
quickFilter: true,
|
|
28
|
-
quickFilterValue: '',
|
|
29
|
-
quickFilterPlaceholder: 'Quick filter...',
|
|
30
|
-
selectable: false,
|
|
31
|
-
rowSelection: 'multiple',
|
|
32
|
-
}, // Storybook hangs otherwise
|
|
33
|
-
parameters: {
|
|
34
|
-
docs: {
|
|
35
|
-
source: {
|
|
36
|
-
type: 'code',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
decorators: [
|
|
41
|
-
(Story) => (
|
|
42
|
-
<LuiMessagingContextProvider version="v2">
|
|
43
|
-
<div style={{ width: 1024, height: '80vh', display: 'flex', flexDirection: 'column' }}>
|
|
44
|
-
<GridUpdatingContextProvider>
|
|
45
|
-
<GridContextProvider>
|
|
46
|
-
<Story />
|
|
47
|
-
</GridContextProvider>
|
|
48
|
-
</GridUpdatingContextProvider>
|
|
49
|
-
</div>
|
|
50
|
-
</LuiMessagingContextProvider>
|
|
51
|
-
),
|
|
52
|
-
],
|
|
53
|
-
} as Meta<typeof Grid>;
|
|
22
|
+
import { withOpenInPanelDecorator } from '../decorators/withOpenInPanelDecorator';
|
|
54
23
|
|
|
55
24
|
interface ITestRow {
|
|
56
25
|
id: number;
|
|
@@ -155,5 +124,39 @@ const GridCopyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITest
|
|
|
155
124
|
);
|
|
156
125
|
};
|
|
157
126
|
|
|
158
|
-
|
|
159
|
-
|
|
127
|
+
const meta: Meta<typeof GridCopyTemplate> = {
|
|
128
|
+
title: 'Components / Grids',
|
|
129
|
+
component: GridCopyTemplate,
|
|
130
|
+
args: {
|
|
131
|
+
selectable: false,
|
|
132
|
+
rowSelection: 'multiple',
|
|
133
|
+
}, // Storybook hangs otherwise
|
|
134
|
+
parameters: {
|
|
135
|
+
docs: {
|
|
136
|
+
source: {
|
|
137
|
+
type: 'code',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
decorators: [
|
|
142
|
+
(Story) => (
|
|
143
|
+
<LuiMessagingContextProvider version="v2">
|
|
144
|
+
<div style={{ width: 1024, height: '80vh', display: 'flex', flexDirection: 'column' }}>
|
|
145
|
+
<GridUpdatingContextProvider>
|
|
146
|
+
<GridContextProvider>
|
|
147
|
+
<Story />
|
|
148
|
+
</GridContextProvider>
|
|
149
|
+
</GridUpdatingContextProvider>
|
|
150
|
+
</div>
|
|
151
|
+
</LuiMessagingContextProvider>
|
|
152
|
+
),
|
|
153
|
+
withOpenInPanelDecorator,
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
export default meta;
|
|
157
|
+
|
|
158
|
+
type Story = StoryObj<typeof meta>;
|
|
159
|
+
|
|
160
|
+
export const GridCopy: Story = {
|
|
161
|
+
play: waitForGridReady,
|
|
162
|
+
};
|
|
@@ -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[]>([]);
|
|
@@ -166,8 +147,32 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
166
147
|
);
|
|
167
148
|
};
|
|
168
149
|
|
|
169
|
-
|
|
170
|
-
|
|
150
|
+
const meta: Meta<typeof GridInlineTextTemplate> = {
|
|
151
|
+
title: 'Components / Grids',
|
|
152
|
+
component: GridInlineTextTemplate,
|
|
153
|
+
args: {
|
|
154
|
+
selectable: true,
|
|
155
|
+
},
|
|
156
|
+
decorators: [
|
|
157
|
+
(Story) => (
|
|
158
|
+
<div style={{ width: 1024, height: 400 }}>
|
|
159
|
+
<GridUpdatingContextProvider>
|
|
160
|
+
<GridContextProvider>
|
|
161
|
+
<Story />
|
|
162
|
+
</GridContextProvider>
|
|
163
|
+
</GridUpdatingContextProvider>
|
|
164
|
+
</div>
|
|
165
|
+
),
|
|
166
|
+
withOpenInPanelDecorator,
|
|
167
|
+
],
|
|
168
|
+
};
|
|
169
|
+
export default meta;
|
|
170
|
+
|
|
171
|
+
type Story = StoryObj<typeof meta>;
|
|
172
|
+
|
|
173
|
+
export const _EditInlineText: Story = {
|
|
174
|
+
play: waitForGridReady,
|
|
175
|
+
};
|
|
171
176
|
|
|
172
177
|
const InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
|
|
173
178
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
@@ -246,16 +251,18 @@ const InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (pro
|
|
|
246
251
|
);
|
|
247
252
|
};
|
|
248
253
|
|
|
249
|
-
export const _InlineText_ChangeEvents =
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
export const _InlineText_ChangeEvents: Story = {
|
|
255
|
+
render: InlineText_ChangeEventsTemplate,
|
|
256
|
+
play: async ({ canvasElement }) => {
|
|
257
|
+
await waitForGridReady({ canvasElement });
|
|
258
|
+
const canvas = within(canvasElement);
|
|
259
|
+
const saveButtons = canvas.getAllByTestId('inline-edit-save');
|
|
260
|
+
const saveButton = saveButtons[0];
|
|
261
|
+
await expect(saveButton).toBeDisabled();
|
|
262
|
+
const textCells = canvas.getAllByText('a text1');
|
|
263
|
+
await userEvent.click(textCells[0]);
|
|
264
|
+
const input = await screen.findByPlaceholderText('Enter some text...');
|
|
265
|
+
await userEvent.type(input, 'X');
|
|
266
|
+
await expect(saveButton).toBeEnabled();
|
|
267
|
+
},
|
|
261
268
|
};
|
|
@@ -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
|
+
};
|