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
package/x-next/ui.js DELETED
@@ -1,1357 +0,0 @@
1
- var Ze = Object.defineProperty;
2
- var Ke = (e, t, n) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var D = (e, t, n) => Ke(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { ref as K, watch as ae, onMounted as ie, onBeforeUnmount as we, readonly as Xe, defineComponent as V, computed as k, reactive as Oe, openBlock as g, createBlock as N, Teleport as Ye, withDirectives as P, createElementBlock as p, normalizeClass as m, normalizeStyle as O, createVNode as R, Transition as Q, withCtx as x, vShow as z, createCommentVNode as B, createElementVNode as C, withModifiers as $e, renderSlot as T, toDisplayString as _, getCurrentInstance as Ge, resolveComponent as I, Comment as qe, Fragment as Je, render as M, isVNode as w, onUnmounted as Ne, resolveDynamicComponent as Qe, createTextVNode as xe } from "vue";
5
- const _e = "X", et = "x", Be = (e) => e ? et + "-" + e : e || "", X = (e) => _e + e, L = (e) => {
6
- const t = Be(e);
7
- return {
8
- block: t,
9
- element: (r) => `${t}--${r}`,
10
- modifier: (r) => `${t}-${r}`,
11
- is: (r) => `${t}-is-${r}`
12
- };
13
- }, tt = ["px", "%", "vh", "vw", "calc"], pe = (e, t = "px") => {
14
- if (e === void 0)
15
- return "";
16
- const n = String(e);
17
- return tt.some((l) => n.includes(l)) ? n : n + t;
18
- }, Y = Object.prototype.toString;
19
- function Te(e) {
20
- return Y.call(e) === "[object Array]";
21
- }
22
- function Se(e) {
23
- return Y.call(e) === "[object Object]";
24
- }
25
- const Me = (e) => Y.call(e) === "[object Promise]";
26
- function Le(e) {
27
- return Y.call(e) === "[object String]";
28
- }
29
- function nt(e) {
30
- return Y.call(e) === "[object Number]" && e === e;
31
- }
32
- function b(e) {
33
- return typeof e == "function";
34
- }
35
- function te() {
36
- return typeof window < "u";
37
- }
38
- const lt = 1e3, rt = 3e3, ot = 1;
39
- class st {
40
- constructor() {
41
- D(this, "popupStack", {
42
- popup: /* @__PURE__ */ new Set(),
43
- dialog: /* @__PURE__ */ new Set(),
44
- message: /* @__PURE__ */ new Set()
45
- });
46
- D(this, "getNextZIndex", (t) => (t === "message" ? Array.from(this.popupStack.message).pop() || rt : Array.from(this.popupStack.popup).pop() || lt) + ot);
47
- D(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
- D(this, "delete", (t, n) => {
52
- this.popupStack[n].delete(t), n === "dialog" && this.popupStack.popup.delete(t);
53
- });
54
- D(this, "isLastDialog", (t) => this.popupStack.dialog.size > 1 ? t === Array.from(this.popupStack.dialog).pop() : !0);
55
- }
56
- }
57
- const le = new st();
58
- function ce(e, {
59
- visible: t,
60
- runOnMounted: n
61
- } = {}) {
62
- const l = K(0), s = () => {
63
- l.value = le.add(e);
64
- }, r = () => {
65
- le.delete(l.value, e);
66
- }, u = () => e === "dialog" ? le.isLastDialog(l.value) : !1;
67
- return ae(
68
- () => t == null ? void 0 : t.value,
69
- (o) => {
70
- o ? s() : r();
71
- },
72
- {
73
- immediate: !0
74
- }
75
- ), n && (ie(() => {
76
- s();
77
- }), we(() => {
78
- r();
79
- })), {
80
- zIndex: Xe(l),
81
- open: s,
82
- close: r,
83
- isLastDialog: u
84
- };
85
- }
86
- const Ae = (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
- }), Re = () => {
90
- }, at = (e, t) => {
91
- var n;
92
- if (te)
93
- return (n = document.querySelector(e)) !== null && n !== void 0 ? n : void 0;
94
- }, it = (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
- }, ct = (e) => e.tagName === "BODY" ? document.documentElement.scrollHeight > window.innerHeight : e.scrollHeight > e.offsetHeight, ut = (e, t) => {
100
- var n;
101
- if (!te || !e || !t)
102
- return "";
103
- let l = Ae(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
- }, W = (e, t, n) => {
115
- if (!(!e || !t))
116
- if (Se(t))
117
- Object.entries(t).forEach(([l, s]) => W(e, l, s));
118
- else {
119
- const l = Ae(t);
120
- e.style[l] = n;
121
- }
122
- }, ue = (e, t) => {
123
- if (Le(e)) {
124
- const n = e[0] === "#" ? `[id='${e.slice(1)}']` : e;
125
- return at(n);
126
- }
127
- return e;
128
- }, dt = te ? (e, t, n, l = !1) => {
129
- e.addEventListener(t, n, l);
130
- } : Re, ft = te ? (e, t, n, l = !1) => {
131
- e.removeEventListener(t, n, l);
132
- } : Re, mt = (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 = it(o);
142
- if (d > 0 || ct(o)) {
143
- l.overflow = o.style.overflow, l.width = o.style.width;
144
- let f = 0;
145
- s(o) && (f = o.getBoundingClientRect().left || 0), W(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
- W(o, {
156
- overflow: l.overflow,
157
- width: l.width
158
- }), n = !1;
159
- }
160
- };
161
- return ae(
162
- () => t == null ? void 0 : t.value,
163
- (o) => {
164
- e.value && !s(e.value) && (o && W(o, {
165
- position: "absolute"
166
- }), ut(e.value, "position") === "static" && W(e.value, { position: "relative" }));
167
- }
168
- ), {
169
- setOverflowHidden: r,
170
- resetOverflow: u
171
- };
172
- }, yt = {
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
- }, Z = (e) => e;
183
- var H;
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
- })(H || (H = {}));
187
- const gt = (e) => !!(e && e.shapeFlag & H.ELEMENT), Ct = (e, t) => !!(e && e.shapeFlag & H.COMPONENT), vt = (e, t) => !!(e && e.shapeFlag & 8), ht = (e, t) => !!(e && e.shapeFlag & H.ARRAY_CHILDREN), kt = (e, t) => !!(e && e.shapeFlag & H.SLOTS_CHILDREN), J = (e, t = !1) => {
188
- var n, l;
189
- const s = [];
190
- for (const r of e ?? [])
191
- gt(r) || Ct(r) || t && vt(r, r.children) ? s.push(r) : ht(r, r.children) ? s.push(...J(r.children, t)) : kt(r, r.children) ? s.push(...J((l = (n = r.children).default) === null || l === void 0 ? void 0 : l.call(n), t)) : Te(r) && s.push(...J(r, t));
192
- return s;
193
- }, pt = {
194
- renderTo: {
195
- type: Z([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
- }, Et = ["width", "minWidth", "height", "minHeight"], bt = V({
280
- name: X("Dialog"),
281
- inheritAttrs: !1,
282
- props: pt,
283
- emits: ["closed", "close", "open", "opened", "update:modelValue"],
284
- setup(e, { emit: t }) {
285
- const n = L("dialog"), l = n.block, s = L("message-box"), r = s.block, u = k(() => [
286
- l,
287
- e.messageBox && "is-message-box",
288
- e.popupClass && e.popupClass
289
- ]), o = k(() => ue(e.renderTo)), d = K(), f = k(() => e.disabled || !o.value), y = k(() => ({
290
- zIndex: E.value
291
- })), a = k(() => {
292
- const v = {};
293
- return e.fullscreen || (!e.center && e.top && (v.top = pe(e.top)), Et.forEach((S) => {
294
- e[S] && (v[S] = pe(e[S]));
295
- })), v;
296
- }), i = K(!1), c = k(() => e.modelValue), h = k(() => c.value || i.value), { zIndex: E, isLastDialog: A } = ce("dialog", {
297
- visible: c
298
- }), { setOverflowHidden: Pe, resetOverflow: Ce } = mt(o, d), ve = (v, S) => {
299
- t("update:modelValue", !1), t("close", e.messageBox ? v : void 0, e.messageBox ? S : void 0);
300
- }, ze = () => {
301
- i.value = !1, Ce(), t("closed");
302
- }, He = () => {
303
- t("opened");
304
- }, G = Oe({
305
- ok: !1,
306
- cancel: !1
307
- }), j = (v, S) => {
308
- let q = !0;
309
- if (G[v] = !0, b(e.onBeforeCancel) && (q = e.onBeforeCancel(v) ?? !1), Me(q)) {
310
- q.then((We) => {
311
- G[v] = !1, We && ve(v, S);
312
- });
313
- return;
314
- }
315
- G[v] = !1, q && ve(v, S);
316
- }, Ve = () => {
317
- e.maskToClose && e.mask && j("cancel");
318
- }, Fe = (v) => {
319
- j("cancel", v);
320
- }, je = (v) => {
321
- j("ok", v);
322
- };
323
- let ne = !1;
324
- const he = (v) => {
325
- e.escToClose && v.key === yt.ESC && A() && j("cancel");
326
- }, Ue = () => {
327
- e.escToClose && !ne && (ne = !0, dt(document.documentElement, "keydown", he));
328
- }, ke = () => {
329
- ne = !1, ft(document.documentElement, "keydown", he);
330
- };
331
- return we(() => {
332
- Ce(), ke();
333
- }), ae(
334
- () => c.value,
335
- (v) => {
336
- v ? (t("open"), Pe(), i.value = !0, Ue()) : ke();
337
- },
338
- { immediate: !0 }
339
- ), {
340
- cls: u,
341
- ns: l,
342
- cn: n,
343
- cnOMB: s,
344
- messageBoxNs: r,
345
- containerStyle: a,
346
- dialogStyle: y,
347
- dialogRef: d,
348
- teleportContainer: o,
349
- teleportDisabled: f,
350
- modelVisible: c,
351
- mergeVisible: h,
352
- interceptClose: j,
353
- afterLeave: ze,
354
- afterEnter: He,
355
- handleMaskClick: Ve,
356
- handleCancel: Fe,
357
- handleOk: je,
358
- loadingObj: G
359
- };
360
- }
361
- }), $ = (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 wt(e, t, n, l, s, r) {
368
- return g(), N(Ye, {
369
- to: e.teleportContainer,
370
- disabled: e.teleportDisabled
371
- }, [
372
- !e.destroyOnClosed || e.mergeVisible ? P((g(), p("div", {
373
- key: 0,
374
- ref: "dialogRef",
375
- class: m(e.cls),
376
- style: O(e.dialogStyle)
377
- }, [
378
- R(Q, {
379
- name: "x-fade-in-standard",
380
- appear: ""
381
- }, {
382
- default: x(() => [
383
- e.mask ? P((g(), p("div", {
384
- key: 0,
385
- class: m([e.cn.element("mask")])
386
- }, null, 2)), [
387
- [z, e.modelVisible]
388
- ]) : B("", !0)
389
- ]),
390
- _: 1
391
- }),
392
- C("div", {
393
- class: m([e.cn.element("wrapper"), { "is-center": e.center }]),
394
- onClick: t[1] || (t[1] = $e((...u) => e.handleMaskClick && e.handleMaskClick(...u), ["self"]))
395
- }, [
396
- R(Q, {
397
- name: "x-zoom-in",
398
- appear: "",
399
- onAfterEnter: e.afterEnter,
400
- onAfterLeave: e.afterLeave
401
- }, {
402
- default: x(() => [
403
- P(C("div", {
404
- class: m([e.cn.element("container"), { "is-fullscreen": e.fullscreen }]),
405
- style: O(e.containerStyle)
406
- }, [
407
- C("div", {
408
- class: m([
409
- e.messageBox ? e.cnOMB.element("header") : e.cn.element("header"),
410
- e.showHeaderBottomLine && "is-bottom-line"
411
- ])
412
- }, [
413
- T(e.$slots, "title", {}, () => [
414
- C("div", {
415
- class: m([e.cn.element("header-title")])
416
- }, _(e.title), 3)
417
- ])
418
- ], 2),
419
- C("div", {
420
- class: m([e.messageBox ? e.cnOMB.element("body") : e.cn.element("body")])
421
- }, [
422
- T(e.$slots, "default")
423
- ], 2),
424
- C("div", {
425
- class: m([e.messageBox ? e.cnOMB.element("footer") : e.cn.element("footer")])
426
- }, [
427
- T(e.$slots, "footer", {
428
- cancel: e.handleCancel,
429
- ok: e.handleOk,
430
- loadingObj: e.loadingObj
431
- })
432
- ], 2),
433
- e.showClose ? (g(), p("span", {
434
- key: 0,
435
- class: m([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)) : B("", !0)
438
- ], 6), [
439
- [z, e.modelVisible]
440
- ])
441
- ]),
442
- _: 3
443
- }, 8, ["onAfterEnter", "onAfterLeave"])
444
- ], 2)
445
- ], 6)), [
446
- [z, e.mergeVisible]
447
- ]) : B("", !0)
448
- ], 8, ["to", "disabled"]);
449
- }
450
- const De = /* @__PURE__ */ $(bt, [["render", wt]]), Ot = {
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: Z(String),
464
- default: void 0
465
- },
466
- link: {
467
- type: Boolean,
468
- default: !1
469
- },
470
- type: {
471
- type: Z(String),
472
- default: void 0
473
- },
474
- status: {
475
- type: Z(String),
476
- default: void 0
477
- },
478
- plain: {
479
- type: Boolean,
480
- default: !1
481
- },
482
- size: {
483
- type: Z(String),
484
- default: "medium"
485
- },
486
- border: {
487
- type: Boolean,
488
- default: !0
489
- }
490
- }, $t = (e) => Le(e) ? e.split("-").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("") : "", Nt = (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 V({
498
- name: Be(`Icon${$t(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 = k(() => {
523
- const r = {};
524
- return t.size && (r.fontSize = Nt(t.size)), t.rotate && (r.transform = `rotate(${t.rotate}deg)`), t.color && (r.color = t.color), r;
525
- });
526
- return {
527
- cls: k(() => [
528
- n,
529
- {
530
- [`${n}-loading`]: t.spin
531
- }
532
- ]),
533
- styles: l
534
- };
535
- }
536
- });
537
- }
538
- const Bt = F("animation-loading");
539
- function Tt(e, t, n, l, s, r) {
540
- return g(), p("div", {
541
- class: m(e.cls),
542
- style: O(e.styles)
543
- }, t[0] || (t[0] = [
544
- C("svg", {
545
- viewBox: "0 0 50 50",
546
- class: "icon-loading-svg"
547
- }, [
548
- C("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 St = /* @__PURE__ */ $(Bt, [["render", Tt], ["__scopeId", "data-v-62d46830"]]), Mt = V({
560
- name: X("Button"),
561
- components: {
562
- AnimationLoading: St
563
- },
564
- props: Ot,
565
- emits: ["click"],
566
- setup(e) {
567
- const t = Oe({
568
- // 点击
569
- clicked: !1,
570
- // 防抖
571
- isDebounce: !1
572
- }), n = L("button"), l = k(() => [
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 = k(() => e.loading || t.clicked || t.isDebounce), u = Ge(), o = (f, y) => {
589
- const a = f(y);
590
- Me(a) && (t.clicked = !0, a.finally(() => {
591
- t.clicked = !1;
592
- }));
593
- };
594
- return {
595
- cn: n,
596
- cls: l,
597
- handleClick: async (f) => {
598
- var a, i, c, h;
599
- if ((i = (a = f.target).blur) == null || i.call(a), r.value) return;
600
- s();
601
- const y = (h = (c = u == null ? void 0 : u.vnode) == null ? void 0 : c.props) == null ? void 0 : h.onClick;
602
- Te(y) ? y.forEach((E) => o(E, f)) : b(y) && o(y, f);
603
- },
604
- isLoading: r
605
- };
606
- }
607
- }), Lt = ["disabled"];
608
- function At(e, t, n, l, s, r) {
609
- const u = I("AnimationLoading");
610
- return g(), p("button", {
611
- class: m(e.cls),
612
- type: "button",
613
- disabled: e.disabled,
614
- onClick: t[0] || (t[0] = (...o) => e.handleClick && e.handleClick(...o))
615
- }, [
616
- P(C("span", {
617
- class: m([e.cn.element("loading")])
618
- }, [
619
- R(u)
620
- ], 2), [
621
- [z, e.isLoading]
622
- ]),
623
- e.$slots.prefix ? (g(), p("span", {
624
- key: 0,
625
- class: m([e.cn.element("prefix")])
626
- }, [
627
- T(e.$slots, "prefix")
628
- ], 2)) : B("", !0),
629
- T(e.$slots, "default"),
630
- e.$slots.suffix ? (g(), p("span", {
631
- key: 1,
632
- class: m([e.cn.element("suffix")])
633
- }, [
634
- T(e.$slots, "suffix")
635
- ], 2)) : B("", !0)
636
- ], 10, Lt);
637
- }
638
- const ee = /* @__PURE__ */ $(Mt, [["render", At]]), Ie = V({
639
- name: X("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, { slots: t }) {
659
- const n = L("space"), l = k(() => [
660
- n.block,
661
- n.element(e.direction),
662
- e.fill && "is-fill",
663
- n.element(`${e.direction}-${e.align}`)
664
- ]);
665
- function s(u) {
666
- if (nt(u))
667
- return u;
668
- switch (u) {
669
- case "mini":
670
- return 4;
671
- case "small":
672
- return 8;
673
- case "medium":
674
- return 16;
675
- case "large":
676
- return 24;
677
- default:
678
- return 8;
679
- }
680
- }
681
- const r = (u) => {
682
- const o = {};
683
- if (u) return o;
684
- const d = `${s(e.size)}px`, f = `${s(e.size)}px`;
685
- return e.direction === "horizontal" && (o.marginRight = d), e.direction === "vertical" && (o.marginBottom = f), o;
686
- };
687
- return () => {
688
- var o;
689
- const u = J((o = t.default) == null ? void 0 : o.call(t), !0).filter(
690
- (d) => d.type !== qe
691
- );
692
- return /* @__PURE__ */ React.createElement("div", { class: [l.value] }, u.map((d, f) => {
693
- var a;
694
- const y = t.split && f > 0;
695
- return /* @__PURE__ */ React.createElement(Je, { key: `space-item-${f}` }, y && /* @__PURE__ */ React.createElement("div", { className: n.element("split"), style: r(!1) }, (a = t.split) == null ? void 0 : a.call(t)), /* @__PURE__ */ React.createElement(
696
- "div",
697
- {
698
- className: n.element("item"),
699
- style: r(f === u.length - 1)
700
- },
701
- d
702
- ));
703
- }));
704
- };
705
- }
706
- }), Ee = L("dialog"), rn = (e) => {
707
- const t = document.createElement("div"), n = () => {
708
- M(null, t);
709
- }, l = (a) => {
710
- if (a === "cancel")
711
- return e.beforeOnCancel ? e.beforeOnCancel() : !0;
712
- if (a === "ok")
713
- return e.beforeOnOk ? e.beforeOnOk() : !0;
714
- }, s = (a, i) => {
715
- a === "cancel" && e.onCancel && e.onCancel(i), a === "ok" && e.onOk && e.onOk(i);
716
- }, r = (a) => {
717
- if (w(a)) return a;
718
- if (b(a)) {
719
- const i = a();
720
- return w(i) ? i : null;
721
- }
722
- return /* @__PURE__ */ React.createElement("div", { className: Ee.element("header-title") }, " ", a, " ");
723
- }, u = (a) => {
724
- if (w(a)) return a;
725
- if (b(a)) {
726
- const i = a();
727
- return w(i) ? i : null;
728
- }
729
- return /* @__PURE__ */ React.createElement("div", { className: Ee.element("content") }, " ", e.content, " ");
730
- }, o = () => () => /* @__PURE__ */ React.createElement(React.Fragment, null, e.title && r(e.title)), d = () => () => /* @__PURE__ */ React.createElement(React.Fragment, null, e.content && u(e.content)), f = () => {
731
- if (w(e.footer) || b(e.footer))
732
- return e.footer;
733
- const a = (e == null ? void 0 : e.cancelText) || "取消", i = (e == null ? void 0 : e.okText) || "确认";
734
- return (c) => {
735
- var h, E;
736
- return /* @__PURE__ */ React.createElement(Ie, { size: 12 }, !e.hideCancel && /* @__PURE__ */ React.createElement(ee, { size: "small", onClick: c.cancel, loading: (h = c.loadingObj) == null ? void 0 : h.cancel }, a), !e.hideOk && /* @__PURE__ */ React.createElement(ee, { type: "primary", size: "small", onClick: c.ok, loading: (E = c.loadingObj) == null ? void 0 : E.ok }, i));
737
- };
738
- }, y = R(
739
- De,
740
- {
741
- width: (e == null ? void 0 : e.width) ?? 368,
742
- height: (e == null ? void 0 : e.height) ?? "auto",
743
- modelValue: !0,
744
- renderTo: e == null ? void 0 : e.renderTo,
745
- center: e != null && e.top ? !1 : (e == null ? void 0 : e.center) ?? !0,
746
- top: (e == null ? void 0 : e.top) ?? 0,
747
- mask: (e == null ? void 0 : e.mask) ?? !0,
748
- maskToClose: (e == null ? void 0 : e.maskToClose) ?? !0,
749
- popupClass: e.popupClass,
750
- onClose: s,
751
- onBeforeCancel: l,
752
- "onUpdate:modelValue": () => {
753
- y.component.props.modelValue = !1;
754
- },
755
- // 等待动画完全结束后销毁vm
756
- onClosed: n,
757
- onOpened: () => {
758
- }
759
- },
760
- {
761
- title: o(),
762
- default: d(),
763
- footer: f()
764
- }
765
- );
766
- M(y, t);
767
- }, Rt = ["success", "warning", "error", "strong", "info"], Dt = F("close-circle-fill");
768
- function It(e, t, n, l, s, r) {
769
- return g(), p("div", {
770
- class: m(e.cls),
771
- style: O(e.styles)
772
- }, t[0] || (t[0] = [
773
- C("svg", {
774
- viewBox: "0 0 48 48",
775
- fill: "none",
776
- xmlns: "http://www.w3.org/2000/svg",
777
- stroke: "currentColor",
778
- "stroke-width": "4",
779
- "stroke-linecap": "butt",
780
- "stroke-linejoin": "miter",
781
- filter: ""
782
- }, [
783
- C("path", {
784
- "fill-rule": "evenodd",
785
- "clip-rule": "evenodd",
786
- 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",
787
- fill: "currentColor",
788
- stroke: "none"
789
- })
790
- ], -1)
791
- ]), 6);
792
- }
793
- const de = /* @__PURE__ */ $(Dt, [["render", It]]), Pt = F("check-circle-fill");
794
- function zt(e, t, n, l, s, r) {
795
- return g(), p("div", {
796
- class: m(e.cls),
797
- style: O(e.styles)
798
- }, t[0] || (t[0] = [
799
- C("svg", {
800
- viewBox: "0 0 48 48",
801
- fill: "none",
802
- xmlns: "http://www.w3.org/2000/svg",
803
- stroke: "currentColor",
804
- "stroke-width": "4",
805
- "stroke-linecap": "butt",
806
- "stroke-linejoin": "miter",
807
- filter: ""
808
- }, [
809
- C("path", {
810
- "fill-rule": "evenodd",
811
- "clip-rule": "evenodd",
812
- 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",
813
- fill: "currentColor",
814
- stroke: "none"
815
- })
816
- ], -1)
817
- ]), 6);
818
- }
819
- const fe = /* @__PURE__ */ $(Pt, [["render", zt]]), Ht = F("exclamation-circle-fill");
820
- function Vt(e, t, n, l, s, r) {
821
- return g(), p("div", {
822
- class: m(e.cls),
823
- style: O(e.styles)
824
- }, t[0] || (t[0] = [
825
- C("svg", {
826
- viewBox: "0 0 48 48",
827
- fill: "none",
828
- xmlns: "http://www.w3.org/2000/svg",
829
- stroke: "currentColor",
830
- "stroke-width": "4",
831
- "stroke-linecap": "butt",
832
- "stroke-linejoin": "miter",
833
- filter: ""
834
- }, [
835
- C("path", {
836
- "fill-rule": "evenodd",
837
- "clip-rule": "evenodd",
838
- 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",
839
- fill: "currentColor",
840
- stroke: "none"
841
- })
842
- ], -1)
843
- ]), 6);
844
- }
845
- const me = /* @__PURE__ */ $(Ht, [["render", Vt]]), Ft = F("info-circle-fill");
846
- function jt(e, t, n, l, s, r) {
847
- return g(), p("div", {
848
- class: m(e.cls),
849
- style: O(e.styles)
850
- }, t[0] || (t[0] = [
851
- C("svg", {
852
- viewBox: "0 0 48 48",
853
- fill: "none",
854
- xmlns: "http://www.w3.org/2000/svg",
855
- stroke: "currentColor",
856
- "stroke-width": "4",
857
- "stroke-linecap": "butt",
858
- "stroke-linejoin": "miter",
859
- filter: ""
860
- }, [
861
- C("path", {
862
- "fill-rule": "evenodd",
863
- "clip-rule": "evenodd",
864
- 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",
865
- fill: "currentColor",
866
- stroke: "none"
867
- })
868
- ], -1)
869
- ]), 6);
870
- }
871
- const ye = /* @__PURE__ */ $(Ft, [["render", jt]]), Ut = F("minus-circle-fill");
872
- function Wt(e, t, n, l, s, r) {
873
- return g(), p("div", {
874
- class: m(e.cls),
875
- style: O(e.styles)
876
- }, t[0] || (t[0] = [
877
- C("svg", {
878
- viewBox: "0 0 48 48",
879
- fill: "none",
880
- xmlns: "http://www.w3.org/2000/svg",
881
- stroke: "currentColor",
882
- "stroke-width": "4",
883
- "stroke-linecap": "butt",
884
- "stroke-linejoin": "miter",
885
- filter: ""
886
- }, [
887
- C("path", {
888
- "fill-rule": "evenodd",
889
- "clip-rule": "evenodd",
890
- 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",
891
- fill: "currentColor",
892
- stroke: "none"
893
- })
894
- ], -1)
895
- ]), 6);
896
- }
897
- const ge = /* @__PURE__ */ $(Ut, [["render", Wt]]), Zt = V({
898
- name: X("Message"),
899
- components: {
900
- CloseCircleFill: de,
901
- CheckCircleFill: fe,
902
- ExclamationCircleFill: me,
903
- InfoCircleFill: ye,
904
- MinusCircleFill: ge
905
- },
906
- props: {
907
- id: {
908
- type: String,
909
- default: ""
910
- },
911
- message: {
912
- type: [String, Number, Object],
913
- default: ""
914
- },
915
- type: {
916
- type: String,
917
- default: "success"
918
- },
919
- duration: {
920
- type: Number,
921
- default: 1500
922
- },
923
- center: {
924
- type: Boolean,
925
- default: !1
926
- },
927
- onClose: {
928
- type: Function,
929
- default: () => {
930
- }
931
- },
932
- offset: {
933
- type: Number,
934
- default: 20
935
- },
936
- zIndex: {
937
- type: Number,
938
- default: 0
939
- },
940
- showClose: {
941
- type: Boolean,
942
- default: !1
943
- },
944
- useHTML: Boolean,
945
- popupClass: {
946
- type: String,
947
- default: void 0
948
- }
949
- },
950
- emits: ["destroy"],
951
- setup(e) {
952
- const t = L("message"), n = k(() => [
953
- t.block,
954
- t.modifier(e.type),
955
- e.center && t.modifier("center"),
956
- e.showClose && !e.center && t.element("show-close"),
957
- e.popupClass && e.popupClass
958
- ]), l = K(!1);
959
- let s = null;
960
- const r = () => {
961
- s = setTimeout(() => {
962
- l.value = !1;
963
- }, e.duration);
964
- };
965
- ie(() => {
966
- l.value = !0, e.duration !== 0 && r();
967
- }), Ne(() => {
968
- clearTimeout(s);
969
- });
970
- const { zIndex: u } = ce("message", { runOnMounted: !0 }), o = k(() => ({
971
- top: `${e.offset}px`,
972
- zIndex: u.value
973
- }));
974
- return {
975
- cn: t,
976
- cls: n,
977
- styles: o,
978
- visible: l,
979
- handleClose: () => {
980
- l.value = !1;
981
- }
982
- };
983
- }
984
- }), Kt = ["innerHTML"], Xt = { key: 1 };
985
- function Yt(e, t, n, l, s, r) {
986
- const u = I("CheckCircleFill"), o = I("ExclamationCircleFill"), d = I("MinusCircleFill"), f = I("CloseCircleFill"), y = I("InfoCircleFill");
987
- return g(), N(Q, {
988
- name: "x-message-slide-top",
989
- onBeforeLeave: e.onClose,
990
- onAfterLeave: t[1] || (t[1] = (a) => e.$emit("destroy"))
991
- }, {
992
- default: x(() => [
993
- P(C("div", {
994
- class: m(e.cls),
995
- style: O(e.styles)
996
- }, [
997
- e.$slots.icon ? B("", !0) : (g(), p("span", {
998
- key: 0,
999
- class: m([e.cn.element("icon"), e.cn.modifier(`icon-${e.type}`)])
1000
- }, [
1001
- T(e.$slots, "icon", {}, () => [
1002
- e.type === "success" ? (g(), N(u, { key: 0 })) : e.type === "warning" ? (g(), N(o, { key: 1 })) : e.type === "strong" ? (g(), N(d, { key: 2 })) : e.type === "error" ? (g(), N(f, { key: 3 })) : e.type === "info" ? (g(), N(y, { key: 4 })) : B("", !0)
1003
- ])
1004
- ], 2)),
1005
- T(e.$slots, "default", {}, () => [
1006
- e.useHTML ? (g(), p("span", {
1007
- key: 0,
1008
- innerHTML: e.message
1009
- }, null, 8, Kt)) : (g(), p("span", Xt, _(e.message), 1)),
1010
- e.showClose ? (g(), p("span", {
1011
- key: 2,
1012
- class: m([e.cn.element("close-icon")]),
1013
- onClick: t[0] || (t[0] = (...a) => e.handleClose && e.handleClose(...a))
1014
- }, null, 2)) : B("", !0)
1015
- ])
1016
- ], 6), [
1017
- [z, e.visible]
1018
- ])
1019
- ]),
1020
- _: 3
1021
- }, 8, ["onBeforeLeave"]);
1022
- }
1023
- const Gt = /* @__PURE__ */ $(Zt, [["render", Yt]]), re = /* @__PURE__ */ new WeakMap(), oe = (e) => {
1024
- (typeof e == "string" || w(e)) && (e = {
1025
- message: e
1026
- });
1027
- const t = ue(e.renderTo || "body");
1028
- re.has(t) || re.set(t, []);
1029
- const n = re.get(t);
1030
- let l = e.offset || 20;
1031
- n.forEach((a) => {
1032
- var i;
1033
- l += ((i = a.el) == null ? void 0 : i.offsetHeight) + 20;
1034
- });
1035
- const s = e.onClose;
1036
- let r = {};
1037
- r = { ...e, onClose: () => {
1038
- var c;
1039
- const a = n.findIndex((h) => h === d);
1040
- if (a < 0) return;
1041
- const i = ((c = d.el) == null ? void 0 : c.offsetHeight) + 20;
1042
- n.slice(a + 1).forEach((h) => {
1043
- var A;
1044
- const E = (A = h.component) == null ? void 0 : A.props.offset;
1045
- h.component.props.offset = E - i;
1046
- }), n.splice(a, 1), s && s(d);
1047
- }, onDestroy: () => {
1048
- M(null, f);
1049
- }, offset: l };
1050
- const d = R(
1051
- Gt,
1052
- r,
1053
- b(r.message) || w(r.message) ? {
1054
- default: b(r.message) ? r.message : () => r.message
1055
- } : null
1056
- ), f = document.createElement("div");
1057
- return M(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), {
1058
- close: () => {
1059
- d.component.proxy.handleClose();
1060
- }
1061
- };
1062
- }, qt = () => {
1063
- Rt.forEach((e) => {
1064
- oe[e] = (t) => Se(t) ? oe({
1065
- type: e,
1066
- ...t
1067
- }) : oe({
1068
- message: t,
1069
- type: e
1070
- });
1071
- });
1072
- };
1073
- qt();
1074
- const Jt = ["info", "success", "warning", "strong", "error"], se = L("message-box"), be = (e) => {
1075
- const t = document.createElement("div"), n = () => {
1076
- M(null, t);
1077
- }, l = (i) => {
1078
- if (i === "cancel")
1079
- return e.beforeOnCancel ? e.beforeOnCancel() : !0;
1080
- if (i === "ok")
1081
- return e.beforeOnOk ? e.beforeOnOk() : !0;
1082
- }, s = (i, c) => {
1083
- i === "cancel" && e.onCancel && e.onCancel(c), i === "ok" && e.onOk && e.onOk(c);
1084
- }, r = (i) => {
1085
- let c;
1086
- switch (i) {
1087
- case "warning":
1088
- c = /* @__PURE__ */ React.createElement(me, { size: "22px", color: "#f6c64b" });
1089
- break;
1090
- case "strong":
1091
- c = /* @__PURE__ */ React.createElement(ge, { size: "22px", color: "#ff7125" });
1092
- break;
1093
- case "error":
1094
- c = /* @__PURE__ */ React.createElement(de, { size: "22px", color: "#e24f48" });
1095
- break;
1096
- case "success":
1097
- c = /* @__PURE__ */ React.createElement(fe, { size: "22px", color: "#68d1ab" });
1098
- break;
1099
- case "info":
1100
- c = /* @__PURE__ */ React.createElement(ye, { size: "22px", color: "#2355f5" });
1101
- break;
1102
- }
1103
- return /* @__PURE__ */ React.createElement("div", { className: se.element("icon") }, c);
1104
- }, u = (i) => {
1105
- if (w(i)) return i;
1106
- if (b(i)) {
1107
- const c = i();
1108
- return w(c) ? c : null;
1109
- }
1110
- return /* @__PURE__ */ React.createElement("div", { className: se.element("title") }, " ", i, " ");
1111
- }, o = (i) => {
1112
- if (w(i)) return i;
1113
- if (b(i)) {
1114
- const c = i();
1115
- return w(c) ? c : null;
1116
- }
1117
- return /* @__PURE__ */ React.createElement("div", { className: se.element("content") }, " ", e.content, " ");
1118
- }, d = () => () => /* @__PURE__ */ React.createElement(React.Fragment, null, r(e.type || "success"), e.title && u(e.title)), f = () => () => /* @__PURE__ */ React.createElement(React.Fragment, null, e.content && o(e.content)), y = () => {
1119
- if (w(e.footer) || b(e.footer))
1120
- return e.footer;
1121
- const i = (e == null ? void 0 : e.cancelText) || "取消", c = (e == null ? void 0 : e.okText) || "确认";
1122
- return (h) => {
1123
- var E, A;
1124
- return /* @__PURE__ */ React.createElement(Ie, { size: 12 }, !e.hideCancel && /* @__PURE__ */ React.createElement(ee, { size: "small", onClick: h.cancel, loading: (E = h.loadingObj) == null ? void 0 : E.cancel }, i), !e.hideOk && /* @__PURE__ */ React.createElement(ee, { type: "primary", size: "small", onClick: h.ok, loading: (A = h.loadingObj) == null ? void 0 : A.ok }, c));
1125
- };
1126
- }, a = R(
1127
- De,
1128
- {
1129
- messageBox: !0,
1130
- width: (e == null ? void 0 : e.width) ?? 358,
1131
- height: (e == null ? void 0 : e.height) ?? "auto",
1132
- modelValue: !0,
1133
- renderTo: e == null ? void 0 : e.renderTo,
1134
- center: e != null && e.top ? !1 : (e == null ? void 0 : e.center) ?? !0,
1135
- top: (e == null ? void 0 : e.top) ?? 0,
1136
- mask: (e == null ? void 0 : e.mask) ?? !0,
1137
- maskToClose: (e == null ? void 0 : e.maskToClose) ?? !0,
1138
- popupClass: e.popupClass,
1139
- onClose: s,
1140
- onBeforeCancel: l,
1141
- "onUpdate:modelValue": () => {
1142
- a.component.props.modelValue = !1;
1143
- },
1144
- // 等待动画完全结束后销毁vm
1145
- onClosed: n,
1146
- onOpened: () => {
1147
- }
1148
- },
1149
- {
1150
- title: d(),
1151
- default: f(),
1152
- footer: y()
1153
- }
1154
- );
1155
- M(a, t);
1156
- }, Qt = () => {
1157
- Jt.forEach((e) => {
1158
- be[e] = (t, n) => {
1159
- const l = [], s = [];
1160
- let r = () => !0, u = () => !0;
1161
- return setTimeout(() => {
1162
- be({
1163
- title: t,
1164
- content: n,
1165
- type: e,
1166
- beforeOnCancel: u,
1167
- beforeOnOk: r,
1168
- onOk: () => {
1169
- l.forEach((o) => b(o) && o());
1170
- },
1171
- onCancel: () => {
1172
- s.forEach((o) => b(o) && o());
1173
- }
1174
- });
1175
- }, 0), {
1176
- ok(...o) {
1177
- return o.length === 1 && l.push(o[0]), o.length === 2 && (r = o[0], l.push(o[1])), this;
1178
- },
1179
- cancel(...o) {
1180
- return o.length === 1 && s.push(o[0]), o.length === 2 && (u = o[0], s.push(o[1])), this;
1181
- }
1182
- };
1183
- };
1184
- });
1185
- };
1186
- Qt();
1187
- const xt = {
1188
- position: {
1189
- type: String,
1190
- default: "top-right"
1191
- },
1192
- offset: {
1193
- type: Number,
1194
- default: 0
1195
- },
1196
- title: {
1197
- type: String,
1198
- default: ""
1199
- },
1200
- type: {
1201
- type: String,
1202
- default: "info"
1203
- },
1204
- message: {
1205
- type: String,
1206
- default: void 0
1207
- },
1208
- duration: {
1209
- type: Number,
1210
- default: 3e3
1211
- },
1212
- showClose: {
1213
- type: Boolean,
1214
- default: !0
1215
- },
1216
- onClose: {
1217
- type: Function,
1218
- default: () => {
1219
- }
1220
- },
1221
- renderToBody: {
1222
- type: Boolean,
1223
- default: !1
1224
- }
1225
- }, _t = V({
1226
- name: X("Notification"),
1227
- props: xt,
1228
- emits: ["close", "destroy"],
1229
- setup(e) {
1230
- const t = L("notification"), n = t.block, l = k(() => [n, t.modifier(r.value.ver)]), { zIndex: s } = ce("message", { runOnMounted: !0 }), r = k(() => {
1231
- const c = e.position.split("-");
1232
- return {
1233
- hor: c[1],
1234
- ver: c[0]
1235
- };
1236
- }), u = k(() => `x-notification-slide-${r.value.hor}`), o = k(() => {
1237
- const c = {};
1238
- return c.position = e.renderToBody ? "fixed" : "absolute", c.zIndex = s.value, c[r.value.hor] = "20px", c[r.value.ver] = `${e.offset}px`, c;
1239
- }), d = K(!1);
1240
- let f = 0;
1241
- const y = () => {
1242
- setTimeout(() => {
1243
- d.value = !1;
1244
- }, e.duration);
1245
- }, a = k(() => e.type === "info" ? ye : e.type === "warning" ? me : e.type === "strong" ? ge : e.type === "success" ? fe : e.type === "error" ? de : ""), i = () => {
1246
- d.value = !1;
1247
- };
1248
- return ie(() => {
1249
- e.duration !== 0 && y(), d.value = !0;
1250
- }), Ne(() => {
1251
- clearTimeout(f);
1252
- }), {
1253
- ns: n,
1254
- cn: t,
1255
- cls: l,
1256
- animationClsName: u,
1257
- positionStyle: o,
1258
- visible: d,
1259
- positionPropMap: r,
1260
- currentIcon: a,
1261
- handleClose: i
1262
- };
1263
- }
1264
- });
1265
- function en(e, t, n, l, s, r) {
1266
- return g(), N(Q, {
1267
- name: e.animationClsName,
1268
- onBeforeLeave: t[1] || (t[1] = (u) => e.$emit("close")),
1269
- onAfterLeave: t[2] || (t[2] = (u) => e.$emit("destroy"))
1270
- }, {
1271
- default: x(() => [
1272
- P(C("div", {
1273
- class: m(e.cls),
1274
- style: O(e.positionStyle)
1275
- }, [
1276
- C("div", {
1277
- class: m([e.cn.element("header")])
1278
- }, [
1279
- C("div", {
1280
- class: m([e.cn.element("icon"), e.cn.modifier(`icon-${e.type}`)])
1281
- }, [
1282
- (g(), N(Qe(e.currentIcon)))
1283
- ], 2),
1284
- C("div", null, [
1285
- C("div", {
1286
- class: m([e.cn.element("title")])
1287
- }, _(e.title), 3),
1288
- C("div", {
1289
- class: m([e.cn.element("message")])
1290
- }, [
1291
- T(e.$slots, "default", {}, () => [
1292
- xe(_(e.message), 1)
1293
- ])
1294
- ], 2)
1295
- ])
1296
- ], 2),
1297
- e.showClose ? (g(), p("span", {
1298
- key: 0,
1299
- class: m([e.cn.element("close-icon")]),
1300
- onClick: t[0] || (t[0] = $e((...u) => e.handleClose && e.handleClose(...u), ["self"]))
1301
- }, null, 2)) : B("", !0)
1302
- ], 6), [
1303
- [z, e.visible]
1304
- ])
1305
- ]),
1306
- _: 3
1307
- }, 8, ["name"]);
1308
- }
1309
- const tn = /* @__PURE__ */ $(_t, [["render", en]]), U = /* @__PURE__ */ new WeakMap(), on = (e) => {
1310
- const t = ue(e.renderTo || "body"), n = document.createElement("div");
1311
- U.get(t) || U.set(t, {}), U.get(t)[e.position] || (U.get(t)[e.position] = []);
1312
- const l = U.get(t)[e.position];
1313
- let s = e.offset || 20;
1314
- l.forEach((y) => {
1315
- var a;
1316
- s += ((a = y.el) == null ? void 0 : a.offsetHeight) + 20;
1317
- });
1318
- const r = t.tagName === "BODY";
1319
- r || (t.style.position = "relative", t.style.overflowX = "hidden");
1320
- const u = e.onClose, o = () => {
1321
- var i;
1322
- const y = l.findIndex((c) => c === f);
1323
- if (y < 0) return;
1324
- const a = ((i = f.el) == null ? void 0 : i.offsetHeight) + 20;
1325
- l.slice(y + 1).forEach((c) => {
1326
- var E;
1327
- const h = (E = c.component) == null ? void 0 : E.props.offset;
1328
- c.component.props.offset = h - a;
1329
- }), l.splice(y, 1), u && u(f);
1330
- }, d = () => {
1331
- M(null, n);
1332
- }, f = R(
1333
- tn,
1334
- {
1335
- message: e.message,
1336
- title: e.title,
1337
- type: e.type,
1338
- offset: s,
1339
- renderToBody: r,
1340
- position: e.position,
1341
- duration: e.duration ?? 3e3,
1342
- showClose: e.showClose ?? !0,
1343
- onClose: o,
1344
- onDestroy: d
1345
- },
1346
- b(e.message) || w(e.message) ? {
1347
- default: b(e.message) ? e.message : () => e.message
1348
- } : null
1349
- );
1350
- M(f, n), l.push(f), t == null || t.appendChild(n.firstChild);
1351
- };
1352
- export {
1353
- rn as Dialog,
1354
- oe as Message,
1355
- be as MessageBox,
1356
- on as Notification
1357
- };