x-next 0.0.0-alpha.3 → 0.0.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/index.es.js +1414 -0
  3. package/dist/index.umd.js +1 -0
  4. package/package.json +6 -5
  5. package/x-next/ui.js +0 -1357
  6. package/x-next/ui.umd.cjs +0 -1
  7. /package/{x-next → dist}/_hooks/use-overflow.d.ts +0 -0
  8. /package/{x-next → dist}/_hooks/use-popup-manager.d.ts +0 -0
  9. /package/{x-next → dist}/_props/css.d.ts +0 -0
  10. /package/{x-next → dist}/_props/global.d.ts +0 -0
  11. /package/{x-next → dist}/_utils/config.d.ts +0 -0
  12. /package/{x-next → dist}/_utils/convert-case.d.ts +0 -0
  13. /package/{x-next → dist}/_utils/dom.d.ts +0 -0
  14. /package/{x-next → dist}/_utils/helpers.d.ts +0 -0
  15. /package/{x-next → dist}/_utils/icon.d.ts +0 -0
  16. /package/{x-next → dist}/_utils/is.d.ts +0 -0
  17. /package/{x-next → dist}/_utils/keyboard.d.ts +0 -0
  18. /package/{x-next → dist}/_utils/number.d.ts +0 -0
  19. /package/{x-next → dist}/_utils/vue-eco.d.ts +0 -0
  20. /package/{x-next → dist}/componets/button/index.vue.d.ts +0 -0
  21. /package/{x-next → dist}/componets/button/props.d.ts +0 -0
  22. /package/{x-next → dist}/componets/dialog/index.vue.d.ts +0 -0
  23. /package/{x-next → dist}/componets/dialog/props.d.ts +0 -0
  24. /package/{x-next → dist}/componets/dialog/use-props.d.ts +0 -0
  25. /package/{x-next → dist}/componets/dialog/use.d.ts +0 -0
  26. /package/{x-next → dist}/componets/dialog/warp.d.ts +0 -0
  27. /package/{x-next → dist}/componets/message/index.vue.d.ts +0 -0
  28. /package/{x-next → dist}/componets/message/props.d.ts +0 -0
  29. /package/{x-next → dist}/componets/message/warp.d.ts +0 -0
  30. /package/{x-next → dist}/componets/message-box/index.d.ts +0 -0
  31. /package/{x-next → dist}/componets/message-box/props.d.ts +0 -0
  32. /package/{x-next → dist}/componets/message-box/warp.d.ts +0 -0
  33. /package/{x-next → dist}/componets/notification/index.vue.d.ts +0 -0
  34. /package/{x-next → dist}/componets/notification/props.d.ts +0 -0
  35. /package/{x-next → dist}/componets/notification/warp.d.ts +0 -0
  36. /package/{x-next → dist}/componets/space/index.d.ts +0 -0
  37. /package/{x-next → dist}/componets/tag-cloud/index.d.ts +0 -0
  38. /package/{x-next → dist}/componets/trend-chart/components/trend-chart-curve.d.ts +0 -0
  39. /package/{x-next → dist}/componets/trend-chart/components/trend-chart-grid.d.ts +0 -0
  40. /package/{x-next → dist}/componets/trend-chart/components/trend-chart-labels.d.ts +0 -0
  41. /package/{x-next → dist}/componets/trend-chart/components/trend-chart.d.ts +0 -0
  42. /package/{x-next → dist}/componets/trend-chart/helpers/genPath.d.ts +0 -0
  43. /package/{x-next → dist}/componets/trend-chart/helpers/genPoints.d.ts +0 -0
  44. /package/{x-next → dist}/componets/trend-chart/helpers/getPadding.d.ts +0 -0
  45. /package/{x-next → dist}/componets/trend-chart/helpers/validatePadding.d.ts +0 -0
  46. /package/{x-next → dist}/componets/trend-chart/index.d.ts +0 -0
  47. /package/{x-next → dist}/componets/trend-chart/props.d.ts +0 -0
  48. /package/{x-next → dist}/icons/animation/animation-loading.vue.d.ts +0 -0
  49. /package/{x-next → dist}/icons/default/check-circle-fill.vue.d.ts +0 -0
  50. /package/{x-next → dist}/icons/default/close-circle-fill.vue.d.ts +0 -0
  51. /package/{x-next → dist}/icons/default/exclamation-circle-fill.vue.d.ts +0 -0
  52. /package/{x-next → dist}/icons/default/info-circle-fill.vue.d.ts +0 -0
  53. /package/{x-next → dist}/icons/default/minus-circle-fill.vue.d.ts +0 -0
  54. /package/{x-next → dist}/icons/index.d.ts +0 -0
  55. /package/{x-next → dist}/style.css +0 -0
  56. /package/{x-next → dist}/ui.d.ts +0 -0
