@linzjs/step-ag-grid 30.4.3 → 31.1.1
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/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 +310 -214
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +310 -214
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +26 -52
- package/src/components/Grid.tsx +6 -3
- package/src/components/PostSortRowsHook.ts +3 -1
- 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/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/GridInlineText.stories.tsx +2 -2
- package/src/stories/grid/GridSorting.stories.tsx +6 -2
- package/src/stories/grid/GridViewSelectableList.stories.tsx +121 -0
- 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,13 +1,13 @@
|
|
|
1
|
-
@use
|
|
2
|
-
|
|
3
|
-
.LuiTextInput.GridLuiTextInput {
|
|
4
|
-
margin-bottom: 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.LuiTextInput-formatted {
|
|
8
|
-
position: absolute;
|
|
9
|
-
right: 14px;
|
|
10
|
-
top: 0;
|
|
11
|
-
line-height: 48px;
|
|
12
|
-
color: lui.$fuscous;
|
|
13
|
-
}
|
|
1
|
+
@use '../../node_modules/@linzjs/lui/dist/scss/Core' as lui;
|
|
2
|
+
|
|
3
|
+
.LuiTextInput.GridLuiTextInput {
|
|
4
|
+
margin-bottom: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.LuiTextInput-formatted {
|
|
8
|
+
position: absolute;
|
|
9
|
+
right: 14px;
|
|
10
|
+
top: 0;
|
|
11
|
+
line-height: 48px;
|
|
12
|
+
color: lui.$fuscous;
|
|
13
|
+
}
|
|
@@ -36,7 +36,7 @@ export const TextInputFormatted = (props: LuiTextInputProps): ReactElement => {
|
|
|
36
36
|
className={'LuiTextInput-input'}
|
|
37
37
|
onMouseEnter={(e) => {
|
|
38
38
|
e.currentTarget.focus();
|
|
39
|
-
props.onMouseEnter
|
|
39
|
+
props.onMouseEnter?.(e);
|
|
40
40
|
}}
|
|
41
41
|
data-allowtabtosave={props.allowTabToSave}
|
|
42
42
|
/>
|
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
# React-Menu
|
|
2
|
-
|
|
3
|
-
> This is a fork of @szhsin/react-menu. v3.2.0
|
|
4
|
-
|
|
5
|
-
> An accessible and keyboard-friendly React menu library.
|
|
6
|
-
|
|
7
|
-
**[Live examples and docs](https://szhsin.github.io/react-menu/)**
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- React menu components for easy and fast web development.
|
|
12
|
-
- Unlimited levels of submenu.
|
|
13
|
-
- Supports dropdown or context menu.
|
|
14
|
-
- Supports radio and checkbox menu items.
|
|
15
|
-
- Flexible menu positioning.
|
|
16
|
-
- Comprehensive keyboard interactions.
|
|
17
|
-
- Unstyled components and easy [customisation](https://szhsin.github.io/react-menu/#styling).
|
|
18
|
-
- [Optimal level support](https://github.com/reactwg/react-18/discussions/70) (level 3) of **React 18** concurrent rendering.
|
|
19
|
-
- Works in major browsers without polyfills.
|
|
20
|
-
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) compliant.
|
|
21
|
-
|
|
22
|
-
## Install
|
|
23
|
-
|
|
24
|
-
with npm
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm install @szhsin/react-menu
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
or with Yarn
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
yarn add @szhsin/react-menu
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
```jsx
|
|
39
|
-
import { Menu, MenuItem, MenuButton, SubMenu } from
|
|
40
|
-
|
|
41
|
-
export default function App() {
|
|
42
|
-
return (
|
|
43
|
-
<Menu menuButton={<MenuButton>Open menu</MenuButton>}>
|
|
44
|
-
<MenuItem>New File</MenuItem>
|
|
45
|
-
<MenuItem>Save</MenuItem>
|
|
46
|
-
<SubMenu label="Edit">
|
|
47
|
-
<MenuItem>Cut</MenuItem>
|
|
48
|
-
<MenuItem>Copy</MenuItem>
|
|
49
|
-
<MenuItem>Paste</MenuItem>
|
|
50
|
-
</SubMenu>
|
|
51
|
-
<MenuItem>Print...</MenuItem>
|
|
52
|
-
</Menu>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
**[Edit on CodeSandbox](https://codesandbox.io/s/react-menu-starter-3ez3c)**<br>
|
|
58
|
-
**[Visit more examples and docs](https://szhsin.github.io/react-menu/)**<br><br>
|
|
59
|
-
[Migration from v2 to v3](https://github.com/szhsin/react-menu/wiki/Migration-from-v2-to-v3)<br>
|
|
60
|
-
[Migration from v1 to v2](https://github.com/szhsin/react-menu/wiki/Migration-from-v1-to-v2)
|
|
61
|
-
|
|
62
|
-
_Please note that React-Menu v3 requires React 16.14.0 or higher. If you are not able to upgrade React, you could install v2/v1 which requires React 16.8.0._
|
|
63
|
-
|
|
64
|
-
## License
|
|
65
|
-
|
|
66
|
-
[MIT](https://github.com/szhsin/react-menu/blob/master/LICENSE) Licensed.
|
|
67
|
-
|
|
1
|
+
# React-Menu
|
|
2
|
+
|
|
3
|
+
> This is a fork of @szhsin/react-menu. v3.2.0
|
|
4
|
+
|
|
5
|
+
> An accessible and keyboard-friendly React menu library.
|
|
6
|
+
|
|
7
|
+
**[Live examples and docs](https://szhsin.github.io/react-menu/)**
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- React menu components for easy and fast web development.
|
|
12
|
+
- Unlimited levels of submenu.
|
|
13
|
+
- Supports dropdown or context menu.
|
|
14
|
+
- Supports radio and checkbox menu items.
|
|
15
|
+
- Flexible menu positioning.
|
|
16
|
+
- Comprehensive keyboard interactions.
|
|
17
|
+
- Unstyled components and easy [customisation](https://szhsin.github.io/react-menu/#styling).
|
|
18
|
+
- [Optimal level support](https://github.com/reactwg/react-18/discussions/70) (level 3) of **React 18** concurrent rendering.
|
|
19
|
+
- Works in major browsers without polyfills.
|
|
20
|
+
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) compliant.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
with npm
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @szhsin/react-menu
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
or with Yarn
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
yarn add @szhsin/react-menu
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
import { Menu, MenuItem, MenuButton, SubMenu } from '@szhsin/react-menu';
|
|
40
|
+
|
|
41
|
+
export default function App() {
|
|
42
|
+
return (
|
|
43
|
+
<Menu menuButton={<MenuButton>Open menu</MenuButton>}>
|
|
44
|
+
<MenuItem>New File</MenuItem>
|
|
45
|
+
<MenuItem>Save</MenuItem>
|
|
46
|
+
<SubMenu label="Edit">
|
|
47
|
+
<MenuItem>Cut</MenuItem>
|
|
48
|
+
<MenuItem>Copy</MenuItem>
|
|
49
|
+
<MenuItem>Paste</MenuItem>
|
|
50
|
+
</SubMenu>
|
|
51
|
+
<MenuItem>Print...</MenuItem>
|
|
52
|
+
</Menu>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**[Edit on CodeSandbox](https://codesandbox.io/s/react-menu-starter-3ez3c)**<br>
|
|
58
|
+
**[Visit more examples and docs](https://szhsin.github.io/react-menu/)**<br><br>
|
|
59
|
+
[Migration from v2 to v3](https://github.com/szhsin/react-menu/wiki/Migration-from-v2-to-v3)<br>
|
|
60
|
+
[Migration from v1 to v2](https://github.com/szhsin/react-menu/wiki/Migration-from-v1-to-v2)
|
|
61
|
+
|
|
62
|
+
_Please note that React-Menu v3 requires React 16.14.0 or higher. If you are not able to upgrade React, you could install v2/v1 which requires React 16.8.0._
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
[MIT](https://github.com/szhsin/react-menu/blob/master/LICENSE) Licensed.
|
|
@@ -173,7 +173,7 @@ export const ControlledMenuFr = (
|
|
|
173
173
|
if (isDown) {
|
|
174
174
|
lastTabDownEl.current = activeElement;
|
|
175
175
|
} else {
|
|
176
|
-
lastTabDownEl.current == activeElement
|
|
176
|
+
if (lastTabDownEl.current == activeElement) invokeSave(tabDirection);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -191,7 +191,7 @@ export const ControlledMenuFr = (
|
|
|
191
191
|
if (isDown) {
|
|
192
192
|
lastEnterDownEl.current = activeElement;
|
|
193
193
|
} else {
|
|
194
|
-
lastEnterDownEl.current == activeElement
|
|
194
|
+
if (lastEnterDownEl.current == activeElement) invokeSave(CloseReason.CLICK);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
}
|
|
@@ -175,7 +175,9 @@ export const MenuList = ({
|
|
|
175
175
|
setOverflowData(undefined); // reset overflowData after closing
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
if (endTransition) {
|
|
179
|
+
safeCall(endTransition);
|
|
180
|
+
}
|
|
179
181
|
};
|
|
180
182
|
|
|
181
183
|
const handlePosition = useCallback(
|
|
@@ -455,7 +457,11 @@ export const MenuList = ({
|
|
|
455
457
|
let maxHeight: number | undefined;
|
|
456
458
|
let overflowAmt: number | undefined;
|
|
457
459
|
if (overflowData) {
|
|
458
|
-
|
|
460
|
+
if (setDownOverflow) {
|
|
461
|
+
overflowAmt = overflowData.overflowAmt;
|
|
462
|
+
} else {
|
|
463
|
+
maxHeight = overflowData.height;
|
|
464
|
+
}
|
|
459
465
|
}
|
|
460
466
|
|
|
461
467
|
const listContext = useMemo(
|
|
@@ -194,7 +194,7 @@ export const SubMenuFr = ({
|
|
|
194
194
|
const openMenu = (...args: any[]) => {
|
|
195
195
|
stopTimer();
|
|
196
196
|
setHover();
|
|
197
|
-
!isDisabled
|
|
197
|
+
if (!isDisabled) _openMenu(...args);
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
const setHover = () => !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, menuItemRef?.current, 0);
|
|
@@ -226,7 +226,7 @@ export const SubMenuFr = ({
|
|
|
226
226
|
// LEFT key is bubbled up from submenu items
|
|
227
227
|
case Keys.LEFT:
|
|
228
228
|
if (isOpen) {
|
|
229
|
-
menuItemRef?.current
|
|
229
|
+
menuItemRef?.current.focus();
|
|
230
230
|
toggleMenu(false);
|
|
231
231
|
handled = true;
|
|
232
232
|
}
|
|
@@ -251,7 +251,7 @@ export const SubMenuFr = ({
|
|
|
251
251
|
case Keys.ENTER:
|
|
252
252
|
case Keys.SPACE:
|
|
253
253
|
case Keys.RIGHT:
|
|
254
|
-
openTrigger !== 'none'
|
|
254
|
+
if (openTrigger !== 'none') openMenu(FocusPositions.FIRST);
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
257
|
};
|
|
@@ -264,7 +264,7 @@ export const SubMenuFr = ({
|
|
|
264
264
|
// Don't set focus when parent menu is closed, otherwise focus will be lost
|
|
265
265
|
// and onBlur event will be fired with relatedTarget setting as null.
|
|
266
266
|
if (isHovering && isParentOpen) {
|
|
267
|
-
menuItemRef?.current
|
|
267
|
+
menuItemRef?.current?.focus();
|
|
268
268
|
} else {
|
|
269
269
|
toggleMenu(false);
|
|
270
270
|
}
|
|
@@ -276,11 +276,11 @@ export const SubMenuFr = ({
|
|
|
276
276
|
|
|
277
277
|
useImperativeHandle(instanceRef, () => ({
|
|
278
278
|
openMenu: (...args) => {
|
|
279
|
-
isParentOpen
|
|
279
|
+
if (isParentOpen) openMenu(...args);
|
|
280
280
|
},
|
|
281
281
|
closeMenu: () => {
|
|
282
282
|
if (isOpen) {
|
|
283
|
-
menuItemRef?.current
|
|
283
|
+
menuItemRef?.current?.focus();
|
|
284
284
|
toggleMenu(false);
|
|
285
285
|
}
|
|
286
286
|
},
|
|
@@ -18,11 +18,12 @@ export const useBEM = ({ block, element, modifiers, className }: useBemProps) =>
|
|
|
18
18
|
const blockElement = element ? `${block}__${element}` : block;
|
|
19
19
|
|
|
20
20
|
let classString = blockElement;
|
|
21
|
-
modifiers
|
|
21
|
+
if (modifiers) {
|
|
22
22
|
Object.keys(modifiers).forEach((name) => {
|
|
23
23
|
const value = modifiers[name];
|
|
24
24
|
if (value) classString += ` ${blockElement}--${value === true ? name : `${name}-${value}`}`;
|
|
25
25
|
});
|
|
26
|
+
}
|
|
26
27
|
|
|
27
28
|
let expandedClassName = typeof className === 'function' ? className(modifiers) : className;
|
|
28
29
|
if (typeof expandedClassName === 'string') {
|
|
@@ -17,11 +17,11 @@ export const useItemState = (
|
|
|
17
17
|
const timeoutId = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
18
18
|
|
|
19
19
|
const setHover = () => {
|
|
20
|
-
!isHovering && !isDisabled
|
|
20
|
+
if (!isHovering && !isDisabled) dispatch(HoverActionTypes.SET, menuItemRef?.current, 0);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const unsetHover = () => {
|
|
24
|
-
!isDisabled
|
|
24
|
+
if (!isDisabled) dispatch(HoverActionTypes.UNSET, menuItemRef?.current, 0);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const onBlur = (e: FocusEvent) => {
|
|
@@ -48,7 +48,9 @@ export const useItemState = (
|
|
|
48
48
|
timeoutId.current = undefined;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
!keepHover
|
|
51
|
+
if (!keepHover) {
|
|
52
|
+
unsetHover();
|
|
53
|
+
}
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
useItemEffect(isDisabled, menuItemRef, updateItems);
|
|
@@ -57,7 +59,9 @@ export const useItemState = (
|
|
|
57
59
|
// Don't set focus when parent menu is closed, otherwise focus will be lost
|
|
58
60
|
// and onBlur event will be fired with relatedTarget setting as null.
|
|
59
61
|
if (isHovering && isParentOpen) {
|
|
60
|
-
focusRef?.current
|
|
62
|
+
if (focusRef?.current) {
|
|
63
|
+
focusRef.current.focus();
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
}, [focusRef, isHovering, isParentOpen]);
|
|
63
67
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use 'var';
|
|
2
|
+
@use 'mixins';
|
|
3
3
|
|
|
4
4
|
.szh-menu {
|
|
5
|
-
@include mixins.reset-list
|
|
6
|
-
@include mixins.remove-focus
|
|
5
|
+
@include mixins.reset-list();
|
|
6
|
+
@include mixins.remove-focus();
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
width: max-content;
|
|
9
9
|
z-index: 100;
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
&__item {
|
|
45
|
-
@include mixins.remove-focus
|
|
45
|
+
@include mixins.remove-focus();
|
|
46
46
|
cursor: pointer;
|
|
47
47
|
|
|
48
48
|
&--hover {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
&__radio-group {
|
|
68
|
-
@include mixins.reset-list
|
|
68
|
+
@include mixins.reset-list();
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
&__divider {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use 'var';
|
|
2
|
+
@use 'core';
|
|
3
3
|
|
|
4
4
|
.szh-menu {
|
|
5
5
|
user-select: none;
|
|
6
6
|
color: var.$color;
|
|
7
7
|
border: none;
|
|
8
8
|
border-radius: 0.25rem;
|
|
9
|
-
box-shadow:
|
|
9
|
+
box-shadow:
|
|
10
|
+
0 3px 7px rgb(0 0 0 / 13.3%),
|
|
11
|
+
0 0.6px 2px rgb(0 0 0 / 10%);
|
|
10
12
|
min-width: 10rem;
|
|
11
13
|
padding: 0.5rem 0;
|
|
12
14
|
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
padding-left: 2.2rem;
|
|
29
31
|
|
|
30
32
|
&::before {
|
|
31
|
-
content:
|
|
33
|
+
content: '\25cb';
|
|
32
34
|
position: absolute;
|
|
33
35
|
left: 0.8rem;
|
|
34
36
|
top: 0.55rem;
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
&--type-radio#{&}--checked::before {
|
|
40
|
-
content:
|
|
42
|
+
content: '\25cf';
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
&--type-checkbox {
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
&--type-checkbox#{&}--checked::before {
|
|
53
|
-
content:
|
|
55
|
+
content: '\2714';
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
padding-right: 2.5rem;
|
|
59
61
|
|
|
60
62
|
&::after {
|
|
61
|
-
content:
|
|
63
|
+
content: '\276f';
|
|
62
64
|
position: absolute;
|
|
63
65
|
right: 1rem;
|
|
64
66
|
}
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
.react-menu-inline-test .szh-menu-container,
|
|
77
|
+
.react-menu-inline-test .szh-menu-container,
|
|
78
|
+
.react-menu-inline-test .szh-menu {
|
|
76
79
|
position: static !important;
|
|
77
80
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
3
|
|
|
4
|
-
$menu:
|
|
4
|
+
$menu: 'szh-menu';
|
|
5
5
|
$duration: 0.15s;
|
|
6
6
|
$directions: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
'left': 'X' 1,
|
|
8
|
+
'right': 'X' -1,
|
|
9
|
+
'top': 'Y' 1,
|
|
10
|
+
'bottom': 'Y' -1,
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
@mixin animation($name, $dir) {
|
|
@@ -43,5 +43,5 @@ $directions: (
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
@each $dir in map.keys($directions) {
|
|
46
|
-
@include animation(
|
|
46
|
+
@include animation('slide', $dir);
|
|
47
47
|
}
|
|
@@ -34,7 +34,7 @@ export const defineName = (
|
|
|
34
34
|
) => Object.defineProperty(component, internalKey, { value: name });
|
|
35
35
|
|
|
36
36
|
export const mergeProps = (target: any, source: any) => {
|
|
37
|
-
source
|
|
37
|
+
if (source) {
|
|
38
38
|
Object.keys(source).forEach((key) => {
|
|
39
39
|
const targetProp = target[key];
|
|
40
40
|
const sourceProp = source[key];
|
|
@@ -47,6 +47,7 @@ export const mergeProps = (target: any, source: any) => {
|
|
|
47
47
|
target[key] = sourceProp;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
+
}
|
|
50
51
|
|
|
51
52
|
return target;
|
|
52
53
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
.FormTest {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
flex-wrap: nowrap;
|
|
4
|
-
gap: 12px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.FormTest .LuiTextInput {
|
|
8
|
-
margin-bottom: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.FormTest-textInput {
|
|
12
|
-
width: 100px;
|
|
13
|
-
}
|
|
1
|
+
.FormTest {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
flex-wrap: nowrap;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.FormTest .LuiTextInput {
|
|
8
|
+
margin-bottom: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.FormTest-textInput {
|
|
12
|
+
width: 100px;
|
|
13
|
+
}
|
|
@@ -174,7 +174,7 @@ const GridInlineTextTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridP
|
|
|
174
174
|
export const _EditInlineText = GridInlineTextTemplate.bind({});
|
|
175
175
|
_EditInlineText.play = waitForGridReady;
|
|
176
176
|
|
|
177
|
-
const
|
|
177
|
+
const InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (props: GridProps<IFormTestRow>) => {
|
|
178
178
|
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
179
179
|
const [isDirty, setIsDirty] = useState(false);
|
|
180
180
|
const [rowData, setRowData] = useState<IFormTestRow[]>(initialRows);
|
|
@@ -251,7 +251,7 @@ const _InlineText_ChangeEventsTemplate: StoryFn<typeof Grid<IFormTestRow>> = (pr
|
|
|
251
251
|
);
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
export const _InlineText_ChangeEvents =
|
|
254
|
+
export const _InlineText_ChangeEvents = InlineText_ChangeEventsTemplate.bind({});
|
|
255
255
|
_InlineText_ChangeEvents.play = async (context) => {
|
|
256
256
|
await waitForGridReady(context);
|
|
257
257
|
const canvas = within(context.canvasElement);
|
|
@@ -137,9 +137,13 @@ Sorting.play = async (context) => {
|
|
|
137
137
|
if (colId !== null) {
|
|
138
138
|
await clickColumnHeaderToSort(colId, canvasElement);
|
|
139
139
|
await wait(500);
|
|
140
|
-
|
|
140
|
+
if (expected) {
|
|
141
|
+
expect(gridColumnValues(colId, canvasElement)).toEqual(expected);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (idExpected) {
|
|
145
|
+
expect(gridColumnValues('id', canvasElement)).toEqual(idExpected);
|
|
141
146
|
}
|
|
142
|
-
idExpected && expect(gridColumnValues('id', canvasElement)).toEqual(idExpected);
|
|
143
147
|
};
|
|
144
148
|
|
|
145
149
|
// Default sort order
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import '../../styles/GridTheme.scss';
|
|
2
|
+
import '../../styles/index.scss';
|
|
3
|
+
import '@linzjs/lui/dist/scss/base.scss';
|
|
4
|
+
import '@linzjs/lui/dist/fonts';
|
|
5
|
+
|
|
6
|
+
import { Meta, StoryFn } from '@storybook/react-vite';
|
|
7
|
+
import { useMemo, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ColDefT,
|
|
11
|
+
Grid,
|
|
12
|
+
GridCell,
|
|
13
|
+
GridContextProvider,
|
|
14
|
+
GridProps,
|
|
15
|
+
GridUpdatingContextProvider,
|
|
16
|
+
GridWrapper,
|
|
17
|
+
} from '../..';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Components / Grids',
|
|
21
|
+
component: Grid,
|
|
22
|
+
// Storybook hangs otherwise
|
|
23
|
+
parameters: {
|
|
24
|
+
docs: {
|
|
25
|
+
source: {
|
|
26
|
+
type: 'code',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
decorators: [
|
|
31
|
+
(Story) => (
|
|
32
|
+
<div style={{ maxWidth: 1024, height: 400, display: 'flex', flexDirection: 'column' }}>
|
|
33
|
+
<GridUpdatingContextProvider>
|
|
34
|
+
<GridContextProvider>
|
|
35
|
+
<Story />
|
|
36
|
+
</GridContextProvider>
|
|
37
|
+
</GridUpdatingContextProvider>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
],
|
|
41
|
+
} as Meta<typeof Grid>;
|
|
42
|
+
|
|
43
|
+
interface ITestRow {
|
|
44
|
+
id: number;
|
|
45
|
+
position: string;
|
|
46
|
+
age: number;
|
|
47
|
+
height: string;
|
|
48
|
+
desc: string;
|
|
49
|
+
dd: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const GridReadOnlyTemplate: StoryFn<typeof Grid<ITestRow>> = (props: GridProps<ITestRow>) => {
|
|
53
|
+
const [externalSelectedItems, setExternalSelectedItems] = useState<any[]>([]);
|
|
54
|
+
const columnDefs: ColDefT<ITestRow>[] = useMemo(
|
|
55
|
+
() => [
|
|
56
|
+
GridCell<ITestRow, ITestRow['id']>({
|
|
57
|
+
field: 'id',
|
|
58
|
+
headerName: 'Id',
|
|
59
|
+
lockVisible: true,
|
|
60
|
+
resizable: false,
|
|
61
|
+
lockPosition: 'left',
|
|
62
|
+
cellRenderer: ({ value }) => <a href={'#'}>{value}</a>,
|
|
63
|
+
}),
|
|
64
|
+
GridCell<ITestRow, ITestRow['position']>({
|
|
65
|
+
field: 'position',
|
|
66
|
+
headerName: 'Position',
|
|
67
|
+
resizable: false,
|
|
68
|
+
lockPosition: 'left',
|
|
69
|
+
cellRendererParams: {
|
|
70
|
+
warning: ({ value }) => value === 'Tester' && 'Testers are testing',
|
|
71
|
+
info: ({ value }) => value === 'Developer' && 'Developers are awesome',
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
GridCell({
|
|
75
|
+
field: 'desc',
|
|
76
|
+
headerName: 'Description',
|
|
77
|
+
resizable: false,
|
|
78
|
+
lockPosition: 'left',
|
|
79
|
+
}),
|
|
80
|
+
GridCell({
|
|
81
|
+
field: 'age',
|
|
82
|
+
headerName: 'Age',
|
|
83
|
+
resizable: false,
|
|
84
|
+
lockPosition: 'left',
|
|
85
|
+
}),
|
|
86
|
+
GridCell({
|
|
87
|
+
field: 'height',
|
|
88
|
+
headerName: 'Height',
|
|
89
|
+
resizable: false,
|
|
90
|
+
lockPosition: 'left',
|
|
91
|
+
}),
|
|
92
|
+
],
|
|
93
|
+
[],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const [rowData] = useState<ITestRow[]>([
|
|
97
|
+
{ id: 1000, position: 'Tester', age: 30, height: `6'4"`, desc: 'Tests application', dd: '1' },
|
|
98
|
+
{ id: 1001, position: 'Developer', age: 12, height: `5'3"`, desc: 'Develops application', dd: '2' },
|
|
99
|
+
{ id: 1002, position: 'Manager', age: 65, height: `5'9"`, desc: 'Manages', dd: '3' },
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<GridWrapper maxHeight={400}>
|
|
104
|
+
<Grid
|
|
105
|
+
data-testid={'readonly'}
|
|
106
|
+
{...props}
|
|
107
|
+
selectable={true}
|
|
108
|
+
rowSelection={'multiple'}
|
|
109
|
+
externalSelectedItems={externalSelectedItems}
|
|
110
|
+
setExternalSelectedItems={setExternalSelectedItems}
|
|
111
|
+
columnDefs={columnDefs}
|
|
112
|
+
rowData={rowData}
|
|
113
|
+
sizeColumns={'fit'}
|
|
114
|
+
theme={'ag-theme-step-view-list-default'}
|
|
115
|
+
contextMenuSelectRow={false}
|
|
116
|
+
suppressCellFocus={true}
|
|
117
|
+
/>
|
|
118
|
+
</GridWrapper>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
export const SelectableListViewGrid = GridReadOnlyTemplate.bind({});
|