@vaebe/ccui 2.0.0-beta.0
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/LICENSE +201 -0
- package/README.md +31 -0
- package/affix/ccui-cli.css +2 -0
- package/affix/index.es.js +132 -0
- package/affix/index.umd.js +1 -0
- package/alert/ccui-cli.css +2 -0
- package/alert/index.es.js +127 -0
- package/alert/index.umd.js +1 -0
- package/anchor/ccui-cli.css +2 -0
- package/anchor/index.es.js +160 -0
- package/anchor/index.umd.js +1 -0
- package/avatar/ccui-cli.css +2 -0
- package/avatar/index.es.js +235 -0
- package/avatar/index.umd.js +1 -0
- package/badge/ccui-cli.css +2 -0
- package/badge/index.es.js +146 -0
- package/badge/index.umd.js +1 -0
- package/breadcrumb/ccui-cli.css +2 -0
- package/breadcrumb/index.es.js +89 -0
- package/breadcrumb/index.umd.js +1 -0
- package/button/ccui-cli.css +2 -0
- package/button/index.es.js +1236 -0
- package/button/index.umd.js +1 -0
- package/button-3d/ccui-cli.css +2 -0
- package/button-3d/index.es.js +80 -0
- package/button-3d/index.umd.js +1 -0
- package/calendar/ccui-cli.css +2 -0
- package/calendar/index.es.js +450 -0
- package/calendar/index.umd.js +1 -0
- package/card/ccui-cli.css +2 -0
- package/card/index.es.js +78 -0
- package/card/index.umd.js +1 -0
- package/ccui-cli.css +2 -0
- package/check-box/ccui-cli.css +2 -0
- package/check-box/index.es.js +173 -0
- package/check-box/index.umd.js +1 -0
- package/collapse/ccui-cli.css +2 -0
- package/collapse/index.es.js +176 -0
- package/collapse/index.umd.js +1 -0
- package/config-provider/index.es.js +204 -0
- package/config-provider/index.umd.js +1 -0
- package/date-picker/ccui-cli.css +2 -0
- package/date-picker/index.es.js +2447 -0
- package/date-picker/index.umd.js +1 -0
- package/descriptions/ccui-cli.css +2 -0
- package/descriptions/index.es.js +175 -0
- package/descriptions/index.umd.js +1 -0
- package/divider/ccui-cli.css +2 -0
- package/divider/index.es.js +78 -0
- package/divider/index.umd.js +1 -0
- package/drawer/ccui-cli.css +2 -0
- package/drawer/index.es.js +1320 -0
- package/drawer/index.umd.js +1 -0
- package/dropdown/ccui-cli.css +2 -0
- package/dropdown/index.es.js +606 -0
- package/dropdown/index.umd.js +1 -0
- package/empty/ccui-cli.css +2 -0
- package/empty/index.es.js +173 -0
- package/empty/index.umd.js +1 -0
- package/flex/ccui-cli.css +2 -0
- package/flex/index.es.js +87 -0
- package/flex/index.umd.js +1 -0
- package/float-button/ccui-cli.css +2 -0
- package/float-button/index.es.js +169 -0
- package/float-button/index.umd.js +1 -0
- package/form/ccui-cli.css +2 -0
- package/form/index.es.js +752 -0
- package/form/index.umd.js +1 -0
- package/grid/ccui-cli.css +2 -0
- package/grid/index.es.js +207 -0
- package/grid/index.umd.js +1 -0
- package/icon/ccui-cli.css +2 -0
- package/icon/index.es.js +1228 -0
- package/icon/index.umd.js +1 -0
- package/image/ccui-cli.css +2 -0
- package/image/index.es.js +276 -0
- package/image/index.umd.js +1 -0
- package/index.d.ts +7 -0
- package/input/ccui-cli.css +2 -0
- package/input/index.es.js +1293 -0
- package/input/index.umd.js +1 -0
- package/input-number/ccui-cli.css +2 -0
- package/input-number/index.es.js +263 -0
- package/input-number/index.umd.js +1 -0
- package/layout/ccui-cli.css +2 -0
- package/layout/index.es.js +184 -0
- package/layout/index.umd.js +1 -0
- package/masonry/ccui-cli.css +2 -0
- package/masonry/index.es.js +119 -0
- package/masonry/index.umd.js +1 -0
- package/menu/ccui-cli.css +2 -0
- package/menu/index.es.js +385 -0
- package/menu/index.umd.js +1 -0
- package/message/ccui-cli.css +2 -0
- package/message/index.es.js +351 -0
- package/message/index.umd.js +1 -0
- package/modal/ccui-cli.css +2 -0
- package/modal/index.es.js +1553 -0
- package/modal/index.umd.js +1 -0
- package/notification/ccui-cli.css +2 -0
- package/notification/index.es.js +347 -0
- package/notification/index.umd.js +1 -0
- package/nuxt/components/category.js +2 -0
- package/nuxt/components/install.js +2 -0
- package/nuxt/components/status.js +2 -0
- package/nuxt/components/title.js +2 -0
- package/nuxt/index.js +13 -0
- package/package.json +53 -0
- package/pagination/ccui-cli.css +2 -0
- package/pagination/index.es.js +296 -0
- package/pagination/index.umd.js +1 -0
- package/popconfirm/ccui-cli.css +2 -0
- package/popconfirm/index.es.js +735 -0
- package/popconfirm/index.umd.js +1 -0
- package/popover/ccui-cli.css +2 -0
- package/popover/index.es.js +530 -0
- package/popover/index.umd.js +1 -0
- package/progress/ccui-cli.css +2 -0
- package/progress/index.es.js +167 -0
- package/progress/index.umd.js +1 -0
- package/radio/ccui-cli.css +2 -0
- package/radio/index.es.js +157 -0
- package/radio/index.umd.js +1 -0
- package/rate/ccui-cli.css +2 -0
- package/rate/index.es.js +115 -0
- package/rate/index.umd.js +1 -0
- package/result/ccui-cli.css +2 -0
- package/result/index.es.js +90 -0
- package/result/index.umd.js +1 -0
- package/segmented/ccui-cli.css +2 -0
- package/segmented/index.es.js +99 -0
- package/segmented/index.umd.js +1 -0
- package/select/ccui-cli.css +2 -0
- package/select/index.es.js +1885 -0
- package/select/index.umd.js +1 -0
- package/skeleton/ccui-cli.css +2 -0
- package/skeleton/index.es.js +117 -0
- package/skeleton/index.umd.js +1 -0
- package/slider/ccui-cli.css +2 -0
- package/slider/index.es.js +1071 -0
- package/slider/index.umd.js +1 -0
- package/space/ccui-cli.css +2 -0
- package/space/index.es.js +108 -0
- package/space/index.umd.js +1 -0
- package/spin/ccui-cli.css +2 -0
- package/spin/index.es.js +86 -0
- package/spin/index.umd.js +1 -0
- package/splitter/ccui-cli.css +2 -0
- package/splitter/index.es.js +198 -0
- package/splitter/index.umd.js +1 -0
- package/status/ccui-cli.css +2 -0
- package/status/index.es.js +44 -0
- package/status/index.umd.js +1 -0
- package/steps/ccui-cli.css +2 -0
- package/steps/index.es.js +118 -0
- package/steps/index.umd.js +1 -0
- package/switch/ccui-cli.css +2 -0
- package/switch/index.es.js +118 -0
- package/switch/index.umd.js +1 -0
- package/table/ccui-cli.css +2 -0
- package/table/index.es.js +553 -0
- package/table/index.umd.js +1 -0
- package/tabs/ccui-cli.css +2 -0
- package/tabs/index.es.js +128 -0
- package/tabs/index.umd.js +1 -0
- package/tag/ccui-cli.css +2 -0
- package/tag/index.es.js +116 -0
- package/tag/index.umd.js +1 -0
- package/theme/darkTheme.css +352 -0
- package/theme/theme.scss +703 -0
- package/timeline/ccui-cli.css +2 -0
- package/timeline/index.es.js +113 -0
- package/timeline/index.umd.js +1 -0
- package/tooltip/ccui-cli.css +2 -0
- package/tooltip/index.es.js +423 -0
- package/tooltip/index.umd.js +1 -0
- package/tree/ccui-cli.css +2 -0
- package/tree/index.es.js +810 -0
- package/tree/index.umd.js +1 -0
- package/typography/ccui-cli.css +2 -0
- package/typography/index.es.js +270 -0
- package/typography/index.umd.js +1 -0
- package/util/index.es.js +78 -0
- package/util/index.umd.js +1 -0
- package/vue-ccui.es.js +18989 -0
- package/vue-ccui.umd.js +1 -0
- package/watermark/ccui-cli.css +2 -0
- package/watermark/index.es.js +179 -0
- package/watermark/index.umd.js +1 -0
package/tree/index.es.js
ADDED
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
import { computed as e, defineComponent as t, h as n, nextTick as r, onUnmounted as i, ref as a, shallowRef as o, toRef as s, watch as c } from "vue";
|
|
2
|
+
//#region ../icons/dist/caret-right-outlined-RzTzenJQ.js
|
|
3
|
+
function l(e) {
|
|
4
|
+
if (!(e == null || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
5
|
+
}
|
|
6
|
+
function u(e) {
|
|
7
|
+
let { name: t, viewBox: r = "0 0 1024 1024", path: i } = e, a = Array.isArray(i) ? i : [i], o = (e) => {
|
|
8
|
+
let t = l(e.size), i = {
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
lineHeight: 0,
|
|
11
|
+
verticalAlign: "-0.125em"
|
|
12
|
+
};
|
|
13
|
+
t && (i.fontSize = t), e.color && (i.color = e.color);
|
|
14
|
+
let o = e.rotate;
|
|
15
|
+
o !== void 0 && o !== "" && (i.transform = `rotate(${typeof o == "number" ? `${o}deg` : o})`, i.transformOrigin = "center");
|
|
16
|
+
let s = typeof e.style == "string" ? i : {
|
|
17
|
+
...i,
|
|
18
|
+
...e.style
|
|
19
|
+
};
|
|
20
|
+
return n("span", {
|
|
21
|
+
class: [
|
|
22
|
+
"ccui-icon",
|
|
23
|
+
e.spin && "ccui-icon--spin",
|
|
24
|
+
e.class
|
|
25
|
+
],
|
|
26
|
+
style: s,
|
|
27
|
+
"aria-hidden": "true"
|
|
28
|
+
}, n("svg", {
|
|
29
|
+
viewBox: r,
|
|
30
|
+
width: "1em",
|
|
31
|
+
height: "1em",
|
|
32
|
+
fill: "currentColor"
|
|
33
|
+
}, a.map((e) => n("path", { d: e }))));
|
|
34
|
+
};
|
|
35
|
+
return o.displayName = t, o.props = [
|
|
36
|
+
"size",
|
|
37
|
+
"color",
|
|
38
|
+
"rotate",
|
|
39
|
+
"spin",
|
|
40
|
+
"class",
|
|
41
|
+
"style"
|
|
42
|
+
], o;
|
|
43
|
+
}
|
|
44
|
+
var d = u({
|
|
45
|
+
name: "CaretRightOutlined",
|
|
46
|
+
path: "M384 192v640l384-320.064z"
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ../ccui/ui/shared/hooks/use-namespace.ts
|
|
50
|
+
function f(e, t, n) {
|
|
51
|
+
let r = e;
|
|
52
|
+
return t && (r += `__${t}`), n && (r += `--${n}`), r;
|
|
53
|
+
}
|
|
54
|
+
function ee(e, t = !1) {
|
|
55
|
+
let n = t ? `.ccui-${e}` : `ccui-${e}`;
|
|
56
|
+
return {
|
|
57
|
+
b: () => f(n),
|
|
58
|
+
e: (e) => e ? f(n, e) : "",
|
|
59
|
+
m: (e) => e ? f(n, "", e) : "",
|
|
60
|
+
em: (e, t) => e && t ? f(n, e, t) : "",
|
|
61
|
+
is: (e) => `is-${e}`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region ../ccui/ui/shared/hooks/use-virtual-list.ts
|
|
66
|
+
function te(t, n) {
|
|
67
|
+
let r = a(0), i = n.buffer ?? 4, o = e(() => t.value.length * n.itemHeight), s = e(() => Math.min(n.maxHeight, o.value));
|
|
68
|
+
return {
|
|
69
|
+
scrollTop: r,
|
|
70
|
+
onScroll: (e) => {
|
|
71
|
+
r.value = e.currentTarget.scrollTop;
|
|
72
|
+
},
|
|
73
|
+
visible: e(() => {
|
|
74
|
+
let e = t.value;
|
|
75
|
+
if (e.length === 0) return [];
|
|
76
|
+
let a = Math.max(0, Math.floor(r.value / n.itemHeight) - i), o = Math.ceil(s.value / n.itemHeight) + i * 2, c = Math.min(e.length, a + o), l = [];
|
|
77
|
+
for (let t = a; t < c; t += 1) l.push({
|
|
78
|
+
index: t,
|
|
79
|
+
data: e[t],
|
|
80
|
+
top: t * n.itemHeight
|
|
81
|
+
});
|
|
82
|
+
return l;
|
|
83
|
+
}),
|
|
84
|
+
totalHeight: o,
|
|
85
|
+
containerHeight: s,
|
|
86
|
+
scrollToIndex: (e, t) => {
|
|
87
|
+
if (!t) return;
|
|
88
|
+
let i = e * n.itemHeight;
|
|
89
|
+
i < r.value ? t.scrollTop = i : i + n.itemHeight > r.value + s.value && (t.scrollTop = i - s.value + n.itemHeight);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region ../ccui/ui/tree/src/composables/use-tree-check.ts
|
|
95
|
+
function ne(t, n, r) {
|
|
96
|
+
return e(() => {
|
|
97
|
+
let { flatAll: e, byKey: i } = t.value;
|
|
98
|
+
if (r.value) return {
|
|
99
|
+
checked: new Set(n.value),
|
|
100
|
+
halfChecked: /* @__PURE__ */ new Set()
|
|
101
|
+
};
|
|
102
|
+
let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = new Set(n.value), c = (e) => {
|
|
103
|
+
let t = i.get(e);
|
|
104
|
+
return !!t && !t.disableCheckbox && !t.disabled;
|
|
105
|
+
};
|
|
106
|
+
for (let t of e) if (s.has(t.key)) {
|
|
107
|
+
let e = [t];
|
|
108
|
+
for (; e.length;) {
|
|
109
|
+
let t = e.pop();
|
|
110
|
+
c(t.key) && a.add(t.key);
|
|
111
|
+
for (let n of t.childKeys) {
|
|
112
|
+
let t = i.get(n);
|
|
113
|
+
t && e.push(t);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
for (let t = e.length - 1; t >= 0; --t) {
|
|
118
|
+
let n = e[t];
|
|
119
|
+
if (!n.hasChildren) continue;
|
|
120
|
+
let r = n.childKeys.map((e) => i.get(e)).filter((e) => !!e && c(e.key));
|
|
121
|
+
if (r.length === 0) continue;
|
|
122
|
+
let s = r.every((e) => a.has(e.key)), l = r.some((e) => a.has(e.key) || o.has(e.key));
|
|
123
|
+
s ? (c(n.key) && a.add(n.key), o.delete(n.key)) : l && (o.add(n.key), a.delete(n.key));
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
checked: a,
|
|
127
|
+
halfChecked: o
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function re(e, t, n, r) {
|
|
132
|
+
let i = e.byKey.get(n);
|
|
133
|
+
if (!i || i.disabled || i.disableCheckbox) return Array.from(t);
|
|
134
|
+
let a = t.has(n), o = new Set(t);
|
|
135
|
+
if (r) return a ? o.delete(n) : o.add(n), Array.from(o);
|
|
136
|
+
let s = [], c = [n];
|
|
137
|
+
for (; c.length;) {
|
|
138
|
+
let t = c.pop();
|
|
139
|
+
s.push(t);
|
|
140
|
+
let n = e.byKey.get(t);
|
|
141
|
+
if (n) for (let e of n.childKeys) c.push(e);
|
|
142
|
+
}
|
|
143
|
+
if (a) for (let e of s) o.delete(e);
|
|
144
|
+
else for (let t of s) {
|
|
145
|
+
let n = e.byKey.get(t);
|
|
146
|
+
n && !n.disabled && !n.disableCheckbox && o.add(t);
|
|
147
|
+
}
|
|
148
|
+
for (let t of [...i.parentKeys].reverse()) {
|
|
149
|
+
let n = e.byKey.get(t);
|
|
150
|
+
if (!n) continue;
|
|
151
|
+
let r = n.childKeys.map((t) => e.byKey.get(t)).filter((e) => !!e && !e.disableCheckbox && !e.disabled);
|
|
152
|
+
r.length !== 0 && (r.every((e) => o.has(e.key)) ? o.add(t) : o.delete(t));
|
|
153
|
+
}
|
|
154
|
+
return Array.from(o);
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region ../ccui/ui/tree/src/composables/use-tree-flatten.ts
|
|
158
|
+
var p = {
|
|
159
|
+
key: "key",
|
|
160
|
+
title: "title",
|
|
161
|
+
children: "children",
|
|
162
|
+
disabled: "disabled",
|
|
163
|
+
disableCheckbox: "disableCheckbox",
|
|
164
|
+
isLeaf: "isLeaf",
|
|
165
|
+
selectable: "selectable"
|
|
166
|
+
};
|
|
167
|
+
function ie(e) {
|
|
168
|
+
return {
|
|
169
|
+
...p,
|
|
170
|
+
...e
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function m(e, t, n) {
|
|
174
|
+
return e[t.key] ?? `__auto_${n}`;
|
|
175
|
+
}
|
|
176
|
+
function h(e, t) {
|
|
177
|
+
let n = e[t.children];
|
|
178
|
+
return Array.isArray(n) ? n : void 0;
|
|
179
|
+
}
|
|
180
|
+
function g(e, t, n, r, i) {
|
|
181
|
+
let a = h(e, t), o = e[t.isLeaf], s = !!a && a.length > 0, c = o === void 0 ? !s && !e.loadable : o, l = m(e, t, i);
|
|
182
|
+
return {
|
|
183
|
+
key: l,
|
|
184
|
+
raw: e,
|
|
185
|
+
title: e[t.title] ?? l,
|
|
186
|
+
level: n,
|
|
187
|
+
parentKeys: r,
|
|
188
|
+
isLeaf: c,
|
|
189
|
+
disabled: !!e[t.disabled],
|
|
190
|
+
disableCheckbox: !!e[t.disableCheckbox],
|
|
191
|
+
selectable: e[t.selectable] !== !1,
|
|
192
|
+
hasChildren: s,
|
|
193
|
+
childKeys: s ? a.map((e, n) => m(e, t, i * 1e3 + n)) : []
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function _(e) {
|
|
197
|
+
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
198
|
+
}
|
|
199
|
+
function ae(t, n) {
|
|
200
|
+
return e(() => {
|
|
201
|
+
let e = [], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = [], o = n.value, s = 0, c = (t, n, l) => {
|
|
202
|
+
let u = [];
|
|
203
|
+
for (let i of t) {
|
|
204
|
+
s += 1;
|
|
205
|
+
let t = g(i, o, n, l, s);
|
|
206
|
+
e.push(t), u.push(t), r.set(t.key, t);
|
|
207
|
+
let a = h(i, o);
|
|
208
|
+
a && c(a, n + 1, [...l, t.key]);
|
|
209
|
+
}
|
|
210
|
+
l.length === 0 ? a.push(...u.map((e) => e.key)) : i.set(l[l.length - 1], u);
|
|
211
|
+
};
|
|
212
|
+
return c(t.value, 0, []), {
|
|
213
|
+
flatAll: e,
|
|
214
|
+
byKey: r,
|
|
215
|
+
childrenByKey: i,
|
|
216
|
+
rootKeys: a
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function oe(t, n, r, i) {
|
|
221
|
+
return e(() => {
|
|
222
|
+
let { flatAll: e } = t.value, a = n.value, o = r.value.trim(), s = i?.value, c = [], l = /* @__PURE__ */ new Set();
|
|
223
|
+
if (o || s) {
|
|
224
|
+
for (let t of e) if (s ? s(t.raw, t.parentKeys) : o.length > 0 && _(t.title).toLowerCase().includes(o.toLowerCase())) {
|
|
225
|
+
l.add(t.key);
|
|
226
|
+
for (let e of t.parentKeys) l.add(e);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
for (let t of e) l.size > 0 && !l.has(t.key) || t.parentKeys.every((e) => a.has(e)) && c.push(t);
|
|
230
|
+
return c;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region ../ccui/ui/tree/src/composables/use-tree-state.ts
|
|
235
|
+
function v(e) {
|
|
236
|
+
return new Set(e ?? []);
|
|
237
|
+
}
|
|
238
|
+
function y(t, n, r) {
|
|
239
|
+
let i = a(v(n.value));
|
|
240
|
+
return c(t, (e) => {
|
|
241
|
+
e !== void 0 && (i.value = v(e));
|
|
242
|
+
}), {
|
|
243
|
+
current: e(() => t.value === void 0 ? i.value : v(t.value)),
|
|
244
|
+
setKeys: (e) => {
|
|
245
|
+
t.value === void 0 && (i.value = v(e)), r(e);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function se(t, n, r) {
|
|
250
|
+
let i = e(() => t.selectedKeys), a = e(() => t.defaultSelectedKeys ?? []), o = e(() => t.checkedKeys), s = e(() => t.defaultCheckedKeys ?? []), c = e(() => t.expandedKeys), l = e(() => t.expandedKeys ? t.expandedKeys : n.value.length > 0 ? n.value : t.defaultExpandedKeys ?? []), u = y(i, a, (e) => r("update:selectedKeys", e)), d = y(o, s, (e) => r("update:checkedKeys", e)), f = y(c, l, (e) => r("update:expandedKeys", e));
|
|
251
|
+
return {
|
|
252
|
+
selectedKeys: u.current,
|
|
253
|
+
setSelectedKeys: u.setKeys,
|
|
254
|
+
checkedKeys: d.current,
|
|
255
|
+
setCheckedKeys: d.setKeys,
|
|
256
|
+
expandedKeys: f.current,
|
|
257
|
+
setExpandedKeys: f.setKeys
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region ../ccui/ui/tree/src/tree-types.ts
|
|
262
|
+
var b = {
|
|
263
|
+
data: {
|
|
264
|
+
type: Array,
|
|
265
|
+
default: () => []
|
|
266
|
+
},
|
|
267
|
+
fieldNames: {
|
|
268
|
+
type: Object,
|
|
269
|
+
default: () => ({})
|
|
270
|
+
},
|
|
271
|
+
selectable: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: !0
|
|
274
|
+
},
|
|
275
|
+
multiple: {
|
|
276
|
+
type: Boolean,
|
|
277
|
+
default: !1
|
|
278
|
+
},
|
|
279
|
+
selectedKeys: {
|
|
280
|
+
type: Array,
|
|
281
|
+
default: void 0
|
|
282
|
+
},
|
|
283
|
+
defaultSelectedKeys: {
|
|
284
|
+
type: Array,
|
|
285
|
+
default: () => []
|
|
286
|
+
},
|
|
287
|
+
checkable: {
|
|
288
|
+
type: Boolean,
|
|
289
|
+
default: !1
|
|
290
|
+
},
|
|
291
|
+
checkedKeys: {
|
|
292
|
+
type: Array,
|
|
293
|
+
default: void 0
|
|
294
|
+
},
|
|
295
|
+
defaultCheckedKeys: {
|
|
296
|
+
type: Array,
|
|
297
|
+
default: () => []
|
|
298
|
+
},
|
|
299
|
+
checkStrictly: {
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: !1
|
|
302
|
+
},
|
|
303
|
+
expandedKeys: {
|
|
304
|
+
type: Array,
|
|
305
|
+
default: void 0
|
|
306
|
+
},
|
|
307
|
+
defaultExpandedKeys: {
|
|
308
|
+
type: Array,
|
|
309
|
+
default: () => []
|
|
310
|
+
},
|
|
311
|
+
defaultExpandAll: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
default: !1
|
|
314
|
+
},
|
|
315
|
+
disabled: {
|
|
316
|
+
type: Boolean,
|
|
317
|
+
default: !1
|
|
318
|
+
},
|
|
319
|
+
loadData: {
|
|
320
|
+
type: Function,
|
|
321
|
+
default: void 0
|
|
322
|
+
},
|
|
323
|
+
draggable: {
|
|
324
|
+
type: Boolean,
|
|
325
|
+
default: !1
|
|
326
|
+
},
|
|
327
|
+
showLine: {
|
|
328
|
+
type: Boolean,
|
|
329
|
+
default: !1
|
|
330
|
+
},
|
|
331
|
+
blockNode: {
|
|
332
|
+
type: Boolean,
|
|
333
|
+
default: !1
|
|
334
|
+
},
|
|
335
|
+
expandAction: {
|
|
336
|
+
type: [String, Boolean],
|
|
337
|
+
default: "click"
|
|
338
|
+
},
|
|
339
|
+
searchValue: {
|
|
340
|
+
type: String,
|
|
341
|
+
default: ""
|
|
342
|
+
},
|
|
343
|
+
filterTreeNode: {
|
|
344
|
+
type: Function,
|
|
345
|
+
default: void 0
|
|
346
|
+
},
|
|
347
|
+
indentSize: {
|
|
348
|
+
type: Number,
|
|
349
|
+
default: 24
|
|
350
|
+
},
|
|
351
|
+
virtualScroll: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
default: !1
|
|
354
|
+
},
|
|
355
|
+
virtualItemHeight: {
|
|
356
|
+
type: Number,
|
|
357
|
+
default: 32
|
|
358
|
+
},
|
|
359
|
+
virtualMaxHeight: {
|
|
360
|
+
type: Number,
|
|
361
|
+
default: 320
|
|
362
|
+
},
|
|
363
|
+
focusedKey: {
|
|
364
|
+
type: [String, Number],
|
|
365
|
+
default: void 0
|
|
366
|
+
},
|
|
367
|
+
dragHoverExpandDelay: {
|
|
368
|
+
type: Number,
|
|
369
|
+
default: 600
|
|
370
|
+
},
|
|
371
|
+
dragAutoScroll: {
|
|
372
|
+
type: Boolean,
|
|
373
|
+
default: !0
|
|
374
|
+
},
|
|
375
|
+
dragAutoScrollEdge: {
|
|
376
|
+
type: Number,
|
|
377
|
+
default: 32
|
|
378
|
+
},
|
|
379
|
+
dragAutoScrollSpeed: {
|
|
380
|
+
type: Number,
|
|
381
|
+
default: 12
|
|
382
|
+
},
|
|
383
|
+
classNames: {
|
|
384
|
+
type: Object,
|
|
385
|
+
default: void 0
|
|
386
|
+
},
|
|
387
|
+
styles: {
|
|
388
|
+
type: Object,
|
|
389
|
+
default: void 0
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
//#endregion
|
|
393
|
+
//#region ../ccui/ui/tree/src/tree.tsx
|
|
394
|
+
function ce(e) {
|
|
395
|
+
return e.filter((e) => e.hasChildren).map((e) => e.key);
|
|
396
|
+
}
|
|
397
|
+
function x(e) {
|
|
398
|
+
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
|
|
399
|
+
}
|
|
400
|
+
function le(e, t) {
|
|
401
|
+
let r = x(e);
|
|
402
|
+
if (!t) return r;
|
|
403
|
+
let i = r.toLowerCase(), a = t.toLowerCase(), o = i.indexOf(a);
|
|
404
|
+
return o < 0 ? r : n("span", null, [
|
|
405
|
+
r.slice(0, o),
|
|
406
|
+
n("span", { class: "ccui-tree__highlight" }, r.slice(o, o + t.length)),
|
|
407
|
+
r.slice(o + t.length)
|
|
408
|
+
]);
|
|
409
|
+
}
|
|
410
|
+
var S = /* @__PURE__ */ t({
|
|
411
|
+
name: "CTree",
|
|
412
|
+
props: b,
|
|
413
|
+
emits: [
|
|
414
|
+
"update:selectedKeys",
|
|
415
|
+
"update:checkedKeys",
|
|
416
|
+
"update:expandedKeys",
|
|
417
|
+
"update:focusedKey",
|
|
418
|
+
"select",
|
|
419
|
+
"check",
|
|
420
|
+
"expand",
|
|
421
|
+
"load",
|
|
422
|
+
"drop",
|
|
423
|
+
"dragstart",
|
|
424
|
+
"dragenter",
|
|
425
|
+
"dragover",
|
|
426
|
+
"dragleave",
|
|
427
|
+
"focus-change",
|
|
428
|
+
"load-error"
|
|
429
|
+
],
|
|
430
|
+
setup(t, { emit: l, expose: u, slots: f }) {
|
|
431
|
+
let p = ee("tree"), m = e(() => ie(t.fieldNames)), h = s(t, "data"), g = s(t, "searchValue"), _ = e(() => t.filterTreeNode), v = ae(h, m), y = a([]);
|
|
432
|
+
t.defaultExpandAll && t.expandedKeys === void 0 && (t.defaultExpandedKeys ?? []).length === 0 && (y.value = ce(v.value.flatAll));
|
|
433
|
+
let { selectedKeys: b, setSelectedKeys: x, checkedKeys: S, setCheckedKeys: C, expandedKeys: w, setExpandedKeys: ue } = se(t, y, l), T = ne(v, S, e(() => t.checkStrictly)), E = oe(v, w, g, _), D = a(/* @__PURE__ */ new Set()), O = a(/* @__PURE__ */ new Set()), k = a(/* @__PURE__ */ new Set()), A = o(null), j = o(null), M = o(null), N = o(null), P = o(null), F = o(0), I = a(t.focusedKey), L = e(() => t.focusedKey === void 0 ? I.value : t.focusedKey), R = (e) => {
|
|
434
|
+
t.focusedKey === void 0 && (I.value = e), l("update:focusedKey", e), l("focus-change", e);
|
|
435
|
+
}, z = a(null), B = a(null), V = e(() => {
|
|
436
|
+
let e = /* @__PURE__ */ new Map();
|
|
437
|
+
return E.value.forEach((t, n) => e.set(t.key, n)), e;
|
|
438
|
+
}), H = e(() => t.virtualScroll && E.value.length > 0), U = te(E, {
|
|
439
|
+
itemHeight: t.virtualItemHeight,
|
|
440
|
+
maxHeight: t.virtualMaxHeight
|
|
441
|
+
}), W = async (e, n) => {
|
|
442
|
+
if (t.loadData) {
|
|
443
|
+
k.value.delete(e.key), k.value = new Set(k.value), D.value.add(e.key), D.value = new Set(D.value);
|
|
444
|
+
try {
|
|
445
|
+
await t.loadData(e.raw), O.value.add(e.key), O.value = new Set(O.value), l("load", Array.from(O.value), {
|
|
446
|
+
event: n,
|
|
447
|
+
node: e
|
|
448
|
+
});
|
|
449
|
+
} catch (t) {
|
|
450
|
+
k.value.add(e.key), k.value = new Set(k.value), l("load-error", {
|
|
451
|
+
error: t,
|
|
452
|
+
node: e
|
|
453
|
+
});
|
|
454
|
+
} finally {
|
|
455
|
+
D.value.delete(e.key), D.value = new Set(D.value);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}, G = async (e, n) => {
|
|
459
|
+
if (t.disabled) return;
|
|
460
|
+
let r = w.value.has(e.key), i = new Set(w.value);
|
|
461
|
+
r ? i.delete(e.key) : (i.add(e.key), t.loadData && !e.hasChildren && !e.isLeaf && !O.value.has(e.key) && await W(e, n));
|
|
462
|
+
let a = Array.from(i);
|
|
463
|
+
ue(a), l("expand", a, {
|
|
464
|
+
expanded: !r,
|
|
465
|
+
node: e
|
|
466
|
+
});
|
|
467
|
+
}, K = async (e) => {
|
|
468
|
+
let n = v.value.byKey.get(e);
|
|
469
|
+
!n || !t.loadData || await W(n);
|
|
470
|
+
}, q = (e, n) => {
|
|
471
|
+
if (t.disabled || !t.selectable || !e.selectable || e.disabled) return;
|
|
472
|
+
let r = b.value.has(e.key), i;
|
|
473
|
+
i = t.multiple ? r ? Array.from(b.value).filter((t) => t !== e.key) : [...b.value, e.key] : r ? [] : [e.key], x(i), l("select", i, {
|
|
474
|
+
selectedKeys: i,
|
|
475
|
+
selected: !r,
|
|
476
|
+
node: e,
|
|
477
|
+
event: n
|
|
478
|
+
});
|
|
479
|
+
}, J = (e, n) => {
|
|
480
|
+
if (t.disabled || !t.checkable || e.disableCheckbox || e.disabled) return;
|
|
481
|
+
let r = T.value.checked.has(e.key), i = t.checkStrictly ? S.value : T.value.checked, a = re(v.value, i, e.key, t.checkStrictly);
|
|
482
|
+
C(a), l("check", a, {
|
|
483
|
+
checkedKeys: a,
|
|
484
|
+
halfCheckedKeys: Array.from(T.value.halfChecked),
|
|
485
|
+
checked: !r,
|
|
486
|
+
node: e,
|
|
487
|
+
event: n
|
|
488
|
+
});
|
|
489
|
+
}, de = (e, n) => {
|
|
490
|
+
if (!t.draggable || n.disabled) {
|
|
491
|
+
e.preventDefault();
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
j.value = n.key, e.dataTransfer?.setData("text/plain", String(n.key)), l("dragstart", {
|
|
495
|
+
event: e,
|
|
496
|
+
node: n
|
|
497
|
+
});
|
|
498
|
+
}, fe = (e, t) => {
|
|
499
|
+
let n = t.getBoundingClientRect();
|
|
500
|
+
if (!n.height) return "inside";
|
|
501
|
+
let r = (e.clientY - n.top) / n.height;
|
|
502
|
+
return r < .25 ? "before" : r > .75 ? "after" : "inside";
|
|
503
|
+
}, Y = () => {
|
|
504
|
+
M.value &&= (clearTimeout(M.value), null), N.value = null;
|
|
505
|
+
}, pe = (e, n) => {
|
|
506
|
+
!t.dragHoverExpandDelay || t.dragHoverExpandDelay <= 0 || !e.hasChildren && (!t.loadData || e.isLeaf) || w.value.has(e.key) || N.value !== e.key && (Y(), N.value = e.key, M.value = setTimeout(() => {
|
|
507
|
+
j.value !== null && N.value === e.key && G(e, n), M.value = null;
|
|
508
|
+
}, t.dragHoverExpandDelay));
|
|
509
|
+
}, X = () => {
|
|
510
|
+
F.value = 0, P.value !== null && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(P.value), P.value = null;
|
|
511
|
+
}, Z = () => {
|
|
512
|
+
let e = B.value;
|
|
513
|
+
if (!e || F.value === 0) {
|
|
514
|
+
P.value = null;
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
e.scrollTop += F.value, typeof requestAnimationFrame == "function" ? P.value = requestAnimationFrame(Z) : P.value = null;
|
|
518
|
+
}, me = (e) => {
|
|
519
|
+
if (!t.dragAutoScroll) return;
|
|
520
|
+
let n = B.value;
|
|
521
|
+
if (!n) return;
|
|
522
|
+
let r = n.getBoundingClientRect(), i = t.dragAutoScrollEdge, a = t.dragAutoScrollSpeed, o = e.clientY - r.top, s = r.bottom - e.clientY, c = 0;
|
|
523
|
+
o < i && o > 0 ? c = -a : s < i && s > 0 && (c = a);
|
|
524
|
+
let l = F.value === 0;
|
|
525
|
+
F.value = c, c !== 0 && l && typeof requestAnimationFrame == "function" ? P.value = requestAnimationFrame(Z) : c === 0 && X();
|
|
526
|
+
}, he = (e, n) => {
|
|
527
|
+
if (!t.draggable || j.value === null) return;
|
|
528
|
+
e.preventDefault();
|
|
529
|
+
let r = fe(e, e.currentTarget);
|
|
530
|
+
A.value = {
|
|
531
|
+
key: n.key,
|
|
532
|
+
position: r
|
|
533
|
+
}, r === "inside" ? pe(n, e) : N.value !== null && Y(), me(e), l("dragover", {
|
|
534
|
+
event: e,
|
|
535
|
+
node: n
|
|
536
|
+
});
|
|
537
|
+
}, ge = (e, n) => {
|
|
538
|
+
t.draggable && l("dragenter", {
|
|
539
|
+
event: e,
|
|
540
|
+
node: n
|
|
541
|
+
});
|
|
542
|
+
}, _e = (e, n) => {
|
|
543
|
+
t.draggable && (N.value === n.key && Y(), l("dragleave", {
|
|
544
|
+
event: e,
|
|
545
|
+
node: n
|
|
546
|
+
}));
|
|
547
|
+
}, ve = (e, n) => {
|
|
548
|
+
if (!t.draggable || j.value === null) return;
|
|
549
|
+
e.preventDefault(), Y(), X();
|
|
550
|
+
let r = v.value.byKey.get(j.value);
|
|
551
|
+
if (!r || r.key === n.key) {
|
|
552
|
+
j.value = null, A.value = null;
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
l("drop", {
|
|
556
|
+
event: e,
|
|
557
|
+
node: n,
|
|
558
|
+
dragNode: r,
|
|
559
|
+
dropPosition: A.value?.key === n.key ? A.value.position : "inside"
|
|
560
|
+
}), j.value = null, A.value = null;
|
|
561
|
+
}, ye = (e) => {
|
|
562
|
+
if (f.switcher) return f.switcher({
|
|
563
|
+
expanded: w.value.has(e.key),
|
|
564
|
+
node: e,
|
|
565
|
+
loading: D.value.has(e.key),
|
|
566
|
+
loadFailed: k.value.has(e.key)
|
|
567
|
+
});
|
|
568
|
+
let r = w.value.has(e.key), i = D.value.has(e.key), a = k.value.has(e.key);
|
|
569
|
+
return i ? n("span", { class: p.e("switcher-loading") }, "○") : a ? n("span", {
|
|
570
|
+
class: p.e("switcher-error"),
|
|
571
|
+
role: "button",
|
|
572
|
+
title: "Click to retry",
|
|
573
|
+
onClick: (t) => {
|
|
574
|
+
t.stopPropagation(), K(e.key);
|
|
575
|
+
}
|
|
576
|
+
}, "!") : e.isLeaf && !e.hasChildren ? n("span", { class: p.e("switcher-leaf") }) : n("span", {
|
|
577
|
+
class: [
|
|
578
|
+
p.e("switcher"),
|
|
579
|
+
r && p.em("switcher", "open"),
|
|
580
|
+
t.classNames?.switcher
|
|
581
|
+
],
|
|
582
|
+
style: t.styles?.switcher
|
|
583
|
+
}, n(d, { size: 12 }));
|
|
584
|
+
}, be = (e) => {
|
|
585
|
+
if (!t.checkable) return null;
|
|
586
|
+
let r = T.value.checked.has(e.key), i = T.value.halfChecked.has(e.key);
|
|
587
|
+
return n("span", {
|
|
588
|
+
class: [
|
|
589
|
+
p.e("checkbox"),
|
|
590
|
+
r && p.em("checkbox", "checked"),
|
|
591
|
+
i && p.em("checkbox", "indeterminate"),
|
|
592
|
+
(e.disabled || e.disableCheckbox) && p.em("checkbox", "disabled")
|
|
593
|
+
],
|
|
594
|
+
role: "checkbox",
|
|
595
|
+
"aria-checked": i ? "mixed" : r,
|
|
596
|
+
onClick: (t) => {
|
|
597
|
+
t.stopPropagation(), J(e, t);
|
|
598
|
+
}
|
|
599
|
+
}, r ? "✓" : i ? "–" : "");
|
|
600
|
+
}, xe = (e) => f.title ? f.title({
|
|
601
|
+
node: e,
|
|
602
|
+
data: e.raw,
|
|
603
|
+
expanded: w.value.has(e.key)
|
|
604
|
+
}) : le(e.title, g.value), Se = (e) => f.icon ? n("span", { class: p.e("icon") }, f.icon({
|
|
605
|
+
node: e,
|
|
606
|
+
expanded: w.value.has(e.key)
|
|
607
|
+
})) : e.raw.icon ? n("span", { class: p.e("icon") }, e.raw.icon) : null, Ce = (e) => {
|
|
608
|
+
if (!t.showLine || e.level === 0) return null;
|
|
609
|
+
let r = [];
|
|
610
|
+
for (let i = 0; i < e.level; i += 1) f.connector ? r.push(n("span", {
|
|
611
|
+
key: `guide-${i}`,
|
|
612
|
+
class: p.e("guide"),
|
|
613
|
+
style: { left: `${i * t.indentSize + t.indentSize / 2}px` }
|
|
614
|
+
}, f.connector({
|
|
615
|
+
depth: i,
|
|
616
|
+
node: e
|
|
617
|
+
}))) : r.push(n("span", {
|
|
618
|
+
key: `guide-${i}`,
|
|
619
|
+
class: p.e("guide"),
|
|
620
|
+
style: { left: `${i * t.indentSize + t.indentSize / 2}px` }
|
|
621
|
+
}));
|
|
622
|
+
return r;
|
|
623
|
+
}, we = () => {
|
|
624
|
+
Y(), X(), j.value = null, A.value = null;
|
|
625
|
+
}, Te = (e, r) => {
|
|
626
|
+
let i = {
|
|
627
|
+
paddingLeft: `${t.indentSize * e.level}px`,
|
|
628
|
+
...r
|
|
629
|
+
}, a = b.value.has(e.key), o = L.value === e.key, s = A.value?.key === e.key, c = s ? A.value.position : null, l = N.value === e.key;
|
|
630
|
+
return n("div", {
|
|
631
|
+
key: e.key,
|
|
632
|
+
class: [
|
|
633
|
+
p.e("node"),
|
|
634
|
+
a && p.em("node", "selected"),
|
|
635
|
+
o && p.em("node", "focused"),
|
|
636
|
+
e.disabled && p.em("node", "disabled"),
|
|
637
|
+
s && c === "inside" && p.em("node", "drop-inside"),
|
|
638
|
+
s && c === "before" && p.em("node", "drop-before"),
|
|
639
|
+
s && c === "after" && p.em("node", "drop-after"),
|
|
640
|
+
t.blockNode && p.em("node", "block"),
|
|
641
|
+
l && p.em("node", "hover-expand"),
|
|
642
|
+
t.classNames?.node
|
|
643
|
+
],
|
|
644
|
+
role: "treeitem",
|
|
645
|
+
tabindex: o ? 0 : -1,
|
|
646
|
+
"aria-selected": a,
|
|
647
|
+
"aria-expanded": e.hasChildren ? w.value.has(e.key) : void 0,
|
|
648
|
+
"aria-disabled": e.disabled || void 0,
|
|
649
|
+
"data-key": e.key,
|
|
650
|
+
style: [i, t.styles?.node],
|
|
651
|
+
draggable: t.draggable && !e.disabled ? !0 : void 0,
|
|
652
|
+
onDragstart: (t) => de(t, e),
|
|
653
|
+
onDragover: (t) => he(t, e),
|
|
654
|
+
onDragenter: (t) => ge(t, e),
|
|
655
|
+
onDragleave: (t) => _e(t, e),
|
|
656
|
+
onDrop: (t) => ve(t, e),
|
|
657
|
+
onDragend: we,
|
|
658
|
+
onFocus: () => {
|
|
659
|
+
L.value !== e.key && R(e.key);
|
|
660
|
+
}
|
|
661
|
+
}, [
|
|
662
|
+
...Ce(e) || [],
|
|
663
|
+
n("span", {
|
|
664
|
+
class: p.e("switcher-wrap"),
|
|
665
|
+
onClick: (n) => {
|
|
666
|
+
n.stopPropagation(), (e.hasChildren || t.loadData && !e.isLeaf) && G(e, n);
|
|
667
|
+
}
|
|
668
|
+
}, ye(e)),
|
|
669
|
+
be(e),
|
|
670
|
+
n("span", {
|
|
671
|
+
class: [p.e("content"), t.classNames?.label],
|
|
672
|
+
style: t.styles?.label,
|
|
673
|
+
onClick: (n) => {
|
|
674
|
+
q(e, n), t.expandAction === "click" && !t.disabled && !e.disabled && (e.hasChildren || t.loadData && !e.isLeaf) && G(e, n);
|
|
675
|
+
}
|
|
676
|
+
}, [Se(e), n("span", { class: p.e("title") }, xe(e))])
|
|
677
|
+
]);
|
|
678
|
+
}, Ee = (e) => {
|
|
679
|
+
let t = E.value;
|
|
680
|
+
if (t.length === 0) return;
|
|
681
|
+
let n = L.value, r = n === void 0 ? -1 : V.value.get(n) ?? -1, i = Math.max(0, Math.min(t.length - 1, r + e));
|
|
682
|
+
if (r === i && n !== void 0) return;
|
|
683
|
+
let a = t[i].key;
|
|
684
|
+
R(a);
|
|
685
|
+
}, Q = (e) => {
|
|
686
|
+
let t = E.value;
|
|
687
|
+
t.length !== 0 && R(t[e === 1 ? t.length - 1 : 0].key);
|
|
688
|
+
}, $ = (e) => {
|
|
689
|
+
if (t.disabled) return;
|
|
690
|
+
let n = E.value;
|
|
691
|
+
if (n.length === 0) return;
|
|
692
|
+
let r = L.value ?? n[0].key, i = V.value.get(r) ?? 0, a = n[i];
|
|
693
|
+
switch (e.key) {
|
|
694
|
+
case "ArrowDown":
|
|
695
|
+
e.preventDefault(), Ee(1);
|
|
696
|
+
break;
|
|
697
|
+
case "ArrowUp":
|
|
698
|
+
e.preventDefault(), Ee(-1);
|
|
699
|
+
break;
|
|
700
|
+
case "ArrowRight":
|
|
701
|
+
if (e.preventDefault(), a.hasChildren && !w.value.has(a.key)) G(a, e);
|
|
702
|
+
else if (a.hasChildren) {
|
|
703
|
+
let e = n[i + 1];
|
|
704
|
+
e && e.parentKeys.includes(a.key) && R(e.key);
|
|
705
|
+
} else t.loadData && !a.isLeaf && !O.value.has(a.key) && G(a, e);
|
|
706
|
+
break;
|
|
707
|
+
case "ArrowLeft":
|
|
708
|
+
if (e.preventDefault(), a.hasChildren && w.value.has(a.key)) G(a, e);
|
|
709
|
+
else if (a.parentKeys.length > 0) {
|
|
710
|
+
let e = a.parentKeys[a.parentKeys.length - 1];
|
|
711
|
+
R(e);
|
|
712
|
+
}
|
|
713
|
+
break;
|
|
714
|
+
case "Home":
|
|
715
|
+
e.preventDefault(), Q(-1);
|
|
716
|
+
break;
|
|
717
|
+
case "End":
|
|
718
|
+
e.preventDefault(), Q(1);
|
|
719
|
+
break;
|
|
720
|
+
case "Enter":
|
|
721
|
+
case " ": {
|
|
722
|
+
e.preventDefault();
|
|
723
|
+
let n = new MouseEvent("click");
|
|
724
|
+
t.checkable ? J(a, n) : q(a, n);
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}, De = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/(["\\])/g, "\\$1"), Oe = () => {
|
|
729
|
+
let e = L.value;
|
|
730
|
+
if (e === void 0) return;
|
|
731
|
+
let t = V.value.get(e);
|
|
732
|
+
t !== void 0 && (H.value ? U.scrollToIndex(t, B.value) : z.value && z.value.querySelector(`[data-key="${De(String(e))}"]`)?.focus({ preventScroll: !1 }));
|
|
733
|
+
};
|
|
734
|
+
return c(L, () => {
|
|
735
|
+
r(Oe);
|
|
736
|
+
}), i(() => {
|
|
737
|
+
Y(), X();
|
|
738
|
+
}), u({
|
|
739
|
+
retryLoad: K,
|
|
740
|
+
isNodeLoading: (e) => D.value.has(e),
|
|
741
|
+
hasLoadError: (e) => k.value.has(e)
|
|
742
|
+
}), () => {
|
|
743
|
+
let e = [
|
|
744
|
+
p.b(),
|
|
745
|
+
t.disabled && p.m("disabled"),
|
|
746
|
+
t.showLine && p.m("show-line"),
|
|
747
|
+
t.draggable && p.m("draggable"),
|
|
748
|
+
t.classNames?.root
|
|
749
|
+
], r = t.styles?.root;
|
|
750
|
+
if (E.value.length === 0) return n("div", {
|
|
751
|
+
ref: z,
|
|
752
|
+
class: e,
|
|
753
|
+
style: r,
|
|
754
|
+
role: "tree",
|
|
755
|
+
onKeydown: $
|
|
756
|
+
}, n("div", { class: p.e("empty") }, "No data"));
|
|
757
|
+
if (H.value) {
|
|
758
|
+
let i = U.visible.value.map(({ data: e, top: n }) => Te(e, {
|
|
759
|
+
position: "absolute",
|
|
760
|
+
top: `${n}px`,
|
|
761
|
+
left: 0,
|
|
762
|
+
right: 0,
|
|
763
|
+
height: `${t.virtualItemHeight}px`
|
|
764
|
+
}));
|
|
765
|
+
return n("div", {
|
|
766
|
+
ref: z,
|
|
767
|
+
class: e,
|
|
768
|
+
style: r,
|
|
769
|
+
role: "tree",
|
|
770
|
+
onKeydown: $
|
|
771
|
+
}, n("div", {
|
|
772
|
+
ref: B,
|
|
773
|
+
class: p.e("virtual"),
|
|
774
|
+
style: {
|
|
775
|
+
height: `${U.containerHeight.value}px`,
|
|
776
|
+
overflow: "auto",
|
|
777
|
+
position: "relative"
|
|
778
|
+
},
|
|
779
|
+
onScroll: U.onScroll
|
|
780
|
+
}, n("div", { style: {
|
|
781
|
+
height: `${U.totalHeight.value}px`,
|
|
782
|
+
position: "relative"
|
|
783
|
+
} }, i)));
|
|
784
|
+
}
|
|
785
|
+
return n("div", {
|
|
786
|
+
ref: z,
|
|
787
|
+
class: e,
|
|
788
|
+
style: r,
|
|
789
|
+
role: "tree",
|
|
790
|
+
onKeydown: $,
|
|
791
|
+
tabindex: L.value === void 0 ? 0 : -1
|
|
792
|
+
}, E.value.map((e) => Te(e)));
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region ../ccui/ui/tree/index.ts
|
|
798
|
+
S.install = function(e) {
|
|
799
|
+
e.component(S.name, S);
|
|
800
|
+
};
|
|
801
|
+
var C = {
|
|
802
|
+
title: "Tree 树",
|
|
803
|
+
category: "数据展示",
|
|
804
|
+
status: "100%",
|
|
805
|
+
install(e) {
|
|
806
|
+
e.component(S.name, S);
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
//#endregion
|
|
810
|
+
export { S as Tree, C as default };
|