@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,27 +1,15 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
2
|
import { expect } from 'storybook/test';
|
|
5
3
|
import * as test from 'storybook/test';
|
|
6
4
|
import { userEvent, within } from 'storybook/test';
|
|
7
5
|
|
|
8
|
-
import { Grid } from '../../components/Grid';
|
|
9
6
|
import { Menu, MenuButton, MenuDivider, MenuItem, SubMenu } from '../../react-menu3';
|
|
10
7
|
import { wait } from '../../utils/util';
|
|
11
8
|
|
|
12
|
-
export default {
|
|
13
|
-
title: 'Components / React-menu',
|
|
14
|
-
component: Grid,
|
|
15
|
-
args: {
|
|
16
|
-
externalSelectedItems: [],
|
|
17
|
-
setExternalSelectedItems: () => {},
|
|
18
|
-
},
|
|
19
|
-
} as Meta<typeof Grid>;
|
|
20
|
-
|
|
21
9
|
const menuItemClickAction = test.fn();
|
|
22
10
|
const newFileAction = test.fn();
|
|
23
11
|
|
|
24
|
-
const ReactMenuTemplate
|
|
12
|
+
const ReactMenuTemplate = () => {
|
|
25
13
|
return (
|
|
26
14
|
<>
|
|
27
15
|
<Menu menuButton={<MenuButton>Open menu</MenuButton>} onItemClick={menuItemClickAction}>
|
|
@@ -40,63 +28,72 @@ const ReactMenuTemplate: StoryFn<typeof Grid> = () => {
|
|
|
40
28
|
);
|
|
41
29
|
};
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
31
|
+
const meta: Meta<typeof ReactMenuTemplate> = {
|
|
32
|
+
title: 'Components / React-menu',
|
|
33
|
+
component: ReactMenuTemplate,
|
|
34
|
+
};
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const ReactMenuControlled: Story = {
|
|
40
|
+
play: async ({ canvasElement }) => {
|
|
41
|
+
const canvas = within(canvasElement);
|
|
42
|
+
|
|
43
|
+
const keyboard = async (key: string) => {
|
|
44
|
+
await userEvent.keyboard(key);
|
|
45
|
+
await wait(100); // Wait for debounce
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const menuButton = await canvas.findByRole('button');
|
|
49
|
+
await expect(menuButton).toBeInTheDocument();
|
|
50
|
+
|
|
51
|
+
const openMenu = async () => {
|
|
52
|
+
await wait(500); // Wait for debounce
|
|
53
|
+
await userEvent.click(menuButton);
|
|
54
|
+
await expect(await canvas.findByRole('menuitem', { name: 'New File' })).toBeInTheDocument();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Check menu closes on click outside
|
|
58
|
+
await openMenu();
|
|
59
|
+
await userEvent.click(menuButton.parentElement as Element);
|
|
60
|
+
await expect(canvas.queryByRole('menuitem', { name: 'New File' })).not.toBeInTheDocument();
|
|
61
|
+
|
|
62
|
+
// Test arrow down/up
|
|
63
|
+
await openMenu();
|
|
64
|
+
await keyboard('{arrowdown}');
|
|
65
|
+
await keyboard('{arrowdown}');
|
|
66
|
+
await keyboard('{arrowdown}');
|
|
67
|
+
await keyboard('{arrowdown}');
|
|
68
|
+
await keyboard('{arrowdown}');
|
|
69
|
+
await expect(document.activeElement?.innerHTML).toBe('Exit');
|
|
70
|
+
|
|
71
|
+
await keyboard('{arrowup}');
|
|
72
|
+
await expect(document.activeElement?.innerHTML).toBe('Print...');
|
|
73
|
+
|
|
74
|
+
// Escape close
|
|
75
|
+
await userEvent.type(menuButton.parentElement as Element, '{Escape}');
|
|
76
|
+
await expect(canvas.queryByRole('menuitem', { name: 'New File' })).not.toBeInTheDocument();
|
|
77
|
+
|
|
78
|
+
// Test enter to select
|
|
79
|
+
await openMenu();
|
|
80
|
+
await keyboard('{arrowdown}');
|
|
81
|
+
await keyboard('{enter}');
|
|
82
|
+
await expect(menuItemClickAction).toHaveBeenCalled();
|
|
83
|
+
await expect(newFileAction).toHaveBeenCalled();
|
|
84
|
+
|
|
85
|
+
menuItemClickAction.mockClear();
|
|
86
|
+
newFileAction.mockClear();
|
|
87
|
+
|
|
88
|
+
// Test tab to select
|
|
89
|
+
await openMenu();
|
|
90
|
+
await keyboard('{arrowdown}');
|
|
91
|
+
// For some reason arrow down takes a little time to activate
|
|
92
|
+
await wait(10);
|
|
93
|
+
await keyboard('{Tab}');
|
|
94
|
+
await expect(menuItemClickAction).toHaveBeenCalled();
|
|
95
|
+
await expect(newFileAction).toHaveBeenCalled();
|
|
96
|
+
|
|
97
|
+
newFileAction.mockClear();
|
|
98
|
+
},
|
|
102
99
|
};
|
|
@@ -21,7 +21,7 @@ const startSharedInterval = () => {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
}, 100);
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
|
|
26
26
|
const stopSharedInterval = () => {
|
|
27
27
|
if (sharedIntervalId === null) {
|
|
@@ -29,7 +29,7 @@ const stopSharedInterval = () => {
|
|
|
29
29
|
}
|
|
30
30
|
clearInterval(sharedIntervalId);
|
|
31
31
|
sharedIntervalId = null;
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Like useInterval, but all callers share a single 100ms interval.
|
|
@@ -54,4 +54,4 @@ export const useSharedInterval = (callback: () => void) => {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}, []);
|
|
57
|
-
}
|
|
57
|
+
};
|