impact-nova 3.0.0-alpha.12 → 3.0.0-alpha.14
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/components/data/ag-grid-react/ag-grid-list.d.ts +3 -1
- package/dist/components/data/ag-grid-react/ag-grid-list.demo-board.d.ts +46 -0
- package/dist/components/data/ag-grid-react/ag-grid-list.js +9 -8
- package/dist/components/data/ag-grid-react/ag-grid-list.key-attributes.d.ts +1 -0
- package/dist/components/data/ag-grid-react/ag-grid.types.d.ts +50 -3
- package/dist/components/data/ag-grid-react/build-list-drag-column-defs.d.ts +8 -0
- package/dist/components/data/ag-grid-react/build-list-drag-column-defs.js +28 -0
- package/dist/components/data/ag-grid-react/cell-renderers/drag-handle-cell-renderer.d.ts +18 -0
- package/dist/components/data/ag-grid-react/cell-renderers/drag-handle-cell-renderer.js +32 -0
- package/dist/components/data/ag-grid-react/cell-renderers/editors/list-select-cell-editor.js +66 -55
- package/dist/components/data/ag-grid-react/headers/custom-header.js +109 -107
- package/dist/components/data/ag-grid-react/index.d.ts +5 -1
- package/dist/components/data/ag-grid-react/index.js +250 -201
- package/dist/components/data/ag-grid-react/list-drag-grid-options.d.ts +21 -0
- package/dist/components/data/ag-grid-react/list-drag-grid-options.js +46 -0
- package/dist/components/data/ag-grid-react/list-row-move.d.ts +84 -0
- package/dist/components/data/ag-grid-react/list-row-move.js +74 -0
- package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.d.ts +59 -0
- package/dist/components/data/ag-grid-react/use-ag-grid-list-drag.js +139 -0
- package/dist/components/data/ag-grid-react/use-list-drag-preview.d.ts +17 -0
- package/dist/components/data/ag-grid-react/use-list-drag-preview.js +49 -0
- package/dist/components/data/ag-grid-react/use-list-row-drop-zones.d.ts +44 -0
- package/dist/components/data/ag-grid-react/use-list-row-drop-zones.js +73 -0
- package/dist/components/data/data-table/data-table-list-header.d.ts +7 -0
- package/dist/components/data/data-table/data-table-list-header.js +31 -0
- package/dist/components/data/data-table/data-table.js +35 -34
- package/dist/components/data/data-table/data-table.types.d.ts +12 -2
- package/dist/components/data/data-table/index.d.ts +6 -0
- package/dist/components/data/data-table/index.js +63 -57
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +3 -2
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +3 -2
- package/dist/components/feedback/tooltip/tab-tooltip-render.js +3 -2
- package/dist/components/flows/command-palette/shortcut-settings.js +10 -10
- package/dist/components/flows/filter-panel/filter-panel.js +4 -4
- package/dist/components/forms/select/components/SelectTriggerValue.js +3 -2
- package/dist/components/forms/select/components/Submenu.js +3 -2
- package/dist/components/primitives/iris/iris.js +20 -18
- package/dist/impact-nova-components.css +71 -0
- package/dist/impact-nova-tokens.scss +2 -0
- package/dist/impact-nova.css +1 -1
- package/dist/index.js +314 -308
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/real-world-patterns.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/dist/tailwind.config.js +3 -0
- package/dist/theme/tailwind-colors.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function d(n) {
|
|
2
|
+
return n === "list";
|
|
3
|
+
}
|
|
4
|
+
function f(n) {
|
|
5
|
+
return n.variant === "list" && n.onRowReorder != null && n.getRowId != null;
|
|
6
|
+
}
|
|
7
|
+
function u(n) {
|
|
8
|
+
if (!(n?.id == null || n.id === ""))
|
|
9
|
+
return String(n.id);
|
|
10
|
+
}
|
|
11
|
+
function l(n) {
|
|
12
|
+
return n.rowsDrop?.position === "above" ? "above" : "below";
|
|
13
|
+
}
|
|
14
|
+
function a(n, t) {
|
|
15
|
+
if (n)
|
|
16
|
+
return String(
|
|
17
|
+
n({ data: t, level: 0 })
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function c(n) {
|
|
21
|
+
const t = [], i = (e) => {
|
|
22
|
+
for (const r of e) {
|
|
23
|
+
if (t.length >= 2) return;
|
|
24
|
+
"children" in r && r.children ? i(r.children) : "field" in r && typeof r.field == "string" && t.push(r.field);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return n && i(n), (e) => {
|
|
28
|
+
const r = e.rowNode?.data ?? {};
|
|
29
|
+
return t.map((o) => r[o]).filter((o) => o != null && o !== "").join(" · ");
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function s(n, t) {
|
|
33
|
+
return n == null ? t : (i) => {
|
|
34
|
+
const e = typeof n == "function" ? n({ data: i.data, rowIndex: i.node.rowIndex }) : n, r = t?.(i);
|
|
35
|
+
return e ? { ...r, "--in-ag-list-row-gradient": e } : r;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
c as createDefaultRowDragText,
|
|
40
|
+
s as createListRowStyle,
|
|
41
|
+
l as dropPositionFromEvent,
|
|
42
|
+
f as isAgGridListDragEnabled,
|
|
43
|
+
d as isAgGridListVariant,
|
|
44
|
+
a as itemIdFromGetRowId,
|
|
45
|
+
u as readDragRowId
|
|
46
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export type ListDropPosition = 'above' | 'below';
|
|
2
|
+
/** Same-list drop or Alt+Arrow. Set state from `rows` — do not rebuild order from the indexes. */
|
|
3
|
+
export interface ListRowReorderMeta<TItem> {
|
|
4
|
+
rowId: string;
|
|
5
|
+
fromIndex: number;
|
|
6
|
+
toIndex: number;
|
|
7
|
+
rows: TItem[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Cross-list drop from `useListRowDropZones`. Remove `row` from the source list
|
|
11
|
+
* and insert it at `toIndex` on the destination list.
|
|
12
|
+
*/
|
|
13
|
+
export interface ListRowTransferMeta<TItem> {
|
|
14
|
+
rowId: string;
|
|
15
|
+
row: TItem;
|
|
16
|
+
fromListId: string;
|
|
17
|
+
toListId: string;
|
|
18
|
+
toIndex: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ListRowDropCheck<TItem> {
|
|
21
|
+
row: TItem;
|
|
22
|
+
fromListId?: string;
|
|
23
|
+
toListId?: string;
|
|
24
|
+
toIndex: number;
|
|
25
|
+
}
|
|
26
|
+
/** Same-list move. `toIndex` is the destination in the array after the item is removed, then inserted. */
|
|
27
|
+
export declare function moveListRow<TItem>(items: TItem[], fromIndex: number, toIndex: number): TItem[];
|
|
28
|
+
/**
|
|
29
|
+
* Maps a hover target to the `toIndex` for `moveListRow`.
|
|
30
|
+
* `below` inserts after the hovered row; `above` inserts before it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveDropToIndex(options: {
|
|
33
|
+
fromIndex: number;
|
|
34
|
+
overIndex: number;
|
|
35
|
+
position: ListDropPosition;
|
|
36
|
+
}): number;
|
|
37
|
+
export declare function applyUnmanagedRowDrag<TItem>(options: {
|
|
38
|
+
items: TItem[];
|
|
39
|
+
getItemId: (item: TItem) => string;
|
|
40
|
+
draggedId: string;
|
|
41
|
+
overId: string | undefined;
|
|
42
|
+
position: ListDropPosition;
|
|
43
|
+
}): ListRowReorderMeta<TItem> | null;
|
|
44
|
+
export declare function transferListRow<TItem>(options: {
|
|
45
|
+
fromItems: TItem[];
|
|
46
|
+
toItems: TItem[];
|
|
47
|
+
itemId: string;
|
|
48
|
+
getItemId: (item: TItem) => string;
|
|
49
|
+
toIndex: number;
|
|
50
|
+
}): {
|
|
51
|
+
fromItems: TItem[];
|
|
52
|
+
toItems: TItem[];
|
|
53
|
+
};
|
|
54
|
+
export type ListKeyboardDirection = 'up' | 'down';
|
|
55
|
+
/** Alt+Arrow reorder using displayed row order (respects quick filter) against full `items`. */
|
|
56
|
+
export declare function applyKeyboardListRowReorder<TItem>(options: {
|
|
57
|
+
items: TItem[];
|
|
58
|
+
displayedRowIds: string[];
|
|
59
|
+
draggedId: string;
|
|
60
|
+
direction: ListKeyboardDirection;
|
|
61
|
+
getItemId: (item: TItem) => string;
|
|
62
|
+
isRowDragDisabled?: (row: TItem | undefined) => boolean;
|
|
63
|
+
canDropRow?: (params: ListRowDropCheck<TItem>) => boolean;
|
|
64
|
+
}): ListRowReorderMeta<TItem> | null;
|
|
65
|
+
export declare function listRowTransferDropIndex(options: {
|
|
66
|
+
overIndex: number;
|
|
67
|
+
overNode: unknown;
|
|
68
|
+
targetDisplayedCount: number;
|
|
69
|
+
position: ListDropPosition;
|
|
70
|
+
}): number;
|
|
71
|
+
export declare function buildListRowTransferMeta<TItem>(options: {
|
|
72
|
+
row: TItem | undefined;
|
|
73
|
+
rowId: string | undefined;
|
|
74
|
+
fromListId: string;
|
|
75
|
+
toListId: string;
|
|
76
|
+
overIndex: number;
|
|
77
|
+
overNode: unknown;
|
|
78
|
+
targetDisplayedCount: number;
|
|
79
|
+
position: ListDropPosition;
|
|
80
|
+
canDropRow?: (params: ListRowDropCheck<TItem>) => boolean;
|
|
81
|
+
}): ListRowTransferMeta<TItem> | null;
|
|
82
|
+
export declare function isListDropAllowed<TItem>(canDropRow: ((params: ListRowDropCheck<TItem>) => boolean) | undefined, check: ListRowDropCheck<TItem>): boolean;
|
|
83
|
+
/** Keep known ids in place, drop missing ones, append newly arrived ids. */
|
|
84
|
+
export declare function reconcileListOrder<TItem>(orderIds: string[], items: TItem[], getItemId: (item: TItem) => string): string[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function a(e, r, d) {
|
|
2
|
+
if (r === d || r < 0 || d < 0 || r >= e.length || d >= e.length)
|
|
3
|
+
return e;
|
|
4
|
+
const n = e.slice(), [t] = n.splice(r, 1);
|
|
5
|
+
return t === void 0 ? e : (n.splice(d, 0, t), n);
|
|
6
|
+
}
|
|
7
|
+
function f(e) {
|
|
8
|
+
let r = e.position === "below" ? e.overIndex + 1 : e.overIndex;
|
|
9
|
+
return e.fromIndex < r && (r -= 1), r;
|
|
10
|
+
}
|
|
11
|
+
function i(e) {
|
|
12
|
+
const r = e.items.findIndex((I) => e.getItemId(I) === e.draggedId);
|
|
13
|
+
if (r < 0) return null;
|
|
14
|
+
const d = e.overId ? e.items.findIndex((I) => e.getItemId(I) === e.overId) : e.items.length - 1;
|
|
15
|
+
if (d < 0) return null;
|
|
16
|
+
const n = f({
|
|
17
|
+
fromIndex: r,
|
|
18
|
+
overIndex: d,
|
|
19
|
+
position: e.overId ? e.position : "below"
|
|
20
|
+
}), t = a(e.items, r, n);
|
|
21
|
+
return t === e.items ? null : { rowId: e.draggedId, fromIndex: r, toIndex: n, rows: t };
|
|
22
|
+
}
|
|
23
|
+
function c(e) {
|
|
24
|
+
const r = e.items.find((u) => e.getItemId(u) === e.draggedId);
|
|
25
|
+
if (!r || e.isRowDragDisabled?.(r)) return null;
|
|
26
|
+
const d = e.displayedRowIds.indexOf(e.draggedId);
|
|
27
|
+
if (d < 0) return null;
|
|
28
|
+
const n = d + (e.direction === "down" ? 1 : -1);
|
|
29
|
+
if (n < 0 || n >= e.displayedRowIds.length) return null;
|
|
30
|
+
const t = e.displayedRowIds[n], I = e.direction === "down" ? "below" : "above", l = i({
|
|
31
|
+
items: e.items,
|
|
32
|
+
getItemId: e.getItemId,
|
|
33
|
+
draggedId: e.draggedId,
|
|
34
|
+
overId: t,
|
|
35
|
+
position: I
|
|
36
|
+
});
|
|
37
|
+
return !l || e.canDropRow && !e.canDropRow({ row: r, toIndex: l.toIndex }) ? null : l;
|
|
38
|
+
}
|
|
39
|
+
function w(e) {
|
|
40
|
+
return e.overIndex < 0 || !e.overNode ? e.targetDisplayedCount : e.position === "below" ? e.overIndex + 1 : e.overIndex;
|
|
41
|
+
}
|
|
42
|
+
function v(e) {
|
|
43
|
+
if (!e.row || !e.rowId) return null;
|
|
44
|
+
const r = w({
|
|
45
|
+
overIndex: e.overIndex,
|
|
46
|
+
overNode: e.overNode,
|
|
47
|
+
targetDisplayedCount: e.targetDisplayedCount,
|
|
48
|
+
position: e.position
|
|
49
|
+
});
|
|
50
|
+
return g(e.canDropRow, {
|
|
51
|
+
row: e.row,
|
|
52
|
+
toIndex: r,
|
|
53
|
+
fromListId: e.fromListId,
|
|
54
|
+
toListId: e.toListId
|
|
55
|
+
}) ? {
|
|
56
|
+
rowId: e.rowId,
|
|
57
|
+
row: e.row,
|
|
58
|
+
fromListId: e.fromListId,
|
|
59
|
+
toListId: e.toListId,
|
|
60
|
+
toIndex: r
|
|
61
|
+
} : null;
|
|
62
|
+
}
|
|
63
|
+
function g(e, r) {
|
|
64
|
+
return e ? e(r) : !0;
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
c as applyKeyboardListRowReorder,
|
|
68
|
+
i as applyUnmanagedRowDrag,
|
|
69
|
+
v as buildListRowTransferMeta,
|
|
70
|
+
g as isListDropAllowed,
|
|
71
|
+
w as listRowTransferDropIndex,
|
|
72
|
+
a as moveListRow,
|
|
73
|
+
f as resolveDropToIndex
|
|
74
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { ColDef, ColGroupDef, GridApi, RowDragEndEvent, RowDragMoveEvent } from 'ag-grid-community';
|
|
3
|
+
import { AgGridReactProps } from 'ag-grid-react';
|
|
4
|
+
import { ListRowDropCheck, ListRowReorderMeta } from './list-row-move';
|
|
5
|
+
import { AgGridListHeaderMode, AgGridVisualVariant, AgGridWrapperProps } from './ag-grid.types';
|
|
6
|
+
export declare function useAgGridDragList<TData>(options: {
|
|
7
|
+
variant: AgGridVisualVariant;
|
|
8
|
+
listHeader: AgGridListHeaderMode;
|
|
9
|
+
columnDefs: AgGridReactProps<TData>['columnDefs'];
|
|
10
|
+
mergedColumnDefs: Array<ColDef<TData> | ColGroupDef<TData>> | null | undefined;
|
|
11
|
+
listRowGradient: AgGridWrapperProps<TData>['listRowGradient'];
|
|
12
|
+
listDragPreview?: AgGridWrapperProps<TData>['listDragPreview'];
|
|
13
|
+
isRowDragDisabled?: AgGridWrapperProps<TData>['isRowDragDisabled'];
|
|
14
|
+
getRowDragHandleLabel?: AgGridWrapperProps<TData>['getRowDragHandleLabel'];
|
|
15
|
+
canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
|
|
16
|
+
onRowReorder?: (meta: ListRowReorderMeta<TData>) => void;
|
|
17
|
+
getRowStyle?: AgGridReactProps<TData>['getRowStyle'];
|
|
18
|
+
getRowId?: AgGridReactProps<TData>['getRowId'];
|
|
19
|
+
rowData?: TData[] | null;
|
|
20
|
+
rowDragManaged?: boolean;
|
|
21
|
+
rowDragText?: AgGridReactProps<TData>['rowDragText'];
|
|
22
|
+
onRowDragEnter?: AgGridReactProps<TData>['onRowDragEnter'];
|
|
23
|
+
onRowDragMove?: AgGridReactProps<TData>['onRowDragMove'];
|
|
24
|
+
onRowDragCancel?: AgGridReactProps<TData>['onRowDragCancel'];
|
|
25
|
+
onRowDragEnd?: AgGridReactProps<TData>['onRowDragEnd'];
|
|
26
|
+
gridContainerRef: RefObject<HTMLDivElement | null>;
|
|
27
|
+
gridApiRef: RefObject<GridApi<TData> | null>;
|
|
28
|
+
}): {
|
|
29
|
+
isDragList: boolean;
|
|
30
|
+
isListVariant: boolean;
|
|
31
|
+
hideColumnHeader: boolean;
|
|
32
|
+
dragListColumnDefs: (ColDef<TData, any> | ColGroupDef<TData>)[] | null | undefined;
|
|
33
|
+
dragListGridProps: {
|
|
34
|
+
rowDragManaged: boolean;
|
|
35
|
+
rowDragText: import('ag-grid-community').RowDragTextFunc;
|
|
36
|
+
suppressMoveWhenRowDragging: boolean;
|
|
37
|
+
animateRows: boolean;
|
|
38
|
+
getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
|
|
39
|
+
onRowDragEnter: (event: import('ag-grid-community').RowDragEnterEvent<TData, any>) => void;
|
|
40
|
+
onRowDragMove: (event: RowDragMoveEvent<TData>) => void;
|
|
41
|
+
onRowDragCancel: (event: import('ag-grid-community').RowDragCancelEvent<TData, any>) => void;
|
|
42
|
+
onRowDragEnd: (event: RowDragEndEvent<TData>) => void;
|
|
43
|
+
} | {
|
|
44
|
+
getRowStyle: import('ag-grid-community').GetRowStyle<TData, any> | undefined;
|
|
45
|
+
rowDragManaged?: undefined;
|
|
46
|
+
rowDragText?: undefined;
|
|
47
|
+
suppressMoveWhenRowDragging?: undefined;
|
|
48
|
+
animateRows?: undefined;
|
|
49
|
+
onRowDragEnter?: undefined;
|
|
50
|
+
onRowDragMove?: undefined;
|
|
51
|
+
onRowDragCancel?: undefined;
|
|
52
|
+
onRowDragEnd?: undefined;
|
|
53
|
+
} | null;
|
|
54
|
+
listHeaderGridProps: {
|
|
55
|
+
headerHeight: number;
|
|
56
|
+
} | null;
|
|
57
|
+
dragPreviewPortal: import('react').ReactPortal | null;
|
|
58
|
+
liveRegion: import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as oo, useMemo as h, useCallback as M, useEffect as eo } from "react";
|
|
3
|
+
import { isListDropAllowed as F, applyUnmanagedRowDrag as ro, applyKeyboardListRowReorder as to } from "./list-row-move.js";
|
|
4
|
+
import { buildDragListColumnDefs as ao } from "./build-list-drag-column-defs.js";
|
|
5
|
+
import { createDefaultRowDragText as no, createListRowStyle as io, dropPositionFromEvent as H, readDragRowId as m, isAgGridListDragEnabled as so, isAgGridListVariant as lo, itemIdFromGetRowId as N } from "./list-drag-grid-options.js";
|
|
6
|
+
import { useListDragPreview as wo } from "./use-list-drag-preview.js";
|
|
7
|
+
function go(d) {
|
|
8
|
+
const r = d?.getFocusedCell();
|
|
9
|
+
if (!(!r || r.rowIndex == null))
|
|
10
|
+
return d?.getDisplayedRowAtIndex(r.rowIndex) ?? void 0;
|
|
11
|
+
}
|
|
12
|
+
function co(d) {
|
|
13
|
+
const r = [];
|
|
14
|
+
return d.forEachNodeAfterFilterAndSort((I) => {
|
|
15
|
+
const g = m(I);
|
|
16
|
+
g && r.push(g);
|
|
17
|
+
}), r;
|
|
18
|
+
}
|
|
19
|
+
function Io(d) {
|
|
20
|
+
const {
|
|
21
|
+
variant: r,
|
|
22
|
+
listHeader: I,
|
|
23
|
+
columnDefs: g,
|
|
24
|
+
mergedColumnDefs: y,
|
|
25
|
+
listRowGradient: D,
|
|
26
|
+
listDragPreview: T,
|
|
27
|
+
isRowDragDisabled: R,
|
|
28
|
+
getRowDragHandleLabel: P,
|
|
29
|
+
canDropRow: s,
|
|
30
|
+
onRowReorder: L,
|
|
31
|
+
getRowStyle: x,
|
|
32
|
+
getRowId: a,
|
|
33
|
+
rowData: l,
|
|
34
|
+
rowDragManaged: K,
|
|
35
|
+
rowDragText: U,
|
|
36
|
+
onRowDragEnter: V,
|
|
37
|
+
onRowDragMove: E,
|
|
38
|
+
onRowDragCancel: j,
|
|
39
|
+
onRowDragEnd: v,
|
|
40
|
+
gridContainerRef: A,
|
|
41
|
+
gridApiRef: C
|
|
42
|
+
} = d, c = lo(r), t = so({ variant: r, onRowReorder: L, getRowId: a }), b = c && I === "none", u = K === !0, [W, $] = oo(""), q = h(() => t ? ao({
|
|
43
|
+
columnDefs: y,
|
|
44
|
+
isRowDragDisabled: R,
|
|
45
|
+
getRowDragHandleLabel: P
|
|
46
|
+
}) : y, [P, t, R, y]), z = h(
|
|
47
|
+
() => no(g),
|
|
48
|
+
[g]
|
|
49
|
+
), G = h(
|
|
50
|
+
() => c ? io(D, x) : x,
|
|
51
|
+
[x, c, D]
|
|
52
|
+
), f = M(
|
|
53
|
+
(o) => {
|
|
54
|
+
L?.(o), $(`Moved to position ${o.toIndex + 1}`);
|
|
55
|
+
},
|
|
56
|
+
[L]
|
|
57
|
+
), n = wo({
|
|
58
|
+
enabled: t,
|
|
59
|
+
listDragPreview: T,
|
|
60
|
+
onRowDragEnter: V,
|
|
61
|
+
onRowDragCancel: j
|
|
62
|
+
}), B = M(
|
|
63
|
+
(o) => {
|
|
64
|
+
if (n.handleRowDragMove(o), !u) {
|
|
65
|
+
const i = Math.max(o.overIndex, 0), e = o.node.data && F(s, { row: o.node.data, toIndex: i });
|
|
66
|
+
o.api.setRowDropPositionIndicator(
|
|
67
|
+
e && o.overNode ? { row: o.overNode, dropIndicatorPosition: H(o) } : null
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
E?.(o);
|
|
71
|
+
},
|
|
72
|
+
[s, u, E, n]
|
|
73
|
+
), J = M(
|
|
74
|
+
(o) => {
|
|
75
|
+
if (n.clearPreview(), o.api.setRowDropPositionIndicator(null), !u && l && o.node.data && a) {
|
|
76
|
+
const i = m(o.node), e = Math.max(o.overIndex, 0);
|
|
77
|
+
if (o.node.data && F(s, { row: o.node.data, toIndex: e }) && i) {
|
|
78
|
+
const w = ro({
|
|
79
|
+
items: l,
|
|
80
|
+
getItemId: (p) => N(a, p) ?? "",
|
|
81
|
+
draggedId: i,
|
|
82
|
+
overId: m(o.overNode),
|
|
83
|
+
position: H(o)
|
|
84
|
+
});
|
|
85
|
+
w && f(w);
|
|
86
|
+
}
|
|
87
|
+
} else typeof D == "function" && o.api.redrawRows();
|
|
88
|
+
v?.(o);
|
|
89
|
+
},
|
|
90
|
+
[s, f, a, D, u, v, n, l]
|
|
91
|
+
);
|
|
92
|
+
eo(() => {
|
|
93
|
+
const o = A.current;
|
|
94
|
+
if (!t || !o || !a) return;
|
|
95
|
+
const i = (e) => {
|
|
96
|
+
if (!e.altKey || e.key !== "ArrowUp" && e.key !== "ArrowDown" || e.target?.closest('input, textarea, [contenteditable="true"]')) return;
|
|
97
|
+
const w = C.current, p = go(w ?? void 0);
|
|
98
|
+
if (!p?.data || !l || !w) return;
|
|
99
|
+
const S = m(p);
|
|
100
|
+
if (!S) return;
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
const Y = e.key === "ArrowUp" ? "up" : "down", k = to({
|
|
103
|
+
items: l,
|
|
104
|
+
displayedRowIds: co(w),
|
|
105
|
+
draggedId: S,
|
|
106
|
+
direction: Y,
|
|
107
|
+
getItemId: (Z) => N(a, Z) ?? "",
|
|
108
|
+
isRowDragDisabled: R,
|
|
109
|
+
canDropRow: s
|
|
110
|
+
});
|
|
111
|
+
k && f(k);
|
|
112
|
+
};
|
|
113
|
+
return o.addEventListener("keydown", i), () => o.removeEventListener("keydown", i);
|
|
114
|
+
}, [s, f, a, C, A, t, R, l]);
|
|
115
|
+
const O = t ? /* @__PURE__ */ _("div", { className: "sr-only", "aria-live": "polite", children: W }) : null, Q = t ? {
|
|
116
|
+
rowDragManaged: u,
|
|
117
|
+
rowDragText: U ?? z,
|
|
118
|
+
suppressMoveWhenRowDragging: !0,
|
|
119
|
+
animateRows: !0,
|
|
120
|
+
getRowStyle: G,
|
|
121
|
+
onRowDragEnter: n.handleRowDragEnter,
|
|
122
|
+
onRowDragMove: B,
|
|
123
|
+
onRowDragCancel: n.handleRowDragCancel,
|
|
124
|
+
onRowDragEnd: J
|
|
125
|
+
} : c ? { getRowStyle: G } : null;
|
|
126
|
+
return {
|
|
127
|
+
isDragList: t,
|
|
128
|
+
isListVariant: c,
|
|
129
|
+
hideColumnHeader: b,
|
|
130
|
+
dragListColumnDefs: q,
|
|
131
|
+
dragListGridProps: Q,
|
|
132
|
+
listHeaderGridProps: b ? { headerHeight: 0 } : null,
|
|
133
|
+
dragPreviewPortal: n.dragPreviewPortal,
|
|
134
|
+
liveRegion: O
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
Io as useAgGridDragList
|
|
139
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RowDragCancelEvent, RowDragEnterEvent, RowDragMoveEvent } from 'ag-grid-community';
|
|
3
|
+
export declare function useListDragPreview<TData>(options: {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
listDragPreview?: (params: {
|
|
6
|
+
data: TData;
|
|
7
|
+
}) => ReactNode;
|
|
8
|
+
onRowDragEnter?: (event: RowDragEnterEvent<TData>) => void;
|
|
9
|
+
onRowDragMove?: (event: RowDragMoveEvent<TData>) => void;
|
|
10
|
+
onRowDragCancel?: (event: RowDragCancelEvent<TData>) => void;
|
|
11
|
+
}): {
|
|
12
|
+
handleRowDragEnter: (event: RowDragEnterEvent<TData>) => void;
|
|
13
|
+
handleRowDragMove: (event: RowDragMoveEvent<TData>) => void;
|
|
14
|
+
handleRowDragCancel: (event: RowDragCancelEvent<TData>) => void;
|
|
15
|
+
clearPreview: () => void;
|
|
16
|
+
dragPreviewPortal: import('react').ReactPortal | null;
|
|
17
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useCallback as r, useEffect as y } from "react";
|
|
3
|
+
import { createPortal as P } from "react-dom";
|
|
4
|
+
function C(f) {
|
|
5
|
+
const { enabled: a, listDragPreview: n, onRowDragEnter: l, onRowDragMove: s, onRowDragCancel: c } = f, [t, o] = w(null), [g, u] = w(!1), m = r(
|
|
6
|
+
(e) => {
|
|
7
|
+
u(!0), n && e.node.data && o({
|
|
8
|
+
node: n({ data: e.node.data }),
|
|
9
|
+
x: e.event.clientX,
|
|
10
|
+
y: e.event.clientY
|
|
11
|
+
}), l?.(e);
|
|
12
|
+
},
|
|
13
|
+
[n, l]
|
|
14
|
+
), v = r(
|
|
15
|
+
(e) => {
|
|
16
|
+
o(
|
|
17
|
+
(i) => i && { ...i, x: e.event.clientX, y: e.event.clientY }
|
|
18
|
+
), s?.(e);
|
|
19
|
+
},
|
|
20
|
+
[s]
|
|
21
|
+
), d = r(() => {
|
|
22
|
+
o(null), u(!1);
|
|
23
|
+
}, []), D = r(
|
|
24
|
+
(e) => {
|
|
25
|
+
d(), c?.(e);
|
|
26
|
+
},
|
|
27
|
+
[d, c]
|
|
28
|
+
);
|
|
29
|
+
y(() => {
|
|
30
|
+
if (!(!a || !g))
|
|
31
|
+
return document.body.setAttribute("data-in-list-drag", "true"), () => document.body.removeAttribute("data-in-list-drag");
|
|
32
|
+
}, [a, g]);
|
|
33
|
+
const b = a && t && typeof document < "u" ? P(
|
|
34
|
+
/* @__PURE__ */ p(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
"data-component": "ag-grid-drag-preview",
|
|
38
|
+
className: "pointer-events-none fixed z-[9999] rounded-lg border border-stroke-hairline bg-canvas-elevated px-3 py-2 shadow-[var(--shadow-elevation-toast)]",
|
|
39
|
+
style: { left: t.x + 12, top: t.y + 12 },
|
|
40
|
+
children: t.node
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
document.body
|
|
44
|
+
) : null;
|
|
45
|
+
return { handleRowDragEnter: m, handleRowDragMove: v, handleRowDragCancel: D, clearPreview: d, dragPreviewPortal: b };
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
C as useListDragPreview
|
|
49
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GridApi, RowDragEndEvent, RowDragMoveEvent } from 'ag-grid-community';
|
|
2
|
+
import { ListRowDropCheck, ListRowTransferMeta } from './list-row-move';
|
|
3
|
+
export interface UseListRowDropZonesOptions<TData> {
|
|
4
|
+
/** Grid APIs from each list's `onGridReady`. A `null` api is skipped (hidden list). */
|
|
5
|
+
lists: Record<string, GridApi<TData> | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Host owns both `rowData` arrays. Remove `meta.row` from `meta.fromListId`
|
|
8
|
+
* and insert it at `meta.toIndex` on `meta.toListId`.
|
|
9
|
+
*/
|
|
10
|
+
onRowTransfer: (meta: ListRowTransferMeta<TData>) => void;
|
|
11
|
+
canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function displayedRowCount<TData>(api: GridApi<TData>): number;
|
|
14
|
+
export declare function previewListTransferAllowed<TData>(event: RowDragMoveEvent<TData>, options: {
|
|
15
|
+
fromListId: string;
|
|
16
|
+
toListId: string;
|
|
17
|
+
target: GridApi<TData>;
|
|
18
|
+
canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
|
|
19
|
+
}): boolean;
|
|
20
|
+
export declare function tryListRowTransfer<TData>(event: RowDragEndEvent<TData>, options: {
|
|
21
|
+
fromListId: string;
|
|
22
|
+
toListId: string;
|
|
23
|
+
target: GridApi<TData>;
|
|
24
|
+
canDropRow?: (params: ListRowDropCheck<TData>) => boolean;
|
|
25
|
+
}): ListRowTransferMeta<TData> | null;
|
|
26
|
+
/**
|
|
27
|
+
* Cross-list drag on `variant="list"` + `onRowReorder`. Pass each list's `GridApi`
|
|
28
|
+
* from `onGridReady`. Same-list drops still go through that list's `onRowReorder`.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* useListRowDropZones({
|
|
32
|
+
* lists: { inPlan: inPlanApi, bench: benchApi },
|
|
33
|
+
* onRowTransfer: ({ row, rowId, toListId, toIndex }) => {
|
|
34
|
+
* const place = (rows: Item[], isDestination: boolean) => {
|
|
35
|
+
* const without = rows.filter((item) => item.id !== rowId);
|
|
36
|
+
* if (!isDestination) return without;
|
|
37
|
+
* return [...without.slice(0, toIndex), row, ...without.slice(toIndex)];
|
|
38
|
+
* };
|
|
39
|
+
* setInPlan((rows) => place(rows, toListId === 'inPlan'));
|
|
40
|
+
* setBench((rows) => place(rows, toListId === 'bench'));
|
|
41
|
+
* },
|
|
42
|
+
* });
|
|
43
|
+
*/
|
|
44
|
+
export declare function useListRowDropZones<TData>(options: UseListRowDropZonesOptions<TData>): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect as D } from "react";
|
|
2
|
+
import { buildListRowTransferMeta as R, listRowTransferDropIndex as m, isListDropAllowed as L } from "./list-row-move.js";
|
|
3
|
+
import { readDragRowId as g, dropPositionFromEvent as p } from "./list-drag-grid-options.js";
|
|
4
|
+
function I(r) {
|
|
5
|
+
let o = 0;
|
|
6
|
+
return r.forEachNodeAfterFilterAndSort(() => {
|
|
7
|
+
o += 1;
|
|
8
|
+
}), o;
|
|
9
|
+
}
|
|
10
|
+
function x(r, o) {
|
|
11
|
+
const t = r.node.data;
|
|
12
|
+
if (!t) return !1;
|
|
13
|
+
const n = m({
|
|
14
|
+
overIndex: r.overIndex,
|
|
15
|
+
overNode: r.overNode,
|
|
16
|
+
targetDisplayedCount: I(o.target),
|
|
17
|
+
position: p(r)
|
|
18
|
+
});
|
|
19
|
+
return L(o.canDropRow, {
|
|
20
|
+
row: t,
|
|
21
|
+
toIndex: n,
|
|
22
|
+
fromListId: o.fromListId,
|
|
23
|
+
toListId: o.toListId
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function P(r, o) {
|
|
27
|
+
const t = r.node.data, n = g(r.node);
|
|
28
|
+
return R({
|
|
29
|
+
row: t,
|
|
30
|
+
rowId: n,
|
|
31
|
+
fromListId: o.fromListId,
|
|
32
|
+
toListId: o.toListId,
|
|
33
|
+
overIndex: r.overIndex,
|
|
34
|
+
overNode: r.overNode,
|
|
35
|
+
targetDisplayedCount: I(o.target),
|
|
36
|
+
position: p(r),
|
|
37
|
+
canDropRow: o.canDropRow
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function y(r) {
|
|
41
|
+
const { lists: o, onRowTransfer: t, canDropRow: n } = r;
|
|
42
|
+
D(() => {
|
|
43
|
+
const c = Object.entries(o).filter((e) => e[1] != null), f = [];
|
|
44
|
+
for (const [e, s] of c)
|
|
45
|
+
for (const [u, i] of c) {
|
|
46
|
+
if (e === u) continue;
|
|
47
|
+
const l = { fromListId: e, toListId: u, target: i, canDropRow: n }, d = i.getRowDropZoneParams({
|
|
48
|
+
onDragging: (a) => {
|
|
49
|
+
x(a, l) || (s.setRowDropPositionIndicator(null), i.setRowDropPositionIndicator(null));
|
|
50
|
+
},
|
|
51
|
+
onDragStop: (a) => {
|
|
52
|
+
i.setRowDropPositionIndicator(null);
|
|
53
|
+
const w = P(a, l);
|
|
54
|
+
w && t(w);
|
|
55
|
+
},
|
|
56
|
+
onDragLeave: () => {
|
|
57
|
+
s.setRowDropPositionIndicator(null), i.setRowDropPositionIndicator(null);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
d && (s.addRowDropZone(d), f.push({ source: s, params: d }));
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
for (const { source: e, params: s } of f)
|
|
64
|
+
e.removeRowDropZone(s);
|
|
65
|
+
};
|
|
66
|
+
}, [n, o, t]);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
I as displayedRowCount,
|
|
70
|
+
x as previewListTransferAllowed,
|
|
71
|
+
P as tryListRowTransfer,
|
|
72
|
+
y as useListRowDropZones
|
|
73
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataTableListHeaderProps } from './data-table.types';
|
|
2
|
+
/**
|
|
3
|
+
* Optional 40px muted bar above a list grid — same composition slot as
|
|
4
|
+
* `DataTableToolbar`, not an AG Grid column header.
|
|
5
|
+
* Pair with `listHeader="none"` on `DataTableContent`. Omit when the list has no heading.
|
|
6
|
+
*/
|
|
7
|
+
export declare function DataTableListHeader({ title, description, actions, className, ...props }: DataTableListHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as r } from "../../../lib/utils.js";
|
|
3
|
+
function d({
|
|
4
|
+
title: t,
|
|
5
|
+
description: n,
|
|
6
|
+
actions: l,
|
|
7
|
+
className: s,
|
|
8
|
+
...i
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ a(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
"data-component": "data-table-list-header",
|
|
14
|
+
className: r(
|
|
15
|
+
"mb-3 flex h-10 shrink-0 items-center justify-between gap-4 rounded-lg bg-canvas-muted px-5",
|
|
16
|
+
s
|
|
17
|
+
),
|
|
18
|
+
...i,
|
|
19
|
+
children: [
|
|
20
|
+
t != null ? /* @__PURE__ */ e("p", { className: "shrink-0 text-sm font-bold leading-[21px] text-content", children: t }) : /* @__PURE__ */ e("span", {}),
|
|
21
|
+
/* @__PURE__ */ a("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
22
|
+
n != null ? /* @__PURE__ */ e("p", { className: "truncate text-xs font-medium leading-4 text-content-icon", children: n }) : null,
|
|
23
|
+
l
|
|
24
|
+
] })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as DataTableListHeader
|
|
31
|
+
};
|