impact-nova 2.5.16 → 2.5.17
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/data-table/build-column-tree-from-grid.d.ts +0 -1
- package/dist/components/data/data-table/build-column-tree-from-grid.js +50 -55
- package/dist/components/data/data-table/data-table-column-apply.d.ts +0 -2
- package/dist/components/data/data-table/data-table-column-apply.js +73 -84
- package/dist/components/data/data-table/data-table-column-list.js +64 -94
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +6 -12
- package/dist/components/data/data-table/data-table-column-tree-cache.js +131 -250
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +0 -5
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +11 -28
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +0 -10
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +196 -250
- package/dist/components/data/nested-list/components/NestedListContent.d.ts +2 -10
- package/dist/components/data/nested-list/components/NestedListContent.js +138 -253
- package/dist/components/data/nested-list/components/SortableItem.d.ts +1 -2
- package/dist/components/data/nested-list/components/SortableItem.js +60 -62
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +20 -10
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +233 -44
- package/dist/components/data/nested-list/nested-list-constants.d.ts +1 -4
- package/dist/components/data/nested-list/nested-list-constants.js +4 -10
- package/dist/components/data/nested-list/nested-list.js +336 -322
- package/dist/components/data/nested-list/nested-list.types.d.ts +0 -17
- package/dist/form-react/fields.d.ts +3 -0
- package/dist/form-react/fields.js +35 -29
- package/dist/impact-nova.css +1 -1
- package/dist/llms/rules/ag-grid.js +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
- package/dist/components/data/data-table/column-picker-authority.d.ts +0 -34
- package/dist/components/data/data-table/column-picker-authority.js +0 -116
- package/dist/components/data/data-table/column-picker-drop-validation.d.ts +0 -7
- package/dist/components/data/data-table/column-picker-drop-validation.js +0 -37
- package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +0 -10
- package/dist/components/data/data-table/data-table-column-list-tree-apply.js +0 -79
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +0 -26
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +0 -195
- package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +0 -1
- package/dist/components/data/data-table/data-table-picker-column-eligibility.js +0 -7
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +0 -12
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +0 -12
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +0 -24
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +0 -128
- package/dist/components/data/nested-list/nested-list-display-utils.d.ts +0 -11
- package/dist/components/data/nested-list/nested-list-display-utils.js +0 -74
- package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +0 -31
- package/dist/components/data/nested-list/nested-list-drop-engine.js +0 -209
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +0 -26
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +0 -67
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +0 -4
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +0 -43
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +0 -3
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +0 -34
- package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +0 -9
- package/dist/components/data/nested-list/nested-list-row-estimates.js +0 -14
- package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +0 -36
- package/dist/components/data/nested-list/nested-list-scroll-anchor.js +0 -47
- package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +0 -59
- package/dist/components/data/nested-list/nested-list-virtual-drop.js +0 -341
- package/dist/lib/hash/fnv1a128.d.ts +0 -16
- package/dist/lib/hash/fnv1a128.js +0 -21
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useSortable as
|
|
4
|
-
import { useDroppable as
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
import { ChevronRight as
|
|
2
|
+
import C, { useMemo as R } from "react";
|
|
3
|
+
import { useSortable as j } from "@dnd-kit/sortable";
|
|
4
|
+
import { useDroppable as _ } from "@dnd-kit/core";
|
|
5
|
+
import { Checkbox as H } from "../../../forms/checkbox/checkbox.js";
|
|
6
|
+
import { ChevronRight as D, Drag as $ } from "impact-nova-icons";
|
|
7
7
|
import { cn as d } from "../../../../lib/utils.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
9
|
-
import { isNestedListSubtreeIndeterminate as
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
return e ? d(
|
|
13
|
-
},
|
|
14
|
-
const { t: n } =
|
|
15
|
-
setNodeRef:
|
|
8
|
+
import { useImpactNovaI18n as v } from "../../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { isNestedListSubtreeIndeterminate as E } from "../nested-list-tree-utils.js";
|
|
10
|
+
const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 items-center justify-center", O = "flex h-5 w-5 shrink-0 cursor-grab active:cursor-grabbing items-center justify-center rounded-sm text-content-icon transition-colors hover:bg-canvas-muted hover:text-content", P = (e, r) => {
|
|
11
|
+
const s = "group flex items-start gap-2 py-1 pr-2 rounded transition-colors duration-150 min-w-0";
|
|
12
|
+
return e ? d(s, "opacity-40 bg-canvas-muted") : r ? d(s, "bg-feedback-error-surface border border-destructive animate-pulse") : d(s, "hover:bg-canvas-muted");
|
|
13
|
+
}, G = ({ item: e, isAnyDragging: r, renderActions: s }) => {
|
|
14
|
+
const { t: n } = v(), a = !e.children || e.children.length === 0, {
|
|
15
|
+
setNodeRef: l,
|
|
16
16
|
isOver: o
|
|
17
|
-
} =
|
|
17
|
+
} = _({
|
|
18
18
|
id: `droppable-${e.id}`,
|
|
19
19
|
data: { sectionId: e.id },
|
|
20
|
-
disabled: !
|
|
20
|
+
disabled: !a
|
|
21
21
|
});
|
|
22
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
22
|
+
return /* @__PURE__ */ c("div", { ref: a ? l : void 0, children: [
|
|
23
23
|
/* @__PURE__ */ c(
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
26
|
className: d(
|
|
27
27
|
"flex items-center justify-between px-2 py-0 text-xs font-[500] leading-4 text-navigation-muted select-none",
|
|
28
28
|
e.id === "root-scrollable" ? "mt-2 pt-2 pb-1 border-t border-solid border-stroke-subtle" : "mt-1 pb-1",
|
|
29
|
-
o && r &&
|
|
29
|
+
o && r && a && "bg-canvas-tint rounded"
|
|
30
30
|
),
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
33
33
|
e.label,
|
|
34
|
-
o && r &&
|
|
34
|
+
o && r && a && /* @__PURE__ */ t("span", { className: "ml-2 text-brand text-[11px]", children: n("nestedList.dropHere") })
|
|
35
35
|
] }),
|
|
36
|
-
|
|
36
|
+
s?.(e, { isLeaf: !1, level: 0 })
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
),
|
|
40
|
-
|
|
40
|
+
a && /* @__PURE__ */ t(
|
|
41
41
|
"div",
|
|
42
42
|
{
|
|
43
|
-
"data-section-droppable": e.id,
|
|
44
43
|
className: d(
|
|
45
44
|
"mx-2 my-1 rounded border-2 border-dashed min-h-[36px] flex items-center justify-center text-[11px] transition-colors",
|
|
46
45
|
o && r ? "border-brand bg-canvas-tint text-brand" : "border-stroke-hairline text-content-empty"
|
|
@@ -49,37 +48,36 @@ const O = "flex shrink-0 items-center h-5 gap-0.5", P = "flex h-5 w-4 shrink-0 i
|
|
|
49
48
|
}
|
|
50
49
|
)
|
|
51
50
|
] });
|
|
52
|
-
},
|
|
51
|
+
}, M = ({
|
|
53
52
|
item: e,
|
|
54
53
|
level: r,
|
|
55
|
-
indentLevel:
|
|
54
|
+
indentLevel: s,
|
|
56
55
|
isCollapsed: n,
|
|
57
|
-
onToggle:
|
|
58
|
-
onToggleCollapse:
|
|
59
|
-
isAnyDragging:
|
|
60
|
-
enableDragDrop:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
renderActions: v
|
|
56
|
+
onToggle: a,
|
|
57
|
+
onToggleCollapse: l,
|
|
58
|
+
isAnyDragging: o = !1,
|
|
59
|
+
enableDragDrop: N = !0,
|
|
60
|
+
enableCollapse: g = !0,
|
|
61
|
+
shouldBlink: k = !1,
|
|
62
|
+
isDragDisabled: u = !1,
|
|
63
|
+
renderLabelExtras: f,
|
|
64
|
+
renderActions: m
|
|
67
65
|
}) => {
|
|
68
|
-
const { t:
|
|
69
|
-
attributes:
|
|
66
|
+
const { t: h } = v(), x = e.category === "structure", p = e.children && e.children.length > 0, b = !p && e.category !== "structure", L = R(() => !e.children || e.children.length === 0 ? !1 : E(e.children), [e.children]), {
|
|
67
|
+
attributes: y,
|
|
70
68
|
listeners: S,
|
|
71
69
|
setNodeRef: w,
|
|
72
|
-
isDragging:
|
|
73
|
-
} =
|
|
70
|
+
isDragging: I
|
|
71
|
+
} = j({
|
|
74
72
|
id: e.id,
|
|
75
73
|
data: {
|
|
76
74
|
level: r,
|
|
77
75
|
hasChildren: p,
|
|
78
76
|
isExpanded: !n
|
|
79
77
|
},
|
|
80
|
-
disabled:
|
|
78
|
+
disabled: x || e.disabled || u
|
|
81
79
|
});
|
|
82
|
-
return
|
|
80
|
+
return x ? /* @__PURE__ */ t(G, { item: e, isAnyDragging: o, renderActions: m }) : /* @__PURE__ */ t(
|
|
83
81
|
"div",
|
|
84
82
|
{
|
|
85
83
|
ref: w,
|
|
@@ -92,24 +90,24 @@ const O = "flex shrink-0 items-center h-5 gap-0.5", P = "flex h-5 w-4 shrink-0 i
|
|
|
92
90
|
children: /* @__PURE__ */ c(
|
|
93
91
|
"div",
|
|
94
92
|
{
|
|
95
|
-
className:
|
|
93
|
+
className: P(I, k),
|
|
96
94
|
style: {
|
|
97
|
-
paddingLeft: `${8 +
|
|
95
|
+
paddingLeft: `${8 + s * 20}px`
|
|
98
96
|
},
|
|
99
97
|
children: [
|
|
100
|
-
/* @__PURE__ */ c("div", { className:
|
|
101
|
-
/* @__PURE__ */ t("div", { className:
|
|
98
|
+
/* @__PURE__ */ c("div", { className: z, children: [
|
|
99
|
+
/* @__PURE__ */ t("div", { className: A, children: g && p && /* @__PURE__ */ t(
|
|
102
100
|
"button",
|
|
103
101
|
{
|
|
104
102
|
type: "button",
|
|
105
103
|
onClick: (i) => {
|
|
106
|
-
i.stopPropagation(),
|
|
104
|
+
i.stopPropagation(), l(e.id);
|
|
107
105
|
},
|
|
108
106
|
onMouseDown: (i) => i.stopPropagation(),
|
|
109
107
|
className: "flex h-4 w-4 items-center justify-center rounded-full p-0 hover:bg-canvas-muted transition-colors text-content-icon hover:text-brand",
|
|
110
|
-
"aria-label":
|
|
108
|
+
"aria-label": h(n ? "nestedList.expand" : "nestedList.collapse"),
|
|
111
109
|
children: /* @__PURE__ */ t(
|
|
112
|
-
|
|
110
|
+
D,
|
|
113
111
|
{
|
|
114
112
|
size: "16px",
|
|
115
113
|
className: d("transition-transform", !n && "rotate-90")
|
|
@@ -118,23 +116,23 @@ const O = "flex shrink-0 items-center h-5 gap-0.5", P = "flex h-5 w-4 shrink-0 i
|
|
|
118
116
|
}
|
|
119
117
|
) }),
|
|
120
118
|
/* @__PURE__ */ t("div", { className: "flex h-5 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ t(
|
|
121
|
-
|
|
119
|
+
H,
|
|
122
120
|
{
|
|
123
121
|
id: `checkbox-${e.id}`,
|
|
124
|
-
checked:
|
|
125
|
-
onCheckedChange: () =>
|
|
122
|
+
checked: L ? "indeterminate" : e.checked,
|
|
123
|
+
onCheckedChange: () => a(e.id),
|
|
126
124
|
disabled: e.disabled,
|
|
127
125
|
className: "mr-0",
|
|
128
126
|
"aria-label": e.label
|
|
129
127
|
}
|
|
130
128
|
) }),
|
|
131
|
-
|
|
129
|
+
N && !u ? /* @__PURE__ */ t(
|
|
132
130
|
"div",
|
|
133
131
|
{
|
|
134
|
-
...
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
...y,
|
|
133
|
+
...S,
|
|
134
|
+
"aria-label": `${h("aria.dragHandle")}: ${e.label}`,
|
|
135
|
+
className: O,
|
|
138
136
|
style: {
|
|
139
137
|
pointerEvents: "auto",
|
|
140
138
|
position: "relative",
|
|
@@ -142,9 +140,9 @@ const O = "flex shrink-0 items-center h-5 gap-0.5", P = "flex h-5 w-4 shrink-0 i
|
|
|
142
140
|
touchAction: "none"
|
|
143
141
|
},
|
|
144
142
|
onPointerDown: (i) => {
|
|
145
|
-
|
|
143
|
+
i.stopPropagation();
|
|
146
144
|
},
|
|
147
|
-
children: /* @__PURE__ */ t(
|
|
145
|
+
children: /* @__PURE__ */ t($, { size: "14px" })
|
|
148
146
|
}
|
|
149
147
|
) : /* @__PURE__ */ t("div", { className: "w-5 shrink-0", "aria-hidden": !0 })
|
|
150
148
|
] }),
|
|
@@ -156,16 +154,16 @@ const O = "flex shrink-0 items-center h-5 gap-0.5", P = "flex h-5 w-4 shrink-0 i
|
|
|
156
154
|
children: /* @__PURE__ */ t("span", { className: "break-words", children: e.label })
|
|
157
155
|
}
|
|
158
156
|
),
|
|
159
|
-
|
|
160
|
-
/* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children:
|
|
157
|
+
f?.(e, { isLeaf: b, level: r }) ? /* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children: f(e, { isLeaf: b, level: r }) }) : null,
|
|
158
|
+
/* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children: m?.(e, { isLeaf: b, level: r }) })
|
|
161
159
|
]
|
|
162
160
|
}
|
|
163
161
|
)
|
|
164
162
|
}
|
|
165
163
|
);
|
|
166
|
-
},
|
|
164
|
+
}, W = C.memo(M);
|
|
167
165
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
O as DRAG_HANDLE_CLASS,
|
|
167
|
+
z as LEADING_RAIL_CLASS,
|
|
168
|
+
W as SortableItem
|
|
171
169
|
};
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import { DragEndEvent, CollisionDetection } from '@dnd-kit/core';
|
|
2
2
|
import { NestedListItem } from '../nested-list.types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Custom collision detection: closestCorners but filters out section header
|
|
5
|
+
* sortable nodes from results. This prevents headers from "stealing" drops
|
|
6
|
+
* that should target child items.
|
|
7
|
+
*
|
|
8
|
+
* - When children exist nearby: header is filtered → closest child wins →
|
|
9
|
+
* handleCrossParentReorder gives precise positioning
|
|
10
|
+
* - When section is empty: only the droppable node (droppable-root-*)
|
|
11
|
+
* exists → not filtered → handleDropOnSection handles it
|
|
12
|
+
* - Edge case (no children nearby): headers are included as fallback
|
|
13
|
+
*/
|
|
4
14
|
export declare const customCollisionDetection: CollisionDetection;
|
|
15
|
+
declare function findItemLevel(items: NestedListItem[], itemId: string, currentLevel?: number): number | null;
|
|
16
|
+
declare function findParentId(items: NestedListItem[], itemId: string, parentId?: string | null): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Find the direct child of a section that contains (or is) the given item.
|
|
19
|
+
* Returns the level-1 ancestor's ID within the section.
|
|
20
|
+
*/
|
|
5
21
|
interface UseNestedListDragDropProps {
|
|
6
22
|
items: NestedListItem[];
|
|
7
23
|
onDragEnd?: (activeId: string, overId: string | null) => void;
|
|
8
24
|
collapsedItems?: Record<string, boolean>;
|
|
9
25
|
canDrag?: (item: NestedListItem, level: number) => boolean;
|
|
10
|
-
isValidDropTarget?: (options: {
|
|
11
|
-
activeItemId: string;
|
|
12
|
-
overItemId: string;
|
|
13
|
-
items: NestedListItem[];
|
|
14
|
-
insertAfter?: boolean;
|
|
15
|
-
}) => boolean;
|
|
16
26
|
}
|
|
17
|
-
export declare const useNestedListDragDrop: ({ items, onDragEnd, collapsedItems, canDrag,
|
|
27
|
+
export declare const useNestedListDragDrop: ({ items, onDragEnd, collapsedItems, canDrag, }: UseNestedListDragDropProps) => {
|
|
18
28
|
sensors: import('@dnd-kit/core').SensorDescriptor<import('@dnd-kit/core').SensorOptions>[];
|
|
19
29
|
handleDragEnd: (event: DragEndEvent, setItems: (updater: (prevItems: NestedListItem[]) => NestedListItem[]) => void) => void;
|
|
20
30
|
isValidDrop: (activeItemId: string | null, overItemId: string | null) => boolean;
|
|
21
|
-
findItemLevel: typeof
|
|
22
|
-
findParentId: typeof
|
|
31
|
+
findItemLevel: typeof findItemLevel;
|
|
32
|
+
findParentId: typeof findParentId;
|
|
23
33
|
};
|
|
24
34
|
export {};
|
|
@@ -1,58 +1,247 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { useSensors as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useCallback as F } from "react";
|
|
2
|
+
import { useSensors as Z, useSensor as V, MouseSensor as $, TouchSensor as E, closestCenter as p } from "@dnd-kit/core";
|
|
3
|
+
import { arrayMove as k } from "@dnd-kit/sortable";
|
|
4
|
+
const W = "droppable-", _ = /* @__PURE__ */ new Set(["root-frozen", "root-scrollable"]);
|
|
5
|
+
function X(f) {
|
|
6
|
+
if (f.startsWith(W)) {
|
|
7
|
+
const r = f.slice(W.length);
|
|
8
|
+
if (_.has(r)) return r;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
function q(f, r, d) {
|
|
13
|
+
return f.map((e) => {
|
|
14
|
+
if (e.children && e.children.length > 0) {
|
|
15
|
+
const C = e.children.findIndex(
|
|
16
|
+
(P) => P.id === r
|
|
17
|
+
), b = e.children.findIndex(
|
|
18
|
+
(P) => P.id === d
|
|
19
|
+
);
|
|
20
|
+
if (C !== -1 && b !== -1) {
|
|
21
|
+
const P = k(e.children, C, b);
|
|
22
|
+
return {
|
|
23
|
+
...e,
|
|
24
|
+
children: P
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
...e,
|
|
29
|
+
children: q(e.children, r, d)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return e;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const nn = (f) => {
|
|
36
|
+
const r = p(f), d = r.filter(
|
|
37
|
+
(e) => !_.has(e.id)
|
|
8
38
|
);
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
return d.length > 0 ? d : r;
|
|
40
|
+
};
|
|
41
|
+
function M(f, r) {
|
|
42
|
+
for (const d of f) {
|
|
43
|
+
if (d.id === r) return d;
|
|
44
|
+
if (d.children) {
|
|
45
|
+
const e = M(d.children, r);
|
|
46
|
+
if (e) return e;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function T(f, r, d = 0) {
|
|
51
|
+
for (const e of f) {
|
|
52
|
+
if (e.id === r) return d;
|
|
53
|
+
if (e.children) {
|
|
54
|
+
const C = T(e.children, r, d + 1);
|
|
55
|
+
if (C !== null) return C;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function G(f, r, d = null) {
|
|
61
|
+
for (const e of f) {
|
|
62
|
+
if (e.id === r) return d;
|
|
63
|
+
if (e.children) {
|
|
64
|
+
const C = G(e.children, r, e.id);
|
|
65
|
+
if (C !== null) return C;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function j(f, r) {
|
|
71
|
+
for (const d of f) {
|
|
72
|
+
if (d.id === r) return null;
|
|
73
|
+
if (d.children && M(d.children, r))
|
|
74
|
+
return d.id;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const rn = ({
|
|
79
|
+
items: f,
|
|
80
|
+
onDragEnd: r,
|
|
81
|
+
collapsedItems: d = {},
|
|
82
|
+
canDrag: e
|
|
16
83
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
),
|
|
21
|
-
(
|
|
22
|
-
const
|
|
23
|
-
!s
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
84
|
+
const C = Z(
|
|
85
|
+
V($),
|
|
86
|
+
V(E)
|
|
87
|
+
), b = F(
|
|
88
|
+
(o, c, u) => {
|
|
89
|
+
const s = G(o, u);
|
|
90
|
+
if (!s) return null;
|
|
91
|
+
const n = o.findIndex(
|
|
92
|
+
(i) => i.id === s
|
|
93
|
+
), t = o.findIndex(
|
|
94
|
+
(i) => i.id === c
|
|
95
|
+
);
|
|
96
|
+
if (n !== -1 && t !== -1) {
|
|
97
|
+
const i = k(
|
|
98
|
+
o,
|
|
99
|
+
t,
|
|
100
|
+
n
|
|
101
|
+
);
|
|
102
|
+
return r?.(c, s), i;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
},
|
|
106
|
+
[r]
|
|
107
|
+
), P = F(
|
|
108
|
+
(o, c, u) => {
|
|
109
|
+
const s = o.findIndex((t) => t.id === c), n = o.findIndex((t) => t.id === u);
|
|
110
|
+
if (s !== -1 && n !== -1) {
|
|
111
|
+
const t = k(o, s, n);
|
|
112
|
+
return r?.(c, u), t;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
},
|
|
116
|
+
[r]
|
|
117
|
+
), z = F(
|
|
118
|
+
(o, c, u) => {
|
|
119
|
+
const s = q(o, c, u);
|
|
120
|
+
return r?.(c, u), s;
|
|
121
|
+
},
|
|
122
|
+
[r]
|
|
123
|
+
), w = F(
|
|
124
|
+
(o, c, u, s = !1) => {
|
|
125
|
+
const n = M(o, c);
|
|
126
|
+
if (!n) return null;
|
|
127
|
+
const t = (h) => h.filter((l) => l.id !== c).map(
|
|
128
|
+
(l) => l.children ? { ...l, children: t(l.children) } : l
|
|
129
|
+
).filter((l) => !(l.children && l.children.length === 0 && l.category === "group")), i = M(o, u), a = !n.children || n.children.length === 0, R = i?.children && i.children.length > 0, Y = d[u] === !0, B = a && R && !Y && s, N = (h) => {
|
|
130
|
+
for (let l = 0; l < h.length; l++) {
|
|
131
|
+
if (h[l].id === u)
|
|
132
|
+
if (B) {
|
|
133
|
+
const L = {
|
|
134
|
+
...h[l],
|
|
135
|
+
children: [n, ...h[l].children || []]
|
|
136
|
+
}, x = [...h];
|
|
137
|
+
return x[l] = L, { nodes: x, inserted: !0 };
|
|
138
|
+
} else {
|
|
139
|
+
const L = [...h], x = s ? l + 1 : l;
|
|
140
|
+
return L.splice(x, 0, n), { nodes: L, inserted: !0 };
|
|
141
|
+
}
|
|
142
|
+
if (h[l].children) {
|
|
143
|
+
const L = N(h[l].children);
|
|
144
|
+
if (L.inserted) {
|
|
145
|
+
const x = [...h];
|
|
146
|
+
return x[l] = { ...h[l], children: L.nodes }, { nodes: x, inserted: !0 };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return { nodes: h, inserted: !1 };
|
|
151
|
+
}, S = t(o), { nodes: O, inserted: g } = N(S);
|
|
152
|
+
return g ? (r?.(c, u), O) : null;
|
|
153
|
+
},
|
|
154
|
+
[r, d]
|
|
155
|
+
), A = F(
|
|
156
|
+
(o, c, u) => {
|
|
157
|
+
const s = M(o, c);
|
|
158
|
+
if (!s) return o;
|
|
159
|
+
const n = (i) => i.filter((a) => a.id !== c).map(
|
|
160
|
+
(a) => a.children ? { ...a, children: n(a.children) } : a
|
|
161
|
+
), t = o.map((i) => {
|
|
162
|
+
let a = i.children ? n(i.children) : [];
|
|
163
|
+
return i.id === u && (a = [s, ...a]), { ...i, children: a };
|
|
164
|
+
});
|
|
165
|
+
return r?.(c, u), t;
|
|
166
|
+
},
|
|
167
|
+
[r]
|
|
168
|
+
), J = F(
|
|
169
|
+
(o, c) => {
|
|
170
|
+
const { active: u, over: s } = o;
|
|
171
|
+
!s || u.id === s.id || c((n) => {
|
|
172
|
+
const t = u.id, i = s.id;
|
|
173
|
+
if (e) {
|
|
174
|
+
const S = M(n, t), O = T(n, t);
|
|
175
|
+
if (S && O !== null && !e(S, O))
|
|
176
|
+
return n;
|
|
177
|
+
}
|
|
178
|
+
const a = X(i);
|
|
179
|
+
if (a)
|
|
180
|
+
return A(n, t, a);
|
|
181
|
+
const R = T(n, t), Y = T(n, i), B = G(n, t), N = G(n, i);
|
|
182
|
+
if (_.has(i) && R !== null && R > 0)
|
|
183
|
+
return A(n, t, i);
|
|
184
|
+
if (R === 0 && Y !== null && Y > 0)
|
|
185
|
+
return b(
|
|
186
|
+
n,
|
|
187
|
+
t,
|
|
188
|
+
i
|
|
189
|
+
) || n;
|
|
190
|
+
if (R === null || Y === null)
|
|
191
|
+
return n;
|
|
192
|
+
if (R > 0 && Y > 0 && B !== N) {
|
|
193
|
+
const S = j(n, t), O = j(n, i);
|
|
194
|
+
if (S && O && S !== O) {
|
|
195
|
+
const x = u.rect.current.translated, y = s.rect;
|
|
196
|
+
let H = !1;
|
|
197
|
+
if (x && y) {
|
|
198
|
+
const Q = x.top + x.height / 2, U = y.top + y.height / 2;
|
|
199
|
+
H = Q > U;
|
|
200
|
+
}
|
|
201
|
+
return w(n, t, i, H) || n;
|
|
202
|
+
}
|
|
203
|
+
const g = u.rect.current.translated, h = s.rect;
|
|
204
|
+
let l = !1;
|
|
205
|
+
if (g && h) {
|
|
206
|
+
const x = g.top + g.height / 2, y = h.top + h.height / 2;
|
|
207
|
+
l = x > y;
|
|
208
|
+
}
|
|
209
|
+
return w(n, t, i, l) || n;
|
|
210
|
+
}
|
|
211
|
+
return R === 0 ? P(n, t, i) || n : z(n, t, i);
|
|
30
212
|
});
|
|
31
213
|
},
|
|
32
|
-
[
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
214
|
+
[
|
|
215
|
+
b,
|
|
216
|
+
P,
|
|
217
|
+
z,
|
|
218
|
+
w,
|
|
219
|
+
A,
|
|
220
|
+
e
|
|
221
|
+
]
|
|
222
|
+
), K = F(
|
|
223
|
+
(o, c) => {
|
|
224
|
+
if (!o || !c || o === c)
|
|
36
225
|
return !1;
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
226
|
+
if (e) {
|
|
227
|
+
const n = M(f, o), t = T(f, o);
|
|
228
|
+
if (n && t !== null && !e(n, t))
|
|
40
229
|
return !1;
|
|
41
230
|
}
|
|
42
|
-
const
|
|
43
|
-
return
|
|
231
|
+
const u = o ? T(f, o) : null, s = c ? T(f, c) : null;
|
|
232
|
+
return X(c) !== null || _.has(c) ? !0 : u === null || s === null ? !1 : u === 0 && s > 0 || u === s || u > 0 && s > 0;
|
|
44
233
|
},
|
|
45
|
-
[
|
|
234
|
+
[f, e]
|
|
46
235
|
);
|
|
47
236
|
return {
|
|
48
|
-
sensors:
|
|
49
|
-
handleDragEnd:
|
|
50
|
-
isValidDrop:
|
|
51
|
-
findItemLevel:
|
|
52
|
-
findParentId:
|
|
237
|
+
sensors: C,
|
|
238
|
+
handleDragEnd: J,
|
|
239
|
+
isValidDrop: K,
|
|
240
|
+
findItemLevel: T,
|
|
241
|
+
findParentId: G
|
|
53
242
|
};
|
|
54
243
|
};
|
|
55
244
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
245
|
+
nn as customCollisionDetection,
|
|
246
|
+
rn as useNestedListDragDrop
|
|
58
247
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/** Flat row count at or above which NestedListContent virtualizes rows. */
|
|
2
2
|
export declare const NESTED_LIST_VIRTUALIZATION_THRESHOLD = 80;
|
|
3
|
-
export declare const NESTED_LIST_VIRTUAL_ROW_ESTIMATE_PX =
|
|
3
|
+
export declare const NESTED_LIST_VIRTUAL_ROW_ESTIMATE_PX = 32;
|
|
4
4
|
export declare const NESTED_LIST_VIRTUAL_OVERSCAN = 12;
|
|
5
|
-
export declare const NESTED_LIST_ROOT_FROZEN_ID = "root-frozen";
|
|
6
|
-
export declare const NESTED_LIST_ROOT_SCROLLABLE_ID = "root-scrollable";
|
|
7
|
-
export declare const NESTED_LIST_SECTION_IDS: Set<string>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
T,
|
|
3
|
-
_
|
|
4
|
-
]);
|
|
1
|
+
const T = 80, _ = 32, E = 12;
|
|
5
2
|
export {
|
|
6
|
-
T as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
E as NESTED_LIST_VIRTUALIZATION_THRESHOLD,
|
|
10
|
-
I as NESTED_LIST_VIRTUAL_OVERSCAN,
|
|
11
|
-
S as NESTED_LIST_VIRTUAL_ROW_ESTIMATE_PX
|
|
3
|
+
T as NESTED_LIST_VIRTUALIZATION_THRESHOLD,
|
|
4
|
+
E as NESTED_LIST_VIRTUAL_OVERSCAN,
|
|
5
|
+
_ as NESTED_LIST_VIRTUAL_ROW_ESTIMATE_PX
|
|
12
6
|
};
|