asterui 0.12.26 → 0.12.28
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/Collapse.d.ts +40 -20
- package/dist/components/Descriptions.d.ts +35 -3
- package/dist/components/Empty.d.ts +10 -1
- package/dist/components/Image.d.ts +13 -1
- package/dist/components/List.d.ts +74 -8
- package/dist/components/Table.d.ts +64 -10
- package/dist/components/Timeline.d.ts +62 -7
- package/dist/index.d.ts +4 -6
- package/dist/index.js +148 -150
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index100.js +5 -32
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +13 -5
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +43 -11
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +11 -44
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +12 -10
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +7 -14
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +12 -7
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +29 -11
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +16 -29
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +31 -16
- package/dist/index109.js.map +1 -1
- package/dist/index110.js +517 -30
- package/dist/index110.js.map +1 -1
- package/dist/index111.js +45 -515
- package/dist/index111.js.map +1 -1
- package/dist/index18.js +105 -64
- package/dist/index18.js.map +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.js +127 -93
- package/dist/index23.js.map +1 -1
- package/dist/index39.js +162 -115
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +398 -40
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +132 -389
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +252 -91
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +143 -247
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +15 -154
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +17 -15
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +136 -16
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +118 -133
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +35 -13
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +34 -35
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +81 -34
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +166 -71
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +144 -167
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +11 -152
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +55 -10
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +12 -55
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +7 -14
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +333 -6
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +47 -334
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +122 -47
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +108 -120
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +167 -107
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +29 -167
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +120 -30
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +80 -116
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +19 -85
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +73 -19
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +54 -71
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +44 -56
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +49 -42
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +121 -50
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +102 -118
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +72 -105
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +67 -73
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +19 -66
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +55 -18
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +251 -55
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +22 -254
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +31 -22
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +93 -30
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +626 -86
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +73 -322
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +39 -79
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +23 -40
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +207 -23
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +148 -199
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +152 -147
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +143 -156
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -65
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +234 -35
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +31 -231
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +210 -34
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +418 -187
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +686 -376
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +165 -738
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +253 -173
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +64 -256
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +121 -61
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +14 -126
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +31 -12
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Indicator.d.ts +0 -7
- package/dist/index112.js +0 -53
- package/dist/index112.js.map +0 -1
package/dist/index92.js
CHANGED
|
@@ -1,213 +1,444 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
15
|
-
const [l, L] = C(""), b = S(() => l ? s.filter((e) => y(l, e)) : s, [s, l, y]), m = b.filter((e) => !e.disabled), d = m.length > 0 && m.every((e) => n.includes(e.key)), h = m.some((e) => n.includes(e.key)), i = () => {
|
|
16
|
-
if (!u)
|
|
17
|
-
if (d)
|
|
18
|
-
p(n.filter((e) => !m.some((a) => a.key === e)));
|
|
19
|
-
else {
|
|
20
|
-
const e = m.map((o) => o.key), a = [.../* @__PURE__ */ new Set([...n, ...e])];
|
|
21
|
-
p(a);
|
|
22
|
-
}
|
|
23
|
-
}, M = (e, a) => {
|
|
24
|
-
u || a || (n.includes(e) ? p(n.filter((o) => o !== e)) : p([...n, e]));
|
|
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);
|
|
14
|
+
});
|
|
25
15
|
};
|
|
26
|
-
return
|
|
16
|
+
return c(e), a;
|
|
17
|
+
}
|
|
18
|
+
function de(e) {
|
|
19
|
+
const a = [], c = (d) => {
|
|
20
|
+
d.children && d.children.forEach((f) => {
|
|
21
|
+
a.push(f.key), c(f);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return c(e), a;
|
|
25
|
+
}
|
|
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);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return c(e, null), a;
|
|
33
|
+
}
|
|
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;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
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
|
+
});
|
|
49
|
+
};
|
|
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(
|
|
27
168
|
"div",
|
|
28
169
|
{
|
|
29
|
-
className: "
|
|
30
|
-
|
|
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,
|
|
31
180
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
w && /* @__PURE__ */ r(
|
|
34
|
-
"input",
|
|
35
|
-
{
|
|
36
|
-
type: "checkbox",
|
|
37
|
-
className: "checkbox checkbox-sm checkbox-primary",
|
|
38
|
-
checked: d,
|
|
39
|
-
ref: (e) => {
|
|
40
|
-
e && (e.indeterminate = h && !d);
|
|
41
|
-
},
|
|
42
|
-
onChange: i,
|
|
43
|
-
disabled: u || m.length === 0
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
/* @__PURE__ */ r("span", { className: "flex-1 font-medium text-sm truncate", children: x }),
|
|
47
|
-
/* @__PURE__ */ k("span", { className: "text-xs text-base-content/50", children: [
|
|
48
|
-
n.filter((e) => b.some((a) => a.key === e)).length,
|
|
49
|
-
"/",
|
|
50
|
-
b.length
|
|
51
|
-
] })
|
|
52
|
-
] }),
|
|
53
|
-
g && /* @__PURE__ */ r("div", { className: "px-2 py-2 border-b border-base-300", children: /* @__PURE__ */ r(
|
|
54
|
-
"input",
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
className: "input input-sm w-full",
|
|
58
|
-
placeholder: "Search...",
|
|
59
|
-
value: l,
|
|
60
|
-
onChange: (e) => L(e.target.value),
|
|
61
|
-
disabled: u
|
|
62
|
-
}
|
|
63
|
-
) }),
|
|
64
|
-
/* @__PURE__ */ r("div", { className: "flex-1 overflow-auto", children: b.length > 0 ? b.map((e) => /* @__PURE__ */ k(
|
|
181
|
+
/* @__PURE__ */ ue(
|
|
65
182
|
"div",
|
|
66
183
|
{
|
|
184
|
+
ref: $,
|
|
67
185
|
className: [
|
|
68
|
-
"flex items-center
|
|
69
|
-
|
|
70
|
-
|
|
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"
|
|
71
193
|
].filter(Boolean).join(" "),
|
|
72
|
-
|
|
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),
|
|
73
200
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ k(
|
|
202
|
+
"span",
|
|
203
|
+
{
|
|
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()
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
c && e.checkable !== !1 && /* @__PURE__ */ k("span", { className: "mr-1 flex-shrink-0", onClick: z, children: /* @__PURE__ */ k(
|
|
75
214
|
"input",
|
|
76
215
|
{
|
|
77
216
|
type: "checkbox",
|
|
78
|
-
className:
|
|
79
|
-
checked:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
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"
|
|
83
227
|
}
|
|
84
|
-
),
|
|
85
|
-
/* @__PURE__ */
|
|
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() })
|
|
86
231
|
]
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
)
|
|
90
243
|
]
|
|
91
244
|
}
|
|
92
245
|
);
|
|
93
246
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
return /* @__PURE__ */ k("div", { className: `flex items-center gap-4 ${b}`, ...m, children: [
|
|
152
|
-
/* @__PURE__ */ r(
|
|
153
|
-
B,
|
|
154
|
-
{
|
|
155
|
-
items: K,
|
|
156
|
-
selectedKeys: i,
|
|
157
|
-
onSelectChange: W,
|
|
158
|
-
title: y[0],
|
|
159
|
-
showSearch: w,
|
|
160
|
-
filterOption: u,
|
|
161
|
-
render: N,
|
|
162
|
-
showSelectAll: T,
|
|
163
|
-
disabled: l,
|
|
164
|
-
listStyle: L,
|
|
165
|
-
direction: "left"
|
|
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;
|
|
166
304
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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;
|
|
313
|
+
}
|
|
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);
|
|
338
|
+
}
|
|
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
|
+
}
|
|
178
360
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
+
}
|
|
189
389
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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",
|
|
194
425
|
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
disabled: l,
|
|
204
|
-
listStyle: L,
|
|
205
|
-
direction: "right"
|
|
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))
|
|
206
434
|
}
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
435
|
+
) });
|
|
436
|
+
}),
|
|
437
|
+
{
|
|
438
|
+
Node: fe
|
|
439
|
+
}
|
|
440
|
+
);
|
|
210
441
|
export {
|
|
211
|
-
|
|
442
|
+
_e as Tree
|
|
212
443
|
};
|
|
213
444
|
//# sourceMappingURL=index92.js.map
|