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

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