fangguo-component 1.1.0 → 1.1.2

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/README.md +13 -11
  3. package/dist/{CustomInputV2-DYEcbu5_.js → CustomInputV2-uARhbFc8.js} +12 -12
  4. package/dist/CustomInputV2.css +1 -1
  5. package/dist/DragResizable.css +1 -1
  6. package/dist/DragResizable.vue_vue_type_style_index_0_lang-CHv0gJmo.js +179 -0
  7. package/dist/FgCascader.css +1 -1
  8. package/dist/FgCascader.vue_vue_type_style_index_0_lang-BUZDDcVn.js +1656 -0
  9. package/dist/{HSelect-Bqz2yTMf.js → HSelect-Drf6YBwO.js} +69 -69
  10. package/dist/{HSelectAll.vue_vue_type_script_setup_true_lang-C8i6LF_k.js → HSelectAll.vue_vue_type_script_setup_true_lang-Blq9xpfa.js} +1 -1
  11. package/dist/{HSelectSJ-BieRp2gG.js → HSelectSJ-D3GrXmvj.js} +104 -104
  12. package/dist/SelectTree-Dm5259kY.js +911 -0
  13. package/dist/SelectTree.css +1 -1
  14. package/dist/TextCopy-hOj-Wj2H.js +41 -0
  15. package/dist/TextCopy.css +1 -0
  16. package/dist/VirtualTable-BWugJiQ5.js +349 -0
  17. package/dist/VirtualTable.css +1 -1
  18. package/dist/components/VirtualTable/VirtualTable.vue.d.ts +3 -3
  19. package/dist/components/VirtualTable/index.d.ts +1 -0
  20. package/dist/components/VirtualTable/index.js +1 -1
  21. package/dist/components/cascader/cascader/ElCascader.vue.d.ts +3 -0
  22. package/dist/components/cascader/cascader/FgCascader.vue.d.ts +16 -4
  23. package/dist/components/cascader/cascader/cascader.d.ts +1 -0
  24. package/dist/components/cascader/index.js +1 -1
  25. package/dist/components/citySelect/demos/mockAddressTree.d.ts +8 -0
  26. package/dist/components/customInputV2/CustomInputV2.vue.d.ts +1 -1
  27. package/dist/components/customInputV2/index.js +1 -1
  28. package/dist/components/dragResizable/DragResizable.vue.d.ts +2 -0
  29. package/dist/components/dragResizable/index.js +1 -1
  30. package/dist/components/hSelect/demos/mockApi.d.ts +12 -0
  31. package/dist/components/hSelect/index.js +1 -1
  32. package/dist/components/hSelectAll/demos/mockApi.d.ts +10 -0
  33. package/dist/components/hSelectAll/index.js +1 -1
  34. package/dist/components/hSelectSJ/demos/mockApi.d.ts +11 -0
  35. package/dist/components/hSelectSJ/index.js +1 -1
  36. package/dist/components/index.d.ts +0 -2
  37. package/dist/components/index.js +42 -46
  38. package/dist/components/selectAddress/demos/mockAddressTree.d.ts +7 -0
  39. package/dist/components/selectTimePicker/SelectTimePicker.vue.d.ts +1 -1
  40. package/dist/components/selectTree/demos/treeData.d.ts +9 -0
  41. package/dist/components/selectTree/index.js +1 -1
  42. package/dist/components/textCopy/index.js +1 -1
  43. package/dist/index-BRcBDlVs.js +68 -0
  44. package/dist/index.css +1 -0
  45. package/dist/index.d.ts +4 -2
  46. package/dist/index.js +145 -149
  47. package/dist/vue-virtual-scroller.esm-CH-jx4ri.js +1051 -0
  48. package/package.json +8 -8
  49. package/dist/DragResizable.vue_vue_type_style_index_0_lang-DYL6TUPE.js +0 -167
  50. package/dist/FgCascader.vue_vue_type_style_index_0_lang-OnqaEAao.js +0 -1807
  51. package/dist/SelectTree-C7lBZnZH.js +0 -306
  52. package/dist/SortTransfer.css +0 -1
  53. package/dist/SortTransfer.vue_vue_type_style_index_0_lang-C5OmBF3s.js +0 -153
  54. package/dist/TextCopy.vue_vue_type_script_setup_true_lang-DbhZGH_z.js +0 -29
  55. package/dist/TipInput-CIskitOV.js +0 -117
  56. package/dist/TipInput.css +0 -1
  57. package/dist/VirtualTable-BYTfwDC1.js +0 -353
  58. package/dist/components/sortTransfer/SortTransfer.vue.d.ts +0 -97
  59. package/dist/components/sortTransfer/index.d.ts +0 -1
  60. package/dist/components/sortTransfer/index.js +0 -4
  61. package/dist/components/tipInput/TipInput.vue.d.ts +0 -56
  62. package/dist/components/tipInput/index.d.ts +0 -1
  63. package/dist/components/tipInput/index.js +0 -4
  64. package/dist/debounce-BLrZUqsA.js +0 -84
  65. package/dist/index-BKzmtfeu.js +0 -72
  66. package/dist/isEqual-qYQTJBU6.js +0 -506
  67. package/dist/isObject-CO569sPG.js +0 -35