@@ -0,0 +1,1414 @@
1
+ var Ge = Object.defineProperty;
2
+ var qe = (e, t, n) => t in e ? Ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var P = (e, t, n) => qe(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { ref as X, watch as ce, onMounted as ue, onBeforeUnmount as Be, readonly as Je, defineComponent as R, computed as p, reactive as Te, openBlock as C, createBlock as B, Teleport as Qe, withDirectives as H, createElementBlock as b, normalizeClass as y, normalizeStyle as $, createVNode as m, Transition as x, withCtx as ee, vShow as V, createCommentVNode as S, createElementVNode as v, withModifiers as Se, renderSlot as M, toDisplayString as te, getCurrentInstance as _e, resolveComponent as z, Comment as xe, Fragment as Y, render as A, isVNode as w, createTextVNode as T, onUnmounted as Me, resolveDynamicComponent as et } from "vue";
5
+ const tt = "X", nt = "x", Le = (e) => e ? nt + "-" + e : e || "", G = (e) => tt + e, D = (e) => {
6
+ const t = Le(e);
7
+ return {
8
+ block: t,
9
+ element: (r) => `${t}--${r}`,
10
+ modifier: (r) => `${t}-${r}`,
11
+ is: (r) => `${t}-is-${r}`
12
+ };
13
+ }, lt = ["px", "%", "vh", "vw", "calc"], we = (e, t = "px") => {
14
+ if (e === void 0)
15
+ return "";
16
+ const n = String(e);
17
+ return lt.some((l) => n.includes(l)) ? n : n + t;
18
+ }, q = Object.prototype.toString;
19
+ function Ae(e) {
20
+ return q.call(e) === "[object Array]";
21
+ }
22
+ function De(e) {
23
+ return q.call(e) === "[object Object]";
24
+ }
25
+ const Ie = (e) => q.call(e) === "[object Promise]";
26
+ function Pe(e) {
27
+ return q.call(e) === "[object String]";
28
+ }
29
+ function rt(e) {
30
+ return q.call(e) === "[object Number]" && e === e;
31
+ }
32
+ function E(e) {
33
+ return typeof e == "function";
34
+ }
35
+ function le() {
36
+ return typeof window < "u";
37
+ }
38
+ const ot = 1e3, st = 3e3, at = 1;
39
+ class it {
40
+ constructor() {
41
+ P(this, "popupStack", {
42
+ popup: /* @__PURE__ */ new Set(),
43
+ dialog: /* @__PURE__ */ new Set(),
44
+ message: /* @__PURE__ */ new Set()
45
+ });
46
+ P(this, "getNextZIndex", (t) => (t === "message" ? Array.from(this.popupStack.message).pop() || st : Array.from(this.popupStack.popup).pop() || ot) + at);
47
+ P(this, "add", (t) => {
48
+ const n = this.getNextZIndex(t);
49
+ return this.popupStack[t].add(n), t === "dialog" && this.popupStack.popup.add(n), n;
50
+ });
51
+ P(this, "delete", (t, n) => {
52
+ this.popupStack[n].delete(t), n === "dialog" && this.popupStack.popup.delete(t);
53
+ });
54
+ P(this, "isLastDialog", (t) => this.popupStack.dialog.size > 1 ? t === Array.from(this.popupStack.dialog).pop() : !0);
55
+ }
56
+ }
57
+ const oe = new it();
58
+ function de(e, {
59
+ visible: t,
60
+ runOnMounted: n
61
+ } = {}) {
62
+ const l = X(0), s = () => {
63
+ l.value = oe.add(e);
64
+ }, r = () => {
65
+ oe.delete(l.value, e);
66
+ }, u = () => e === "dialog" ? oe.isLastDialog(l.value) : !1;
67
+ return ce(
68
+ () => t == null ? void 0 : t.value,
69
+ (o) => {
70
+ o ? s() : r();
71
+ },
72
+ {
73
+ immediate: !0
74
+ }
75
+ ), n && (ue(() => {
76
+ s();
77
+ }), Be(() => {
78
+ r();
79
+ })), {
80
+ zIndex: Je(l),
81
+ open: s,
82
+ close: r,
83
+ isLastDialog: u
84
+ };
85
+ }
86
+ const ze = (e) => e.replace(/^./, (t) => t.toLowerCase()).replace(/-(\w)/g, (t, n) => {
87
+ var l;
88
+ return (l = n == null ? void 0 : n.toUpperCase()) !== null && l !== void 0 ? l : "";
89
+ }), He = () => {
90
+ }, ct = (e, t) => {
91
+ var n;
92
+ if (le)
93
+ return (n = document.querySelector(e)) !== null && n !== void 0 ? n : void 0;
94
+ }, ut = (e) => {
95
+ if (e.tagName === "BODY")
96
+ return window.innerWidth - (document.documentElement.offsetWidth || document.body.offsetWidth);
97
+ const { borderLeftWidth: t, borderRightWidth: n } = window.getComputedStyle(e), l = Number(t.replace("px", "")) + Number(n.replace("px", ""));
98
+ return e.offsetWidth - (e.clientWidth + l);
99
+ }, dt = (e) => e.tagName === "BODY" ? document.documentElement.scrollHeight > window.innerHeight : e.scrollHeight > e.offsetHeight, ft = (e, t) => {
100
+ var n;
101
+ if (!le || !e || !t)
102
+ return "";
103
+ let l = ze(t);
104
+ l === "float" && (l = "cssFloat");
105
+ try {
106
+ const s = e.style[l];
107
+ if (s)
108
+ return s;
109
+ const r = (n = document.defaultView) === null || n === void 0 ? void 0 : n.getComputedStyle(e, "");
110
+ return r ? r[l] : "";
111
+ } catch {
112
+ return e.style[l];
113
+ }
114
+ }, Z = (e, t, n) => {
115
+ if (!(!e || !t))
116
+ if (De(t))
117
+ Object.entries(t).forEach(([l, s]) => Z(e, l, s));
118
+ else {
119
+ const l = ze(t);
120
+ e.style[l] = n;
121
+ }
122
+ }, fe = (e, t) => {
123
+ if (Pe(e)) {
124
+ const n = e[0] === "#" ? `[id='${e.slice(1)}']` : e;
125
+ return ct(n);
126
+ }
127
+ return e;
128
+ }, mt = le ? (e, t, n, l = !1) => {
129
+ e.addEventListener(t, n, l);
130
+ } : He, yt = le ? (e, t, n, l = !1) => {
131
+ e.removeEventListener(t, n, l);
132
+ } : He, gt = (e, t) => {
133
+ let n = !1;
134
+ const l = {
135
+ overflow: "",
136
+ width: ""
137
+ }, s = (o) => o.tagName === "BODY", r = () => {
138
+ if (e.value) {
139
+ const o = e.value;
140
+ if (!n && o.style.overflow !== "hidden") {
141
+ const d = ut(o);
142
+ if (d > 0 || dt(o)) {
143
+ l.overflow = o.style.overflow, l.width = o.style.width;
144
+ let f = 0;
145
+ s(o) && (f = o.getBoundingClientRect().left || 0), Z(o, {
146
+ width: `calc(100% - ${Math.ceil(d - f)}px)`,
147
+ overflow: "hidden"
148
+ }), n = !0;
149
+ }
150
+ }
151
+ }
152
+ }, u = () => {
153
+ if (e.value && n) {
154
+ const o = e.value;
155
+ Z(o, {
156
+ overflow: l.overflow,
157
+ width: l.width
158
+ }), n = !1;
159
+ }
160
+ };
161
+ return ce(
162
+ () => t == null ? void 0 : t.value,
163
+ (o) => {
164
+ e.value && !s(e.value) && (o && Z(o, {
165
+ position: "absolute"
166
+ }), ft(e.value, "position") === "static" && Z(e.value, { position: "relative" }));
167
+ }
168
+ ), {
169
+ setOverflowHidden: r,
170
+ resetOverflow: u
171
+ };
172
+ }, Ct = {
173
+ ENTER: "Enter",
174
+ ESC: "Escape",
175
+ BACKSPACE: "Backspace",
176
+ TAB: "Tab",
177
+ SPACE: " ",
178
+ ARROW_UP: "ArrowUp",
179
+ ARROW_DOWN: "ArrowDown",
180
+ ARROW_LEFT: "ArrowLeft",
181
+ ARROW_RIGHT: "ArrowRight"
182
+ }, K = (e) => e;
183
+ var j;
184
+ (function(e) {
185
+ e[e.ELEMENT = 1] = "ELEMENT", e[e.FUNCTIONAL_COMPONENT = 2] = "FUNCTIONAL_COMPONENT", e[e.STATEFUL_COMPONENT = 4] = "STATEFUL_COMPONENT", e[e.COMPONENT = 6] = "COMPONENT", e[e.TEXT_CHILDREN = 8] = "TEXT_CHILDREN", e[e.ARRAY_CHILDREN = 16] = "ARRAY_CHILDREN", e[e.SLOTS_CHILDREN = 32] = "SLOTS_CHILDREN", e[e.TELEPORT = 64] = "TELEPORT", e[e.SUSPENSE = 128] = "SUSPENSE", e[e.COMPONENT_SHOULD_KEEP_ALIVE = 256] = "COMPONENT_SHOULD_KEEP_ALIVE", e[e.COMPONENT_KEPT_ALIVE = 512] = "COMPONENT_KEPT_ALIVE";
186
+ })(j || (j = {}));
187
+ const vt = (e) => !!(e && e.shapeFlag & j.ELEMENT), ht = (e, t) => !!(e && e.shapeFlag & j.COMPONENT), kt = (e, t) => !!(e && e.shapeFlag & 8), pt = (e, t) => !!(e && e.shapeFlag & j.ARRAY_CHILDREN), bt = (e, t) => !!(e && e.shapeFlag & j.SLOTS_CHILDREN), _ = (e, t = !1) => {
188
+ var n, l;
189
+ const s = [];
190
+ for (const r of e ?? [])
191
+ vt(r) || ht(r) || t && kt(r, r.children) ? s.push(r) : pt(r, r.children) ? s.push(..._(r.children, t)) : bt(r, r.children) ? s.push(..._((l = (n = r.children).default) === null || l === void 0 ? void 0 : l.call(n), t)) : Ae(r) && s.push(..._(r, t));
192
+ return s;
193
+ }, wt = {
194
+ renderTo: {
195
+ type: K([String, Object]),
196
+ default: "body"
197
+ },
198
+ disabled: {
199
+ type: Boolean,
200
+ default: !1
201
+ },
202
+ modelValue: {
203
+ type: Boolean,
204
+ default: !1
205
+ },
206
+ top: {
207
+ type: [String, Number],
208
+ default: "3vh"
209
+ },
210
+ center: {
211
+ type: Boolean,
212
+ default: !1
213
+ },
214
+ width: {
215
+ type: [String, Number],
216
+ default: 0
217
+ },
218
+ height: {
219
+ type: [String, Number],
220
+ default: 0
221
+ },
222
+ minWidth: {
223
+ type: [String, Number],
224
+ default: 0
225
+ },
226
+ minHeight: {
227
+ type: [String, Number],
228
+ default: 0
229
+ },
230
+ title: {
231
+ type: String,
232
+ default: ""
233
+ },
234
+ mask: {
235
+ type: Boolean,
236
+ default: !0
237
+ },
238
+ // 关闭时卸载
239
+ destroyOnClosed: {
240
+ type: Boolean,
241
+ default: !0
242
+ },
243
+ // 关闭前回调检查是否可以关闭
244
+ onBeforeCancel: {
245
+ type: Function
246
+ },
247
+ // 是否点击遮罩层关闭
248
+ maskToClose: {
249
+ type: Boolean,
250
+ default: !0
251
+ },
252
+ // esc键关闭
253
+ escToClose: {
254
+ type: Boolean,
255
+ default: !0
256
+ },
257
+ // 全屏
258
+ fullscreen: {
259
+ type: Boolean,
260
+ default: !1
261
+ },
262
+ // 是否是messageBox
263
+ messageBox: {
264
+ type: Boolean,
265
+ default: !1
266
+ },
267
+ popupClass: {
268
+ type: String,
269
+ default: void 0
270
+ },
271
+ showClose: {
272
+ type: Boolean,
273
+ default: !0
274
+ },
275
+ showHeaderBottomLine: {
276
+ type: Boolean,
277
+ default: !1
278
+ }
279
+ }, Ot = ["width", "minWidth", "height", "minHeight"], Et = R({
280
+ name: G("Dialog"),
281
+ inheritAttrs: !1,
282
+ props: wt,
283
+ emits: ["closed", "close", "open", "opened", "update:modelValue"],
284
+ setup(e, { emit: t }) {
285
+ const n = D("dialog"), l = n.block, s = D("message-box"), r = s.block, u = p(() => [
286
+ l,
287
+ e.messageBox && "is-message-box",
288
+ e.popupClass && e.popupClass
289
+ ]), o = p(() => fe(e.renderTo)), d = X(), f = p(() => e.disabled || !o.value), g = p(() => ({
290
+ zIndex: O.value
291
+ })), i = p(() => {
292
+ const h = {};
293
+ return e.fullscreen || (!e.center && e.top && (h.top = we(e.top)), Ot.forEach((L) => {
294
+ e[L] && (h[L] = we(e[L]));
295
+ })), h;
296
+ }), a = X(!1), c = p(() => e.modelValue), k = p(() => c.value || a.value), { zIndex: O, isLastDialog: I } = de("dialog", {
297
+ visible: c
298
+ }), { setOverflowHidden: Re, resetOverflow: he } = gt(o, d), ke = (h, L) => {
299
+ t("update:modelValue", !1), t("close", e.messageBox ? h : void 0, e.messageBox ? L : void 0);
300
+ }, Fe = () => {
301
+ a.value = !1, he(), t("closed");
302
+ }, Ue = () => {
303
+ t("opened");
304
+ }, J = Te({
305
+ ok: !1,
306
+ cancel: !1
307
+ }), U = (h, L) => {
308
+ let Q = !0;
309
+ if (J[h] = !0, E(e.onBeforeCancel) && (Q = e.onBeforeCancel(h) ?? !1), Ie(Q)) {
310
+ Q.then((Ye) => {
311
+ J[h] = !1, Ye && ke(h, L);
312
+ });
313
+ return;
314
+ }
315
+ J[h] = !1, Q && ke(h, L);
316
+ }, We = () => {
317
+ e.maskToClose && e.mask && U("cancel");
318
+ }, Ze = (h) => {
319
+ U("cancel", h);
320
+ }, Ke = (h) => {
321
+ U("ok", h);
322
+ };
323
+ let re = !1;
324
+ const pe = (h) => {
325
+ e.escToClose && h.key === Ct.ESC && I() && U("cancel");
326
+ }, Xe = () => {
327
+ e.escToClose && !re && (re = !0, mt(document.documentElement, "keydown", pe));
328
+ }, be = () => {
329
+ re = !1, yt(document.documentElement, "keydown", pe);
330
+ };
331
+ return Be(() => {
332
+ he(), be();
333
+ }), ce(
334
+ () => c.value,
335
+ (h) => {
336
+ h ? (t("open"), Re(), a.value = !0, Xe()) : be();
337
+ },
338
+ { immediate: !0 }
339
+ ), {
340
+ cls: u,
341
+ ns: l,
342
+ cn: n,
343
+ cnOMB: s,
344
+ messageBoxNs: r,
345
+ containerStyle: i,
346
+ dialogStyle: g,
347
+ dialogRef: d,
348
+ teleportContainer: o,
349
+ teleportDisabled: f,
350
+ modelVisible: c,
351
+ mergeVisible: k,
352
+ interceptClose: U,
353
+ afterLeave: Fe,
354
+ afterEnter: Ue,
355
+ handleMaskClick: We,
356
+ handleCancel: Ze,
357
+ handleOk: Ke,
358
+ loadingObj: J
359
+ };
360
+ }
361
+ }), N = (e, t) => {
362
+ const n = e.__vccOpts || e;
363
+ for (const [l, s] of t)
364
+ n[l] = s;
365
+ return n;
366
+ };
367
+ function $t(e, t, n, l, s, r) {
368
+ return C(), B(Qe, {
369
+ to: e.teleportContainer,
370
+ disabled: e.teleportDisabled
371
+ }, [
372
+ !e.destroyOnClosed || e.mergeVisible ? H((C(), b("div", {
373
+ key: 0,
374
+ ref: "dialogRef",
375
+ class: y(e.cls),
376
+ style: $(e.dialogStyle)
377
+ }, [
378
+ m(x, {
379
+ name: "x-fade-in-standard",
380
+ appear: ""
381
+ }, {
382
+ default: ee(() => [
383
+ e.mask ? H((C(), b("div", {
384
+ key: 0,
385
+ class: y([e.cn.element("mask")])
386
+ }, null, 2)), [
387
+ [V, e.modelVisible]
388
+ ]) : S("", !0)
389
+ ]),
390
+ _: 1
391
+ }),
392
+ v("div", {
393
+ class: y([e.cn.element("wrapper"), { "is-center": e.center }]),
394
+ onClick: t[1] || (t[1] = Se((...u) => e.handleMaskClick && e.handleMaskClick(...u), ["self"]))
395
+ }, [
396
+ m(x, {
397
+ name: "x-zoom-in",
398
+ appear: "",
399
+ onAfterEnter: e.afterEnter,
400
+ onAfterLeave: e.afterLeave
401
+ }, {
402
+ default: ee(() => [
403
+ H(v("div", {
404
+ class: y([e.cn.element("container"), { "is-fullscreen": e.fullscreen }]),
405
+ style: $(e.containerStyle)
406
+ }, [
407
+ v("div", {
408
+ class: y([
409
+ e.messageBox ? e.cnOMB.element("header") : e.cn.element("header"),
410
+ e.showHeaderBottomLine && "is-bottom-line"
411
+ ])
412
+ }, [
413
+ M(e.$slots, "title", {}, () => [
414
+ v("div", {
415
+ class: y([e.cn.element("header-title")])
416
+ }, te(e.title), 3)
417
+ ])
418
+ ], 2),
419
+ v("div", {
420
+ class: y([e.messageBox ? e.cnOMB.element("body") : e.cn.element("body")])
421
+ }, [
422
+ M(e.$slots, "default")
423
+ ], 2),
424
+ v("div", {
425
+ class: y([e.messageBox ? e.cnOMB.element("footer") : e.cn.element("footer")])
426
+ }, [
427
+ M(e.$slots, "footer", {
428
+ cancel: e.handleCancel,
429
+ ok: e.handleOk,
430
+ loadingObj: e.loadingObj
431
+ })
432
+ ], 2),
433
+ e.showClose ? (C(), b("span", {
434
+ key: 0,
435
+ class: y([e.cn.element("close-icon"), e.messageBox && e.cnOMB.element("close-icon")]),
436
+ onClick: t[0] || (t[0] = (u) => e.interceptClose("cancel"))
437
+ }, null, 2)) : S("", !0)
438
+ ], 6), [
439
+ [V, e.modelVisible]
440
+ ])
441
+ ]),
442
+ _: 3
443
+ }, 8, ["onAfterEnter", "onAfterLeave"])
444
+ ], 2)
445
+ ], 6)), [
446
+ [V, e.mergeVisible]
447
+ ]) : S("", !0)
448
+ ], 8, ["to", "disabled"]);
449
+ }
450
+ const Ve = /* @__PURE__ */ N(Et, [["render", $t]]), Nt = {
451
+ disabled: Boolean,
452
+ block: Boolean,
453
+ loading: Boolean,
454
+ loadingFill: {
455
+ type: Boolean,
456
+ default: !1
457
+ },
458
+ debounce: {
459
+ type: Number,
460
+ default: 0
461
+ },
462
+ shape: {
463
+ type: K(String),
464
+ default: void 0
465
+ },
466
+ link: {
467
+ type: Boolean,
468
+ default: !1
469
+ },
470
+ type: {
471
+ type: K(String),
472
+ default: void 0
473
+ },
474
+ status: {
475
+ type: K(String),
476
+ default: void 0
477
+ },
478
+ plain: {
479
+ type: Boolean,
480
+ default: !1
481
+ },
482
+ size: {
483
+ type: K(String),
484
+ default: "medium"
485
+ },
486
+ border: {
487
+ type: Boolean,
488
+ default: !0
489
+ }
490
+ }, Bt = (e) => Pe(e) ? e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("") : "", Tt = (e, t = "px") => {
491
+ if (e === void 0)
492
+ return "";
493
+ const n = typeof e == "number" ? `${e}` : e;
494
+ return ["px", "%", "vh", "vw", "calc"].some((s) => n.includes(s)) ? n : n + t;
495
+ };
496
+ function F(e) {
497
+ return R({
498
+ name: Le(`Icon${Bt(e)}`),
499
+ props: {
500
+ size: {
501
+ type: [Number, String],
502
+ default: void 0
503
+ },
504
+ rotate: {
505
+ type: Number,
506
+ default: void 0
507
+ },
508
+ spin: {
509
+ type: Boolean,
510
+ default: !1
511
+ },
512
+ color: {
513
+ type: String,
514
+ default: void 0
515
+ },
516
+ fillColor: {
517
+ type: Array,
518
+ default: void 0
519
+ }
520
+ },
521
+ setup(t) {
522
+ const n = "x-icon", l = p(() => {
523
+ const r = {};
524
+ return t.size && (r.fontSize = Tt(t.size)), t.rotate && (r.transform = `rotate(${t.rotate}deg)`), t.color && (r.color = t.color), r;
525
+ });
526
+ return {
527
+ cls: p(() => [
528
+ n,
529
+ {
530
+ [`${n}-loading`]: t.spin
531
+ }
532
+ ]),
533
+ styles: l
534
+ };
535
+ }
536
+ });
537
+ }
538
+ const St = F("animation-loading");
539
+ function Mt(e, t, n, l, s, r) {
540
+ return C(), b("div", {
541
+ class: y(e.cls),
542
+ style: $(e.styles)
543
+ }, t[0] || (t[0] = [
544
+ v("svg", {
545
+ viewBox: "0 0 50 50",
546
+ class: "icon-loading-svg"
547
+ }, [
548
+ v("circle", {
549
+ cx: "25",
550
+ cy: "25",
551
+ r: "20",
552
+ class: "path",
553
+ fill: "none",
554
+ stroke: "currentColor"
555
+ })
556
+ ], -1)
557
+ ]), 6);
558
+ }
559
+ const Lt = /* @__PURE__ */ N(St, [["render", Mt], ["__scopeId", "data-v-62d46830"]]), At = R({
560
+ name: G("Button"),
561
+ components: {
562
+ AnimationLoading: Lt
563
+ },
564
+ props: Nt,
565
+ emits: ["click"],
566
+ setup(e) {
567
+ const t = Te({
568
+ // 点击
569
+ clicked: !1,
570
+ // 防抖
571
+ isDebounce: !1
572
+ }), n = D("button"), l = p(() => [
573
+ n.block,
574
+ e.type && n.modifier(e.type),
575
+ e.status && n.modifier(e.status),
576
+ e.disabled && n.is("disabled"),
577
+ e.block && n.modifier("block"),
578
+ e.plain && n.is("plain"),
579
+ e.shape && n.modifier(e.shape),
580
+ e.link && n.modifier("is-link"),
581
+ e.size && n.modifier(e.size),
582
+ !e.border && n.modifier("is-hide-border"),
583
+ r.value && n.modifier("is-loading")
584
+ ]), s = () => {
585
+ e.debounce > 0 && !t.isDebounce && (t.isDebounce = !0, setTimeout(() => {
586
+ t.isDebounce = !1;
587
+ }, e.debounce));
588
+ }, r = p(() => e.loading || t.clicked || t.isDebounce), u = _e(), o = (f, g) => {
589
+ const i = f(g);
590
+ Ie(i) && (t.clicked = !0, i.finally(() => {
591
+ t.clicked = !1;
592
+ }));
593
+ };
594
+ return {
595
+ cn: n,
596
+ cls: l,
597
+ handleClick: async (f) => {
598
+ var i, a, c, k;
599
+ if ((a = (i = f.target).blur) == null || a.call(i), r.value) return;
600
+ s();
601
+ const g = (k = (c = u == null ? void 0 : u.vnode) == null ? void 0 : c.props) == null ? void 0 : k.onClick;
602
+ Ae(g) ? g.forEach((O) => o(O, f)) : E(g) && o(g, f);
603
+ },
604
+ isLoading: r
605
+ };
606
+ }
607
+ }), Dt = ["disabled"];
608
+ function It(e, t, n, l, s, r) {
609
+ const u = z("AnimationLoading");
610
+ return C(), b("button", {
611
+ class: y(e.cls),
612
+ type: "button",
613
+ disabled: e.disabled,
614
+ onClick: t[0] || (t[0] = (...o) => e.handleClick && e.handleClick(...o))
615
+ }, [
616
+ H(v("span", {
617
+ class: y([e.cn.element("loading")])
618
+ }, [
619
+ m(u)
620
+ ], 2), [
621
+ [V, e.isLoading]
622
+ ]),
623
+ e.$slots.prefix ? (C(), b("span", {
624
+ key: 0,
625
+ class: y([e.cn.element("prefix")])
626
+ }, [
627
+ M(e.$slots, "prefix")
628
+ ], 2)) : S("", !0),
629
+ M(e.$slots, "default"),
630
+ e.$slots.suffix ? (C(), b("span", {
631
+ key: 1,
632
+ class: y([e.cn.element("suffix")])
633
+ }, [
634
+ M(e.$slots, "suffix")
635
+ ], 2)) : S("", !0)
636
+ ], 10, Dt);
637
+ }
638
+ const ne = /* @__PURE__ */ N(At, [["render", It]]), je = /* @__PURE__ */ R({
639
+ name: G("Space"),
640
+ props: {
641
+ direction: {
642
+ type: String,
643
+ default: "horizontal"
644
+ },
645
+ size: {
646
+ type: [Number, String],
647
+ default: "small"
648
+ },
649
+ align: {
650
+ type: String,
651
+ default: "center"
652
+ },
653
+ fill: {
654
+ type: Boolean,
655
+ default: !1
656
+ }
657
+ },
658
+ setup(e, {
659
+ slots: t
660
+ }) {
661
+ const n = D("space"), l = p(() => [n.block, n.element(e.direction), e.fill && "is-fill", n.element(`${e.direction}-${e.align}`)]);
662
+ function s(u) {
663
+ if (rt(u))
664
+ return u;
665
+ switch (u) {
666
+ case "mini":
667
+ return 4;
668
+ case "small":
669
+ return 8;
670
+ case "medium":
671
+ return 16;
672
+ case "large":
673
+ return 24;
674
+ default:
675
+ return 8;
676
+ }
677
+ }
678
+ const r = (u) => {
679
+ const o = {};
680
+ if (u) return o;
681
+ const d = `${s(e.size)}px`, f = `${s(e.size)}px`;
682
+ return e.direction === "horizontal" && (o.marginRight = d), e.direction === "vertical" && (o.marginBottom = f), o;
683
+ };
684
+ return () => {
685
+ var o;
686
+ const u = _((o = t.default) == null ? void 0 : o.call(t), !0).filter((d) => d.type !== xe);
687
+ return m("div", {
688
+ class: [l.value]
689
+ }, [u.map((d, f) => {
690
+ var i;
691
+ const g = t.split && f > 0;
692
+ return m(Y, {
693
+ key: `space-item-${f}`
694
+ }, [g && m("div", {
695
+ className: n.element("split"),
696
+ style: r(!1)
697
+ }, [(i = t.split) == null ? void 0 : i.call(t)]), m("div", {
698
+ className: n.element("item"),
699
+ style: r(f === u.length - 1)
700
+ }, [d])]);
701
+ })]);
702
+ };
703
+ }
704
+ });
705
+ function Oe(e) {
706
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !w(e);
707
+ }
708
+ const Ee = D("dialog"), sn = (e) => {
709
+ const t = document.createElement("div"), n = () => {
710
+ A(null, t);
711
+ }, l = (i) => {
712
+ if (i === "cancel")
713
+ return e.beforeOnCancel ? e.beforeOnCancel() : !0;
714
+ if (i === "ok")
715
+ return e.beforeOnOk ? e.beforeOnOk() : !0;
716
+ }, s = (i, a) => {
717
+ i === "cancel" && e.onCancel && e.onCancel(a), i === "ok" && e.onOk && e.onOk(a);
718
+ }, r = (i) => {
719
+ if (w(i)) return i;
720
+ if (E(i)) {
721
+ const a = i();
722
+ return w(a) ? a : null;
723
+ }
724
+ return m("div", {
725
+ className: Ee.element("header-title")
726
+ }, [T(" "), i, T(" ")]);
727
+ }, u = (i) => {
728
+ if (w(i)) return i;
729
+ if (E(i)) {
730
+ const a = i();
731
+ return w(a) ? a : null;
732
+ }
733
+ return m("div", {
734
+ className: Ee.element("content")
735
+ }, [T(" "), e.content, T(" ")]);
736
+ }, o = () => () => m(Y, null, [e.title && r(e.title)]), d = () => () => m(Y, null, [e.content && u(e.content)]), f = () => {
737
+ if (w(e.footer) || E(e.footer))
738
+ return e.footer;
739
+ const i = (e == null ? void 0 : e.cancelText) || "取消", a = (e == null ? void 0 : e.okText) || "确认";
740
+ return (c) => m(je, {
741
+ size: 12
742
+ }, {
743
+ default: () => {
744
+ var k, O;
745
+ return [!e.hideCancel && m(ne, {
746
+ size: "small",
747
+ onClick: c.cancel,
748
+ loading: (k = c.loadingObj) == null ? void 0 : k.cancel
749
+ }, Oe(i) ? i : {
750
+ default: () => [i]
751
+ }), !e.hideOk && m(ne, {
752
+ type: "primary",
753
+ size: "small",
754
+ onClick: c.ok,
755
+ loading: (O = c.loadingObj) == null ? void 0 : O.ok
756
+ }, Oe(a) ? a : {
757
+ default: () => [a]
758
+ })];
759
+ }
760
+ });
761
+ }, g = m(Ve, {
762
+ width: (e == null ? void 0 : e.width) ?? 368,
763
+ height: (e == null ? void 0 : e.height) ?? "auto",
764
+ modelValue: !0,
765
+ renderTo: e == null ? void 0 : e.renderTo,
766
+ center: e != null && e.top ? !1 : (e == null ? void 0 : e.center) ?? !0,
767
+ top: (e == null ? void 0 : e.top) ?? 0,
768
+ mask: (e == null ? void 0 : e.mask) ?? !0,
769
+ maskToClose: (e == null ? void 0 : e.maskToClose) ?? !0,
770
+ popupClass: e.popupClass,
771
+ onClose: s,
772
+ onBeforeCancel: l,
773
+ "onUpdate:modelValue": () => {
774
+ g.component.props.modelValue = !1;
775
+ },
776
+ // 等待动画完全结束后销毁vm
777
+ onClosed: n,
778
+ onOpened: () => {
779
+ }
780
+ }, {
781
+ title: o(),
782
+ default: d(),
783
+ footer: f()
784
+ });
785
+ A(g, t);
786
+ }, Pt = ["success", "warning", "error", "strong", "info"], zt = F("close-circle-fill");
787
+ function Ht(e, t, n, l, s, r) {
788
+ return C(), b("div", {
789
+ class: y(e.cls),
790
+ style: $(e.styles)
791
+ }, t[0] || (t[0] = [
792
+ v("svg", {
793
+ viewBox: "0 0 48 48",
794
+ fill: "none",
795
+ xmlns: "http://www.w3.org/2000/svg",
796
+ stroke: "currentColor",
797
+ "stroke-width": "4",
798
+ "stroke-linecap": "butt",
799
+ "stroke-linejoin": "miter",
800
+ filter: ""
801
+ }, [
802
+ v("path", {
803
+ "fill-rule": "evenodd",
804
+ "clip-rule": "evenodd",
805
+ d: "M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm4.955-27.771-4.95 4.95-4.95-4.95a1 1 0 0 0-1.414 0l-1.414 1.414a1 1 0 0 0 0 1.414l4.95 4.95-4.95 4.95a1 1 0 0 0 0 1.414l1.414 1.414a1 1 0 0 0 1.414 0l4.95-4.95 4.95 4.95a1 1 0 0 0 1.414 0l1.414-1.414a1 1 0 0 0 0-1.414l-4.95-4.95 4.95-4.95a1 1 0 0 0 0-1.414l-1.414-1.414a1 1 0 0 0-1.414 0Z",
806
+ fill: "currentColor",
807
+ stroke: "none"
808
+ })
809
+ ], -1)
810
+ ]), 6);
811
+ }
812
+ const me = /* @__PURE__ */ N(zt, [["render", Ht]]), Vt = F("check-circle-fill");
813
+ function jt(e, t, n, l, s, r) {
814
+ return C(), b("div", {
815
+ class: y(e.cls),
816
+ style: $(e.styles)
817
+ }, t[0] || (t[0] = [
818
+ v("svg", {
819
+ viewBox: "0 0 48 48",
820
+ fill: "none",
821
+ xmlns: "http://www.w3.org/2000/svg",
822
+ stroke: "currentColor",
823
+ "stroke-width": "4",
824
+ "stroke-linecap": "butt",
825
+ "stroke-linejoin": "miter",
826
+ filter: ""
827
+ }, [
828
+ v("path", {
829
+ "fill-rule": "evenodd",
830
+ "clip-rule": "evenodd",
831
+ d: "M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm10.207-24.379a1 1 0 0 0 0-1.414l-1.414-1.414a1 1 0 0 0-1.414 0L22 26.172l-4.878-4.88a1 1 0 0 0-1.415 0l-1.414 1.415a1 1 0 0 0 0 1.414l7 7a1 1 0 0 0 1.414 0l11.5-11.5Z",
832
+ fill: "currentColor",
833
+ stroke: "none"
834
+ })
835
+ ], -1)
836
+ ]), 6);
837
+ }
838
+ const ye = /* @__PURE__ */ N(Vt, [["render", jt]]), Rt = F("exclamation-circle-fill");
839
+ function Ft(e, t, n, l, s, r) {
840
+ return C(), b("div", {
841
+ class: y(e.cls),
842
+ style: $(e.styles)
843
+ }, t[0] || (t[0] = [
844
+ v("svg", {
845
+ viewBox: "0 0 48 48",
846
+ fill: "none",
847
+ xmlns: "http://www.w3.org/2000/svg",
848
+ stroke: "currentColor",
849
+ "stroke-width": "4",
850
+ "stroke-linecap": "butt",
851
+ "stroke-linejoin": "miter",
852
+ filter: ""
853
+ }, [
854
+ v("path", {
855
+ "fill-rule": "evenodd",
856
+ "clip-rule": "evenodd",
857
+ d: "M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm-2-11a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v2Zm4-18a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V15Z",
858
+ fill: "currentColor",
859
+ stroke: "none"
860
+ })
861
+ ], -1)
862
+ ]), 6);
863
+ }
864
+ const ge = /* @__PURE__ */ N(Rt, [["render", Ft]]), Ut = F("info-circle-fill");
865
+ function Wt(e, t, n, l, s, r) {
866
+ return C(), b("div", {
867
+ class: y(e.cls),
868
+ style: $(e.styles)
869
+ }, t[0] || (t[0] = [
870
+ v("svg", {
871
+ viewBox: "0 0 48 48",
872
+ fill: "none",
873
+ xmlns: "http://www.w3.org/2000/svg",
874
+ stroke: "currentColor",
875
+ "stroke-width": "4",
876
+ "stroke-linecap": "butt",
877
+ "stroke-linejoin": "miter",
878
+ filter: ""
879
+ }, [
880
+ v("path", {
881
+ "fill-rule": "evenodd",
882
+ "clip-rule": "evenodd",
883
+ d: "M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm2-30a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2Zm0 17h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1v-8a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v11Z",
884
+ fill: "currentColor",
885
+ stroke: "none"
886
+ })
887
+ ], -1)
888
+ ]), 6);
889
+ }
890
+ const Ce = /* @__PURE__ */ N(Ut, [["render", Wt]]), Zt = F("minus-circle-fill");
891
+ function Kt(e, t, n, l, s, r) {
892
+ return C(), b("div", {
893
+ class: y(e.cls),
894
+ style: $(e.styles)
895
+ }, t[0] || (t[0] = [
896
+ v("svg", {
897
+ viewBox: "0 0 48 48",
898
+ fill: "none",
899
+ xmlns: "http://www.w3.org/2000/svg",
900
+ stroke: "currentColor",
901
+ "stroke-width": "4",
902
+ "stroke-linecap": "butt",
903
+ "stroke-linejoin": "miter",
904
+ filter: ""
905
+ }, [
906
+ v("path", {
907
+ "fill-rule": "evenodd",
908
+ "clip-rule": "evenodd",
909
+ d: "M24 44c11.046 0 20-8.954 20-20S35.046 4 24 4 4 12.954 4 24s8.954 20 20 20Zm-7-22a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1H17Z",
910
+ fill: "currentColor",
911
+ stroke: "none"
912
+ })
913
+ ], -1)
914
+ ]), 6);
915
+ }
916
+ const ve = /* @__PURE__ */ N(Zt, [["render", Kt]]), Xt = R({
917
+ name: G("Message"),
918
+ components: {
919
+ CloseCircleFill: me,
920
+ CheckCircleFill: ye,
921
+ ExclamationCircleFill: ge,
922
+ InfoCircleFill: Ce,
923
+ MinusCircleFill: ve
924
+ },
925
+ props: {
926
+ id: {
927
+ type: String,
928
+ default: ""
929
+ },
930
+ message: {
931
+ type: [String, Number, Object],
932
+ default: ""
933
+ },
934
+ type: {
935
+ type: String,
936
+ default: "success"
937
+ },
938
+ duration: {
939
+ type: Number,
940
+ default: 1500
941
+ },
942
+ center: {
943
+ type: Boolean,
944
+ default: !1
945
+ },
946
+ onClose: {
947
+ type: Function,
948
+ default: () => {
949
+ }
950
+ },
951
+ offset: {
952
+ type: Number,
953
+ default: 20
954
+ },
955
+ zIndex: {
956
+ type: Number,
957
+ default: 0
958
+ },
959
+ showClose: {
960
+ type: Boolean,
961
+ default: !1
962
+ },
963
+ useHTML: Boolean,
964
+ popupClass: {
965
+ type: String,
966
+ default: void 0
967
+ }
968
+ },
969
+ emits: ["destroy"],
970
+ setup(e) {
971
+ const t = D("message"), n = p(() => [
972
+ t.block,
973
+ t.modifier(e.type),
974
+ e.center && t.modifier("center"),
975
+ e.showClose && !e.center && t.element("show-close"),
976
+ e.popupClass && e.popupClass
977
+ ]), l = X(!1);
978
+ let s = null;
979
+ const r = () => {
980
+ s = setTimeout(() => {
981
+ l.value = !1;
982
+ }, e.duration);
983
+ };
984
+ ue(() => {
985
+ l.value = !0, e.duration !== 0 && r();
986
+ }), Me(() => {
987
+ clearTimeout(s);
988
+ });
989
+ const { zIndex: u } = de("message", { runOnMounted: !0 }), o = p(() => ({
990
+ top: `${e.offset}px`,
991
+ zIndex: u.value
992
+ }));
993
+ return {
994
+ cn: t,
995
+ cls: n,
996
+ styles: o,
997
+ visible: l,
998
+ handleClose: () => {
999
+ l.value = !1;
1000
+ }
1001
+ };
1002
+ }
1003
+ }), Yt = ["innerHTML"], Gt = { key: 1 };
1004
+ function qt(e, t, n, l, s, r) {
1005
+ const u = z("CheckCircleFill"), o = z("ExclamationCircleFill"), d = z("MinusCircleFill"), f = z("CloseCircleFill"), g = z("InfoCircleFill");
1006
+ return C(), B(x, {
1007
+ name: "x-message-slide-top",
1008
+ onBeforeLeave: e.onClose,
1009
+ onAfterLeave: t[1] || (t[1] = (i) => e.$emit("destroy"))
1010
+ }, {
1011
+ default: ee(() => [
1012
+ H(v("div", {
1013
+ class: y(e.cls),
1014
+ style: $(e.styles)
1015
+ }, [
1016
+ e.$slots.icon ? S("", !0) : (C(), b("span", {
1017
+ key: 0,
1018
+ class: y([e.cn.element("icon"), e.cn.modifier(`icon-${e.type}`)])
1019
+ }, [
1020
+ M(e.$slots, "icon", {}, () => [
1021
+ e.type === "success" ? (C(), B(u, { key: 0 })) : e.type === "warning" ? (C(), B(o, { key: 1 })) : e.type === "strong" ? (C(), B(d, { key: 2 })) : e.type === "error" ? (C(), B(f, { key: 3 })) : e.type === "info" ? (C(), B(g, { key: 4 })) : S("", !0)
1022
+ ])
1023
+ ], 2)),
1024
+ M(e.$slots, "default", {}, () => [
1025
+ e.useHTML ? (C(), b("span", {
1026
+ key: 0,
1027
+ innerHTML: e.message
1028
+ }, null, 8, Yt)) : (C(), b("span", Gt, te(e.message), 1)),
1029
+ e.showClose ? (C(), b("span", {
1030
+ key: 2,
1031
+ class: y([e.cn.element("close-icon")]),
1032
+ onClick: t[0] || (t[0] = (...i) => e.handleClose && e.handleClose(...i))
1033
+ }, null, 2)) : S("", !0)
1034
+ ])
1035
+ ], 6), [
1036
+ [V, e.visible]
1037
+ ])
1038
+ ]),
1039
+ _: 3
1040
+ }, 8, ["onBeforeLeave"]);
1041
+ }
1042
+ const Jt = /* @__PURE__ */ N(Xt, [["render", qt]]), se = /* @__PURE__ */ new WeakMap(), ae = (e) => {
1043
+ (typeof e == "string" || w(e)) && (e = {
1044
+ message: e
1045
+ });
1046
+ const t = fe(e.renderTo || "body");
1047
+ se.has(t) || se.set(t, []);
1048
+ const n = se.get(t);
1049
+ let l = e.offset || 20;
1050
+ n.forEach((i) => {
1051
+ var a;
1052
+ l += ((a = i.el) == null ? void 0 : a.offsetHeight) + 20;
1053
+ });
1054
+ const s = e.onClose;
1055
+ let r = {};
1056
+ r = { ...e, onClose: () => {
1057
+ var c;
1058
+ const i = n.findIndex((k) => k === d);
1059
+ if (i < 0) return;
1060
+ const a = ((c = d.el) == null ? void 0 : c.offsetHeight) + 20;
1061
+ n.slice(i + 1).forEach((k) => {
1062
+ var I;
1063
+ const O = (I = k.component) == null ? void 0 : I.props.offset;
1064
+ k.component.props.offset = O - a;
1065
+ }), n.splice(i, 1), s && s(d);
1066
+ }, onDestroy: () => {
1067
+ A(null, f);
1068
+ }, offset: l };
1069
+ const d = m(
1070
+ Jt,
1071
+ r,
1072
+ E(r.message) || w(r.message) ? {
1073
+ default: E(r.message) ? r.message : () => r.message
1074
+ } : null
1075
+ ), f = document.createElement("div");
1076
+ return A(d, f), t.tagName === "BODY" ? d.el.style.position = "fixed" : (t.style.position = "relative", d.el.style.position = "absolute"), t.appendChild(f.firstElementChild), n.push(d), {
1077
+ close: () => {
1078
+ d.component.proxy.handleClose();
1079
+ }
1080
+ };
1081
+ }, Qt = () => {
1082
+ Pt.forEach((e) => {
1083
+ ae[e] = (t) => De(t) ? ae({
1084
+ type: e,
1085
+ ...t
1086
+ }) : ae({
1087
+ message: t,
1088
+ type: e
1089
+ });
1090
+ });
1091
+ };
1092
+ Qt();
1093
+ const _t = ["info", "success", "warning", "strong", "error"];
1094
+ function $e(e) {
1095
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !w(e);
1096
+ }
1097
+ const ie = D("message-box"), Ne = (e) => {
1098
+ const t = document.createElement("div"), n = () => {
1099
+ A(null, t);
1100
+ }, l = (a) => {
1101
+ if (a === "cancel")
1102
+ return e.beforeOnCancel ? e.beforeOnCancel() : !0;
1103
+ if (a === "ok")
1104
+ return e.beforeOnOk ? e.beforeOnOk() : !0;
1105
+ }, s = (a, c) => {
1106
+ a === "cancel" && e.onCancel && e.onCancel(c), a === "ok" && e.onOk && e.onOk(c);
1107
+ }, r = (a) => {
1108
+ let c;
1109
+ switch (a) {
1110
+ case "warning":
1111
+ c = m(ge, {
1112
+ size: "22px",
1113
+ color: "#f6c64b"
1114
+ }, null);
1115
+ break;
1116
+ case "strong":
1117
+ c = m(ve, {
1118
+ size: "22px",
1119
+ color: "#ff7125"
1120
+ }, null);
1121
+ break;
1122
+ case "error":
1123
+ c = m(me, {
1124
+ size: "22px",
1125
+ color: "#e24f48"
1126
+ }, null);
1127
+ break;
1128
+ case "success":
1129
+ c = m(ye, {
1130
+ size: "22px",
1131
+ color: "#68d1ab"
1132
+ }, null);
1133
+ break;
1134
+ case "info":
1135
+ c = m(Ce, {
1136
+ size: "22px",
1137
+ color: "#2355f5"
1138
+ }, null);
1139
+ break;
1140
+ }
1141
+ return m("div", {
1142
+ className: ie.element("icon")
1143
+ }, [c]);
1144
+ }, u = (a) => {
1145
+ if (w(a)) return a;
1146
+ if (E(a)) {
1147
+ const c = a();
1148
+ return w(c) ? c : null;
1149
+ }
1150
+ return m("div", {
1151
+ className: ie.element("title")
1152
+ }, [T(" "), a, T(" ")]);
1153
+ }, o = (a) => {
1154
+ if (w(a)) return a;
1155
+ if (E(a)) {
1156
+ const c = a();
1157
+ return w(c) ? c : null;
1158
+ }
1159
+ return m("div", {
1160
+ className: ie.element("content")
1161
+ }, [T(" "), e.content, T(" ")]);
1162
+ }, d = () => () => m(Y, null, [r(e.type || "success"), e.title && u(e.title)]), f = () => () => m(Y, null, [e.content && o(e.content)]), g = () => {
1163
+ if (w(e.footer) || E(e.footer))
1164
+ return e.footer;
1165
+ const a = (e == null ? void 0 : e.cancelText) || "取消", c = (e == null ? void 0 : e.okText) || "确认";
1166
+ return (k) => m(je, {
1167
+ size: 12
1168
+ }, {
1169
+ default: () => {
1170
+ var O, I;
1171
+ return [!e.hideCancel && m(ne, {
1172
+ size: "small",
1173
+ onClick: k.cancel,
1174
+ loading: (O = k.loadingObj) == null ? void 0 : O.cancel
1175
+ }, $e(a) ? a : {
1176
+ default: () => [a]
1177
+ }), !e.hideOk && m(ne, {
1178
+ type: "primary",
1179
+ size: "small",
1180
+ onClick: k.ok,
1181
+ loading: (I = k.loadingObj) == null ? void 0 : I.ok
1182
+ }, $e(c) ? c : {
1183
+ default: () => [c]
1184
+ })];
1185
+ }
1186
+ });
1187
+ }, i = m(Ve, {
1188
+ messageBox: !0,
1189
+ width: (e == null ? void 0 : e.width) ?? 358,
1190
+ height: (e == null ? void 0 : e.height) ?? "auto",
1191
+ modelValue: !0,
1192
+ renderTo: e == null ? void 0 : e.renderTo,
1193
+ center: e != null && e.top ? !1 : (e == null ? void 0 : e.center) ?? !0,
1194
+ top: (e == null ? void 0 : e.top) ?? 0,
1195
+ mask: (e == null ? void 0 : e.mask) ?? !0,
1196
+ maskToClose: (e == null ? void 0 : e.maskToClose) ?? !0,
1197
+ popupClass: e.popupClass,
1198
+ onClose: s,
1199
+ onBeforeCancel: l,
1200
+ "onUpdate:modelValue": () => {
1201
+ i.component.props.modelValue = !1;
1202
+ },
1203
+ // 等待动画完全结束后销毁vm
1204
+ onClosed: n,
1205
+ onOpened: () => {
1206
+ }
1207
+ }, {
1208
+ title: d(),
1209
+ default: f(),
1210
+ footer: g()
1211
+ });
1212
+ A(i, t);
1213
+ }, xt = () => {
1214
+ _t.forEach((e) => {
1215
+ Ne[e] = (t, n) => {
1216
+ const l = [], s = [];
1217
+ let r = () => !0, u = () => !0;
1218
+ return setTimeout(() => {
1219
+ Ne({
1220
+ title: t,
1221
+ content: n,
1222
+ type: e,
1223
+ beforeOnCancel: u,
1224
+ beforeOnOk: r,
1225
+ onOk: () => {
1226
+ l.forEach((o) => E(o) && o());
1227
+ },
1228
+ onCancel: () => {
1229
+ s.forEach((o) => E(o) && o());
1230
+ }
1231
+ });
1232
+ }, 0), {
1233
+ ok(...o) {
1234
+ return o.length === 1 && l.push(o[0]), o.length === 2 && (r = o[0], l.push(o[1])), this;
1235
+ },
1236
+ cancel(...o) {
1237
+ return o.length === 1 && s.push(o[0]), o.length === 2 && (u = o[0], s.push(o[1])), this;
1238
+ }
1239
+ };
1240
+ };
1241
+ });
1242
+ };
1243
+ xt();
1244
+ const en = {
1245
+ position: {
1246
+ type: String,
1247
+ default: "top-right"
1248
+ },
1249
+ offset: {
1250
+ type: Number,
1251
+ default: 0
1252
+ },
1253
+ title: {
1254
+ type: String,
1255
+ default: ""
1256
+ },
1257
+ type: {
1258
+ type: String,
1259
+ default: "info"
1260
+ },
1261
+ message: {
1262
+ type: String,
1263
+ default: void 0
1264
+ },
1265
+ duration: {
1266
+ type: Number,
1267
+ default: 3e3
1268
+ },
1269
+ showClose: {
1270
+ type: Boolean,
1271
+ default: !0
1272
+ },
1273
+ onClose: {
1274
+ type: Function,
1275
+ default: () => {
1276
+ }
1277
+ },
1278
+ renderToBody: {
1279
+ type: Boolean,
1280
+ default: !1
1281
+ }
1282
+ }, tn = R({
1283
+ name: G("Notification"),
1284
+ props: en,
1285
+ emits: ["close", "destroy"],
1286
+ setup(e) {
1287
+ const t = D("notification"), n = t.block, l = p(() => [n, t.modifier(r.value.ver)]), { zIndex: s } = de("message", { runOnMounted: !0 }), r = p(() => {
1288
+ const c = e.position.split("-");
1289
+ return {
1290
+ hor: c[1],
1291
+ ver: c[0]
1292
+ };
1293
+ }), u = p(() => `x-notification-slide-${r.value.hor}`), o = p(() => {
1294
+ const c = {};
1295
+ return c.position = e.renderToBody ? "fixed" : "absolute", c.zIndex = s.value, c[r.value.hor] = "20px", c[r.value.ver] = `${e.offset}px`, c;
1296
+ }), d = X(!1);
1297
+ let f = 0;
1298
+ const g = () => {
1299
+ setTimeout(() => {
1300
+ d.value = !1;
1301
+ }, e.duration);
1302
+ }, i = p(() => e.type === "info" ? Ce : e.type === "warning" ? ge : e.type === "strong" ? ve : e.type === "success" ? ye : e.type === "error" ? me : ""), a = () => {
1303
+ d.value = !1;
1304
+ };
1305
+ return ue(() => {
1306
+ e.duration !== 0 && g(), d.value = !0;
1307
+ }), Me(() => {
1308
+ clearTimeout(f);
1309
+ }), {
1310
+ ns: n,
1311
+ cn: t,
1312
+ cls: l,
1313
+ animationClsName: u,
1314
+ positionStyle: o,
1315
+ visible: d,
1316
+ positionPropMap: r,
1317
+ currentIcon: i,
1318
+ handleClose: a
1319
+ };
1320
+ }
1321
+ });
1322
+ function nn(e, t, n, l, s, r) {
1323
+ return C(), B(x, {
1324
+ name: e.animationClsName,
1325
+ onBeforeLeave: t[1] || (t[1] = (u) => e.$emit("close")),
1326
+ onAfterLeave: t[2] || (t[2] = (u) => e.$emit("destroy"))
1327
+ }, {
1328
+ default: ee(() => [
1329
+ H(v("div", {
1330
+ class: y(e.cls),
1331
+ style: $(e.positionStyle)
1332
+ }, [
1333
+ v("div", {
1334
+ class: y([e.cn.element("header")])
1335
+ }, [
1336
+ v("div", {
1337
+ class: y([e.cn.element("icon"), e.cn.modifier(`icon-${e.type}`)])
1338
+ }, [
1339
+ (C(), B(et(e.currentIcon)))
1340
+ ], 2),
1341
+ v("div", null, [
1342
+ v("div", {
1343
+ class: y([e.cn.element("title")])
1344
+ }, te(e.title), 3),
1345
+ v("div", {
1346
+ class: y([e.cn.element("message")])
1347
+ }, [
1348
+ M(e.$slots, "default", {}, () => [
1349
+ T(te(e.message), 1)
1350
+ ])
1351
+ ], 2)
1352
+ ])
1353
+ ], 2),
1354
+ e.showClose ? (C(), b("span", {
1355
+ key: 0,
1356
+ class: y([e.cn.element("close-icon")]),
1357
+ onClick: t[0] || (t[0] = Se((...u) => e.handleClose && e.handleClose(...u), ["self"]))
1358
+ }, null, 2)) : S("", !0)
1359
+ ], 6), [
1360
+ [V, e.visible]
1361
+ ])
1362
+ ]),
1363
+ _: 3
1364
+ }, 8, ["name"]);
1365
+ }
1366
+ const ln = /* @__PURE__ */ N(tn, [["render", nn]]), W = /* @__PURE__ */ new WeakMap(), an = (e) => {
1367
+ const t = fe(e.renderTo || "body"), n = document.createElement("div");
1368
+ W.get(t) || W.set(t, {}), W.get(t)[e.position] || (W.get(t)[e.position] = []);
1369
+ const l = W.get(t)[e.position];
1370
+ let s = e.offset || 20;
1371
+ l.forEach((g) => {
1372
+ var i;
1373
+ s += ((i = g.el) == null ? void 0 : i.offsetHeight) + 20;
1374
+ });
1375
+ const r = t.tagName === "BODY";
1376
+ r || (t.style.position = "relative", t.style.overflowX = "hidden");
1377
+ const u = e.onClose, o = () => {
1378
+ var a;
1379
+ const g = l.findIndex((c) => c === f);
1380
+ if (g < 0) return;
1381
+ const i = ((a = f.el) == null ? void 0 : a.offsetHeight) + 20;
1382
+ l.slice(g + 1).forEach((c) => {
1383
+ var O;
1384
+ const k = (O = c.component) == null ? void 0 : O.props.offset;
1385
+ c.component.props.offset = k - i;
1386
+ }), l.splice(g, 1), u && u(f);
1387
+ }, d = () => {
1388
+ A(null, n);
1389
+ }, f = m(
1390
+ ln,
1391
+ {
1392
+ message: e.message,
1393
+ title: e.title,
1394
+ type: e.type,
1395
+ offset: s,
1396
+ renderToBody: r,
1397
+ position: e.position,
1398
+ duration: e.duration ?? 3e3,
1399
+ showClose: e.showClose ?? !0,
1400
+ onClose: o,
1401
+ onDestroy: d
1402
+ },
1403
+ E(e.message) || w(e.message) ? {
1404
+ default: E(e.message) ? e.message : () => e.message
1405
+ } : null
1406
+ );
1407
+ A(f, n), l.push(f), t == null || t.appendChild(n.firstChild);
1408
+ };
1409
+ export {
1410
+ sn as Dialog,
1411
+ ae as Message,
1412
+ Ne as MessageBox,
1413
+ an as Notification
1414
+ };