@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
package/dist/GridTheme.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@use
|
|
2
|
-
@use
|
|
1
|
+
@use '@linzjs/lui/dist/scss/Core' as lui;
|
|
2
|
+
@use 'ag-grid-community/styles' as ag;
|
|
3
3
|
|
|
4
4
|
// ag-grid likes to add 1px to this, so we subtract to compensate
|
|
5
5
|
$grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
@@ -44,7 +44,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
44
44
|
data-color: lui.$charcoal,
|
|
45
45
|
foreground-color: lui.$charcoal,
|
|
46
46
|
font-family: (
|
|
47
|
-
|
|
47
|
+
'Open Sans',
|
|
48
48
|
system-ui,
|
|
49
49
|
sans-serif,
|
|
50
50
|
),
|
|
@@ -58,6 +58,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
58
58
|
)
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
+
.ag-theme-step-view-list-default,
|
|
61
62
|
.ag-theme-step-default.theme-specific,
|
|
62
63
|
.ag-theme-step-compact.theme-specific {
|
|
63
64
|
// Don't hide the drag handle
|
|
@@ -154,7 +155,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
154
155
|
content: none !important;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
|
|
158
|
+
|
|
158
159
|
.ag-header-cell-filter-button.ag-has-popup-positioned-under .ag-icon-filter {
|
|
159
160
|
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M6 12.984v-1.969h12v1.969zM3 6h18v2.016H3zm6.984 12v-2.016h4.031V18z'/%3E%3C/svg%3E") !important;
|
|
160
161
|
background-color: #007198;
|
|
@@ -243,7 +244,8 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
243
244
|
visibility: inherit;
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
.ag-row-highlight-above::after,
|
|
247
|
+
.ag-row-highlight-above::after,
|
|
248
|
+
.ag-row-highlight-below::after {
|
|
247
249
|
content: '';
|
|
248
250
|
height: 3px;
|
|
249
251
|
background-color: transparent;
|
|
@@ -257,6 +259,10 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
257
259
|
border-bottom: 2px dashed lui.$andrea;
|
|
258
260
|
}
|
|
259
261
|
|
|
262
|
+
.ag-row-dragging {
|
|
263
|
+
opacity: 0.5;
|
|
264
|
+
}
|
|
265
|
+
|
|
260
266
|
.ag-pinned-left-header,
|
|
261
267
|
.ag-pinned-right-header,
|
|
262
268
|
.ag-pinned-right-cols-container,
|
|
@@ -268,7 +274,7 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
268
274
|
|
|
269
275
|
.ag-pinned-left-header,
|
|
270
276
|
.ag-pinned-left-cols-container {
|
|
271
|
-
|
|
277
|
+
clip-path: polygon(0% 0%, 120% 0%, 120% 100%, 0% 100%);
|
|
272
278
|
}
|
|
273
279
|
|
|
274
280
|
.ag-pinned-right-header,
|
|
@@ -278,7 +284,6 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
.ag-theme-step-view-list-default.theme-specific {
|
|
281
|
-
|
|
282
287
|
.ag-header-hide-default-select .ag-labeled {
|
|
283
288
|
display: none;
|
|
284
289
|
}
|
package/dist/index.css
CHANGED
|
@@ -311,7 +311,8 @@
|
|
|
311
311
|
text-transform: uppercase;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
.react-menu-inline-test .szh-menu-container,
|
|
314
|
+
.react-menu-inline-test .szh-menu-container,
|
|
315
|
+
.react-menu-inline-test .szh-menu {
|
|
315
316
|
position: static !important;
|
|
316
317
|
}
|
|
317
318
|
|
|
@@ -328,7 +329,8 @@
|
|
|
328
329
|
user-select: none;
|
|
329
330
|
}
|
|
330
331
|
|
|
331
|
-
.LabelPreferencesPanelGridCellAlignCenter .ag-cell-wrapper,
|
|
332
|
+
.LabelPreferencesPanelGridCellAlignCenter .ag-cell-wrapper,
|
|
333
|
+
.LabelPreferencesPanelGridCellAlignCenter .GridCell-container {
|
|
332
334
|
display: flex;
|
|
333
335
|
justify-content: center;
|
|
334
336
|
}
|
|
@@ -447,7 +449,8 @@
|
|
|
447
449
|
margin-right: auto;
|
|
448
450
|
}
|
|
449
451
|
|
|
450
|
-
.GridCellAlignCenter .ag-cell-wrapper,
|
|
452
|
+
.GridCellAlignCenter .ag-cell-wrapper,
|
|
453
|
+
.LabelPreferencesPanelGridCellAlignCenter .GridCell-container {
|
|
451
454
|
display: flex;
|
|
452
455
|
justify-content: center;
|
|
453
456
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GridBaseRow } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Reorders rows by removing movedRows from the array and inserting them at the target position.
|
|
4
|
+
* @param rows - The current row array.
|
|
5
|
+
* @param movedRows - Rows to move, in desired insertion order (typically display order).
|
|
6
|
+
* @param targetRow - The row to insert relative to.
|
|
7
|
+
* @param direction - -1 inserts above targetRow, 1 inserts below targetRow.
|
|
8
|
+
* @returns A new array with the rows reordered, or the original array if the operation is a no-op.
|
|
9
|
+
*/
|
|
10
|
+
export declare function reorderRows<T extends GridBaseRow>(rows: T[], movedRows: T[], targetRow: T, direction: -1 | 1): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,7 @@ export * from './GridCell';
|
|
|
4
4
|
export * from './GridCellFiller';
|
|
5
5
|
export * from './GridCellMultiEditor';
|
|
6
6
|
export * from './GridCellMultiSelectClassRules';
|
|
7
|
+
export * from './gridDragUtil';
|
|
7
8
|
export * from './gridFilter';
|
|
8
9
|
export * from './gridForm';
|
|
9
10
|
export * from './gridHook';
|
|
@@ -5,8 +5,12 @@ export interface GridBaseRow {
|
|
|
5
5
|
id: string | number;
|
|
6
6
|
}
|
|
7
7
|
export interface GridOnRowDragEndProps<TData extends GridBaseRow> {
|
|
8
|
+
/** The row the user physically grabbed by its drag handle. */
|
|
8
9
|
movedRow: TData;
|
|
10
|
+
/** All rows being moved, ordered by display index. Single-element array when dragging an unselected row. */
|
|
11
|
+
movedRows: TData[];
|
|
9
12
|
targetRow: TData;
|
|
13
|
+
/** -1 = dropped above target, 1 = dropped below target. */
|
|
10
14
|
direction: -1 | 1;
|
|
11
15
|
}
|
|
12
16
|
export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends ColDef<TData, ValueType> {
|
|
@@ -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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from usehooks-ts
|
|
3
|
+
*
|
|
4
|
+
* 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).
|
|
5
|
+
* @param {() => void} callback - The function to be invoked at each interval.
|
|
6
|
+
* @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.
|
|
7
|
+
* @public
|
|
8
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const handleInterval = () => {
|
|
12
|
+
* // Code to be executed at each interval
|
|
13
|
+
* };
|
|
14
|
+
* useInterval(handleInterval, 1000);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function useInterval(callback: () => void, delay: number | null): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Copied from usehooks-ts
|
|
4
|
+
*
|
|
5
|
+
* Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
|
|
6
|
+
* @param {Function} effect - The effect function to be executed.
|
|
7
|
+
* @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
|
|
8
|
+
* @public
|
|
9
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* useIsomorphicLayoutEffect(() => {
|
|
13
|
+
* // Code to be executed during the layout phase on the client side
|
|
14
|
+
* }, [dependency1, dependency2]);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|