@witlink/components 0.0.3 → 1.0.0

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/index.js ADDED
@@ -0,0 +1,998 @@
1
+ import { markRaw as q, createElementBlock as D, openBlock as M, createElementVNode as S, defineComponent as j, mergeModels as z, useModel as ie, useSlots as le, useAttrs as be, resolveComponent as L, createBlock as W, mergeProps as F, createSlots as H, renderList as O, withCtx as w, unref as $, renderSlot as A, normalizeProps as ue, guardReactiveProps as xe, createVNode as T, ref as _, getCurrentInstance as ce, computed as U, onMounted as de, onUnmounted as Ce, normalizeClass as ke, normalizeStyle as Z, isRef as we, withKeys as Se, withModifiers as G, Fragment as Y, createTextVNode as V, toDisplayString as Q, nextTick as J, shallowRef as R, shallowReadonly as Ee, toValue as P, getCurrentScope as Me, onScopeDispose as Ne, watch as $e, toRaw as Te, render as pe, h as ee } from "vue";
2
+ import { isNullOrUndef as B, hasPermission as Le } from "./utils.js";
3
+ import { UserCenterKey as xt, buildTree as Ct, exportFile as kt, forEachTree as wt, getButtonPermissions as St, getLocale as Et, getMenuInfo as Mt, getToken as Nt, getUserCenterParams as $t, getUserCenterParamsByUrl as Tt, getUserInfo as Lt, is as Bt, isArray as Dt, isAsyncFunction as Pt, isBoolean as At, isClient as Rt, isDate as Wt, isDef as Ft, isElement as Ot, isFunction as Ut, isImageDom as jt, isNull as zt, isNumber as Vt, isObject as It, isPromise as Kt, isServer as qt, isString as Ht, isUndef as Xt, isWindow as Zt, logoutToUserCenter as Gt, removeAll as Yt, removeLocale as Qt, removeToken as Jt, setLocale as en, setMenuInfo as tn, setToken as nn, setUserCenterParams as on, setUserInfo as an, toUserCenterConsole as sn } from "./utils.js";
4
+ import te from "dayjs";
5
+ import { message as Be, Tooltip as De } from "ant-design-vue";
6
+ const Pe = {
7
+ class: "icon",
8
+ viewBox: "0 0 1024 1024",
9
+ width: "1.2em",
10
+ height: "1.2em"
11
+ };
12
+ function Ae(e, t) {
13
+ return M(), D("svg", Pe, t[0] || (t[0] = [
14
+ S("path", {
15
+ fill: "currentColor",
16
+ d: "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8"
17
+ }, null, -1),
18
+ S("path", {
19
+ fill: "currentColor",
20
+ d: "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"
21
+ }, null, -1)
22
+ ]));
23
+ }
24
+ const Re = q({ name: "ant-design-plus", render: Ae }), We = {
25
+ class: "icon",
26
+ viewBox: "0 0 1024 1024",
27
+ width: "1.2em",
28
+ height: "1.2em"
29
+ };
30
+ function Fe(e, t) {
31
+ return M(), D("svg", We, t[0] || (t[0] = [
32
+ S("path", {
33
+ fill: "currentColor",
34
+ d: "M872 474H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8"
35
+ }, null, -1)
36
+ ]));
37
+ }
38
+ const Oe = q({ name: "ant-design-minus", render: Fe }), Ue = /* @__PURE__ */ j({
39
+ inheritAttrs: !1,
40
+ __name: "index",
41
+ props: /* @__PURE__ */ z({
42
+ precision: {
43
+ type: Number
44
+ },
45
+ stringMode: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ customControls: {
50
+ type: Boolean,
51
+ default: !1
52
+ }
53
+ }, {
54
+ value: {},
55
+ valueModifiers: {}
56
+ }),
57
+ emits: /* @__PURE__ */ z(["change"], ["update:value"]),
58
+ setup(e, { emit: t }) {
59
+ const n = ie(e, "value"), r = e, l = t, i = le(), o = be();
60
+ function a(d) {
61
+ if (B(d))
62
+ n.value = null, l("change", null);
63
+ else {
64
+ let v = d;
65
+ r.stringMode && (v = Number(v).toFixed(r.precision)), n.value !== v && (n.value = v, l("change", v));
66
+ }
67
+ }
68
+ function u() {
69
+ if (B(n.value))
70
+ return;
71
+ let d = n.value;
72
+ r.stringMode && (d = Number(d).toFixed(r.precision)), n.value = d;
73
+ }
74
+ function c() {
75
+ if (o.disabled) return;
76
+ const d = Number(n.value);
77
+ !B(o.min) && d <= Number(o.min) || a(d - 1);
78
+ }
79
+ function s() {
80
+ if (o.disabled) return;
81
+ const d = Number(n.value);
82
+ !B(o.max) && d >= Number(o.max) || a(d + 1);
83
+ }
84
+ return (d, v) => {
85
+ const h = Oe, b = Re, x = L("a-input-number");
86
+ return M(), W(x, F({
87
+ value: n.value,
88
+ precision: e.precision,
89
+ stringMode: e.stringMode,
90
+ controls: !e.customControls,
91
+ onChange: a,
92
+ onBlur: u
93
+ }, d.$attrs), H({ _: 2 }, [
94
+ O(Object.keys($(i)), (m) => ({
95
+ name: m,
96
+ fn: w((f) => [
97
+ A(d.$slots, m, ue(xe(f)))
98
+ ])
99
+ })),
100
+ e.customControls ? {
101
+ name: "addonBefore",
102
+ fn: w(() => [
103
+ S("div", {
104
+ class: "btn-control",
105
+ onClick: c
106
+ }, [
107
+ T(h, { class: "btn-icon" })
108
+ ])
109
+ ]),
110
+ key: "0"
111
+ } : void 0,
112
+ e.customControls ? {
113
+ name: "addonAfter",
114
+ fn: w(() => [
115
+ S("div", {
116
+ class: "btn-control",
117
+ onClick: s
118
+ }, [
119
+ T(b, { class: "btn-icon" })
120
+ ])
121
+ ]),
122
+ key: "1"
123
+ } : void 0
124
+ ]), 1040, ["value", "precision", "stringMode", "controls"]);
125
+ };
126
+ }
127
+ }), je = /* @__PURE__ */ j({
128
+ __name: "index",
129
+ props: {
130
+ value: {},
131
+ // 最大可选择时间距离当日多长时间,默认0,代表当日
132
+ max: {
133
+ type: Number,
134
+ default: 0
135
+ },
136
+ maxUnit: {
137
+ type: String,
138
+ default: "day"
139
+ },
140
+ // 最小可选择时间距离当日多长时间,默认0,代表当日
141
+ min: {
142
+ type: Number,
143
+ default: 0
144
+ },
145
+ minUnit: {
146
+ type: String,
147
+ default: "day"
148
+ },
149
+ // 可选择时间间隔,默认60天
150
+ interval: {
151
+ type: Number,
152
+ default: 60
153
+ }
154
+ },
155
+ emits: ["update:value", "change"],
156
+ setup(e, { emit: t }) {
157
+ const n = e, r = t, l = _(), i = _(), o = (s) => {
158
+ const d = te().add(n.max, n.maxUnit), v = te().subtract(n.min, n.minUnit), h = n.interval;
159
+ if (!l.value || l.value.length === 0)
160
+ return s.isAfter(d) || s.isBefore(v);
161
+ const b = l.value[0] && (s.diff(l.value[0], "days") > h || s.isAfter(d));
162
+ return l.value[1] && (l.value[1].diff(s, "days") > h || s.isBefore(v)) || b;
163
+ }, a = (s) => {
164
+ s ? (l.value = [], i.value = []) : i.value = void 0;
165
+ }, u = (s) => {
166
+ r("update:value", s), r("change", s);
167
+ }, c = (s) => {
168
+ l.value = s;
169
+ };
170
+ return (s, d) => {
171
+ const v = L("a-range-picker");
172
+ return M(), W(v, F({
173
+ value: $(i) || e.value,
174
+ "disabled-date": o,
175
+ onChange: u,
176
+ onOpenChange: a,
177
+ onCalendarChange: c
178
+ }, s.$attrs), H({ _: 2 }, [
179
+ O(Object.keys(s.$slots), (h) => ({
180
+ name: h,
181
+ fn: w((b) => [
182
+ A(s.$slots, h)
183
+ ])
184
+ }))
185
+ ]), 1040, ["value"]);
186
+ };
187
+ }
188
+ });
189
+ function fe(e) {
190
+ e || (e = ce());
191
+ const t = (e == null ? void 0 : e.provides) || {}, n = ze(t, "configProvider");
192
+ return t[n];
193
+ }
194
+ function ze(e, t) {
195
+ for (; e; ) {
196
+ const n = Reflect.ownKeys(e).find(
197
+ (r) => r === t || typeof r == "symbol" && r.description === t
198
+ );
199
+ if (n)
200
+ return n;
201
+ e = Object.getPrototypeOf(e);
202
+ }
203
+ return null;
204
+ }
205
+ const Ve = /* @__PURE__ */ j({
206
+ inheritAttrs: !1,
207
+ __name: "index",
208
+ props: {
209
+ loadData: {
210
+ type: Function,
211
+ required: !0
212
+ },
213
+ formatSortParams: {
214
+ type: Boolean,
215
+ default: !0
216
+ }
217
+ },
218
+ setup(e, { expose: t }) {
219
+ const n = e, r = le(), l = _([]), i = _(!1), o = _(0), a = _(1), u = _(10), c = _(), s = _(), d = {
220
+ zh: "共 {num} 条",
221
+ en: "Total {num} items",
222
+ fr: "Total de {num}"
223
+ }, v = fe(), h = U(() => {
224
+ var k, C, N;
225
+ return ((N = (C = (k = v == null ? void 0 : v.locale) == null ? void 0 : k.value) == null ? void 0 : C.locale) == null ? void 0 : N.slice(0, 2)) || "en";
226
+ }), b = U(() => ({
227
+ total: o.value,
228
+ current: a.value,
229
+ pageSize: u.value,
230
+ showSizeChanger: !0,
231
+ size: "small",
232
+ showTotal: (y) => d[h.value].replace("{num}", y)
233
+ }));
234
+ function x() {
235
+ var y;
236
+ if (typeof n.loadData == "function") {
237
+ i.value = !0;
238
+ const k = { pageNo: a.value, pageSize: u.value };
239
+ n.formatSortParams && ((y = s.value) != null && y.orderMap) && (k[s.value.field + "SortField"] = s.value.orderMap), n.loadData(k, c.value, s.value).then((C) => {
240
+ i.value = !1, (C == null ? void 0 : C.code) === 0 && (o.value = C.result.totalCount, l.value = C.result.data);
241
+ });
242
+ }
243
+ }
244
+ function m(y, k, C) {
245
+ if (a.value = y.current, u.value = y.pageSize, c.value = k, C) {
246
+ const N = {
247
+ ascend: "asc",
248
+ descend: "desc"
249
+ };
250
+ C.orderMap = N[C.order] || "";
251
+ }
252
+ s.value = C, x();
253
+ }
254
+ function f(y, k) {
255
+ k.width = y;
256
+ }
257
+ function p() {
258
+ a.value = 1, x();
259
+ }
260
+ function g() {
261
+ a.value = 1, o.value = 0, l.value = [];
262
+ }
263
+ return t({
264
+ loadData: x,
265
+ refresh: p,
266
+ reset: g
267
+ }), (y, k) => {
268
+ const C = L("a-table");
269
+ return M(), W(C, F({
270
+ class: "table-ex",
271
+ loading: $(i),
272
+ pagination: $(b),
273
+ dataSource: $(l),
274
+ onChange: m,
275
+ onResizeColumn: f
276
+ }, y.$attrs), H({ _: 2 }, [
277
+ O(Object.keys($(r)), (N) => ({
278
+ name: N,
279
+ fn: w((E) => [
280
+ N !== "emptyText" ? A(y.$slots, N, ue(F({ key: 0 }, E))) : A(y.$slots, N, { key: 1 })
281
+ ])
282
+ }))
283
+ ]), 1040, ["loading", "pagination", "dataSource"]);
284
+ };
285
+ }
286
+ }), Ie = /* @__PURE__ */ j({
287
+ __name: "index",
288
+ props: {
289
+ leftMin: {
290
+ type: Number,
291
+ default: 0.1
292
+ },
293
+ leftMax: {
294
+ type: Number,
295
+ default: 0.3
296
+ },
297
+ bordered: {
298
+ type: Boolean,
299
+ default: !0
300
+ }
301
+ },
302
+ setup(e) {
303
+ const t = e, n = _(), r = _(), l = _({}), i = _({}), o = _(0.2);
304
+ function a(c) {
305
+ l.value = { width: `calc(${c * 100}% - 5px)` }, i.value = { width: `calc(${(1 - c) * 100}% - 5px)` };
306
+ }
307
+ function u() {
308
+ const c = n.value;
309
+ if (!c)
310
+ return;
311
+ const s = c.clientWidth, d = c.getBoundingClientRect(), v = d.left;
312
+ function h(x) {
313
+ x.preventDefault(), (x.clientX < d.left || x.clientX > d.right || x.clientY < d.top || x.clientY > d.bottom) && b();
314
+ const f = (x.clientX - v) / s;
315
+ f > t.leftMin && f < t.leftMax && (o.value = f, a(f));
316
+ }
317
+ function b() {
318
+ document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", b);
319
+ }
320
+ document.addEventListener("mousemove", h), document.addEventListener("mouseup", b);
321
+ }
322
+ return de(() => {
323
+ a(o.value), r.value && r.value.addEventListener("mousedown", u, !1);
324
+ }), Ce(() => {
325
+ r.value && r.value.removeEventListener("mousedown", u);
326
+ }), (c, s) => (M(), D("div", {
327
+ ref_key: "container",
328
+ ref: n,
329
+ class: ke(["wl-splitter", { bordered: e.bordered }])
330
+ }, [
331
+ S("div", {
332
+ class: "my-left",
333
+ style: Z($(l))
334
+ }, [
335
+ A(c.$slots, "left")
336
+ ], 4),
337
+ S("div", {
338
+ ref_key: "spliter",
339
+ ref: r,
340
+ style: { height: "100%", width: "10px" },
341
+ class: "my-spliter"
342
+ }, null, 512),
343
+ S("div", {
344
+ class: "my-right",
345
+ style: Z($(i))
346
+ }, [
347
+ A(c.$slots, "right")
348
+ ], 4)
349
+ ], 2));
350
+ }
351
+ }), Ke = {
352
+ class: "icon",
353
+ width: "25",
354
+ height: "24",
355
+ viewBox: "0 0 25 24",
356
+ fill: "none",
357
+ xmlns: "http://www.w3.org/2000/svg"
358
+ };
359
+ function qe(e, t) {
360
+ return M(), D("svg", Ke, t[0] || (t[0] = [
361
+ S("path", {
362
+ d: "M7.3125 5.5L2.3125 12L7.3125 18.5H22.3125V5.5H7.3125Z",
363
+ stroke: "#272E3B",
364
+ "stroke-linecap": "round",
365
+ "stroke-linejoin": "round"
366
+ }, null, -1),
367
+ S("path", {
368
+ d: "M10.8125 9.5L15.8125 14.5",
369
+ stroke: "#272E3B",
370
+ "stroke-linecap": "round",
371
+ "stroke-linejoin": "round"
372
+ }, null, -1),
373
+ S("path", {
374
+ d: "M15.8125 9.5L10.8125 14.5",
375
+ stroke: "#272E3B",
376
+ "stroke-linecap": "round",
377
+ "stroke-linejoin": "round"
378
+ }, null, -1)
379
+ ]));
380
+ }
381
+ const He = q({ name: "local-clear", render: qe }), Xe = { class: "nums-box" }, Ze = { class: "btn-box" }, Ge = /* @__PURE__ */ j({
382
+ inheritAttrs: !1,
383
+ __name: "index",
384
+ props: /* @__PURE__ */ z({
385
+ quickNums: {
386
+ type: Array,
387
+ default: () => [100, 500, 1e3, 1500, 2e3, 2500]
388
+ },
389
+ min: {
390
+ type: Number,
391
+ default: 0
392
+ },
393
+ max: {
394
+ type: Number,
395
+ default: 1e8
396
+ },
397
+ precision: {
398
+ type: Number,
399
+ default: 0
400
+ }
401
+ }, {
402
+ value: { type: String },
403
+ valueModifiers: {}
404
+ }),
405
+ emits: /* @__PURE__ */ z(["enter"], ["update:value"]),
406
+ setup(e, { emit: t }) {
407
+ const n = e, r = t, l = _(), i = _(), o = _(["7", "8", "9", "4", "5", "6", "1", "2", "3", "0", "00", "."]), a = ie(e, "value"), u = _(!1);
408
+ function c() {
409
+ u.value = !0;
410
+ }
411
+ function s() {
412
+ x();
413
+ }
414
+ function d(m) {
415
+ i.value.focus(), a.value = Number(m).toFixed(n.precision);
416
+ }
417
+ function v(m) {
418
+ if (i.value.focus(), B(a.value) || a.value === "") {
419
+ if (["00", "."].includes(m))
420
+ return;
421
+ a.value = m;
422
+ } else {
423
+ const f = String(a.value), p = l.value.getElementsByTagName("input")[0], g = p.selectionStart || 0, y = p.selectionEnd || 0;
424
+ a.value = `${f.slice(0, g)}${m}${f.slice(y)}`;
425
+ const k = g + m.length;
426
+ J(() => {
427
+ i.value.setSelectionRange(k, k);
428
+ });
429
+ }
430
+ }
431
+ function h() {
432
+ if (i.value.focus(), B(a.value))
433
+ return;
434
+ const m = String(a.value);
435
+ if (m != null && m.length) {
436
+ const f = l.value.getElementsByTagName("input")[0], p = f.selectionStart || 0, g = f.selectionEnd || 0, y = p > 0 ? p - 1 : 0;
437
+ p === g ? a.value = m.slice(0, y) + m.slice(g) : a.value = m.slice(0, p) + m.slice(g), J(() => {
438
+ i.value.setSelectionRange(y, y);
439
+ });
440
+ }
441
+ }
442
+ function b() {
443
+ i.value.blur();
444
+ }
445
+ function x() {
446
+ const m = n.min, f = n.max;
447
+ let p = parseFloat(a.value || "0");
448
+ B(m) || (p = p > m ? p : m), B(f) || (p = p > f ? f : p), a.value = Number(p).toFixed(n.precision), u.value = !1, r("enter");
449
+ }
450
+ return (m, f) => {
451
+ const p = L("a-button"), g = L("a-col"), y = He, k = L("a-row"), C = L("a-input"), N = L("a-popover");
452
+ return M(), D("div", {
453
+ class: "number-keyboard",
454
+ ref_key: "numberKeyboard",
455
+ ref: l
456
+ }, [
457
+ T(N, {
458
+ overlayClassName: "popover-keyboard",
459
+ trigger: "manual",
460
+ placement: "bottomLeft",
461
+ align: { offset: [0, -9] },
462
+ open: $(u),
463
+ "onUpdate:open": f[2] || (f[2] = (E) => we(u) ? u.value = E : null)
464
+ }, {
465
+ content: w(() => [
466
+ S("div", {
467
+ class: "keyboard-panel",
468
+ onMousedownCapture: f[0] || (f[0] = G(() => {
469
+ }, ["prevent", "stop"]))
470
+ }, [
471
+ T(k, { gutter: "8" }, {
472
+ default: w(() => [
473
+ T(g, { span: 18 }, {
474
+ default: w(() => [
475
+ S("div", Xe, [
476
+ (M(!0), D(Y, null, O(e.quickNums, (E) => (M(), W(p, {
477
+ class: "btn-num",
478
+ key: E,
479
+ onClick: (_e) => d(E)
480
+ }, {
481
+ default: w(() => [
482
+ V(Q(E), 1)
483
+ ]),
484
+ _: 2
485
+ }, 1032, ["onClick"]))), 128)),
486
+ (M(!0), D(Y, null, O($(o), (E) => (M(), W(p, {
487
+ class: "btn-num",
488
+ key: E,
489
+ onClick: (_e) => v(E)
490
+ }, {
491
+ default: w(() => [
492
+ V(Q(E), 1)
493
+ ]),
494
+ _: 2
495
+ }, 1032, ["onClick"]))), 128))
496
+ ])
497
+ ]),
498
+ _: 1
499
+ }),
500
+ T(g, { span: 6 }, {
501
+ default: w(() => [
502
+ S("div", Ze, [
503
+ T(p, {
504
+ class: "btn-clear",
505
+ onClick: h
506
+ }, {
507
+ default: w(() => [
508
+ T(y, { style: { width: "24px", height: "24px" } })
509
+ ]),
510
+ _: 1
511
+ }),
512
+ T(p, {
513
+ class: "btn-enter",
514
+ type: "primary",
515
+ onClick: G(b, ["stop"])
516
+ }, {
517
+ default: w(() => f[3] || (f[3] = [
518
+ V("Enter ")
519
+ ])),
520
+ _: 1
521
+ })
522
+ ])
523
+ ]),
524
+ _: 1
525
+ })
526
+ ]),
527
+ _: 1
528
+ })
529
+ ], 32)
530
+ ]),
531
+ default: w(() => [
532
+ T(C, F({
533
+ ref_key: "inputRef",
534
+ ref: i,
535
+ value: a.value,
536
+ "onUpdate:value": f[1] || (f[1] = (E) => a.value = E)
537
+ }, m.$attrs, {
538
+ onFocus: c,
539
+ onBlur: s,
540
+ onKeyup: Se(b, ["enter"])
541
+ }), null, 16, ["value"])
542
+ ]),
543
+ _: 1
544
+ }, 8, ["open"])
545
+ ], 512);
546
+ };
547
+ }
548
+ }), ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
549
+ __proto__: null,
550
+ AInputNumberEx: Ue,
551
+ ARangePickerEx: je,
552
+ ATableEx: Ve,
553
+ WlNumberKeyboard: Ge,
554
+ WlSplitter: Ie
555
+ }, Symbol.toStringTag, { value: "Module" }));
556
+ function me(e) {
557
+ return Me() ? (Ne(e), !0) : !1;
558
+ }
559
+ const X = typeof window < "u" && typeof document < "u";
560
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
561
+ const Ye = Object.prototype.toString, Qe = (e) => Ye.call(e) === "[object Object]";
562
+ function Je(e) {
563
+ let t;
564
+ function n() {
565
+ return t || (t = e()), t;
566
+ }
567
+ return n.reset = async () => {
568
+ const r = t;
569
+ t = void 0, r && await r;
570
+ }, n;
571
+ }
572
+ function I(e) {
573
+ return Array.isArray(e) ? e : [e];
574
+ }
575
+ function et(e, t, n = {}) {
576
+ const {
577
+ immediate: r = !0,
578
+ immediateCallback: l = !1
579
+ } = n, i = R(!1);
580
+ let o = null;
581
+ function a() {
582
+ o && (clearTimeout(o), o = null);
583
+ }
584
+ function u() {
585
+ i.value = !1, a();
586
+ }
587
+ function c(...s) {
588
+ l && e(), a(), i.value = !0, o = setTimeout(() => {
589
+ i.value = !1, o = null, e(...s);
590
+ }, P(t));
591
+ }
592
+ return r && (i.value = !0, X && c()), me(u), {
593
+ isPending: Ee(i),
594
+ start: c,
595
+ stop: u
596
+ };
597
+ }
598
+ function tt(e, t, n) {
599
+ return $e(
600
+ e,
601
+ t,
602
+ {
603
+ ...n,
604
+ immediate: !0
605
+ }
606
+ );
607
+ }
608
+ const nt = X ? window : void 0, ve = X ? window.navigator : void 0;
609
+ function ot(e) {
610
+ var t;
611
+ const n = P(e);
612
+ return (t = n == null ? void 0 : n.$el) != null ? t : n;
613
+ }
614
+ function ge(...e) {
615
+ const t = [], n = () => {
616
+ t.forEach((a) => a()), t.length = 0;
617
+ }, r = (a, u, c, s) => (a.addEventListener(u, c, s), () => a.removeEventListener(u, c, s)), l = U(() => {
618
+ const a = I(P(e[0])).filter((u) => u != null);
619
+ return a.every((u) => typeof u != "string") ? a : void 0;
620
+ }), i = tt(
621
+ () => {
622
+ var a, u;
623
+ return [
624
+ (u = (a = l.value) == null ? void 0 : a.map((c) => ot(c))) != null ? u : [nt].filter((c) => c != null),
625
+ I(P(l.value ? e[1] : e[0])),
626
+ I($(l.value ? e[2] : e[1])),
627
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
628
+ P(l.value ? e[3] : e[2])
629
+ ];
630
+ },
631
+ ([a, u, c, s]) => {
632
+ if (n(), !(a != null && a.length) || !(u != null && u.length) || !(c != null && c.length))
633
+ return;
634
+ const d = Qe(s) ? { ...s } : s;
635
+ t.push(
636
+ ...a.flatMap(
637
+ (v) => u.flatMap(
638
+ (h) => c.map((b) => r(v, h, b, d))
639
+ )
640
+ )
641
+ );
642
+ },
643
+ { flush: "post" }
644
+ ), o = () => {
645
+ i(), n();
646
+ };
647
+ return me(n), o;
648
+ }
649
+ function at() {
650
+ const e = R(!1), t = ce();
651
+ return t && de(() => {
652
+ e.value = !0;
653
+ }, t), e;
654
+ }
655
+ function ye(e) {
656
+ const t = at();
657
+ return U(() => (t.value, !!e()));
658
+ }
659
+ function oe(e, t = {}) {
660
+ const {
661
+ controls: n = !1,
662
+ navigator: r = ve
663
+ } = t, l = ye(() => r && "permissions" in r), i = R(), o = typeof e == "string" ? { name: e } : e, a = R(), u = () => {
664
+ var s, d;
665
+ a.value = (d = (s = i.value) == null ? void 0 : s.state) != null ? d : "prompt";
666
+ };
667
+ ge(i, "change", u, { passive: !0 });
668
+ const c = Je(async () => {
669
+ if (l.value) {
670
+ if (!i.value)
671
+ try {
672
+ i.value = await r.permissions.query(o);
673
+ } catch {
674
+ i.value = void 0;
675
+ } finally {
676
+ u();
677
+ }
678
+ if (n)
679
+ return Te(i.value);
680
+ }
681
+ });
682
+ return c(), n ? {
683
+ state: a,
684
+ isSupported: l,
685
+ query: c
686
+ } : a;
687
+ }
688
+ function st(e = {}) {
689
+ const {
690
+ navigator: t = ve,
691
+ read: n = !1,
692
+ source: r,
693
+ copiedDuring: l = 1500,
694
+ legacy: i = !1
695
+ } = e, o = ye(() => t && "clipboard" in t), a = oe("clipboard-read"), u = oe("clipboard-write"), c = U(() => o.value || i), s = R(""), d = R(!1), v = et(() => d.value = !1, l, { immediate: !1 });
696
+ async function h() {
697
+ let p = !(o.value && f(a.value));
698
+ if (!p)
699
+ try {
700
+ s.value = await t.clipboard.readText();
701
+ } catch {
702
+ p = !0;
703
+ }
704
+ p && (s.value = m());
705
+ }
706
+ c.value && n && ge(["copy", "cut"], h, { passive: !0 });
707
+ async function b(p = P(r)) {
708
+ if (c.value && p != null) {
709
+ let g = !(o.value && f(u.value));
710
+ if (!g)
711
+ try {
712
+ await t.clipboard.writeText(p);
713
+ } catch {
714
+ g = !0;
715
+ }
716
+ g && x(p), s.value = p, d.value = !0, v.start();
717
+ }
718
+ }
719
+ function x(p) {
720
+ const g = document.createElement("textarea");
721
+ g.value = p ?? "", g.style.position = "absolute", g.style.opacity = "0", document.body.appendChild(g), g.select(), document.execCommand("copy"), g.remove();
722
+ }
723
+ function m() {
724
+ var p, g, y;
725
+ return (y = (g = (p = document == null ? void 0 : document.getSelection) == null ? void 0 : p.call(document)) == null ? void 0 : g.toString()) != null ? y : "";
726
+ }
727
+ function f(p) {
728
+ return p === "granted" || p === "prompt";
729
+ }
730
+ return {
731
+ isSupported: c,
732
+ text: s,
733
+ copied: d,
734
+ copy: b
735
+ };
736
+ }
737
+ const rt = st();
738
+ let K;
739
+ const it = {
740
+ mounted(e, t, n) {
741
+ var o, a, u;
742
+ const r = fe(n.ctx), l = ((u = (a = (o = r == null ? void 0 : r.locale) == null ? void 0 : o.value) == null ? void 0 : a.locale) == null ? void 0 : u.slice(0, 2)) || "en", i = {
743
+ zh: "复制成功",
744
+ en: "Copy successfully",
745
+ fr: "Copie réussie"
746
+ };
747
+ K = () => {
748
+ rt.copy(t.value), Be.success(i[l]);
749
+ }, e.addEventListener("click", K);
750
+ },
751
+ unmounted(e) {
752
+ e.removeEventListener("click", K);
753
+ }
754
+ }, lt = {
755
+ beforeMount(e, t, n) {
756
+ const r = t.value, l = {
757
+ letterNumber: /^\w*$/,
758
+ // 字母和数字
759
+ price: /^(\d*|(\d+\.\d{0,2}))$/,
760
+ phone: /^\d{0,11}$/,
761
+ number: /^\d*$/,
762
+ negativePrice: /^\-?(\d*|(\d+\.\d{0,2}))$/,
763
+ //负数金额
764
+ loginVerify: /^[0-9a-zA-Z]{0,4}$/,
765
+ verify: /^\d{0,6}$/,
766
+ idCard: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
767
+ //身份证号(15位、18位数字),最后一位是校验位,可能为数字或字符X
768
+ }, i = r instanceof RegExp ? r : t.arg && l[t.arg] ? l[t.arg] : null;
769
+ e._handleInput = (o) => {
770
+ if (o.isTrusted && !(!o.isComposing && o.inputType === "insertCompositionText" && o.data)) {
771
+ const a = i == null ? void 0 : i.test(o.target.value);
772
+ if (e._input = a ? o.target.value : e._input, o.target.value = "", o.target.value = e._input, !a)
773
+ o.target.selectionStart = e._start, o.target.selectionEnd = e._end;
774
+ else
775
+ switch (o.inputType) {
776
+ case "deleteContentForward":
777
+ //delete
778
+ case "deleteByDrag":
779
+ //dropout
780
+ case "deleteByCut":
781
+ o.target.selectionStart = e._start, o.target.selectionEnd = e._start;
782
+ break;
783
+ case "deleteContentBackward":
784
+ o.target.selectionStart = e._start === e._end ? e._start - 1 : e._start, o.target.selectionEnd = e._start === e._end ? e._start - 1 : e._start;
785
+ break;
786
+ case "insertFromPaste":
787
+ //粘贴
788
+ case "insertFromDrop":
789
+ const c = o.dataTransfer || o.clipboardData || null;
790
+ if (c) {
791
+ const s = c.getData("text") || "";
792
+ o.target.selectionStart = e._start + s.length, o.target.selectionEnd = e._start + s.length;
793
+ }
794
+ break;
795
+ case "insertText":
796
+ //insert
797
+ case "insertCompositionText":
798
+ o.target.selectionStart = e._start + 1, o.target.selectionEnd = e._start + 1;
799
+ break;
800
+ }
801
+ const u = new InputEvent("input", {
802
+ isComposing: !1
803
+ });
804
+ o.target.dispatchEvent(u);
805
+ }
806
+ }, e._handleKeydown = (o) => {
807
+ const a = i == null ? void 0 : i.test(o.target.value);
808
+ e._input = a ? o.target.value : "", e._start = o.target.selectionStart, e._end = o.target.selectionEnd;
809
+ }, e._handleDrop = (o) => {
810
+ o.stopPropagation();
811
+ }, n.type === "input" && (e.addEventListener("input", e._handleInput), e.addEventListener("keydown", e._handleKeydown), e.addEventListener("drop", e._handleDrop));
812
+ },
813
+ unmounted(e) {
814
+ e._handleInput && e.removeEventListener("input", e._handleInput), e._handleKeydown && e.removeEventListener("keydown", e._handleKeydown), e._handleDrop && e.removeEventListener("drop", e._handleDrop);
815
+ }
816
+ };
817
+ function ae(e, t, n) {
818
+ const r = t.value;
819
+ if (r) {
820
+ const l = r / 2;
821
+ e.style.marginLeft = `-${l}px`, e.style.marginRight = `-${l}px`;
822
+ const i = n.children;
823
+ i != null && i.length && i[0].children.forEach((o) => {
824
+ if (o.component) {
825
+ const a = o.el;
826
+ a != null && a.style && (a.style.paddingLeft = l + "px", a.style.paddingRight = l + "px");
827
+ } else Array.isArray(o.children) && o.children.forEach((a) => {
828
+ const u = a.el;
829
+ u != null && u.style && (u.style.paddingLeft = l + "px", u.style.paddingRight = l + "px");
830
+ });
831
+ });
832
+ }
833
+ }
834
+ const ut = {
835
+ beforeMount(e) {
836
+ e.classList.add("ant-row"), e.style.display = "flex", e.style.flexWrap = "wrap", e.style.flexDirection = "row", e.style.minWidth = 0;
837
+ },
838
+ mounted(e, t, n) {
839
+ ae(e, t, n);
840
+ },
841
+ updated(e, t, n, r) {
842
+ ae(e, t, n);
843
+ }
844
+ }, ct = {
845
+ beforeMount(e, t) {
846
+ e.classList.add("ant-col", `ant-col-${t.value}`);
847
+ const n = t.value / 24 * 100;
848
+ e.style.position = "relative", e.style.flex = `0 0 ${n}%`, e.style.maxWidth = `${n}%`;
849
+ }
850
+ }, dt = {
851
+ mounted(e, t, n) {
852
+ se(e, t);
853
+ },
854
+ updated(e, t) {
855
+ if (e._tooltipVNode) {
856
+ const { value: n } = t, {
857
+ content: r = "",
858
+ enabled: l = !0,
859
+ padding: i = 8
860
+ // 默认左右间距8px,用来判断文本的测量宽度是否超出元素宽度
861
+ } = typeof n == "string" ? { content: n } : n;
862
+ if (!l)
863
+ e.tooltipDisabled = !0;
864
+ else if (t.modifiers.exceed) {
865
+ const o = e.originWidth, a = he(r);
866
+ e.tooltipDisabled = a < o - i * 2;
867
+ }
868
+ e._tooltipVNode.component.props.title = r, e._tooltipVNode.component.props.trigger = e.tooltipDisabled ? "manual" : "hover", e._tooltipVNode.component.update();
869
+ } else
870
+ se(e, t);
871
+ },
872
+ unmounted(e) {
873
+ e._tooltipContainer && (pe(null, e._tooltipContainer), e._tooltipContainer = null, e._tooltipVNode = null);
874
+ }
875
+ };
876
+ function se(e, t) {
877
+ const { value: n } = t, {
878
+ content: r = "",
879
+ placement: l = "top",
880
+ trigger: i = "hover",
881
+ enabled: o = !0,
882
+ padding: a = 8,
883
+ // 默认左右间距8px,用来判断文本的测量宽度是否超出元素宽度
884
+ ...u
885
+ } = typeof n == "string" ? { content: n } : n;
886
+ if (!o)
887
+ e.tooltipDisabled = !0;
888
+ else if (t.modifiers.exceed) {
889
+ const c = e.clientWidth, s = he(r);
890
+ e.originWidth = c, e.tooltipDisabled = s < c - a * 2;
891
+ }
892
+ if (!e.tooltipDisabled) {
893
+ const c = ee(
894
+ De,
895
+ {
896
+ title: r,
897
+ placement: l,
898
+ trigger: i,
899
+ ...u
900
+ },
901
+ // 默认插槽内容
902
+ {
903
+ default: () => {
904
+ const d = Array.from(e.attributes).reduce(
905
+ (v, h) => (v[h.name] = h.value, v),
906
+ {}
907
+ );
908
+ return ee(e.tagName, { ...d, innerHTML: e.innerHTML });
909
+ }
910
+ }
911
+ ), s = document.createElement("div");
912
+ pe(c, s), e._tooltipVNode = c, e._tooltipContainer = s, e.replaceWith(s.firstElementChild);
913
+ }
914
+ }
915
+ function he(e, t) {
916
+ const r = document.createElement("canvas").getContext("2d");
917
+ return r.font = "14px Arial", r.measureText(e).width;
918
+ }
919
+ const pt = {
920
+ beforeMount(e, t) {
921
+ const { value: n } = t;
922
+ n && (Le(n) || setTimeout(() => {
923
+ var l;
924
+ (l = e.parentNode) == null || l.removeChild(e);
925
+ }, 50));
926
+ }
927
+ }, re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
928
+ __proto__: null,
929
+ col: ct,
930
+ copy: it,
931
+ inputlimit: lt,
932
+ permission: pt,
933
+ row: ut,
934
+ tooltip: dt
935
+ }, Symbol.toStringTag, { value: "Module" }));
936
+ function ft(e) {
937
+ Object.keys(ne).forEach((t) => {
938
+ e.component(t, ne[t]);
939
+ }), Object.keys(re).forEach((t) => {
940
+ e.directive(t, re[t]);
941
+ });
942
+ }
943
+ const ht = { install: ft };
944
+ export {
945
+ Ue as AInputNumberEx,
946
+ je as ARangePickerEx,
947
+ Ve as ATableEx,
948
+ xt as UserCenterKey,
949
+ Ge as WlNumberKeyboard,
950
+ Ie as WlSplitter,
951
+ Ct as buildTree,
952
+ ct as col,
953
+ it as copy,
954
+ ht as default,
955
+ kt as exportFile,
956
+ wt as forEachTree,
957
+ St as getButtonPermissions,
958
+ Et as getLocale,
959
+ Mt as getMenuInfo,
960
+ Nt as getToken,
961
+ $t as getUserCenterParams,
962
+ Tt as getUserCenterParamsByUrl,
963
+ Lt as getUserInfo,
964
+ Le as hasPermission,
965
+ lt as inputlimit,
966
+ Bt as is,
967
+ Dt as isArray,
968
+ Pt as isAsyncFunction,
969
+ At as isBoolean,
970
+ Rt as isClient,
971
+ Wt as isDate,
972
+ Ft as isDef,
973
+ Ot as isElement,
974
+ Ut as isFunction,
975
+ jt as isImageDom,
976
+ zt as isNull,
977
+ B as isNullOrUndef,
978
+ Vt as isNumber,
979
+ It as isObject,
980
+ Kt as isPromise,
981
+ qt as isServer,
982
+ Ht as isString,
983
+ Xt as isUndef,
984
+ Zt as isWindow,
985
+ Gt as logoutToUserCenter,
986
+ pt as permission,
987
+ Yt as removeAll,
988
+ Qt as removeLocale,
989
+ Jt as removeToken,
990
+ ut as row,
991
+ en as setLocale,
992
+ tn as setMenuInfo,
993
+ nn as setToken,
994
+ on as setUserCenterParams,
995
+ an as setUserInfo,
996
+ sn as toUserCenterConsole,
997
+ dt as tooltip
998
+ };