@yqg/permission 1.3.11 → 1.3.13
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-B4niAWln.js → apply-modal-OokdyEmj.js} +760 -758
- package/dist/category-selector-C-yZxEgO.js +1301 -0
- package/dist/{index-CZ6UV6_X.js → index-BkbJOH6j.js} +3 -3
- package/dist/{index-CJ_Ktj6t.js → index-CSnwgcu-.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{permission-item-Bm9OiOSx.js → permission-item-CZ7LWwNL.js} +4 -4
- package/dist/{yqg-permission-Cb-_sywm.js → yqg-permission-D0O9c9lI.js} +7 -7
- package/dist/yqg-permission.umd.js +44 -44
- package/package.json +1 -1
- package/src/App.vue +5 -3
- package/src/components/apply-modal.vue +4 -4
- package/src/components/category-selector.vue +13 -5
- package/src/hooks/useAttributesCache.ts +23 -1
- 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-CJ2VLSr7.js +0 -1275
|
@@ -1,1275 +0,0 @@
|
|
|
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 R, E as ae, e as U, b as Ge, y as oe, a0 as gt, G as yt, K as Ze, R as et, L as ie, M as Re, P as je, N as we, S as ye, u as W, F as bt, Y as Ct, j as St, z as wt } from "./index-CJ_Ktj6t.js";
|
|
2
|
-
import { a as X, _ as b, W as xt, X as Vt, ae as ut, aX as tt, Y as Ie, P as ve, N as It, Q as it, V as kt, aN as Be, a0 as Nt, ar as Tt, as as Lt, aY as Et, c as at, b as _t, ai as $e, ak as We, am as Pt, $ as Dt, aj as At, aV as Kt, aP as xe, aS as Ft } from "./yqg-permission-Cb-_sywm.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-CZ6UV6_X.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-B4niAWln.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 ua = {
|
|
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
|
-
}, ia = 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 = Mt(() => 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 u = y(() => String(a.searchValue).toLowerCase()), f = (v) => u.value ? String(v[n.treeNodeFilterProp]).toLowerCase().includes(u.value) : !1, p = R(n.treeDefaultExpandedKeys), w = R(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 : p.value), S = (v) => {
|
|
94
|
-
var V;
|
|
95
|
-
p.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: j,
|
|
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: ue,
|
|
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 ue && (Q.loadedKeys = ue), x.value && (Q.expandedKeys = x.value), U("div", {
|
|
189
|
-
onMousedown: g
|
|
190
|
-
}, [K.value && T && U("span", {
|
|
191
|
-
style: ua,
|
|
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: j,
|
|
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: u,
|
|
274
|
-
checkable: f,
|
|
275
|
-
selectable: p,
|
|
276
|
-
disabled: w,
|
|
277
|
-
disableCheckbox: x
|
|
278
|
-
} = c, S = {
|
|
279
|
-
isLeaf: u || u === "" || void 0,
|
|
280
|
-
checkable: f || f === "" || void 0,
|
|
281
|
-
selectable: p || p === "" || 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: u
|
|
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(u) {
|
|
312
|
-
let f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "0", p = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
313
|
-
return u.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 p || r.push(O), O;
|
|
324
|
-
}
|
|
325
|
-
return null;
|
|
326
|
-
}).filter((w) => w);
|
|
327
|
-
}
|
|
328
|
-
r || (r = [], c(t), r.sort((u, f) => {
|
|
329
|
-
let {
|
|
330
|
-
node: {
|
|
331
|
-
props: {
|
|
332
|
-
value: p
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
} = u, {
|
|
336
|
-
node: {
|
|
337
|
-
props: {
|
|
338
|
-
value: w
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
} = f;
|
|
342
|
-
const x = l.indexOf(p), 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: u
|
|
355
|
-
} = c;
|
|
356
|
-
return u;
|
|
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), u = c[l];
|
|
370
|
-
return n[u] = c, c.key = c.key || u, c;
|
|
371
|
-
}).forEach((d) => {
|
|
372
|
-
const c = d[t], u = n[c];
|
|
373
|
-
u && (u.children = u.children || [], u.children.push(d)), (c === a || !u && a === null) && o.push(d);
|
|
374
|
-
}), o;
|
|
375
|
-
}
|
|
376
|
-
function ga(e, s, l) {
|
|
377
|
-
const t = R();
|
|
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 = R({
|
|
392
|
-
valueLabels: /* @__PURE__ */ new Map()
|
|
393
|
-
}), l = R();
|
|
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, u = (d = r.label) !== null && d !== void 0 ? d : a.get(c);
|
|
406
|
-
return n.set(c, u), b(b({}, r), {
|
|
407
|
-
label: u
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
return s.value.valueLabels = n, o;
|
|
411
|
-
})];
|
|
412
|
-
}, ba = (e, s) => {
|
|
413
|
-
const l = R(/* @__PURE__ */ new Map()), t = R({});
|
|
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 = R([]), r = R([]);
|
|
432
|
-
return Ge(() => {
|
|
433
|
-
let d = e.value.map((f) => {
|
|
434
|
-
let {
|
|
435
|
-
value: p
|
|
436
|
-
} = f;
|
|
437
|
-
return p;
|
|
438
|
-
}), c = s.value.map((f) => {
|
|
439
|
-
let {
|
|
440
|
-
value: p
|
|
441
|
-
} = f;
|
|
442
|
-
return p;
|
|
443
|
-
});
|
|
444
|
-
const u = 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([...u, ...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 = (p, w) => {
|
|
468
|
-
const x = w[d];
|
|
469
|
-
return String(x).toUpperCase().includes(f);
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
function u(f) {
|
|
473
|
-
let p = 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 = p || c(r, qe(g)), K = u(F || [], A);
|
|
477
|
-
(A || K.length) && w.push(b(b({}, g), {
|
|
478
|
-
[o]: K
|
|
479
|
-
}));
|
|
480
|
-
}
|
|
481
|
-
return w;
|
|
482
|
-
}
|
|
483
|
-
return u(e.value);
|
|
484
|
-
});
|
|
485
|
-
};
|
|
486
|
-
function ft() {
|
|
487
|
-
return b(b({}, Ie($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: 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: ut(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 = Rt(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), u = y(() => oa(e.fieldNames)), [f, p] = tt("", {
|
|
648
|
-
value: y(() => e.searchValue !== void 0 ? e.searchValue : e.inputValue),
|
|
649
|
-
postState: (i) => i || ""
|
|
650
|
-
}), w = (i) => {
|
|
651
|
-
var h;
|
|
652
|
-
p(i), (h = e.onSearch) === null || h === void 0 || h.call(e, i);
|
|
653
|
-
}, x = ga(oe(e, "treeData"), oe(e, "children"), oe(e, "treeDataSimpleMode")), {
|
|
654
|
-
keyEntities: S,
|
|
655
|
-
valueEntities: g
|
|
656
|
-
} = ba(x, u), F = (i) => {
|
|
657
|
-
const h = [], m = [];
|
|
658
|
-
return i.forEach((k) => {
|
|
659
|
-
g.value.has(k) ? m.push(k) : h.push(k);
|
|
660
|
-
}), {
|
|
661
|
-
missingRawValues: h,
|
|
662
|
-
existRawValues: m
|
|
663
|
-
};
|
|
664
|
-
}, A = Sa(x, f, {
|
|
665
|
-
fieldNames: u,
|
|
666
|
-
treeNodeFilterProp: oe(e, "treeNodeFilterProp"),
|
|
667
|
-
filterTreeNode: oe(e, "filterTreeNode")
|
|
668
|
-
}), K = (i) => {
|
|
669
|
-
if (i) {
|
|
670
|
-
if (e.treeNodeLabelProp)
|
|
671
|
-
return i[e.treeNodeLabelProp];
|
|
672
|
-
const {
|
|
673
|
-
_title: h
|
|
674
|
-
} = u.value;
|
|
675
|
-
for (let m = 0; m < h.length; m += 1) {
|
|
676
|
-
const k = i[h[m]];
|
|
677
|
-
if (k !== void 0)
|
|
678
|
-
return k;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
}, O = (i) => na(i).map((m) => wa(m) ? {
|
|
682
|
-
value: m
|
|
683
|
-
} : m), v = (i) => O(i).map((m) => {
|
|
684
|
-
let {
|
|
685
|
-
label: k
|
|
686
|
-
} = m;
|
|
687
|
-
const {
|
|
688
|
-
value: P,
|
|
689
|
-
halfChecked: L
|
|
690
|
-
} = m;
|
|
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 = R([]), z = R([]);
|
|
702
|
-
Ge(() => {
|
|
703
|
-
const i = [], h = [];
|
|
704
|
-
D.value.forEach((m) => {
|
|
705
|
-
m.halfChecked ? h.push(m) : i.push(m);
|
|
706
|
-
}), T.value = i, z.value = h;
|
|
707
|
-
});
|
|
708
|
-
const Y = y(() => T.value.map((i) => i.value)), {
|
|
709
|
-
maxLevel: j,
|
|
710
|
-
levelEntities: le
|
|
711
|
-
} = Yt(S), [q, re] = Ca(T, z, o, S, j, le), se = y(() => {
|
|
712
|
-
const m = ot(q.value, e.showCheckedStrategy, S.value, u.value).map((L) => {
|
|
713
|
-
var I, N, M;
|
|
714
|
-
return (M = (N = (I = S.value[L]) === null || I === void 0 ? void 0 : I.node) === null || N === void 0 ? void 0 : N[u.value.value]) !== null && M !== void 0 ? M : 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(m), 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 = (i, h, m) => {
|
|
729
|
-
const k = v(i);
|
|
730
|
-
if (E(k), e.autoClearSearchValue && p(""), e.onChange) {
|
|
731
|
-
let P = i;
|
|
732
|
-
o.value && (P = ot(i, e.showCheckedStrategy, S.value, u.value).map((te) => {
|
|
733
|
-
const Se = g.value.get(te);
|
|
734
|
-
return Se ? Se.node[u.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 $ = z.value.filter((te) => !P.includes(te.value));
|
|
746
|
-
N = [...N, ...$];
|
|
747
|
-
}
|
|
748
|
-
const M = 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 || m === "selection" && !I) && (ee = !1), pa(Z, L, i, x.value, ee, u.value), r.value ? Z.checked = I : Z.selected = I;
|
|
755
|
-
const B = d.value ? M : M.map(($) => $.value);
|
|
756
|
-
e.onChange(c.value ? B : B[0], d.value ? null : M.map(($) => $.label), Z);
|
|
757
|
-
}
|
|
758
|
-
}, G = (i, h) => {
|
|
759
|
-
let {
|
|
760
|
-
selected: m,
|
|
761
|
-
source: k
|
|
762
|
-
} = h;
|
|
763
|
-
var P, L, I;
|
|
764
|
-
const N = ae(S.value), M = ae(g.value), Z = N[i], ee = Z == null ? void 0 : Z.node, B = (P = ee == null ? void 0 : ee[u.value.value]) !== null && P !== void 0 ? P : i;
|
|
765
|
-
if (!c.value)
|
|
766
|
-
ne([B], {
|
|
767
|
-
selected: !0,
|
|
768
|
-
triggerValue: B
|
|
769
|
-
}, "option");
|
|
770
|
-
else {
|
|
771
|
-
let $ = m ? [...Y.value, B] : q.value.filter((te) => te !== B);
|
|
772
|
-
if (o.value) {
|
|
773
|
-
const {
|
|
774
|
-
missingRawValues: te,
|
|
775
|
-
existRawValues: Se
|
|
776
|
-
} = F($), Je = Se.map((Me) => M.get(Me).key);
|
|
777
|
-
let He;
|
|
778
|
-
m ? {
|
|
779
|
-
checkedKeys: He
|
|
780
|
-
} = Xe(Je, !0, N, j.value, le.value) : {
|
|
781
|
-
checkedKeys: He
|
|
782
|
-
} = Xe(Je, {
|
|
783
|
-
halfCheckedKeys: re.value
|
|
784
|
-
}, N, j.value, le.value), $ = [...te, ...He.map((Me) => N[Me].node[u.value.value])];
|
|
785
|
-
}
|
|
786
|
-
ne($, {
|
|
787
|
-
selected: m,
|
|
788
|
-
triggerValue: B
|
|
789
|
-
}, k || "option");
|
|
790
|
-
}
|
|
791
|
-
m || !c.value ? (L = e.onSelect) === null || L === void 0 || L.call(e, B, qe(ee)) : (I = e.onDeselect) === null || I === void 0 || I.call(e, B, qe(ee));
|
|
792
|
-
}, pe = (i) => {
|
|
793
|
-
if (e.onDropdownVisibleChange) {
|
|
794
|
-
const h = {};
|
|
795
|
-
Object.defineProperty(h, "documentClickClose", {
|
|
796
|
-
get() {
|
|
797
|
-
return !1;
|
|
798
|
-
}
|
|
799
|
-
}), e.onDropdownVisibleChange(i, h);
|
|
800
|
-
}
|
|
801
|
-
}, me = (i, h) => {
|
|
802
|
-
const m = i.map((k) => k.value);
|
|
803
|
-
if (h.type === "clear") {
|
|
804
|
-
ne(m, {}, "selection");
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
h.values.length && G(h.values[0].value, {
|
|
808
|
-
selected: !1,
|
|
809
|
-
source: "selection"
|
|
810
|
-
});
|
|
811
|
-
}, {
|
|
812
|
-
treeNodeFilterProp: ge,
|
|
813
|
-
// Data
|
|
814
|
-
loadData: ue,
|
|
815
|
-
treeLoadedKeys: C,
|
|
816
|
-
onTreeLoad: _,
|
|
817
|
-
// Expanded
|
|
818
|
-
treeDefaultExpandAll: H,
|
|
819
|
-
treeExpandedKeys: Q,
|
|
820
|
-
treeDefaultExpandedKeys: ke,
|
|
821
|
-
onTreeExpand: Ne,
|
|
822
|
-
// Options
|
|
823
|
-
virtual: Te,
|
|
824
|
-
listHeight: Le,
|
|
825
|
-
listItemHeight: Ee,
|
|
826
|
-
// Tree
|
|
827
|
-
treeLine: _e,
|
|
828
|
-
treeIcon: Ce,
|
|
829
|
-
showTreeIcon: Pe,
|
|
830
|
-
switcherIcon: De,
|
|
831
|
-
treeMotion: Ae,
|
|
832
|
-
customSlots: Ke,
|
|
833
|
-
dropdownMatchSelectWidth: Fe,
|
|
834
|
-
treeExpandAction: Oe
|
|
835
|
-
} = gt(e);
|
|
836
|
-
jt(lt({
|
|
837
|
-
checkable: r,
|
|
838
|
-
loadData: ue,
|
|
839
|
-
treeLoadedKeys: C,
|
|
840
|
-
onTreeLoad: _,
|
|
841
|
-
checkedKeys: q,
|
|
842
|
-
halfCheckedKeys: re,
|
|
843
|
-
treeDefaultExpandAll: H,
|
|
844
|
-
treeExpandedKeys: Q,
|
|
845
|
-
treeDefaultExpandedKeys: ke,
|
|
846
|
-
onTreeExpand: Ne,
|
|
847
|
-
treeIcon: Ce,
|
|
848
|
-
treeMotion: Ae,
|
|
849
|
-
showTreeIcon: Pe,
|
|
850
|
-
switcherIcon: De,
|
|
851
|
-
treeLine: _e,
|
|
852
|
-
treeNodeFilterProp: ge,
|
|
853
|
-
keyEntities: S,
|
|
854
|
-
customSlots: Ke
|
|
855
|
-
})), sa(lt({
|
|
856
|
-
virtual: Te,
|
|
857
|
-
listHeight: Le,
|
|
858
|
-
listItemHeight: Ee,
|
|
859
|
-
treeData: A,
|
|
860
|
-
fieldNames: u,
|
|
861
|
-
onSelect: G,
|
|
862
|
-
dropdownMatchSelectWidth: Fe,
|
|
863
|
-
treeExpandAction: Oe
|
|
864
|
-
}));
|
|
865
|
-
const J = fe();
|
|
866
|
-
return t({
|
|
867
|
-
focus() {
|
|
868
|
-
var i;
|
|
869
|
-
(i = J.value) === null || i === void 0 || i.focus();
|
|
870
|
-
},
|
|
871
|
-
blur() {
|
|
872
|
-
var i;
|
|
873
|
-
(i = J.value) === null || i === void 0 || i.blur();
|
|
874
|
-
},
|
|
875
|
-
scrollTo(i) {
|
|
876
|
-
var h;
|
|
877
|
-
(h = J.value) === null || h === void 0 || h.scrollTo(i);
|
|
878
|
-
}
|
|
879
|
-
}), () => {
|
|
880
|
-
var i;
|
|
881
|
-
const h = Ie(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
|
-
}, l), h), {}, {
|
|
935
|
-
id: n,
|
|
936
|
-
prefixCls: e.prefixCls,
|
|
937
|
-
mode: c.value ? "multiple" : void 0,
|
|
938
|
-
displayValues: ce.value,
|
|
939
|
-
onDisplayValuesChange: me,
|
|
940
|
-
searchValue: f.value,
|
|
941
|
-
onSearch: w,
|
|
942
|
-
OptionList: ia,
|
|
943
|
-
emptyOptions: !x.value.length,
|
|
944
|
-
onDropdownVisibleChange: pe,
|
|
945
|
-
tagRender: e.tagRender || a.tagRender,
|
|
946
|
-
dropdownMatchSelectWidth: (i = e.dropdownMatchSelectWidth) !== null && i !== void 0 ? i : !0
|
|
947
|
-
}), a);
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
}), Va = (e) => {
|
|
951
|
-
const {
|
|
952
|
-
componentCls: s,
|
|
953
|
-
treePrefixCls: l,
|
|
954
|
-
colorBgElevated: t
|
|
955
|
-
} = e, a = `.${l}`;
|
|
956
|
-
return [
|
|
957
|
-
// ======================================================
|
|
958
|
-
// == Dropdown ==
|
|
959
|
-
// ======================================================
|
|
960
|
-
{
|
|
961
|
-
[`${s}-dropdown`]: [
|
|
962
|
-
{
|
|
963
|
-
padding: `${e.paddingXS}px ${e.paddingXS / 2}px`
|
|
964
|
-
},
|
|
965
|
-
// ====================== Tree ======================
|
|
966
|
-
qt(l, it(e, {
|
|
967
|
-
colorBgContainer: t
|
|
968
|
-
})),
|
|
969
|
-
{
|
|
970
|
-
[a]: {
|
|
971
|
-
borderRadius: 0,
|
|
972
|
-
"&-list-holder-inner": {
|
|
973
|
-
alignItems: "stretch",
|
|
974
|
-
[`${a}-treenode`]: {
|
|
975
|
-
[`${a}-node-content-wrapper`]: {
|
|
976
|
-
flex: "auto"
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
},
|
|
982
|
-
// ==================== Checkbox ====================
|
|
983
|
-
Gt(`${l}-checkbox`, e),
|
|
984
|
-
// ====================== RTL =======================
|
|
985
|
-
{
|
|
986
|
-
"&-rtl": {
|
|
987
|
-
direction: "rtl",
|
|
988
|
-
[`${a}-switcher${a}-switcher_close`]: {
|
|
989
|
-
[`${a}-switcher-icon svg`]: {
|
|
990
|
-
transform: "rotate(90deg)"
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
]
|
|
996
|
-
}
|
|
997
|
-
];
|
|
998
|
-
};
|
|
999
|
-
function Ia(e, s) {
|
|
1000
|
-
return It("TreeSelect", (l) => {
|
|
1001
|
-
const t = it(l, {
|
|
1002
|
-
treePrefixCls: s.value
|
|
1003
|
-
});
|
|
1004
|
-
return [Va(t)];
|
|
1005
|
-
})(e);
|
|
1006
|
-
}
|
|
1007
|
-
const rt = (e, s, l) => l !== void 0 ? l : `${e}-${s}`;
|
|
1008
|
-
function ka() {
|
|
1009
|
-
return b(b({}, Ie(ft(), ["showTreeIcon", "treeMotion", "inputIcon", "getInputElement", "treeLine", "customSlots"])), {
|
|
1010
|
-
suffixIcon: ve.any,
|
|
1011
|
-
size: We(),
|
|
1012
|
-
bordered: At(),
|
|
1013
|
-
treeLine: Dt([Boolean, Object]),
|
|
1014
|
-
replaceFields: Pt(),
|
|
1015
|
-
placement: We(),
|
|
1016
|
-
status: We(),
|
|
1017
|
-
popupClassName: String,
|
|
1018
|
-
/** @deprecated Please use `popupClassName` instead */
|
|
1019
|
-
dropdownClassName: String,
|
|
1020
|
-
"onUpdate:value": $e(),
|
|
1021
|
-
"onUpdate:treeExpandedKeys": $e(),
|
|
1022
|
-
"onUpdate:searchValue": $e()
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
const Ue = Ve({
|
|
1026
|
-
compatConfig: {
|
|
1027
|
-
MODE: 3
|
|
1028
|
-
},
|
|
1029
|
-
name: "ATreeSelect",
|
|
1030
|
-
inheritAttrs: !1,
|
|
1031
|
-
props: ut(ka(), {
|
|
1032
|
-
choiceTransitionName: "",
|
|
1033
|
-
listHeight: 256,
|
|
1034
|
-
treeIcon: !1,
|
|
1035
|
-
listItemHeight: 26,
|
|
1036
|
-
bordered: !0
|
|
1037
|
-
}),
|
|
1038
|
-
slots: Object,
|
|
1039
|
-
setup(e, s) {
|
|
1040
|
-
let {
|
|
1041
|
-
attrs: l,
|
|
1042
|
-
slots: t,
|
|
1043
|
-
expose: a,
|
|
1044
|
-
emit: n
|
|
1045
|
-
} = s;
|
|
1046
|
-
kt(!(e.treeData === void 0 && t.default)), Be(e.multiple !== !1 || !e.treeCheckable, "TreeSelect", "`multiple` will always be `true` when `treeCheckable` is true"), Be(e.replaceFields === void 0, "TreeSelect", "`replaceFields` is deprecated, please use fieldNames instead"), Be(!e.dropdownClassName, "TreeSelect", "`dropdownClassName` is deprecated. Please use `popupClassName` instead.");
|
|
1047
|
-
const o = Qt(), r = Jt.useInject(), d = y(() => Zt(r.status, e.status)), {
|
|
1048
|
-
prefixCls: c,
|
|
1049
|
-
renderEmpty: u,
|
|
1050
|
-
direction: f,
|
|
1051
|
-
virtual: p,
|
|
1052
|
-
dropdownMatchSelectWidth: w,
|
|
1053
|
-
size: x,
|
|
1054
|
-
getPopupContainer: S,
|
|
1055
|
-
getPrefixCls: g,
|
|
1056
|
-
disabled: F
|
|
1057
|
-
} = Nt("select", e), {
|
|
1058
|
-
compactSize: A,
|
|
1059
|
-
compactItemClassnames: K
|
|
1060
|
-
} = Tt(c, f), O = y(() => A.value || x.value), v = Lt(), V = y(() => {
|
|
1061
|
-
var C;
|
|
1062
|
-
return (C = F.value) !== null && C !== void 0 ? C : v.value;
|
|
1063
|
-
}), 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)), j = y(() => g("tree-select", e.prefixCls)), [le, q] = Wt(c), [re] = Ia(j, Y), se = y(() => at(e.popupClassName || e.dropdownClassName, `${j.value}-dropdown`, {
|
|
1064
|
-
[`${j.value}-dropdown-rtl`]: f.value === "rtl"
|
|
1065
|
-
}, q.value)), ce = y(() => !!(e.treeCheckable || e.multiple)), ne = y(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !ce.value), G = fe();
|
|
1066
|
-
a({
|
|
1067
|
-
focus() {
|
|
1068
|
-
var C, _;
|
|
1069
|
-
(_ = (C = G.value).focus) === null || _ === void 0 || _.call(C);
|
|
1070
|
-
},
|
|
1071
|
-
blur() {
|
|
1072
|
-
var C, _;
|
|
1073
|
-
(_ = (C = G.value).blur) === null || _ === void 0 || _.call(C);
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
const pe = function() {
|
|
1077
|
-
for (var C = arguments.length, _ = new Array(C), H = 0; H < C; H++)
|
|
1078
|
-
_[H] = arguments[H];
|
|
1079
|
-
n("update:value", _[0]), n("change", ..._), o.onFieldChange();
|
|
1080
|
-
}, me = (C) => {
|
|
1081
|
-
n("update:treeExpandedKeys", C), n("treeExpand", C);
|
|
1082
|
-
}, ge = (C) => {
|
|
1083
|
-
n("update:searchValue", C), n("search", C);
|
|
1084
|
-
}, ue = (C) => {
|
|
1085
|
-
n("blur", C), o.onFieldBlur();
|
|
1086
|
-
};
|
|
1087
|
-
return () => {
|
|
1088
|
-
var C, _, H;
|
|
1089
|
-
const {
|
|
1090
|
-
notFoundContent: Q = (C = t.notFoundContent) === null || C === void 0 ? void 0 : C.call(t),
|
|
1091
|
-
prefixCls: ke,
|
|
1092
|
-
bordered: Ne,
|
|
1093
|
-
listHeight: Te,
|
|
1094
|
-
listItemHeight: Le,
|
|
1095
|
-
multiple: Ee,
|
|
1096
|
-
treeIcon: _e,
|
|
1097
|
-
treeLine: Ce,
|
|
1098
|
-
showArrow: Pe,
|
|
1099
|
-
switcherIcon: De = (_ = t.switcherIcon) === null || _ === void 0 ? void 0 : _.call(t),
|
|
1100
|
-
fieldNames: Ae = e.replaceFields,
|
|
1101
|
-
id: Ke = o.id.value,
|
|
1102
|
-
placeholder: Fe = (H = t.placeholder) === null || H === void 0 ? void 0 : H.call(t)
|
|
1103
|
-
} = e, {
|
|
1104
|
-
isFormItemInput: Oe,
|
|
1105
|
-
hasFeedback: J,
|
|
1106
|
-
feedbackIcon: i
|
|
1107
|
-
} = r, {
|
|
1108
|
-
suffixIcon: h,
|
|
1109
|
-
removeIcon: m,
|
|
1110
|
-
clearIcon: k
|
|
1111
|
-
} = Ut(b(b({}, e), {
|
|
1112
|
-
multiple: ce.value,
|
|
1113
|
-
showArrow: ne.value,
|
|
1114
|
-
hasFeedback: J,
|
|
1115
|
-
feedbackIcon: i,
|
|
1116
|
-
prefixCls: c.value
|
|
1117
|
-
}), t);
|
|
1118
|
-
let P;
|
|
1119
|
-
Q !== void 0 ? P = Q : P = u("Select");
|
|
1120
|
-
const L = Ie(e, ["suffixIcon", "itemIcon", "removeIcon", "clearIcon", "switcherIcon", "bordered", "status", "onUpdate:value", "onUpdate:treeExpandedKeys", "onUpdate:searchValue"]), I = at(!ke && j.value, {
|
|
1121
|
-
[`${c.value}-lg`]: O.value === "large",
|
|
1122
|
-
[`${c.value}-sm`]: O.value === "small",
|
|
1123
|
-
[`${c.value}-rtl`]: f.value === "rtl",
|
|
1124
|
-
[`${c.value}-borderless`]: !Ne,
|
|
1125
|
-
[`${c.value}-in-form-item`]: Oe
|
|
1126
|
-
}, ea(c.value, d.value, J), K.value, l.class, q.value), N = {};
|
|
1127
|
-
return e.treeData === void 0 && t.default && (N.children = _t(t.default())), le(re(U(xa, X(X(X(X({}, l), L), {}, {
|
|
1128
|
-
disabled: V.value,
|
|
1129
|
-
virtual: p.value,
|
|
1130
|
-
dropdownMatchSelectWidth: w.value,
|
|
1131
|
-
id: Ke,
|
|
1132
|
-
fieldNames: Ae,
|
|
1133
|
-
ref: G,
|
|
1134
|
-
prefixCls: c.value,
|
|
1135
|
-
class: I,
|
|
1136
|
-
listHeight: Te,
|
|
1137
|
-
listItemHeight: Le,
|
|
1138
|
-
treeLine: !!Ce,
|
|
1139
|
-
inputIcon: h,
|
|
1140
|
-
multiple: Ee,
|
|
1141
|
-
removeIcon: m,
|
|
1142
|
-
clearIcon: k,
|
|
1143
|
-
switcherIcon: (M) => ta(Y.value, De, M, t.leafIcon, Ce),
|
|
1144
|
-
showTreeIcon: _e,
|
|
1145
|
-
notFoundContent: P,
|
|
1146
|
-
getPopupContainer: S == null ? void 0 : S.value,
|
|
1147
|
-
treeMotion: null,
|
|
1148
|
-
dropdownClassName: se.value,
|
|
1149
|
-
choiceTransitionName: z.value,
|
|
1150
|
-
onChange: pe,
|
|
1151
|
-
onBlur: ue,
|
|
1152
|
-
onSearch: ge,
|
|
1153
|
-
onTreeExpand: me
|
|
1154
|
-
}, N), {}, {
|
|
1155
|
-
transitionName: T.value,
|
|
1156
|
-
customSlots: b(b({}, t), {
|
|
1157
|
-
treeCheckable: () => U("span", {
|
|
1158
|
-
class: `${c.value}-tree-checkbox-inner`
|
|
1159
|
-
}, null)
|
|
1160
|
-
}),
|
|
1161
|
-
maxTagPlaceholder: e.maxTagPlaceholder || t.maxTagPlaceholder,
|
|
1162
|
-
placement: D.value,
|
|
1163
|
-
showArrow: J || Pe,
|
|
1164
|
-
placeholder: Fe
|
|
1165
|
-
}), b(b({}, t), {
|
|
1166
|
-
treeCheckable: () => U("span", {
|
|
1167
|
-
class: `${c.value}-tree-checkbox-inner`
|
|
1168
|
-
}, null)
|
|
1169
|
-
}))));
|
|
1170
|
-
};
|
|
1171
|
-
}
|
|
1172
|
-
}), st = he, ct = b(Ue, {
|
|
1173
|
-
TreeNode: he,
|
|
1174
|
-
SHOW_ALL: da,
|
|
1175
|
-
SHOW_PARENT: vt,
|
|
1176
|
-
SHOW_CHILD: Qe,
|
|
1177
|
-
install: (e) => (e.component(Ue.name, Ue), e.component(st.displayName, st), e)
|
|
1178
|
-
}), ze = yt({});
|
|
1179
|
-
function Na(e) {
|
|
1180
|
-
return be(() => e.categoryList, (s) => {
|
|
1181
|
-
s.forEach(async (l) => {
|
|
1182
|
-
if (!ze[l.id]) {
|
|
1183
|
-
const t = await Kt.getCategoryValues(l.id), { flatAttributeValue: a, treeAttributeValue: n, showWay: o } = t.body;
|
|
1184
|
-
ze[l.id] = o === "TREE" ? n : a;
|
|
1185
|
-
}
|
|
1186
|
-
});
|
|
1187
|
-
}, { immediate: !0, deep: !0 }), {
|
|
1188
|
-
categoryValuesMap: ze
|
|
1189
|
-
};
|
|
1190
|
-
}
|
|
1191
|
-
const Ta = { class: "crane-required" }, La = { class: "crane-category-tips" }, Ea = {
|
|
1192
|
-
key: 0,
|
|
1193
|
-
style: { color: "#1677ff", "font-weight": "bold" }
|
|
1194
|
-
}, _a = { key: 1 }, Pa = {
|
|
1195
|
-
key: 0,
|
|
1196
|
-
style: { color: "#ff4d4f", "font-size": "12px" }
|
|
1197
|
-
}, Da = /* @__PURE__ */ Ve({
|
|
1198
|
-
__name: "category-selector",
|
|
1199
|
-
props: {
|
|
1200
|
-
categoryList: {
|
|
1201
|
-
type: Array,
|
|
1202
|
-
default: () => []
|
|
1203
|
-
}
|
|
1204
|
-
},
|
|
1205
|
-
setup(e, { expose: s }) {
|
|
1206
|
-
const l = ct.SHOW_PARENT, t = e, a = y(() => ({
|
|
1207
|
-
categoryList: t.categoryList
|
|
1208
|
-
})), n = y(() => Object.values(d).some((u) => u.length > 0)), o = fe(), r = fe(""), { categoryValuesMap: d } = Na(t);
|
|
1209
|
-
return s({
|
|
1210
|
-
validate: () => new Promise((u, f) => {
|
|
1211
|
-
o.value.validate().then(() => {
|
|
1212
|
-
u(!0);
|
|
1213
|
-
}).catch(() => {
|
|
1214
|
-
f(!1);
|
|
1215
|
-
});
|
|
1216
|
-
})
|
|
1217
|
-
}), (u, f) => n.value ? (ie(), Ze(W(la), {
|
|
1218
|
-
key: 0,
|
|
1219
|
-
class: "crane-category-wraper",
|
|
1220
|
-
model: a.value,
|
|
1221
|
-
ref_key: "formRef",
|
|
1222
|
-
ref: o
|
|
1223
|
-
}, {
|
|
1224
|
-
default: Re(() => [
|
|
1225
|
-
je("div", Ta, ye(W(xe)("category")), 1),
|
|
1226
|
-
je("div", La, ye(W(xe)("categotySelectTips")), 1),
|
|
1227
|
-
f[1] || (f[1] = je("div", { class: "crane-category-line" }, null, -1)),
|
|
1228
|
-
(ie(!0), we(bt, null, Ct(a.value.categoryList, (p, w) => {
|
|
1229
|
-
var x;
|
|
1230
|
-
return St((ie(), Ze(W(aa), {
|
|
1231
|
-
key: p.id,
|
|
1232
|
-
label: p.categoryName,
|
|
1233
|
-
name: ["categoryList", w, "attributeValueIds_view"],
|
|
1234
|
-
rules: [{ required: !0, message: W(xe)("pleaseChoose"), trigger: ["change", "blur"] }]
|
|
1235
|
-
}, {
|
|
1236
|
-
default: Re(() => {
|
|
1237
|
-
var S;
|
|
1238
|
-
return [
|
|
1239
|
-
U(W(ct), {
|
|
1240
|
-
treeCheckable: "",
|
|
1241
|
-
treeDefaultExpandAll: "",
|
|
1242
|
-
"tree-data": W(d)[p.id],
|
|
1243
|
-
showSearch: "",
|
|
1244
|
-
allowClear: "",
|
|
1245
|
-
value: p.attributeValueIds_view,
|
|
1246
|
-
"onUpdate:value": (g) => p.attributeValueIds_view = g,
|
|
1247
|
-
treeNodeFilterProp: "attributeName",
|
|
1248
|
-
searchValue: r.value,
|
|
1249
|
-
"onUpdate:searchValue": f[0] || (f[0] = (g) => r.value = g),
|
|
1250
|
-
fieldNames: { label: "attributeName", value: "id" },
|
|
1251
|
-
treeNodeLabelProp: "attributeName",
|
|
1252
|
-
"show-checked-strategy": W(l)
|
|
1253
|
-
}, {
|
|
1254
|
-
title: Re(({ attributeName: g }) => [
|
|
1255
|
-
r.value.toLowerCase() && g.includes(r.value.toLowerCase()) ? (ie(), we("span", Ea, ye(g), 1)) : (ie(), we("span", _a, ye(g), 1))
|
|
1256
|
-
]),
|
|
1257
|
-
_: 2
|
|
1258
|
-
}, 1032, ["tree-data", "value", "onUpdate:value", "searchValue", "show-checked-strategy"]),
|
|
1259
|
-
(S = p.attributeValueIds_view) != null && S.includes(-1) ? (ie(), we("span", Pa, ye(W(xe)("categoryChangeTips", { category: p.categoryName })), 1)) : et("", !0)
|
|
1260
|
-
];
|
|
1261
|
-
}),
|
|
1262
|
-
_: 2
|
|
1263
|
-
}, 1032, ["label", "name", "rules"])), [
|
|
1264
|
-
[wt, (x = W(d)[p.id]) == null ? void 0 : x.length]
|
|
1265
|
-
]);
|
|
1266
|
-
}), 128))
|
|
1267
|
-
]),
|
|
1268
|
-
_: 1,
|
|
1269
|
-
__: [1]
|
|
1270
|
-
}, 8, ["model"])) : et("", !0);
|
|
1271
|
-
}
|
|
1272
|
-
}), Ha = /* @__PURE__ */ Ft(Da, [["__scopeId", "data-v-21167b98"]]);
|
|
1273
|
-
export {
|
|
1274
|
-
Ha as default
|
|
1275
|
-
};
|