@tan-bin/ui 1.0.3

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.
@@ -0,0 +1,1276 @@
1
+ import { ref as B, onMounted as Ae, onUnmounted as _e, watchEffect as Fe, createBlock as V, openBlock as c, Transition as xe, withCtx as P, withDirectives as $, createElementVNode as p, normalizeStyle as me, renderSlot as pe, vShow as R, createElementBlock as u, normalizeClass as J, useTemplateRef as ze, computed as G, watch as te, createVNode as D, unref as O, mergeProps as Ke, withModifiers as Se, TransitionGroup as He, Fragment as T, renderList as A, createCommentVNode as I, vModelDynamic as Je, toDisplayString as x, createTextVNode as Ge, resolveDynamicComponent as Qe, inject as Ze, provide as et, reactive as tt, resolveComponent as $e, toHandlers as nt, createApp as Ee, mergeModels as Ne, useModel as ue, vModelSelect as ot, withKeys as at, vModelText as lt, vModelCheckbox as De, defineComponent as st, h as rt } from "vue";
2
+ import { useRouter as ct, useRoute as it } from "vue-router";
3
+ const _ = {
4
+ disabledCount: 0,
5
+ allowedElements: /* @__PURE__ */ new Set(),
6
+ touchStartY: 0,
7
+ touchStartScrollTop: 0,
8
+ touchStartElement: null,
9
+ // 记录触摸开始时的元素
10
+ isInAllowedElement: !1
11
+ // 当前触摸是否在允许元素内
12
+ };
13
+ function Oe(e = {}) {
14
+ const { allowedElements: t, immediate: a = !1 } = e, n = /* @__PURE__ */ new Set(), l = B(!1), s = (o) => {
15
+ if (!o) return null;
16
+ let i = o;
17
+ for (; i; ) {
18
+ if (_.allowedElements.has(i))
19
+ return i;
20
+ i = i.parentElement;
21
+ }
22
+ return null;
23
+ }, f = (o) => o ? o.scrollHeight > o.clientHeight + 1 : !1, r = (o) => {
24
+ const i = s(o.target);
25
+ if (i && f(i)) {
26
+ const d = i.scrollTop === 0 && o.deltaY < 0, E = Math.ceil(i.scrollTop + i.clientHeight) >= i.scrollHeight && o.deltaY > 0;
27
+ if (!(d || E))
28
+ return;
29
+ }
30
+ o.cancelable && o.preventDefault();
31
+ }, m = (o) => {
32
+ const i = o.touches[0];
33
+ _.touchStartY = i.clientY;
34
+ const d = o.target, E = s(d);
35
+ E && f(E) ? (_.touchStartElement = E, _.touchStartScrollTop = E.scrollTop, _.isInAllowedElement = !0) : (_.touchStartElement = null, _.isInAllowedElement = !1);
36
+ }, b = (o) => {
37
+ if (!_.isInAllowedElement) {
38
+ o.cancelable && o.preventDefault();
39
+ return;
40
+ }
41
+ if (!_.touchStartElement) {
42
+ o.cancelable && o.preventDefault();
43
+ return;
44
+ }
45
+ const E = o.touches[0].clientY - _.touchStartY;
46
+ if (Math.abs(E) < 1) return;
47
+ const C = _.touchStartElement, Q = C.scrollTop, ve = C.scrollHeight, fe = C.clientHeight, Ue = Q === 0, qe = Math.ceil(Q + fe) >= ve, We = E > 0, Xe = E < 0;
48
+ if (Ue && We || qe && Xe)
49
+ o.cancelable && o.preventDefault();
50
+ else
51
+ return;
52
+ }, w = () => {
53
+ _.touchStartElement = null, _.isInAllowedElement = !1;
54
+ }, L = (o) => {
55
+ if (!["Space", "ArrowUp", "ArrowDown", "PageUp", "PageDown"].includes(o.code)) return;
56
+ const d = s(document.activeElement);
57
+ if (d && f(d)) {
58
+ const E = d.scrollTop, C = d.scrollHeight, Q = d.clientHeight, ve = E === 0 && (o.code === "ArrowUp" || o.code === "PageUp"), fe = Math.ceil(E + Q) >= C && (o.code === "ArrowDown" || o.code === "PageDown" || o.code === "Space");
59
+ (ve || fe) && o.cancelable && o.preventDefault();
60
+ return;
61
+ }
62
+ o.cancelable && o.preventDefault();
63
+ }, M = () => {
64
+ document.addEventListener("wheel", r, { passive: !1 }), document.addEventListener("mousewheel", r, { passive: !1 }), document.addEventListener("touchstart", m, { passive: !0 }), document.addEventListener("touchmove", b, { passive: !1 }), document.addEventListener("touchend", w, { passive: !0 }), document.addEventListener("touchcancel", w, { passive: !0 }), document.addEventListener("keydown", L, { passive: !1 });
65
+ }, y = () => {
66
+ document.removeEventListener("wheel", r), document.removeEventListener("mousewheel", r), document.removeEventListener("touchstart", m), document.removeEventListener("touchmove", b), document.removeEventListener("touchend", w), document.removeEventListener("touchcancel", w), document.removeEventListener("keydown", L);
67
+ }, v = () => {
68
+ l.value || (l.value = !0, _.disabledCount++, _.disabledCount === 1 && M());
69
+ }, h = () => {
70
+ l.value && (l.value = !1, _.disabledCount > 0 && (_.disabledCount--, _.disabledCount === 0 && y()));
71
+ }, S = (o) => {
72
+ if (!o) return;
73
+ (Array.isArray(o) ? o : [o]).forEach((d) => {
74
+ if (!(d instanceof HTMLElement)) {
75
+ console.warn("Allowed element must be an HTMLElement", d);
76
+ return;
77
+ }
78
+ n.add(d), _.allowedElements.add(d), d.dataset.scrollAllowed = "true";
79
+ });
80
+ }, H = (o) => {
81
+ g(), S(o);
82
+ }, N = (o) => {
83
+ if (!o) return;
84
+ (Array.isArray(o) ? o : [o]).forEach((d) => {
85
+ n.delete(d), _.allowedElements.delete(d), delete d.dataset.scrollAllowed;
86
+ });
87
+ }, g = () => {
88
+ n.forEach((o) => {
89
+ _.allowedElements.delete(o), delete o.dataset.scrollAllowed;
90
+ }), n.clear();
91
+ };
92
+ return Ae(() => {
93
+ t && S(t), a && v();
94
+ }), _e(() => {
95
+ g(), l.value && h();
96
+ }), {
97
+ isDisabled: l,
98
+ disableScroll: v,
99
+ enableScroll: h,
100
+ addAllowedElement: S,
101
+ removeAllowedElement: N,
102
+ updateAllowedElements: H,
103
+ clearAllowedElements: g
104
+ };
105
+ }
106
+ function Ln(e = {}) {
107
+ const { allowedElements: t = [] } = e, { enableScroll: a } = Oe({ allowedElements: t, immediate: !0 });
108
+ return a;
109
+ }
110
+ const k = (e, t) => {
111
+ const a = e.__vccOpts || e;
112
+ for (const [n, l] of t)
113
+ a[n] = l;
114
+ return a;
115
+ }, ut = /* @__PURE__ */ Object.assign({
116
+ name: "Modal"
117
+ }, {
118
+ __name: "index",
119
+ props: {
120
+ visible: {
121
+ type: Boolean,
122
+ default: !0
123
+ },
124
+ bg: {
125
+ type: String
126
+ },
127
+ blur: {
128
+ type: Number
129
+ },
130
+ zIndex: {
131
+ type: Number
132
+ },
133
+ duration: {
134
+ type: Number,
135
+ default: 300
136
+ },
137
+ disableScroll: {
138
+ type: Boolean,
139
+ default: !1
140
+ },
141
+ allowScrollEl: {
142
+ type: [HTMLElement, Array],
143
+ default: null
144
+ }
145
+ },
146
+ setup(e) {
147
+ const { disableScroll: t, enableScroll: a, updateAllowedElements: n } = Oe(), l = e;
148
+ return Fe(() => {
149
+ l.disableScroll && l.visible ? (t(), n(l.allowScrollEl ? l.allowScrollEl : null)) : a();
150
+ }), (s, f) => (c(), V(xe, {
151
+ name: "modal",
152
+ appear: ""
153
+ }, {
154
+ default: P(() => [
155
+ $(p("div", {
156
+ class: "modal-container",
157
+ style: me({
158
+ "--bg": e.bg,
159
+ "--blur": e.blur ? `${e.blur}px` : "",
160
+ "--z-index": e.zIndex,
161
+ "--duration": `${e.duration}ms`
162
+ })
163
+ }, [
164
+ pe(s.$slots, "default", {}, void 0, !0)
165
+ ], 4), [
166
+ [R, e.visible]
167
+ ])
168
+ ]),
169
+ _: 3
170
+ }));
171
+ }
172
+ }), q = /* @__PURE__ */ k(ut, [["__scopeId", "data-v-eff05c57"]]);
173
+ q.install = function(e) {
174
+ e.component(q.name, q);
175
+ };
176
+ const je = (e = 16) => {
177
+ const t = Date.now().toString(36);
178
+ return t + Pe(e - t.length);
179
+ }, Pe = (e) => {
180
+ const t = Math.random().toString(36).substring(2, 2 + e);
181
+ return t.length === e ? t : t + Pe(e - t.length);
182
+ }, dt = (e, t) => Math.floor(Math.random() * (t - e)) + e, mt = /* @__PURE__ */ Object.assign({
183
+ name: "Icon"
184
+ }, {
185
+ __name: "index",
186
+ props: {
187
+ type: {
188
+ type: String,
189
+ required: !0
190
+ }
191
+ },
192
+ setup(e) {
193
+ return (t, a) => (c(), u("i", {
194
+ class: J(["_icon icon-container", `_icon-${e.type}`])
195
+ }, [
196
+ pe(t.$slots, "default", {}, void 0, !0)
197
+ ], 2));
198
+ }
199
+ }), z = /* @__PURE__ */ k(mt, [["__scopeId", "data-v-288c6a41"]]);
200
+ z.install = function(e) {
201
+ e.component(z.name, z);
202
+ };
203
+ const pt = ["innerHTML"], vt = ["type", "onUpdate:modelValue", "name", "placeholder", "onInput"], ft = { class: "label" }, ht = { class: "msg" }, yt = { class: "total-err" }, gt = ["innerHTML"], bt = ["innerHTML"], wt = { class: "btns" }, _t = ["onClick", "disabled"], he = 300, xt = /* @__PURE__ */ Object.assign({
204
+ name: "Dialog"
205
+ }, {
206
+ __name: "index",
207
+ emits: ["destroy"],
208
+ setup(e, { expose: t, emit: a }) {
209
+ const n = ze("content"), l = B(null), s = a, f = B([]), r = G(() => f.value.at(-1));
210
+ let m;
211
+ const b = (g, o) => ({
212
+ title: "",
213
+ content: "",
214
+ textColor: "",
215
+ tip: "",
216
+ type: "",
217
+ // alert, confirm, prompt
218
+ confirmText: g.type === "alert" ? "我知道了" : "确定",
219
+ confirmColor: "",
220
+ cancelText: "取消",
221
+ modal: !1,
222
+ id: je(),
223
+ ...g,
224
+ resolve: o
225
+ }), w = (g) => {
226
+ g.msg = g.validate?.(g.value), r.value.totalErr = "";
227
+ }, L = (g) => {
228
+ g.content.forEach((o) => {
229
+ o.value = o.value ?? "", o.validate = o.validate ?? ((i) => i === "" ? `请输入${o.label}` : ""), o.placeholder = o.placeholder ?? "请输入";
230
+ }), g.totalErr = "";
231
+ }, M = () => {
232
+ f.value.pop(), r.value || (m = setTimeout(() => s("destroy"), he));
233
+ }, y = (g) => (clearTimeout(m), new Promise((o) => {
234
+ const i = b(g, o);
235
+ g.type === "prompt" && L(i), f.value.push(i);
236
+ })), v = () => {
237
+ r.value && (r.value.resolve(!0), M());
238
+ }, h = () => {
239
+ if (!r.value || (r.value.content.forEach((o) => o.msg = o.validate(o.value)), r.value.content.some((o) => o.msg) || (r.value.totalErr = r.value.validateAll?.(...r.value.content)) || r.value.content.some((o) => o.msg)))
240
+ return;
241
+ const g = r.value.content.map((o) => o.value);
242
+ r.value.resolve(g), M();
243
+ }, S = () => {
244
+ r.value && (r.value.resolve(!1), M());
245
+ }, H = () => {
246
+ r.value && (r.value.modal || (r.value.resolve(!1), M()));
247
+ }, N = () => {
248
+ r.value && (f.value.forEach((g) => {
249
+ g.resolve(!1);
250
+ }), f.value.length = 0, m = setTimeout(() => s("destroy"), he));
251
+ };
252
+ return te(
253
+ r,
254
+ () => {
255
+ l.value = n.value.at(-1);
256
+ },
257
+ {
258
+ flush: "post"
259
+ }
260
+ ), t({
261
+ open: y,
262
+ destroyAll: N
263
+ }), (g, o) => (c(), V(xe, { name: "modal" }, {
264
+ default: P(() => [
265
+ $(D(O(q), Ke({
266
+ class: "dialog-container",
267
+ onClick: Se(H, ["self"]),
268
+ duration: he,
269
+ disableScroll: !0,
270
+ allowScrollEl: l.value
271
+ }, r.value?.modal ? { blur: 2 } : { bg: "rgba(0, 0, 0, 0.3)" }), {
272
+ default: P(() => [
273
+ D(He, { name: "area" }, {
274
+ default: P(() => [
275
+ (c(!0), u(T, null, A(f.value, (i) => (c(), u("div", {
276
+ class: "area",
277
+ style: me({ color: i.textColor }),
278
+ key: i.id
279
+ }, [
280
+ i.title ? (c(), u("p", {
281
+ key: 0,
282
+ class: "title",
283
+ innerHTML: i.title
284
+ }, null, 8, pt)) : I("", !0),
285
+ i.type === "prompt" ? (c(), u("form", {
286
+ key: 1,
287
+ class: "content",
288
+ onSubmit: Se(h, ["prevent"]),
289
+ ref_for: !0,
290
+ ref: "content"
291
+ }, [
292
+ (c(!0), u(T, null, A(i.content, (d, E) => (c(), u("label", {
293
+ key: E,
294
+ class: J(["input-item", { error: d.msg }])
295
+ }, [
296
+ $(p("input", {
297
+ type: d.type,
298
+ "onUpdate:modelValue": (C) => d.value = C,
299
+ name: d.label,
300
+ placeholder: d.placeholder,
301
+ onInput: (C) => w(d)
302
+ }, null, 40, vt), [
303
+ [Je, d.value]
304
+ ]),
305
+ p("span", ft, x(d.label), 1),
306
+ p("span", ht, x(d.msg), 1),
307
+ $(D(O(z), {
308
+ type: "close",
309
+ onClick: (C) => d.value = ""
310
+ }, null, 8, ["onClick"]), [
311
+ [R, d.value !== ""]
312
+ ])
313
+ ], 2))), 128)),
314
+ $(p("p", yt, [
315
+ D(O(z), { type: "tip" }),
316
+ Ge(" " + x(i.totalErr), 1)
317
+ ], 512), [
318
+ [R, i.totalErr]
319
+ ])
320
+ ], 544)) : (c(), u(T, { key: 2 }, [
321
+ i.content ? (c(), u("p", {
322
+ key: 0,
323
+ class: "content",
324
+ ref_for: !0,
325
+ ref: "content",
326
+ innerHTML: i.content
327
+ }, null, 8, gt)) : I("", !0)
328
+ ], 64)),
329
+ i.tip ? (c(), u("p", {
330
+ key: 3,
331
+ class: "tip",
332
+ innerHTML: i.tip
333
+ }, null, 8, bt)) : I("", !0),
334
+ p("div", wt, [
335
+ i.type !== "alert" ? (c(), u("button", {
336
+ key: 0,
337
+ class: "btn cancel",
338
+ onClick: S
339
+ }, x(i.cancelText), 1)) : I("", !0),
340
+ p("button", {
341
+ class: J(["btn confirm", { danger: i.danger }]),
342
+ onClick: (d) => i.type === "prompt" ? h() : v(),
343
+ disabled: i.type === "prompt" && (i.content.some((d) => d.msg) || i.totalErr !== "")
344
+ }, x(i.confirmText), 11, _t)
345
+ ])
346
+ ], 4))), 128))
347
+ ]),
348
+ _: 1
349
+ })
350
+ ]),
351
+ _: 1
352
+ }, 16, ["allowScrollEl"]), [
353
+ [R, r.value]
354
+ ])
355
+ ]),
356
+ _: 1
357
+ }));
358
+ }
359
+ }), W = /* @__PURE__ */ k(xt, [["__scopeId", "data-v-876a5595"]]);
360
+ W.install = function(e) {
361
+ e.component(W.name, W);
362
+ };
363
+ const Et = ["innerHTML"], kt = /* @__PURE__ */ Object.assign({
364
+ name: "Loading"
365
+ }, {
366
+ __name: "index",
367
+ props: {
368
+ size: {
369
+ type: Number,
370
+ default: 42
371
+ },
372
+ color: {
373
+ type: String,
374
+ default: "#409eff"
375
+ },
376
+ text: {
377
+ type: String,
378
+ default: ""
379
+ }
380
+ },
381
+ setup(e) {
382
+ return (t, a) => (c(), u("div", {
383
+ class: "loading-container",
384
+ style: me({ "--size": e.size + "px", "--color": e.color })
385
+ }, [
386
+ a[0] || (a[0] = p("svg", {
387
+ viewBox: "0 0 50 50",
388
+ class: "loading-svg"
389
+ }, [
390
+ p("circle", {
391
+ class: "path",
392
+ cx: "25",
393
+ cy: "25",
394
+ r: "20",
395
+ fill: "none"
396
+ })
397
+ ], -1)),
398
+ $(p("p", { innerHTML: e.text }, null, 8, Et), [
399
+ [R, e.text]
400
+ ])
401
+ ], 4));
402
+ }
403
+ }), X = /* @__PURE__ */ k(kt, [["__scopeId", "data-v-b253c0cf"]]);
404
+ X.install = function(e) {
405
+ e.component(X.name, X);
406
+ };
407
+ const St = ["innerHTML"], $t = 3e3, Tt = 3, Lt = /* @__PURE__ */ Object.assign({
408
+ name: "Message"
409
+ }, {
410
+ __name: "index",
411
+ emits: ["destroy"],
412
+ setup(e, { expose: t, emit: a }) {
413
+ const n = a, l = B([]);
414
+ let s;
415
+ const f = () => {
416
+ clearTimeout(l.value[0]?.timer), l.value.shift(), !l.value.length && (s = setTimeout(() => n("destroy"), 500));
417
+ };
418
+ return t({ add: (m, b) => {
419
+ clearTimeout(s), l.value.length >= Tt && f();
420
+ const w = je(), L = setTimeout(() => f(), $t);
421
+ l.value.push({ id: w, content: m, type: b, timer: L });
422
+ } }), (m, b) => (c(), V(He, {
423
+ tag: "div",
424
+ class: "message-container"
425
+ }, {
426
+ default: P(() => [
427
+ (c(!0), u(T, null, A(l.value, (w) => (c(), u("div", {
428
+ key: w.id,
429
+ class: J(["item", [w.type]])
430
+ }, [
431
+ typeof w.content == "string" ? (c(), u("span", {
432
+ key: 0,
433
+ innerHTML: w.content
434
+ }, null, 8, St)) : (c(), V(Qe(w.content), { key: 1 }))
435
+ ], 2))), 128))
436
+ ]),
437
+ _: 1
438
+ }));
439
+ }
440
+ }), F = /* @__PURE__ */ k(Lt, [["__scopeId", "data-v-31eeb9bf"]]);
441
+ F.install = function(e) {
442
+ e.component(F.name, F);
443
+ };
444
+ const Mt = { class: "text" }, Ct = /* @__PURE__ */ Object.assign({ name: "Nav" }, {
445
+ __name: "index",
446
+ props: {
447
+ list: {
448
+ type: Array,
449
+ default: () => []
450
+ }
451
+ },
452
+ setup(e) {
453
+ const t = e, a = Ze("layer", 0);
454
+ et("layer", a + 1);
455
+ const n = tt(t.list.map(() => !0)), l = {
456
+ beforeEnter(s) {
457
+ s.style.height = "0", s.style.opacity = "0", s.style.overflow = "hidden";
458
+ },
459
+ enter(s) {
460
+ s.style.height = s.scrollHeight + "px", s.style.opacity = "1";
461
+ },
462
+ afterEnter(s) {
463
+ s.style.height = "", s.style.overflow = "", s.style.opacity = "";
464
+ },
465
+ beforeLeave(s) {
466
+ s.style.height = s.scrollHeight + "px", s.style.opacity = "0", s.style.overflow = "hidden";
467
+ },
468
+ leave(s) {
469
+ s.style.height = "0", s.style.opacity = "0";
470
+ },
471
+ afterLeave(s) {
472
+ s.style.height = "", s.style.overflow = "", s.style.opacity = "";
473
+ }
474
+ };
475
+ return (s, f) => {
476
+ const r = $e("RouterLink"), m = $e("Nav");
477
+ return c(), u("div", {
478
+ class: "nav-container",
479
+ style: me({ "--layer": O(a) })
480
+ }, [
481
+ (c(!0), u(T, null, A(e.list, (b, w) => (c(), u("div", {
482
+ class: "nav-item",
483
+ key: b.path
484
+ }, [
485
+ D(r, {
486
+ class: "link",
487
+ to: { name: b.name },
488
+ "exact-active-class": "active"
489
+ }, {
490
+ default: P(() => [
491
+ D(O(z), {
492
+ type: b.meta?.icon
493
+ }, null, 8, ["type"]),
494
+ p("span", Mt, x(b.meta?.title), 1),
495
+ b.children?.length ? (c(), V(O(z), {
496
+ key: 0,
497
+ type: n[w] ? "down" : "right",
498
+ class: "arrow-icon",
499
+ onClick: (L) => n[w] = !n[w]
500
+ }, null, 8, ["type", "onClick"])) : I("", !0)
501
+ ]),
502
+ _: 2
503
+ }, 1032, ["to"]),
504
+ D(xe, nt(l), {
505
+ default: P(() => [
506
+ b.children?.length ? $((c(), V(m, {
507
+ key: 0,
508
+ list: b.children
509
+ }, null, 8, ["list"])), [
510
+ [R, n[w]]
511
+ ]) : I("", !0)
512
+ ]),
513
+ _: 2
514
+ }, 1040)
515
+ ]))), 128))
516
+ ], 4);
517
+ };
518
+ }
519
+ }), ne = /* @__PURE__ */ k(Ct, [["__scopeId", "data-v-69d79c4b"]]);
520
+ ne.install = function(e) {
521
+ e.component(ne.name, ne);
522
+ };
523
+ const ye = document.createElement("div");
524
+ let Y = null, Te = null;
525
+ const Z = (e, t) => {
526
+ Y || (document.body.appendChild(ye), Y = Ee(F, {
527
+ onDestroy: () => {
528
+ Y.unmount(), Y = null, document.body.removeChild(ye);
529
+ }
530
+ }), Te = Y.mount(ye)), Te.add(e, t);
531
+ }, It = {
532
+ success: (e) => {
533
+ Z(e, "success");
534
+ },
535
+ error: (e) => {
536
+ Z(e, "error");
537
+ },
538
+ warn: (e) => {
539
+ Z(e, "warn");
540
+ },
541
+ info: (e) => {
542
+ Z(e, "info");
543
+ }
544
+ }, At = {
545
+ key: 0,
546
+ class: "pagination-container"
547
+ }, zt = {
548
+ key: 0,
549
+ class: "controls"
550
+ }, Ht = ["disabled"], Nt = ["onClick"], Dt = ["disabled"], Ot = { class: "meta" }, jt = ["value"], Pt = ["max"], Bt = /* @__PURE__ */ Object.assign({ name: "Pagination" }, {
551
+ __name: "index",
552
+ props: /* @__PURE__ */ Ne({
553
+ total: { type: Number, default: 0 },
554
+ // 共有多少条数据
555
+ pageSizes: { type: Array, default: () => [10, 20, 50, 100] },
556
+ // 可选的每页条数
557
+ maxButtonCount: { type: Number, default: 7 }
558
+ // 最大显示多少个页码按钮
559
+ }, {
560
+ modelValue: { type: Number, default: 1 },
561
+ modelModifiers: {},
562
+ pageSize: { type: Number, default: 10 },
563
+ pageSizeModifiers: {}
564
+ }),
565
+ emits: ["update:modelValue", "update:pageSize"],
566
+ setup(e) {
567
+ const t = ct(), a = it(), n = ue(e, "modelValue"), l = ue(e, "pageSize"), s = e, f = B("");
568
+ te(l, () => {
569
+ n.value > r.value && m(r.value);
570
+ });
571
+ const r = G(() => !s.total || l.value <= 0 ? 0 : Math.max(0, Math.ceil(s.total / l.value)));
572
+ function m(y) {
573
+ const v = Math.min(Math.max(1, Math.floor(y || 1)), Math.max(1, r.value || 1));
574
+ v !== n.value && (n.value = v);
575
+ }
576
+ function b() {
577
+ let y = Number(f.value);
578
+ if (!y || isNaN(y) || y < 1 || y > r.value) {
579
+ f.value = "", It.warn("请输入有效页码");
580
+ return;
581
+ }
582
+ m(y), f.value = "";
583
+ }
584
+ function w(y) {
585
+ if (y)
586
+ if (y.ellipsis) {
587
+ const v = Math.max(3, Math.min(r.value, Math.max(5, s.maxButtonCount) - 2));
588
+ y.key === "left" ? m(n.value - v) : m(n.value + v);
589
+ } else y.page && m(y.page);
590
+ }
591
+ const L = G(() => {
592
+ const y = [], v = r.value, h = Math.max(5, s.maxButtonCount), S = n.value;
593
+ if (v <= h) {
594
+ for (let o = 1; o <= v; o++) y.push({ key: `p${o}`, page: o, label: o });
595
+ return y;
596
+ }
597
+ const H = Math.floor((h - 1) / 2);
598
+ let N = Math.max(2, S - H), g = Math.min(v - 1, S + H);
599
+ S - 1 <= H && (N = 2, g = h - 1), v - S <= H && (N = v - (h - 2), g = v - 1), y.push({ key: "p1", page: 1, label: 1 }), N > 2 && y.push({ key: "left", ellipsis: !0, label: "..." });
600
+ for (let o = N; o <= g; o++)
601
+ y.push({ key: `p${o}`, page: o, label: o });
602
+ return g < v - 1 && y.push({ key: "right", ellipsis: !0, label: "..." }), y.push({ key: `p${v}`, page: v, label: v }), y;
603
+ }), M = te(
604
+ () => s.total,
605
+ (y) => {
606
+ if (!y) return;
607
+ const v = +a.query.page, h = +a.query.pageSize;
608
+ h && !isNaN(h) && s.pageSizes.includes(h) && (l.value = h), v <= r.value && (m(v), M());
609
+ },
610
+ { immediate: !0 }
611
+ );
612
+ return te([n, l], () => {
613
+ t.replace({
614
+ query: {
615
+ ...a.query,
616
+ page: n.value,
617
+ pageSize: l.value
618
+ }
619
+ });
620
+ }), (y, v) => e.total ? (c(), u("div", At, [
621
+ e.total > l.value ? (c(), u("div", zt, [
622
+ p("button", {
623
+ disabled: n.value === 1,
624
+ onClick: v[0] || (v[0] = (h) => m(n.value - 1))
625
+ }, "上一页", 8, Ht),
626
+ (c(!0), u(T, null, A(L.value, (h) => (c(), u("button", {
627
+ key: h.key,
628
+ class: J({ active: h.page === n.value }),
629
+ onClick: (S) => w(h)
630
+ }, x(h.label), 11, Nt))), 128)),
631
+ p("button", {
632
+ disabled: n.value === r.value || !r.value,
633
+ onClick: v[1] || (v[1] = (h) => m(n.value + 1))
634
+ }, " 下一页 ", 8, Dt)
635
+ ])) : I("", !0),
636
+ p("div", Ot, [
637
+ p("p", null, "共" + x(e.total) + "条,第" + x(n.value) + " / " + x(r.value || 1) + "页", 1),
638
+ $(p("select", {
639
+ "onUpdate:modelValue": v[2] || (v[2] = (h) => l.value = h)
640
+ }, [
641
+ (c(!0), u(T, null, A(e.pageSizes, (h) => (c(), u("option", {
642
+ key: h,
643
+ value: h
644
+ }, x(h) + " / 页", 9, jt))), 128))
645
+ ], 512), [
646
+ [
647
+ ot,
648
+ l.value,
649
+ void 0,
650
+ { number: !0 }
651
+ ]
652
+ ]),
653
+ e.total > l.value ? (c(), u(T, { key: 0 }, [
654
+ $(p("input", {
655
+ type: "number",
656
+ "onUpdate:modelValue": v[3] || (v[3] = (h) => f.value = h),
657
+ min: "1",
658
+ max: r.value || 1,
659
+ onKeyup: at(b, ["enter"]),
660
+ placeholder: "页码"
661
+ }, null, 40, Pt), [
662
+ [
663
+ lt,
664
+ f.value,
665
+ void 0,
666
+ { number: !0 }
667
+ ]
668
+ ]),
669
+ p("button", { onClick: b }, "跳转")
670
+ ], 64)) : I("", !0)
671
+ ])
672
+ ])) : I("", !0);
673
+ }
674
+ }), oe = /* @__PURE__ */ k(Bt, [["__scopeId", "data-v-e175d2aa"]]);
675
+ oe.install = function(e) {
676
+ e.component(oe.name, oe);
677
+ };
678
+ const Vt = { class: "warn-container" }, Rt = /* @__PURE__ */ Object.assign({ name: "Warn" }, {
679
+ __name: "index",
680
+ props: {
681
+ msg: {
682
+ type: String,
683
+ default: "暂无数据"
684
+ }
685
+ },
686
+ setup(e) {
687
+ return (t, a) => (c(), u("div", Vt, [
688
+ D(O(z), { type: "tip" }),
689
+ p("p", null, x(e.msg), 1),
690
+ pe(t.$slots, "default", {}, void 0, !0)
691
+ ]));
692
+ }
693
+ }), K = /* @__PURE__ */ k(Rt, [["__scopeId", "data-v-0e46cecf"]]);
694
+ K.install = function(e) {
695
+ e.component(K.name, K);
696
+ };
697
+ const Yt = { class: "table-container" }, Ut = {
698
+ key: 0,
699
+ class: "table-inner"
700
+ }, qt = { class: "row" }, Wt = { class: "content" }, Xt = /* @__PURE__ */ Object.assign({ name: "Table" }, {
701
+ __name: "index",
702
+ props: {
703
+ data: {
704
+ type: Array,
705
+ required: !0
706
+ }
707
+ },
708
+ setup(e) {
709
+ return (t, a) => (c(), u("div", Yt, [
710
+ e.data.length ? (c(), u("div", Ut, [
711
+ p("header", qt, [
712
+ (c(!0), u(T, null, A(e.data[0], (n, l) => (c(), u("div", {
713
+ class: "cell",
714
+ key: l
715
+ }, x(l), 1))), 128))
716
+ ]),
717
+ (c(!0), u(T, null, A(e.data, (n, l) => (c(), u("div", {
718
+ class: "row",
719
+ key: l
720
+ }, [
721
+ (c(!0), u(T, null, A(n, (s, f) => (c(), u("div", {
722
+ class: "cell",
723
+ key: f
724
+ }, [
725
+ p("p", Wt, x(s), 1)
726
+ ]))), 128))
727
+ ]))), 128))
728
+ ])) : (c(), V(O(K), { key: 1 }))
729
+ ]));
730
+ }
731
+ }), ae = /* @__PURE__ */ k(Xt, [["__scopeId", "data-v-f0bc9df0"]]);
732
+ ae.install = function(e) {
733
+ e.component(ae.name, ae);
734
+ };
735
+ const Ft = { class: "timer-container" }, le = /* @__PURE__ */ Object.assign({ name: "Timer" }, {
736
+ __name: "index",
737
+ setup(e, { expose: t }) {
738
+ const a = B(0);
739
+ let n;
740
+ const l = G(() => s(a.value));
741
+ _e(() => {
742
+ clearInterval(n);
743
+ });
744
+ const s = () => {
745
+ const m = Math.floor(a.value / 3600), b = Math.floor(a.value % 3600 / 60), w = a.value % 60;
746
+ return (m ? [m, b, w] : [b, w]).map((M) => M.toString().padStart(2, "0")).join(":");
747
+ };
748
+ return t({
749
+ start: (m) => {
750
+ m !== void 0 && (a.value = m), !n && (n = setInterval(() => {
751
+ a.value++;
752
+ }, 1e3));
753
+ },
754
+ stop: () => {
755
+ clearInterval(n), n = null;
756
+ },
757
+ getTime: () => a.value
758
+ }), (m, b) => (c(), u("span", Ft, x(l.value), 1));
759
+ }
760
+ });
761
+ le.install = function(e) {
762
+ e.component(le.name, le);
763
+ };
764
+ const Kt = (e) => G(() => {
765
+ const t = document.createElement("canvas"), a = window.devicePixelRatio || 1, l = e.fontSize * a + "px serif", s = t.getContext("2d"), { width: f } = s.measureText(e.text), r = Math.max(100, f) + e.gap * a;
766
+ return t.width = r, t.height = r, s.translate(t.width / 2, t.height / 2), s.rotate(Math.PI / 180 * -e.rotate), s.fillStyle = e.color, s.font = l, s.textAlign = "center", s.textBaseline = "middle", s.fillText(e.text, 0, 0), {
767
+ base64: t.toDataURL(),
768
+ size: r / a
769
+ };
770
+ }), Jt = /* @__PURE__ */ Object.assign({ name: "Watermark" }, {
771
+ __name: "index",
772
+ props: {
773
+ text: {
774
+ type: String,
775
+ default: "Watermark"
776
+ },
777
+ fontSize: {
778
+ type: Number,
779
+ default: 20
780
+ },
781
+ gap: {
782
+ type: Number,
783
+ default: 100
784
+ },
785
+ rotate: {
786
+ type: Number,
787
+ default: -45
788
+ },
789
+ color: {
790
+ type: String,
791
+ default: "rgba(0, 0, 0, .1)"
792
+ }
793
+ },
794
+ setup(e) {
795
+ const t = ze("parentRef"), a = e;
796
+ let n;
797
+ const l = Kt(a), s = () => {
798
+ if (!t.value) return;
799
+ n && n.remove();
800
+ const { base64: r, size: m } = l.value;
801
+ n = document.createElement("div"), n.style.position = "absolute", n.style.backgroundImage = `url(${r})`, n.style.backgroundRepeat = "repeat", n.style.backgroundSize = `${m}px ${m}px`, n.style.pointerEvents = "none", n.style.zIndex = 9999, n.style.inset = 0, t.value.appendChild(n);
802
+ }, f = new MutationObserver((r) => {
803
+ for (const m of r) {
804
+ for (const b of m.removedNodes)
805
+ if (b === n) {
806
+ s();
807
+ return;
808
+ }
809
+ if (m.target === n) {
810
+ s();
811
+ return;
812
+ }
813
+ }
814
+ });
815
+ return Ae(() => {
816
+ s(), f.observe(t.value, {
817
+ attributes: !0,
818
+ childList: !0,
819
+ subtree: !0
820
+ });
821
+ }), _e(() => {
822
+ f.disconnect();
823
+ }), (r, m) => (c(), u("div", {
824
+ class: "watermark-container",
825
+ ref_key: "parentRef",
826
+ ref: t
827
+ }, [
828
+ pe(r.$slots, "default", {}, void 0, !0)
829
+ ], 512));
830
+ }
831
+ }), se = /* @__PURE__ */ k(Jt, [["__scopeId", "data-v-b86ee0ab"]]);
832
+ se.install = function(e) {
833
+ e.component(se.name, se);
834
+ };
835
+ const Gt = { class: "switch-container" }, Qt = { class: "slider" }, Zt = { class: "circle" }, en = {
836
+ class: "cross",
837
+ "xml:space": "preserve",
838
+ style: { "enable-background": "new 0 0 512 512" },
839
+ viewBox: "0 0 365.696 365.696",
840
+ y: "0",
841
+ x: "0",
842
+ height: "6",
843
+ width: "6",
844
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
845
+ version: "1.1",
846
+ xmlns: "http://www.w3.org/2000/svg"
847
+ }, tn = {
848
+ class: "checkmark",
849
+ "xml:space": "preserve",
850
+ style: { "enable-background": "new 0 0 512 512" },
851
+ viewBox: "0 0 24 24",
852
+ y: "0",
853
+ x: "0",
854
+ height: "10",
855
+ width: "10",
856
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
857
+ version: "1.1",
858
+ xmlns: "http://www.w3.org/2000/svg"
859
+ }, nn = /* @__PURE__ */ Object.assign({ name: "Switch" }, {
860
+ __name: "index",
861
+ props: {
862
+ modelValue: { type: Boolean, required: !0 },
863
+ modelModifiers: {}
864
+ },
865
+ emits: ["update:modelValue"],
866
+ setup(e) {
867
+ const t = ue(e, "modelValue");
868
+ return (a, n) => (c(), u("label", Gt, [
869
+ $(p("input", {
870
+ type: "checkbox",
871
+ "onUpdate:modelValue": n[0] || (n[0] = (l) => t.value = l)
872
+ }, null, 512), [
873
+ [De, t.value]
874
+ ]),
875
+ p("div", Qt, [
876
+ p("div", Zt, [
877
+ (c(), u("svg", en, n[1] || (n[1] = [
878
+ p("g", null, [
879
+ p("path", {
880
+ "data-original": "#000000",
881
+ fill: "currentColor",
882
+ d: "M243.188 182.86 356.32 69.726c12.5-12.5 12.5-32.766 0-45.247L341.238 9.398c-12.504-12.503-32.77-12.503-45.25 0L182.86 122.528 69.727 9.374c-12.5-12.5-32.766-12.5-45.247 0L9.375 24.457c-12.5 12.504-12.5 32.77 0 45.25l113.152 113.152L9.398 295.99c-12.503 12.503-12.503 32.769 0 45.25L24.48 356.32c12.5 12.5 32.766 12.5 45.247 0l113.132-113.132L295.99 356.32c12.503 12.5 32.769 12.5 45.25 0l15.081-15.082c12.5-12.504 12.5-32.77 0-45.25zm0 0"
883
+ })
884
+ ], -1)
885
+ ]))),
886
+ (c(), u("svg", tn, n[2] || (n[2] = [
887
+ p("g", null, [
888
+ p("path", {
889
+ class: "",
890
+ "data-original": "#000000",
891
+ fill: "currentColor",
892
+ d: "M9.707 19.121a.997.997 0 0 1-1.414 0l-5.646-5.647a1.5 1.5 0 0 1 0-2.121l.707-.707a1.5 1.5 0 0 1 2.121 0L9 14.171l9.525-9.525a1.5 1.5 0 0 1 2.121 0l.707.707a1.5 1.5 0 0 1 0 2.121z"
893
+ })
894
+ ], -1)
895
+ ])))
896
+ ])
897
+ ])
898
+ ]));
899
+ }
900
+ }), re = /* @__PURE__ */ k(nn, [["__scopeId", "data-v-f75b2497"]]);
901
+ re.install = function(e) {
902
+ e.component(re.name, re);
903
+ };
904
+ const on = { class: "checkbox-container" }, an = { class: "label" }, ln = ["value"], sn = { class: "desc" }, rn = /* @__PURE__ */ Object.assign({ name: "Checkbox" }, {
905
+ __name: "index",
906
+ props: /* @__PURE__ */ Ne({
907
+ value: {
908
+ required: !0
909
+ },
910
+ title: {
911
+ type: String,
912
+ required: !0
913
+ }
914
+ }, {
915
+ modelValue: {},
916
+ modelModifiers: {}
917
+ }),
918
+ emits: ["update:modelValue"],
919
+ setup(e) {
920
+ const t = ue(e, "modelValue");
921
+ return (a, n) => (c(), u("div", on, [
922
+ p("label", an, [
923
+ $(p("input", {
924
+ type: "checkbox",
925
+ "onUpdate:modelValue": n[0] || (n[0] = (l) => t.value = l),
926
+ value: e.value
927
+ }, null, 8, ln), [
928
+ [De, t.value]
929
+ ]),
930
+ n[1] || (n[1] = p("svg", {
931
+ xmlns: "http://www.w3.org/2000/svg",
932
+ fill: "none",
933
+ viewBox: "0 0 200 200",
934
+ class: "svg"
935
+ }, [
936
+ p("rect", {
937
+ x: "0",
938
+ y: "0",
939
+ width: "200",
940
+ height: "200",
941
+ "stroke-width": "40",
942
+ class: "box",
943
+ fill: "rgba(207,205,205,0.425)",
944
+ rx: "30",
945
+ ry: "30"
946
+ }),
947
+ p("path", {
948
+ "stroke-width": "15",
949
+ d: "M52 111.018L76.9867 136L149 64",
950
+ class: "tick"
951
+ })
952
+ ], -1)),
953
+ p("span", sn, x(e.title), 1)
954
+ ])
955
+ ]));
956
+ }
957
+ }), ce = /* @__PURE__ */ k(rn, [["__scopeId", "data-v-d71f306b"]]);
958
+ ce.install = function(e) {
959
+ e.component(ce.name, ce);
960
+ };
961
+ const cn = 500, ee = 100, Le = {
962
+ up: [
963
+ {
964
+ transform: `translateY(${ee}px)`,
965
+ opacity: 0
966
+ },
967
+ {
968
+ transform: "translateY(0)",
969
+ opacity: 1
970
+ }
971
+ ],
972
+ down: [
973
+ {
974
+ transform: `translateY(-${ee}px)`,
975
+ opacity: 0
976
+ },
977
+ {
978
+ transform: "translateY(0)",
979
+ opacity: 1
980
+ }
981
+ ],
982
+ left: [
983
+ {
984
+ transform: `translateX(${ee}px)`,
985
+ opacity: 0
986
+ },
987
+ {
988
+ transform: "translateX(0)",
989
+ opacity: 1
990
+ }
991
+ ],
992
+ right: [
993
+ {
994
+ transform: `translateX(-${ee}px)`,
995
+ opacity: 0
996
+ },
997
+ {
998
+ transform: "translateX(0)",
999
+ opacity: 1
1000
+ }
1001
+ ],
1002
+ scale: [
1003
+ {
1004
+ transform: "scale(0)",
1005
+ opacity: 0
1006
+ },
1007
+ {
1008
+ transform: "scale(1)",
1009
+ opacity: 1
1010
+ }
1011
+ ],
1012
+ opacity: [
1013
+ {
1014
+ opacity: 0
1015
+ },
1016
+ {
1017
+ opacity: 1
1018
+ }
1019
+ ],
1020
+ fade: [
1021
+ {
1022
+ transform: "translateY(-5px) scale(1.2)",
1023
+ opacity: 0
1024
+ },
1025
+ {
1026
+ transform: "translateY(0) scale(1)",
1027
+ opacity: 1
1028
+ }
1029
+ ]
1030
+ }, un = {
1031
+ name: "delay-in",
1032
+ mounted(e, t) {
1033
+ const a = t.arg || "fade", n = e.animate(Le[a] || Le.fade, {
1034
+ duration: cn,
1035
+ easing: "ease-in-out",
1036
+ delay: t.value || 0,
1037
+ fill: "both"
1038
+ });
1039
+ n.onfinish = () => {
1040
+ n.cancel();
1041
+ }, n.play();
1042
+ }
1043
+ }, dn = "正在加载...", ke = /* @__PURE__ */ new WeakMap(), mn = () => {
1044
+ const e = document.createElement("div");
1045
+ return e.style.position = "absolute", e.style.top = "50%", e.style.left = "50%", e.style.transform = "translate(-50%, -50%)", e.style.zIndex = "100", e;
1046
+ }, Me = (e) => {
1047
+ const t = ke.get(e);
1048
+ t && (t.app.unmount(), t.container.remove(), t.changePosition && (e.style.position = ""));
1049
+ }, Ce = (e, t) => {
1050
+ const a = {};
1051
+ getComputedStyle(e).position === "static" && (e.style.position = "relative", a.changePosition = !0);
1052
+ const n = B("");
1053
+ Be(n, t.value);
1054
+ const l = mn(), s = st({
1055
+ render: () => rt(X, { text: n.value })
1056
+ }), f = Ee(s);
1057
+ f.mount(l), e.appendChild(l), a.container = l, a.app = f, a.textRef = n, ke.set(e, a);
1058
+ }, Be = (e, t) => {
1059
+ t === !0 ? e.value = dn : e.value = t;
1060
+ }, pn = {
1061
+ name: "loading",
1062
+ mounted(e, t) {
1063
+ t.value !== !1 && Ce(e, t);
1064
+ },
1065
+ updated(e, t) {
1066
+ if (t.value === !1) {
1067
+ Me(e);
1068
+ return;
1069
+ }
1070
+ const a = ke.get(e);
1071
+ a ? Be(a.textRef, t.value) : Ce(e, t);
1072
+ },
1073
+ unmounted(e) {
1074
+ Me(e);
1075
+ }
1076
+ }, vn = 600, Ve = 100, Re = /* @__PURE__ */ new WeakMap(), we = new IntersectionObserver((e) => {
1077
+ for (const t of e) {
1078
+ const a = Re.get(t.target);
1079
+ a && t.isIntersecting && (a.play(), we.unobserve(t.target));
1080
+ }
1081
+ }), fn = (e) => e.getBoundingClientRect().top - Ve > window.innerHeight, hn = {
1082
+ name: "slide-in",
1083
+ mounted(e, t) {
1084
+ if (!fn(e))
1085
+ return;
1086
+ const a = e.animate(
1087
+ [
1088
+ {
1089
+ transform: `translateY(${Ve}px)`,
1090
+ opacity: 0.5
1091
+ },
1092
+ {
1093
+ transform: "translateY(0px)",
1094
+ opacity: 1
1095
+ }
1096
+ ],
1097
+ {
1098
+ duration: vn,
1099
+ easing: "ease-out",
1100
+ delay: t.value || 0,
1101
+ fill: "both"
1102
+ }
1103
+ );
1104
+ a.pause(), a.onfinish = () => {
1105
+ a.cancel();
1106
+ }, Re.set(e, a), we.observe(e);
1107
+ },
1108
+ unmounted(e) {
1109
+ we.unobserve(e);
1110
+ }
1111
+ }, yn = {
1112
+ name: "text-jump",
1113
+ mounted(e, t) {
1114
+ const a = t.value || ["#ff1e00", "#335bff"];
1115
+ e.style.cssText += `
1116
+ background-image: linear-gradient(90deg, ${a[0]}33 0%, ${a[0]} 20%, ${a[1]} 80%, ${a[1]}33 100%);
1117
+ background-size: 200% 100%;
1118
+ background-clip: text;
1119
+ color: transparent;
1120
+ `, e.animate(
1121
+ [
1122
+ {
1123
+ backgroundPositionX: "200%"
1124
+ },
1125
+ {
1126
+ backgroundPositionX: "0%"
1127
+ }
1128
+ ],
1129
+ {
1130
+ //匀速,无限循环
1131
+ duration: 4e3,
1132
+ easing: "linear",
1133
+ iterations: 1 / 0,
1134
+ delay: dt(0, 8) * -500
1135
+ //随机延迟
1136
+ }
1137
+ ).play();
1138
+ }
1139
+ };
1140
+ let j = null;
1141
+ const ie = /* @__PURE__ */ new WeakMap(), Ie = () => j || (j = new IntersectionObserver((e) => {
1142
+ e.forEach((t) => {
1143
+ if (t.isIntersecting) {
1144
+ const a = t.target, { src: n, callbacks: l } = ie.get(a);
1145
+ l.onEnterViewport?.(a), j.unobserve(a), l.onLoadStart?.(a, n), gn(a, n, l.onLoadSuccess, l.onLoadError);
1146
+ }
1147
+ });
1148
+ }), j), gn = (e, t, a, n) => {
1149
+ const l = new Image();
1150
+ l.src = t, l.onload = () => {
1151
+ e.src = t, a?.(e, t);
1152
+ }, l.onerror = (s) => {
1153
+ n?.(e, t, s);
1154
+ };
1155
+ }, bn = {
1156
+ name: "lazy",
1157
+ // 指令绑定到元素时
1158
+ mounted(e, t) {
1159
+ if (!(e instanceof HTMLImageElement)) {
1160
+ console.warn("v-lazy 指令仅支持 img 元素");
1161
+ return;
1162
+ }
1163
+ let a = "", n = {
1164
+ onEnterViewport: null,
1165
+ onLoadStart: null,
1166
+ onLoadSuccess: null,
1167
+ onLoadError: null
1168
+ };
1169
+ if (typeof t.value == "string")
1170
+ a = t.value;
1171
+ else if (typeof t.value == "object" && t.value.src)
1172
+ a = t.value.src, n = { ...n, ...t.value };
1173
+ else {
1174
+ console.error("v-lazy 绑定值格式错误,支持:字符串地址 | { src: 地址, 回调函数 }");
1175
+ return;
1176
+ }
1177
+ ie.set(e, { src: a, callbacks: n }), Ie().observe(e);
1178
+ },
1179
+ // 指令更新时
1180
+ updated(e, t) {
1181
+ let a = "", n = {
1182
+ onEnterViewport: null,
1183
+ onLoadStart: null,
1184
+ onLoadSuccess: null,
1185
+ onLoadError: null
1186
+ };
1187
+ if (typeof t.value == "string")
1188
+ a = t.value;
1189
+ else if (typeof t.value == "object" && t.value.src)
1190
+ a = t.value.src, n = { ...n, ...t.value };
1191
+ else
1192
+ return;
1193
+ ie.set(e, { src: a, callbacks: n }), Ie().observe(e);
1194
+ },
1195
+ // 元素卸载时(清理回调和监听)
1196
+ unmounted(e) {
1197
+ j && e instanceof HTMLImageElement && (j.unobserve(e), ie.delete(e));
1198
+ }
1199
+ };
1200
+ let U = null, de = null;
1201
+ const ge = document.createElement("div"), Ye = (e) => typeof e == "object" && e !== null, wn = (e, t) => (!Ye(e) && (e = { content: e }), t === "prompt" && _n(e), e.type = t, e), _n = (e) => {
1202
+ if (!Array.isArray(e.content))
1203
+ throw new Error("Prompt content must be an array");
1204
+ e.content = e.content.map((t) => {
1205
+ if (typeof t == "string")
1206
+ return { label: t };
1207
+ if (Ye(t))
1208
+ return t;
1209
+ throw new Error("Prompt content must be an array of strings or objects");
1210
+ });
1211
+ }, xn = () => {
1212
+ U || (document.body.appendChild(ge), U = Ee(W, {
1213
+ onDestroy: () => {
1214
+ U.unmount(), U = null, document.body.removeChild(ge);
1215
+ }
1216
+ }), de = U.mount(ge));
1217
+ }, be = (e, t) => {
1218
+ xn();
1219
+ const a = wn(e, t);
1220
+ return de.open(a);
1221
+ }, Mn = {
1222
+ destroy: () => {
1223
+ de && de.destroyAll();
1224
+ },
1225
+ confirm: (e) => be(e, "confirm"),
1226
+ alert: (e) => be(e, "alert"),
1227
+ prompt: (e) => be(e, "prompt")
1228
+ }, En = [
1229
+ W,
1230
+ z,
1231
+ X,
1232
+ F,
1233
+ q,
1234
+ ne,
1235
+ oe,
1236
+ ae,
1237
+ le,
1238
+ K,
1239
+ se,
1240
+ re,
1241
+ ce
1242
+ ], kn = [un, pn, hn, yn, bn], Sn = (e) => {
1243
+ En.forEach((t) => {
1244
+ e.component(t.name, t);
1245
+ }), kn.forEach((t) => {
1246
+ e.directive(t.name, t);
1247
+ });
1248
+ }, Cn = {
1249
+ install: Sn
1250
+ };
1251
+ export {
1252
+ ce as Checkbox,
1253
+ W as Dialog,
1254
+ z as Icon,
1255
+ X as Loading,
1256
+ F as Message,
1257
+ q as Modal,
1258
+ ne as Nav,
1259
+ oe as Pagination,
1260
+ re as Switch,
1261
+ ae as Table,
1262
+ le as Timer,
1263
+ K as Warn,
1264
+ se as Watermark,
1265
+ Cn as default,
1266
+ Mn as dialog,
1267
+ Ln as disableBodyScroll,
1268
+ Sn as install,
1269
+ It as msg,
1270
+ Oe as useScrollControl,
1271
+ un as vDelayIn,
1272
+ bn as vLazy,
1273
+ pn as vLoading,
1274
+ hn as vSlideIn,
1275
+ yn as vTextJump
1276
+ };