@linzjs/step-ag-grid 30.4.4 → 31.2.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/GridTheme.scss +12 -7
- package/dist/index.css +6 -3
- package/dist/src/components/gridDragUtil.d.ts +10 -0
- package/dist/src/components/gridDragUtil.test.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/types.d.ts +4 -0
- package/dist/src/utils/__tests__/testQuick.ts +7 -7
- package/dist/src/utils/__tests__/testUtil.ts +3 -1
- package/dist/src/utils/__tests__/vitestUtil.ts +3 -1
- package/dist/src/utils/storybook.d.ts +4 -0
- package/dist/src/utils/useInterval.d.ts +17 -0
- package/dist/src/utils/useIsomorphicLayoutEffect.d.ts +17 -0
- package/dist/step-ag-grid.cjs +402 -218
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +402 -219
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +26 -52
- package/src/components/Grid.tsx +75 -8
- package/src/components/PostSortRowsHook.ts +3 -1
- package/src/components/gridDragUtil.test.ts +115 -0
- package/src/components/gridDragUtil.ts +32 -0
- package/src/components/gridFilter/GridFilterColumnsMultiSelect.scss +18 -20
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +3 -4
- package/src/components/gridFilter/useGridFilter.ts +2 -2
- package/src/components/gridForm/GridFormDropDown.tsx +1 -1
- package/src/components/gridForm/GridFormInlineTextInput.tsx +1 -2
- package/src/components/gridForm/GridFormMultiSelect.tsx +10 -4
- package/src/components/gridForm/GridFormSubComponentTextArea.tsx +1 -2
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +1 -2
- package/src/components/gridForm/GridFormTextArea.tsx +1 -2
- package/src/components/gridForm/GridFormTextInput.tsx +1 -2
- package/src/components/gridHeader/GridHeaderSelect.tsx +3 -1
- package/src/components/gridHook/useGridCopy.ts +13 -3
- package/src/components/gridHook/useGridRangeSelection.ts +29 -16
- package/src/components/index.ts +1 -0
- package/src/components/types.ts +4 -0
- package/src/contexts/GridContextProvider.tsx +18 -7
- package/src/lui/ActionButton.scss +1 -1
- package/src/lui/ActionButton.tsx +5 -1
- package/src/lui/FormError.scss +1 -1
- package/src/lui/TextAreaInput.tsx +1 -1
- package/src/lui/TextInputFormatted.scss +13 -13
- package/src/lui/TextInputFormatted.tsx +1 -1
- package/src/react-menu3/README.md +66 -67
- package/src/react-menu3/components/ControlledMenu.tsx +2 -2
- package/src/react-menu3/components/Menu.tsx +1 -1
- package/src/react-menu3/components/MenuItem.tsx +1 -1
- package/src/react-menu3/components/MenuList.tsx +8 -2
- package/src/react-menu3/components/SubMenu.tsx +6 -6
- package/src/react-menu3/hooks/useBEM.ts +2 -1
- package/src/react-menu3/hooks/useItemState.ts +8 -4
- package/src/react-menu3/styles/_var.scss +1 -1
- package/src/react-menu3/styles/core.scss +6 -6
- package/src/react-menu3/styles/index.scss +11 -8
- package/src/react-menu3/styles/theme-dark.scss +1 -1
- package/src/react-menu3/styles/transitions/slide.scss +8 -8
- package/src/react-menu3/utils/utils.ts +2 -1
- package/src/stories/grid/FormTest.scss +13 -13
- package/src/stories/grid/GridDragRow.stories.tsx +61 -8
- package/src/stories/grid/GridInlineText.stories.tsx +2 -2
- package/src/stories/grid/GridSorting.stories.tsx +6 -2
- package/src/styles/ComponentLoadingWrapper.scss +1 -1
- package/src/styles/ContextMenu.scss +1 -1
- package/src/styles/Grid.scss +11 -9
- package/src/styles/GridCell.scss +1 -1
- package/src/styles/GridFilterColumnsToggle.scss +1 -1
- package/src/styles/GridFormInlineTextInput.scss +7 -7
- package/src/styles/GridFormMultiSelectGrid.scss +1 -1
- package/src/styles/GridFormSubComponentTextInput.scss +4 -4
- package/src/styles/GridIcon.scss +1 -1
- package/src/styles/GridPopoverMenu.scss +1 -1
- package/src/styles/GridTheme.scss +12 -7
- package/src/styles/index.scss +16 -16
- package/src/styles/react-menu-customisations.scss +119 -120
- package/src/utils/__tests__/testQuick.ts +7 -7
- package/src/utils/__tests__/testUtil.ts +3 -1
- package/src/utils/__tests__/vitestUtil.ts +3 -1
- package/src/utils/deferredPromise.ts +1 -1
- package/src/utils/storybook.ts +5 -0
- package/src/utils/useInterval.ts +44 -0
- package/src/utils/useIsomorphicLayoutEffect.ts +18 -0
|
@@ -1,120 +1,119 @@
|
|
|
1
|
-
@use
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Here is where we can override the styles of react-menu
|
|
5
|
-
*/
|
|
6
|
-
.step-ag-grid-react-menu.szh-menu {
|
|
7
|
-
z-index: 900;
|
|
8
|
-
color: lui.$base-type-color;
|
|
9
|
-
@include lui.font-regular();
|
|
10
|
-
|
|
11
|
-
div,
|
|
12
|
-
a[role=
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
color: lui.$base-type-color;
|
|
15
|
-
@include lui.font-regular();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
li[role=
|
|
19
|
-
background-color: lui.$polar;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.szh-menu__header {
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Here are styles for lui select menu
|
|
30
|
-
*/
|
|
31
|
-
.lui-select-menu.szh-menu {
|
|
32
|
-
z-index: 900;
|
|
33
|
-
width: 92vw;
|
|
34
|
-
overflow-y: scroll;
|
|
35
|
-
|
|
36
|
-
color: lui.$base-type-color;
|
|
37
|
-
@include lui.font-light();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.lui-select-menuItem {
|
|
41
|
-
padding: lui.$unit-xs lui.$unit-sm lui.$unit-xs lui.$unit-xs;
|
|
42
|
-
display: flex;
|
|
43
|
-
line-height: 1;
|
|
44
|
-
transition: all 0.2s ease-in-out;
|
|
45
|
-
fill: lui.$fuscous;
|
|
46
|
-
|
|
47
|
-
&:hover {
|
|
48
|
-
background-color: lui.$polar;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.lui-select-menuItem--error {
|
|
53
|
-
p {
|
|
54
|
-
color: lui.$error;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.LuiIcon {
|
|
58
|
-
fill: lui.$error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.lui-select-menuItemText {
|
|
63
|
-
@include lui.font-regular();
|
|
64
|
-
color: lui.$charcoal;
|
|
65
|
-
margin: 0;
|
|
66
|
-
padding-left: lui.$unit-lg;
|
|
67
|
-
|
|
68
|
-
// if no icon, give it 4px to align with the group header
|
|
69
|
-
&--noPadding {
|
|
70
|
-
padding-left: lui.$unit-xxs;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.lui-select-icon + .lui-select-menuItemText {
|
|
75
|
-
padding-left: lui.$unit-xs;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.lui-select-menu-group {
|
|
79
|
-
height: 32px;
|
|
80
|
-
color: lui.$fuscous;
|
|
81
|
-
padding-left: 0.75rem;
|
|
82
|
-
text-transform: none;
|
|
83
|
-
@include lui.font-semibold();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.lui-select-submenu {
|
|
87
|
-
flex: 1;
|
|
88
|
-
|
|
89
|
-
div[role=
|
|
90
|
-
padding: lui.$unit-xs lui.$unit-xs lui.$unit-xs 2.5rem;
|
|
91
|
-
text-decoration: none;
|
|
92
|
-
@include lui.font-regular();
|
|
93
|
-
height: 40px;
|
|
94
|
-
}
|
|
95
|
-
// overwrite the hover color
|
|
96
|
-
.szh-menu__item--hover {
|
|
97
|
-
background-color: lui.$polar;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.lui-select-submenu-with-icon {
|
|
102
|
-
flex: 1;
|
|
103
|
-
// width: 200px;
|
|
104
|
-
div[role=
|
|
105
|
-
padding-left: 0;
|
|
106
|
-
text-decoration: none;
|
|
107
|
-
@include lui.font-regular();
|
|
108
|
-
height: 40px;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.lui-select-divider {
|
|
113
|
-
margin: 0.25rem;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
1
|
+
@use '../../node_modules/@linzjs/lui/dist/scss/Core' as lui;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Here is where we can override the styles of react-menu
|
|
5
|
+
*/
|
|
6
|
+
.step-ag-grid-react-menu.szh-menu {
|
|
7
|
+
z-index: 900;
|
|
8
|
+
color: lui.$base-type-color;
|
|
9
|
+
@include lui.font-regular();
|
|
10
|
+
|
|
11
|
+
div,
|
|
12
|
+
a[role='menuitem'] {
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
color: lui.$base-type-color;
|
|
15
|
+
@include lui.font-regular();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
li[role='menuitem']:not(.szh-menu__item--disabled):hover {
|
|
19
|
+
background-color: lui.$polar;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.szh-menu__header {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Here are styles for lui select menu
|
|
30
|
+
*/
|
|
31
|
+
.lui-select-menu.szh-menu {
|
|
32
|
+
z-index: 900;
|
|
33
|
+
width: 92vw;
|
|
34
|
+
overflow-y: scroll;
|
|
35
|
+
|
|
36
|
+
color: lui.$base-type-color;
|
|
37
|
+
@include lui.font-light();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.lui-select-menuItem {
|
|
41
|
+
padding: lui.$unit-xs lui.$unit-sm lui.$unit-xs lui.$unit-xs;
|
|
42
|
+
display: flex;
|
|
43
|
+
line-height: 1;
|
|
44
|
+
transition: all 0.2s ease-in-out;
|
|
45
|
+
fill: lui.$fuscous;
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
background-color: lui.$polar;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.lui-select-menuItem--error {
|
|
53
|
+
p {
|
|
54
|
+
color: lui.$error;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.LuiIcon {
|
|
58
|
+
fill: lui.$error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.lui-select-menuItemText {
|
|
63
|
+
@include lui.font-regular();
|
|
64
|
+
color: lui.$charcoal;
|
|
65
|
+
margin: 0;
|
|
66
|
+
padding-left: lui.$unit-lg;
|
|
67
|
+
|
|
68
|
+
// if no icon, give it 4px to align with the group header
|
|
69
|
+
&--noPadding {
|
|
70
|
+
padding-left: lui.$unit-xxs;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.lui-select-icon + .lui-select-menuItemText {
|
|
75
|
+
padding-left: lui.$unit-xs;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.lui-select-menu-group {
|
|
79
|
+
height: 32px;
|
|
80
|
+
color: lui.$fuscous;
|
|
81
|
+
padding-left: 0.75rem;
|
|
82
|
+
text-transform: none;
|
|
83
|
+
@include lui.font-semibold();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.lui-select-submenu {
|
|
87
|
+
flex: 1;
|
|
88
|
+
|
|
89
|
+
div[role='menuitem'] {
|
|
90
|
+
padding: lui.$unit-xs lui.$unit-xs lui.$unit-xs 2.5rem;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
@include lui.font-regular();
|
|
93
|
+
height: 40px;
|
|
94
|
+
}
|
|
95
|
+
// overwrite the hover color
|
|
96
|
+
.szh-menu__item--hover {
|
|
97
|
+
background-color: lui.$polar;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.lui-select-submenu-with-icon {
|
|
102
|
+
flex: 1;
|
|
103
|
+
// width: 200px;
|
|
104
|
+
div[role='menuitem'] {
|
|
105
|
+
padding-left: 0;
|
|
106
|
+
text-decoration: none;
|
|
107
|
+
@include lui.font-regular();
|
|
108
|
+
height: 40px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.lui-select-divider {
|
|
113
|
+
margin: 0.25rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.step-ag-grid-react-menu-sub-header-icon {
|
|
117
|
+
margin: lui.$unit-xs;
|
|
118
|
+
fill: lui.$fuscous;
|
|
119
|
+
}
|
|
@@ -52,13 +52,13 @@ const quickSelector = <T extends HTMLElement>(
|
|
|
52
52
|
let lastIQueryQuick = props;
|
|
53
53
|
for (let loop: IQueryQuick | undefined = props; loop; loop = loop.child) {
|
|
54
54
|
lastIQueryQuick = loop;
|
|
55
|
-
loop.selector
|
|
56
|
-
loop.tagName
|
|
57
|
-
loop.ariaLabel
|
|
58
|
-
loop.role
|
|
59
|
-
loop.testId
|
|
60
|
-
loop.icon
|
|
61
|
-
loop.classes
|
|
55
|
+
if (loop.selector) selector += loop.selector;
|
|
56
|
+
if (loop.tagName) selector += loop.tagName;
|
|
57
|
+
if (loop.ariaLabel) selector += `[aria-label='${escapeSelectorParam(loop.ariaLabel)}']`;
|
|
58
|
+
if (loop.role) selector += `[role="${escapeSelectorParam(loop.role)}"]`;
|
|
59
|
+
if (loop.testId) selector += `[data-testid="${escapeSelectorParam(loop.testId)}"]`;
|
|
60
|
+
if (loop.icon) selector += `[data-icon='${loop.icon}']`;
|
|
61
|
+
if (loop.classes) selector += loop.classes;
|
|
62
62
|
selector += ' ';
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -259,7 +259,9 @@ export const findMultiSelectOption = async (value: string): Promise<HTMLElement>
|
|
|
259
259
|
|
|
260
260
|
export const clickMultiSelectOption = async (value: string): Promise<void> => {
|
|
261
261
|
const menuItem = await findMultiSelectOption(value);
|
|
262
|
-
|
|
262
|
+
if (menuItem.parentElement) {
|
|
263
|
+
await user.click(menuItem.parentElement);
|
|
264
|
+
}
|
|
263
265
|
};
|
|
264
266
|
|
|
265
267
|
const typeInput = async (value: string, filter: IQueryQuick): Promise<void> => {
|
|
@@ -260,7 +260,9 @@ export const findMultiSelectOption = async (value: string): Promise<HTMLElement>
|
|
|
260
260
|
|
|
261
261
|
export const clickMultiSelectOption = async (value: string): Promise<void> => {
|
|
262
262
|
const menuItem = await findMultiSelectOption(value);
|
|
263
|
-
|
|
263
|
+
if (menuItem.parentElement) {
|
|
264
|
+
await user.click(menuItem.parentElement);
|
|
265
|
+
}
|
|
264
266
|
};
|
|
265
267
|
|
|
266
268
|
const typeInput = async (value: string, filter: IQueryQuick): Promise<void> => {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from 'usehooks-ts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Copied from usehooks-ts
|
|
6
|
+
*
|
|
7
|
+
* Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).
|
|
8
|
+
* @param {() => void} callback - The function to be invoked at each interval.
|
|
9
|
+
* @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.
|
|
10
|
+
* @public
|
|
11
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const handleInterval = () => {
|
|
15
|
+
* // Code to be executed at each interval
|
|
16
|
+
* };
|
|
17
|
+
* useInterval(handleInterval, 1000);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function useInterval(callback: () => void, delay: number | null) {
|
|
21
|
+
const savedCallback = useRef(callback);
|
|
22
|
+
|
|
23
|
+
// Remember the latest callback if it changes.
|
|
24
|
+
useIsomorphicLayoutEffect(() => {
|
|
25
|
+
savedCallback.current = callback;
|
|
26
|
+
}, [callback]);
|
|
27
|
+
|
|
28
|
+
// Set up the interval.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
// Don't schedule if no delay is specified.
|
|
31
|
+
// Note: 0 is a valid value for delay.
|
|
32
|
+
if (delay === null) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const id = setInterval(() => {
|
|
37
|
+
savedCallback.current();
|
|
38
|
+
}, delay);
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
clearInterval(id);
|
|
42
|
+
};
|
|
43
|
+
}, [delay]);
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copied from usehooks-ts
|
|
5
|
+
*
|
|
6
|
+
* Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
|
|
7
|
+
* @param {Function} effect - The effect function to be executed.
|
|
8
|
+
* @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
|
|
9
|
+
* @public
|
|
10
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* useIsomorphicLayoutEffect(() => {
|
|
14
|
+
* // Code to be executed during the layout phase on the client side
|
|
15
|
+
* }, [dependency1, dependency2]);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|