@@ -1,1807 +0,0 @@
1
- import './FgCascader.css';var Nn = Object.defineProperty, Sn = Object.defineProperties;
2
- var kn = Object.getOwnPropertyDescriptors;
3
- var Oe = Object.getOwnPropertySymbols;
4
- var ht = Object.prototype.hasOwnProperty, vt = Object.prototype.propertyIsEnumerable;
5
- var Ye = (e, t, n) => t in e ? Nn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, fe = (e, t) => {
6
- for (var n in t || (t = {}))
7
- ht.call(t, n) && Ye(e, n, t[n]);
8
- if (Oe)
9
- for (var n of Oe(t))
10
- vt.call(t, n) && Ye(e, n, t[n]);
11
- return e;
12
- }, je = (e, t) => Sn(e, kn(t));
13
- var Xe = (e, t) => {
14
- var n = {};
15
- for (var a in e)
16
- ht.call(e, a) && t.indexOf(a) < 0 && (n[a] = e[a]);
17
- if (e != null && Oe)
18
- for (var a of Oe(e))
19
- t.indexOf(a) < 0 && vt.call(e, a) && (n[a] = e[a]);
20
- return n;
21
- };
22
- var M = (e, t, n) => Ye(e, typeof t != "symbol" ? t + "" : t, n);
23
- var gt = (e, t, n) => new Promise((a, l) => {
24
- var i = (v) => {
25
- try {
26
- m(n.next(v));
27
- } catch (u) {
28
- l(u);
29
- }
30
- }, r = (v) => {
31
- try {
32
- m(n.throw(v));
33
- } catch (u) {
34
- l(u);
35
- }
36
- }, m = (v) => v.done ? a(v.value) : Promise.resolve(v.value).then(i, r);
37
- m((n = n.apply(e, t)).next());
38
- });
39
- import { getCurrentScope as wn, onScopeDispose as En, watch as Q, computed as k, toValue as ge, shallowRef as Ft, getCurrentInstance as Bt, onMounted as qe, warn as Tn, defineComponent as Se, h as Qe, inject as zt, resolveComponent as ae, openBlock as E, createElementBlock as K, normalizeClass as z, createBlock as Z, withModifiers as Te, withCtx as q, createElementVNode as pe, createVNode as ne, createCommentVNode as ve, Fragment as $e, ref as A, normalizeStyle as nt, createTextVNode as $n, toDisplayString as he, provide as An, reactive as Pn, onBeforeUpdate as Ln, nextTick as ce, renderList as De, useAttrs as Mn, unref as $, withDirectives as xe, vShow as mt, renderSlot as Rt, withKeys as Vn, vModelText as On, useSlots as jn, useModel as xn, onBeforeUnmount as Dn, mergeProps as In, mergeModels as yt, render as bt } from "vue";
40
- import { p as at } from "./index-DIX8TpoT.js";
41
- import { ArrowRight as Fn, Loading as Ht, Check as Wt, CircleClose as Bn, ArrowDown as zn } from "@element-plus/icons-vue";
42
- import { useNamespace as Ce, ElIcon as Ae, ElRadio as Rn, ElCheckbox as Hn, ElScrollbar as qt, useLocale as Ut, UPDATE_MODEL_EVENT as Be, CHANGE_EVENT as ze, EVENT_CODE as X, tagProps as Wn, useTooltipContentProps as qn, CommonProps as Un, useSizeProp as Kn, useFormItem as _n, useFormSize as Jn, ElConfigProvider as Gn, ElTooltip as Ct, ElInput as Zn, ElTag as Nt, ClickOutside as Yn } from "element-plus";
43
- import { RecycleScroller as Xn } from "vue-virtual-scroller";
44
- import { _ as lt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
45
- import { g as Qn, e as ea, a as Kt, b as ta, o as na, U as St, c as aa, d as st, f as _t, n as Re, h as la, S as sa, j as oa, i as Pe } from "./isEqual-qYQTJBU6.js";
46
- import { a as Jt, S as He, r as ra, i as Gt } from "./isObject-CO569sPG.js";
47
- import { d as ia } from "./debounce-BLrZUqsA.js";
48
- at.env.NODE_ENV !== "production" && Object.freeze({});
49
- at.env.NODE_ENV !== "production" && Object.freeze([]);
50
- const ca = () => {
51
- }, ua = Object.prototype.hasOwnProperty, kt = (e, t) => ua.call(e, t), da = Array.isArray, Le = (e) => typeof e == "function", fa = (e) => typeof e == "string", Ue = (e) => e !== null && typeof e == "object", pa = (e) => (Ue(e) || Le(e)) && Le(e.then) && Le(e.catch), ha = (e) => {
52
- const t = /* @__PURE__ */ Object.create(null);
53
- return ((n) => t[n] || (t[n] = e(n)));
54
- }, va = ha((e) => e.charAt(0).toUpperCase() + e.slice(1));
55
- var wt = Object.create, ga = /* @__PURE__ */ (function() {
56
- function e() {
57
- }
58
- return function(t) {
59
- if (!Jt(t))
60
- return {};
61
- if (wt)
62
- return wt(t);
63
- e.prototype = t;
64
- var n = new e();
65
- return e.prototype = void 0, n;
66
- };
67
- })(), Et = (function() {
68
- try {
69
- var e = Qn(Object, "defineProperty");
70
- return e({}, "", {}), e;
71
- } catch (t) {
72
- }
73
- })();
74
- function ma(e, t) {
75
- for (var n = -1, a = e == null ? 0 : e.length; ++n < a && t(e[n], n, e) !== !1; )
76
- ;
77
- return e;
78
- }
79
- function Zt(e, t, n) {
80
- t == "__proto__" && Et ? Et(e, t, {
81
- configurable: !0,
82
- enumerable: !0,
83
- value: n,
84
- writable: !0
85
- }) : e[t] = n;
86
- }
87
- var ya = Object.prototype, ba = ya.hasOwnProperty;
88
- function Ca(e, t, n) {
89
- var a = e[t];
90
- (!(ba.call(e, t) && ea(a, n)) || n === void 0 && !(t in e)) && Zt(e, t, n);
91
- }
92
- var Tt = He ? He.isConcatSpreadable : void 0;
93
- function Na(e) {
94
- return Kt(e) || ta(e) || !!(Tt && e && e[Tt]);
95
- }
96
- function Yt(e, t, n, a, l) {
97
- var i = -1, r = e.length;
98
- for (n || (n = Na), l || (l = []); ++i < r; ) {
99
- var m = e[i];
100
- n(m) ? Yt(m, t - 1, n, a, l) : l[l.length] = m;
101
- }
102
- return l;
103
- }
104
- var Sa = na(Object.getPrototypeOf, Object), Xt = typeof exports == "object" && exports && !exports.nodeType && exports, $t = Xt && typeof module == "object" && module && !module.nodeType && module, ka = $t && $t.exports === Xt, At = ka ? ra.Buffer : void 0;
105
- At && At.allocUnsafe;
106
- function wa(e, t) {
107
- return e.slice();
108
- }
109
- var Ea = Object.prototype, Ta = Ea.hasOwnProperty;
110
- function $a(e) {
111
- var t = e.length, n = new e.constructor(t);
112
- return t && typeof e[0] == "string" && Ta.call(e, "index") && (n.index = e.index, n.input = e.input), n;
113
- }
114
- function ot(e) {
115
- var t = new e.constructor(e.byteLength);
116
- return new St(t).set(new St(e)), t;
117
- }
118
- function Aa(e, t) {
119
- var n = ot(e.buffer);
120
- return new e.constructor(n, e.byteOffset, e.byteLength);
121
- }
122
- var Pa = /\w*$/;
123
- function La(e) {
124
- var t = new e.constructor(e.source, Pa.exec(e));
125
- return t.lastIndex = e.lastIndex, t;
126
- }
127
- var Pt = He ? He.prototype : void 0, Lt = Pt ? Pt.valueOf : void 0;
128
- function Ma(e) {
129
- return Lt ? Object(Lt.call(e)) : {};
130
- }
131
- function Va(e, t) {
132
- var n = ot(e.buffer);
133
- return new e.constructor(n, e.byteOffset, e.length);
134
- }
135
- var Oa = "[object Boolean]", ja = "[object Date]", xa = "[object Map]", Da = "[object Number]", Ia = "[object RegExp]", Fa = "[object Set]", Ba = "[object String]", za = "[object Symbol]", Ra = "[object ArrayBuffer]", Ha = "[object DataView]", Wa = "[object Float32Array]", qa = "[object Float64Array]", Ua = "[object Int8Array]", Ka = "[object Int16Array]", _a = "[object Int32Array]", Ja = "[object Uint8Array]", Ga = "[object Uint8ClampedArray]", Za = "[object Uint16Array]", Ya = "[object Uint32Array]";
136
- function Xa(e, t, n) {
137
- var a = e.constructor;
138
- switch (t) {
139
- case Ra:
140
- return ot(e);
141
- case Oa:
142
- case ja:
143
- return new a(+e);
144
- case Ha:
145
- return Aa(e);
146
- case Wa:
147
- case qa:
148
- case Ua:
149
- case Ka:
150
- case _a:
151
- case Ja:
152
- case Ga:
153
- case Za:
154
- case Ya:
155
- return Va(e);
156
- case xa:
157
- return new a();
158
- case Da:
159
- case Ba:
160
- return new a(e);
161
- case Ia:
162
- return La(e);
163
- case Fa:
164
- return new a();
165
- case za:
166
- return Ma(e);
167
- }
168
- }
169
- function Qa(e) {
170
- return typeof e.constructor == "function" && !aa(e) ? ga(Sa(e)) : {};
171
- }
172
- var el = "[object Map]";
173
- function tl(e) {
174
- return Gt(e) && st(e) == el;
175
- }
176
- var Mt = Re && Re.isMap, nl = Mt ? _t(Mt) : tl, al = "[object Set]";
177
- function ll(e) {
178
- return Gt(e) && st(e) == al;
179
- }
180
- var Vt = Re && Re.isSet, sl = Vt ? _t(Vt) : ll, Qt = "[object Arguments]", ol = "[object Array]", rl = "[object Boolean]", il = "[object Date]", cl = "[object Error]", en = "[object Function]", ul = "[object GeneratorFunction]", dl = "[object Map]", fl = "[object Number]", tn = "[object Object]", pl = "[object RegExp]", hl = "[object Set]", vl = "[object String]", gl = "[object Symbol]", ml = "[object WeakMap]", yl = "[object ArrayBuffer]", bl = "[object DataView]", Cl = "[object Float32Array]", Nl = "[object Float64Array]", Sl = "[object Int8Array]", kl = "[object Int16Array]", wl = "[object Int32Array]", El = "[object Uint8Array]", Tl = "[object Uint8ClampedArray]", $l = "[object Uint16Array]", Al = "[object Uint32Array]", L = {};
181
- L[Qt] = L[ol] = L[yl] = L[bl] = L[rl] = L[il] = L[Cl] = L[Nl] = L[Sl] = L[kl] = L[wl] = L[dl] = L[fl] = L[tn] = L[pl] = L[hl] = L[vl] = L[gl] = L[El] = L[Tl] = L[$l] = L[Al] = !0;
182
- L[cl] = L[en] = L[ml] = !1;
183
- function Ie(e, t, n, a, l, i) {
184
- var r;
185
- if (r !== void 0)
186
- return r;
187
- if (!Jt(e))
188
- return e;
189
- var m = Kt(e);
190
- if (m)
191
- r = $a(e);
192
- else {
193
- var v = st(e), u = v == en || v == ul;
194
- if (la(e))
195
- return wa(e);
196
- if (v == tn || v == Qt || u && !l)
197
- r = u ? {} : Qa(e);
198
- else {
199
- if (!L[v])
200
- return l ? e : {};
201
- r = Xa(e, v);
202
- }
203
- }
204
- i || (i = new sa());
205
- var h = i.get(e);
206
- if (h)
207
- return h;
208
- i.set(e, r), sl(e) ? e.forEach(function(N) {
209
- r.add(Ie(N, t, n, N, e, i));
210
- }) : nl(e) && e.forEach(function(N, j) {
211
- r.set(j, Ie(N, t, n, j, e, i));
212
- });
213
- var b = oa, S = m ? void 0 : b(e);
214
- return ma(S || e, function(N, j) {
215
- S && (j = N, N = e[j]), Ca(r, j, Ie(N, t, n, j, e, i));
216
- }), r;
217
- }
218
- var Pl = 1, Ll = 4;
219
- function nn(e) {
220
- return Ie(e, Pl | Ll);
221
- }
222
- var Ml = 1 / 0;
223
- function Vl(e) {
224
- var t = e == null ? 0 : e.length;
225
- return t ? Yt(e, Ml) : [];
226
- }
227
- function Ol(e) {
228
- for (var t = -1, n = e == null ? 0 : e.length, a = {}; ++t < n; ) {
229
- var l = e[t];
230
- Zt(a, l[0], l[1]);
231
- }
232
- return a;
233
- }
234
- function an(e, t) {
235
- return wn() ? (En(e, t), !0) : !1;
236
- }
237
- const rt = typeof window != "undefined" && typeof document != "undefined";
238
- typeof WorkerGlobalScope != "undefined" && globalThis instanceof WorkerGlobalScope;
239
- const jl = (e) => e != null;
240
- function xl(e) {
241
- return Array.isArray(e) ? e : [e];
242
- }
243
- const it = rt ? window : void 0;
244
- function We(e) {
245
- var t;
246
- const n = ge(e);
247
- return (t = n == null ? void 0 : n.$el) !== null && t !== void 0 ? t : n;
248
- }
249
- // @__NO_SIDE_EFFECTS__
250
- function Dl() {
251
- const e = Ft(!1), t = Bt();
252
- return t && qe(() => {
253
- e.value = !0;
254
- }, t), e;
255
- }
256
- // @__NO_SIDE_EFFECTS__
257
- function ln(e) {
258
- const t = /* @__PURE__ */ Dl();
259
- return k(() => (t.value, !!e()));
260
- }
261
- function Il(e, t, n = {}) {
262
- const b = n, { window: a = it } = b, l = Xe(b, ["window"]);
263
- let i;
264
- const r = /* @__PURE__ */ ln(() => a && "MutationObserver" in a), m = () => {
265
- i && (i.disconnect(), i = void 0);
266
- }, v = Q(k(() => {
267
- const S = xl(ge(e)).map(We).filter(jl);
268
- return new Set(S);
269
- }), (S) => {
270
- m(), r.value && S.size && (i = new MutationObserver(t), S.forEach((N) => i.observe(N, l)));
271
- }, {
272
- immediate: !0,
273
- flush: "post"
274
- }), u = () => i == null ? void 0 : i.takeRecords(), h = () => {
275
- v(), m();
276
- };
277
- return an(h), {
278
- isSupported: r,
279
- stop: h,
280
- takeRecords: u
281
- };
282
- }
283
- function Fl(e, t, n = {}) {
284
- const { window: a = it, initialValue: l, observe: i = !1 } = n, r = Ft(l), m = k(() => {
285
- var u;
286
- return We(t) || (a == null || (u = a.document) === null || u === void 0 ? void 0 : u.documentElement);
287
- });
288
- function v() {
289
- const u = ge(e), h = ge(m);
290
- if (h && a && u) {
291
- var b;
292
- r.value = ((b = a.getComputedStyle(h).getPropertyValue(u)) === null || b === void 0 ? void 0 : b.trim()) || r.value || l;
293
- }
294
- }
295
- return i && Il(m, v, {
296
- attributeFilter: ["style", "class"],
297
- window: a
298
- }), Q([m, () => ge(e)], (u, h) => {
299
- h[0] && h[1] && h[0].style.removeProperty(h[1]), v();
300
- }, { immediate: !0 }), Q([r, m], ([u, h]) => {
301
- const b = ge(e);
302
- h != null && h.style && b && (u == null ? h.style.removeProperty(b) : h.style.setProperty(b, u));
303
- }, { immediate: !0 }), r;
304
- }
305
- function Bl(e, t, n = {}) {
306
- const h = n, { window: a = it } = h, l = Xe(h, ["window"]);
307
- let i;
308
- const r = /* @__PURE__ */ ln(() => a && "ResizeObserver" in a), m = () => {
309
- i && (i.disconnect(), i = void 0);
310
- }, v = Q(k(() => {
311
- const b = ge(e);
312
- return Array.isArray(b) ? b.map((S) => We(S)) : [We(b)];
313
- }), (b) => {
314
- if (m(), r.value && a) {
315
- i = new ResizeObserver(t);
316
- for (const S of b) S && i.observe(S, l);
317
- }
318
- }, {
319
- immediate: !0,
320
- flush: "post"
321
- }), u = () => {
322
- m(), v();
323
- };
324
- return an(u), {
325
- isSupported: r,
326
- stop: u
327
- };
328
- }
329
- const sn = (e) => !e.getAttribute("aria-owns"), on = (e, t, n) => {
330
- const { parentNode: a } = e;
331
- if (!a) return null;
332
- const l = a.querySelectorAll(n), i = Array.prototype.indexOf.call(l, e);
333
- return l[i + t] || null;
334
- }, Fe = (e) => {
335
- e && (e.focus(), !sn(e) && e.click());
336
- }, zl = (e) => e === void 0, Rl = (e) => typeof e == "boolean", et = (e) => !e && e !== 0 || da(e) && e.length === 0 || Ue(e) && !Object.keys(e).length, Ot = (e) => va(e);
337
- class Hl extends Error {
338
- constructor(t) {
339
- super(t), this.name = "ElementPlusError";
340
- }
341
- }
342
- function Wl(e, t) {
343
- if (at.env.NODE_ENV !== "production") {
344
- const n = fa(e) ? new Hl(`[${e}] ${t}`) : e;
345
- console.warn(n);
346
- }
347
- }
348
- const rn = "__epPropKey", Me = (e) => e, ql = (e) => Ue(e) && !!e[rn], Ul = (e, t) => {
349
- if (!Ue(e) || ql(e)) return e;
350
- const { values: n, required: a, default: l, type: i, validator: r } = e, v = {
351
- type: i,
352
- required: !!a,
353
- validator: n || r ? (u) => {
354
- let h = !1, b = [];
355
- if (n && (b = Array.from(n), kt(e, "default") && b.push(l), h || (h = b.includes(u))), r && (h || (h = r(u))), !h && b.length > 0) {
356
- const S = [...new Set(b)].map((N) => JSON.stringify(N)).join(", ");
357
- Tn(
358
- `Invalid prop: validation failed${t ? ` for prop "${t}"` : ""}. Expected one of [${S}], got value ${JSON.stringify(
359
- u
360
- )}.`
361
- );
362
- }
363
- return h;
364
- } : void 0,
365
- [rn]: !0
366
- };
367
- return kt(e, "default") && (v.default = l), v;
368
- }, cn = (e) => Ol(
369
- Object.entries(e).map(([t, n]) => [
370
- t,
371
- Ul(n, t)
372
- ])
373
- ), jt = (e) => [...new Set(e)], xt = (e) => !e && e !== 0 ? [] : Array.isArray(e) ? e : [e], Kl = (e) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e), _l = () => Math.floor(Math.random() * 1e4), Jl = Se({
374
- name: "NodeContent",
375
- setup() {
376
- return {
377
- ns: Ce("cascader-node")
378
- };
379
- },
380
- render() {
381
- const { ns: e } = this, { node: t, panel: n } = this.$parent, { data: a, label: l } = t, { renderLabelFn: i } = n;
382
- return Qe(
383
- "span",
384
- { class: e.e("label") },
385
- i ? i({ node: t, data: a }) : l
386
- );
387
- }
388
- }), ct = /* @__PURE__ */ Symbol(), Gl = Se({
389
- name: "ElCascaderNode",
390
- components: {
391
- ElCheckbox: Hn,
392
- ElRadio: Rn,
393
- NodeContent: Jl,
394
- ElIcon: Ae,
395
- Check: Wt,
396
- Loading: Ht,
397
- ArrowRight: Fn
398
- },
399
- props: {
400
- node: {
401
- type: Object,
402
- required: !0
403
- },
404
- menuId: String
405
- },
406
- emits: ["expand"],
407
- setup(e, { emit: t }) {
408
- const n = zt(ct), a = Ce("cascader-node"), l = k(() => n.isHoverMenu), i = k(() => n.config.multiple), r = k(() => n.config.checkStrictly), m = k(() => {
409
- var T;
410
- return (T = n.checkedNodes[0]) == null ? void 0 : T.uid;
411
- }), v = k(() => e.node.isDisabled), u = k(() => e.node.isLeaf), h = k(
412
- () => r.value && !u.value || !v.value
413
- ), b = k(() => N(n.expandingNode)), S = k(
414
- () => r.value && n.checkedNodes.some(N)
415
- ), N = (T) => {
416
- var H;
417
- const { level: R, uid: x } = e.node;
418
- return ((H = T == null ? void 0 : T.pathNodes[R - 1]) == null ? void 0 : H.uid) === x;
419
- }, j = () => {
420
- b.value || n.expandNode(e.node);
421
- }, U = (T) => {
422
- const { node: R } = e;
423
- T !== R.checked && n.handleCheckChange(R, T);
424
- }, ee = () => {
425
- n.lazyLoad(e.node, () => {
426
- u.value || j();
427
- });
428
- }, P = (T) => {
429
- l.value && (W(), !u.value && t("expand", T));
430
- }, W = () => {
431
- const { node: T } = e;
432
- !h.value || T.loading || (T.loaded ? j() : ee());
433
- }, D = () => {
434
- l.value && !u.value || (u.value && !v.value && !r.value && !i.value ? I(!0) : W());
435
- }, _ = (T) => {
436
- r.value ? (U(T), e.node.loaded && j()) : I(T);
437
- }, I = (T) => {
438
- e.node.loaded ? (U(T), !r.value && j()) : ee();
439
- };
440
- return {
441
- panel: n,
442
- isHoverMenu: l,
443
- multiple: i,
444
- checkStrictly: r,
445
- checkedNodeId: m,
446
- isDisabled: v,
447
- isLeaf: u,
448
- expandable: h,
449
- inExpandingPath: b,
450
- inCheckedPath: S,
451
- ns: a,
452
- handleHoverExpand: P,
453
- handleExpand: W,
454
- handleClick: D,
455
- handleCheck: I,
456
- handleSelectCheck: _
457
- };
458
- }
459
- }), Zl = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
460
- function Yl(e, t, n, a, l, i) {
461
- const r = ae("el-checkbox"), m = ae("el-radio"), v = ae("check"), u = ae("el-icon"), h = ae("node-content"), b = ae("loading"), S = ae("arrow-right");
462
- return E(), K("li", {
463
- id: `${e.menuId}-${e.node.uid}`,
464
- role: "menuitem",
465
- "aria-haspopup": !e.isLeaf,
466
- "aria-owns": e.isLeaf ? null : e.menuId,
467
- "aria-expanded": e.inExpandingPath,
468
- tabindex: e.expandable ? -1 : void 0,
469
- class: z([
470
- e.ns.b(),
471
- e.ns.is("selectable", e.checkStrictly),
472
- e.ns.is("active", e.node.checked),
473
- e.ns.is("disabled", !e.expandable),
474
- e.inExpandingPath && "in-active-path",
475
- e.inCheckedPath && "in-checked-path"
476
- ]),
477
- onMouseenter: t[2] || (t[2] = (...N) => e.handleHoverExpand && e.handleHoverExpand(...N)),
478
- onFocus: t[3] || (t[3] = (...N) => e.handleHoverExpand && e.handleHoverExpand(...N)),
479
- onClick: t[4] || (t[4] = (...N) => e.handleClick && e.handleClick(...N))
480
- }, [
481
- e.multiple ? (E(), Z(r, {
482
- key: 0,
483
- "model-value": e.node.checked,
484
- indeterminate: e.node.indeterminate,
485
- disabled: e.isDisabled,
486
- onClick: t[0] || (t[0] = Te(() => {
487
- }, ["stop"])),
488
- "onUpdate:modelValue": e.handleSelectCheck
489
- }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : e.checkStrictly ? (E(), Z(m, {
490
- key: 1,
491
- "model-value": e.checkedNodeId,
492
- label: e.node.uid,
493
- disabled: e.isDisabled,
494
- "onUpdate:modelValue": e.handleSelectCheck,
495
- onClick: t[1] || (t[1] = Te(() => {
496
- }, ["stop"]))
497
- }, {
498
- default: q(() => [...t[5] || (t[5] = [
499
- pe("span", null, null, -1)
500
- ])]),
501
- _: 1
502
- }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : e.isLeaf && e.node.checked ? (E(), Z(u, {
503
- key: 2,
504
- class: z(e.ns.e("prefix"))
505
- }, {
506
- default: q(() => [
507
- ne(v)
508
- ]),
509
- _: 1
510
- }, 8, ["class"])) : ve("", !0),
511
- ne(h),
512
- e.isLeaf ? ve("", !0) : (E(), K($e, { key: 3 }, [
513
- e.node.loading ? (E(), Z(u, {
514
- key: 0,
515
- class: z([e.ns.is("loading"), e.ns.e("postfix")])
516
- }, {
517
- default: q(() => [
518
- ne(b)
519
- ]),
520
- _: 1
521
- }, 8, ["class"])) : (E(), Z(u, {
522
- key: 1,
523
- class: z(["arrow-right", e.ns.e("postfix")])
524
- }, {
525
- default: q(() => [
526
- ne(S)
527
- ]),
528
- _: 1
529
- }, 8, ["class"]))
530
- ], 64))
531
- ], 42, Zl);
532
- }
533
- const Xl = /* @__PURE__ */ lt(Gl, [["render", Yl]]), Ql = (e, t = "14px sans-serif") => {
534
- const a = document.createElement("canvas").getContext("2d");
535
- return a ? (a.font = t, a.measureText(e).width) : 0;
536
- }, es = Se({
537
- name: "CustomCascaderMenu",
538
- components: {
539
- Loading: Ht,
540
- ElIcon: Ae,
541
- ElScrollbar: qt,
542
- RecycleScroller: Xn,
543
- CustomCascaderNode: Xl
544
- },
545
- props: {
546
- nodes: {
547
- type: Array,
548
- required: !0
549
- },
550
- index: {
551
- type: Number,
552
- required: !0
553
- }
554
- },
555
- setup(e) {
556
- const t = Bt(), n = Ce("cascader-menu"), { t: a } = Ut(), l = _l();
557
- let i = null, r = null;
558
- const m = zt(ct), v = A(null), u = k(() => !e.nodes.length), h = k(() => !m.initialLoaded), b = k(() => `cascader-menu-${l}-${e.index}`), S = k(() => {
559
- if (!e.nodes.length) return 180;
560
- const P = 110;
561
- let W = 0;
562
- for (const D of e.nodes) {
563
- const _ = D.label || "", I = Ql(String(_));
564
- I > W && (W = I);
565
- }
566
- return Math.max(180, Math.ceil(W + P));
567
- }), N = (P) => {
568
- i = P.target;
569
- }, j = (P) => {
570
- if (!(!m.isHoverMenu || !i || !v.value))
571
- if (i.contains(P.target)) {
572
- U();
573
- const W = t.vnode.el, { left: D } = W.getBoundingClientRect(), { offsetWidth: _, offsetHeight: I } = W, T = P.clientX - D, R = i.offsetTop, x = R + i.offsetHeight;
574
- v.value.innerHTML = `
575
- <path style="pointer-events: auto;" fill="transparent" d="M${T} ${R} L${_} 0 V${R} Z" />
576
- <path style="pointer-events: auto;" fill="transparent" d="M${T} ${x} L${_} ${I} V${x} Z" />
577
- `;
578
- } else r || (r = window.setTimeout(ee, m.config.hoverThreshold));
579
- }, U = () => {
580
- r && (clearTimeout(r), r = null);
581
- }, ee = () => {
582
- v.value && (v.value.innerHTML = "", U());
583
- };
584
- return {
585
- ns: n,
586
- panel: m,
587
- hoverZone: v,
588
- isEmpty: u,
589
- isLoading: h,
590
- menuId: b,
591
- menuWidth: S,
592
- t: a,
593
- handleExpand: N,
594
- handleMouseMove: j,
595
- clearHoverZone: ee
596
- };
597
- }
598
- });
599
- function ts(e, t, n, a, l, i) {
600
- const r = ae("custom-cascader-node"), m = ae("loading"), v = ae("el-icon"), u = ae("RecycleScroller");
601
- return e.nodes.length ? (E(), Z(u, {
602
- key: e.menuId,
603
- tag: "ul",
604
- role: "menu",
605
- class: z([e.ns.b(), "cascader-virtual-list"]),
606
- "wrap-class": e.ns.e("wrap"),
607
- "view-class": [e.ns.e("list"), e.ns.is("empty", e.isEmpty)],
608
- style: nt({ minWidth: e.menuWidth + "px" }),
609
- items: e.nodes,
610
- "item-size": 34,
611
- "key-field": "uid",
612
- onMousemove: e.handleMouseMove,
613
- onMouseleave: e.clearHoverZone
614
- }, {
615
- default: q(({ item: h }) => {
616
- var b;
617
- return [
618
- ne(r, {
619
- node: h,
620
- "menu-id": e.menuId,
621
- onExpand: e.handleExpand
622
- }, null, 8, ["node", "menu-id", "onExpand"]),
623
- e.isLoading ? (E(), K("div", {
624
- key: 0,
625
- class: z(e.ns.e("empty-text"))
626
- }, [
627
- ne(v, {
628
- size: "14",
629
- class: z(e.ns.is("loading"))
630
- }, {
631
- default: q(() => [
632
- ne(m)
633
- ]),
634
- _: 1
635
- }, 8, ["class"]),
636
- $n(" " + he(e.t("el.cascader.loading")), 1)
637
- ], 2)) : e.isEmpty ? (E(), K("div", {
638
- key: 1,
639
- class: z(e.ns.e("empty-text"))
640
- }, he(e.t("el.cascader.noData")), 3)) : (b = e.panel) != null && b.isHoverMenu ? (E(), K("svg", {
641
- key: 2,
642
- ref: "hoverZone",
643
- class: z(e.ns.e("hover-zone"))
644
- }, null, 2)) : ve("", !0)
645
- ];
646
- }),
647
- _: 1
648
- }, 8, ["class", "wrap-class", "view-class", "style", "items", "onMousemove", "onMouseleave"])) : ve("", !0);
649
- }
650
- const ns = /* @__PURE__ */ lt(es, [["render", ts], ["__scopeId", "data-v-a251fab9"]]);
651
- let as = 0;
652
- const ls = (e) => {
653
- const t = [e];
654
- let { parent: n } = e;
655
- for (; n; )
656
- t.unshift(n), n = n.parent;
657
- return t;
658
- };
659
- class Ne {
660
- constructor(t, n, a, l = !1) {
661
- M(this, "data");
662
- M(this, "config");
663
- M(this, "parent");
664
- M(this, "root");
665
- M(this, "uid", as++);
666
- M(this, "level");
667
- M(this, "value");
668
- M(this, "label");
669
- M(this, "pathNodes");
670
- M(this, "pathValues");
671
- M(this, "pathLabels");
672
- M(this, "childrenData");
673
- M(this, "children");
674
- M(this, "text");
675
- M(this, "loaded");
676
- /**
677
- * Is it checked
678
- *
679
- * @default false
680
- */
681
- M(this, "checked", !1);
682
- /**
683
- * Used to indicate the intermediate state of unchecked and fully checked child nodes
684
- *
685
- * @default false
686
- */
687
- M(this, "indeterminate", !1);
688
- /**
689
- * Loading Status
690
- *
691
- * @default false
692
- */
693
- M(this, "loading", !1);
694
- this.data = t, this.config = n, this.parent = a, this.root = l;
695
- const { value: i, label: r, children: m } = n, v = t[m], u = ls(this);
696
- this.level = l ? 0 : a ? a.level + 1 : 1, this.value = t[i], this.label = t[r], this.pathNodes = u, this.pathValues = u.map((h) => h.value), this.pathLabels = u.map((h) => h.label), this.childrenData = v, this.children = (v || []).map(
697
- (h) => new Ne(h, n, this)
698
- ), this.loaded = !n.lazy || this.isLeaf || !et(v);
699
- }
700
- get isDisabled() {
701
- const { data: t, parent: n, config: a } = this, { disabled: l, checkStrictly: i } = a;
702
- return (Le(l) ? l(t, this) : !!t[l]) || !i && (n == null ? void 0 : n.isDisabled);
703
- }
704
- get isLeaf() {
705
- const { data: t, config: n, childrenData: a, loaded: l } = this, { lazy: i, leaf: r } = n, m = Le(r) ? r(t, this) : t[r];
706
- return zl(m) ? i && !l ? !1 : !(Array.isArray(a) && a.length) : !!m;
707
- }
708
- get valueByOption() {
709
- return this.config.emitPath ? this.pathValues : this.value;
710
- }
711
- appendChild(t) {
712
- const { childrenData: n, children: a } = this, l = new Ne(t, this.config, this);
713
- return Array.isArray(n) ? n.push(t) : this.childrenData = [t], a.push(l), l;
714
- }
715
- calcText(t, n) {
716
- const a = t ? this.pathLabels.join(n) : this.label;
717
- return this.text = a, a;
718
- }
719
- broadcast(t, ...n) {
720
- const a = `onParent${Ot(t)}`;
721
- this.children.forEach((l) => {
722
- l && (l.broadcast(t, ...n), l[a] && l[a](...n));
723
- });
724
- }
725
- emit(t, ...n) {
726
- const { parent: a } = this, l = `onChild${Ot(t)}`;
727
- a && (a[l] && a[l](...n), a.emit(t, ...n));
728
- }
729
- onParentCheck(t) {
730
- this.isDisabled || this.setCheckState(t);
731
- }
732
- onChildCheck() {
733
- const { children: t } = this, n = t.filter((l) => !l.isDisabled), a = n.length ? n.every((l) => l.checked) : !1;
734
- this.setCheckState(a);
735
- }
736
- setCheckState(t) {
737
- const n = this.children.length, a = this.children.reduce((l, i) => {
738
- const r = i.checked ? 1 : i.indeterminate ? 0.5 : 0;
739
- return l + r;
740
- }, 0);
741
- this.checked = this.loaded && this.children.filter((l) => !l.isDisabled).every((l) => l.loaded && l.checked) && t, this.indeterminate = this.loaded && a !== n && a > 0;
742
- }
743
- doCheck(t) {
744
- if (this.checked === t) return;
745
- const { checkStrictly: n, multiple: a } = this.config;
746
- n || !a ? this.checked = t : (this.broadcast("check", t), this.setCheckState(t), this.emit("check"));
747
- }
748
- }
749
- const tt = (e, t) => e.reduce((n, a) => (a.isLeaf ? n.push(a) : (!t && n.push(a), n = n.concat(tt(a.children, t))), n), []);
750
- class Dt {
751
- constructor(t, n) {
752
- M(this, "config");
753
- M(this, "nodes");
754
- M(this, "allNodes");
755
- M(this, "leafNodes");
756
- M(this, "valueNodeMap");
757
- M(this, "pathNodeMap");
758
- this.config = n;
759
- const a = (t || []).map((l) => new Ne(l, this.config));
760
- this.nodes = a, this.allNodes = tt(a, !1), this.leafNodes = tt(a, !0), this.valueNodeMap = /* @__PURE__ */ new Map(), this.pathNodeMap = /* @__PURE__ */ new Map(), this.allNodes.forEach((l) => this.cacheNode(l));
761
- }
762
- cacheNode(t) {
763
- this.valueNodeMap.has(t.value) || this.valueNodeMap.set(t.value, t), this.pathNodeMap.set(JSON.stringify(t.pathValues), t);
764
- }
765
- getNodes() {
766
- return this.nodes;
767
- }
768
- getFlattedNodes(t) {
769
- return t ? this.leafNodes : this.allNodes;
770
- }
771
- appendNode(t, n) {
772
- const a = n ? n.appendChild(t) : new Ne(t, this.config);
773
- n || this.nodes.push(a), this.allNodes.push(a), a.isLeaf && this.leafNodes.push(a), this.cacheNode(a);
774
- }
775
- appendNodes(t, n) {
776
- t.forEach((a) => this.appendNode(a, n));
777
- }
778
- // when checkStrictly, leaf node first
779
- getNodeByValue(t, n = !1) {
780
- if (!t && t !== 0) return null;
781
- if (Array.isArray(t)) {
782
- const l = this.pathNodeMap.get(JSON.stringify(t));
783
- if (l) return l;
784
- } else {
785
- const l = this.valueNodeMap.get(t);
786
- if (l) return l;
787
- }
788
- return this.getFlattedNodes(n).find(
789
- (l) => Pe(l.value, t) || Pe(l.pathValues, t)
790
- ) || null;
791
- }
792
- getSameNode(t) {
793
- return t && this.getFlattedNodes(!1).find(
794
- ({ value: a, level: l }) => Pe(t.value, a) && t.level === l
795
- ) || null;
796
- }
797
- }
798
- const ss = cn({
799
- /**
800
- * @description specify which key of node object is used as the node's value
801
- */
802
- modelValue: {
803
- type: Me([Number, String, Array])
804
- },
805
- /**
806
- * @description data of the options, the key of `value` and `label` can be customize by `CascaderProps`.
807
- */
808
- options: {
809
- type: Me(Array),
810
- default: () => []
811
- },
812
- /**
813
- * @description configuration options, see the following `CascaderProps` table.
814
- */
815
- props: {
816
- type: Me(Object),
817
- default: () => ({})
818
- }
819
- }), os = {
820
- /**
821
- * @description trigger mode of expanding options
822
- */
823
- expandTrigger: "click",
824
- /**
825
- * @description whether multiple selection is enabled
826
- */
827
- multiple: !1,
828
- /**
829
- * @description whether checked state of a node not affects its parent and child nodes
830
- */
831
- checkStrictly: !1,
832
- // whether all nodes can be selected
833
- /**
834
- * @description when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node.
835
- */
836
- emitPath: !0,
837
- // wether to emit an array of all levels value in which node is located
838
- /**
839
- * @description whether to dynamic load child nodes, use with `lazyload` attribute
840
- */
841
- lazy: !1,
842
- /**
843
- * @description method for loading child nodes data, only works when `lazy` is true
844
- */
845
- lazyLoad: ca,
846
- /**
847
- * @description specify which key of node object is used as the node's value
848
- */
849
- value: "value",
850
- /**
851
- * @description specify which key of node object is used as the node's label
852
- */
853
- label: "label",
854
- /**
855
- * @description specify which key of node object is used as the node's children
856
- */
857
- children: "children",
858
- /**
859
- * @description specify which key of node object is used as the node's leaf
860
- */
861
- leaf: "leaf",
862
- /**
863
- * @description specify which key of node object is used as the node's disabled
864
- */
865
- disabled: "disabled",
866
- /**
867
- * @description hover threshold of expanding options
868
- */
869
- hoverThreshold: 500
870
- }, rs = (e) => k(() => fe(fe({}, os), e.props)), It = (e) => {
871
- if (!e) return 0;
872
- const t = e.id.split("-");
873
- return Number(t[t.length - 2]);
874
- }, is = (e) => {
875
- if (!e) return;
876
- const t = e.querySelector("input");
877
- t ? t.click() : sn(e) && e.click();
878
- }, cs = (e, t) => {
879
- const n = t.slice(0), a = n.map((i) => i.uid), l = e.reduce((i, r) => {
880
- const m = a.indexOf(r.uid);
881
- return m > -1 && (i.push(r), n.splice(m, 1), a.splice(m, 1)), i;
882
- }, []);
883
- return l.push(...n), l;
884
- }, us = Se({
885
- name: "ElCascaderPanel",
886
- components: {
887
- CustomCascaderMenu: ns
888
- },
889
- props: je(fe({}, ss), {
890
- border: {
891
- type: Boolean,
892
- default: !0
893
- },
894
- inputWidth: {
895
- type: Number,
896
- default: 0
897
- },
898
- renderLabel: Function
899
- }),
900
- emits: [Be, ze, "close", "expand-change"],
901
- setup(e, { emit: t, slots: n }) {
902
- let a = !1;
903
- const l = Ce("cascader"), i = rs(e);
904
- let r = null;
905
- const m = A(!0), v = A([]), u = A(0), h = A(null), b = A([]), S = A(null), N = A([]), j = k(() => i.value.expandTrigger === "hover"), U = k(() => e.renderLabel || n.default), ee = (f) => {
906
- var d, p;
907
- const s = f == null ? void 0 : f.$el;
908
- return (d = s == null ? void 0 : s.classList) != null && d.contains("vue-recycle-scroller") ? s : ((p = s == null ? void 0 : s.querySelector) == null ? void 0 : p.call(s, ".vue-recycle-scroller")) || s;
909
- }, P = (f = !0) => {
910
- const s = f ? v.value.map((p) => {
911
- var g;
912
- return ((g = ee(p)) == null ? void 0 : g.scrollTop) || 0;
913
- }) : [];
914
- if (u.value++, !f) return;
915
- const d = () => {
916
- v.value.forEach((p, g) => {
917
- const C = ee(p);
918
- C && (C.scrollTop = s[g] || 0);
919
- });
920
- };
921
- ce(() => {
922
- d(), rt && requestAnimationFrame(d);
923
- });
924
- }, W = () => {
925
- const { options: f } = e, s = i.value;
926
- a = !1, r = new Dt(f, s), b.value = [r.getNodes()], s.lazy && et(e.options) ? (m.value = !1, D(void 0, (d) => {
927
- d && (r = new Dt(d, s), b.value = [r.getNodes()]), m.value = !0, te(!1, !0);
928
- })) : te(!1, !0);
929
- }, D = (f, s) => {
930
- const d = i.value;
931
- f = f || new Ne({}, d, void 0, !0), f.loading = !0;
932
- const p = (g) => {
933
- const C = f, V = C.root ? null : C;
934
- g && (r == null || r.appendNodes(g, V)), C.loading = !1, C.loaded = !0, C.childrenData = C.childrenData || [], s && s(g);
935
- };
936
- d.lazyLoad(f, p);
937
- }, _ = (f, s) => {
938
- var C;
939
- const { level: d } = f, p = b.value.slice(0, d);
940
- let g;
941
- f.isLeaf ? g = f.pathNodes[d - 2] : (g = f, p.push(f.children)), ((C = S.value) == null ? void 0 : C.uid) !== (g == null ? void 0 : g.uid) && (S.value = f, b.value = p, !s && t("expand-change", (f == null ? void 0 : f.pathValues) || []));
942
- }, I = (f, s, d = !0) => {
943
- const { checkStrictly: p, multiple: g } = i.value, C = N.value[0];
944
- a = !0, !g && (C == null || C.doCheck(!1)), f.doCheck(s), oe(), d && !g && !p && t("close"), !d && !g && !p && T(f);
945
- }, T = (f) => {
946
- f && (f = f.parent, T(f), f && _(f));
947
- }, R = (f) => r == null ? void 0 : r.getFlattedNodes(f), x = (f) => {
948
- var s;
949
- return (s = R(f)) == null ? void 0 : s.filter((d) => d.checked !== !1);
950
- }, H = (f) => {
951
- const s = (r == null ? void 0 : r.getNodes()) || [];
952
- if (!f) {
953
- S.value = null, b.value = s.length ? [s] : [], P();
954
- return;
955
- }
956
- const d = f.isLeaf ? f.parent : f;
957
- if (!d) {
958
- S.value = null, b.value = s.length ? [s] : [], P();
959
- return;
960
- }
961
- const p = [s];
962
- d.pathNodes.forEach((g) => {
963
- g.isLeaf || p.push(g.children);
964
- }), S.value = d, b.value = p, P();
965
- }, ue = () => {
966
- var f;
967
- (f = R(!1)) == null || f.forEach((s) => {
968
- s.checked = !1, s.indeterminate = !1;
969
- }), N.value = [], h.value = i.value.multiple ? [] : null, b.value = r ? [r.getNodes()] : [], S.value = null, P(!1), t("expand-change", []);
970
- }, oe = () => {
971
- var V;
972
- const { checkStrictly: f, multiple: s } = i.value, d = N.value, p = x(!f), g = cs(d, p), C = g.map((J) => J.valueByOption);
973
- N.value = g, h.value = s ? C : (V = C[0]) != null ? V : null;
974
- }, te = (f = !1, s = !1) => {
975
- const { modelValue: d } = e, { lazy: p, multiple: g, checkStrictly: C } = i.value, V = !C;
976
- if (!(!m.value || a || !s && Pe(d, h.value)))
977
- if (p && !f) {
978
- const F = jt(Vl(xt(d))).map((B) => r == null ? void 0 : r.getNodeByValue(B)).filter((B) => !!B && !B.loaded && !B.loading);
979
- F.length ? F.forEach((B) => {
980
- D(B, () => te(!1, s));
981
- }) : te(!0, s);
982
- } else {
983
- const J = g ? xt(d) : [d], F = jt(J.map((B) => r == null ? void 0 : r.getNodeByValue(B, V)));
984
- re(F, s), h.value = nn(d);
985
- }
986
- }, re = (f, s = !0) => {
987
- var de;
988
- const { checkStrictly: d, multiple: p } = i.value, g = R(!1) || [], C = new Map(g.map((w) => [w.uid, w])), V = (w) => w ? C.get(w.uid) || (r == null ? void 0 : r.getSameNode(w)) || w : null, J = N.value.map((w) => V(w)).filter((w) => !!w), F = f.map((w) => V(w)).filter((w) => !!w && (d || w.isLeaf)), B = (de = S.value) != null && de.isLeaf ? S.value.parent : S.value, ye = B ? r == null ? void 0 : r.getSameNode(B) : null, Ve = new Set(F.map((w) => w.uid)), Ke = new Set(J.map((w) => w.uid)), ke = F.filter((w) => !Ke.has(w.uid)), we = J.filter((w) => !Ve.has(w.uid));
989
- if (!ke.length && !we.length) {
990
- H(s && ye || null), N.value = F;
991
- return;
992
- }
993
- if (p && !d && ke.length + we.length > 80) {
994
- const w = new Set(F);
995
- g.forEach((Y) => {
996
- Y.checked = Y.isLeaf ? w.has(Y) : !1, Y.indeterminate = !1;
997
- }), g.filter((Y) => !Y.isLeaf).sort((Y, Ee) => Ee.level - Y.level).forEach((Y) => Y.onChildCheck()), P();
998
- } else
999
- we.forEach((w) => w.doCheck(!1)), ke.forEach((w) => w.doCheck(!0));
1000
- const G = s && ye || F[0];
1001
- H(G || null), N.value = F;
1002
- }, me = (f) => {
1003
- const s = f.target, { code: d } = f;
1004
- switch (d) {
1005
- case X.up:
1006
- case X.down: {
1007
- f.preventDefault();
1008
- const p = d === X.up ? -1 : 1;
1009
- Fe(on(s, p, `.${l.b("node")}[tabindex="-1"]`));
1010
- break;
1011
- }
1012
- case X.left: {
1013
- f.preventDefault();
1014
- const p = v.value[It(s) - 1], g = p == null ? void 0 : p.$el.querySelector(`.${l.b("node")}[aria-expanded="true"]`);
1015
- Fe(g);
1016
- break;
1017
- }
1018
- case X.right: {
1019
- f.preventDefault();
1020
- const p = v.value[It(s) + 1], g = p == null ? void 0 : p.$el.querySelector(`.${l.b("node")}[tabindex="-1"]`);
1021
- Fe(g);
1022
- break;
1023
- }
1024
- case X.enter:
1025
- is(s);
1026
- break;
1027
- }
1028
- };
1029
- return An(
1030
- ct,
1031
- Pn({
1032
- config: i,
1033
- expandingNode: S,
1034
- checkedNodes: N,
1035
- isHoverMenu: j,
1036
- initialLoaded: m,
1037
- renderLabelFn: U,
1038
- lazyLoad: D,
1039
- expandNode: _,
1040
- handleCheckChange: I
1041
- })
1042
- ), Q([i, () => e.options], W, {
1043
- deep: !0,
1044
- immediate: !0
1045
- }), Q(
1046
- () => e.modelValue,
1047
- () => {
1048
- a = !1, te();
1049
- },
1050
- {
1051
- deep: !0
1052
- }
1053
- ), Q(
1054
- () => h.value,
1055
- (f) => {
1056
- Pe(f, e.modelValue) || (t(Be, f), t(ze, f));
1057
- }
1058
- ), Ln(() => v.value = []), qe(() => !et(e.modelValue) && te()), {
1059
- ns: l,
1060
- menuList: v,
1061
- menuRenderKey: u,
1062
- menus: b,
1063
- checkedNodes: N,
1064
- handleKeyDown: me,
1065
- handleCheckChange: I,
1066
- getFlattedNodes: R,
1067
- /**
1068
- * @description get an array of currently selected node,(leafOnly) whether only return the leaf checked nodes, default is `false`
1069
- */
1070
- getCheckedNodes: x,
1071
- /**
1072
- * @description clear checked nodes
1073
- */
1074
- clearCheckedNodes: ue,
1075
- calculateCheckedValue: oe
1076
- };
1077
- }
1078
- });
1079
- function ds(e, t, n, a, l, i) {
1080
- var m;
1081
- const r = ae("custom-cascader-menu");
1082
- return E(), K("div", {
1083
- class: z([e.ns.b("panel"), e.ns.is("bordered", e.border)]),
1084
- onKeydown: t[0] || (t[0] = (...v) => e.handleKeyDown && e.handleKeyDown(...v))
1085
- }, [
1086
- (m = e.options) != null && m.length ? (E(!0), K($e, { key: 0 }, De(e.menus, (v, u) => (E(), Z(r, {
1087
- key: `${u}-${e.menuRenderKey}`,
1088
- ref_for: !0,
1089
- ref: (h) => e.menuList[u] = h,
1090
- index: u,
1091
- nodes: [...v]
1092
- }, null, 8, ["index", "nodes"]))), 128)) : (E(), K("div", {
1093
- key: 1,
1094
- class: "empty-panel",
1095
- style: nt(e.inputWidth ? { width: e.inputWidth + "px" } : {})
1096
- }, [...t[1] || (t[1] = [
1097
- pe("p", null, "暂无数据", -1)
1098
- ])], 4))
1099
- ], 34);
1100
- }
1101
- const fs = /* @__PURE__ */ lt(us, [["render", ds]]), ps = cn(je(fe({}, Un), {
1102
- /**
1103
- * @description size of input
1104
- */
1105
- size: Kn,
1106
- /**
1107
- * @description placeholder of input
1108
- */
1109
- placeholder: String,
1110
- /**
1111
- * @description whether Cascader is disabled
1112
- */
1113
- disabled: Boolean,
1114
- /**
1115
- * @description whether selected value can be cleared
1116
- */
1117
- clearable: Boolean,
1118
- /**
1119
- * @description whether the options can be searched
1120
- */
1121
- filterable: Boolean,
1122
- /**
1123
- * @description customize search logic, the first parameter is `node`, the second is `keyword`, and need return a boolean value indicating whether it hits.
1124
- */
1125
- filterMethod: {
1126
- type: Me(Function),
1127
- default: (e, t) => e.text.includes(t)
1128
- },
1129
- /**
1130
- * @description option label separator
1131
- */
1132
- separator: {
1133
- type: String,
1134
- default: " / "
1135
- },
1136
- /**
1137
- * @description whether to display all levels of the selected value in the input
1138
- */
1139
- showAllLevels: {
1140
- type: Boolean,
1141
- default: !0
1142
- },
1143
- /**
1144
- * @description whether to collapse tags in multiple selection mode
1145
- */
1146
- collapseTags: Boolean,
1147
- /**
1148
- * @description The max tags number to be shown. To use this, collapse-tags must be true
1149
- */
1150
- maxCollapseTags: {
1151
- type: Number,
1152
- default: 1
1153
- },
1154
- /**
1155
- * @description native input id
1156
- */
1157
- collapseTagsTooltip: {
1158
- type: Boolean,
1159
- default: !1
1160
- },
1161
- /**
1162
- * @description debounce delay when typing filter keyword, in milliseconds
1163
- */
1164
- debounce: {
1165
- type: Number,
1166
- default: 300
1167
- },
1168
- /**
1169
- * @description hook function before filtering with the value to be filtered as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, filtering will be aborted
1170
- */
1171
- beforeFilter: {
1172
- type: Me(Function),
1173
- default: () => !0
1174
- },
1175
- /**
1176
- * @description custom class name for Cascader's dropdown
1177
- */
1178
- popperClass: {
1179
- type: String,
1180
- default: ""
1181
- },
1182
- /**
1183
- * @description whether cascader popup is teleported
1184
- */
1185
- teleported: qn.teleported,
1186
- /**
1187
- * @description tag type
1188
- */
1189
- tagType: je(fe({}, Wn.type), { default: "info" }),
1190
- /**
1191
- * @description whether to trigger form validation
1192
- */
1193
- validateEvent: {
1194
- type: Boolean,
1195
- default: !0
1196
- }
1197
- })), hs = {
1198
- [Be]: (e) => !!e || e === null,
1199
- [ze]: (e) => !!e || e === null,
1200
- focus: (e) => e instanceof FocusEvent,
1201
- blur: (e) => e instanceof FocusEvent,
1202
- visibleChange: (e) => Rl(e),
1203
- expandChange: (e) => !!e,
1204
- removeTag: (e) => !!e
1205
- }, vs = { key: 0 }, gs = ["placeholder"], ms = ["onClick"], ys = "ElCascader", bs = /* @__PURE__ */ Se({
1206
- name: ys,
1207
- __name: "ElCascader",
1208
- props: ps,
1209
- emits: hs,
1210
- setup(e, { expose: t, emit: n }) {
1211
- const a = {
1212
- modifiers: [
1213
- {
1214
- name: "arrowPosition",
1215
- enabled: !0,
1216
- phase: "main",
1217
- fn: ({ state: o }) => {
1218
- const { modifiersData: c, placement: y } = o;
1219
- ["right", "left", "bottom", "top"].includes(y) || (c.arrow.x = 35);
1220
- },
1221
- requires: ["arrow"]
1222
- }
1223
- ]
1224
- }, l = e, i = n, r = Mn();
1225
- let m = 0, v = 0;
1226
- const u = Ce("cascader"), h = Ce("input"), { t: b } = Ut(), { form: S, formItem: N } = _n(), j = A(null), U = A(null), ee = A(null), P = A(null), W = A(null), D = A(!1), _ = A(!1), I = A(!1), T = A(!1), R = A(""), x = A(""), H = A([]), ue = A([]), oe = A([]), te = A(!1), re = A(), me = k(() => r.style), f = k(() => l.disabled || (S == null ? void 0 : S.disabled)), s = k(() => l.placeholder || b("el.cascader.placeholder")), d = k(() => x.value || H.value.length > 0 || te.value ? "" : s.value), p = Jn(), g = k(() => ["small"].includes(p.value) ? "small" : "default"), C = k(() => !!l.props.multiple), V = k(() => !l.filterable || C.value), J = k(() => C.value ? x.value : R.value), F = k(() => {
1227
- var o;
1228
- return ((o = P.value) == null ? void 0 : o.checkedNodes) || [];
1229
- }), B = k(() => !l.clearable || f.value || I.value || !_.value ? !1 : !!F.value.length), ye = k(() => {
1230
- const { showAllLevels: o, separator: c } = l, y = F.value;
1231
- return y.length ? C.value ? "" : y[0].calcText(o, c) : "";
1232
- }), Ve = k({
1233
- get() {
1234
- return nn(l.modelValue);
1235
- },
1236
- set(o) {
1237
- i(Be, o), i(ze, o), l.validateEvent && (N == null || N.validate("change").catch((c) => Wl(c)));
1238
- }
1239
- }), Ke = k(() => [u.b(), u.m(p.value), u.is("disabled", f.value), r.class]), ke = k(() => [h.e("icon"), "icon-arrow-down", u.is("reverse", D.value)]), we = k(() => u.is("focus", D.value || T.value)), _e = k(() => {
1240
- var o, c;
1241
- return (c = (o = j.value) == null ? void 0 : o.popperRef) == null ? void 0 : c.contentRef;
1242
- }), G = (o) => {
1243
- var c, y;
1244
- f.value || (o = o != null ? o : !D.value, o !== D.value && (D.value = o, (y = (c = U.value) == null ? void 0 : c.input) == null || y.setAttribute("aria-expanded", `${o}`), o ? de() : l.filterable && Ge(), i("visibleChange", o)));
1245
- }, de = () => {
1246
- ce(() => {
1247
- var o;
1248
- (o = j.value) == null || o.updatePopper();
1249
- });
1250
- }, w = () => {
1251
- I.value = !1;
1252
- }, Y = (o) => {
1253
- const { showAllLevels: c, separator: y } = l;
1254
- return {
1255
- node: o,
1256
- key: o.uid,
1257
- text: o.calcText(c, y),
1258
- hitState: !1,
1259
- closable: !f.value && !o.isDisabled,
1260
- isCollapseTag: !1
1261
- };
1262
- }, Ee = (o) => {
1263
- var y;
1264
- const c = o.node;
1265
- c.doCheck(!1), (y = P.value) == null || y.calculateCheckedValue(), i("removeTag", c.valueByOption);
1266
- }, un = () => {
1267
- if (!C.value) return;
1268
- const o = F.value, c = [], y = [];
1269
- if (o.forEach((O) => y.push(Y(O))), ue.value = y, o.length) {
1270
- o.slice(0, l.maxCollapseTags).forEach((le) => c.push(Y(le)));
1271
- const O = o.slice(l.maxCollapseTags), se = O.length;
1272
- se && (l.collapseTags ? c.push({
1273
- key: -1,
1274
- text: `+ ${se}`,
1275
- closable: !1,
1276
- isCollapseTag: !0
1277
- }) : O.forEach((le) => c.push(Y(le))));
1278
- }
1279
- H.value = c;
1280
- }, ut = () => {
1281
- var se, le;
1282
- const { filterMethod: o, showAllLevels: c, separator: y } = l, O = (le = (se = P.value) == null ? void 0 : se.getFlattedNodes(!l.props.checkStrictly)) == null ? void 0 : le.filter((ie) => ie.isDisabled ? !1 : (ie.calcText(c, y), o(ie, J.value)));
1283
- C.value && (H.value.forEach((ie) => {
1284
- ie.hitState = !1;
1285
- }), ue.value.forEach((ie) => {
1286
- ie.hitState = !1;
1287
- })), I.value = !0, oe.value = O, de();
1288
- }, dn = () => {
1289
- var c;
1290
- let o;
1291
- I.value && W.value ? o = W.value.$el.querySelector(`.${u.e("suggestion-item")}`) : o = (c = P.value) == null ? void 0 : c.$el.querySelector(`.${u.b("node")}[tabindex="-1"]`), o && (o.focus(), !I.value && o.click());
1292
- }, Je = () => {
1293
- var O, se;
1294
- const o = (O = U.value) == null ? void 0 : O.input, c = ee.value, y = (se = W.value) == null ? void 0 : se.$el;
1295
- if (!(!rt || !o)) {
1296
- if (y) {
1297
- const le = y.querySelector(`.${u.e("suggestion-list")}`);
1298
- le.style.minWidth = `${o.offsetWidth}px`, re.value = o.offsetWidth;
1299
- }
1300
- if (c) {
1301
- const { offsetHeight: le } = c, ie = H.value.length > 0 ? `${Math.max(le + 6, m)}px` : `${m}px`;
1302
- o.style.height = ie, de();
1303
- }
1304
- }
1305
- }, fn = (o) => {
1306
- var c;
1307
- return (c = P.value) == null ? void 0 : c.getCheckedNodes(o);
1308
- }, pn = (o) => {
1309
- de(), i("expandChange", o);
1310
- }, be = (o) => {
1311
- var y;
1312
- const c = (y = o.target) == null ? void 0 : y.value;
1313
- if (o.type === "compositionend")
1314
- te.value = !1, ce(() => Ze(c));
1315
- else {
1316
- const O = c[c.length - 1] || "";
1317
- te.value = !Kl(O);
1318
- }
1319
- }, hn = (o) => {
1320
- if (!te.value)
1321
- switch (o.code) {
1322
- case X.enter:
1323
- G();
1324
- break;
1325
- case X.down:
1326
- G(!0), ce(dn), o.preventDefault();
1327
- break;
1328
- case X.esc:
1329
- D.value === !0 && (o.preventDefault(), o.stopPropagation(), G(!1));
1330
- break;
1331
- case X.tab:
1332
- G(!1);
1333
- break;
1334
- }
1335
- }, vn = () => {
1336
- var o;
1337
- (o = P.value) == null || o.clearCheckedNodes(), !D.value && l.filterable && Ge(), G(!1);
1338
- }, Ge = () => {
1339
- const { value: o } = ye;
1340
- R.value = o, x.value = o;
1341
- }, gn = (o) => {
1342
- var y, O;
1343
- const { checked: c } = o;
1344
- C.value ? (y = P.value) == null || y.handleCheckChange(o, !c, !1) : (!c && ((O = P.value) == null || O.handleCheckChange(o, !0, !1)), G(!1));
1345
- }, mn = (o) => {
1346
- const c = o.target, { code: y } = o;
1347
- switch (y) {
1348
- case X.up:
1349
- case X.down: {
1350
- const O = y === X.up ? -1 : 1;
1351
- Fe(on(c, O, `.${u.e("suggestion-item")}[tabindex="-1"]`));
1352
- break;
1353
- }
1354
- case X.enter:
1355
- c.click();
1356
- break;
1357
- }
1358
- }, yn = () => {
1359
- const o = H.value, c = o[o.length - 1];
1360
- v = x.value ? 0 : v + 1, !(!c || !v || l.collapseTags && o.length > 1) && (c.hitState ? Ee(c) : c.hitState = !0);
1361
- }, dt = (o) => {
1362
- const c = o.target, y = u.e("search-input");
1363
- c.className === y && (T.value = !0), i("focus", o);
1364
- }, ft = (o) => {
1365
- T.value = !1, i("blur", o);
1366
- }, bn = ia(() => {
1367
- const { value: o } = J;
1368
- if (!o) return;
1369
- const c = l.beforeFilter(o);
1370
- pa(c) ? c.then(ut).catch(() => {
1371
- }) : c !== !1 ? ut() : w();
1372
- }, l.debounce), Ze = (o, c) => {
1373
- !D.value && G(!0), !(c != null && c.isComposing) && (o ? bn() : w());
1374
- }, Cn = () => {
1375
- var c;
1376
- const o = (c = U.value) == null ? void 0 : c.input;
1377
- o && (re.value = parseFloat(o.offsetWidth), console.log(re.value));
1378
- }, pt = (o) => Number.parseFloat(Fl(h.cssVarName("input-height"), o).value) - 2;
1379
- return Q(I, de), Q([F, f], un), Q(H, () => {
1380
- ce(() => Je());
1381
- }), Q(p, () => gt(null, null, function* () {
1382
- yield ce();
1383
- const o = U.value.input;
1384
- m = pt(o) || m, Je();
1385
- })), Q(ye, Ge, { immediate: !0 }), qe(() => {
1386
- const o = U.value.input, c = pt(o);
1387
- m = o.offsetHeight || c, Bl(o, Je), Cn();
1388
- }), t({
1389
- /**
1390
- * @description get an array of currently selected node,(leafOnly) whether only return the leaf checked nodes, default is `false`
1391
- */
1392
- getCheckedNodes: fn,
1393
- /**
1394
- * @description cascader panel ref
1395
- */
1396
- cascaderPanelRef: P,
1397
- /**
1398
- * @description toggle the visible of popper
1399
- */
1400
- togglePopperVisible: G,
1401
- /**
1402
- * @description cascader content ref
1403
- */
1404
- contentRef: _e
1405
- }), (o, c) => (E(), Z($(Gn), { "z-index": 3e3 }, {
1406
- default: q(() => [
1407
- ne($(Ct), {
1408
- ref_key: "tooltipRef",
1409
- ref: j,
1410
- visible: D.value,
1411
- teleported: o.teleported,
1412
- "popper-class": [$(u).e("dropdown"), o.popperClass],
1413
- "popper-options": a,
1414
- "fallback-placements": ["bottom-start", "bottom", "top-start", "top", "right", "left"],
1415
- "stop-popper-mouse-event": !1,
1416
- "gpu-acceleration": !1,
1417
- placement: "bottom-start",
1418
- transition: `${$(u).namespace.value}-zoom-in-top`,
1419
- effect: "light",
1420
- pure: "",
1421
- persistent: "",
1422
- onHide: w
1423
- }, {
1424
- default: q(() => [
1425
- xe((E(), K("div", {
1426
- class: z(Ke.value),
1427
- style: nt(me.value),
1428
- onClick: c[5] || (c[5] = () => G(V.value ? void 0 : !0)),
1429
- onKeydown: hn,
1430
- onMouseenter: c[6] || (c[6] = (y) => _.value = !0),
1431
- onMouseleave: c[7] || (c[7] = (y) => _.value = !1)
1432
- }, [
1433
- ne($(Zn), {
1434
- ref_key: "input",
1435
- ref: U,
1436
- modelValue: R.value,
1437
- "onUpdate:modelValue": c[1] || (c[1] = (y) => R.value = y),
1438
- placeholder: d.value,
1439
- readonly: V.value,
1440
- disabled: f.value,
1441
- "validate-event": !1,
1442
- size: $(p),
1443
- class: z(we.value),
1444
- tabindex: C.value && o.filterable && !f.value ? -1 : void 0,
1445
- onCompositionstart: be,
1446
- onCompositionupdate: be,
1447
- onCompositionend: be,
1448
- onFocus: dt,
1449
- onBlur: ft,
1450
- onInput: Ze
1451
- }, {
1452
- suffix: q(() => [
1453
- B.value ? (E(), Z($(Ae), {
1454
- key: "clear",
1455
- class: z([$(h).e("icon"), "icon-circle-close"]),
1456
- onClick: Te(vn, ["stop"])
1457
- }, {
1458
- default: q(() => [
1459
- ne($(Bn))
1460
- ]),
1461
- _: 1
1462
- }, 8, ["class"])) : (E(), Z($(Ae), {
1463
- key: "arrow-down",
1464
- class: z(ke.value),
1465
- onClick: c[0] || (c[0] = Te((y) => G(), ["stop"]))
1466
- }, {
1467
- default: q(() => [
1468
- ne($(zn))
1469
- ]),
1470
- _: 1
1471
- }, 8, ["class"]))
1472
- ]),
1473
- _: 1
1474
- }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
1475
- C.value ? (E(), K("div", {
1476
- key: 0,
1477
- ref_key: "tagWrapper",
1478
- ref: ee,
1479
- class: z($(u).e("tags"))
1480
- }, [
1481
- (E(!0), K($e, null, De(H.value, (y) => (E(), Z($(Nt), {
1482
- key: y.key,
1483
- type: o.tagType,
1484
- size: g.value,
1485
- hit: y.hitState,
1486
- closable: y.closable,
1487
- "disable-transitions": "",
1488
- onClose: (O) => Ee(y)
1489
- }, {
1490
- default: q(() => [
1491
- y.isCollapseTag === !1 ? (E(), K("span", vs, he(y.text), 1)) : (E(), Z($(Ct), {
1492
- key: 1,
1493
- disabled: D.value || !o.collapseTagsTooltip,
1494
- "fallback-placements": ["bottom", "top", "right", "left"],
1495
- placement: "bottom",
1496
- effect: "light"
1497
- }, {
1498
- default: q(() => [
1499
- pe("span", null, he(y.text), 1)
1500
- ]),
1501
- content: q(() => [
1502
- pe("div", {
1503
- class: z($(u).e("collapse-tags"))
1504
- }, [
1505
- (E(!0), K($e, null, De(ue.value.slice(o.maxCollapseTags), (O, se) => (E(), K("div", {
1506
- key: se,
1507
- class: z($(u).e("collapse-tag"))
1508
- }, [
1509
- (E(), Z($(Nt), {
1510
- key: O.key,
1511
- class: "in-tooltip",
1512
- type: o.tagType,
1513
- size: g.value,
1514
- hit: O.hitState,
1515
- closable: O.closable,
1516
- "disable-transitions": "",
1517
- onClose: (le) => Ee(O)
1518
- }, {
1519
- default: q(() => [
1520
- pe("span", null, he(O.text), 1)
1521
- ]),
1522
- _: 2
1523
- }, 1032, ["type", "size", "hit", "closable", "onClose"]))
1524
- ], 2))), 128))
1525
- ], 2)
1526
- ]),
1527
- _: 2
1528
- }, 1032, ["disabled"]))
1529
- ]),
1530
- _: 2
1531
- }, 1032, ["type", "size", "hit", "closable", "onClose"]))), 128)),
1532
- o.filterable && !f.value ? xe((E(), K("input", {
1533
- key: 0,
1534
- "onUpdate:modelValue": c[2] || (c[2] = (y) => x.value = y),
1535
- type: "text",
1536
- class: z($(u).e("search-input")),
1537
- placeholder: ye.value ? "" : s.value,
1538
- onInput: c[3] || (c[3] = (y) => Ze(x.value, y)),
1539
- onClick: c[4] || (c[4] = Te((y) => G(!0), ["stop"])),
1540
- onKeydown: Vn(yn, ["delete"]),
1541
- onCompositionstart: be,
1542
- onCompositionupdate: be,
1543
- onCompositionend: be,
1544
- onFocus: dt,
1545
- onBlur: ft
1546
- }, null, 42, gs)), [
1547
- [On, x.value]
1548
- ]) : ve("", !0)
1549
- ], 2)) : ve("", !0)
1550
- ], 38)), [
1551
- [$(Yn), () => G(!1), _e.value]
1552
- ])
1553
- ]),
1554
- content: q(() => [
1555
- xe(ne(fs, {
1556
- ref_key: "cascaderPanelRef",
1557
- ref: P,
1558
- inputWidth: re.value,
1559
- modelValue: Ve.value,
1560
- "onUpdate:modelValue": c[8] || (c[8] = (y) => Ve.value = y),
1561
- options: o.options,
1562
- props: l.props,
1563
- border: !1,
1564
- "render-label": o.$slots.default,
1565
- onExpandChange: pn,
1566
- onClose: c[9] || (c[9] = (y) => o.$nextTick(() => G(!1)))
1567
- }, null, 8, ["inputWidth", "modelValue", "options", "props", "render-label"]), [
1568
- [mt, !I.value]
1569
- ]),
1570
- o.filterable ? xe((E(), Z($(qt), {
1571
- key: 0,
1572
- ref_key: "suggestionPanel",
1573
- ref: W,
1574
- tag: "ul",
1575
- class: z($(u).e("suggestion-panel")),
1576
- "view-class": $(u).e("suggestion-list"),
1577
- onKeydown: mn
1578
- }, {
1579
- default: q(() => [
1580
- oe.value.length ? (E(!0), K($e, { key: 0 }, De(oe.value, (y) => (E(), K("li", {
1581
- key: y.uid,
1582
- class: z([$(u).e("suggestion-item"), $(u).is("checked", y.checked)]),
1583
- tabindex: -1,
1584
- onClick: (O) => gn(y)
1585
- }, [
1586
- pe("span", null, he(y.text), 1),
1587
- y.checked ? (E(), Z($(Ae), { key: 0 }, {
1588
- default: q(() => [
1589
- ne($(Wt))
1590
- ]),
1591
- _: 1
1592
- })) : ve("", !0)
1593
- ], 10, ms))), 128)) : Rt(o.$slots, "empty", { key: 1 }, () => [
1594
- pe("li", {
1595
- class: z($(u).e("empty-text"))
1596
- }, he($(b)("el.cascader.noMatch")), 3)
1597
- ])
1598
- ]),
1599
- _: 3
1600
- }, 8, ["class", "view-class"])), [
1601
- [mt, I.value]
1602
- ]) : ve("", !0)
1603
- ]),
1604
- _: 3
1605
- }, 8, ["visible", "teleported", "popper-class", "transition"])
1606
- ]),
1607
- _: 3
1608
- }));
1609
- }
1610
- }), Ls = /* @__PURE__ */ Se({
1611
- __name: "FgCascader",
1612
- props: /* @__PURE__ */ yt({
1613
- props: {
1614
- type: Object,
1615
- default: () => ({})
1616
- },
1617
- /** 级联展示时候是否有全选 */
1618
- selectAll: {
1619
- type: Boolean,
1620
- default: () => !1
1621
- },
1622
- options: {
1623
- type: Array,
1624
- default: () => []
1625
- },
1626
- filterMethod: {
1627
- type: Function,
1628
- default: null
1629
- },
1630
- /** 筛选后是否有全选 */
1631
- filterSelectAll: {
1632
- type: Boolean,
1633
- default: () => !1
1634
- },
1635
- poperClass: {
1636
- type: String,
1637
- default: () => ""
1638
- },
1639
- // 用于搜索后在匹配标签
1640
- labelIds: {
1641
- type: Array,
1642
- default: () => []
1643
- },
1644
- // 用于搜索后在标签后显示内容
1645
- labelName: {
1646
- type: String,
1647
- default: () => ""
1648
- },
1649
- // 用于搜索后在标签前还是标签后插入,默认标签后
1650
- labelInsertHeader: {
1651
- type: Boolean,
1652
- default: () => !1
1653
- },
1654
- // 用于搜索后在标签前插入的icon
1655
- labelIcon: {
1656
- type: String,
1657
- default: () => ""
1658
- },
1659
- teleported: {
1660
- type: Boolean,
1661
- default: () => !1
1662
- }
1663
- }, {
1664
- modelValue: {},
1665
- modelModifiers: {}
1666
- }),
1667
- emits: /* @__PURE__ */ yt(["change"], ["update:modelValue"]),
1668
- setup(e, { emit: t }) {
1669
- const n = jn(), a = e, l = xn(e, "modelValue"), i = fe({ expandTrigger: "hover", emitPath: !1 }, a.props), r = A(0);
1670
- Q(
1671
- () => a.options,
1672
- () => {
1673
- var s;
1674
- (s = l.value) != null && s.length && ce(() => {
1675
- r.value++;
1676
- });
1677
- },
1678
- {
1679
- deep: !0
1680
- }
1681
- );
1682
- const m = t, v = A(), u = A(!1);
1683
- let h = null, b, S, N = [];
1684
- const j = k(() => a.selectAll && a.options.length > 0 ? [{ [i.label || "label"]: "全选", [i.value || "value"]: "ALL" }, ...a.options] : a.options), U = (s, d) => {
1685
- if (d === "add") {
1686
- const p = l.value ? JSON.parse(JSON.stringify(l.value)) : [];
1687
- s.forEach((g) => {
1688
- p.find((C) => String(C) === String(g)) || p.push(g);
1689
- }), l.value = p;
1690
- } else
1691
- l.value = l.value.filter((p) => !s.find((g) => String(g) === String(p)));
1692
- ce(() => {
1693
- m("change", [...l.value]);
1694
- });
1695
- }, ee = () => {
1696
- u.value = !u.value, S.textContent = u.value ? "取消全选" : "全选", Object.prototype.hasOwnProperty.call(a.props, "emitPath") ? U(a.props.emitPath ? N.map((s) => s.pathValues) : N.map((s) => s.pathValues[s.pathValues.length - 1]), u.value ? "add" : "remove") : U(
1697
- N.map((s) => s.pathValues[s.pathValues.length - 1]),
1698
- u.value ? "add" : "remove"
1699
- );
1700
- }, P = () => {
1701
- a.filterSelectAll && (u.value = !1, S.textContent = "全选");
1702
- }, W = () => {
1703
- var p, g;
1704
- const s = (g = (p = v.value) == null ? void 0 : p.cascaderPanelRef) == null ? void 0 : g.$el.parentNode;
1705
- if (!s || !n.footer || h && s.contains(h)) return;
1706
- h = document.createElement("div"), h.className = "cascader-footer-slot", s.appendChild(h), bt(Qe(() => Qe("div", { class: "cascader-footer-wrapper" }, n.footer())), h);
1707
- }, D = () => {
1708
- h && (bt(null, h), h.parentNode && h.parentNode.removeChild(h), h = null);
1709
- }, _ = () => {
1710
- var C, V, J;
1711
- const s = (J = (V = (C = v.value) == null ? void 0 : C.cascaderPanelRef) == null ? void 0 : V.$el) == null ? void 0 : J.parentNode, d = s == null ? void 0 : s.querySelector(".el-cascader__suggestion-panel"), p = d == null ? void 0 : d.querySelector(".el-cascader__suggestion-list");
1712
- !p || p.querySelector(".select-all") || (b = document.createElement("li"), b.className = "el-cascader__suggestion-item select-all", b.style.display = "none", S = document.createElement("span"), S.textContent = "全选", b.appendChild(S), p.prepend(b), b.onclick = () => {
1713
- ee();
1714
- });
1715
- }, I = (s) => {
1716
- var C, V, J;
1717
- const d = (J = (V = (C = v.value) == null ? void 0 : C.cascaderPanelRef) == null ? void 0 : V.$el) == null ? void 0 : J.parentNode, p = d == null ? void 0 : d.querySelector(".el-cascader__suggestion-panel"), g = p == null ? void 0 : p.querySelector(".el-cascader__suggestion-list");
1718
- g && ce(() => {
1719
- setTimeout(() => {
1720
- const F = Array.from(g.querySelectorAll(".el-cascader__suggestion-item")).find((B) => B.querySelector("span").textContent === s.text);
1721
- if (F && a.labelIds.includes(s.value)) {
1722
- if (F.querySelector("i")) return;
1723
- const B = document.createElement("i");
1724
- B.className = `el-cascader__suggestion-item-label text-[#aaa] text-[12px] ${a.labelIcon}`, B.textContent = a.labelName, a.labelInsertHeader ? F.insertBefore(B, F.firstChild) : F.appendChild(B);
1725
- }
1726
- });
1727
- });
1728
- }, T = (s, d) => {
1729
- a.filterSelectAll && (_(), s.keyword = d, N = N.filter((g) => g.keyword === d));
1730
- const p = a.filterMethod ? a.filterMethod(s, d) : R(s.text, d);
1731
- return p && a.filterSelectAll && !N.find((g) => g.uid === s.uid) && N.push(fe({}, s)), a.filterSelectAll && b && (b.style.display = N.length ? "flex" : "none"), a.labelIds.length && p && I(s), p;
1732
- };
1733
- function R(s, d) {
1734
- return s.toLowerCase().includes(d.toLowerCase());
1735
- }
1736
- const x = A(!1), H = (s) => {
1737
- l.value = s, m("change", s);
1738
- }, ue = (s, d = []) => {
1739
- const p = [];
1740
- return s.forEach((g) => {
1741
- const C = g[i.value || "value"], V = [...d, C];
1742
- g.children && g.children.length > 0 ? p.push(...ue(g.children, V)) : p.push(i.emitPath ? V : C);
1743
- }), p;
1744
- }, oe = () => ue(j.value.filter((s) => s[i.value || "value"] !== "ALL")), te = (s) => !s || s.length === 0 ? !1 : i.emitPath ? s.some((d) => Array.isArray(d) && d.includes("ALL")) : s.includes("ALL"), re = (s) => !s || s.length === 0 ? [] : i.emitPath ? s.filter((d) => !Array.isArray(d) || !d.includes("ALL")) : s.filter((d) => d !== "ALL"), me = (s) => {
1745
- const d = oe(), p = re(s || []);
1746
- if (p.length !== d.length) return !1;
1747
- const g = new Set(p.map((C) => JSON.stringify(C)));
1748
- return d.every((C) => g.has(JSON.stringify(C)));
1749
- }, f = (s) => {
1750
- if (a.selectAll) {
1751
- const d = re(s || []), p = oe(), g = i.emitPath ? [["ALL"]] : ["ALL"], C = te(s), V = me(s);
1752
- if (x.value) {
1753
- V ? (x.value = !1, H([])) : (x.value = !1, H(d));
1754
- return;
1755
- }
1756
- C ? (x.value = !0, H([...g, ...p])) : (x.value = V, H(d));
1757
- } else
1758
- H(s);
1759
- };
1760
- return Q(
1761
- [() => l.value, () => a.options],
1762
- () => {
1763
- if (!a.selectAll) {
1764
- x.value = !1;
1765
- return;
1766
- }
1767
- x.value = me(l.value);
1768
- },
1769
- {
1770
- deep: !0,
1771
- immediate: !0
1772
- }
1773
- ), qe(() => {
1774
- a.filterSelectAll && _(), n.footer && W();
1775
- }), Dn(() => {
1776
- D();
1777
- }), (s, d) => (E(), Z(bs, In({
1778
- key: r.value,
1779
- ref_key: "cascaderRef",
1780
- ref: v,
1781
- modelValue: l.value,
1782
- "onUpdate:modelValue": d[0] || (d[0] = (p) => l.value = p),
1783
- "popper-class": `cascader-popper-deep ${e.poperClass}`,
1784
- teleported: e.teleported,
1785
- props: i,
1786
- options: j.value,
1787
- "collapse-tags": "",
1788
- "collapse-tags-tooltip": "",
1789
- clearable: "",
1790
- filterable: ""
1791
- }, s.$attrs, {
1792
- "filter-method": T,
1793
- onChange: f,
1794
- onFocus: P
1795
- }), {
1796
- default: q(({ data: p }) => [
1797
- Rt(s.$slots, "customer", { data: p }, () => [
1798
- pe("span", null, he(p[i.label || "label"]), 1)
1799
- ])
1800
- ]),
1801
- _: 3
1802
- }, 16, ["modelValue", "popper-class", "teleported", "options"]));
1803
- }
1804
- });
1805
- export {
1806
- Ls as _
1807
- };