@wirecore/wirelayer-react 0.11.0 → 0.12.1
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/CopyButton-C_LAuCkR.js +47 -0
- package/dist/Tree-DLHbcH3-.js +602 -0
- package/dist/chart/Chart.d.ts +3 -3
- package/dist/chart/Chart.d.ts.map +1 -1
- package/dist/chart/PieChart.d.ts +3 -3
- package/dist/chart/PieChart.d.ts.map +1 -1
- package/dist/chart/SeriesChartView.d.ts +1 -1
- package/dist/chart/SeriesChartView.d.ts.map +1 -1
- package/dist/chart/Sparkline.d.ts +3 -3
- package/dist/chart/Sparkline.d.ts.map +1 -1
- package/dist/chart/WaterfallChart.d.ts +3 -3
- package/dist/chart/WaterfallChart.d.ts.map +1 -1
- package/dist/chart/types.d.ts +2 -2
- package/dist/chart/types.d.ts.map +1 -1
- package/dist/chart.js +148 -143
- package/dist/code.js +1 -1
- package/dist/components/AngleSlider/AngleSlider.d.ts +3 -3
- package/dist/components/AngleSlider/AngleSlider.d.ts.map +1 -1
- package/dist/components/BlockUi/BlockUi.d.ts +3 -3
- package/dist/components/BlockUi/BlockUi.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +3 -3
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +3 -3
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/CascadeSelect/CascadeSelect.d.ts +4 -3
- package/dist/components/CascadeSelect/CascadeSelect.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +4 -4
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +3 -3
- package/dist/components/CopyButton/CopyButton.d.ts.map +1 -1
- package/dist/components/DataView/DataView.d.ts +3 -3
- package/dist/components/DataView/DataView.d.ts.map +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +5 -3
- package/dist/components/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/components/Gallery/Gallery.d.ts +3 -3
- package/dist/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/components/JsonViewer/JsonViewer.d.ts +4 -3
- package/dist/components/JsonViewer/JsonViewer.d.ts.map +1 -1
- package/dist/components/Knob/Knob.d.ts +4 -3
- package/dist/components/Knob/Knob.d.ts.map +1 -1
- package/dist/components/Listbox/Listbox.d.ts +4 -4
- package/dist/components/Listbox/Listbox.d.ts.map +1 -1
- package/dist/components/LogViewer/LogViewer.d.ts +3 -3
- package/dist/components/LogViewer/LogViewer.d.ts.map +1 -1
- package/dist/components/MeterGroup/MeterGroup.d.ts +3 -3
- package/dist/components/MeterGroup/MeterGroup.d.ts.map +1 -1
- package/dist/components/NavigationMenu/NavigationMenu.d.ts +3 -3
- package/dist/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
- package/dist/components/OrderList/OrderList.d.ts +3 -3
- package/dist/components/OrderList/OrderList.d.ts.map +1 -1
- package/dist/components/OrgChart/OrgChart.d.ts +3 -3
- package/dist/components/OrgChart/OrgChart.d.ts.map +1 -1
- package/dist/components/Panel/Panel.d.ts +3 -3
- package/dist/components/Panel/Panel.d.ts.map +1 -1
- package/dist/components/PickList/PickList.d.ts +3 -3
- package/dist/components/PickList/PickList.d.ts.map +1 -1
- package/dist/components/PinInput/PinInput.d.ts +4 -4
- package/dist/components/PinInput/PinInput.d.ts.map +1 -1
- package/dist/components/ProgressCircle/ProgressCircle.d.ts +3 -3
- package/dist/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/dist/components/Rating/Rating.d.ts +3 -3
- package/dist/components/Rating/Rating.d.ts.map +1 -1
- package/dist/components/ScrollPanel/ScrollPanel.d.ts +3 -3
- package/dist/components/ScrollPanel/ScrollPanel.d.ts.map +1 -1
- package/dist/components/ScrollTop/ScrollTop.d.ts +3 -2
- package/dist/components/ScrollTop/ScrollTop.d.ts.map +1 -1
- package/dist/components/SidebarNav/SidebarNav.d.ts +3 -3
- package/dist/components/SidebarNav/SidebarNav.d.ts.map +1 -1
- package/dist/components/SignaturePad/SignaturePad.d.ts +3 -3
- package/dist/components/SignaturePad/SignaturePad.d.ts.map +1 -1
- package/dist/components/Sortable/Sortable.d.ts +9 -3
- package/dist/components/Sortable/Sortable.d.ts.map +1 -1
- package/dist/components/SpeedDial/SpeedDial.d.ts +3 -3
- package/dist/components/SpeedDial/SpeedDial.d.ts.map +1 -1
- package/dist/components/SplitButton/SplitButton.d.ts +3 -3
- package/dist/components/SplitButton/SplitButton.d.ts.map +1 -1
- package/dist/components/Splitter/Splitter.d.ts +3 -3
- package/dist/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/components/Spoiler/Spoiler.d.ts +3 -3
- package/dist/components/Spoiler/Spoiler.d.ts.map +1 -1
- package/dist/components/Stepper/Stepper.d.ts +3 -3
- package/dist/components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/components/TableOfContents/TableOfContents.d.ts +3 -3
- package/dist/components/TableOfContents/TableOfContents.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts +3 -3
- package/dist/components/Timeline/Timeline.d.ts.map +1 -1
- package/dist/components/Toolbar/Toolbar.d.ts +3 -3
- package/dist/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/components/Tour/Tour.d.ts +10 -1
- package/dist/components/Tour/Tour.d.ts.map +1 -1
- package/dist/components/Tree/Tree.d.ts +3 -3
- package/dist/components/Tree/Tree.d.ts.map +1 -1
- package/dist/components/Tree/useTree.d.ts +2 -0
- package/dist/components/Tree/useTree.d.ts.map +1 -1
- package/dist/components/TreeSelect/TreeSelect.d.ts +4 -4
- package/dist/components/TreeSelect/TreeSelect.d.ts.map +1 -1
- package/dist/data-table.js +1 -1
- package/dist/editor/Editor.d.ts +4 -4
- package/dist/editor/Editor.d.ts.map +1 -1
- package/dist/editor.js +184 -183
- package/dist/index.js +2903 -2779
- package/dist/pdf.js +1 -1
- package/dist/virtual/VirtualList.d.ts +3 -3
- package/dist/virtual/VirtualList.d.ts.map +1 -1
- package/dist/virtual/VirtualTree.d.ts.map +1 -1
- package/dist/virtual.js +224 -219
- package/llms-full.txt +70 -10
- package/package.json +2 -2
- package/dist/CopyButton-0e1pHR3f.js +0 -45
- package/dist/Tree-DVjwp6FG.js +0 -568
package/dist/Tree-DVjwp6FG.js
DELETED
|
@@ -1,568 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { a as e, i as t, n } from "./RecipesProvider-0idafuGm.js";
|
|
3
|
-
import { t as r } from "./Button-Cd7lufvJ.js";
|
|
4
|
-
import { t as i } from "./Highlight-43-H9459.js";
|
|
5
|
-
import { ChildrenLoader as a, filterTree as o, isLazyNode as s, locateTreeNode as c, moveTreeNode as l, pluralText as u, pruneTree as d, toggleTreeChecked as f, tree as p, treeBranchIds as ee, treeCheckStates as te, treeCheckedValue as m, treeDropMove as h, treeInsertPosition as g, treeKeyboardMove as _, treeMoveAnchor as v, treeRetryId as y, treeRetryParent as b, walkTree as x, withLoadedChildren as S } from "@wirecore/wirelayer-recipes";
|
|
6
|
-
import { Check as C, ChevronRight as w, LoaderCircle as T, Minus as E, RotateCw as ne } from "lucide-react";
|
|
7
|
-
import { createContext as D, useContext as O, useEffect as k, useImperativeHandle as A, useMemo as j, useRef as M, useState as N, useSyncExternalStore as re } from "react";
|
|
8
|
-
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
9
|
-
import { TreeView as L, createTreeCollection as ie } from "@ark-ui/react/tree-view";
|
|
10
|
-
//#region src/components/Tree/types.ts
|
|
11
|
-
var ae = null, R = /* @__PURE__ */ new Set(), z = {
|
|
12
|
-
get: () => ae,
|
|
13
|
-
set(e) {
|
|
14
|
-
ae = e, R.forEach((e) => e());
|
|
15
|
-
},
|
|
16
|
-
subscribe(e) {
|
|
17
|
-
return R.add(e), () => void R.delete(e);
|
|
18
|
-
}
|
|
19
|
-
}, B = (e, t) => c(e, t)?.node, oe = (e) => {
|
|
20
|
-
let t = !1;
|
|
21
|
-
return x(e, (e) => {
|
|
22
|
-
s(e) && (t = !0);
|
|
23
|
-
}), t;
|
|
24
|
-
}, se = {
|
|
25
|
-
status: {},
|
|
26
|
-
children: {},
|
|
27
|
-
errors: {}
|
|
28
|
-
};
|
|
29
|
-
function ce(e, n) {
|
|
30
|
-
let { translations: r, locale: i, dir: c } = t(), p = r.tree, [x, C] = N(""), [w] = N(() => Symbol("tree")), T = M(e);
|
|
31
|
-
k(() => {
|
|
32
|
-
T.current = e;
|
|
33
|
-
});
|
|
34
|
-
let [E, ne] = N(se), D = M(se), [O, A] = N(() => /* @__PURE__ */ new Set()), P = j(() => S(e.items, E.children), [e.items, E.children]), F = M(P);
|
|
35
|
-
k(() => {
|
|
36
|
-
F.current = P;
|
|
37
|
-
}, [P]);
|
|
38
|
-
let I = (e) => B(F.current, e)?.label ?? e, L = M(void 0), ae = () => L.current ??= new a({
|
|
39
|
-
load: (e, t) => T.current.loadChildren ? T.current.loadChildren(e, t) : T.current.dataSource.getChildren(e, t).then((e) => e.items),
|
|
40
|
-
onChange: (e) => {
|
|
41
|
-
let t = D.current;
|
|
42
|
-
D.current = e;
|
|
43
|
-
for (let [n, r] of Object.entries(e.status)) t.status[n] !== r && C(r === "loading" ? p.loadingNode(I(n)) : r === "error" ? p.loadError(I(n)) : u(p.loadedNode, e.children[n]?.length ?? 0, i).replace("{label}", I(n)));
|
|
44
|
-
ne(e);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
k(() => () => {
|
|
48
|
-
L.current?.dispose(), L.current = void 0;
|
|
49
|
-
}, []);
|
|
50
|
-
let R = !!e.loadChildren || !!e.dataSource?.getChildren, ce = (e) => s(e) && (E.status[e.id] === "loading" || !R && O.has(e.id)), [V, ue] = N(!1), H = oe(e.items);
|
|
51
|
-
H && !V && ue(!0);
|
|
52
|
-
let U = R || V || H, W = M(O);
|
|
53
|
-
k(() => {
|
|
54
|
-
W.current = O;
|
|
55
|
-
}, [O]);
|
|
56
|
-
function G(e) {
|
|
57
|
-
for (let t of e) {
|
|
58
|
-
let e = B(F.current, t);
|
|
59
|
-
e && s(e) && (T.current.loadChildren || T.current.dataSource?.getChildren ? ae().load(e) : W.current.has(t) || (W.current = /* @__PURE__ */ new Set([...W.current, t]), A(W.current), C(p.loadingNode(e.label)), T.current.onLoadChildren?.(e)));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function de(t) {
|
|
63
|
-
let n = B(F.current, t);
|
|
64
|
-
n && (ze(t), R ? ae().load(n, { force: !0 }) : (W.current = /* @__PURE__ */ new Set([...W.current, t]), A(W.current), e.onLoadChildren?.(n)));
|
|
65
|
-
}
|
|
66
|
-
let [fe, pe] = N(e.defaultExpandedValue ?? []), K = e.expandedValue ?? fe, q = (e) => {
|
|
67
|
-
pe(e), T.current.onExpandedChange?.(e);
|
|
68
|
-
}, me = M([]);
|
|
69
|
-
k(() => {
|
|
70
|
-
let e = me.current;
|
|
71
|
-
me.current = K, G(K.filter((t) => !e.includes(t)));
|
|
72
|
-
}, [K]);
|
|
73
|
-
let he = () => q(ee(F.current)), ge = () => q([]);
|
|
74
|
-
function _e(e) {
|
|
75
|
-
L.current?.invalidate(e), W.current = e === void 0 ? /* @__PURE__ */ new Set() : new Set([...W.current].filter((t) => t !== e)), A(W.current), ve.current = e === void 0 ? K : K.filter((t) => t === e);
|
|
76
|
-
}
|
|
77
|
-
let ve = M([]);
|
|
78
|
-
k(() => {
|
|
79
|
-
if (!ve.current.length) return;
|
|
80
|
-
let e = ve.current;
|
|
81
|
-
ve.current = [], G(e);
|
|
82
|
-
}, [P]);
|
|
83
|
-
let [ye, be] = N(e.defaultSelectedValue ?? []), xe = e.selectedValue ?? ye;
|
|
84
|
-
function Se(t) {
|
|
85
|
-
let n = t.find((e) => b(e) !== void 0);
|
|
86
|
-
if (n) return de(b(n));
|
|
87
|
-
be(t), e.onSelectionChange?.(t);
|
|
88
|
-
}
|
|
89
|
-
let Ce = !!e.checkable && (!!e.checkStrictly || e.checkedStrategy !== void 0 || U), [we, Te] = N(e.defaultCheckedValue ?? []), Ee = e.checkedValue ?? we, De = j(() => Ce ? te(P, Ee, e.checkStrictly) : void 0, [
|
|
90
|
-
Ce,
|
|
91
|
-
P,
|
|
92
|
-
Ee,
|
|
93
|
-
e.checkStrictly
|
|
94
|
-
]);
|
|
95
|
-
function Oe(t) {
|
|
96
|
-
let n = f(P, Ee, t, e.checkStrictly), r = m(P, n, e.checkedStrategy ?? "all", e.checkStrictly);
|
|
97
|
-
Te(r), e.onCheckedChange?.(r);
|
|
98
|
-
}
|
|
99
|
-
function ke(t) {
|
|
100
|
-
Te(t), e.onCheckedChange?.(t);
|
|
101
|
-
}
|
|
102
|
-
let [Ae, je] = N(""), J = e.filterValue ?? Ae, Me = (t) => {
|
|
103
|
-
je(t), e.onFilterValueChange?.(t);
|
|
104
|
-
}, Y = j(() => o(P, J, (e) => e.label, e.filterMode ?? "filter"), [
|
|
105
|
-
P,
|
|
106
|
-
J,
|
|
107
|
-
e.filterMode
|
|
108
|
-
]), Ne = j(() => new Set(Y.matches), [Y]), X = M(null), Pe = M("");
|
|
109
|
-
k(() => {
|
|
110
|
-
if (J === Pe.current) return;
|
|
111
|
-
if (Pe.current = J, Fe.current = -1, !J.trim()) {
|
|
112
|
-
X.current && q(X.current), X.current = null;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
X.current ??= K, q([.../* @__PURE__ */ new Set([...X.current, ...Y.expand])]);
|
|
116
|
-
let e = Y.matches.length;
|
|
117
|
-
C(e ? u(p.matches, e, i) : p.noMatches);
|
|
118
|
-
}, [J]);
|
|
119
|
-
let Fe = M(-1);
|
|
120
|
-
function Ie(e = 1) {
|
|
121
|
-
let t = Y.matches;
|
|
122
|
-
t.length && (Fe.current = (Fe.current + e + t.length) % t.length, ze(t[Fe.current]));
|
|
123
|
-
}
|
|
124
|
-
let Le = j(() => {
|
|
125
|
-
let e = (e) => s(e) && E.status[e.id] === "error", t = (n) => n.map((n) => e(n) ? {
|
|
126
|
-
...n,
|
|
127
|
-
children: [{
|
|
128
|
-
id: y(n.id),
|
|
129
|
-
label: p.retry
|
|
130
|
-
}]
|
|
131
|
-
} : n.children ? {
|
|
132
|
-
...n,
|
|
133
|
-
children: t(n.children)
|
|
134
|
-
} : n), n = Object.keys(E.errors).length ? t(P) : P;
|
|
135
|
-
return d(n, Y.visible);
|
|
136
|
-
}, [
|
|
137
|
-
P,
|
|
138
|
-
E,
|
|
139
|
-
Y.visible,
|
|
140
|
-
p.retry
|
|
141
|
-
]), Re = j(() => ie({
|
|
142
|
-
nodeToValue: (e) => e.id,
|
|
143
|
-
nodeToString: (e) => e.label,
|
|
144
|
-
isNodeDisabled: (e) => !!e.disabled,
|
|
145
|
-
nodeToChildrenCount: (e) => s(e) ? 1 : void 0,
|
|
146
|
-
rootNode: {
|
|
147
|
-
id: "ROOT",
|
|
148
|
-
label: "",
|
|
149
|
-
children: Le
|
|
150
|
-
}
|
|
151
|
-
}), [Le]);
|
|
152
|
-
function ze(e) {
|
|
153
|
-
let t = n.current?.querySelector(`[data-node-id="${CSS.escape(e)}"]`);
|
|
154
|
-
(t?.matches("[data-part=branch]") ? t.querySelector(":scope > [data-part=branch-control]") : t)?.focus();
|
|
155
|
-
}
|
|
156
|
-
let Be = M(null);
|
|
157
|
-
k(() => {
|
|
158
|
-
Be.current &&= (ze(Be.current), null);
|
|
159
|
-
}, [e.items]);
|
|
160
|
-
let Ve = (e, t) => (e ? B(P, e)?.children ?? [] : P).filter((e) => e.id !== t).length + 1;
|
|
161
|
-
function He(t) {
|
|
162
|
-
if (!t) return;
|
|
163
|
-
let n = B(P, t.id);
|
|
164
|
-
if (n && e.allowDrop) {
|
|
165
|
-
let r = v(P, t);
|
|
166
|
-
if (!e.allowDrop(n, r.target, r.position)) return C(p.dropDenied);
|
|
167
|
-
}
|
|
168
|
-
let r = t.parentId ? I(t.parentId) : null;
|
|
169
|
-
C(p.moved(I(t.id), r, t.index + 1, Ve(t.parentId, t.id))), Be.current = t.id, e.onMove?.(Object.keys(E.children).length ? {
|
|
170
|
-
...t,
|
|
171
|
-
items: l(P, t)
|
|
172
|
-
} : t);
|
|
173
|
-
}
|
|
174
|
-
function Ue(t, n, r) {
|
|
175
|
-
let i = r.parentId ? I(r.parentId) : null;
|
|
176
|
-
C(p.moved(t.label, i, r.index + 1, Ve(r.parentId, t.id))), Be.current = t.id, e.onTransfer?.({
|
|
177
|
-
node: t,
|
|
178
|
-
sourceTree: n,
|
|
179
|
-
targetTree: e.name,
|
|
180
|
-
...r
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
let We = re(z.subscribe, z.get, () => null), Z = (t) => {
|
|
184
|
-
let n = z.get();
|
|
185
|
-
return n && n.mode === t && n.tree !== w && e.group !== void 0 && n.group === e.group ? n : null;
|
|
186
|
-
}, Ge = We?.mode === "cut" && We.tree === w ? We.node.id : null;
|
|
187
|
-
function Ke(t) {
|
|
188
|
-
let n = z.get();
|
|
189
|
-
if (!n || n.mode !== "cut") return !1;
|
|
190
|
-
let r = B(P, t);
|
|
191
|
-
if (!r) return !1;
|
|
192
|
-
let i = r.children ? "inside" : "after";
|
|
193
|
-
if (e.allowDrop && !e.allowDrop(n.node, r, i)) return C(p.dropDenied), !0;
|
|
194
|
-
if (n.tree === w) {
|
|
195
|
-
if (!e.reorderable) return !1;
|
|
196
|
-
let r = h(P, n.node.id, t, i);
|
|
197
|
-
r ? He(r) : C(p.dropDenied);
|
|
198
|
-
} else {
|
|
199
|
-
if (!Z("cut")) return !1;
|
|
200
|
-
let e = g(P, t, i);
|
|
201
|
-
e && Ue(n.node, n.name, e);
|
|
202
|
-
}
|
|
203
|
-
return z.set(null), !0;
|
|
204
|
-
}
|
|
205
|
-
let qe = e.reorderable || e.group !== void 0;
|
|
206
|
-
function Je(t) {
|
|
207
|
-
e.checkable && le(t);
|
|
208
|
-
let n = t.target.closest("[data-node-id]")?.dataset.nodeId;
|
|
209
|
-
if (!n || b(n) !== void 0) return;
|
|
210
|
-
let r = t.ctrlKey || t.metaKey;
|
|
211
|
-
if (qe && r && !t.altKey && (t.key === "x" || t.key === "X")) {
|
|
212
|
-
let r = B(P, n);
|
|
213
|
-
if (!r || r.disabled) return;
|
|
214
|
-
t.preventDefault(), z.set({
|
|
215
|
-
mode: "cut",
|
|
216
|
-
node: r,
|
|
217
|
-
tree: w,
|
|
218
|
-
group: e.group,
|
|
219
|
-
name: e.name
|
|
220
|
-
}), C(p.cut(r.label));
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (r && !t.altKey && (t.key === "v" || t.key === "V")) {
|
|
224
|
-
Ke(n) && t.preventDefault();
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
if (t.key === "Escape" && Ge) {
|
|
228
|
-
t.preventDefault(), t.stopPropagation(), z.set(null), C(p.cutCancelled);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (!e.reorderable || !t.altKey) return;
|
|
232
|
-
let i = c === "rtl", a = t.key === "ArrowUp" ? "up" : t.key === "ArrowDown" ? "down" : t.key === "ArrowRight" ? i ? "out" : "in" : t.key === "ArrowLeft" ? i ? "in" : "out" : void 0;
|
|
233
|
-
a && (t.preventDefault(), t.stopPropagation(), He(_(P, n, a)));
|
|
234
|
-
}
|
|
235
|
-
let [Q, Ye] = N(null), [$, Xe] = N(null), Ze = (e, t) => {
|
|
236
|
-
let n = e.currentTarget.getBoundingClientRect(), r = (e.clientY - n.top) / n.height;
|
|
237
|
-
return t ? r < .25 ? "before" : r > .75 ? "after" : "inside" : r < .5 ? "before" : "after";
|
|
238
|
-
}, Qe = {
|
|
239
|
-
reorderable: qe,
|
|
240
|
-
dragging: Q,
|
|
241
|
-
drop: $,
|
|
242
|
-
onDragStart: (t, n) => {
|
|
243
|
-
let r = B(P, t);
|
|
244
|
-
r && (Ye(t), z.set({
|
|
245
|
-
mode: "drag",
|
|
246
|
-
node: r,
|
|
247
|
-
tree: w,
|
|
248
|
-
group: e.group,
|
|
249
|
-
name: e.name
|
|
250
|
-
}), n.dataTransfer.setData("text/plain", r.label), n.dataTransfer.effectAllowed = "move");
|
|
251
|
-
},
|
|
252
|
-
onDragOver: (t, n, r) => {
|
|
253
|
-
let i = Z("drag");
|
|
254
|
-
if ((!Q || !e.reorderable) && !i || Q === t) return;
|
|
255
|
-
let a = B(P, t);
|
|
256
|
-
a && s(a) && G([t]);
|
|
257
|
-
let o = Ze(r, n), c = i ? i.node : B(P, Q), l = i ? g(P, t, o) : h(P, Q, t, o), u = B(P, t) ?? null;
|
|
258
|
-
!l || !c || e.allowDrop && !e.allowDrop(c, u, o) ? Xe(null) : (r.preventDefault(), Xe({
|
|
259
|
-
id: t,
|
|
260
|
-
position: o
|
|
261
|
-
}));
|
|
262
|
-
},
|
|
263
|
-
onDrop: (t) => {
|
|
264
|
-
t.preventDefault();
|
|
265
|
-
let n = Z("drag");
|
|
266
|
-
if ($ && Q && e.reorderable) He(h(P, Q, $.id, $.position));
|
|
267
|
-
else if ($ && n) {
|
|
268
|
-
let e = g(P, $.id, $.position);
|
|
269
|
-
e && Ue(n.node, n.name, e);
|
|
270
|
-
}
|
|
271
|
-
Ye(null), Xe(null);
|
|
272
|
-
},
|
|
273
|
-
onDragEnd: () => {
|
|
274
|
-
Ye(null), Xe(null), z.get()?.mode === "drag" && z.set(null);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
function $e(t) {
|
|
278
|
-
let n = Z("drag");
|
|
279
|
-
!n || e.allowDrop && !e.allowDrop(n.node, null, "inside") || t.preventDefault();
|
|
280
|
-
}
|
|
281
|
-
function et(e) {
|
|
282
|
-
let t = Z("drag");
|
|
283
|
-
t && (e.preventDefault(), Ue(t.node, t.name, {
|
|
284
|
-
parentId: null,
|
|
285
|
-
index: 0
|
|
286
|
-
}));
|
|
287
|
-
}
|
|
288
|
-
return {
|
|
289
|
-
status: x,
|
|
290
|
-
resolved: P,
|
|
291
|
-
view: Le,
|
|
292
|
-
collection: Re,
|
|
293
|
-
expanded: K,
|
|
294
|
-
setExpanded: q,
|
|
295
|
-
expandAll: he,
|
|
296
|
-
collapseAll: ge,
|
|
297
|
-
selected: xe,
|
|
298
|
-
onSelectionChange: Se,
|
|
299
|
-
ownChecks: Ce,
|
|
300
|
-
checkStates: De,
|
|
301
|
-
toggleCheck: Oe,
|
|
302
|
-
onArkCheckedChange: ke,
|
|
303
|
-
query: J,
|
|
304
|
-
setQuery: Me,
|
|
305
|
-
matches: Ne,
|
|
306
|
-
jump: Ie,
|
|
307
|
-
loadingOf: ce,
|
|
308
|
-
lazy: U,
|
|
309
|
-
invalidate: _e,
|
|
310
|
-
onKeyDown: Je,
|
|
311
|
-
drag: Qe,
|
|
312
|
-
cutId: Ge,
|
|
313
|
-
onEmptyDragOver: $e,
|
|
314
|
-
onEmptyDrop: et,
|
|
315
|
-
focusNode: ze
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
function le(e) {
|
|
319
|
-
if (e.key !== " " || e.altKey) return;
|
|
320
|
-
let t = e.target.querySelector(":scope > [data-part=\"node-checkbox\"]");
|
|
321
|
-
t && (e.preventDefault(), e.stopPropagation(), t.click());
|
|
322
|
-
}
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/components/Tree/Tree.tsx
|
|
325
|
-
var V = D(null);
|
|
326
|
-
function ue({ classes: t, items: r, label: i, "aria-label": a, selectionMode: o = "single", checkable: s = !1, checkStrictly: c = !1, checkedValue: l, defaultCheckedValue: u, reorderable: d = !1, filter: f = !1, filterMode: ee = "filter", expandControls: te = !1, showLines: m = !1, renderNode: h, emptyText: g, empty: _, className: v, style: y, ref: b, ...x }) {
|
|
327
|
-
let S = n("tree", p, t)(), C = e(), w = C.tree, T = M(null), E = ce({
|
|
328
|
-
...x,
|
|
329
|
-
items: r,
|
|
330
|
-
checkable: s,
|
|
331
|
-
checkStrictly: c,
|
|
332
|
-
checkedValue: l,
|
|
333
|
-
defaultCheckedValue: u,
|
|
334
|
-
reorderable: d,
|
|
335
|
-
filterMode: ee
|
|
336
|
-
}, T);
|
|
337
|
-
A(b, () => ({
|
|
338
|
-
expandAll: E.expandAll,
|
|
339
|
-
collapseAll: E.collapseAll,
|
|
340
|
-
invalidate: E.invalidate,
|
|
341
|
-
focusNode: E.focusNode
|
|
342
|
-
}));
|
|
343
|
-
let ne = f || x.filterValue !== void 0, D = g ?? (E.query.trim() ? w.noMatches : x.group === void 0 ? void 0 : C.common.empty), O = !E.view.length && (D !== void 0 || !!_ || x.group !== void 0), k = d || E.lazy || ne || x.group !== void 0;
|
|
344
|
-
return /* @__PURE__ */ I(L.Root, {
|
|
345
|
-
ref: T,
|
|
346
|
-
className: S.base({ class: v }),
|
|
347
|
-
style: y,
|
|
348
|
-
collection: E.collection,
|
|
349
|
-
selectionMode: o,
|
|
350
|
-
selectedValue: E.selected,
|
|
351
|
-
onSelectionChange: (e) => E.onSelectionChange(e.selectedValue),
|
|
352
|
-
expandedValue: E.expanded,
|
|
353
|
-
onExpandedChange: (e) => E.setExpanded(e.expandedValue),
|
|
354
|
-
...E.ownChecks ? {} : {
|
|
355
|
-
checkedValue: l,
|
|
356
|
-
defaultCheckedValue: u
|
|
357
|
-
},
|
|
358
|
-
onCheckedChange: (e) => E.ownChecks || E.onArkCheckedChange(e.checkedValue),
|
|
359
|
-
translations: { treeLabel: i ?? a ?? C.tree.treeLabel },
|
|
360
|
-
onKeyDownCapture: E.onKeyDown,
|
|
361
|
-
children: [
|
|
362
|
-
i && /* @__PURE__ */ F(L.Label, {
|
|
363
|
-
className: S.label(),
|
|
364
|
-
children: i
|
|
365
|
-
}),
|
|
366
|
-
/* @__PURE__ */ F(H, {
|
|
367
|
-
model: E,
|
|
368
|
-
filter: f,
|
|
369
|
-
filterMode: ee,
|
|
370
|
-
expandControls: te,
|
|
371
|
-
classes: t
|
|
372
|
-
}),
|
|
373
|
-
/* @__PURE__ */ F(V, {
|
|
374
|
-
value: {
|
|
375
|
-
model: E,
|
|
376
|
-
checkable: s,
|
|
377
|
-
showLines: m,
|
|
378
|
-
renderNode: h
|
|
379
|
-
},
|
|
380
|
-
children: /* @__PURE__ */ F(L.Tree, {
|
|
381
|
-
className: S.tree(),
|
|
382
|
-
hidden: O || void 0,
|
|
383
|
-
children: E.view.map((e, t) => /* @__PURE__ */ F(de, {
|
|
384
|
-
node: e,
|
|
385
|
-
indexPath: [t]
|
|
386
|
-
}, e.id))
|
|
387
|
-
})
|
|
388
|
-
}),
|
|
389
|
-
O && /* @__PURE__ */ F("div", {
|
|
390
|
-
className: S.empty(),
|
|
391
|
-
onDragOver: E.onEmptyDragOver,
|
|
392
|
-
onDrop: E.onEmptyDrop,
|
|
393
|
-
children: _ ?? D
|
|
394
|
-
}),
|
|
395
|
-
k && /* @__PURE__ */ F("p", {
|
|
396
|
-
role: "status",
|
|
397
|
-
className: S.status(),
|
|
398
|
-
children: E.status
|
|
399
|
-
})
|
|
400
|
-
]
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
function H({ model: t, filter: i, filterMode: a, expandControls: o, classes: s }) {
|
|
404
|
-
let c = n("tree", p, s)(), l = e(), u = l.tree;
|
|
405
|
-
return !i && !o ? null : /* @__PURE__ */ I("div", {
|
|
406
|
-
className: c.toolbar(),
|
|
407
|
-
children: [i && /* @__PURE__ */ F("input", {
|
|
408
|
-
type: "search",
|
|
409
|
-
autoComplete: "off",
|
|
410
|
-
className: c.search(),
|
|
411
|
-
"aria-label": u.filter,
|
|
412
|
-
placeholder: l.combobox.search,
|
|
413
|
-
value: t.query,
|
|
414
|
-
onChange: (e) => t.setQuery(e.target.value),
|
|
415
|
-
onKeyDown: (e) => {
|
|
416
|
-
e.key === "Enter" && a === "highlight" && (e.preventDefault(), t.jump(e.shiftKey ? -1 : 1));
|
|
417
|
-
}
|
|
418
|
-
}), o && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(r, {
|
|
419
|
-
variant: "text",
|
|
420
|
-
size: "sm",
|
|
421
|
-
onClick: t.expandAll,
|
|
422
|
-
children: u.expandAll
|
|
423
|
-
}), /* @__PURE__ */ F(r, {
|
|
424
|
-
variant: "text",
|
|
425
|
-
size: "sm",
|
|
426
|
-
onClick: t.collapseAll,
|
|
427
|
-
children: u.collapseAll
|
|
428
|
-
})] })]
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
var U = "Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight", W = (e) => e === "indeterminate" ? "mixed" : e;
|
|
432
|
-
function G({ own: e, checked: t, onToggle: r }) {
|
|
433
|
-
let i = n("tree", p)();
|
|
434
|
-
return e ? /* @__PURE__ */ F("span", {
|
|
435
|
-
"data-part": "node-checkbox",
|
|
436
|
-
"data-state": t === "indeterminate" ? "indeterminate" : t ? "checked" : "unchecked",
|
|
437
|
-
role: "presentation",
|
|
438
|
-
"aria-hidden": "true",
|
|
439
|
-
className: i.checkbox(),
|
|
440
|
-
onClick: (e) => {
|
|
441
|
-
e.stopPropagation(), r();
|
|
442
|
-
},
|
|
443
|
-
children: t === "indeterminate" ? /* @__PURE__ */ F(E, { className: i.checkboxIcon() }) : t ? /* @__PURE__ */ F(C, { className: i.checkboxIcon() }) : null
|
|
444
|
-
}) : /* @__PURE__ */ F(L.NodeCheckbox, {
|
|
445
|
-
className: i.checkbox(),
|
|
446
|
-
role: "presentation",
|
|
447
|
-
"aria-hidden": "true",
|
|
448
|
-
children: /* @__PURE__ */ F(L.NodeCheckboxIndicator, {
|
|
449
|
-
indeterminate: /* @__PURE__ */ F(E, {
|
|
450
|
-
className: i.checkboxIcon(),
|
|
451
|
-
"aria-hidden": "true"
|
|
452
|
-
}),
|
|
453
|
-
children: /* @__PURE__ */ F(C, {
|
|
454
|
-
className: i.checkboxIcon(),
|
|
455
|
-
"aria-hidden": "true"
|
|
456
|
-
})
|
|
457
|
-
})
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
function de({ node: t, indexPath: r, flat: a = !1, posinset: o, setsize: c }) {
|
|
461
|
-
let l = n("tree", p)(), u = e().tree, { model: d, checkable: f, showLines: ee, renderNode: te } = O(V), m = d.drag, h = t.icon, g = !!t.children || s(t), _ = b(t.id) !== void 0, v = d.loadingOf(t), y = d.matches.has(t.id), x = d.ownChecks, S = d.checkStates?.get(t.id) ?? !1, C = (e) => x ? S : e.checked, E = (e) => m.reorderable ? {
|
|
462
|
-
draggable: t.disabled ? void 0 : "true",
|
|
463
|
-
"data-drop": m.drop?.id === t.id ? m.drop.position : void 0,
|
|
464
|
-
"data-dragging": m.dragging === t.id || void 0,
|
|
465
|
-
"data-cut": d.cutId === t.id || void 0,
|
|
466
|
-
onDragStart: (e) => m.onDragStart(t.id, e),
|
|
467
|
-
onDragOver: (n) => m.onDragOver(t.id, e, n),
|
|
468
|
-
onDrop: m.onDrop,
|
|
469
|
-
onDragEnd: m.onDragEnd
|
|
470
|
-
} : {}, D = (e, n) => te ? te(t, {
|
|
471
|
-
level: e.depth,
|
|
472
|
-
selected: e.selected,
|
|
473
|
-
expanded: e.expanded,
|
|
474
|
-
branch: g,
|
|
475
|
-
checked: C(e),
|
|
476
|
-
loading: v,
|
|
477
|
-
match: y,
|
|
478
|
-
query: d.query
|
|
479
|
-
}) : /* @__PURE__ */ I(P, { children: [h && /* @__PURE__ */ F(h, {
|
|
480
|
-
className: l.icon(),
|
|
481
|
-
"aria-hidden": "true"
|
|
482
|
-
}), /* @__PURE__ */ F(n, {
|
|
483
|
-
className: l.text(),
|
|
484
|
-
children: y ? /* @__PURE__ */ F(i, {
|
|
485
|
-
text: t.label,
|
|
486
|
-
query: d.query,
|
|
487
|
-
ignoreAccents: !0
|
|
488
|
-
}) : t.label
|
|
489
|
-
})] });
|
|
490
|
-
return /* @__PURE__ */ F(L.NodeProvider, {
|
|
491
|
-
node: t,
|
|
492
|
-
indexPath: r,
|
|
493
|
-
children: /* @__PURE__ */ F(L.NodeContext, { children: (e) => g ? /* @__PURE__ */ I(L.Branch, {
|
|
494
|
-
"data-node-id": t.id,
|
|
495
|
-
"aria-keyshortcuts": m.reorderable ? U : void 0,
|
|
496
|
-
"aria-checked": f ? W(C(e)) : void 0,
|
|
497
|
-
"aria-busy": v || void 0,
|
|
498
|
-
"aria-posinset": o,
|
|
499
|
-
"aria-setsize": c,
|
|
500
|
-
"data-match": y || void 0,
|
|
501
|
-
children: [/* @__PURE__ */ I(L.BranchControl, {
|
|
502
|
-
className: l.branch({ class: m.reorderable ? l.dropTarget() : void 0 }),
|
|
503
|
-
...E(!0),
|
|
504
|
-
children: [
|
|
505
|
-
/* @__PURE__ */ F(L.BranchIndicator, {
|
|
506
|
-
className: l.indicator(),
|
|
507
|
-
children: /* @__PURE__ */ F(w, {
|
|
508
|
-
className: l.indicatorIcon(),
|
|
509
|
-
"aria-hidden": "true"
|
|
510
|
-
})
|
|
511
|
-
}),
|
|
512
|
-
f && /* @__PURE__ */ F(G, {
|
|
513
|
-
own: x,
|
|
514
|
-
checked: S,
|
|
515
|
-
onToggle: () => d.toggleCheck(t.id)
|
|
516
|
-
}),
|
|
517
|
-
D(e, L.BranchText)
|
|
518
|
-
]
|
|
519
|
-
}), !a && /* @__PURE__ */ I(L.BranchContent, {
|
|
520
|
-
...ee ? { className: l.lines() } : {},
|
|
521
|
-
children: [v && /* @__PURE__ */ I("div", {
|
|
522
|
-
className: l.loadingRow(),
|
|
523
|
-
"aria-hidden": "true",
|
|
524
|
-
children: [/* @__PURE__ */ F(T, { className: l.loadingIcon() }), u.loadingRow]
|
|
525
|
-
}), (t.children ?? []).map((e, t) => /* @__PURE__ */ F(de, {
|
|
526
|
-
node: e,
|
|
527
|
-
indexPath: [...r, t]
|
|
528
|
-
}, e.id))]
|
|
529
|
-
})]
|
|
530
|
-
}) : _ ? /* @__PURE__ */ I(L.Item, {
|
|
531
|
-
className: l.item({ class: l.retry() }),
|
|
532
|
-
"data-node-id": t.id,
|
|
533
|
-
"aria-posinset": o,
|
|
534
|
-
"aria-setsize": c,
|
|
535
|
-
children: [/* @__PURE__ */ F(ne, {
|
|
536
|
-
className: l.retryIcon(),
|
|
537
|
-
"aria-hidden": "true"
|
|
538
|
-
}), /* @__PURE__ */ F(L.ItemText, {
|
|
539
|
-
className: l.text(),
|
|
540
|
-
children: t.label
|
|
541
|
-
})]
|
|
542
|
-
}) : /* @__PURE__ */ I(L.Item, {
|
|
543
|
-
className: l.item({ class: m.reorderable ? l.dropTarget() : void 0 }),
|
|
544
|
-
"data-node-id": t.id,
|
|
545
|
-
"aria-keyshortcuts": m.reorderable ? U : void 0,
|
|
546
|
-
"aria-checked": f ? W(C(e)) : void 0,
|
|
547
|
-
"aria-posinset": o,
|
|
548
|
-
"aria-setsize": c,
|
|
549
|
-
"data-match": y || void 0,
|
|
550
|
-
...E(!1),
|
|
551
|
-
children: [f && /* @__PURE__ */ F(G, {
|
|
552
|
-
own: x,
|
|
553
|
-
checked: S,
|
|
554
|
-
onToggle: () => d.toggleCheck(t.id)
|
|
555
|
-
}), D(e, L.ItemText)]
|
|
556
|
-
}) })
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
var fe = V;
|
|
560
|
-
function pe(e, t, n = []) {
|
|
561
|
-
for (let r of e) {
|
|
562
|
-
if ((r.id ?? r.value) === t) return [...n, r];
|
|
563
|
-
let e = r.children && pe(r.children, t, [...n, r]);
|
|
564
|
-
if (e) return e;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
//#endregion
|
|
568
|
-
export { pe as a, H as i, de as n, ce as o, fe as r, ue as t };
|