asterui 0.12.22 → 0.12.24
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/Cascader.d.ts +55 -5
- package/dist/components/Tree.d.ts +78 -2
- package/dist/components/TreeSelect.d.ts +35 -2
- package/dist/index.d.ts +1 -1
- package/dist/index15.js +391 -137
- package/dist/index15.js.map +1 -1
- package/dist/index93.js +422 -194
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +626 -263
- package/dist/index94.js.map +1 -1
- package/dist/index97.js +23 -23
- package/dist/index97.js.map +1 -1
- package/package.json +1 -1
package/dist/index93.js
CHANGED
|
@@ -1,216 +1,444 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as k, jsxs as ue } from "react/jsx-runtime";
|
|
2
|
+
import he, { forwardRef as Ne, useCallback as D, useMemo as G, useState as V, createContext as Te, useRef as Ee, useEffect as Ie, useContext as Le } from "react";
|
|
3
|
+
const ke = Te(null);
|
|
4
|
+
function De() {
|
|
5
|
+
const e = Le(ke);
|
|
6
|
+
if (!e)
|
|
7
|
+
throw new Error("Tree components must be used within a Tree");
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
function Se(e) {
|
|
11
|
+
const a = [], c = (d) => {
|
|
12
|
+
d.forEach((f) => {
|
|
13
|
+
a.push(f.key), f.children && c(f.children);
|
|
7
14
|
});
|
|
8
15
|
};
|
|
9
|
-
return
|
|
16
|
+
return c(e), a;
|
|
10
17
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
function de(e) {
|
|
19
|
+
const a = [], c = (d) => {
|
|
20
|
+
d.children && d.children.forEach((f) => {
|
|
21
|
+
a.push(f.key), c(f);
|
|
15
22
|
});
|
|
16
23
|
};
|
|
17
|
-
return
|
|
24
|
+
return c(e), a;
|
|
18
25
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
function ye(e) {
|
|
27
|
+
const a = /* @__PURE__ */ new Map(), c = (d, f) => {
|
|
28
|
+
d.forEach((u) => {
|
|
29
|
+
a.set(u.key, f), u.children && c(u.children, u.key);
|
|
23
30
|
});
|
|
24
31
|
};
|
|
25
|
-
return
|
|
32
|
+
return c(e, null), a;
|
|
26
33
|
}
|
|
27
|
-
function
|
|
28
|
-
for (const
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
34
|
+
function pe(e, a) {
|
|
35
|
+
for (const c of e) {
|
|
36
|
+
if (c.key === a) return c;
|
|
37
|
+
if (c.children) {
|
|
38
|
+
const d = pe(c.children, a);
|
|
39
|
+
if (d) return d;
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
return null;
|
|
36
43
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
checked: l,
|
|
43
|
-
indeterminate: o,
|
|
44
|
-
checkable: x,
|
|
45
|
-
selectable: M,
|
|
46
|
-
showLine: b,
|
|
47
|
-
showIcon: S,
|
|
48
|
-
onToggle: C,
|
|
49
|
-
onSelect: N,
|
|
50
|
-
onCheck: w,
|
|
51
|
-
renderChildren: j
|
|
52
|
-
}) {
|
|
53
|
-
const v = e.children && e.children.length > 0, m = e.isLeaf ?? !v, T = (f) => {
|
|
54
|
-
f.stopPropagation(), m || C(e.key);
|
|
55
|
-
}, L = () => {
|
|
56
|
-
M && e.selectable !== !1 && !e.disabled && N(e.key, e);
|
|
57
|
-
}, B = (f) => {
|
|
58
|
-
f.stopPropagation(), !e.disabled && !e.disableCheckbox && w(e.key, e);
|
|
44
|
+
function Ae(e, a) {
|
|
45
|
+
const c = [], d = (f) => {
|
|
46
|
+
f.forEach((u) => {
|
|
47
|
+
c.push(u), u.children && a.includes(u.key) && d(u.children);
|
|
48
|
+
});
|
|
59
49
|
};
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
50
|
+
return d(e), c;
|
|
51
|
+
}
|
|
52
|
+
function Me(e, a) {
|
|
53
|
+
const c = ye(e), d = [];
|
|
54
|
+
let f = c.get(a);
|
|
55
|
+
for (; f; )
|
|
56
|
+
d.push(f), f = c.get(f);
|
|
57
|
+
return d;
|
|
58
|
+
}
|
|
59
|
+
function be({ node: e, level: a }) {
|
|
60
|
+
const {
|
|
61
|
+
checkable: c,
|
|
62
|
+
checkboxColor: d,
|
|
63
|
+
checkboxSize: f,
|
|
64
|
+
selectable: u,
|
|
65
|
+
showLine: J,
|
|
66
|
+
showIcon: E,
|
|
67
|
+
blockNode: Q,
|
|
68
|
+
expandedKeys: I,
|
|
69
|
+
selectedKeys: S,
|
|
70
|
+
loadingKeys: X,
|
|
71
|
+
switcherIcon: C,
|
|
72
|
+
titleRender: q,
|
|
73
|
+
filterTreeNode: L,
|
|
74
|
+
onToggle: N,
|
|
75
|
+
onSelect: A,
|
|
76
|
+
onCheck: M,
|
|
77
|
+
onRightClick: H,
|
|
78
|
+
getCheckedState: Y,
|
|
79
|
+
focusedKey: T,
|
|
80
|
+
setFocusedKey: w,
|
|
81
|
+
flattenedNodes: K,
|
|
82
|
+
baseTestId: Z
|
|
83
|
+
} = De(), $ = Ee(null), j = e.children && e.children.length > 0, b = e.isLeaf ?? !j, g = I.includes(e.key), p = S.includes(e.key), ee = X.includes(e.key), F = T === e.key, { checked: R, indeterminate: _ } = Y(e), O = L ? L(e) : !1, m = e.disabled;
|
|
84
|
+
Ie(() => {
|
|
85
|
+
F && $.current && $.current.focus();
|
|
86
|
+
}, [F]);
|
|
87
|
+
const x = (s) => {
|
|
88
|
+
s.stopPropagation(), !b && !m && N(e.key, e);
|
|
89
|
+
}, te = (s) => {
|
|
90
|
+
u && e.selectable !== !1 && !m && A(e.key, e);
|
|
91
|
+
}, z = (s) => {
|
|
92
|
+
s.stopPropagation(), !m && !e.disableCheckbox && M(e.key, e);
|
|
93
|
+
}, ne = (s) => {
|
|
94
|
+
H && (s.preventDefault(), H({ event: s, node: e }));
|
|
95
|
+
}, se = (s) => {
|
|
96
|
+
const v = K.findIndex((i) => i.key === e.key);
|
|
97
|
+
switch (s.key) {
|
|
98
|
+
case "ArrowDown": {
|
|
99
|
+
s.preventDefault();
|
|
100
|
+
const i = K[v + 1];
|
|
101
|
+
i && w(i.key);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case "ArrowUp": {
|
|
105
|
+
s.preventDefault();
|
|
106
|
+
const i = K[v - 1];
|
|
107
|
+
i && w(i.key);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case "ArrowRight": {
|
|
111
|
+
if (s.preventDefault(), !b && !g)
|
|
112
|
+
N(e.key, e);
|
|
113
|
+
else if (j && g) {
|
|
114
|
+
const i = e.children[0];
|
|
115
|
+
w(i.key);
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case "ArrowLeft": {
|
|
120
|
+
s.preventDefault(), !b && g && N(e.key, e);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "Enter":
|
|
124
|
+
case " ": {
|
|
125
|
+
s.preventDefault(), c && e.checkable !== !1 ? M(e.key, e) : u && e.selectable !== !1 ? A(e.key, e) : b || N(e.key, e);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case "Home": {
|
|
129
|
+
s.preventDefault();
|
|
130
|
+
const i = K[0];
|
|
131
|
+
i && w(i.key);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case "End": {
|
|
135
|
+
s.preventDefault();
|
|
136
|
+
const i = K[K.length - 1];
|
|
137
|
+
i && w(i.key);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, re = {
|
|
142
|
+
xs: "checkbox-xs",
|
|
143
|
+
sm: "checkbox-sm",
|
|
144
|
+
md: "",
|
|
145
|
+
lg: "checkbox-lg",
|
|
146
|
+
xl: "checkbox-xl"
|
|
147
|
+
}, ce = {
|
|
148
|
+
primary: "checkbox-primary",
|
|
149
|
+
secondary: "checkbox-secondary",
|
|
150
|
+
accent: "checkbox-accent",
|
|
151
|
+
neutral: "checkbox-neutral",
|
|
152
|
+
info: "checkbox-info",
|
|
153
|
+
success: "checkbox-success",
|
|
154
|
+
warning: "checkbox-warning",
|
|
155
|
+
error: "checkbox-error"
|
|
156
|
+
}, ie = re[f], ae = ce[d], le = () => ee ? /* @__PURE__ */ k("span", { className: "loading loading-spinner loading-xs" }) : b ? /* @__PURE__ */ k("span", { className: "w-4 h-4" }) : C ? typeof C == "function" ? C(g) : C : /* @__PURE__ */ k(
|
|
157
|
+
"svg",
|
|
158
|
+
{
|
|
159
|
+
className: `w-4 h-4 transition-transform duration-200 ${g ? "rotate-90" : ""}`,
|
|
160
|
+
fill: "none",
|
|
161
|
+
viewBox: "0 0 24 24",
|
|
162
|
+
stroke: "currentColor",
|
|
163
|
+
"aria-hidden": "true",
|
|
164
|
+
children: /* @__PURE__ */ k("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" })
|
|
165
|
+
}
|
|
166
|
+
), B = () => q ? q(e) : e.title, P = p ? "selected" : g ? "expanded" : "collapsed";
|
|
167
|
+
return /* @__PURE__ */ ue(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: "tree-node",
|
|
171
|
+
role: "treeitem",
|
|
172
|
+
"aria-expanded": b ? void 0 : g,
|
|
173
|
+
"aria-selected": p,
|
|
174
|
+
"aria-checked": c ? _ ? "mixed" : R : void 0,
|
|
175
|
+
"aria-disabled": m,
|
|
176
|
+
"aria-level": a + 1,
|
|
177
|
+
"data-testid": `${Z}-node-${e.key}`,
|
|
178
|
+
"data-state": P,
|
|
179
|
+
"data-key": e.key,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ ue(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
ref: $,
|
|
185
|
+
className: [
|
|
186
|
+
"flex items-center py-1 px-1 rounded transition-colors outline-none",
|
|
187
|
+
"focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1",
|
|
188
|
+
u && !m && "cursor-pointer hover:bg-base-200",
|
|
189
|
+
p && "bg-primary/10 text-primary",
|
|
190
|
+
m && "opacity-50 cursor-not-allowed",
|
|
191
|
+
O && "bg-warning/20",
|
|
192
|
+
Q && "w-full"
|
|
193
|
+
].filter(Boolean).join(" "),
|
|
194
|
+
style: { paddingLeft: `${a * 20}px` },
|
|
195
|
+
tabIndex: F ? 0 : -1,
|
|
196
|
+
onClick: te,
|
|
197
|
+
onContextMenu: ne,
|
|
198
|
+
onKeyDown: se,
|
|
199
|
+
onFocus: () => w(e.key),
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ k(
|
|
202
|
+
"span",
|
|
82
203
|
{
|
|
83
|
-
className:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
204
|
+
className: [
|
|
205
|
+
"w-5 h-5 flex items-center justify-center flex-shrink-0",
|
|
206
|
+
!b && !m && "cursor-pointer hover:bg-base-300 rounded"
|
|
207
|
+
].filter(Boolean).join(" "),
|
|
208
|
+
onClick: x,
|
|
209
|
+
"aria-hidden": "true",
|
|
210
|
+
children: le()
|
|
88
211
|
}
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
212
|
+
),
|
|
213
|
+
c && e.checkable !== !1 && /* @__PURE__ */ k("span", { className: "mr-1 flex-shrink-0", onClick: z, children: /* @__PURE__ */ k(
|
|
214
|
+
"input",
|
|
215
|
+
{
|
|
216
|
+
type: "checkbox",
|
|
217
|
+
className: `checkbox ${ie} ${ae}`,
|
|
218
|
+
checked: R,
|
|
219
|
+
ref: (s) => {
|
|
220
|
+
s && (s.indeterminate = _);
|
|
221
|
+
},
|
|
222
|
+
disabled: m || e.disableCheckbox,
|
|
223
|
+
onChange: z,
|
|
224
|
+
tabIndex: -1,
|
|
225
|
+
"aria-hidden": "true",
|
|
226
|
+
"data-state": _ ? "indeterminate" : R ? "checked" : "unchecked"
|
|
227
|
+
}
|
|
228
|
+
) }),
|
|
229
|
+
E && e.icon && /* @__PURE__ */ k("span", { className: "mr-1 flex-shrink-0", "aria-hidden": "true", children: e.icon }),
|
|
230
|
+
/* @__PURE__ */ k("span", { className: "flex-1 truncate select-none", children: B() })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
j && g && /* @__PURE__ */ k(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
className: J ? "border-l border-base-300 ml-2.5" : "",
|
|
238
|
+
role: "group",
|
|
239
|
+
"aria-label": `${e.title} children`,
|
|
240
|
+
children: e.children.map((s) => /* @__PURE__ */ k(be, { node: s, level: a + 1 }, s.key))
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
function fe(e) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
fe.displayName = "Tree.Node";
|
|
251
|
+
function $e(e) {
|
|
252
|
+
return e.type === fe || typeof e.type == "function" && e.type.displayName === "Tree.Node";
|
|
253
|
+
}
|
|
254
|
+
const _e = Object.assign(
|
|
255
|
+
Ne(function({
|
|
256
|
+
treeData: a,
|
|
257
|
+
children: c,
|
|
258
|
+
checkable: d = !1,
|
|
259
|
+
checkboxColor: f = "primary",
|
|
260
|
+
checkboxSize: u = "sm",
|
|
261
|
+
selectable: J = !0,
|
|
262
|
+
multiple: E = !1,
|
|
263
|
+
defaultExpandAll: Q = !1,
|
|
264
|
+
defaultExpandedKeys: I = [],
|
|
265
|
+
expandedKeys: S,
|
|
266
|
+
defaultSelectedKeys: X = [],
|
|
267
|
+
selectedKeys: C,
|
|
268
|
+
defaultCheckedKeys: q = [],
|
|
269
|
+
checkedKeys: L,
|
|
270
|
+
onExpand: N,
|
|
271
|
+
onSelect: A,
|
|
272
|
+
onCheck: M,
|
|
273
|
+
showLine: H = !1,
|
|
274
|
+
showIcon: Y = !1,
|
|
275
|
+
checkStrictly: T = !1,
|
|
276
|
+
autoExpandParent: w = !0,
|
|
277
|
+
blockNode: K = !1,
|
|
278
|
+
switcherIcon: Z,
|
|
279
|
+
titleRender: $,
|
|
280
|
+
filterTreeNode: j,
|
|
281
|
+
loadData: b,
|
|
282
|
+
onRightClick: g,
|
|
283
|
+
fieldNames: p,
|
|
284
|
+
className: ee = "",
|
|
285
|
+
"data-testid": F,
|
|
286
|
+
...R
|
|
287
|
+
}, _) {
|
|
288
|
+
const O = F ?? "tree", m = D((t, o, n) => {
|
|
289
|
+
}, []), x = G(() => {
|
|
290
|
+
if (a) {
|
|
291
|
+
if (p) {
|
|
292
|
+
const o = (n) => {
|
|
293
|
+
const r = p.key ? n[p.key] : n.key, l = p.title ? n[p.title] : n.title, h = p.children ? n[p.children] : n.children;
|
|
294
|
+
return {
|
|
295
|
+
...n,
|
|
296
|
+
key: r,
|
|
297
|
+
title: l,
|
|
298
|
+
children: Array.isArray(h) ? h.map((y) => o(y)) : void 0
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
return a.map(o);
|
|
302
|
+
}
|
|
303
|
+
return a;
|
|
304
|
+
}
|
|
305
|
+
const t = (o) => {
|
|
306
|
+
const n = [];
|
|
307
|
+
return he.Children.forEach(o, (r) => {
|
|
308
|
+
if (he.isValidElement(r) && $e(r)) {
|
|
309
|
+
const l = r.props, h = r.key;
|
|
310
|
+
if (!h) {
|
|
311
|
+
console.warn("Tree.Node requires a key prop");
|
|
312
|
+
return;
|
|
104
313
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
314
|
+
const y = {
|
|
315
|
+
key: h,
|
|
316
|
+
title: l.title,
|
|
317
|
+
icon: l.icon,
|
|
318
|
+
disabled: l.disabled,
|
|
319
|
+
disableCheckbox: l.disableCheckbox,
|
|
320
|
+
selectable: l.selectable,
|
|
321
|
+
checkable: l.checkable,
|
|
322
|
+
isLeaf: l.isLeaf,
|
|
323
|
+
children: l.children ? t(l.children) : void 0
|
|
324
|
+
};
|
|
325
|
+
n.push(y);
|
|
326
|
+
}
|
|
327
|
+
}), n;
|
|
328
|
+
};
|
|
329
|
+
return t(c);
|
|
330
|
+
}, [a, c, p]), [te, z] = V([]), ne = G(() => {
|
|
331
|
+
if (Q)
|
|
332
|
+
return Se(x);
|
|
333
|
+
if (w && I.length > 0) {
|
|
334
|
+
const t = new Set(I);
|
|
335
|
+
return I.forEach((o) => {
|
|
336
|
+
Me(x, o).forEach((n) => t.add(n));
|
|
337
|
+
}), Array.from(t);
|
|
109
338
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
339
|
+
return I;
|
|
340
|
+
}, []), [se, re] = V(ne), [ce, ie] = V(X), [ae, le] = V(q), [B, P] = V(null), s = S ?? se, v = C ?? ce, i = L ?? ae, oe = G(() => ye(x), [x]), U = G(() => Ae(x, s), [x, s]), xe = D(
|
|
341
|
+
(t) => {
|
|
342
|
+
if (T)
|
|
343
|
+
return { checked: i.includes(t.key), indeterminate: !1 };
|
|
344
|
+
if (!t.children || t.children.length === 0)
|
|
345
|
+
return { checked: i.includes(t.key), indeterminate: !1 };
|
|
346
|
+
const o = de(t), n = o.filter((r) => i.includes(r));
|
|
347
|
+
return n.length === 0 ? { checked: i.includes(t.key), indeterminate: !1 } : n.length === o.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
|
|
348
|
+
},
|
|
349
|
+
[i, T]
|
|
350
|
+
), ge = D(
|
|
351
|
+
async (t, o) => {
|
|
352
|
+
const n = s.includes(t);
|
|
353
|
+
if (b && !n && !o.isLeaf && (!o.children || o.children.length === 0)) {
|
|
354
|
+
z((l) => [...l, t]);
|
|
355
|
+
try {
|
|
356
|
+
await b(o);
|
|
357
|
+
} finally {
|
|
358
|
+
z((l) => l.filter((h) => h !== t));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const r = n ? s.filter((l) => l !== t) : [...s, t];
|
|
362
|
+
S === void 0 && re(r), N?.(r, { node: o, expanded: !n });
|
|
363
|
+
},
|
|
364
|
+
[s, S, N, b]
|
|
365
|
+
), me = D(
|
|
366
|
+
(t, o) => {
|
|
367
|
+
let n;
|
|
368
|
+
E ? v.includes(t) ? n = v.filter((r) => r !== t) : n = [...v, t] : n = v.includes(t) ? [] : [t], C === void 0 && ie(n), A?.(n, { node: o, selected: n.includes(t) });
|
|
369
|
+
},
|
|
370
|
+
[v, E, C, A]
|
|
371
|
+
), ve = D(
|
|
372
|
+
(t, o) => {
|
|
373
|
+
const n = i.includes(t);
|
|
374
|
+
let r = [...i];
|
|
375
|
+
if (T)
|
|
376
|
+
n ? r = r.filter((l) => l !== t) : r.push(t);
|
|
377
|
+
else {
|
|
378
|
+
const l = de(o);
|
|
379
|
+
n ? r = r.filter((y) => y !== t && !l.includes(y)) : (r.push(t), l.forEach((y) => {
|
|
380
|
+
r.includes(y) || r.push(y);
|
|
381
|
+
}));
|
|
382
|
+
let h = oe.get(t) ?? null;
|
|
383
|
+
for (; h; ) {
|
|
384
|
+
const y = pe(x, h);
|
|
385
|
+
y && y.children && (y.children.every(
|
|
386
|
+
(W) => r.includes(W.key) || de(W).every((Ke) => r.includes(Ke))
|
|
387
|
+
) ? r.includes(h) || r.push(h) : r = r.filter((W) => W !== h)), h = oe.get(h) ?? null;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
L === void 0 && le(r), M?.(r, { node: o, checked: !n });
|
|
391
|
+
},
|
|
392
|
+
[i, L, M, oe, x, T]
|
|
393
|
+
), Ce = D(() => {
|
|
394
|
+
!B && U.length > 0 && P(U[0].key);
|
|
395
|
+
}, [B, U]), we = {
|
|
396
|
+
checkable: d,
|
|
397
|
+
checkboxColor: f,
|
|
398
|
+
checkboxSize: u,
|
|
399
|
+
selectable: J,
|
|
400
|
+
multiple: E,
|
|
401
|
+
showLine: H,
|
|
402
|
+
showIcon: Y,
|
|
403
|
+
blockNode: K,
|
|
404
|
+
checkStrictly: T,
|
|
405
|
+
expandedKeys: s,
|
|
406
|
+
selectedKeys: v,
|
|
407
|
+
checkedKeys: i,
|
|
408
|
+
loadingKeys: te,
|
|
409
|
+
switcherIcon: Z,
|
|
410
|
+
titleRender: $,
|
|
411
|
+
filterTreeNode: j,
|
|
412
|
+
onToggle: ge,
|
|
413
|
+
onSelect: me,
|
|
414
|
+
onCheck: ve,
|
|
415
|
+
onRightClick: g,
|
|
416
|
+
getCheckedState: xe,
|
|
417
|
+
focusedKey: B,
|
|
418
|
+
setFocusedKey: P,
|
|
419
|
+
flattenedNodes: U,
|
|
420
|
+
registerNode: m,
|
|
421
|
+
baseTestId: O
|
|
422
|
+
};
|
|
423
|
+
return /* @__PURE__ */ k(ke.Provider, { value: we, children: /* @__PURE__ */ k(
|
|
424
|
+
"div",
|
|
425
|
+
{
|
|
426
|
+
ref: _,
|
|
427
|
+
className: `tree ${ee}`,
|
|
428
|
+
role: "tree",
|
|
429
|
+
"aria-multiselectable": E,
|
|
430
|
+
"data-testid": O,
|
|
431
|
+
onFocus: Ce,
|
|
432
|
+
...R,
|
|
433
|
+
children: x.map((t) => /* @__PURE__ */ k(be, { node: t, level: 0 }, t.key))
|
|
170
434
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return /* @__PURE__ */ d(
|
|
178
|
-
_,
|
|
179
|
-
{
|
|
180
|
-
node: c,
|
|
181
|
-
level: a,
|
|
182
|
-
expanded: y.includes(c.key),
|
|
183
|
-
selected: u.includes(c.key),
|
|
184
|
-
checked: s,
|
|
185
|
-
indeterminate: g,
|
|
186
|
-
checkable: t,
|
|
187
|
-
selectable: i,
|
|
188
|
-
showLine: v,
|
|
189
|
-
showIcon: m,
|
|
190
|
-
onToggle: q,
|
|
191
|
-
onSelect: z,
|
|
192
|
-
onCheck: F,
|
|
193
|
-
renderChildren: G
|
|
194
|
-
},
|
|
195
|
-
c.key
|
|
196
|
-
);
|
|
197
|
-
}),
|
|
198
|
-
[
|
|
199
|
-
y,
|
|
200
|
-
u,
|
|
201
|
-
t,
|
|
202
|
-
i,
|
|
203
|
-
v,
|
|
204
|
-
m,
|
|
205
|
-
q,
|
|
206
|
-
z,
|
|
207
|
-
F,
|
|
208
|
-
W
|
|
209
|
-
]
|
|
210
|
-
);
|
|
211
|
-
return /* @__PURE__ */ d("div", { className: `tree ${T}`, ...L, children: G(e, 0) });
|
|
212
|
-
}
|
|
435
|
+
) });
|
|
436
|
+
}),
|
|
437
|
+
{
|
|
438
|
+
Node: fe
|
|
439
|
+
}
|
|
440
|
+
);
|
|
213
441
|
export {
|
|
214
|
-
|
|
442
|
+
_e as Tree
|
|
215
443
|
};
|
|
216
444
|
//# sourceMappingURL=index93.js.map
|