@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
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
import { a as ht, p as pt, d as Ie, r as he, c as m, w as Se, q as gt, s as j, E as ae, e as U, b as Qe, y as oe, a0 as mt, G as yt, K as et, R as je, L as re, M as Be, P as $e, N as be, S as de, u as H, F as bt, Y as Ct, j as St, z as wt } from "./index-CSnwgcu-.js";
|
|
2
|
+
import { a as X, _ as y, W as xt, X as Vt, ae as ut, aX as tt, Y as ke, P as fe, N as It, Q as it, V as kt, aN as We, a0 as Nt, 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 Ce, aS as Ft } from "./yqg-permission-D0O9c9lI.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-BkbJOH6j.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-OokdyEmj.js";
|
|
5
|
+
function na(e) {
|
|
6
|
+
return Array.isArray(e) ? e : e !== void 0 ? [e] : [];
|
|
7
|
+
}
|
|
8
|
+
function oa(e) {
|
|
9
|
+
const {
|
|
10
|
+
label: r,
|
|
11
|
+
value: o,
|
|
12
|
+
children: a
|
|
13
|
+
} = e || {}, t = o || "value";
|
|
14
|
+
return {
|
|
15
|
+
_title: r ? [r] : ["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 ra(e, r) {
|
|
25
|
+
const o = [];
|
|
26
|
+
function a(t) {
|
|
27
|
+
t.forEach((n) => {
|
|
28
|
+
o.push(n[r.value]);
|
|
29
|
+
const l = n[r.children];
|
|
30
|
+
l && a(l);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return a(e), o;
|
|
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 = Ie({
|
|
55
|
+
compatConfig: {
|
|
56
|
+
MODE: 3
|
|
57
|
+
},
|
|
58
|
+
name: "OptionList",
|
|
59
|
+
inheritAttrs: !1,
|
|
60
|
+
setup(e, r) {
|
|
61
|
+
let {
|
|
62
|
+
slots: o,
|
|
63
|
+
expose: a
|
|
64
|
+
} = r;
|
|
65
|
+
const t = Ot(), n = Ht(), l = ca(), s = he(), d = Mt(() => l.treeData, [() => t.open, () => l.treeData], (v) => v[0]), c = m(() => {
|
|
66
|
+
const {
|
|
67
|
+
checkable: v,
|
|
68
|
+
halfCheckedKeys: w,
|
|
69
|
+
checkedKeys: E
|
|
70
|
+
} = n;
|
|
71
|
+
return v ? {
|
|
72
|
+
checked: E,
|
|
73
|
+
halfChecked: w
|
|
74
|
+
} : null;
|
|
75
|
+
});
|
|
76
|
+
Se(() => t.open, () => {
|
|
77
|
+
gt(() => {
|
|
78
|
+
var v;
|
|
79
|
+
t.open && !t.multiple && n.checkedKeys.length && ((v = s.value) === null || v === void 0 || v.scrollTo({
|
|
80
|
+
key: n.checkedKeys[0]
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
}, {
|
|
84
|
+
immediate: !0,
|
|
85
|
+
flush: "post"
|
|
86
|
+
});
|
|
87
|
+
const i = m(() => String(t.searchValue).toLowerCase()), p = (v) => i.value ? String(v[n.treeNodeFilterProp]).toLowerCase().includes(i.value) : !1, b = j(n.treeDefaultExpandedKeys), f = j(null);
|
|
88
|
+
Se(() => t.searchValue, () => {
|
|
89
|
+
t.searchValue && (f.value = ra(ae(l.treeData), ae(l.fieldNames)));
|
|
90
|
+
}, {
|
|
91
|
+
immediate: !0
|
|
92
|
+
});
|
|
93
|
+
const x = m(() => n.treeExpandedKeys ? n.treeExpandedKeys.slice() : t.searchValue ? f.value : b.value), S = (v) => {
|
|
94
|
+
var w;
|
|
95
|
+
b.value = v, f.value = v, (w = n.onTreeExpand) === null || w === void 0 || w.call(n, v);
|
|
96
|
+
}, V = (v) => {
|
|
97
|
+
v.preventDefault();
|
|
98
|
+
}, N = (v, w) => {
|
|
99
|
+
let {
|
|
100
|
+
node: E
|
|
101
|
+
} = w;
|
|
102
|
+
var A, L;
|
|
103
|
+
const {
|
|
104
|
+
checkable: z,
|
|
105
|
+
checkedKeys: Y
|
|
106
|
+
} = n;
|
|
107
|
+
z && qe(E) || ((A = l.onSelect) === null || A === void 0 || A.call(l, E.key, {
|
|
108
|
+
selected: !Y.includes(E.key)
|
|
109
|
+
}), t.multiple || (L = t.toggleOpen) === null || L === void 0 || L.call(t, !1));
|
|
110
|
+
}, K = he(null), F = m(() => n.keyEntities[K.value]), O = (v) => {
|
|
111
|
+
K.value = v;
|
|
112
|
+
};
|
|
113
|
+
return a({
|
|
114
|
+
scrollTo: function() {
|
|
115
|
+
for (var v, w, E = arguments.length, A = new Array(E), L = 0; L < E; L++)
|
|
116
|
+
A[L] = arguments[L];
|
|
117
|
+
return (w = (v = s.value) === null || v === void 0 ? void 0 : v.scrollTo) === null || w === void 0 ? void 0 : w.call(v, ...A);
|
|
118
|
+
},
|
|
119
|
+
onKeydown: (v) => {
|
|
120
|
+
var w;
|
|
121
|
+
const {
|
|
122
|
+
which: E
|
|
123
|
+
} = v;
|
|
124
|
+
switch (E) {
|
|
125
|
+
case ve.UP:
|
|
126
|
+
case ve.DOWN:
|
|
127
|
+
case ve.LEFT:
|
|
128
|
+
case ve.RIGHT:
|
|
129
|
+
(w = s.value) === null || w === void 0 || w.onKeydown(v);
|
|
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 && N(null, {
|
|
138
|
+
node: {
|
|
139
|
+
key: K.value
|
|
140
|
+
},
|
|
141
|
+
selected: !n.checkedKeys.includes(L)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case ve.ESC:
|
|
147
|
+
t.toggleOpen(!1);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
onKeyup: () => {
|
|
151
|
+
}
|
|
152
|
+
}), () => {
|
|
153
|
+
var v;
|
|
154
|
+
const {
|
|
155
|
+
prefixCls: w,
|
|
156
|
+
multiple: E,
|
|
157
|
+
searchValue: A,
|
|
158
|
+
open: L,
|
|
159
|
+
notFoundContent: z = (v = o.notFoundContent) === null || v === void 0 ? void 0 : v.call(o)
|
|
160
|
+
} = t, {
|
|
161
|
+
listHeight: Y,
|
|
162
|
+
listItemHeight: B,
|
|
163
|
+
virtual: le,
|
|
164
|
+
dropdownMatchSelectWidth: q,
|
|
165
|
+
treeExpandAction: se
|
|
166
|
+
} = l, {
|
|
167
|
+
checkable: ce,
|
|
168
|
+
treeDefaultExpandAll: ue,
|
|
169
|
+
treeIcon: ne,
|
|
170
|
+
showTreeIcon: G,
|
|
171
|
+
switcherIcon: ge,
|
|
172
|
+
treeLine: me,
|
|
173
|
+
loadData: ye,
|
|
174
|
+
treeLoadedKeys: ie,
|
|
175
|
+
treeMotion: C,
|
|
176
|
+
onTreeLoad: D,
|
|
177
|
+
checkedKeys: M
|
|
178
|
+
} = n;
|
|
179
|
+
if (d.value.length === 0)
|
|
180
|
+
return U("div", {
|
|
181
|
+
role: "listbox",
|
|
182
|
+
class: `${w}-empty`,
|
|
183
|
+
onMousedown: V
|
|
184
|
+
}, [z]);
|
|
185
|
+
const Q = {
|
|
186
|
+
fieldNames: l.fieldNames
|
|
187
|
+
};
|
|
188
|
+
return ie && (Q.loadedKeys = ie), x.value && (Q.expandedKeys = x.value), U("div", {
|
|
189
|
+
onMousedown: V
|
|
190
|
+
}, [F.value && L && U("span", {
|
|
191
|
+
style: ua,
|
|
192
|
+
"aria-live": "assertive"
|
|
193
|
+
}, [F.value.node.value]), U(zt, X(X({
|
|
194
|
+
ref: s,
|
|
195
|
+
focusable: !1,
|
|
196
|
+
prefixCls: `${w}-tree`,
|
|
197
|
+
treeData: d.value,
|
|
198
|
+
height: Y,
|
|
199
|
+
itemHeight: B,
|
|
200
|
+
virtual: le !== !1 && q !== !1,
|
|
201
|
+
multiple: E,
|
|
202
|
+
icon: ne,
|
|
203
|
+
showIcon: G,
|
|
204
|
+
switcherIcon: ge,
|
|
205
|
+
showLine: me,
|
|
206
|
+
loadData: A ? null : ye,
|
|
207
|
+
motion: C,
|
|
208
|
+
activeKey: K.value,
|
|
209
|
+
checkable: ce,
|
|
210
|
+
checkStrictly: !0,
|
|
211
|
+
checkedKeys: c.value,
|
|
212
|
+
selectedKeys: ce ? [] : M,
|
|
213
|
+
defaultExpandAll: ue
|
|
214
|
+
}, Q), {}, {
|
|
215
|
+
onActiveChange: O,
|
|
216
|
+
onSelect: N,
|
|
217
|
+
onCheck: N,
|
|
218
|
+
onExpand: S,
|
|
219
|
+
onLoad: D,
|
|
220
|
+
filterTreeNode: p,
|
|
221
|
+
expandAction: se
|
|
222
|
+
}), y(y({}, o), {
|
|
223
|
+
checkable: n.customSlots.treeCheckable
|
|
224
|
+
}))]);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}), da = "SHOW_ALL", vt = "SHOW_PARENT", Je = "SHOW_CHILD";
|
|
228
|
+
function ot(e, r, o, a) {
|
|
229
|
+
const t = new Set(e);
|
|
230
|
+
return r === Je ? e.filter((n) => {
|
|
231
|
+
const l = o[n];
|
|
232
|
+
return !(l && l.children && l.children.some((s) => {
|
|
233
|
+
let {
|
|
234
|
+
node: d
|
|
235
|
+
} = s;
|
|
236
|
+
return t.has(d[a.value]);
|
|
237
|
+
}) && l.children.every((s) => {
|
|
238
|
+
let {
|
|
239
|
+
node: d
|
|
240
|
+
} = s;
|
|
241
|
+
return qe(d) || t.has(d[a.value]);
|
|
242
|
+
}));
|
|
243
|
+
}) : r === vt ? e.filter((n) => {
|
|
244
|
+
const l = o[n], s = l ? l.parent : null;
|
|
245
|
+
return !(s && !qe(s.node) && t.has(s.key));
|
|
246
|
+
}) : e;
|
|
247
|
+
}
|
|
248
|
+
const pe = () => null;
|
|
249
|
+
pe.inheritAttrs = !1;
|
|
250
|
+
pe.displayName = "ATreeSelectNode";
|
|
251
|
+
pe.isTreeSelectNode = !0;
|
|
252
|
+
var va = function(e, r) {
|
|
253
|
+
var o = {};
|
|
254
|
+
for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && r.indexOf(a) < 0 && (o[a] = e[a]);
|
|
255
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var t = 0, a = Object.getOwnPropertySymbols(e); t < a.length; t++)
|
|
256
|
+
r.indexOf(a[t]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[t]) && (o[a[t]] = e[a[t]]);
|
|
257
|
+
return o;
|
|
258
|
+
};
|
|
259
|
+
function fa(e) {
|
|
260
|
+
return e && e.type && e.type.isTreeSelectNode;
|
|
261
|
+
}
|
|
262
|
+
function ha(e) {
|
|
263
|
+
function r() {
|
|
264
|
+
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
265
|
+
return xt(o).map((a) => {
|
|
266
|
+
var t, n, l;
|
|
267
|
+
if (!fa(a))
|
|
268
|
+
return null;
|
|
269
|
+
const s = a.children || {}, d = a.key, c = {};
|
|
270
|
+
for (const [E, A] of Object.entries(a.props))
|
|
271
|
+
c[Vt(E)] = A;
|
|
272
|
+
const {
|
|
273
|
+
isLeaf: i,
|
|
274
|
+
checkable: p,
|
|
275
|
+
selectable: b,
|
|
276
|
+
disabled: f,
|
|
277
|
+
disableCheckbox: x
|
|
278
|
+
} = c, S = {
|
|
279
|
+
isLeaf: i || i === "" || void 0,
|
|
280
|
+
checkable: p || p === "" || void 0,
|
|
281
|
+
selectable: b || b === "" || void 0,
|
|
282
|
+
disabled: f || f === "" || void 0,
|
|
283
|
+
disableCheckbox: x || x === "" || void 0
|
|
284
|
+
}, V = y(y({}, c), S), {
|
|
285
|
+
title: N = (t = s.title) === null || t === void 0 ? void 0 : t.call(s, V),
|
|
286
|
+
switcherIcon: K = (n = s.switcherIcon) === null || n === void 0 ? void 0 : n.call(s, V)
|
|
287
|
+
} = c, F = va(c, ["title", "switcherIcon"]), O = (l = s.default) === null || l === void 0 ? void 0 : l.call(s), v = y(y(y({}, F), {
|
|
288
|
+
title: N,
|
|
289
|
+
switcherIcon: K,
|
|
290
|
+
key: d,
|
|
291
|
+
isLeaf: i
|
|
292
|
+
}), S), w = r(O);
|
|
293
|
+
return w.length && (v.children = w), v;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return r(e);
|
|
297
|
+
}
|
|
298
|
+
function Ge(e) {
|
|
299
|
+
if (!e)
|
|
300
|
+
return e;
|
|
301
|
+
const r = y({}, e);
|
|
302
|
+
return "props" in r || Object.defineProperty(r, "props", {
|
|
303
|
+
get() {
|
|
304
|
+
return r;
|
|
305
|
+
}
|
|
306
|
+
}), r;
|
|
307
|
+
}
|
|
308
|
+
function pa(e, r, o, a, t, n) {
|
|
309
|
+
let l = null, s = null;
|
|
310
|
+
function d() {
|
|
311
|
+
function c(i) {
|
|
312
|
+
let p = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "0", b = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
313
|
+
return i.map((f, x) => {
|
|
314
|
+
const S = `${p}-${x}`, V = f[n.value], N = o.includes(V), K = c(f[n.children] || [], S, N), F = U(pe, f, {
|
|
315
|
+
default: () => [K.map((O) => O.node)]
|
|
316
|
+
});
|
|
317
|
+
if (r === V && (l = F), N) {
|
|
318
|
+
const O = {
|
|
319
|
+
pos: S,
|
|
320
|
+
node: F,
|
|
321
|
+
children: K
|
|
322
|
+
};
|
|
323
|
+
return b || s.push(O), O;
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}).filter((f) => f);
|
|
327
|
+
}
|
|
328
|
+
s || (s = [], c(a), s.sort((i, p) => {
|
|
329
|
+
let {
|
|
330
|
+
node: {
|
|
331
|
+
props: {
|
|
332
|
+
value: b
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
} = i, {
|
|
336
|
+
node: {
|
|
337
|
+
props: {
|
|
338
|
+
value: f
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
} = p;
|
|
342
|
+
const x = o.indexOf(b), S = o.indexOf(f);
|
|
343
|
+
return x - S;
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
Object.defineProperty(e, "triggerNode", {
|
|
347
|
+
get() {
|
|
348
|
+
return d(), l;
|
|
349
|
+
}
|
|
350
|
+
}), Object.defineProperty(e, "allCheckedNodes", {
|
|
351
|
+
get() {
|
|
352
|
+
return d(), t ? s : s.map((c) => {
|
|
353
|
+
let {
|
|
354
|
+
node: i
|
|
355
|
+
} = c;
|
|
356
|
+
return i;
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
function ga(e, r) {
|
|
362
|
+
let {
|
|
363
|
+
id: o,
|
|
364
|
+
pId: a,
|
|
365
|
+
rootPId: t
|
|
366
|
+
} = r;
|
|
367
|
+
const n = {}, l = [];
|
|
368
|
+
return e.map((d) => {
|
|
369
|
+
const c = y({}, d), i = c[o];
|
|
370
|
+
return n[i] = c, c.key = c.key || i, c;
|
|
371
|
+
}).forEach((d) => {
|
|
372
|
+
const c = d[a], i = n[c];
|
|
373
|
+
i && (i.children = i.children || [], i.children.push(d)), (c === t || !i && t === null) && l.push(d);
|
|
374
|
+
}), l;
|
|
375
|
+
}
|
|
376
|
+
function ma(e, r, o) {
|
|
377
|
+
const a = j();
|
|
378
|
+
return Se([o, e, r], () => {
|
|
379
|
+
const t = o.value;
|
|
380
|
+
e.value ? a.value = o.value ? ga(ae(e.value), y({
|
|
381
|
+
id: "id",
|
|
382
|
+
pId: "pId",
|
|
383
|
+
rootPId: null
|
|
384
|
+
}, t !== !0 ? t : {})) : ae(e.value).slice() : a.value = ha(ae(r.value));
|
|
385
|
+
}, {
|
|
386
|
+
immediate: !0,
|
|
387
|
+
deep: !0
|
|
388
|
+
}), a;
|
|
389
|
+
}
|
|
390
|
+
const ya = (e) => {
|
|
391
|
+
const r = j({
|
|
392
|
+
valueLabels: /* @__PURE__ */ new Map()
|
|
393
|
+
}), o = j();
|
|
394
|
+
return Se(e, () => {
|
|
395
|
+
o.value = ae(e.value);
|
|
396
|
+
}, {
|
|
397
|
+
immediate: !0
|
|
398
|
+
}), [m(() => {
|
|
399
|
+
const {
|
|
400
|
+
valueLabels: t
|
|
401
|
+
} = r.value, n = /* @__PURE__ */ new Map(), l = o.value.map((s) => {
|
|
402
|
+
var d;
|
|
403
|
+
const {
|
|
404
|
+
value: c
|
|
405
|
+
} = s, i = (d = s.label) !== null && d !== void 0 ? d : t.get(c);
|
|
406
|
+
return n.set(c, i), y(y({}, s), {
|
|
407
|
+
label: i
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
return r.value.valueLabels = n, l;
|
|
411
|
+
})];
|
|
412
|
+
}, ba = (e, r) => {
|
|
413
|
+
const o = j(/* @__PURE__ */ new Map()), a = j({});
|
|
414
|
+
return Qe(() => {
|
|
415
|
+
const t = r.value, n = Xt(e.value, {
|
|
416
|
+
fieldNames: t,
|
|
417
|
+
initWrapper: (l) => y(y({}, l), {
|
|
418
|
+
valueEntities: /* @__PURE__ */ new Map()
|
|
419
|
+
}),
|
|
420
|
+
processEntity: (l, s) => {
|
|
421
|
+
const d = l.node[t.value];
|
|
422
|
+
s.valueEntities.set(d, l);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
o.value = n.valueEntities, a.value = n.keyEntities;
|
|
426
|
+
}), {
|
|
427
|
+
valueEntities: o,
|
|
428
|
+
keyEntities: a
|
|
429
|
+
};
|
|
430
|
+
}, Ca = (e, r, o, a, t, n) => {
|
|
431
|
+
const l = j([]), s = j([]);
|
|
432
|
+
return Qe(() => {
|
|
433
|
+
let d = e.value.map((p) => {
|
|
434
|
+
let {
|
|
435
|
+
value: b
|
|
436
|
+
} = p;
|
|
437
|
+
return b;
|
|
438
|
+
}), c = r.value.map((p) => {
|
|
439
|
+
let {
|
|
440
|
+
value: b
|
|
441
|
+
} = p;
|
|
442
|
+
return b;
|
|
443
|
+
});
|
|
444
|
+
const i = d.filter((p) => !a.value[p]);
|
|
445
|
+
o.value && ({
|
|
446
|
+
checkedKeys: d,
|
|
447
|
+
halfCheckedKeys: c
|
|
448
|
+
} = Ye(d, !0, a.value, t.value, n.value)), l.value = Array.from(/* @__PURE__ */ new Set([...i, ...d])), s.value = c;
|
|
449
|
+
}), [l, s];
|
|
450
|
+
}, Sa = (e, r, o) => {
|
|
451
|
+
let {
|
|
452
|
+
treeNodeFilterProp: a,
|
|
453
|
+
filterTreeNode: t,
|
|
454
|
+
fieldNames: n
|
|
455
|
+
} = o;
|
|
456
|
+
return m(() => {
|
|
457
|
+
const {
|
|
458
|
+
children: l
|
|
459
|
+
} = n.value, s = r.value, d = a == null ? void 0 : a.value;
|
|
460
|
+
if (!s || t.value === !1)
|
|
461
|
+
return e.value;
|
|
462
|
+
let c;
|
|
463
|
+
if (typeof t.value == "function")
|
|
464
|
+
c = t.value;
|
|
465
|
+
else {
|
|
466
|
+
const p = s.toUpperCase();
|
|
467
|
+
c = (b, f) => {
|
|
468
|
+
const x = f[d];
|
|
469
|
+
return String(x).toUpperCase().includes(p);
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
function i(p) {
|
|
473
|
+
let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
474
|
+
const f = [];
|
|
475
|
+
for (let x = 0, S = p.length; x < S; x++) {
|
|
476
|
+
const V = p[x], N = V[l], K = b || c(s, Ge(V)), F = i(N || [], K);
|
|
477
|
+
(K || F.length) && f.push(y(y({}, V), {
|
|
478
|
+
[l]: F
|
|
479
|
+
}));
|
|
480
|
+
}
|
|
481
|
+
return f;
|
|
482
|
+
}
|
|
483
|
+
return i(e.value);
|
|
484
|
+
});
|
|
485
|
+
};
|
|
486
|
+
function ft() {
|
|
487
|
+
return y(y({}, ke($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: fe.any,
|
|
588
|
+
showTreeIcon: {
|
|
589
|
+
type: Boolean,
|
|
590
|
+
default: void 0
|
|
591
|
+
},
|
|
592
|
+
switcherIcon: fe.any,
|
|
593
|
+
treeMotion: fe.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: fe.any,
|
|
617
|
+
maxTagPlaceholder: {
|
|
618
|
+
type: Function
|
|
619
|
+
},
|
|
620
|
+
dropdownPopupAlign: fe.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: ut(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, r) {
|
|
642
|
+
let {
|
|
643
|
+
attrs: o,
|
|
644
|
+
expose: a,
|
|
645
|
+
slots: t
|
|
646
|
+
} = r;
|
|
647
|
+
const n = Rt(oe(e, "id")), l = m(() => e.treeCheckable && !e.treeCheckStrictly), s = m(() => e.treeCheckable || e.treeCheckStrictly), d = m(() => e.treeCheckStrictly || e.labelInValue), c = m(() => s.value || e.multiple), i = m(() => oa(e.fieldNames)), [p, b] = tt("", {
|
|
648
|
+
value: m(() => e.searchValue !== void 0 ? e.searchValue : e.inputValue),
|
|
649
|
+
postState: (u) => u || ""
|
|
650
|
+
}), f = (u) => {
|
|
651
|
+
var h;
|
|
652
|
+
b(u), (h = e.onSearch) === null || h === void 0 || h.call(e, u);
|
|
653
|
+
}, x = ma(oe(e, "treeData"), oe(e, "children"), oe(e, "treeDataSimpleMode")), {
|
|
654
|
+
keyEntities: S,
|
|
655
|
+
valueEntities: V
|
|
656
|
+
} = ba(x, i), N = (u) => {
|
|
657
|
+
const h = [], g = [];
|
|
658
|
+
return u.forEach((k) => {
|
|
659
|
+
V.value.has(k) ? g.push(k) : h.push(k);
|
|
660
|
+
}), {
|
|
661
|
+
missingRawValues: h,
|
|
662
|
+
existRawValues: g
|
|
663
|
+
};
|
|
664
|
+
}, K = Sa(x, p, {
|
|
665
|
+
fieldNames: i,
|
|
666
|
+
treeNodeFilterProp: oe(e, "treeNodeFilterProp"),
|
|
667
|
+
filterTreeNode: oe(e, "filterTreeNode")
|
|
668
|
+
}), F = (u) => {
|
|
669
|
+
if (u) {
|
|
670
|
+
if (e.treeNodeLabelProp)
|
|
671
|
+
return u[e.treeNodeLabelProp];
|
|
672
|
+
const {
|
|
673
|
+
_title: h
|
|
674
|
+
} = i.value;
|
|
675
|
+
for (let g = 0; g < h.length; g += 1) {
|
|
676
|
+
const k = u[h[g]];
|
|
677
|
+
if (k !== void 0)
|
|
678
|
+
return k;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}, O = (u) => na(u).map((g) => wa(g) ? {
|
|
682
|
+
value: g
|
|
683
|
+
} : g), v = (u) => O(u).map((g) => {
|
|
684
|
+
let {
|
|
685
|
+
label: k
|
|
686
|
+
} = g;
|
|
687
|
+
const {
|
|
688
|
+
value: P,
|
|
689
|
+
halfChecked: _
|
|
690
|
+
} = g;
|
|
691
|
+
let I;
|
|
692
|
+
const T = V.value.get(P);
|
|
693
|
+
return T && (k = k ?? F(T.node), I = T.node.disabled), {
|
|
694
|
+
label: k,
|
|
695
|
+
value: P,
|
|
696
|
+
halfChecked: _,
|
|
697
|
+
disabled: I
|
|
698
|
+
};
|
|
699
|
+
}), [w, E] = tt(e.defaultValue, {
|
|
700
|
+
value: oe(e, "value")
|
|
701
|
+
}), A = m(() => O(w.value)), L = j([]), z = j([]);
|
|
702
|
+
Qe(() => {
|
|
703
|
+
const u = [], h = [];
|
|
704
|
+
A.value.forEach((g) => {
|
|
705
|
+
g.halfChecked ? h.push(g) : u.push(g);
|
|
706
|
+
}), L.value = u, z.value = h;
|
|
707
|
+
});
|
|
708
|
+
const Y = m(() => L.value.map((u) => u.value)), {
|
|
709
|
+
maxLevel: B,
|
|
710
|
+
levelEntities: le
|
|
711
|
+
} = Yt(S), [q, se] = Ca(L, z, l, S, B, le), ce = m(() => {
|
|
712
|
+
const g = ot(q.value, e.showCheckedStrategy, S.value, i.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[i.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
|
+
}), k = v(g), P = k[0];
|
|
722
|
+
return !c.value && P && nt(P.value) && nt(P.label) ? [] : k.map((_) => {
|
|
723
|
+
var I;
|
|
724
|
+
return y(y({}, _), {
|
|
725
|
+
label: (I = _.label) !== null && I !== void 0 ? I : _.value
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
}), [ue] = ya(ce), ne = (u, h, g) => {
|
|
729
|
+
const k = v(u);
|
|
730
|
+
if (E(k), e.autoClearSearchValue && b(""), e.onChange) {
|
|
731
|
+
let P = u;
|
|
732
|
+
l.value && (P = ot(u, e.showCheckedStrategy, S.value, i.value).map((te) => {
|
|
733
|
+
const xe = V.value.get(te);
|
|
734
|
+
return xe ? xe.node[i.value.value] : te;
|
|
735
|
+
}));
|
|
736
|
+
const {
|
|
737
|
+
triggerValue: _,
|
|
738
|
+
selected: I
|
|
739
|
+
} = h || {
|
|
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 = v(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 || g === "selection" && !I) && (ee = !1), pa(Z, _, u, x.value, ee, i.value), s.value ? Z.checked = I : Z.selected = I;
|
|
755
|
+
const $ = d.value ? R : R.map((W) => W.value);
|
|
756
|
+
e.onChange(c.value ? $ : $[0], d.value ? null : R.map((W) => W.label), Z);
|
|
757
|
+
}
|
|
758
|
+
}, G = (u, h) => {
|
|
759
|
+
let {
|
|
760
|
+
selected: g,
|
|
761
|
+
source: k
|
|
762
|
+
} = h;
|
|
763
|
+
var P, _, I;
|
|
764
|
+
const T = ae(S.value), R = ae(V.value), Z = T[u], ee = Z == null ? void 0 : Z.node, $ = (P = ee == null ? void 0 : ee[i.value.value]) !== null && P !== void 0 ? P : u;
|
|
765
|
+
if (!c.value)
|
|
766
|
+
ne([$], {
|
|
767
|
+
selected: !0,
|
|
768
|
+
triggerValue: $
|
|
769
|
+
}, "option");
|
|
770
|
+
else {
|
|
771
|
+
let W = g ? [...Y.value, $] : q.value.filter((te) => te !== $);
|
|
772
|
+
if (l.value) {
|
|
773
|
+
const {
|
|
774
|
+
missingRawValues: te,
|
|
775
|
+
existRawValues: xe
|
|
776
|
+
} = N(W), Ze = xe.map((Re) => R.get(Re).key);
|
|
777
|
+
let Me;
|
|
778
|
+
g ? {
|
|
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[i.value.value])];
|
|
785
|
+
}
|
|
786
|
+
ne(W, {
|
|
787
|
+
selected: g,
|
|
788
|
+
triggerValue: $
|
|
789
|
+
}, k || "option");
|
|
790
|
+
}
|
|
791
|
+
g || !c.value ? (_ = e.onSelect) === null || _ === void 0 || _.call(e, $, Ge(ee)) : (I = e.onDeselect) === null || I === void 0 || I.call(e, $, Ge(ee));
|
|
792
|
+
}, ge = (u) => {
|
|
793
|
+
if (e.onDropdownVisibleChange) {
|
|
794
|
+
const h = {};
|
|
795
|
+
Object.defineProperty(h, "documentClickClose", {
|
|
796
|
+
get() {
|
|
797
|
+
return !1;
|
|
798
|
+
}
|
|
799
|
+
}), e.onDropdownVisibleChange(u, h);
|
|
800
|
+
}
|
|
801
|
+
}, me = (u, h) => {
|
|
802
|
+
const g = u.map((k) => k.value);
|
|
803
|
+
if (h.type === "clear") {
|
|
804
|
+
ne(g, {}, "selection");
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
h.values.length && G(h.values[0].value, {
|
|
808
|
+
selected: !1,
|
|
809
|
+
source: "selection"
|
|
810
|
+
});
|
|
811
|
+
}, {
|
|
812
|
+
treeNodeFilterProp: ye,
|
|
813
|
+
// Data
|
|
814
|
+
loadData: ie,
|
|
815
|
+
treeLoadedKeys: C,
|
|
816
|
+
onTreeLoad: D,
|
|
817
|
+
// Expanded
|
|
818
|
+
treeDefaultExpandAll: M,
|
|
819
|
+
treeExpandedKeys: Q,
|
|
820
|
+
treeDefaultExpandedKeys: Ne,
|
|
821
|
+
onTreeExpand: Te,
|
|
822
|
+
// Options
|
|
823
|
+
virtual: Le,
|
|
824
|
+
listHeight: _e,
|
|
825
|
+
listItemHeight: Ee,
|
|
826
|
+
// Tree
|
|
827
|
+
treeLine: De,
|
|
828
|
+
treeIcon: we,
|
|
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: s,
|
|
838
|
+
loadData: ie,
|
|
839
|
+
treeLoadedKeys: C,
|
|
840
|
+
onTreeLoad: D,
|
|
841
|
+
checkedKeys: q,
|
|
842
|
+
halfCheckedKeys: se,
|
|
843
|
+
treeDefaultExpandAll: M,
|
|
844
|
+
treeExpandedKeys: Q,
|
|
845
|
+
treeDefaultExpandedKeys: Ne,
|
|
846
|
+
onTreeExpand: Te,
|
|
847
|
+
treeIcon: we,
|
|
848
|
+
treeMotion: Ke,
|
|
849
|
+
showTreeIcon: Pe,
|
|
850
|
+
switcherIcon: Ae,
|
|
851
|
+
treeLine: De,
|
|
852
|
+
treeNodeFilterProp: ye,
|
|
853
|
+
keyEntities: S,
|
|
854
|
+
customSlots: Fe
|
|
855
|
+
})), sa(lt({
|
|
856
|
+
virtual: Le,
|
|
857
|
+
listHeight: _e,
|
|
858
|
+
listItemHeight: Ee,
|
|
859
|
+
treeData: K,
|
|
860
|
+
fieldNames: i,
|
|
861
|
+
onSelect: G,
|
|
862
|
+
dropdownMatchSelectWidth: Oe,
|
|
863
|
+
treeExpandAction: He
|
|
864
|
+
}));
|
|
865
|
+
const J = he();
|
|
866
|
+
return a({
|
|
867
|
+
focus() {
|
|
868
|
+
var u;
|
|
869
|
+
(u = J.value) === null || u === void 0 || u.focus();
|
|
870
|
+
},
|
|
871
|
+
blur() {
|
|
872
|
+
var u;
|
|
873
|
+
(u = J.value) === null || u === void 0 || u.blur();
|
|
874
|
+
},
|
|
875
|
+
scrollTo(u) {
|
|
876
|
+
var h;
|
|
877
|
+
(h = J.value) === null || h === void 0 || h.scrollTo(u);
|
|
878
|
+
}
|
|
879
|
+
}), () => {
|
|
880
|
+
var u;
|
|
881
|
+
const h = ke(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
|
+
}, o), h), {}, {
|
|
935
|
+
id: n,
|
|
936
|
+
prefixCls: e.prefixCls,
|
|
937
|
+
mode: c.value ? "multiple" : void 0,
|
|
938
|
+
displayValues: ue.value,
|
|
939
|
+
onDisplayValuesChange: me,
|
|
940
|
+
searchValue: p.value,
|
|
941
|
+
onSearch: f,
|
|
942
|
+
OptionList: ia,
|
|
943
|
+
emptyOptions: !x.value.length,
|
|
944
|
+
onDropdownVisibleChange: ge,
|
|
945
|
+
tagRender: e.tagRender || t.tagRender,
|
|
946
|
+
dropdownMatchSelectWidth: (u = e.dropdownMatchSelectWidth) !== null && u !== void 0 ? u : !0
|
|
947
|
+
}), t);
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
}), Va = (e) => {
|
|
951
|
+
const {
|
|
952
|
+
componentCls: r,
|
|
953
|
+
treePrefixCls: o,
|
|
954
|
+
colorBgElevated: a
|
|
955
|
+
} = e, t = `.${o}`;
|
|
956
|
+
return [
|
|
957
|
+
// ======================================================
|
|
958
|
+
// == Dropdown ==
|
|
959
|
+
// ======================================================
|
|
960
|
+
{
|
|
961
|
+
[`${r}-dropdown`]: [
|
|
962
|
+
{
|
|
963
|
+
padding: `${e.paddingXS}px ${e.paddingXS / 2}px`
|
|
964
|
+
},
|
|
965
|
+
// ====================== Tree ======================
|
|
966
|
+
qt(o, it(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(`${o}-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, r) {
|
|
1000
|
+
return It("TreeSelect", (o) => {
|
|
1001
|
+
const a = it(o, {
|
|
1002
|
+
treePrefixCls: r.value
|
|
1003
|
+
});
|
|
1004
|
+
return [Va(a)];
|
|
1005
|
+
})(e);
|
|
1006
|
+
}
|
|
1007
|
+
const rt = (e, r, o) => o !== void 0 ? o : `${e}-${r}`;
|
|
1008
|
+
function ka() {
|
|
1009
|
+
return y(y({}, ke(ft(), ["showTreeIcon", "treeMotion", "inputIcon", "getInputElement", "treeLine", "customSlots"])), {
|
|
1010
|
+
suffixIcon: fe.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: ut(ka(), {
|
|
1032
|
+
choiceTransitionName: "",
|
|
1033
|
+
listHeight: 256,
|
|
1034
|
+
treeIcon: !1,
|
|
1035
|
+
listItemHeight: 26,
|
|
1036
|
+
bordered: !0
|
|
1037
|
+
}),
|
|
1038
|
+
slots: Object,
|
|
1039
|
+
setup(e, r) {
|
|
1040
|
+
let {
|
|
1041
|
+
attrs: o,
|
|
1042
|
+
slots: a,
|
|
1043
|
+
expose: t,
|
|
1044
|
+
emit: n
|
|
1045
|
+
} = r;
|
|
1046
|
+
kt(!(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 l = Qt(), s = Jt.useInject(), d = m(() => Zt(s.status, e.status)), {
|
|
1048
|
+
prefixCls: c,
|
|
1049
|
+
renderEmpty: i,
|
|
1050
|
+
direction: p,
|
|
1051
|
+
virtual: b,
|
|
1052
|
+
dropdownMatchSelectWidth: f,
|
|
1053
|
+
size: x,
|
|
1054
|
+
getPopupContainer: S,
|
|
1055
|
+
getPrefixCls: V,
|
|
1056
|
+
disabled: N
|
|
1057
|
+
} = Nt("select", e), {
|
|
1058
|
+
compactSize: K,
|
|
1059
|
+
compactItemClassnames: F
|
|
1060
|
+
} = Tt(c, p), O = m(() => K.value || x.value), v = Lt(), w = m(() => {
|
|
1061
|
+
var C;
|
|
1062
|
+
return (C = N.value) !== null && C !== void 0 ? C : v.value;
|
|
1063
|
+
}), E = m(() => V()), A = m(() => e.placement !== void 0 ? e.placement : p.value === "rtl" ? "bottomRight" : "bottomLeft"), L = m(() => rt(E.value, _t(A.value), e.transitionName)), z = m(() => rt(E.value, "", e.choiceTransitionName)), Y = m(() => V("select-tree", e.prefixCls)), B = m(() => V("tree-select", e.prefixCls)), [le, q] = Wt(c), [se] = Ia(B, Y), ce = m(() => at(e.popupClassName || e.dropdownClassName, `${B.value}-dropdown`, {
|
|
1064
|
+
[`${B.value}-dropdown-rtl`]: p.value === "rtl"
|
|
1065
|
+
}, q.value)), ue = m(() => !!(e.treeCheckable || e.multiple)), ne = m(() => e.showArrow !== void 0 ? e.showArrow : e.loading || !ue.value), G = he();
|
|
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 ge = function() {
|
|
1077
|
+
for (var C = arguments.length, D = new Array(C), M = 0; M < C; M++)
|
|
1078
|
+
D[M] = arguments[M];
|
|
1079
|
+
n("update:value", D[0]), n("change", ...D), l.onFieldChange();
|
|
1080
|
+
}, me = (C) => {
|
|
1081
|
+
n("update:treeExpandedKeys", C), n("treeExpand", C);
|
|
1082
|
+
}, ye = (C) => {
|
|
1083
|
+
n("update:searchValue", C), n("search", C);
|
|
1084
|
+
}, ie = (C) => {
|
|
1085
|
+
n("blur", C), l.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: Ne,
|
|
1092
|
+
bordered: Te,
|
|
1093
|
+
listHeight: Le,
|
|
1094
|
+
listItemHeight: _e,
|
|
1095
|
+
multiple: Ee,
|
|
1096
|
+
treeIcon: De,
|
|
1097
|
+
treeLine: we,
|
|
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 = l.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: u
|
|
1107
|
+
} = s, {
|
|
1108
|
+
suffixIcon: h,
|
|
1109
|
+
removeIcon: g,
|
|
1110
|
+
clearIcon: k
|
|
1111
|
+
} = Ut(y(y({}, e), {
|
|
1112
|
+
multiple: ue.value,
|
|
1113
|
+
showArrow: ne.value,
|
|
1114
|
+
hasFeedback: J,
|
|
1115
|
+
feedbackIcon: u,
|
|
1116
|
+
prefixCls: c.value
|
|
1117
|
+
}), a);
|
|
1118
|
+
let P;
|
|
1119
|
+
Q !== void 0 ? P = Q : P = i("Select");
|
|
1120
|
+
const _ = ke(e, ["suffixIcon", "itemIcon", "removeIcon", "clearIcon", "switcherIcon", "bordered", "status", "onUpdate:value", "onUpdate:treeExpandedKeys", "onUpdate:searchValue"]), I = at(!Ne && B.value, {
|
|
1121
|
+
[`${c.value}-lg`]: O.value === "large",
|
|
1122
|
+
[`${c.value}-sm`]: O.value === "small",
|
|
1123
|
+
[`${c.value}-rtl`]: p.value === "rtl",
|
|
1124
|
+
[`${c.value}-borderless`]: !Te,
|
|
1125
|
+
[`${c.value}-in-form-item`]: He
|
|
1126
|
+
}, ea(c.value, d.value, J), F.value, o.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({}, o), _), {}, {
|
|
1128
|
+
disabled: w.value,
|
|
1129
|
+
virtual: b.value,
|
|
1130
|
+
dropdownMatchSelectWidth: f.value,
|
|
1131
|
+
id: Fe,
|
|
1132
|
+
fieldNames: Ke,
|
|
1133
|
+
ref: G,
|
|
1134
|
+
prefixCls: c.value,
|
|
1135
|
+
class: I,
|
|
1136
|
+
listHeight: Le,
|
|
1137
|
+
listItemHeight: _e,
|
|
1138
|
+
treeLine: !!we,
|
|
1139
|
+
inputIcon: h,
|
|
1140
|
+
multiple: Ee,
|
|
1141
|
+
removeIcon: g,
|
|
1142
|
+
clearIcon: k,
|
|
1143
|
+
switcherIcon: (R) => ta(Y.value, Ae, R, a.leafIcon, we),
|
|
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: ge,
|
|
1151
|
+
onBlur: ie,
|
|
1152
|
+
onSearch: ye,
|
|
1153
|
+
onTreeExpand: me
|
|
1154
|
+
}, T), {}, {
|
|
1155
|
+
transitionName: L.value,
|
|
1156
|
+
customSlots: y(y({}, a), {
|
|
1157
|
+
treeCheckable: () => U("span", {
|
|
1158
|
+
class: `${c.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
|
+
}), y(y({}, a), {
|
|
1166
|
+
treeCheckable: () => U("span", {
|
|
1167
|
+
class: `${c.value}-tree-checkbox-inner`
|
|
1168
|
+
}, null)
|
|
1169
|
+
}))));
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
}), st = pe, ct = y(Xe, {
|
|
1173
|
+
TreeNode: pe,
|
|
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
|
+
}), Ve = yt({});
|
|
1179
|
+
function Na(e) {
|
|
1180
|
+
Se(() => e.categoryList, (a) => {
|
|
1181
|
+
a.forEach(async (t) => {
|
|
1182
|
+
if (!Ve[t.id]) {
|
|
1183
|
+
const n = await Kt.getCategoryValues(t.id), { flatAttributeValue: l, treeAttributeValue: s, showWay: d } = n.body;
|
|
1184
|
+
Ve[t.id] = d === "TREE" ? s : l;
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}, { immediate: !0, deep: !0 });
|
|
1188
|
+
const r = (a, t) => {
|
|
1189
|
+
for (let n = 0; n < t.length; n++) {
|
|
1190
|
+
const l = t[n];
|
|
1191
|
+
if (l.id === a)
|
|
1192
|
+
return l.attributeName;
|
|
1193
|
+
if (l.children && l.children.length)
|
|
1194
|
+
return r(a, l.children);
|
|
1195
|
+
}
|
|
1196
|
+
return "";
|
|
1197
|
+
};
|
|
1198
|
+
return {
|
|
1199
|
+
categoryValuesMap: Ve,
|
|
1200
|
+
getDeleteAttributesNames: (a) => {
|
|
1201
|
+
var t, n;
|
|
1202
|
+
return (n = (t = a.defaultValueIds) == null ? void 0 : t.filter((l) => !a.attributeValueIds_view.includes(l))) == null ? void 0 : n.map((l) => r(l, Ve[a.id])).join("、");
|
|
1203
|
+
}
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
const Ta = { class: "crane-required" }, La = { class: "crane-category-tips" }, _a = {
|
|
1207
|
+
key: 0,
|
|
1208
|
+
style: { color: "#1677ff", "font-weight": "bold" }
|
|
1209
|
+
}, Ea = { key: 1 }, Da = {
|
|
1210
|
+
key: 0,
|
|
1211
|
+
style: { color: "#ff4d4f", "font-size": "12px" }
|
|
1212
|
+
}, Pa = {
|
|
1213
|
+
key: 1,
|
|
1214
|
+
style: { color: "#ff4d4f", "font-size": "12px" }
|
|
1215
|
+
}, Aa = /* @__PURE__ */ Ie({
|
|
1216
|
+
__name: "category-selector",
|
|
1217
|
+
props: {
|
|
1218
|
+
categoryList: {
|
|
1219
|
+
type: Array,
|
|
1220
|
+
default: () => []
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
setup(e, { expose: r }) {
|
|
1224
|
+
const o = ct.SHOW_PARENT, a = e, t = he(), n = he(""), {
|
|
1225
|
+
categoryValuesMap: l,
|
|
1226
|
+
getDeleteAttributesNames: s
|
|
1227
|
+
} = Na(a), d = m(() => ({
|
|
1228
|
+
categoryList: a.categoryList
|
|
1229
|
+
})), c = m(() => Object.values(l).some((p) => p.length > 0));
|
|
1230
|
+
return r({
|
|
1231
|
+
validate: () => new Promise((p, b) => {
|
|
1232
|
+
if (!t.value) {
|
|
1233
|
+
p(!0);
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
t.value.validate().then(() => {
|
|
1237
|
+
p(!0);
|
|
1238
|
+
}).catch(() => {
|
|
1239
|
+
b(!1);
|
|
1240
|
+
});
|
|
1241
|
+
})
|
|
1242
|
+
}), (p, b) => c.value ? (re(), et(H(la), {
|
|
1243
|
+
key: 0,
|
|
1244
|
+
class: "crane-category-wraper",
|
|
1245
|
+
model: d.value,
|
|
1246
|
+
ref_key: "formRef",
|
|
1247
|
+
ref: t
|
|
1248
|
+
}, {
|
|
1249
|
+
default: Be(() => [
|
|
1250
|
+
$e("div", Ta, de(H(Ce)("category")), 1),
|
|
1251
|
+
$e("div", La, de(H(Ce)("categotySelectTips")), 1),
|
|
1252
|
+
b[1] || (b[1] = $e("div", { class: "crane-category-line" }, null, -1)),
|
|
1253
|
+
(re(!0), be(bt, null, Ct(d.value.categoryList, (f, x) => {
|
|
1254
|
+
var S;
|
|
1255
|
+
return St((re(), et(H(aa), {
|
|
1256
|
+
key: f.id,
|
|
1257
|
+
label: f.categoryName,
|
|
1258
|
+
name: ["categoryList", x, "attributeValueIds_view"],
|
|
1259
|
+
rules: [{ required: !0, message: H(Ce)("pleaseChoose"), trigger: ["change", "blur"] }]
|
|
1260
|
+
}, {
|
|
1261
|
+
default: Be(() => {
|
|
1262
|
+
var V;
|
|
1263
|
+
return [
|
|
1264
|
+
U(H(ct), {
|
|
1265
|
+
treeCheckable: "",
|
|
1266
|
+
treeDefaultExpandAll: "",
|
|
1267
|
+
"tree-data": H(l)[f.id],
|
|
1268
|
+
showSearch: "",
|
|
1269
|
+
allowClear: "",
|
|
1270
|
+
value: f.attributeValueIds_view,
|
|
1271
|
+
"onUpdate:value": (N) => f.attributeValueIds_view = N,
|
|
1272
|
+
treeNodeFilterProp: "attributeName",
|
|
1273
|
+
searchValue: n.value,
|
|
1274
|
+
"onUpdate:searchValue": b[0] || (b[0] = (N) => n.value = N),
|
|
1275
|
+
fieldNames: { label: "attributeName", value: "id" },
|
|
1276
|
+
treeNodeLabelProp: "attributeName",
|
|
1277
|
+
"show-checked-strategy": H(o)
|
|
1278
|
+
}, {
|
|
1279
|
+
title: Be(({ attributeName: N }) => [
|
|
1280
|
+
n.value.toLowerCase() && N.includes(n.value.toLowerCase()) ? (re(), be("span", _a, de(N), 1)) : (re(), be("span", Ea, de(N), 1))
|
|
1281
|
+
]),
|
|
1282
|
+
_: 2
|
|
1283
|
+
}, 1032, ["tree-data", "value", "onUpdate:value", "searchValue", "show-checked-strategy"]),
|
|
1284
|
+
(V = f.attributeValueIds_view) != null && V.includes(-1) ? (re(), be("span", Da, de(H(Ce)("categoryChangeTips", { category: f.categoryName })), 1)) : je("", !0),
|
|
1285
|
+
H(s)(f) ? (re(), be("span", Pa, de(H(Ce)("deleteCategoryTips", { categorys: H(s)(f) })), 1)) : je("", !0)
|
|
1286
|
+
];
|
|
1287
|
+
}),
|
|
1288
|
+
_: 2
|
|
1289
|
+
}, 1032, ["label", "name", "rules"])), [
|
|
1290
|
+
[wt, (S = H(l)[f.id]) == null ? void 0 : S.length]
|
|
1291
|
+
]);
|
|
1292
|
+
}), 128))
|
|
1293
|
+
]),
|
|
1294
|
+
_: 1,
|
|
1295
|
+
__: [1]
|
|
1296
|
+
}, 8, ["model"])) : je("", !0);
|
|
1297
|
+
}
|
|
1298
|
+
}), Ma = /* @__PURE__ */ Ft(Aa, [["__scopeId", "data-v-5a9b14f5"]]);
|
|
1299
|
+
export {
|
|
1300
|
+
Ma as default
|
|
1301
|
+
};
|