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