impact-nova 2.5.12 → 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/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-config.js +1 -1
- 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 +164 -234
- 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-footer.js +21 -21
- package/dist/components/data-display/calendar/calendar-month-picker-panel.js +49 -50
- 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-padding-week.utils.d.ts +1 -3
- package/dist/components/data-display/calendar/calendar-padding-week.utils.js +5 -7
- package/dist/components/data-display/calendar/calendar-period-cell.js +46 -45
- package/dist/components/data-display/calendar/calendar-quarter-panes.js +31 -33
- package/dist/components/data-display/calendar/calendar-selection-appearance.d.ts +0 -10
- package/dist/components/data-display/calendar/calendar-selection-appearance.js +39 -53
- package/dist/components/data-display/calendar/calendar-selection.d.ts +0 -25
- package/dist/components/data-display/calendar/calendar-selection.js +23 -52
- 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 +45 -59
- package/dist/components/data-display/calendar/calendar-week-utils.d.ts +3 -13
- package/dist/components/data-display/calendar/calendar-week-utils.js +50 -59
- package/dist/components/data-display/calendar/calendar-year-panes.d.ts +0 -3
- package/dist/components/data-display/calendar/calendar-year-panes.js +49 -53
- 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/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 +47 -51
- package/dist/components/forms/date-picker/multi-week-picker.js +51 -53
- package/dist/components/forms/date-picker/multi-year-picker.js +49 -53
- package/dist/components/forms/date-picker/quarter-picker.js +47 -51
- package/dist/components/forms/date-picker/quarter-range-picker.js +46 -50
- 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 +48 -52
- package/dist/components/forms/date-picker/year-range-picker.js +48 -52
- 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 +27 -35
- package/dist/form-react/Fields/WeekRangePicker.js +32 -33
- package/dist/form-react/types/fields.types.d.ts +0 -14
- package/dist/impact-nova-components.css +6 -13
- package/dist/impact-nova.css +1 -1
- package/dist/lib/fiscal-calendar/week-selection.js +2 -2
- 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/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.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
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.d.ts +0 -9
- package/dist/components/data-display/calendar/calendar-fiscal-day-cell.js +0 -45
- package/dist/components/data-display/calendar/calendar-injected-week-row.d.ts +0 -5
- package/dist/components/data-display/calendar/calendar-injected-week-row.js +0 -92
- package/dist/components/data-display/calendar/calendar-leading-week.utils.d.ts +0 -16
- package/dist/components/data-display/calendar/calendar-leading-week.utils.js +0 -51
- package/dist/components/data-display/calendar/calendar-orphan-week.d.ts +0 -23
- package/dist/components/forms/date-picker/fiscal-picker-fixtures.d.ts +0 -17
|
@@ -1,213 +1,328 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { DndContext as
|
|
5
|
-
import { SortableContext as
|
|
6
|
-
import { customCollisionDetection as
|
|
7
|
-
import { Drag as
|
|
8
|
-
import { useVirtualizedRows as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as C, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import G, { useRef as ne, useState as L, useCallback as I, useEffect as re, useLayoutEffect as H } from "react";
|
|
3
|
+
import { createPortal as Ne } from "react-dom";
|
|
4
|
+
import { DndContext as be } from "@dnd-kit/core";
|
|
5
|
+
import { SortableContext as ye } from "@dnd-kit/sortable";
|
|
6
|
+
import { customCollisionDetection as Ee } from "../hooks/useNestedListDragDrop.js";
|
|
7
|
+
import { Drag as Ae } from "impact-nova-icons";
|
|
8
|
+
import { useVirtualizedRows as Le } from "../../../../lib/virtualized/useVirtualizedRows.js";
|
|
9
|
+
import { NESTED_LIST_VIRTUAL_OVERSCAN as Ce, NESTED_LIST_VIRTUALIZATION_THRESHOLD as ze } from "../nested-list-constants.js";
|
|
10
|
+
import { estimateNestedListRowHeight as X } from "../nested-list-row-estimates.js";
|
|
11
|
+
import { useVirtualNestedListDrag as Re } from "../hooks/useVirtualNestedListDrag.js";
|
|
12
|
+
import { insertGapIndexFromDropTarget as Oe, isInsertGapVisibleOnMountedRows as _e, getInsertGapOffsetY as Te } from "../nested-list-virtual-drop.js";
|
|
13
|
+
import { createLazyFlatRowList as De } from "../nested-list-lazy-flat-rows.js";
|
|
14
|
+
import { findNestedListRowIndexByItemId as Pe, resolveNestedListRowOffset as Ye, captureNestedListScrollAnchor as Fe, restoreNestedListScrollAnchor as Ge } from "../nested-list-scroll-anchor.js";
|
|
15
|
+
const oe = "0 -2px 0 0 var(--color-primary)", He = "0 2px 0 0 var(--color-primary)", Xe = () => null, se = 32, ie = ({ item: z, pointerX: p, pointerY: R, isVisible: O }) => O ? Ne(
|
|
16
|
+
/* @__PURE__ */ i(
|
|
16
17
|
"div",
|
|
17
18
|
{
|
|
18
19
|
className: "fixed z-50 pointer-events-none",
|
|
19
|
-
style: { top: `${
|
|
20
|
-
children: /* @__PURE__ */
|
|
20
|
+
style: { top: `${R + 16}px`, left: `${p + 12}px` },
|
|
21
|
+
children: /* @__PURE__ */ C(
|
|
21
22
|
"div",
|
|
22
23
|
{
|
|
23
24
|
className: "inline-flex items-center gap-1.5 bg-canvas-elevated border border-stroke-subtle rounded px-2.5 py-1 shadow-md",
|
|
24
25
|
children: [
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ i(Ae, { size: "12px", className: "text-content-icon shrink-0" }),
|
|
27
|
+
/* @__PURE__ */ i("span", { className: "text-[13px] text-content capitalize select-none whitespace-nowrap", children: z.label })
|
|
27
28
|
]
|
|
28
29
|
}
|
|
29
30
|
)
|
|
30
31
|
}
|
|
31
32
|
),
|
|
32
33
|
document.body
|
|
33
|
-
),
|
|
34
|
-
isListCollapsed:
|
|
35
|
-
enableDragDrop:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
) : null, nt = ({
|
|
35
|
+
isListCollapsed: z,
|
|
36
|
+
enableDragDrop: p,
|
|
37
|
+
dragMode: R = "sortable",
|
|
38
|
+
sensors: O,
|
|
39
|
+
items: s,
|
|
40
|
+
flatVirtualRowModel: l = null,
|
|
41
|
+
renderItem: le,
|
|
42
|
+
onDragStart: k,
|
|
43
|
+
onDragOver: $,
|
|
44
|
+
onDragEnd: j,
|
|
45
|
+
onDragCancel: B,
|
|
46
|
+
activeId: c,
|
|
47
|
+
onToggleCollapse: U,
|
|
48
|
+
toggleCollapseHandlerRef: q,
|
|
49
|
+
collapsedItems: ce = {},
|
|
50
|
+
onVirtualDrop: K
|
|
44
51
|
}) => {
|
|
45
|
-
const
|
|
46
|
-
if (!e || !
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
(
|
|
52
|
+
const x = ne(null), _ = ne(null), [W, y] = L(null), [de, ae] = L(0), [T, ue] = L(0), E = I((e, t) => {
|
|
53
|
+
if (!e || !c) return null;
|
|
54
|
+
let n = e, r = "after";
|
|
55
|
+
if (n === "root-frozen" || n === "root-scrollable") {
|
|
56
|
+
const o = s.findIndex((d) => d.item.id === n);
|
|
57
|
+
if (o !== -1) {
|
|
58
|
+
const d = s.slice(o + 1).find(
|
|
59
|
+
(m) => m.item.id !== "root-frozen" && m.item.id !== "root-scrollable"
|
|
53
60
|
);
|
|
54
|
-
if (
|
|
55
|
-
|
|
61
|
+
if (d)
|
|
62
|
+
n = d.item.id, r = "before";
|
|
56
63
|
else {
|
|
57
|
-
const
|
|
58
|
-
(
|
|
64
|
+
const m = s.slice(0, o).filter(
|
|
65
|
+
(S) => S.item.id !== "root-frozen" && S.item.id !== "root-scrollable"
|
|
59
66
|
);
|
|
60
|
-
|
|
67
|
+
m.length > 0 && (n = m[m.length - 1].item.id, r = "after");
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
} else {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
|
|
71
|
+
const o = x.current;
|
|
72
|
+
if (o) {
|
|
73
|
+
const d = o.querySelector(`[data-item-id="${n}"]`);
|
|
74
|
+
if (d) {
|
|
75
|
+
const m = d.getBoundingClientRect(), S = m.top + m.height / 2;
|
|
76
|
+
r = t < S ? "before" : "after";
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
|
-
return { overId:
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
if (!
|
|
77
|
-
const e = (
|
|
78
|
-
|
|
80
|
+
return { overId: n, position: r };
|
|
81
|
+
}, [c, s]), [D, N] = L(null);
|
|
82
|
+
re(() => {
|
|
83
|
+
if (!c) return;
|
|
84
|
+
const e = (t) => {
|
|
85
|
+
ae(t.clientX), ue(t.clientY), N(E(W, t.clientY));
|
|
79
86
|
};
|
|
80
87
|
return window.addEventListener("pointermove", e), () => window.removeEventListener("pointermove", e);
|
|
81
|
-
}, [
|
|
82
|
-
if (!
|
|
88
|
+
}, [c, W, E]), re(() => {
|
|
89
|
+
if (!c) return;
|
|
83
90
|
const e = document.createElement("style");
|
|
84
91
|
return e.setAttribute("data-drag-cursor", "true"), e.textContent = "body, body * { cursor: grabbing !important; }", document.head.appendChild(e), () => {
|
|
85
92
|
e.remove();
|
|
86
93
|
};
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
}, [c]);
|
|
95
|
+
const me = G.useMemo(
|
|
96
|
+
() => l ? [] : s.map((e) => e.item.id),
|
|
97
|
+
[l, s]
|
|
98
|
+
), f = p && R === "virtual-index", A = G.useMemo(
|
|
99
|
+
() => l ? De(l) : s,
|
|
100
|
+
[l, s]
|
|
101
|
+
), a = l?.rowCount ?? s.length, w = (f || !p) && a >= ze, P = f || w ? a : 0, g = I(
|
|
102
|
+
(e) => l ? l.getRowAt(e) : s[e],
|
|
103
|
+
[l, s]
|
|
104
|
+
), b = I(
|
|
105
|
+
(e) => X(g(e)?.item),
|
|
106
|
+
[g]
|
|
107
|
+
), { virtualizer: u, virtualItems: Y, totalSize: Z, measureElement: fe } = Le({
|
|
108
|
+
scrollElementRef: x,
|
|
109
|
+
rowCount: P,
|
|
110
|
+
estimateSize: b,
|
|
111
|
+
overscan: Ce,
|
|
112
|
+
getItemKey: (e) => g(e)?.item.id ?? e,
|
|
113
|
+
scrollPaddingEnd: p ? se : void 0
|
|
94
114
|
});
|
|
95
|
-
|
|
96
|
-
if (
|
|
115
|
+
H(() => {
|
|
116
|
+
if (P === 0)
|
|
97
117
|
return;
|
|
98
|
-
const e =
|
|
118
|
+
const e = x.current;
|
|
99
119
|
if (!e)
|
|
100
120
|
return;
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
121
|
+
u.measure();
|
|
122
|
+
const t = new ResizeObserver(() => {
|
|
123
|
+
u.measure();
|
|
104
124
|
});
|
|
105
|
-
return
|
|
106
|
-
|
|
125
|
+
return t.observe(e), () => {
|
|
126
|
+
t.disconnect();
|
|
107
127
|
};
|
|
108
|
-
}, [
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
}, [P, u]);
|
|
129
|
+
const J = I(
|
|
130
|
+
(e) => {
|
|
131
|
+
if (w && x.current) {
|
|
132
|
+
const t = Pe({
|
|
133
|
+
rowCount: a,
|
|
134
|
+
getRowAtIndex: g,
|
|
135
|
+
anchorItemId: e
|
|
136
|
+
}), n = Ye({
|
|
137
|
+
virtualizer: u,
|
|
138
|
+
rowIndex: t,
|
|
139
|
+
estimateRowSize: b
|
|
140
|
+
}), r = Fe({
|
|
141
|
+
scrollElement: x.current,
|
|
142
|
+
anchorItemId: e,
|
|
143
|
+
anchorRowIndex: t,
|
|
144
|
+
rowOffset: n
|
|
145
|
+
});
|
|
146
|
+
r && (_.current = r), u.shouldAdjustScrollPositionOnItemSizeChange = () => !1;
|
|
147
|
+
}
|
|
148
|
+
U(e);
|
|
149
|
+
},
|
|
150
|
+
[b, g, U, a, w, u]
|
|
151
|
+
);
|
|
152
|
+
H(() => {
|
|
153
|
+
q.current = J;
|
|
154
|
+
}, [J, q]), H(() => {
|
|
155
|
+
const e = _.current, t = x.current;
|
|
156
|
+
!e || !t || !w || (Ge({
|
|
157
|
+
scrollElement: t,
|
|
158
|
+
capture: e,
|
|
159
|
+
virtualizer: u,
|
|
160
|
+
estimateRowSize: b
|
|
161
|
+
}), _.current = null, u.shouldAdjustScrollPositionOnItemSizeChange = void 0);
|
|
162
|
+
}, [b, a, w, u]);
|
|
163
|
+
const he = w && Y.length > 0, pe = I((e, t, n) => {
|
|
164
|
+
K?.(e, t, n);
|
|
165
|
+
}, [K]), {
|
|
166
|
+
dragSession: v,
|
|
167
|
+
handlePointerDown: ge
|
|
168
|
+
} = Re({
|
|
169
|
+
items: A,
|
|
170
|
+
scrollElementRef: x,
|
|
171
|
+
virtualizer: u,
|
|
172
|
+
estimateRowSize: (e) => X(g(e)?.item),
|
|
173
|
+
onDrop: pe,
|
|
174
|
+
collapsedItems: ce
|
|
175
|
+
}), Q = G.useMemo(() => {
|
|
176
|
+
if (!c) return null;
|
|
177
|
+
if (l) {
|
|
178
|
+
for (let e = 0; e < l.rowCount; e += 1) {
|
|
179
|
+
const t = l.getRowAt(e);
|
|
180
|
+
if (t.item.id === c)
|
|
181
|
+
return t;
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return s.find((e) => e.item.id === c) || null;
|
|
186
|
+
}, [c, l, s]), ve = I((e) => {
|
|
187
|
+
k(e);
|
|
188
|
+
}, [k]), Ie = I((e) => {
|
|
189
|
+
const { active: t, over: n } = e;
|
|
190
|
+
if (!n || t.id === n.id)
|
|
191
|
+
y(null), N(null);
|
|
115
192
|
else {
|
|
116
|
-
const
|
|
117
|
-
|
|
193
|
+
const r = n.id;
|
|
194
|
+
y(r), N(E(r, T));
|
|
118
195
|
}
|
|
119
|
-
|
|
120
|
-
}, [
|
|
121
|
-
|
|
122
|
-
}, [
|
|
123
|
-
|
|
124
|
-
}, [
|
|
125
|
-
if (
|
|
126
|
-
const
|
|
127
|
-
const { item:
|
|
128
|
-
return /* @__PURE__ */
|
|
196
|
+
$(e);
|
|
197
|
+
}, [$, E, T]), xe = I((e) => {
|
|
198
|
+
y(null), N(null), j(e);
|
|
199
|
+
}, [j]), we = I(() => {
|
|
200
|
+
y(null), N(null), B();
|
|
201
|
+
}, [B]);
|
|
202
|
+
if (z) return null;
|
|
203
|
+
const V = !f || !v?.dropTarget ? null : Oe(A, v.dropTarget), F = (e, t, n, r) => {
|
|
204
|
+
const { item: h, level: o, indentLevel: d } = e, m = n === t, S = n === r && t === r - 1, ee = m ? oe : S ? He : void 0, Se = f && v?.draggedId === h.id;
|
|
205
|
+
return /* @__PURE__ */ i(
|
|
129
206
|
"div",
|
|
130
207
|
{
|
|
131
208
|
className: "relative",
|
|
132
|
-
style:
|
|
133
|
-
|
|
209
|
+
style: {
|
|
210
|
+
...ee ? { boxShadow: ee } : void 0,
|
|
211
|
+
...Se ? { opacity: 0.4 } : void 0
|
|
212
|
+
},
|
|
213
|
+
onPointerDownCapture: f && !h.isDragDisabled && h.category !== "structure" ? (te) => {
|
|
214
|
+
te.target.closest('[data-drag-handle="true"]') && ge(te, h.id);
|
|
215
|
+
} : void 0,
|
|
216
|
+
children: le(h, o, d, {
|
|
217
|
+
isAnyDragging: c !== null || v !== null
|
|
218
|
+
})
|
|
134
219
|
},
|
|
135
|
-
|
|
220
|
+
h.id
|
|
136
221
|
);
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
222
|
+
}, M = () => {
|
|
223
|
+
let e = null;
|
|
224
|
+
if (f && V !== null)
|
|
225
|
+
e = V;
|
|
226
|
+
else if (c !== null && D) {
|
|
227
|
+
const t = A.findIndex(
|
|
228
|
+
(n) => n.item.id === D.overId
|
|
143
229
|
);
|
|
144
|
-
t !== -1 && (
|
|
230
|
+
t !== -1 && (e = D.position === "before" ? t : t + 1);
|
|
145
231
|
}
|
|
146
|
-
if (
|
|
147
|
-
const t =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
232
|
+
if (he) {
|
|
233
|
+
const t = Z + (p ? se : 0), n = Y.map((o) => o.index), r = e !== null && f && !_e(e, n, a), h = r && e !== null ? Te(
|
|
234
|
+
e,
|
|
235
|
+
u,
|
|
236
|
+
(o) => X(g(o)?.item),
|
|
237
|
+
a
|
|
238
|
+
) : null;
|
|
239
|
+
return /* @__PURE__ */ C("div", { className: "w-full relative", style: { height: t }, children: [
|
|
240
|
+
r && h !== null ? /* @__PURE__ */ i(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
"aria-hidden": !0,
|
|
244
|
+
className: "absolute left-0 w-full h-0 pointer-events-none z-10",
|
|
245
|
+
style: {
|
|
246
|
+
top: `${h}px`,
|
|
247
|
+
boxShadow: oe
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
) : null,
|
|
251
|
+
Y.map((o) => {
|
|
252
|
+
const d = g(o.index);
|
|
253
|
+
return d ? /* @__PURE__ */ i(
|
|
152
254
|
"div",
|
|
153
255
|
{
|
|
154
|
-
"data-index":
|
|
155
|
-
ref:
|
|
256
|
+
"data-index": o.index,
|
|
257
|
+
ref: fe,
|
|
156
258
|
className: "absolute left-0 top-0 w-full",
|
|
157
|
-
style: { transform: `translateY(${
|
|
158
|
-
children:
|
|
259
|
+
style: { transform: `translateY(${o.start}px)` },
|
|
260
|
+
children: F(d, o.index, e, a)
|
|
159
261
|
},
|
|
160
|
-
|
|
262
|
+
d.item.id
|
|
161
263
|
) : null;
|
|
162
264
|
}),
|
|
163
|
-
|
|
265
|
+
p ? /* @__PURE__ */ i(
|
|
164
266
|
"div",
|
|
165
267
|
{
|
|
166
268
|
"aria-hidden": !0,
|
|
167
269
|
className: "absolute left-0 w-full h-8 shrink-0",
|
|
168
|
-
style: { top:
|
|
270
|
+
style: { top: Z },
|
|
169
271
|
"data-slot": "drag-drop-tail"
|
|
170
272
|
}
|
|
171
273
|
) : null
|
|
172
274
|
] });
|
|
173
275
|
}
|
|
174
|
-
return /* @__PURE__ */
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
276
|
+
return /* @__PURE__ */ C("div", { className: "w-full", children: [
|
|
277
|
+
a > 0 && s.length === 0 ? Array.from({ length: a }, (t, n) => {
|
|
278
|
+
const r = g(n);
|
|
279
|
+
return r ? /* @__PURE__ */ i("div", { "data-index": n, children: F(r, n, e, a) }, r.item.id) : null;
|
|
280
|
+
}) : s.map((t, n) => /* @__PURE__ */ i("div", { "data-index": n, children: F(t, n, e, A.length) }, t.item.id)),
|
|
281
|
+
p ? /* @__PURE__ */ i("div", { "aria-hidden": !0, className: "h-8 shrink-0", "data-slot": "drag-drop-tail" }) : null
|
|
179
282
|
] });
|
|
180
283
|
};
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
284
|
+
return /* @__PURE__ */ C("div", { className: "flex flex-col min-h-0 h-full", children: [
|
|
285
|
+
/* @__PURE__ */ i(
|
|
183
286
|
"div",
|
|
184
287
|
{
|
|
185
|
-
ref:
|
|
288
|
+
ref: x,
|
|
289
|
+
"data-slot": "nested-list-scroll",
|
|
186
290
|
className: "flex-1 p-1 overflow-y-auto overflow-x-hidden relative",
|
|
187
|
-
|
|
188
|
-
|
|
291
|
+
style: { overflowAnchor: "none" },
|
|
292
|
+
children: p && !f ? /* @__PURE__ */ i(
|
|
293
|
+
be,
|
|
189
294
|
{
|
|
190
|
-
sensors:
|
|
191
|
-
collisionDetection:
|
|
192
|
-
onDragStart:
|
|
193
|
-
onDragOver:
|
|
194
|
-
onDragEnd:
|
|
195
|
-
onDragCancel:
|
|
196
|
-
children: /* @__PURE__ */
|
|
295
|
+
sensors: O,
|
|
296
|
+
collisionDetection: Ee,
|
|
297
|
+
onDragStart: ve,
|
|
298
|
+
onDragOver: Ie,
|
|
299
|
+
onDragEnd: xe,
|
|
300
|
+
onDragCancel: we,
|
|
301
|
+
children: /* @__PURE__ */ i(ye, { items: me, strategy: Xe, children: M() })
|
|
197
302
|
}
|
|
198
|
-
) :
|
|
303
|
+
) : M()
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
c && Q && !f && /* @__PURE__ */ i(
|
|
307
|
+
ie,
|
|
308
|
+
{
|
|
309
|
+
item: Q.item,
|
|
310
|
+
pointerX: de,
|
|
311
|
+
pointerY: T,
|
|
312
|
+
isVisible: !0
|
|
199
313
|
}
|
|
200
314
|
),
|
|
201
|
-
|
|
202
|
-
|
|
315
|
+
v && f && /* @__PURE__ */ i(
|
|
316
|
+
ie,
|
|
203
317
|
{
|
|
204
|
-
item:
|
|
205
|
-
pointerX:
|
|
206
|
-
pointerY:
|
|
318
|
+
item: v.draggedItem,
|
|
319
|
+
pointerX: v.pointerX,
|
|
320
|
+
pointerY: v.pointerY,
|
|
321
|
+
isVisible: v.isPointerInsideScrollContainer
|
|
207
322
|
}
|
|
208
323
|
)
|
|
209
324
|
] });
|
|
210
325
|
};
|
|
211
326
|
export {
|
|
212
|
-
|
|
327
|
+
nt as NestedListContent
|
|
213
328
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { NestedListItem } from '../nested-list.types';
|
|
2
|
+
import { NestedListItem, NestedListDragMode } from '../nested-list.types';
|
|
3
3
|
interface SortableItemProps {
|
|
4
4
|
item: NestedListItem;
|
|
5
5
|
level: number;
|
|
@@ -11,6 +11,7 @@ interface SortableItemProps {
|
|
|
11
11
|
isOver?: boolean;
|
|
12
12
|
isValidDrop?: boolean;
|
|
13
13
|
enableDragDrop?: boolean;
|
|
14
|
+
dragMode?: NestedListDragMode;
|
|
14
15
|
enableCollapse?: boolean;
|
|
15
16
|
shouldBlink?: boolean;
|
|
16
17
|
isDragDisabled?: boolean;
|