impact-nova 2.5.11 → 2.5.13
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 +1 -0
- package/dist/components/data/data-table/build-column-tree-from-grid.js +55 -50
- package/dist/components/data/data-table/column-picker-authority.d.ts +34 -0
- package/dist/components/data/data-table/column-picker-authority.js +116 -0
- package/dist/components/data/data-table/column-picker-drop-validation.d.ts +7 -0
- package/dist/components/data/data-table/column-picker-drop-validation.js +37 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +2 -0
- package/dist/components/data/data-table/data-table-column-apply.js +84 -73
- package/dist/components/data/data-table/data-table-column-list-tree-apply.d.ts +10 -0
- package/dist/components/data/data-table/data-table-column-list-tree-apply.js +79 -0
- package/dist/components/data/data-table/data-table-column-list.js +94 -64
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +12 -6
- package/dist/components/data/data-table/data-table-column-tree-cache.js +250 -131
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.d.ts +26 -0
- package/dist/components/data/data-table/data-table-flat-column-virtual-rows.js +195 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.d.ts +1 -0
- package/dist/components/data/data-table/data-table-picker-column-eligibility.js +7 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.d.ts +5 -0
- package/dist/components/data/data-table/patch-column-tree-indicators-from-grid.js +28 -11
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.d.ts +12 -0
- package/dist/components/data/data-table/reconcile-column-tree-from-grid.js +12 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +10 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +250 -196
- package/dist/components/data/expandable-list-item/expandable-list-item-attributes.js +2 -3
- package/dist/components/data/expandable-list-item/expandable-list-item-metrics.js +2 -3
- package/dist/components/data/nested-list/components/NestedListContent.d.ts +10 -2
- package/dist/components/data/nested-list/components/NestedListContent.js +253 -138
- package/dist/components/data/nested-list/components/SortableItem.d.ts +2 -1
- package/dist/components/data/nested-list/components/SortableItem.js +62 -60
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.d.ts +10 -20
- package/dist/components/data/nested-list/hooks/useNestedListDragDrop.js +44 -233
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.d.ts +24 -0
- package/dist/components/data/nested-list/hooks/useVirtualNestedListDrag.js +128 -0
- package/dist/components/data/nested-list/nested-list-constants.d.ts +4 -1
- package/dist/components/data/nested-list/nested-list-constants.js +10 -4
- package/dist/components/data/nested-list/nested-list-display-utils.d.ts +11 -0
- package/dist/components/data/nested-list/nested-list-display-utils.js +74 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.d.ts +31 -0
- package/dist/components/data/nested-list/nested-list-drop-engine.js +209 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.d.ts +26 -0
- package/dist/components/data/nested-list/nested-list-flat-virtual-handlers.js +67 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.d.ts +4 -0
- package/dist/components/data/nested-list/nested-list-item-tree-mutations.js +43 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.d.ts +3 -0
- package/dist/components/data/nested-list/nested-list-lazy-flat-rows.js +34 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.d.ts +9 -0
- package/dist/components/data/nested-list/nested-list-row-estimates.js +14 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.d.ts +36 -0
- package/dist/components/data/nested-list/nested-list-scroll-anchor.js +47 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.d.ts +59 -0
- package/dist/components/data/nested-list/nested-list-virtual-drop.js +341 -0
- package/dist/components/data/nested-list/nested-list.js +322 -336
- package/dist/components/data/nested-list/nested-list.types.d.ts +17 -0
- package/dist/components/data-display/calendar/calendar-apply-validation.d.ts +0 -2
- package/dist/components/data-display/calendar/calendar-apply-validation.js +67 -64
- package/dist/components/data-display/calendar/calendar-day-picker-components.d.ts +2 -4
- package/dist/components/data-display/calendar/calendar-day-picker-components.js +152 -163
- package/dist/components/data-display/calendar/calendar-day-picker-view.js +76 -77
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.d.ts +0 -6
- package/dist/components/data-display/calendar/calendar-fiscal-period-nav.js +18 -34
- package/dist/components/data-display/calendar/calendar-month-utils.d.ts +0 -5
- package/dist/components/data-display/calendar/calendar-month-utils.js +64 -85
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +0 -1
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +30 -31
- package/dist/components/data-display/calendar/calendar-week-number-cell.d.ts +1 -2
- package/dist/components/data-display/calendar/calendar-week-number-cell.js +41 -55
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +0 -2
- package/dist/components/data-display/calendar/calendar-year-panes.js +1 -3
- package/dist/components/data-display/calendar/calendar.js +143 -146
- package/dist/components/data-display/calendar/calendar.types.d.ts +0 -5
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.d.ts +1 -2
- package/dist/components/data-display/calendar/use-calendar-day-picker-config.js +74 -79
- package/dist/components/data-display/calendar/use-calendar-state.d.ts +1 -3
- package/dist/components/data-display/calendar/use-calendar-state.js +325 -403
- package/dist/components/feedback/tooltip/tab-tooltip-render.js +2 -3
- 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/date-picker/date-picker.js +58 -60
- package/dist/components/forms/date-picker/date-picker.types.d.ts +0 -5
- package/dist/components/forms/date-picker/date-range-picker.js +64 -66
- package/dist/components/forms/date-picker/fiscal-pass-through.d.ts +0 -1
- package/dist/components/forms/date-picker/fiscal-pass-through.js +2 -3
- package/dist/components/forms/date-picker/month-picker.js +59 -61
- package/dist/components/forms/date-picker/month-range-picker.js +61 -63
- package/dist/components/forms/date-picker/multi-date-picker.js +49 -51
- package/dist/components/forms/date-picker/multi-month-picker.js +47 -49
- package/dist/components/forms/date-picker/multi-quarter-picker.js +44 -46
- package/dist/components/forms/date-picker/multi-week-picker.js +51 -53
- package/dist/components/forms/date-picker/multi-year-picker.js +46 -48
- package/dist/components/forms/date-picker/quarter-picker.js +44 -46
- package/dist/components/forms/date-picker/quarter-range-picker.js +43 -45
- package/dist/components/forms/date-picker/week-picker.js +66 -68
- package/dist/components/forms/date-picker/week-range-picker.js +80 -82
- package/dist/components/forms/date-picker/year-picker.js +45 -47
- package/dist/components/forms/date-picker/year-range-picker.js +45 -47
- package/dist/components/forms/select/components/SelectTriggerValue.js +2 -3
- package/dist/components/forms/select/components/Submenu.js +2 -3
- package/dist/form-react/Fields/DateInputField.js +50 -51
- package/dist/form-react/Fields/DateRangeField.js +13 -14
- package/dist/form-react/Fields/MonthRangeField.js +28 -29
- package/dist/form-react/Fields/MultiMonthPickerField.js +12 -13
- package/dist/form-react/Fields/MultiWeekPickerField.js +17 -18
- package/dist/form-react/Fields/WeekRangePicker.js +21 -22
- package/dist/form-react/types/fields.types.d.ts +0 -12
- package/dist/impact-nova.css +1 -1
- package/dist/lib/hash/fnv1a128.d.ts +16 -0
- package/dist/lib/hash/fnv1a128.js +21 -0
- package/dist/llms/rules/ag-grid.js +1 -1
- package/package.json +1 -1
- package/dist/components/data-display/calendar/calendar-available-view.d.ts +0 -27
- package/dist/components/data-display/calendar/calendar-available-view.js +0 -85
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { useState as B, useRef as d, useEffect as w, useCallback as a } from "react";
|
|
2
|
+
import { resolveVirtualDropTarget as M, clampPointerToScrollBounds as F } from "../nested-list-virtual-drop.js";
|
|
3
|
+
function V({
|
|
4
|
+
items: S,
|
|
5
|
+
scrollElementRef: s,
|
|
6
|
+
virtualizer: L,
|
|
7
|
+
estimateRowSize: y,
|
|
8
|
+
onDrop: h,
|
|
9
|
+
collapsedItems: D = {}
|
|
10
|
+
}) {
|
|
11
|
+
const [v, C] = B(null), f = d(null), p = d(S), x = d(L), X = d(y), b = d(D), c = d(null), g = d(null), E = d(null);
|
|
12
|
+
w(() => {
|
|
13
|
+
p.current = S;
|
|
14
|
+
}), w(() => {
|
|
15
|
+
x.current = L;
|
|
16
|
+
}), w(() => {
|
|
17
|
+
X.current = y;
|
|
18
|
+
}), w(() => {
|
|
19
|
+
b.current = D;
|
|
20
|
+
});
|
|
21
|
+
const I = a((e, r) => {
|
|
22
|
+
const n = s.current;
|
|
23
|
+
return n ? M({
|
|
24
|
+
clientX: e,
|
|
25
|
+
clientY: r,
|
|
26
|
+
scrollElement: n,
|
|
27
|
+
items: p.current,
|
|
28
|
+
virtualizer: x.current,
|
|
29
|
+
estimateRowSize: X.current,
|
|
30
|
+
offsetCacheHolder: E,
|
|
31
|
+
collapsedItems: b.current
|
|
32
|
+
}) : null;
|
|
33
|
+
}, [s]), m = a(() => {
|
|
34
|
+
f.current = null, C(null), g.current = null, c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
|
|
35
|
+
}, []), R = a(() => {
|
|
36
|
+
const e = f.current;
|
|
37
|
+
e?.dropTarget && e.draggedId !== e.dropTarget.overId && h(e.draggedId, e.dropTarget.overId, e.dropTarget.insertAfter);
|
|
38
|
+
}, [h]), P = a((e, r) => {
|
|
39
|
+
const n = f.current;
|
|
40
|
+
if (!n)
|
|
41
|
+
return;
|
|
42
|
+
const t = s.current, o = t?.getBoundingClientRect(), i = o ? F(e, r, o) : {
|
|
43
|
+
pointerX: e,
|
|
44
|
+
pointerY: r,
|
|
45
|
+
isInsideScrollContainer: !0
|
|
46
|
+
}, l = I(e, r), u = i.isInsideScrollContainer ? null : n.dropTarget, T = {
|
|
47
|
+
...n,
|
|
48
|
+
dropTarget: l ?? u,
|
|
49
|
+
pointerX: i.pointerX,
|
|
50
|
+
pointerY: i.pointerY,
|
|
51
|
+
isPointerInsideScrollContainer: i.isInsideScrollContainer
|
|
52
|
+
};
|
|
53
|
+
f.current = T, C(T), t && o && (r < o.top + 40 ? t.scrollTop -= 8 : r > o.bottom - 40 && (t.scrollTop += 8));
|
|
54
|
+
}, [I, s]), Y = a(() => {
|
|
55
|
+
c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
|
|
56
|
+
const e = g.current;
|
|
57
|
+
e && (P(e.clientX, e.clientY), g.current = null);
|
|
58
|
+
}, [P]), A = a((e, r) => {
|
|
59
|
+
g.current = { clientX: e, clientY: r }, c.current === null && (c.current = requestAnimationFrame(() => {
|
|
60
|
+
c.current = null;
|
|
61
|
+
const n = g.current;
|
|
62
|
+
n && (P(n.clientX, n.clientY), g.current = null);
|
|
63
|
+
}));
|
|
64
|
+
}, [P]), k = a((e, r) => {
|
|
65
|
+
const n = p.current.findIndex((T) => T.item.id === r), t = p.current[n]?.item;
|
|
66
|
+
if (!t || n === -1 || t.isDragDisabled || t.category === "structure")
|
|
67
|
+
return;
|
|
68
|
+
e.preventDefault(), E.current = null, s.current?.setPointerCapture(e.pointerId);
|
|
69
|
+
const o = s.current?.getBoundingClientRect(), i = o ? F(e.clientX, e.clientY, o) : {
|
|
70
|
+
pointerX: e.clientX,
|
|
71
|
+
pointerY: e.clientY,
|
|
72
|
+
isInsideScrollContainer: !0
|
|
73
|
+
}, l = I(e.clientX, e.clientY) ?? {
|
|
74
|
+
overId: r,
|
|
75
|
+
insertAfter: !1,
|
|
76
|
+
flatIndex: n
|
|
77
|
+
}, u = {
|
|
78
|
+
draggedId: r,
|
|
79
|
+
draggedItem: t,
|
|
80
|
+
dropTarget: l,
|
|
81
|
+
pointerX: i.pointerX,
|
|
82
|
+
pointerY: i.pointerY,
|
|
83
|
+
isPointerInsideScrollContainer: i.isInsideScrollContainer
|
|
84
|
+
};
|
|
85
|
+
f.current = u, C(u);
|
|
86
|
+
}, [I, s]);
|
|
87
|
+
w(() => {
|
|
88
|
+
if (!v)
|
|
89
|
+
return;
|
|
90
|
+
const e = (u) => {
|
|
91
|
+
A(u.clientX, u.clientY);
|
|
92
|
+
}, r = () => {
|
|
93
|
+
Y(), R(), m();
|
|
94
|
+
}, n = () => {
|
|
95
|
+
m();
|
|
96
|
+
}, t = () => {
|
|
97
|
+
m();
|
|
98
|
+
}, o = (u) => {
|
|
99
|
+
u.key === "Escape" && m();
|
|
100
|
+
};
|
|
101
|
+
window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", n), window.addEventListener("keydown", o);
|
|
102
|
+
const i = s.current;
|
|
103
|
+
i?.addEventListener("lostpointercapture", t);
|
|
104
|
+
const l = document.createElement("style");
|
|
105
|
+
return l.setAttribute("data-virtual-drag-cursor", "true"), l.textContent = "body, body * { cursor: grabbing !important; }", document.head.appendChild(l), () => {
|
|
106
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", n), window.removeEventListener("keydown", o), i?.removeEventListener("lostpointercapture", t), l.remove(), c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
|
|
107
|
+
};
|
|
108
|
+
}, [v, R, m, Y, A, s]);
|
|
109
|
+
const U = a((e, r) => {
|
|
110
|
+
const n = p.current.findIndex((i) => i.item.id === e);
|
|
111
|
+
if (n === -1)
|
|
112
|
+
return;
|
|
113
|
+
const t = r === "up" ? Math.max(0, n - 1) : Math.min(p.current.length - 1, n + 1);
|
|
114
|
+
if (t === n)
|
|
115
|
+
return;
|
|
116
|
+
const o = p.current[t];
|
|
117
|
+
o && h(e, o.item.id, r === "down");
|
|
118
|
+
}, [h]);
|
|
119
|
+
return {
|
|
120
|
+
dragSession: v,
|
|
121
|
+
handlePointerDown: k,
|
|
122
|
+
handleKeyboardReorder: U,
|
|
123
|
+
isDragging: v !== null
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
V as useVirtualNestedListDrag
|
|
128
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
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 = 28;
|
|
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,6 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = 80, S = 28, I = 12, T = "root-frozen", _ = "root-scrollable", o = /* @__PURE__ */ new Set([
|
|
2
|
+
T,
|
|
3
|
+
_
|
|
4
|
+
]);
|
|
2
5
|
export {
|
|
3
|
-
T as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
T as NESTED_LIST_ROOT_FROZEN_ID,
|
|
7
|
+
_ as NESTED_LIST_ROOT_SCROLLABLE_ID,
|
|
8
|
+
o as NESTED_LIST_SECTION_IDS,
|
|
9
|
+
E as NESTED_LIST_VIRTUALIZATION_THRESHOLD,
|
|
10
|
+
I as NESTED_LIST_VIRTUAL_OVERSCAN,
|
|
11
|
+
S as NESTED_LIST_VIRTUAL_ROW_ESTIMATE_PX
|
|
6
12
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NestedListItem } from './nested-list.types';
|
|
2
|
+
export declare function filterNestedListItemsBySearch(items: NestedListItem[], searchText: string): NestedListItem[];
|
|
3
|
+
export declare function updateNestedListParentCheckedState(items: NestedListItem[]): NestedListItem[];
|
|
4
|
+
export declare function extractNestedListCategories(items: NestedListItem[], getCategory?: (item: NestedListItem) => string | undefined): string[];
|
|
5
|
+
export declare function filterNestedListItemsByCategories(items: NestedListItem[], selectedCategories: Set<string>, getCategory?: (item: NestedListItem) => string | undefined): NestedListItem[];
|
|
6
|
+
export type FlattenedNestedListRow = {
|
|
7
|
+
item: NestedListItem;
|
|
8
|
+
level: number;
|
|
9
|
+
indentLevel: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function flattenNestedListTree(items: NestedListItem[], collapsedItems: Record<string, boolean>, activeId: string | null, level?: number, indentLevel?: number): FlattenedNestedListRow[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
function l(o, r) {
|
|
2
|
+
if (!r || typeof r != "string")
|
|
3
|
+
return o;
|
|
4
|
+
const c = r.toLowerCase(), t = [];
|
|
5
|
+
return o.forEach((n) => {
|
|
6
|
+
const s = n.label.toLowerCase().includes(c), e = n.children ? l(n.children, r) : void 0;
|
|
7
|
+
(s || e && e.length > 0) && t.push({
|
|
8
|
+
...n,
|
|
9
|
+
children: e || n.children
|
|
10
|
+
});
|
|
11
|
+
}), t;
|
|
12
|
+
}
|
|
13
|
+
function i(o) {
|
|
14
|
+
return o.map((r) => {
|
|
15
|
+
if (r.children && r.children.length > 0) {
|
|
16
|
+
const c = i(r.children), t = c.every((n) => n.checked);
|
|
17
|
+
return {
|
|
18
|
+
...r,
|
|
19
|
+
checked: t,
|
|
20
|
+
children: c
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return r;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function f(o, r) {
|
|
27
|
+
const c = /* @__PURE__ */ new Set(), t = (n) => {
|
|
28
|
+
n.forEach((s) => {
|
|
29
|
+
const e = r ? r(s) : s.category;
|
|
30
|
+
e && c.add(e), s.children && t(s.children);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return t(o), Array.from(c).sort();
|
|
34
|
+
}
|
|
35
|
+
function u(o, r, c) {
|
|
36
|
+
if (r.size === 0)
|
|
37
|
+
return o;
|
|
38
|
+
const t = [];
|
|
39
|
+
return o.forEach((n) => {
|
|
40
|
+
const s = c ? c(n) : n.category, e = s && r.has(s), d = n.children ? u(n.children, r, c) : void 0;
|
|
41
|
+
(e || d && d.length > 0) && t.push({
|
|
42
|
+
...n,
|
|
43
|
+
children: d
|
|
44
|
+
});
|
|
45
|
+
}), t;
|
|
46
|
+
}
|
|
47
|
+
function a(o, r, c, t = 0, n = 0) {
|
|
48
|
+
const s = [];
|
|
49
|
+
return o.forEach((e) => {
|
|
50
|
+
if (s.push({
|
|
51
|
+
item: e,
|
|
52
|
+
level: t,
|
|
53
|
+
indentLevel: e.category === "structure" ? 0 : n
|
|
54
|
+
}), !r[e.id] && e.children && e.children.length > 0 && e.id !== c) {
|
|
55
|
+
const h = e.category === "structure" ? 0 : n + 1;
|
|
56
|
+
s.push(
|
|
57
|
+
...a(
|
|
58
|
+
e.children,
|
|
59
|
+
r,
|
|
60
|
+
c,
|
|
61
|
+
t + 1,
|
|
62
|
+
h
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}), s;
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
f as extractNestedListCategories,
|
|
70
|
+
u as filterNestedListItemsByCategories,
|
|
71
|
+
l as filterNestedListItemsBySearch,
|
|
72
|
+
a as flattenNestedListTree,
|
|
73
|
+
i as updateNestedListParentCheckedState
|
|
74
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DragEndEvent } from '@dnd-kit/core';
|
|
2
|
+
import { NestedListItem } from './nested-list.types';
|
|
3
|
+
export { NESTED_LIST_SECTION_IDS } from './nested-list-constants';
|
|
4
|
+
export declare function getSectionIdFromDroppable(droppableId: string): string | null;
|
|
5
|
+
export declare function findNestedListItemById(items: NestedListItem[], id: string): NestedListItem | undefined;
|
|
6
|
+
export declare function findNestedListItemLevel(items: NestedListItem[], itemId: string, currentLevel?: number): number | null;
|
|
7
|
+
export declare function findNestedListParentId(items: NestedListItem[], itemId: string, parentId?: string | null): string | null;
|
|
8
|
+
export interface ApplyNestedListDropOptions {
|
|
9
|
+
activeId: string;
|
|
10
|
+
overId: string;
|
|
11
|
+
insertAfter: boolean;
|
|
12
|
+
collapsedItems?: Record<string, boolean>;
|
|
13
|
+
canDrag?: (item: NestedListItem, level: number) => boolean;
|
|
14
|
+
isValidDropTarget?: (options: {
|
|
15
|
+
activeItemId: string;
|
|
16
|
+
overItemId: string;
|
|
17
|
+
items: NestedListItem[];
|
|
18
|
+
insertAfter?: boolean;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function applyNestedListDrop(prevItems: NestedListItem[], options: ApplyNestedListDropOptions): NestedListItem[];
|
|
22
|
+
export declare function applyNestedListDragEndEvent(prevItems: NestedListItem[], event: DragEndEvent, options?: {
|
|
23
|
+
collapsedItems?: Record<string, boolean>;
|
|
24
|
+
canDrag?: (item: NestedListItem, level: number) => boolean;
|
|
25
|
+
isValidDropTarget?: (options: {
|
|
26
|
+
activeItemId: string;
|
|
27
|
+
overItemId: string;
|
|
28
|
+
items: NestedListItem[];
|
|
29
|
+
insertAfter?: boolean;
|
|
30
|
+
}) => boolean;
|
|
31
|
+
}): NestedListItem[];
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { arrayMove as C } from "@dnd-kit/sortable";
|
|
2
|
+
import { NESTED_LIST_SECTION_IDS as O } from "./nested-list-constants.js";
|
|
3
|
+
const N = "droppable-";
|
|
4
|
+
function A(n) {
|
|
5
|
+
if (n.startsWith(N)) {
|
|
6
|
+
const c = n.slice(N.length);
|
|
7
|
+
if (O.has(c)) return c;
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
function D(n, c) {
|
|
12
|
+
for (const e of n) {
|
|
13
|
+
if (e.id === c) return e;
|
|
14
|
+
if (e.children) {
|
|
15
|
+
const r = D(e.children, c);
|
|
16
|
+
if (r) return r;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function P(n, c, e = 0) {
|
|
21
|
+
for (const r of n) {
|
|
22
|
+
if (r.id === c) return e;
|
|
23
|
+
if (r.children) {
|
|
24
|
+
const t = P(r.children, c, e + 1);
|
|
25
|
+
if (t !== null) return t;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function I(n, c, e = null) {
|
|
31
|
+
for (const r of n) {
|
|
32
|
+
if (r.id === c) return e;
|
|
33
|
+
if (r.children) {
|
|
34
|
+
const t = I(r.children, c, r.id);
|
|
35
|
+
if (t !== null) return t;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
function R(n, c) {
|
|
41
|
+
for (const e of n) {
|
|
42
|
+
if (e.id === c) return null;
|
|
43
|
+
if (e.children && D(e.children, c))
|
|
44
|
+
return e.id;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function _(n, c, e) {
|
|
49
|
+
return n.map((r) => {
|
|
50
|
+
if (r.children && r.children.length > 0) {
|
|
51
|
+
const t = r.children.findIndex((i) => i.id === c), l = r.children.findIndex((i) => i.id === e);
|
|
52
|
+
return t !== -1 && l !== -1 ? {
|
|
53
|
+
...r,
|
|
54
|
+
children: C(r.children, t, l)
|
|
55
|
+
} : {
|
|
56
|
+
...r,
|
|
57
|
+
children: _(r.children, c, e)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return r;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function v(n, c, e, r) {
|
|
64
|
+
return n.map((t) => {
|
|
65
|
+
if (t.children && t.children.length > 0) {
|
|
66
|
+
const l = t.children.findIndex((d) => d.id === c), i = t.children.findIndex((d) => d.id === e);
|
|
67
|
+
if (l !== -1 && i !== -1) {
|
|
68
|
+
let d = i;
|
|
69
|
+
return r ? d = l < i ? i : i + 1 : d = l < i ? i - 1 : i, d = Math.max(0, Math.min(d, t.children.length - 1)), {
|
|
70
|
+
...t,
|
|
71
|
+
children: C(t.children, l, d)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
...t,
|
|
76
|
+
children: v(
|
|
77
|
+
t.children,
|
|
78
|
+
c,
|
|
79
|
+
e,
|
|
80
|
+
r
|
|
81
|
+
)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return t;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function G(n, c, e) {
|
|
88
|
+
const r = I(n, e);
|
|
89
|
+
if (!r) return null;
|
|
90
|
+
const t = n.findIndex((i) => i.id === r), l = n.findIndex((i) => i.id === c);
|
|
91
|
+
return t !== -1 && l !== -1 ? C(n, l, t) : null;
|
|
92
|
+
}
|
|
93
|
+
function V(n, c, e) {
|
|
94
|
+
const r = n.findIndex((l) => l.id === c), t = n.findIndex((l) => l.id === e);
|
|
95
|
+
return r !== -1 && t !== -1 ? C(n, r, t) : null;
|
|
96
|
+
}
|
|
97
|
+
function y(n, c, e, r, t) {
|
|
98
|
+
const l = D(n, c);
|
|
99
|
+
if (!l) return null;
|
|
100
|
+
const i = (u) => u.filter((o) => o.id !== c).map(
|
|
101
|
+
(o) => o.children ? { ...o, children: i(o.children) } : o
|
|
102
|
+
).filter((o) => !(o.children && o.children.length === 0 && o.category === "group")), d = D(n, e), a = !l.children || l.children.length === 0, f = !!(d?.children && d.children.length > 0), h = t[e] === !0, g = a && f && !h && r, L = (u) => {
|
|
103
|
+
for (let o = 0; o < u.length; o += 1) {
|
|
104
|
+
if (u[o].id === e) {
|
|
105
|
+
if (g) {
|
|
106
|
+
const F = {
|
|
107
|
+
...u[o],
|
|
108
|
+
children: [l, ...u[o].children || []]
|
|
109
|
+
}, E = [...u];
|
|
110
|
+
return E[o] = F, { nodes: E, inserted: !0 };
|
|
111
|
+
}
|
|
112
|
+
const T = [...u], S = r ? o + 1 : o;
|
|
113
|
+
return T.splice(S, 0, l), { nodes: T, inserted: !0 };
|
|
114
|
+
}
|
|
115
|
+
if (u[o].children) {
|
|
116
|
+
const T = L(u[o].children);
|
|
117
|
+
if (T.inserted) {
|
|
118
|
+
const S = [...u];
|
|
119
|
+
return S[o] = { ...u[o], children: T.nodes }, { nodes: S, inserted: !0 };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { nodes: u, inserted: !1 };
|
|
124
|
+
}, s = i(n), { nodes: x, inserted: B } = L(s);
|
|
125
|
+
return B ? x : null;
|
|
126
|
+
}
|
|
127
|
+
function M(n, c, e) {
|
|
128
|
+
const r = D(n, c);
|
|
129
|
+
if (!r) return n;
|
|
130
|
+
const t = (l) => l.filter((i) => i.id !== c).map(
|
|
131
|
+
(i) => i.children ? { ...i, children: t(i.children) } : i
|
|
132
|
+
);
|
|
133
|
+
return n.map((l) => {
|
|
134
|
+
let i = l.children ? t(l.children) : [];
|
|
135
|
+
return l.id === e && (i = [r, ...i]), { ...l, children: i };
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function W(n, c) {
|
|
139
|
+
const {
|
|
140
|
+
activeId: e,
|
|
141
|
+
overId: r,
|
|
142
|
+
insertAfter: t,
|
|
143
|
+
collapsedItems: l = {},
|
|
144
|
+
canDrag: i,
|
|
145
|
+
isValidDropTarget: d
|
|
146
|
+
} = c;
|
|
147
|
+
if (!r || e === r || d && !d({
|
|
148
|
+
activeItemId: e,
|
|
149
|
+
overItemId: r,
|
|
150
|
+
items: n,
|
|
151
|
+
insertAfter: t
|
|
152
|
+
}))
|
|
153
|
+
return n;
|
|
154
|
+
if (i) {
|
|
155
|
+
const s = D(n, e), x = P(n, e);
|
|
156
|
+
if (s && x !== null && !i(s, x))
|
|
157
|
+
return n;
|
|
158
|
+
}
|
|
159
|
+
const a = A(r);
|
|
160
|
+
if (a)
|
|
161
|
+
return M(n, e, a);
|
|
162
|
+
const f = P(n, e), h = P(n, r), g = I(n, e), L = I(n, r);
|
|
163
|
+
if (O.has(r) && f !== null && f > 0)
|
|
164
|
+
return M(n, e, r);
|
|
165
|
+
if (f === 0 && h !== null && h > 0)
|
|
166
|
+
return G(n, e, r) ?? n;
|
|
167
|
+
if (f === null || h === null)
|
|
168
|
+
return n;
|
|
169
|
+
if (f > 0 && h > 0 && g !== L) {
|
|
170
|
+
const s = R(n, e), x = R(n, r);
|
|
171
|
+
return y(
|
|
172
|
+
n,
|
|
173
|
+
e,
|
|
174
|
+
r,
|
|
175
|
+
t,
|
|
176
|
+
l
|
|
177
|
+
) ?? n;
|
|
178
|
+
}
|
|
179
|
+
return f === 0 ? V(n, e, r) ?? n : g === L ? v(n, e, r, t) : _(n, e, r);
|
|
180
|
+
}
|
|
181
|
+
function w(n, c, e = {}) {
|
|
182
|
+
const { active: r, over: t } = c;
|
|
183
|
+
if (!t || r.id === t.id)
|
|
184
|
+
return n;
|
|
185
|
+
const l = r.id, i = t.id, d = r.rect?.current?.translated, a = t.rect;
|
|
186
|
+
let f = !1;
|
|
187
|
+
if (d && a) {
|
|
188
|
+
const s = d.top + d.height / 2, x = a.top + a.height / 2;
|
|
189
|
+
f = s > x;
|
|
190
|
+
}
|
|
191
|
+
const h = P(n, l), g = P(n, i), L = h !== null && g !== null && h > 0 && g > 0 && !!(d && a);
|
|
192
|
+
return W(n, {
|
|
193
|
+
activeId: l,
|
|
194
|
+
overId: i,
|
|
195
|
+
insertAfter: L ? f : !1,
|
|
196
|
+
collapsedItems: e.collapsedItems,
|
|
197
|
+
canDrag: e.canDrag,
|
|
198
|
+
isValidDropTarget: e.isValidDropTarget
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export {
|
|
202
|
+
O as NESTED_LIST_SECTION_IDS,
|
|
203
|
+
w as applyNestedListDragEndEvent,
|
|
204
|
+
W as applyNestedListDrop,
|
|
205
|
+
D as findNestedListItemById,
|
|
206
|
+
P as findNestedListItemLevel,
|
|
207
|
+
I as findNestedListParentId,
|
|
208
|
+
A as getSectionIdFromDroppable
|
|
209
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FlatVirtualRowModel, NestedListItem } from './nested-list.types';
|
|
2
|
+
import { FlattenedNestedListRow } from './nested-list-display-utils';
|
|
3
|
+
export declare function computeFlatVirtualHeaderSelection(flatVirtualRowModel: FlatVirtualRowModel): {
|
|
4
|
+
allChecked: boolean;
|
|
5
|
+
someChecked: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function findFlatVirtualRowIndexByItemId(flatVirtualRowModel: FlatVirtualRowModel, itemId: string): number;
|
|
8
|
+
export interface ResolveVirtualDropReorderOptions {
|
|
9
|
+
activeId: string;
|
|
10
|
+
overId: string;
|
|
11
|
+
insertAfter: boolean;
|
|
12
|
+
flatVirtualRowModel: FlatVirtualRowModel | null;
|
|
13
|
+
displayItems: FlattenedNestedListRow[];
|
|
14
|
+
onVirtualReorder?: (fromIndex: number, toIndex: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveVirtualDropReorderIndices(options: ResolveVirtualDropReorderOptions): {
|
|
17
|
+
fromIndex: number;
|
|
18
|
+
toIndex: number;
|
|
19
|
+
} | null;
|
|
20
|
+
export interface FlatVirtualToggleChange {
|
|
21
|
+
itemId: string;
|
|
22
|
+
checked: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function resolveFlatVirtualToggleChange(flatVirtualRowModel: FlatVirtualRowModel, sectionItems: NestedListItem[], itemId: string): FlatVirtualToggleChange | null;
|
|
25
|
+
export declare function triggerFlatVirtualSelectAll(flatVirtualRowModel: FlatVirtualRowModel | null, allChecked: boolean, onFlatVirtualSelectAll?: (shouldSelectAll: boolean) => void): boolean;
|
|
26
|
+
export declare function triggerFlatVirtualItemToggle(flatVirtualRowModel: FlatVirtualRowModel | null, sectionItems: NestedListItem[], itemId: string, onItemToggle?: (changes: FlatVirtualToggleChange[]) => void): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NESTED_LIST_ROOT_FROZEN_ID as g, NESTED_LIST_ROOT_SCROLLABLE_ID as x } from "./nested-list-constants.js";
|
|
2
|
+
function h(r) {
|
|
3
|
+
let t = !0, e = !1;
|
|
4
|
+
for (let n = 0; n < r.rowCount; n += 1) {
|
|
5
|
+
const o = r.getRowAt(n);
|
|
6
|
+
if (o.item.category !== "structure" && (o.item.checked ? e = !0 : t = !1, e && !t))
|
|
7
|
+
break;
|
|
8
|
+
}
|
|
9
|
+
return { allChecked: t && e, someChecked: e };
|
|
10
|
+
}
|
|
11
|
+
function I(r, t) {
|
|
12
|
+
for (let e = 0; e < r.rowCount; e += 1)
|
|
13
|
+
if (r.getRowAt(e).item.id === t)
|
|
14
|
+
return e;
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
function w(r) {
|
|
18
|
+
const {
|
|
19
|
+
activeId: t,
|
|
20
|
+
overId: e,
|
|
21
|
+
insertAfter: n,
|
|
22
|
+
flatVirtualRowModel: o,
|
|
23
|
+
displayItems: l,
|
|
24
|
+
onVirtualReorder: a
|
|
25
|
+
} = r;
|
|
26
|
+
if (!a)
|
|
27
|
+
return null;
|
|
28
|
+
if (o) {
|
|
29
|
+
const i = I(o, t), s = I(o, e), f = n ? s + 1 : s;
|
|
30
|
+
return i !== -1 && f !== -1 && i !== f ? { fromIndex: i, toIndex: f } : null;
|
|
31
|
+
}
|
|
32
|
+
const u = l.findIndex((i) => i.item.id === t), d = l.findIndex((i) => i.item.id === e), c = n ? d + 1 : d;
|
|
33
|
+
return u !== -1 && c !== -1 && u !== c ? { fromIndex: u, toIndex: c } : null;
|
|
34
|
+
}
|
|
35
|
+
function m(r, t, e) {
|
|
36
|
+
if (e === g || e === x) {
|
|
37
|
+
const n = t.find((o) => o.id === e);
|
|
38
|
+
return { itemId: e, checked: !(n?.checked ?? !1) };
|
|
39
|
+
}
|
|
40
|
+
for (let n = 0; n < r.rowCount; n += 1) {
|
|
41
|
+
const o = r.getRowAt(n);
|
|
42
|
+
if (o.item.id === e)
|
|
43
|
+
return { itemId: e, checked: !o.item.checked };
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function k(r, t, e) {
|
|
48
|
+
return !r || !e ? !1 : (e(!t), !0);
|
|
49
|
+
}
|
|
50
|
+
function C(r, t, e, n) {
|
|
51
|
+
if (!r)
|
|
52
|
+
return !1;
|
|
53
|
+
const o = m(
|
|
54
|
+
r,
|
|
55
|
+
t,
|
|
56
|
+
e
|
|
57
|
+
);
|
|
58
|
+
return o ? (n?.([o]), !0) : !1;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
h as computeFlatVirtualHeaderSelection,
|
|
62
|
+
I as findFlatVirtualRowIndexByItemId,
|
|
63
|
+
m as resolveFlatVirtualToggleChange,
|
|
64
|
+
w as resolveVirtualDropReorderIndices,
|
|
65
|
+
C as triggerFlatVirtualItemToggle,
|
|
66
|
+
k as triggerFlatVirtualSelectAll
|
|
67
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NestedListItem, SelectionMode } from './nested-list.types';
|
|
2
|
+
export declare function findNestedListItemById(items: NestedListItem[], targetId: string): NestedListItem | null;
|
|
3
|
+
export declare function collectNestedListGroupItemIds(itemsToCollect: NestedListItem[]): string[];
|
|
4
|
+
export declare function updateNestedListParentsUpward(items: NestedListItem[], targetItemId: string, selectionMode: SelectionMode): NestedListItem[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SelectionMode as h } from "./nested-list.types.js";
|
|
2
|
+
function o(c, n) {
|
|
3
|
+
for (const r of c) {
|
|
4
|
+
if (r.id === n)
|
|
5
|
+
return r;
|
|
6
|
+
if (r.children) {
|
|
7
|
+
const d = o(r.children, n);
|
|
8
|
+
if (d)
|
|
9
|
+
return d;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function l(c) {
|
|
15
|
+
const n = [];
|
|
16
|
+
return c.forEach((r) => {
|
|
17
|
+
r.children && r.children.length > 0 && (n.push(r.id), n.push(...l(r.children)));
|
|
18
|
+
}), n;
|
|
19
|
+
}
|
|
20
|
+
function a(c, n, r) {
|
|
21
|
+
if (r === h.INDEPENDENT)
|
|
22
|
+
return c;
|
|
23
|
+
const d = (u, e) => u.id === e ? !0 : u.children ? u.children.some((t) => d(t, e)) : !1, f = (u) => u.map((e) => {
|
|
24
|
+
if (e.id === n)
|
|
25
|
+
return e;
|
|
26
|
+
if (e.children && d(e, n)) {
|
|
27
|
+
const t = f(e.children);
|
|
28
|
+
let i;
|
|
29
|
+
return r === h.CASCADE_UP_DOWN ? i = t.some((s) => s.checked) : i = t.every((s) => s.checked), {
|
|
30
|
+
...e,
|
|
31
|
+
checked: i,
|
|
32
|
+
children: t
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return e;
|
|
36
|
+
});
|
|
37
|
+
return f(c);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
l as collectNestedListGroupItemIds,
|
|
41
|
+
o as findNestedListItemById,
|
|
42
|
+
a as updateNestedListParentsUpward
|
|
43
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function u(e) {
|
|
2
|
+
const s = {
|
|
3
|
+
length: e.rowCount,
|
|
4
|
+
findIndex: (o) => {
|
|
5
|
+
for (let n = 0; n < e.rowCount; n += 1) {
|
|
6
|
+
const t = e.getRowAt(n);
|
|
7
|
+
if (o(t, n, s))
|
|
8
|
+
return n;
|
|
9
|
+
}
|
|
10
|
+
return -1;
|
|
11
|
+
},
|
|
12
|
+
slice: (o = 0, n = e.rowCount) => {
|
|
13
|
+
const t = [];
|
|
14
|
+
for (let r = o; r < n; r += 1)
|
|
15
|
+
t.push(e.getRowAt(r));
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return new Proxy(s, {
|
|
20
|
+
get(o, n) {
|
|
21
|
+
if (n === "length")
|
|
22
|
+
return e.rowCount;
|
|
23
|
+
if (n in o) {
|
|
24
|
+
const t = o[n];
|
|
25
|
+
return typeof t == "function" ? t.bind(o) : t;
|
|
26
|
+
}
|
|
27
|
+
if (typeof n == "string" && /^\d+$/.test(n))
|
|
28
|
+
return e.getRowAt(Number(n));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
u as createLazyFlatRowList
|
|
34
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NestedListItem } from './nested-list.types';
|
|
2
|
+
/** Empty section header + dashed drop zone (measured in column picker). */
|
|
3
|
+
export declare const NESTED_LIST_EMPTY_SECTION_ROW_PX = 68;
|
|
4
|
+
/** root-scrollable header only when children render as separate flat rows. */
|
|
5
|
+
export declare const NESTED_LIST_SCROLLABLE_HEADER_ROW_PX = 37;
|
|
6
|
+
/** root-frozen header only when children render as separate flat rows. */
|
|
7
|
+
export declare const NESTED_LIST_FROZEN_HEADER_ROW_PX = 25;
|
|
8
|
+
export declare function estimateNestedListRowHeight(item: NestedListItem | undefined): number;
|
|
9
|
+
export declare function sumNestedListRowHeightsUpTo(items: NestedListItem[], endIndexExclusive: number): number;
|