@yqg/permission 1.2.1 → 1.3.0-alpha.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/README.md +50 -38
- package/dist/apply-modal-CpmDDWWV.js +12865 -0
- package/dist/category-selector-BQ0-kg3o.js +1275 -0
- package/dist/index-D_0ZQip-.js +2972 -0
- package/dist/index-wLkVeDMW.js +5040 -0
- package/dist/index.js +2 -2
- package/dist/permission-item-Df_aagL1.js +1266 -0
- package/dist/{yqg-permission-DfFns5kK.js → yqg-permission-BjVCs5lN.js} +3483 -3538
- package/dist/yqg-permission.umd.js +250 -0
- package/package.json +13 -3
- package/plugins/alioss.ts +237 -0
- package/src/App.vue +7 -8
- package/src/assets/category.png +0 -0
- package/src/axios/index.ts +6 -1
- package/src/components/apply-modal.vue +254 -157
- package/src/components/category-selector.vue +130 -0
- package/src/components/permission-item.vue +230 -0
- package/src/components/success-modal.vue +4 -4
- package/src/components/yqg-permission.vue +23 -110
- package/src/hooks/useAttributesCache.ts +21 -0
- package/src/hooks/useCategory.ts +20 -0
- package/src/hooks/useDragable.ts +9 -10
- package/src/hooks/useFormat.ts +56 -0
- package/src/hooks/useStatus.ts +82 -0
- package/src/i18n/zh-CH.ts +9 -2
- package/src/main.ts +2 -0
- package/src/typings/index.d.ts +35 -2
- package/src/utils/index.ts +9 -0
- package/src/yqg-permission/index.ts +13 -1
- package/vite.config.ts +18 -2
- package/dist/apply-modal-COwJCSGK.js +0 -8742
- package/dist/checkbox-item-DyKSHMQJ.js +0 -4991
- package/dist/index-DKDl-l25.js +0 -6164
- package/dist/index.umd.cjs +0 -259
- package/src/assets/apply.png +0 -0
- package/src/components/checkbox-item.vue +0 -201
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
import { a as ht, p as pt, d as Ve, r as fe, c as y, w as be, q as mt, s as M, E as ae, e as U, b as Ge, y as oe, $ as gt, G as yt, K as ue, L as Ze, M as Me, N as Be, R as ye, u as W, P as we, F as bt, Y as Ct, f as St, U as et, z as wt } from "./index-wLkVeDMW.js";
|
|
2
|
+
import { a as X, _ as b, W as xt, X as Vt, ae as it, aX as tt, Y as Ie, P as ve, N as It, R as ut, V as kt, aN as $e, $ as Nt, ar as Tt, as as Lt, aY as Et, c as at, b as _t, ak as je, aj as Pt, a0 as Dt, ai as At, am as We, aU as Kt, aP as xe, aQ as Ft } from "./yqg-permission-BjVCs5lN.js";
|
|
3
|
+
import { u as Ot, a as Ht, b as Rt, c as Mt, d as Bt, t as lt, B as $t, e as jt, f as Wt, g as Ut } from "./index-D_0ZQip-.js";
|
|
4
|
+
import { K as de, T as zt, c as Xt, a as Xe, u as Yt, g as qt, b as Gt, d as Qt, F as Jt, e as Zt, f as ea, r as ta, h as aa, i as la } from "./apply-modal-CpmDDWWV.js";
|
|
5
|
+
function na(e) {
|
|
6
|
+
return Array.isArray(e) ? e : e !== void 0 ? [e] : [];
|
|
7
|
+
}
|
|
8
|
+
function oa(e) {
|
|
9
|
+
const {
|
|
10
|
+
label: s,
|
|
11
|
+
value: l,
|
|
12
|
+
children: t
|
|
13
|
+
} = e || {}, a = l || "value";
|
|
14
|
+
return {
|
|
15
|
+
_title: s ? [s] : ["title", "label"],
|
|
16
|
+
value: a,
|
|
17
|
+
key: a,
|
|
18
|
+
children: t || "children"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function Ye(e) {
|
|
22
|
+
return e.disabled || e.disableCheckbox || e.checkable === !1;
|
|
23
|
+
}
|
|
24
|
+
function ra(e, s) {
|
|
25
|
+
const l = [];
|
|
26
|
+
function t(a) {
|
|
27
|
+
a.forEach((n) => {
|
|
28
|
+
l.push(n[s.value]);
|
|
29
|
+
const o = n[s.children];
|
|
30
|
+
o && t(o);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return t(e), l;
|
|
34
|
+
}
|
|
35
|
+
function nt(e) {
|
|
36
|
+
return e == null;
|
|
37
|
+
}
|
|
38
|
+
const dt = Symbol("TreeSelectContextPropsKey");
|
|
39
|
+
function sa(e) {
|
|
40
|
+
return pt(dt, e);
|
|
41
|
+
}
|
|
42
|
+
function ca() {
|
|
43
|
+
return ht(dt, {});
|
|
44
|
+
}
|
|
45
|
+
const ia = {
|
|
46
|
+
width: 0,
|
|
47
|
+
height: 0,
|
|
48
|
+
display: "flex",
|
|
49
|
+
overflow: "hidden",
|
|
50
|
+
opacity: 0,
|
|
51
|
+
border: 0,
|
|
52
|
+
padding: 0,
|
|
53
|
+
margin: 0
|
|
54
|
+
}, ua = Ve({
|
|
55
|
+
compatConfig: {
|
|
56
|
+
MODE: 3
|
|
57
|
+
},
|
|
58
|
+
name: "OptionList",
|
|
59
|
+
inheritAttrs: !1,
|
|
60
|
+
setup(e, s) {
|
|
61
|
+
let {
|
|
62
|
+
slots: l,
|
|
63
|
+
expose: t
|
|
64
|
+
} = s;
|
|
65
|
+
const a = Ot(), n = Ht(), o = ca(), r = fe(), d = Rt(() => o.treeData, [() => a.open, () => o.treeData], (v) => v[0]), c = y(() => {
|
|
66
|
+
const {
|
|
67
|
+
checkable: v,
|
|
68
|
+
halfCheckedKeys: V,
|
|
69
|
+
checkedKeys: E
|
|
70
|
+
} = n;
|
|
71
|
+
return v ? {
|
|
72
|
+
checked: E,
|
|
73
|
+
halfChecked: V
|
|
74
|
+
} : null;
|
|
75
|
+
});
|
|
76
|
+
be(() => a.open, () => {
|
|
77
|
+
mt(() => {
|
|
78
|
+
var v;
|
|
79
|
+
a.open && !a.multiple && n.checkedKeys.length && ((v = r.value) === null || v === void 0 || v.scrollTo({
|
|
80
|
+
key: n.checkedKeys[0]
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
}, {
|
|
84
|
+
immediate: !0,
|
|
85
|
+
flush: "post"
|
|
86
|
+
});
|
|
87
|
+
const i = y(() => String(a.searchValue).toLowerCase()), f = (v) => i.value ? String(v[n.treeNodeFilterProp]).toLowerCase().includes(i.value) : !1, m = M(n.treeDefaultExpandedKeys), w = M(null);
|
|
88
|
+
be(() => a.searchValue, () => {
|
|
89
|
+
a.searchValue && (w.value = ra(ae(o.treeData), ae(o.fieldNames)));
|
|
90
|
+
}, {
|
|
91
|
+
immediate: !0
|
|
92
|
+
});
|
|
93
|
+
const x = y(() => n.treeExpandedKeys ? n.treeExpandedKeys.slice() : a.searchValue ? w.value : m.value), S = (v) => {
|
|
94
|
+
var V;
|
|
95
|
+
m.value = v, w.value = v, (V = n.onTreeExpand) === null || V === void 0 || V.call(n, v);
|
|
96
|
+
}, g = (v) => {
|
|
97
|
+
v.preventDefault();
|
|
98
|
+
}, F = (v, V) => {
|
|
99
|
+
let {
|
|
100
|
+
node: E
|
|
101
|
+
} = V;
|
|
102
|
+
var D, T;
|
|
103
|
+
const {
|
|
104
|
+
checkable: z,
|
|
105
|
+
checkedKeys: Y
|
|
106
|
+
} = n;
|
|
107
|
+
z && Ye(E) || ((D = o.onSelect) === null || D === void 0 || D.call(o, E.key, {
|
|
108
|
+
selected: !Y.includes(E.key)
|
|
109
|
+
}), a.multiple || (T = a.toggleOpen) === null || T === void 0 || T.call(a, !1));
|
|
110
|
+
}, A = fe(null), K = y(() => n.keyEntities[A.value]), O = (v) => {
|
|
111
|
+
A.value = v;
|
|
112
|
+
};
|
|
113
|
+
return t({
|
|
114
|
+
scrollTo: function() {
|
|
115
|
+
for (var v, V, E = arguments.length, D = new Array(E), T = 0; T < E; T++)
|
|
116
|
+
D[T] = arguments[T];
|
|
117
|
+
return (V = (v = r.value) === null || v === void 0 ? void 0 : v.scrollTo) === null || V === void 0 ? void 0 : V.call(v, ...D);
|
|
118
|
+
},
|
|
119
|
+
onKeydown: (v) => {
|
|
120
|
+
var V;
|
|
121
|
+
const {
|
|
122
|
+
which: E
|
|
123
|
+
} = v;
|
|
124
|
+
switch (E) {
|
|
125
|
+
case de.UP:
|
|
126
|
+
case de.DOWN:
|
|
127
|
+
case de.LEFT:
|
|
128
|
+
case de.RIGHT:
|
|
129
|
+
(V = r.value) === null || V === void 0 || V.onKeydown(v);
|
|
130
|
+
break;
|
|
131
|
+
case de.ENTER: {
|
|
132
|
+
if (K.value) {
|
|
133
|
+
const {
|
|
134
|
+
selectable: D,
|
|
135
|
+
value: T
|
|
136
|
+
} = K.value.node || {};
|
|
137
|
+
D !== !1 && F(null, {
|
|
138
|
+
node: {
|
|
139
|
+
key: A.value
|
|
140
|
+
},
|
|
141
|
+
selected: !n.checkedKeys.includes(T)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case de.ESC:
|
|
147
|
+
a.toggleOpen(!1);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
onKeyup: () => {
|
|
151
|
+
}
|
|
152
|
+
}), () => {
|
|
153
|
+
var v;
|
|
154
|
+
const {
|
|
155
|
+
prefixCls: V,
|
|
156
|
+
multiple: E,
|
|
157
|
+
searchValue: D,
|
|
158
|
+
open: T,
|
|
159
|
+
notFoundContent: z = (v = l.notFoundContent) === null || v === void 0 ? void 0 : v.call(l)
|
|
160
|
+
} = a, {
|
|
161
|
+
listHeight: Y,
|
|
162
|
+
listItemHeight: B,
|
|
163
|
+
virtual: le,
|
|
164
|
+
dropdownMatchSelectWidth: q,
|
|
165
|
+
treeExpandAction: re
|
|
166
|
+
} = o, {
|
|
167
|
+
checkable: se,
|
|
168
|
+
treeDefaultExpandAll: ce,
|
|
169
|
+
treeIcon: ne,
|
|
170
|
+
showTreeIcon: G,
|
|
171
|
+
switcherIcon: pe,
|
|
172
|
+
treeLine: me,
|
|
173
|
+
loadData: ge,
|
|
174
|
+
treeLoadedKeys: ie,
|
|
175
|
+
treeMotion: C,
|
|
176
|
+
onTreeLoad: _,
|
|
177
|
+
checkedKeys: H
|
|
178
|
+
} = n;
|
|
179
|
+
if (d.value.length === 0)
|
|
180
|
+
return U("div", {
|
|
181
|
+
role: "listbox",
|
|
182
|
+
class: `${V}-empty`,
|
|
183
|
+
onMousedown: g
|
|
184
|
+
}, [z]);
|
|
185
|
+
const Q = {
|
|
186
|
+
fieldNames: o.fieldNames
|
|
187
|
+
};
|
|
188
|
+
return ie && (Q.loadedKeys = ie), x.value && (Q.expandedKeys = x.value), U("div", {
|
|
189
|
+
onMousedown: g
|
|
190
|
+
}, [K.value && T && U("span", {
|
|
191
|
+
style: ia,
|
|
192
|
+
"aria-live": "assertive"
|
|
193
|
+
}, [K.value.node.value]), U(zt, X(X({
|
|
194
|
+
ref: r,
|
|
195
|
+
focusable: !1,
|
|
196
|
+
prefixCls: `${V}-tree`,
|
|
197
|
+
treeData: d.value,
|
|
198
|
+
height: Y,
|
|
199
|
+
itemHeight: B,
|
|
200
|
+
virtual: le !== !1 && q !== !1,
|
|
201
|
+
multiple: E,
|
|
202
|
+
icon: ne,
|
|
203
|
+
showIcon: G,
|
|
204
|
+
switcherIcon: pe,
|
|
205
|
+
showLine: me,
|
|
206
|
+
loadData: D ? null : ge,
|
|
207
|
+
motion: C,
|
|
208
|
+
activeKey: A.value,
|
|
209
|
+
checkable: se,
|
|
210
|
+
checkStrictly: !0,
|
|
211
|
+
checkedKeys: c.value,
|
|
212
|
+
selectedKeys: se ? [] : H,
|
|
213
|
+
defaultExpandAll: ce
|
|
214
|
+
}, Q), {}, {
|
|
215
|
+
onActiveChange: O,
|
|
216
|
+
onSelect: F,
|
|
217
|
+
onCheck: F,
|
|
218
|
+
onExpand: S,
|
|
219
|
+
onLoad: _,
|
|
220
|
+
filterTreeNode: f,
|
|
221
|
+
expandAction: re
|
|
222
|
+
}), b(b({}, l), {
|
|
223
|
+
checkable: n.customSlots.treeCheckable
|
|
224
|
+
}))]);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}), da = "SHOW_ALL", vt = "SHOW_PARENT", Qe = "SHOW_CHILD";
|
|
228
|
+
function ot(e, s, l, t) {
|
|
229
|
+
const a = new Set(e);
|
|
230
|
+
return s === Qe ? e.filter((n) => {
|
|
231
|
+
const o = l[n];
|
|
232
|
+
return !(o && o.children && o.children.some((r) => {
|
|
233
|
+
let {
|
|
234
|
+
node: d
|
|
235
|
+
} = r;
|
|
236
|
+
return a.has(d[t.value]);
|
|
237
|
+
}) && o.children.every((r) => {
|
|
238
|
+
let {
|
|
239
|
+
node: d
|
|
240
|
+
} = r;
|
|
241
|
+
return Ye(d) || a.has(d[t.value]);
|
|
242
|
+
}));
|
|
243
|
+
}) : s === vt ? e.filter((n) => {
|
|
244
|
+
const o = l[n], r = o ? o.parent : null;
|
|
245
|
+
return !(r && !Ye(r.node) && a.has(r.key));
|
|
246
|
+
}) : e;
|
|
247
|
+
}
|
|
248
|
+
const he = () => null;
|
|
249
|
+
he.inheritAttrs = !1;
|
|
250
|
+
he.displayName = "ATreeSelectNode";
|
|
251
|
+
he.isTreeSelectNode = !0;
|
|
252
|
+
var va = function(e, s) {
|
|
253
|
+
var l = {};
|
|
254
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && s.indexOf(t) < 0 && (l[t] = e[t]);
|
|
255
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, t = Object.getOwnPropertySymbols(e); a < t.length; a++)
|
|
256
|
+
s.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[a]) && (l[t[a]] = e[t[a]]);
|
|
257
|
+
return l;
|
|
258
|
+
};
|
|
259
|
+
function fa(e) {
|
|
260
|
+
return e && e.type && e.type.isTreeSelectNode;
|
|
261
|
+
}
|
|
262
|
+
function ha(e) {
|
|
263
|
+
function s() {
|
|
264
|
+
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
265
|
+
return xt(l).map((t) => {
|
|
266
|
+
var a, n, o;
|
|
267
|
+
if (!fa(t))
|
|
268
|
+
return null;
|
|
269
|
+
const r = t.children || {}, d = t.key, c = {};
|
|
270
|
+
for (const [E, D] of Object.entries(t.props))
|
|
271
|
+
c[Vt(E)] = D;
|
|
272
|
+
const {
|
|
273
|
+
isLeaf: i,
|
|
274
|
+
checkable: f,
|
|
275
|
+
selectable: m,
|
|
276
|
+
disabled: w,
|
|
277
|
+
disableCheckbox: x
|
|
278
|
+
} = c, S = {
|
|
279
|
+
isLeaf: i || i === "" || void 0,
|
|
280
|
+
checkable: f || f === "" || void 0,
|
|
281
|
+
selectable: m || m === "" || void 0,
|
|
282
|
+
disabled: w || w === "" || void 0,
|
|
283
|
+
disableCheckbox: x || x === "" || void 0
|
|
284
|
+
}, g = b(b({}, c), S), {
|
|
285
|
+
title: F = (a = r.title) === null || a === void 0 ? void 0 : a.call(r, g),
|
|
286
|
+
switcherIcon: A = (n = r.switcherIcon) === null || n === void 0 ? void 0 : n.call(r, g)
|
|
287
|
+
} = c, K = va(c, ["title", "switcherIcon"]), O = (o = r.default) === null || o === void 0 ? void 0 : o.call(r), v = b(b(b({}, K), {
|
|
288
|
+
title: F,
|
|
289
|
+
switcherIcon: A,
|
|
290
|
+
key: d,
|
|
291
|
+
isLeaf: i
|
|
292
|
+
}), S), V = s(O);
|
|
293
|
+
return V.length && (v.children = V), v;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return s(e);
|
|
297
|
+
}
|
|
298
|
+
function qe(e) {
|
|
299
|
+
if (!e)
|
|
300
|
+
return e;
|
|
301
|
+
const s = b({}, e);
|
|
302
|
+
return "props" in s || Object.defineProperty(s, "props", {
|
|
303
|
+
get() {
|
|
304
|
+
return s;
|
|
305
|
+
}
|
|
306
|
+
}), s;
|
|
307
|
+
}
|
|
308
|
+
function pa(e, s, l, t, a, n) {
|
|
309
|
+
let o = null, r = null;
|
|
310
|
+
function d() {
|
|
311
|
+
function c(i) {
|
|
312
|
+
let f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "0", m = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
313
|
+
return i.map((w, x) => {
|
|
314
|
+
const S = `${f}-${x}`, g = w[n.value], F = l.includes(g), A = c(w[n.children] || [], S, F), K = U(he, w, {
|
|
315
|
+
default: () => [A.map((O) => O.node)]
|
|
316
|
+
});
|
|
317
|
+
if (s === g && (o = K), F) {
|
|
318
|
+
const O = {
|
|
319
|
+
pos: S,
|
|
320
|
+
node: K,
|
|
321
|
+
children: A
|
|
322
|
+
};
|
|
323
|
+
return m || r.push(O), O;
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}).filter((w) => w);
|
|
327
|
+
}
|
|
328
|
+
r || (r = [], c(t), r.sort((i, f) => {
|
|
329
|
+
let {
|
|
330
|
+
node: {
|
|
331
|
+
props: {
|
|
332
|
+
value: m
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
} = i, {
|
|
336
|
+
node: {
|
|
337
|
+
props: {
|
|
338
|
+
value: w
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
} = f;
|
|
342
|
+
const x = l.indexOf(m), S = l.indexOf(w);
|
|
343
|
+
return x - S;
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
Object.defineProperty(e, "triggerNode", {
|
|
347
|
+
get() {
|
|
348
|
+
return d(), o;
|
|
349
|
+
}
|
|
350
|
+
}), Object.defineProperty(e, "allCheckedNodes", {
|
|
351
|
+
get() {
|
|
352
|
+
return d(), a ? r : r.map((c) => {
|
|
353
|
+
let {
|
|
354
|
+
node: i
|
|
355
|
+
} = c;
|
|
356
|
+
return i;
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function ma(e, s) {
|
|
362
|
+
let {
|
|
363
|
+
id: l,
|
|
364
|
+
pId: t,
|
|
365
|
+
rootPId: a
|
|
366
|
+
} = s;
|
|
367
|
+
const n = {}, o = [];
|
|
368
|
+
return e.map((d) => {
|
|
369
|
+
const c = b({}, d), i = c[l];
|
|
370
|
+
return n[i] = c, c.key = c.key || i, c;
|
|
371
|
+
}).forEach((d) => {
|
|
372
|
+
const c = d[t], i = n[c];
|
|
373
|
+
i && (i.children = i.children || [], i.children.push(d)), (c === a || !i && a === null) && o.push(d);
|
|
374
|
+
}), o;
|
|
375
|
+
}
|
|
376
|
+
function ga(e, s, l) {
|
|
377
|
+
const t = M();
|
|
378
|
+
return be([l, e, s], () => {
|
|
379
|
+
const a = l.value;
|
|
380
|
+
e.value ? t.value = l.value ? ma(ae(e.value), b({
|
|
381
|
+
id: "id",
|
|
382
|
+
pId: "pId",
|
|
383
|
+
rootPId: null
|
|
384
|
+
}, a !== !0 ? a : {})) : ae(e.value).slice() : t.value = ha(ae(s.value));
|
|
385
|
+
}, {
|
|
386
|
+
immediate: !0,
|
|
387
|
+
deep: !0
|
|
388
|
+
}), t;
|
|
389
|
+
}
|
|
390
|
+
const ya = (e) => {
|
|
391
|
+
const s = M({
|
|
392
|
+
valueLabels: /* @__PURE__ */ new Map()
|
|
393
|
+
}), l = M();
|
|
394
|
+
return be(e, () => {
|
|
395
|
+
l.value = ae(e.value);
|
|
396
|
+
}, {
|
|
397
|
+
immediate: !0
|
|
398
|
+
}), [y(() => {
|
|
399
|
+
const {
|
|
400
|
+
valueLabels: a
|
|
401
|
+
} = s.value, n = /* @__PURE__ */ new Map(), o = l.value.map((r) => {
|
|
402
|
+
var d;
|
|
403
|
+
const {
|
|
404
|
+
value: c
|
|
405
|
+
} = r, i = (d = r.label) !== null && d !== void 0 ? d : a.get(c);
|
|
406
|
+
return n.set(c, i), b(b({}, r), {
|
|
407
|
+
label: i
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
return s.value.valueLabels = n, o;
|
|
411
|
+
})];
|
|
412
|
+
}, ba = (e, s) => {
|
|
413
|
+
const l = M(/* @__PURE__ */ new Map()), t = M({});
|
|
414
|
+
return Ge(() => {
|
|
415
|
+
const a = s.value, n = Xt(e.value, {
|
|
416
|
+
fieldNames: a,
|
|
417
|
+
initWrapper: (o) => b(b({}, o), {
|
|
418
|
+
valueEntities: /* @__PURE__ */ new Map()
|
|
419
|
+
}),
|
|
420
|
+
processEntity: (o, r) => {
|
|
421
|
+
const d = o.node[a.value];
|
|
422
|
+
r.valueEntities.set(d, o);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
l.value = n.valueEntities, t.value = n.keyEntities;
|
|
426
|
+
}), {
|
|
427
|
+
valueEntities: l,
|
|
428
|
+
keyEntities: t
|
|
429
|
+
};
|
|
430
|
+
}, Ca = (e, s, l, t, a, n) => {
|
|
431
|
+
const o = M([]), r = M([]);
|
|
432
|
+
return Ge(() => {
|
|
433
|
+
let d = e.value.map((f) => {
|
|
434
|
+
let {
|
|
435
|
+
value: m
|
|
436
|
+
} = f;
|
|
437
|
+
return m;
|
|
438
|
+
}), c = s.value.map((f) => {
|
|
439
|
+
let {
|
|
440
|
+
value: m
|
|
441
|
+
} = f;
|
|
442
|
+
return m;
|
|
443
|
+
});
|
|
444
|
+
const i = d.filter((f) => !t.value[f]);
|
|
445
|
+
l.value && ({
|
|
446
|
+
checkedKeys: d,
|
|
447
|
+
halfCheckedKeys: c
|
|
448
|
+
} = Xe(d, !0, t.value, a.value, n.value)), o.value = Array.from(/* @__PURE__ */ new Set([...i, ...d])), r.value = c;
|
|
449
|
+
}), [o, r];
|
|
450
|
+
}, Sa = (e, s, l) => {
|
|
451
|
+
let {
|
|
452
|
+
treeNodeFilterProp: t,
|
|
453
|
+
filterTreeNode: a,
|
|
454
|
+
fieldNames: n
|
|
455
|
+
} = l;
|
|
456
|
+
return y(() => {
|
|
457
|
+
const {
|
|
458
|
+
children: o
|
|
459
|
+
} = n.value, r = s.value, d = t == null ? void 0 : t.value;
|
|
460
|
+
if (!r || a.value === !1)
|
|
461
|
+
return e.value;
|
|
462
|
+
let c;
|
|
463
|
+
if (typeof a.value == "function")
|
|
464
|
+
c = a.value;
|
|
465
|
+
else {
|
|
466
|
+
const f = r.toUpperCase();
|
|
467
|
+
c = (m, w) => {
|
|
468
|
+
const x = w[d];
|
|
469
|
+
return String(x).toUpperCase().includes(f);
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function i(f) {
|
|
473
|
+
let m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
474
|
+
const w = [];
|
|
475
|
+
for (let x = 0, S = f.length; x < S; x++) {
|
|
476
|
+
const g = f[x], F = g[o], A = m || c(r, qe(g)), K = i(F || [], A);
|
|
477
|
+
(A || K.length) && w.push(b(b({}, g), {
|
|
478
|
+
[o]: K
|
|
479
|
+
}));
|
|
480
|
+
}
|
|
481
|
+
return w;
|
|
482
|
+
}
|
|
483
|
+
return i(e.value);
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
function ft() {
|
|
487
|
+
return b(b({}, Ie(jt(), ["mode"])), {
|
|
488
|
+
prefixCls: String,
|
|
489
|
+
id: String,
|
|
490
|
+
value: {
|
|
491
|
+
type: [String, Number, Object, Array]
|
|
492
|
+
},
|
|
493
|
+
defaultValue: {
|
|
494
|
+
type: [String, Number, Object, Array]
|
|
495
|
+
},
|
|
496
|
+
onChange: {
|
|
497
|
+
type: Function
|
|
498
|
+
},
|
|
499
|
+
searchValue: String,
|
|
500
|
+
/** @deprecated Use `searchValue` instead */
|
|
501
|
+
inputValue: String,
|
|
502
|
+
onSearch: {
|
|
503
|
+
type: Function
|
|
504
|
+
},
|
|
505
|
+
autoClearSearchValue: {
|
|
506
|
+
type: Boolean,
|
|
507
|
+
default: void 0
|
|
508
|
+
},
|
|
509
|
+
filterTreeNode: {
|
|
510
|
+
type: [Boolean, Function],
|
|
511
|
+
default: void 0
|
|
512
|
+
},
|
|
513
|
+
treeNodeFilterProp: String,
|
|
514
|
+
// >>> Select
|
|
515
|
+
onSelect: Function,
|
|
516
|
+
onDeselect: Function,
|
|
517
|
+
showCheckedStrategy: {
|
|
518
|
+
type: String
|
|
519
|
+
},
|
|
520
|
+
treeNodeLabelProp: String,
|
|
521
|
+
fieldNames: {
|
|
522
|
+
type: Object
|
|
523
|
+
},
|
|
524
|
+
// >>> Mode
|
|
525
|
+
multiple: {
|
|
526
|
+
type: Boolean,
|
|
527
|
+
default: void 0
|
|
528
|
+
},
|
|
529
|
+
treeCheckable: {
|
|
530
|
+
type: Boolean,
|
|
531
|
+
default: void 0
|
|
532
|
+
},
|
|
533
|
+
treeCheckStrictly: {
|
|
534
|
+
type: Boolean,
|
|
535
|
+
default: void 0
|
|
536
|
+
},
|
|
537
|
+
labelInValue: {
|
|
538
|
+
type: Boolean,
|
|
539
|
+
default: void 0
|
|
540
|
+
},
|
|
541
|
+
// >>> Data
|
|
542
|
+
treeData: {
|
|
543
|
+
type: Array
|
|
544
|
+
},
|
|
545
|
+
treeDataSimpleMode: {
|
|
546
|
+
type: [Boolean, Object],
|
|
547
|
+
default: void 0
|
|
548
|
+
},
|
|
549
|
+
loadData: {
|
|
550
|
+
type: Function
|
|
551
|
+
},
|
|
552
|
+
treeLoadedKeys: {
|
|
553
|
+
type: Array
|
|
554
|
+
},
|
|
555
|
+
onTreeLoad: {
|
|
556
|
+
type: Function
|
|
557
|
+
},
|
|
558
|
+
// >>> Expanded
|
|
559
|
+
treeDefaultExpandAll: {
|
|
560
|
+
type: Boolean,
|
|
561
|
+
default: void 0
|
|
562
|
+
},
|
|
563
|
+
treeExpandedKeys: {
|
|
564
|
+
type: Array
|
|
565
|
+
},
|
|
566
|
+
treeDefaultExpandedKeys: {
|
|
567
|
+
type: Array
|
|
568
|
+
},
|
|
569
|
+
onTreeExpand: {
|
|
570
|
+
type: Function
|
|
571
|
+
},
|
|
572
|
+
// >>> Options
|
|
573
|
+
virtual: {
|
|
574
|
+
type: Boolean,
|
|
575
|
+
default: void 0
|
|
576
|
+
},
|
|
577
|
+
listHeight: Number,
|
|
578
|
+
listItemHeight: Number,
|
|
579
|
+
onDropdownVisibleChange: {
|
|
580
|
+
type: Function
|
|
581
|
+
},
|
|
582
|
+
// >>> Tree
|
|
583
|
+
treeLine: {
|
|
584
|
+
type: [Boolean, Object],
|
|
585
|
+
default: void 0
|
|
586
|
+
},
|
|
587
|
+
treeIcon: ve.any,
|
|
588
|
+
showTreeIcon: {
|
|
589
|
+
type: Boolean,
|
|
590
|
+
default: void 0
|
|
591
|
+
},
|
|
592
|
+
switcherIcon: ve.any,
|
|
593
|
+
treeMotion: ve.any,
|
|
594
|
+
children: Array,
|
|
595
|
+
treeExpandAction: String,
|
|
596
|
+
showArrow: {
|
|
597
|
+
type: Boolean,
|
|
598
|
+
default: void 0
|
|
599
|
+
},
|
|
600
|
+
showSearch: {
|
|
601
|
+
type: Boolean,
|
|
602
|
+
default: void 0
|
|
603
|
+
},
|
|
604
|
+
open: {
|
|
605
|
+
type: Boolean,
|
|
606
|
+
default: void 0
|
|
607
|
+
},
|
|
608
|
+
defaultOpen: {
|
|
609
|
+
type: Boolean,
|
|
610
|
+
default: void 0
|
|
611
|
+
},
|
|
612
|
+
disabled: {
|
|
613
|
+
type: Boolean,
|
|
614
|
+
default: void 0
|
|
615
|
+
},
|
|
616
|
+
placeholder: ve.any,
|
|
617
|
+
maxTagPlaceholder: {
|
|
618
|
+
type: Function
|
|
619
|
+
},
|
|
620
|
+
dropdownPopupAlign: ve.any,
|
|
621
|
+
customSlots: Object
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
function wa(e) {
|
|
625
|
+
return !e || typeof e != "object";
|
|
626
|
+
}
|
|
627
|
+
const xa = Ve({
|
|
628
|
+
compatConfig: {
|
|
629
|
+
MODE: 3
|
|
630
|
+
},
|
|
631
|
+
name: "TreeSelect",
|
|
632
|
+
inheritAttrs: !1,
|
|
633
|
+
props: it(ft(), {
|
|
634
|
+
treeNodeFilterProp: "value",
|
|
635
|
+
autoClearSearchValue: !0,
|
|
636
|
+
showCheckedStrategy: Qe,
|
|
637
|
+
listHeight: 200,
|
|
638
|
+
listItemHeight: 20,
|
|
639
|
+
prefixCls: "vc-tree-select"
|
|
640
|
+
}),
|
|
641
|
+
setup(e, s) {
|
|
642
|
+
let {
|
|
643
|
+
attrs: l,
|
|
644
|
+
expose: t,
|
|
645
|
+
slots: a
|
|
646
|
+
} = s;
|
|
647
|
+
const n = Mt(oe(e, "id")), o = y(() => e.treeCheckable && !e.treeCheckStrictly), r = y(() => e.treeCheckable || e.treeCheckStrictly), d = y(() => e.treeCheckStrictly || e.labelInValue), c = y(() => r.value || e.multiple), i = y(() => oa(e.fieldNames)), [f, m] = tt("", {
|
|
648
|
+
value: y(() => e.searchValue !== void 0 ? e.searchValue : e.inputValue),
|
|
649
|
+
postState: (u) => u || ""
|
|
650
|
+
}), w = (u) => {
|
|
651
|
+
var h;
|
|
652
|
+
m(u), (h = e.onSearch) === null || h === void 0 || h.call(e, u);
|
|
653
|
+
}, x = ga(oe(e, "treeData"), oe(e, "children"), oe(e, "treeDataSimpleMode")), {
|
|
654
|
+
keyEntities: S,
|
|
655
|
+
valueEntities: g
|
|
656
|
+
} = ba(x, i), F = (u) => {
|
|
657
|
+
const h = [], p = [];
|
|
658
|
+
return u.forEach((k) => {
|
|
659
|
+
g.value.has(k) ? p.push(k) : h.push(k);
|
|
660
|
+
}), {
|
|
661
|
+
missingRawValues: h,
|
|
662
|
+
existRawValues: p
|
|
663
|
+
};
|
|
664
|
+
}, A = Sa(x, f, {
|
|
665
|
+
fieldNames: i,
|
|
666
|
+
treeNodeFilterProp: oe(e, "treeNodeFilterProp"),
|
|
667
|
+
filterTreeNode: oe(e, "filterTreeNode")
|
|
668
|
+
}), K = (u) => {
|
|
669
|
+
if (u) {
|
|
670
|
+
if (e.treeNodeLabelProp)
|
|
671
|
+
return u[e.treeNodeLabelProp];
|
|
672
|
+
const {
|
|
673
|
+
_title: h
|
|
674
|
+
} = i.value;
|
|
675
|
+
for (let p = 0; p < h.length; p += 1) {
|
|
676
|
+
const k = u[h[p]];
|
|
677
|
+
if (k !== void 0)
|
|
678
|
+
return k;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}, O = (u) => na(u).map((p) => wa(p) ? {
|
|
682
|
+
value: p
|
|
683
|
+
} : p), v = (u) => O(u).map((p) => {
|
|
684
|
+
let {
|
|
685
|
+
label: k
|
|
686
|
+
} = p;
|
|
687
|
+
const {
|
|
688
|
+
value: P,
|
|
689
|
+
halfChecked: L
|
|
690
|
+
} = p;
|
|
691
|
+
let I;
|
|
692
|
+
const N = g.value.get(P);
|
|
693
|
+
return N && (k = k ?? K(N.node), I = N.node.disabled), {
|
|
694
|
+
label: k,
|
|
695
|
+
value: P,
|
|
696
|
+
halfChecked: L,
|
|
697
|
+
disabled: I
|
|
698
|
+
};
|
|
699
|
+
}), [V, E] = tt(e.defaultValue, {
|
|
700
|
+
value: oe(e, "value")
|
|
701
|
+
}), D = y(() => O(V.value)), T = M([]), z = M([]);
|
|
702
|
+
Ge(() => {
|
|
703
|
+
const u = [], h = [];
|
|
704
|
+
D.value.forEach((p) => {
|
|
705
|
+
p.halfChecked ? h.push(p) : u.push(p);
|
|
706
|
+
}), T.value = u, z.value = h;
|
|
707
|
+
});
|
|
708
|
+
const Y = y(() => T.value.map((u) => u.value)), {
|
|
709
|
+
maxLevel: B,
|
|
710
|
+
levelEntities: le
|
|
711
|
+
} = Yt(S), [q, re] = Ca(T, z, o, S, B, le), se = y(() => {
|
|
712
|
+
const p = ot(q.value, e.showCheckedStrategy, S.value, i.value).map((L) => {
|
|
713
|
+
var I, N, R;
|
|
714
|
+
return (R = (N = (I = S.value[L]) === null || I === void 0 ? void 0 : I.node) === null || N === void 0 ? void 0 : N[i.value.value]) !== null && R !== void 0 ? R : L;
|
|
715
|
+
}).map((L) => {
|
|
716
|
+
const I = T.value.find((N) => N.value === L);
|
|
717
|
+
return {
|
|
718
|
+
value: L,
|
|
719
|
+
label: I == null ? void 0 : I.label
|
|
720
|
+
};
|
|
721
|
+
}), k = v(p), P = k[0];
|
|
722
|
+
return !c.value && P && nt(P.value) && nt(P.label) ? [] : k.map((L) => {
|
|
723
|
+
var I;
|
|
724
|
+
return b(b({}, L), {
|
|
725
|
+
label: (I = L.label) !== null && I !== void 0 ? I : L.value
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
}), [ce] = ya(se), ne = (u, h, p) => {
|
|
729
|
+
const k = v(u);
|
|
730
|
+
if (E(k), e.autoClearSearchValue && m(""), e.onChange) {
|
|
731
|
+
let P = u;
|
|
732
|
+
o.value && (P = ot(u, e.showCheckedStrategy, S.value, i.value).map((te) => {
|
|
733
|
+
const Se = g.value.get(te);
|
|
734
|
+
return Se ? Se.node[i.value.value] : te;
|
|
735
|
+
}));
|
|
736
|
+
const {
|
|
737
|
+
triggerValue: L,
|
|
738
|
+
selected: I
|
|
739
|
+
} = h || {
|
|
740
|
+
triggerValue: void 0,
|
|
741
|
+
selected: void 0
|
|
742
|
+
};
|
|
743
|
+
let N = P;
|
|
744
|
+
if (e.treeCheckStrictly) {
|
|
745
|
+
const j = z.value.filter((te) => !P.includes(te.value));
|
|
746
|
+
N = [...N, ...j];
|
|
747
|
+
}
|
|
748
|
+
const R = v(N), Z = {
|
|
749
|
+
// [Legacy] Always return as array contains label & value
|
|
750
|
+
preValue: T.value,
|
|
751
|
+
triggerValue: L
|
|
752
|
+
};
|
|
753
|
+
let ee = !0;
|
|
754
|
+
(e.treeCheckStrictly || p === "selection" && !I) && (ee = !1), pa(Z, L, u, x.value, ee, i.value), r.value ? Z.checked = I : Z.selected = I;
|
|
755
|
+
const $ = d.value ? R : R.map((j) => j.value);
|
|
756
|
+
e.onChange(c.value ? $ : $[0], d.value ? null : R.map((j) => j.label), Z);
|
|
757
|
+
}
|
|
758
|
+
}, G = (u, h) => {
|
|
759
|
+
let {
|
|
760
|
+
selected: p,
|
|
761
|
+
source: k
|
|
762
|
+
} = h;
|
|
763
|
+
var P, L, I;
|
|
764
|
+
const N = ae(S.value), R = ae(g.value), Z = N[u], ee = Z == null ? void 0 : Z.node, $ = (P = ee == null ? void 0 : ee[i.value.value]) !== null && P !== void 0 ? P : u;
|
|
765
|
+
if (!c.value)
|
|
766
|
+
ne([$], {
|
|
767
|
+
selected: !0,
|
|
768
|
+
triggerValue: $
|
|
769
|
+
}, "option");
|
|
770
|
+
else {
|
|
771
|
+
let j = p ? [...Y.value, $] : q.value.filter((te) => te !== $);
|
|
772
|
+
if (o.value) {
|
|
773
|
+
const {
|
|
774
|
+
missingRawValues: te,
|
|
775
|
+
existRawValues: Se
|
|
776
|
+
} = F(j), Je = Se.map((Re) => R.get(Re).key);
|
|
777
|
+
let He;
|
|
778
|
+
p ? {
|
|
779
|
+
checkedKeys: He
|
|
780
|
+
} = Xe(Je, !0, N, B.value, le.value) : {
|
|
781
|
+
checkedKeys: He
|
|
782
|
+
} = Xe(Je, {
|
|
783
|
+
checked: !1,
|
|
784
|
+
halfCheckedKeys: re.value
|
|
785
|
+
}, N, B.value, le.value), j = [...te, ...He.map((Re) => N[Re].node[i.value.value])];
|
|
786
|
+
}
|
|
787
|
+
ne(j, {
|
|
788
|
+
selected: p,
|
|
789
|
+
triggerValue: $
|
|
790
|
+
}, k || "option");
|
|
791
|
+
}
|
|
792
|
+
p || !c.value ? (L = e.onSelect) === null || L === void 0 || L.call(e, $, qe(ee)) : (I = e.onDeselect) === null || I === void 0 || I.call(e, $, qe(ee));
|
|
793
|
+
}, pe = (u) => {
|
|
794
|
+
if (e.onDropdownVisibleChange) {
|
|
795
|
+
const h = {};
|
|
796
|
+
Object.defineProperty(h, "documentClickClose", {
|
|
797
|
+
get() {
|
|
798
|
+
return !1;
|
|
799
|
+
}
|
|
800
|
+
}), e.onDropdownVisibleChange(u, h);
|
|
801
|
+
}
|
|
802
|
+
}, me = (u, h) => {
|
|
803
|
+
const p = u.map((k) => k.value);
|
|
804
|
+
if (h.type === "clear") {
|
|
805
|
+
ne(p, {}, "selection");
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
h.values.length && G(h.values[0].value, {
|
|
809
|
+
selected: !1,
|
|
810
|
+
source: "selection"
|
|
811
|
+
});
|
|
812
|
+
}, {
|
|
813
|
+
treeNodeFilterProp: ge,
|
|
814
|
+
// Data
|
|
815
|
+
loadData: ie,
|
|
816
|
+
treeLoadedKeys: C,
|
|
817
|
+
onTreeLoad: _,
|
|
818
|
+
// Expanded
|
|
819
|
+
treeDefaultExpandAll: H,
|
|
820
|
+
treeExpandedKeys: Q,
|
|
821
|
+
treeDefaultExpandedKeys: ke,
|
|
822
|
+
onTreeExpand: Ne,
|
|
823
|
+
// Options
|
|
824
|
+
virtual: Te,
|
|
825
|
+
listHeight: Le,
|
|
826
|
+
listItemHeight: Ee,
|
|
827
|
+
// Tree
|
|
828
|
+
treeLine: _e,
|
|
829
|
+
treeIcon: Ce,
|
|
830
|
+
showTreeIcon: Pe,
|
|
831
|
+
switcherIcon: De,
|
|
832
|
+
treeMotion: Ae,
|
|
833
|
+
customSlots: Ke,
|
|
834
|
+
dropdownMatchSelectWidth: Fe,
|
|
835
|
+
treeExpandAction: Oe
|
|
836
|
+
} = gt(e);
|
|
837
|
+
Bt(lt({
|
|
838
|
+
checkable: r,
|
|
839
|
+
loadData: ie,
|
|
840
|
+
treeLoadedKeys: C,
|
|
841
|
+
onTreeLoad: _,
|
|
842
|
+
checkedKeys: q,
|
|
843
|
+
halfCheckedKeys: re,
|
|
844
|
+
treeDefaultExpandAll: H,
|
|
845
|
+
treeExpandedKeys: Q,
|
|
846
|
+
treeDefaultExpandedKeys: ke,
|
|
847
|
+
onTreeExpand: Ne,
|
|
848
|
+
treeIcon: Ce,
|
|
849
|
+
treeMotion: Ae,
|
|
850
|
+
showTreeIcon: Pe,
|
|
851
|
+
switcherIcon: De,
|
|
852
|
+
treeLine: _e,
|
|
853
|
+
treeNodeFilterProp: ge,
|
|
854
|
+
keyEntities: S,
|
|
855
|
+
customSlots: Ke
|
|
856
|
+
})), sa(lt({
|
|
857
|
+
virtual: Te,
|
|
858
|
+
listHeight: Le,
|
|
859
|
+
listItemHeight: Ee,
|
|
860
|
+
treeData: A,
|
|
861
|
+
fieldNames: i,
|
|
862
|
+
onSelect: G,
|
|
863
|
+
dropdownMatchSelectWidth: Fe,
|
|
864
|
+
treeExpandAction: Oe
|
|
865
|
+
}));
|
|
866
|
+
const J = fe();
|
|
867
|
+
return t({
|
|
868
|
+
focus() {
|
|
869
|
+
var u;
|
|
870
|
+
(u = J.value) === null || u === void 0 || u.focus();
|
|
871
|
+
},
|
|
872
|
+
blur() {
|
|
873
|
+
var u;
|
|
874
|
+
(u = J.value) === null || u === void 0 || u.blur();
|
|
875
|
+
},
|
|
876
|
+
scrollTo(u) {
|
|
877
|
+
var h;
|
|
878
|
+
(h = J.value) === null || h === void 0 || h.scrollTo(u);
|
|
879
|
+
}
|
|
880
|
+
}), () => {
|
|
881
|
+
var u;
|
|
882
|
+
const h = Ie(e, [
|
|
883
|
+
"id",
|
|
884
|
+
"prefixCls",
|
|
885
|
+
"customSlots",
|
|
886
|
+
// Value
|
|
887
|
+
"value",
|
|
888
|
+
"defaultValue",
|
|
889
|
+
"onChange",
|
|
890
|
+
"onSelect",
|
|
891
|
+
"onDeselect",
|
|
892
|
+
// Search
|
|
893
|
+
"searchValue",
|
|
894
|
+
"inputValue",
|
|
895
|
+
"onSearch",
|
|
896
|
+
"autoClearSearchValue",
|
|
897
|
+
"filterTreeNode",
|
|
898
|
+
"treeNodeFilterProp",
|
|
899
|
+
// Selector
|
|
900
|
+
"showCheckedStrategy",
|
|
901
|
+
"treeNodeLabelProp",
|
|
902
|
+
// Mode
|
|
903
|
+
"multiple",
|
|
904
|
+
"treeCheckable",
|
|
905
|
+
"treeCheckStrictly",
|
|
906
|
+
"labelInValue",
|
|
907
|
+
// FieldNames
|
|
908
|
+
"fieldNames",
|
|
909
|
+
// Data
|
|
910
|
+
"treeDataSimpleMode",
|
|
911
|
+
"treeData",
|
|
912
|
+
"children",
|
|
913
|
+
"loadData",
|
|
914
|
+
"treeLoadedKeys",
|
|
915
|
+
"onTreeLoad",
|
|
916
|
+
// Expanded
|
|
917
|
+
"treeDefaultExpandAll",
|
|
918
|
+
"treeExpandedKeys",
|
|
919
|
+
"treeDefaultExpandedKeys",
|
|
920
|
+
"onTreeExpand",
|
|
921
|
+
// Options
|
|
922
|
+
"virtual",
|
|
923
|
+
"listHeight",
|
|
924
|
+
"listItemHeight",
|
|
925
|
+
"onDropdownVisibleChange",
|
|
926
|
+
// Tree
|
|
927
|
+
"treeLine",
|
|
928
|
+
"treeIcon",
|
|
929
|
+
"showTreeIcon",
|
|
930
|
+
"switcherIcon",
|
|
931
|
+
"treeMotion"
|
|
932
|
+
]);
|
|
933
|
+
return U($t, X(X(X({
|
|
934
|
+
ref: J
|
|
935
|
+
}, l), h), {}, {
|
|
936
|
+
id: n,
|
|
937
|
+
prefixCls: e.prefixCls,
|
|
938
|
+
mode: c.value ? "multiple" : void 0,
|
|
939
|
+
displayValues: ce.value,
|
|
940
|
+
onDisplayValuesChange: me,
|
|
941
|
+
searchValue: f.value,
|
|
942
|
+
onSearch: w,
|
|
943
|
+
OptionList: ua,
|
|
944
|
+
emptyOptions: !x.value.length,
|
|
945
|
+
onDropdownVisibleChange: pe,
|
|
946
|
+
tagRender: e.tagRender || a.tagRender,
|
|
947
|
+
dropdownMatchSelectWidth: (u = e.dropdownMatchSelectWidth) !== null && u !== void 0 ? u : !0
|
|
948
|
+
}), a);
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
}), Va = (e) => {
|
|
952
|
+
const {
|
|
953
|
+
componentCls: s,
|
|
954
|
+
treePrefixCls: l,
|
|
955
|
+
colorBgElevated: t
|
|
956
|
+
} = e, a = `.${l}`;
|
|
957
|
+
return [
|
|
958
|
+
// ======================================================
|
|
959
|
+
// == Dropdown ==
|
|
960
|
+
// ======================================================
|
|
961
|
+
{
|
|
962
|
+
[`${s}-dropdown`]: [
|
|
963
|
+
{
|
|
964
|
+
padding: `${e.paddingXS}px ${e.paddingXS / 2}px`
|
|
965
|
+
},
|
|
966
|
+
// ====================== Tree ======================
|
|
967
|
+
qt(l, ut(e, {
|
|
968
|
+
colorBgContainer: t
|
|
969
|
+
})),
|
|
970
|
+
{
|
|
971
|
+
[a]: {
|
|
972
|
+
borderRadius: 0,
|
|
973
|
+
"&-list-holder-inner": {
|
|
974
|
+
alignItems: "stretch",
|
|
975
|
+
[`${a}-treenode`]: {
|
|
976
|
+
[`${a}-node-content-wrapper`]: {
|
|
977
|
+
flex: "auto"
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
// ==================== Checkbox ====================
|
|
984
|
+
Gt(`${l}-checkbox`, e),
|
|
985
|
+
// ====================== RTL =======================
|
|
986
|
+
{
|
|
987
|
+
"&-rtl": {
|
|
988
|
+
direction: "rtl",
|
|
989
|
+
[`${a}-switcher${a}-switcher_close`]: {
|
|
990
|
+
[`${a}-switcher-icon svg`]: {
|
|
991
|
+
transform: "rotate(90deg)"
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
]
|
|
997
|
+
}
|
|
998
|
+
];
|
|
999
|
+
};
|
|
1000
|
+
function Ia(e, s) {
|
|
1001
|
+
return It("TreeSelect", (l) => {
|
|
1002
|
+
const t = ut(l, {
|
|
1003
|
+
treePrefixCls: s.value
|
|
1004
|
+
});
|
|
1005
|
+
return [Va(t)];
|
|
1006
|
+
})(e);
|
|
1007
|
+
}
|
|
1008
|
+
const rt = (e, s, l) => l !== void 0 ? l : `${e}-${s}`;
|
|
1009
|
+
function ka() {
|
|
1010
|
+
return b(b({}, Ie(ft(), ["showTreeIcon", "treeMotion", "inputIcon", "getInputElement", "treeLine", "customSlots"])), {
|
|
1011
|
+
suffixIcon: ve.any,
|
|
1012
|
+
size: je(),
|
|
1013
|
+
bordered: Pt(),
|
|
1014
|
+
treeLine: Dt([Boolean, Object]),
|
|
1015
|
+
replaceFields: At(),
|
|
1016
|
+
placement: je(),
|
|
1017
|
+
status: je(),
|
|
1018
|
+
popupClassName: String,
|
|
1019
|
+
/** @deprecated Please use `popupClassName` instead */
|
|
1020
|
+
dropdownClassName: String,
|
|
1021
|
+
"onUpdate:value": We(),
|
|
1022
|
+
"onUpdate:treeExpandedKeys": We(),
|
|
1023
|
+
"onUpdate:searchValue": We()
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
const Ue = Ve({
|
|
1027
|
+
compatConfig: {
|
|
1028
|
+
MODE: 3
|
|
1029
|
+
},
|
|
1030
|
+
name: "ATreeSelect",
|
|
1031
|
+
inheritAttrs: !1,
|
|
1032
|
+
props: it(ka(), {
|
|
1033
|
+
choiceTransitionName: "",
|
|
1034
|
+
listHeight: 256,
|
|
1035
|
+
treeIcon: !1,
|
|
1036
|
+
listItemHeight: 26,
|
|
1037
|
+
bordered: !0
|
|
1038
|
+
}),
|
|
1039
|
+
slots: Object,
|
|
1040
|
+
setup(e, s) {
|
|
1041
|
+
let {
|
|
1042
|
+
attrs: l,
|
|
1043
|
+
slots: t,
|
|
1044
|
+
expose: a,
|
|
1045
|
+
emit: n
|
|
1046
|
+
} = s;
|
|
1047
|
+
kt(!(e.treeData === void 0 && t.default)), $e(e.multiple !== !1 || !e.treeCheckable, "TreeSelect", "`multiple` will always be `true` when `treeCheckable` is true"), $e(e.replaceFields === void 0, "TreeSelect", "`replaceFields` is deprecated, please use fieldNames instead"), $e(!e.dropdownClassName, "TreeSelect", "`dropdownClassName` is deprecated. Please use `popupClassName` instead.");
|
|
1048
|
+
const o = Qt(), r = Jt.useInject(), d = y(() => Zt(r.status, e.status)), {
|
|
1049
|
+
prefixCls: c,
|
|
1050
|
+
renderEmpty: i,
|
|
1051
|
+
direction: f,
|
|
1052
|
+
virtual: m,
|
|
1053
|
+
dropdownMatchSelectWidth: w,
|
|
1054
|
+
size: x,
|
|
1055
|
+
getPopupContainer: S,
|
|
1056
|
+
getPrefixCls: g,
|
|
1057
|
+
disabled: F
|
|
1058
|
+
} = Nt("select", e), {
|
|
1059
|
+
compactSize: A,
|
|
1060
|
+
compactItemClassnames: K
|
|
1061
|
+
} = Tt(c, f), O = y(() => A.value || x.value), v = Lt(), V = y(() => {
|
|
1062
|
+
var C;
|
|
1063
|
+
return (C = F.value) !== null && C !== void 0 ? C : v.value;
|
|
1064
|
+
}), E = y(() => g()), D = y(() => e.placement !== void 0 ? e.placement : f.value === "rtl" ? "bottomRight" : "bottomLeft"), T = y(() => rt(E.value, Et(D.value), e.transitionName)), z = y(() => rt(E.value, "", e.choiceTransitionName)), Y = y(() => g("select-tree", e.prefixCls)), B = y(() => g("tree-select", e.prefixCls)), [le, q] = Wt(c), [re] = Ia(B, Y), se = y(() => at(e.popupClassName || e.dropdownClassName, `${B.value}-dropdown`, {
|
|
1065
|
+
[`${B.value}-dropdown-rtl`]: f.value === "rtl"
|
|
1066
|
+
}, q.value)), ce = y(() => !!(e.treeCheckable || e.multiple)), ne = y(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !ce.value), G = fe();
|
|
1067
|
+
a({
|
|
1068
|
+
focus() {
|
|
1069
|
+
var C, _;
|
|
1070
|
+
(_ = (C = G.value).focus) === null || _ === void 0 || _.call(C);
|
|
1071
|
+
},
|
|
1072
|
+
blur() {
|
|
1073
|
+
var C, _;
|
|
1074
|
+
(_ = (C = G.value).blur) === null || _ === void 0 || _.call(C);
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
const pe = function() {
|
|
1078
|
+
for (var C = arguments.length, _ = new Array(C), H = 0; H < C; H++)
|
|
1079
|
+
_[H] = arguments[H];
|
|
1080
|
+
n("update:value", _[0]), n("change", ..._), o.onFieldChange();
|
|
1081
|
+
}, me = (C) => {
|
|
1082
|
+
n("update:treeExpandedKeys", C), n("treeExpand", C);
|
|
1083
|
+
}, ge = (C) => {
|
|
1084
|
+
n("update:searchValue", C), n("search", C);
|
|
1085
|
+
}, ie = (C) => {
|
|
1086
|
+
n("blur", C), o.onFieldBlur();
|
|
1087
|
+
};
|
|
1088
|
+
return () => {
|
|
1089
|
+
var C, _, H;
|
|
1090
|
+
const {
|
|
1091
|
+
notFoundContent: Q = (C = t.notFoundContent) === null || C === void 0 ? void 0 : C.call(t),
|
|
1092
|
+
prefixCls: ke,
|
|
1093
|
+
bordered: Ne,
|
|
1094
|
+
listHeight: Te,
|
|
1095
|
+
listItemHeight: Le,
|
|
1096
|
+
multiple: Ee,
|
|
1097
|
+
treeIcon: _e,
|
|
1098
|
+
treeLine: Ce,
|
|
1099
|
+
showArrow: Pe,
|
|
1100
|
+
switcherIcon: De = (_ = t.switcherIcon) === null || _ === void 0 ? void 0 : _.call(t),
|
|
1101
|
+
fieldNames: Ae = e.replaceFields,
|
|
1102
|
+
id: Ke = o.id.value,
|
|
1103
|
+
placeholder: Fe = (H = t.placeholder) === null || H === void 0 ? void 0 : H.call(t)
|
|
1104
|
+
} = e, {
|
|
1105
|
+
isFormItemInput: Oe,
|
|
1106
|
+
hasFeedback: J,
|
|
1107
|
+
feedbackIcon: u
|
|
1108
|
+
} = r, {
|
|
1109
|
+
suffixIcon: h,
|
|
1110
|
+
removeIcon: p,
|
|
1111
|
+
clearIcon: k
|
|
1112
|
+
} = Ut(b(b({}, e), {
|
|
1113
|
+
multiple: ce.value,
|
|
1114
|
+
showArrow: ne.value,
|
|
1115
|
+
hasFeedback: J,
|
|
1116
|
+
feedbackIcon: u,
|
|
1117
|
+
prefixCls: c.value
|
|
1118
|
+
}), t);
|
|
1119
|
+
let P;
|
|
1120
|
+
Q !== void 0 ? P = Q : P = i("Select");
|
|
1121
|
+
const L = Ie(e, ["suffixIcon", "itemIcon", "removeIcon", "clearIcon", "switcherIcon", "bordered", "status", "onUpdate:value", "onUpdate:treeExpandedKeys", "onUpdate:searchValue"]), I = at(!ke && B.value, {
|
|
1122
|
+
[`${c.value}-lg`]: O.value === "large",
|
|
1123
|
+
[`${c.value}-sm`]: O.value === "small",
|
|
1124
|
+
[`${c.value}-rtl`]: f.value === "rtl",
|
|
1125
|
+
[`${c.value}-borderless`]: !Ne,
|
|
1126
|
+
[`${c.value}-in-form-item`]: Oe
|
|
1127
|
+
}, ea(c.value, d.value, J), K.value, l.class, q.value), N = {};
|
|
1128
|
+
return e.treeData === void 0 && t.default && (N.children = _t(t.default())), le(re(U(xa, X(X(X(X({}, l), L), {}, {
|
|
1129
|
+
disabled: V.value,
|
|
1130
|
+
virtual: m.value,
|
|
1131
|
+
dropdownMatchSelectWidth: w.value,
|
|
1132
|
+
id: Ke,
|
|
1133
|
+
fieldNames: Ae,
|
|
1134
|
+
ref: G,
|
|
1135
|
+
prefixCls: c.value,
|
|
1136
|
+
class: I,
|
|
1137
|
+
listHeight: Te,
|
|
1138
|
+
listItemHeight: Le,
|
|
1139
|
+
treeLine: !!Ce,
|
|
1140
|
+
inputIcon: h,
|
|
1141
|
+
multiple: Ee,
|
|
1142
|
+
removeIcon: p,
|
|
1143
|
+
clearIcon: k,
|
|
1144
|
+
switcherIcon: (R) => ta(Y.value, De, R, t.leafIcon, Ce),
|
|
1145
|
+
showTreeIcon: _e,
|
|
1146
|
+
notFoundContent: P,
|
|
1147
|
+
getPopupContainer: S == null ? void 0 : S.value,
|
|
1148
|
+
treeMotion: null,
|
|
1149
|
+
dropdownClassName: se.value,
|
|
1150
|
+
choiceTransitionName: z.value,
|
|
1151
|
+
onChange: pe,
|
|
1152
|
+
onBlur: ie,
|
|
1153
|
+
onSearch: ge,
|
|
1154
|
+
onTreeExpand: me
|
|
1155
|
+
}, N), {}, {
|
|
1156
|
+
transitionName: T.value,
|
|
1157
|
+
customSlots: b(b({}, t), {
|
|
1158
|
+
treeCheckable: () => U("span", {
|
|
1159
|
+
class: `${c.value}-tree-checkbox-inner`
|
|
1160
|
+
}, null)
|
|
1161
|
+
}),
|
|
1162
|
+
maxTagPlaceholder: e.maxTagPlaceholder || t.maxTagPlaceholder,
|
|
1163
|
+
placement: D.value,
|
|
1164
|
+
showArrow: J || Pe,
|
|
1165
|
+
placeholder: Fe
|
|
1166
|
+
}), b(b({}, t), {
|
|
1167
|
+
treeCheckable: () => U("span", {
|
|
1168
|
+
class: `${c.value}-tree-checkbox-inner`
|
|
1169
|
+
}, null)
|
|
1170
|
+
}))));
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
}), st = he, ct = b(Ue, {
|
|
1174
|
+
TreeNode: he,
|
|
1175
|
+
SHOW_ALL: da,
|
|
1176
|
+
SHOW_PARENT: vt,
|
|
1177
|
+
SHOW_CHILD: Qe,
|
|
1178
|
+
install: (e) => (e.component(Ue.name, Ue), e.component(st.displayName, st), e)
|
|
1179
|
+
}), ze = yt({});
|
|
1180
|
+
function Na(e) {
|
|
1181
|
+
return be(() => e, (s) => {
|
|
1182
|
+
s.forEach(async (l) => {
|
|
1183
|
+
if (!ze[l.id]) {
|
|
1184
|
+
const t = await Kt.getCategoryValues(l.id), { flatAttributeValue: a, treeAttributeValue: n, showWay: o } = t.body;
|
|
1185
|
+
ze[l.id] = o === "TREE" ? n : a;
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
}, { immediate: !0 }), {
|
|
1189
|
+
categoryValuesMap: ze
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
const Ta = { class: "crane-required" }, La = { class: "crane-category-tips" }, Ea = {
|
|
1193
|
+
key: 0,
|
|
1194
|
+
style: { color: "#1677ff", "font-weight": "bold" }
|
|
1195
|
+
}, _a = { key: 1 }, Pa = {
|
|
1196
|
+
key: 0,
|
|
1197
|
+
style: { color: "#ff4d4f", "font-size": "12px" }
|
|
1198
|
+
}, Da = /* @__PURE__ */ Ve({
|
|
1199
|
+
__name: "category-selector",
|
|
1200
|
+
props: {
|
|
1201
|
+
categoryList: {
|
|
1202
|
+
type: Array,
|
|
1203
|
+
default: () => []
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
setup(e, { expose: s }) {
|
|
1207
|
+
const l = ct.SHOW_PARENT, t = e, a = y(() => ({
|
|
1208
|
+
categoryList: t.categoryList
|
|
1209
|
+
})), n = y(() => Object.values(d).some((i) => i.length > 0)), o = fe(), r = fe(""), { categoryValuesMap: d } = Na(t.categoryList);
|
|
1210
|
+
return s({
|
|
1211
|
+
validate: () => new Promise((i, f) => {
|
|
1212
|
+
o.value.validate().then(() => {
|
|
1213
|
+
i(!0);
|
|
1214
|
+
}).catch(() => {
|
|
1215
|
+
f(!1);
|
|
1216
|
+
});
|
|
1217
|
+
})
|
|
1218
|
+
}), (i, f) => n.value ? (ue(), Ze(W(la), {
|
|
1219
|
+
key: 0,
|
|
1220
|
+
class: "crane-category-wraper",
|
|
1221
|
+
model: a.value,
|
|
1222
|
+
ref_key: "formRef",
|
|
1223
|
+
ref: o
|
|
1224
|
+
}, {
|
|
1225
|
+
default: Me(() => [
|
|
1226
|
+
Be("div", Ta, ye(W(xe)("category")), 1),
|
|
1227
|
+
Be("div", La, ye(W(xe)("categotySelectTips")), 1),
|
|
1228
|
+
f[1] || (f[1] = Be("div", { class: "crane-category-line" }, null, -1)),
|
|
1229
|
+
(ue(!0), we(bt, null, Ct(a.value.categoryList, (m, w) => {
|
|
1230
|
+
var x;
|
|
1231
|
+
return St((ue(), Ze(W(aa), {
|
|
1232
|
+
key: m.id,
|
|
1233
|
+
label: m.categoryName,
|
|
1234
|
+
name: ["categoryList", w, "attributeValueIds_view"],
|
|
1235
|
+
rules: [{ required: !0, message: W(xe)("pleaseChoose"), trigger: ["change", "blur"] }]
|
|
1236
|
+
}, {
|
|
1237
|
+
default: Me(() => {
|
|
1238
|
+
var S;
|
|
1239
|
+
return [
|
|
1240
|
+
U(W(ct), {
|
|
1241
|
+
treeCheckable: "",
|
|
1242
|
+
treeDefaultExpandAll: "",
|
|
1243
|
+
"tree-data": W(d)[m.id],
|
|
1244
|
+
showSearch: "",
|
|
1245
|
+
allowClear: "",
|
|
1246
|
+
value: m.attributeValueIds_view,
|
|
1247
|
+
"onUpdate:value": (g) => m.attributeValueIds_view = g,
|
|
1248
|
+
treeNodeFilterProp: "attributeName",
|
|
1249
|
+
searchValue: r.value,
|
|
1250
|
+
"onUpdate:searchValue": f[0] || (f[0] = (g) => r.value = g),
|
|
1251
|
+
fieldNames: { label: "attributeName", value: "id" },
|
|
1252
|
+
treeNodeLabelProp: "attributeName",
|
|
1253
|
+
"show-checked-strategy": W(l)
|
|
1254
|
+
}, {
|
|
1255
|
+
title: Me(({ attributeName: g }) => [
|
|
1256
|
+
r.value.toLowerCase() && g.includes(r.value.toLowerCase()) ? (ue(), we("span", Ea, ye(g), 1)) : (ue(), we("span", _a, ye(g), 1))
|
|
1257
|
+
]),
|
|
1258
|
+
_: 2
|
|
1259
|
+
}, 1032, ["tree-data", "value", "onUpdate:value", "searchValue", "show-checked-strategy"]),
|
|
1260
|
+
(S = m.attributeValueIds_view) != null && S.includes(-1) ? (ue(), we("span", Pa, ye(W(xe)("categoryChangeTips")), 1)) : et("", !0)
|
|
1261
|
+
];
|
|
1262
|
+
}),
|
|
1263
|
+
_: 2
|
|
1264
|
+
}, 1032, ["label", "name", "rules"])), [
|
|
1265
|
+
[wt, (x = W(d)[m.id]) == null ? void 0 : x.length]
|
|
1266
|
+
]);
|
|
1267
|
+
}), 128))
|
|
1268
|
+
]),
|
|
1269
|
+
_: 1
|
|
1270
|
+
}, 8, ["model"])) : et("", !0);
|
|
1271
|
+
}
|
|
1272
|
+
}), Ha = /* @__PURE__ */ Ft(Da, [["__scopeId", "data-v-5bc5b7db"]]);
|
|
1273
|
+
export {
|
|
1274
|
+
Ha as default
|
|
1275
|
+
};
|