@xto/feedback 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/es/index.mjs +124 -124
  2. package/lib/index.cjs +1 -1
  3. package/package.json +47 -47
package/es/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as N, ref as I, computed as L, watch as te, resolveComponent as ke, openBlock as d, createBlock as j, Teleport as oe, createVNode as K, Transition as q, withCtx as D, createElementBlock as x, normalizeStyle as O, normalizeClass as a, unref as i, createElementVNode as C, withModifiers as ie, renderSlot as S, createTextVNode as H, toDisplayString as z, createCommentVNode as $, withDirectives as re, vShow as ce, Fragment as ge, renderList as ye, nextTick as ee, onUnmounted as ue, onMounted as be, reactive as Ce, createApp as ve, h as T } from "vue";
1
+ import { defineComponent as N, ref as I, computed as L, watch as te, resolveComponent as ke, openBlock as f, createBlock as j, Teleport as oe, createVNode as K, Transition as q, withCtx as D, createElementBlock as x, normalizeStyle as O, normalizeClass as a, unref as i, createElementVNode as C, withModifiers as ie, renderSlot as S, createTextVNode as H, toDisplayString as z, createCommentVNode as $, withDirectives as re, vShow as ce, Fragment as ge, renderList as ye, nextTick as ee, onUnmounted as ue, onMounted as be, reactive as Ce, createApp as ve, h as T } from "vue";
2
2
  import { useNamespace as F, useZIndex as $e, useEscape as Be, nextMessageZIndex as Te } from "@xto/core";
3
3
  const ot = /* @__PURE__ */ N({
4
4
  name: "XModal",
@@ -19,10 +19,10 @@ const ot = /* @__PURE__ */ N({
19
19
  },
20
20
  emits: ["update:modelValue", "update:open", "close", "open", "ok", "cancel"],
21
21
  setup(e, { emit: s }) {
22
- const t = e, r = s, o = F("modal"), { next: l } = $e(), f = I(l()), g = L({
22
+ const t = e, r = s, o = F("modal"), { next: l } = $e(), m = I(l()), g = L({
23
23
  get: () => t.modelValue !== void 0 ? t.modelValue : t.open !== void 0 ? t.open : !1,
24
- set: (m) => {
25
- r("update:modelValue", m), r("update:open", m);
24
+ set: (d) => {
25
+ t.modelValue !== void 0 && r("update:modelValue", d), t.open !== void 0 && r("update:open", d), t.modelValue === void 0 && t.open === void 0 && r("update:modelValue", d);
26
26
  }
27
27
  }), v = I(), c = () => {
28
28
  g.value = !1, r("cancel"), r("close");
@@ -33,21 +33,21 @@ const ot = /* @__PURE__ */ N({
33
33
  };
34
34
  Be(() => {
35
35
  t.closeOnPressEscape && g.value && c();
36
- }), te(() => [t.modelValue, t.open], ([m, n]) => {
37
- (m !== void 0 ? m : n) && (f.value = l(), r("open"));
36
+ }), te(() => [t.modelValue, t.open], ([d, n]) => {
37
+ (d !== void 0 ? d : n) && (m.value = l(), r("open"));
38
38
  }, { immediate: !0 });
39
39
  const w = L(() => ({
40
40
  paddingTop: t.top
41
41
  })), h = L(() => ({
42
42
  width: typeof t.width == "number" ? `${t.width}px` : t.width,
43
- zIndex: f.value
43
+ zIndex: m.value
44
44
  }));
45
- return (m, n) => {
45
+ return (d, n) => {
46
46
  const y = ke("x-button");
47
- return d(), j(oe, { to: "body" }, [
47
+ return f(), j(oe, { to: "body" }, [
48
48
  K(q, { name: "x-modal-fade" }, {
49
49
  default: D(() => [
50
- g.value ? (d(), x("div", {
50
+ g.value ? (f(), x("div", {
51
51
  key: 0,
52
52
  class: a(i(o).e("wrapper")),
53
53
  style: O(w.value),
@@ -67,11 +67,11 @@ const ot = /* @__PURE__ */ N({
67
67
  C("span", {
68
68
  class: a(i(o).e("title"))
69
69
  }, [
70
- S(m.$slots, "title", {}, () => [
70
+ S(d.$slots, "title", {}, () => [
71
71
  H(z(e.title), 1)
72
72
  ])
73
73
  ], 2),
74
- e.showClose ? (d(), x("button", {
74
+ e.showClose ? (f(), x("button", {
75
75
  key: 0,
76
76
  class: a(i(o).e("close")),
77
77
  onClick: c
@@ -80,17 +80,17 @@ const ot = /* @__PURE__ */ N({
80
80
  C("div", {
81
81
  class: a(i(o).e("body"))
82
82
  }, [
83
- S(m.$slots, "default")
83
+ S(d.$slots, "default")
84
84
  ], 2),
85
- m.$slots.footer ? (d(), x("div", {
85
+ d.$slots.footer ? (f(), x("div", {
86
86
  key: 0,
87
87
  class: a(i(o).e("footer"))
88
88
  }, [
89
- S(m.$slots, "footer", {
89
+ S(d.$slots, "footer", {
90
90
  ok: k,
91
91
  cancel: c
92
92
  })
93
- ], 2)) : m.$slots.footer ? $("", !0) : (d(), x("div", {
93
+ ], 2)) : d.$slots.footer ? $("", !0) : (f(), x("div", {
94
94
  key: 1,
95
95
  class: a(i(o).e("footer"))
96
96
  }, [
@@ -138,12 +138,12 @@ const ot = /* @__PURE__ */ N({
138
138
  },
139
139
  emits: ["update:modelValue", "close", "open"],
140
140
  setup(e, { emit: s }) {
141
- const t = e, r = s, o = F("drawer"), l = I(2e3), f = () => {
141
+ const t = e, r = s, o = F("drawer"), l = I(2e3), m = () => {
142
142
  r("update:modelValue", !1), r("close");
143
143
  }, g = () => {
144
- t.closeOnClickModal && f();
144
+ t.closeOnClickModal && m();
145
145
  }, v = (p) => {
146
- p.key === "Escape" && t.modelValue && f();
146
+ p.key === "Escape" && t.modelValue && m();
147
147
  };
148
148
  te(() => t.modelValue, (p) => {
149
149
  p ? (l.value = 2e3 + Math.floor(Math.random() * 100), r("open"), document.addEventListener("keydown", v)) : document.removeEventListener("keydown", v);
@@ -159,7 +159,7 @@ const ot = /* @__PURE__ */ N({
159
159
  btt: { width: "100%", height: h }
160
160
  }[p];
161
161
  });
162
- return (p, w) => (d(), j(oe, { to: "body" }, [
162
+ return (p, w) => (f(), j(oe, { to: "body" }, [
163
163
  K(q, { name: "x-drawer-fade" }, {
164
164
  default: D(() => [
165
165
  re(C("div", {
@@ -173,7 +173,7 @@ const ot = /* @__PURE__ */ N({
173
173
  onClick: w[0] || (w[0] = ie(() => {
174
174
  }, ["stop"]))
175
175
  }, [
176
- e.withHeader ? (d(), x("div", {
176
+ e.withHeader ? (f(), x("div", {
177
177
  key: 0,
178
178
  class: a(i(o).e("header"))
179
179
  }, [
@@ -184,10 +184,10 @@ const ot = /* @__PURE__ */ N({
184
184
  H(z(e.title), 1)
185
185
  ])
186
186
  ], 2),
187
- e.showClose ? (d(), x("button", {
187
+ e.showClose ? (f(), x("button", {
188
188
  key: 0,
189
189
  class: a(i(o).e("close")),
190
- onClick: f
190
+ onClick: m
191
191
  }, " ✕ ", 2)) : $("", !0)
192
192
  ], 2)) : $("", !0),
193
193
  C("div", {
@@ -195,7 +195,7 @@ const ot = /* @__PURE__ */ N({
195
195
  }, [
196
196
  S(p.$slots, "default")
197
197
  ], 2),
198
- p.$slots.footer ? (d(), x("div", {
198
+ p.$slots.footer ? (f(), x("div", {
199
199
  key: 1,
200
200
  class: a(i(o).e("footer"))
201
201
  }, [
@@ -231,7 +231,7 @@ const ot = /* @__PURE__ */ N({
231
231
  },
232
232
  emits: ["update:modelValue", "confirm", "cancel", "close", "field-change"],
233
233
  setup(e, { emit: s }) {
234
- const t = e, r = s, o = F("drawer-form"), l = I({}), f = I({});
234
+ const t = e, r = s, o = F("drawer-form"), l = I({}), m = I({});
235
235
  L(() => [
236
236
  o.b()
237
237
  ]), te(() => t.formData, (h) => {
@@ -244,26 +244,26 @@ const ot = /* @__PURE__ */ N({
244
244
  }, k = () => {
245
245
  p() && (r("confirm", l.value), v());
246
246
  }, p = () => {
247
- f.value = {};
247
+ m.value = {};
248
248
  for (const h of t.fields) {
249
249
  if (h.required) {
250
- const m = l.value[h.name];
251
- if (m == null || m === "") {
252
- f.value[h.name] = `${h.label}为必填项`;
250
+ const d = l.value[h.name];
251
+ if (d == null || d === "") {
252
+ m.value[h.name] = `${h.label}为必填项`;
253
253
  continue;
254
254
  }
255
255
  }
256
256
  if (h.rules)
257
- for (const m of h.rules) {
257
+ for (const d of h.rules) {
258
258
  const n = l.value[h.name];
259
- m.type === "email" && n && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n) && (f.value[h.name] = m.message), m.type === "minLength" && n && n.length < m.min && (f.value[h.name] = m.message);
259
+ d.type === "email" && n && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n) && (m.value[h.name] = d.message), d.type === "minLength" && n && n.length < d.min && (m.value[h.name] = d.message);
260
260
  }
261
261
  }
262
- return Object.keys(f.value).length === 0;
263
- }, w = (h, m) => {
264
- l.value[h] = m, r("field-change", h, m);
262
+ return Object.keys(m.value).length === 0;
263
+ }, w = (h, d) => {
264
+ l.value[h] = d, r("field-change", h, d);
265
265
  };
266
- return (h, m) => (d(), j(oe, { to: "body" }, [
266
+ return (h, d) => (f(), j(oe, { to: "body" }, [
267
267
  K(q, { name: "drawer-form-fade" }, {
268
268
  default: D(() => [
269
269
  re(C("div", {
@@ -273,7 +273,7 @@ const ot = /* @__PURE__ */ N({
273
273
  C("div", {
274
274
  class: a(i(o).b()),
275
275
  style: O({ width: g.value }),
276
- onClick: m[0] || (m[0] = ie(() => {
276
+ onClick: d[0] || (d[0] = ie(() => {
277
277
  }, ["stop"]))
278
278
  }, [
279
279
  C("div", {
@@ -290,11 +290,11 @@ const ot = /* @__PURE__ */ N({
290
290
  C("div", {
291
291
  class: a(i(o).e("body"))
292
292
  }, [
293
- !e.destroyOnClose || e.modelValue ? (d(), x("div", {
293
+ !e.destroyOnClose || e.modelValue ? (f(), x("div", {
294
294
  key: 0,
295
295
  class: a(i(o).e("form"))
296
296
  }, [
297
- (d(!0), x(ge, null, ye(e.fields, (n) => (d(), x("div", {
297
+ (f(!0), x(ge, null, ye(e.fields, (n) => (f(), x("div", {
298
298
  key: n.name,
299
299
  class: a(i(o).e("field"))
300
300
  }, [
@@ -302,43 +302,43 @@ const ot = /* @__PURE__ */ N({
302
302
  class: a(i(o).e("label"))
303
303
  }, [
304
304
  H(z(n.label) + " ", 1),
305
- n.required ? (d(), x("span", Ee, "*")) : $("", !0)
305
+ n.required ? (f(), x("span", Ee, "*")) : $("", !0)
306
306
  ], 2),
307
- n.type === "input" ? (d(), x("input", {
307
+ n.type === "input" ? (f(), x("input", {
308
308
  key: 0,
309
- class: a([i(o).e("input"), { "has-error": f.value[n.name] }]),
309
+ class: a([i(o).e("input"), { "has-error": m.value[n.name] }]),
310
310
  value: l.value[n.name],
311
311
  placeholder: n.placeholder,
312
312
  disabled: e.disabled || n.disabled,
313
313
  onInput: (y) => w(n.name, y.target.value)
314
- }, null, 42, Me)) : n.type === "textarea" ? (d(), x("textarea", {
314
+ }, null, 42, Me)) : n.type === "textarea" ? (f(), x("textarea", {
315
315
  key: 1,
316
- class: a([i(o).e("textarea"), { "has-error": f.value[n.name] }]),
316
+ class: a([i(o).e("textarea"), { "has-error": m.value[n.name] }]),
317
317
  value: l.value[n.name],
318
318
  placeholder: n.placeholder,
319
319
  disabled: e.disabled || n.disabled,
320
320
  rows: "4",
321
321
  onInput: (y) => w(n.name, y.target.value)
322
- }, null, 42, ze)) : n.type === "number" ? (d(), x("input", {
322
+ }, null, 42, ze)) : n.type === "number" ? (f(), x("input", {
323
323
  key: 2,
324
324
  type: "number",
325
- class: a([i(o).e("input"), { "has-error": f.value[n.name] }]),
325
+ class: a([i(o).e("input"), { "has-error": m.value[n.name] }]),
326
326
  value: l.value[n.name],
327
327
  placeholder: n.placeholder,
328
328
  disabled: e.disabled || n.disabled,
329
329
  onInput: (y) => w(n.name, Number(y.target.value))
330
- }, null, 42, Ie)) : n.type === "select" ? (d(), x("select", {
330
+ }, null, 42, Ie)) : n.type === "select" ? (f(), x("select", {
331
331
  key: 3,
332
- class: a([i(o).e("select"), { "has-error": f.value[n.name] }]),
332
+ class: a([i(o).e("select"), { "has-error": m.value[n.name] }]),
333
333
  value: l.value[n.name],
334
334
  disabled: e.disabled || n.disabled,
335
335
  onChange: (y) => w(n.name, y.target.value)
336
336
  }, [
337
- (d(!0), x(ge, null, ye(n.options, (y) => (d(), x("option", {
337
+ (f(!0), x(ge, null, ye(n.options, (y) => (f(), x("option", {
338
338
  key: y.value,
339
339
  value: y.value
340
340
  }, z(y.label), 9, Le))), 128))
341
- ], 42, Se)) : n.type === "switch" ? (d(), x("div", {
341
+ ], 42, Se)) : n.type === "switch" ? (f(), x("div", {
342
342
  key: 4,
343
343
  class: a(i(o).e("switch"))
344
344
  }, [
@@ -348,22 +348,22 @@ const ot = /* @__PURE__ */ N({
348
348
  onClick: (y) => w(n.name, !l.value[n.name])
349
349
  }, z(l.value[n.name] ? "开启" : "关闭"), 11, Ve)
350
350
  ], 2)) : $("", !0),
351
- f.value[n.name] ? (d(), x("span", {
351
+ m.value[n.name] ? (f(), x("span", {
352
352
  key: 5,
353
353
  class: a(i(o).e("error"))
354
- }, z(f.value[n.name]), 3)) : $("", !0)
354
+ }, z(m.value[n.name]), 3)) : $("", !0)
355
355
  ], 2))), 128))
356
356
  ], 2)) : $("", !0)
357
357
  ], 2),
358
358
  C("div", {
359
359
  class: a(i(o).e("footer"))
360
360
  }, [
361
- e.showCancel ? (d(), x("button", {
361
+ e.showCancel ? (f(), x("button", {
362
362
  key: 0,
363
363
  class: a(i(o).e("cancel")),
364
364
  onClick: c
365
365
  }, z(e.cancelText), 3)) : $("", !0),
366
- e.showConfirm ? (d(), x("button", {
366
+ e.showConfirm ? (f(), x("button", {
367
367
  key: 1,
368
368
  class: a(i(o).e("confirm")),
369
369
  onClick: k
@@ -391,7 +391,7 @@ const ot = /* @__PURE__ */ N({
391
391
  },
392
392
  emits: ["close"],
393
393
  setup(e, { emit: s }) {
394
- const t = e, r = s, o = F("alert"), l = I(!0), f = {
394
+ const t = e, r = s, o = F("alert"), l = I(!0), m = {
395
395
  success: "✓",
396
396
  warning: "⚠",
397
397
  error: "✕",
@@ -404,20 +404,20 @@ const ot = /* @__PURE__ */ N({
404
404
  ]), v = (c) => {
405
405
  l.value = !1, r("close", c);
406
406
  };
407
- return (c, k) => (d(), j(q, { name: "x-alert-fade" }, {
407
+ return (c, k) => (f(), j(q, { name: "x-alert-fade" }, {
408
408
  default: D(() => [
409
- l.value ? (d(), x("div", {
409
+ l.value ? (f(), x("div", {
410
410
  key: 0,
411
411
  class: a(g.value)
412
412
  }, [
413
- e.showIcon ? (d(), x("span", {
413
+ e.showIcon ? (f(), x("span", {
414
414
  key: 0,
415
415
  class: a(i(o).e("icon"))
416
- }, z(f[e.type]), 3)) : $("", !0),
416
+ }, z(m[e.type]), 3)) : $("", !0),
417
417
  C("div", {
418
418
  class: a(i(o).e("content"))
419
419
  }, [
420
- e.title || c.$slots.title ? (d(), x("span", {
420
+ e.title || c.$slots.title ? (f(), x("span", {
421
421
  key: 0,
422
422
  class: a(i(o).e("title"))
423
423
  }, [
@@ -425,7 +425,7 @@ const ot = /* @__PURE__ */ N({
425
425
  H(z(e.title), 1)
426
426
  ])
427
427
  ], 2)) : $("", !0),
428
- e.description || c.$slots.default ? (d(), x("span", {
428
+ e.description || c.$slots.default ? (f(), x("span", {
429
429
  key: 1,
430
430
  class: a(i(o).e("description"))
431
431
  }, [
@@ -434,7 +434,7 @@ const ot = /* @__PURE__ */ N({
434
434
  ])
435
435
  ], 2)) : $("", !0)
436
436
  ], 2),
437
- e.closable ? (d(), x("button", {
437
+ e.closable ? (f(), x("button", {
438
438
  key: 1,
439
439
  class: a(i(o).e("close")),
440
440
  onClick: v
@@ -461,11 +461,11 @@ const ot = /* @__PURE__ */ N({
461
461
  },
462
462
  emits: ["update:visible", "show", "hide"],
463
463
  setup(e, { emit: s }) {
464
- const t = e, r = s, o = F("tooltip"), l = I(!1), f = I(), g = I();
464
+ const t = e, r = s, o = F("tooltip"), l = I(!1), m = I(), g = I();
465
465
  let v, c;
466
466
  const k = I({}), p = () => {
467
- if (!f.value || !g.value) return;
468
- const E = f.value.getBoundingClientRect(), W = g.value;
467
+ if (!m.value || !g.value) return;
468
+ const E = m.value.getBoundingClientRect(), W = g.value;
469
469
  W.style.visibility = "hidden", W.style.display = "block";
470
470
  const A = W.offsetWidth, Z = W.offsetHeight, X = t.offset, fe = window.innerWidth, me = window.innerHeight;
471
471
  let P = 0, R = 0, G = t.placement;
@@ -496,25 +496,25 @@ const ot = /* @__PURE__ */ N({
496
496
  p();
497
497
  });
498
498
  }, t.openDelay));
499
- }, m = () => {
499
+ }, d = () => {
500
500
  clearTimeout(v), c = setTimeout(() => {
501
501
  l.value = !1, r("update:visible", !1), r("hide");
502
502
  }, t.closeDelay);
503
503
  }, n = () => {
504
- l.value ? m() : h();
504
+ l.value ? d() : h();
505
505
  }, y = () => {
506
506
  t.trigger === "hover" && h();
507
507
  }, u = () => {
508
- t.trigger === "hover" && m();
508
+ t.trigger === "hover" && d();
509
509
  }, b = () => {
510
510
  t.trigger === "click" && n();
511
511
  }, U = () => {
512
512
  t.trigger === "focus" && h();
513
513
  }, V = () => {
514
- t.trigger === "focus" && m();
514
+ t.trigger === "focus" && d();
515
515
  }, M = (E) => {
516
516
  var W, A;
517
- t.trigger === "click" && !((W = f.value) != null && W.contains(E.target)) && !((A = g.value) != null && A.contains(E.target)) && m();
517
+ t.trigger === "click" && !((W = m.value) != null && W.contains(E.target)) && !((A = g.value) != null && A.contains(E.target)) && d();
518
518
  }, B = () => {
519
519
  l.value && p();
520
520
  };
@@ -532,12 +532,12 @@ const ot = /* @__PURE__ */ N({
532
532
  o.e("arrow"),
533
533
  o.e(`arrow-${w.value}`)
534
534
  ]);
535
- return (E, W) => (d(), x("div", {
535
+ return (E, W) => (f(), x("div", {
536
536
  class: a(i(o).e("wrapper"))
537
537
  }, [
538
538
  C("div", {
539
539
  ref_key: "triggerRef",
540
- ref: f,
540
+ ref: m,
541
541
  class: a(i(o).e("trigger")),
542
542
  onMouseenter: y,
543
543
  onMouseleave: u,
@@ -547,7 +547,7 @@ const ot = /* @__PURE__ */ N({
547
547
  }, [
548
548
  S(E.$slots, "default")
549
549
  ], 34),
550
- (d(), j(oe, { to: "body" }, [
550
+ (f(), j(oe, { to: "body" }, [
551
551
  K(q, {
552
552
  name: `x-tooltip-${e.transition}`
553
553
  }, {
@@ -563,7 +563,7 @@ const ot = /* @__PURE__ */ N({
563
563
  S(E.$slots, "content", {}, () => [
564
564
  H(z(e.content), 1)
565
565
  ]),
566
- e.visibleArrow ? (d(), x("div", {
566
+ e.visibleArrow ? (f(), x("div", {
567
567
  key: 0,
568
568
  class: a(se.value)
569
569
  }, null, 2)) : $("", !0)
@@ -598,9 +598,9 @@ const ot = /* @__PURE__ */ N({
598
598
  },
599
599
  emits: ["confirm", "cancel"],
600
600
  setup(e, { emit: s }) {
601
- const t = e, r = s, o = I(!1), l = I(null), f = I(null), g = I({}), v = () => {
602
- if (!l.value || !f.value) return;
603
- const u = l.value.getBoundingClientRect(), b = f.value.getBoundingClientRect(), U = t.placement, V = t.offset;
601
+ const t = e, r = s, o = I(!1), l = I(null), m = I(null), g = I({}), v = () => {
602
+ if (!l.value || !m.value) return;
603
+ const u = l.value.getBoundingClientRect(), b = m.value.getBoundingClientRect(), U = t.placement, V = t.offset;
604
604
  let M = 0, B = 0;
605
605
  switch (U) {
606
606
  case "top":
@@ -651,7 +651,7 @@ const ot = /* @__PURE__ */ N({
651
651
  };
652
652
  }, c = (u) => {
653
653
  var b, U;
654
- o.value && ((b = l.value) != null && b.contains(u.target) || (U = f.value) != null && U.contains(u.target) || (o.value = !1));
654
+ o.value && ((b = l.value) != null && b.contains(u.target) || (U = m.value) != null && U.contains(u.target) || (o.value = !1));
655
655
  }, k = (u) => {
656
656
  t.disabled || (u.stopPropagation(), o.value = !o.value, o.value && setTimeout(v, 0));
657
657
  }, p = () => {
@@ -660,13 +660,13 @@ const ot = /* @__PURE__ */ N({
660
660
  o.value = !1, r("cancel");
661
661
  }, h = () => {
662
662
  o.value && v();
663
- }, m = () => {
663
+ }, d = () => {
664
664
  o.value && v();
665
665
  };
666
666
  te(o, (u) => {
667
- u ? (setTimeout(v, 0), document.addEventListener("click", c), window.addEventListener("scroll", h, !0), window.addEventListener("resize", m)) : (document.removeEventListener("click", c), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", m));
667
+ u ? (setTimeout(v, 0), document.addEventListener("click", c), window.addEventListener("scroll", h, !0), window.addEventListener("resize", d)) : (document.removeEventListener("click", c), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", d));
668
668
  }), ue(() => {
669
- document.removeEventListener("click", c), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", m);
669
+ document.removeEventListener("click", c), window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", d);
670
670
  });
671
671
  const n = L(() => ({
672
672
  width: typeof t.width == "number" ? `${t.width}px` : t.width
@@ -696,7 +696,7 @@ const ot = /* @__PURE__ */ N({
696
696
  }
697
697
  return b;
698
698
  });
699
- return (u, b) => (d(), x("span", Pe, [
699
+ return (u, b) => (f(), x("span", Pe, [
700
700
  C("span", {
701
701
  ref_key: "triggerRef",
702
702
  ref: l,
@@ -705,25 +705,25 @@ const ot = /* @__PURE__ */ N({
705
705
  }, [
706
706
  S(u.$slots, "default")
707
707
  ], 512),
708
- (d(), j(oe, { to: "body" }, [
708
+ (f(), j(oe, { to: "body" }, [
709
709
  K(q, { name: "x-popconfirm-fade" }, {
710
710
  default: D(() => [
711
- o.value ? (d(), x("div", {
711
+ o.value ? (f(), x("div", {
712
712
  key: 0,
713
713
  ref_key: "popperRef",
714
- ref: f,
714
+ ref: m,
715
715
  class: "x-popconfirm",
716
716
  style: O({ ...g.value, ...n.value }),
717
717
  onClick: b[0] || (b[0] = ie(() => {
718
718
  }, ["stop"]))
719
719
  }, [
720
- e.showArrow ? (d(), x("span", {
720
+ e.showArrow ? (f(), x("span", {
721
721
  key: 0,
722
722
  class: "x-popconfirm__arrow",
723
723
  style: O(y.value)
724
724
  }, null, 4)) : $("", !0),
725
725
  C("div", Re, [
726
- e.hideIcon ? $("", !0) : (d(), x("span", {
726
+ e.hideIcon ? $("", !0) : (f(), x("span", {
727
727
  key: 0,
728
728
  class: "x-popconfirm__icon",
729
729
  style: O({ color: e.iconColor })
@@ -739,12 +739,12 @@ const ot = /* @__PURE__ */ N({
739
739
  ])
740
740
  ]),
741
741
  C("div", Ne, [
742
- e.hideCancelButton ? $("", !0) : (d(), x("button", {
742
+ e.hideCancelButton ? $("", !0) : (f(), x("button", {
743
743
  key: 0,
744
744
  class: "x-button p-button--default p-button--small",
745
745
  onClick: w
746
746
  }, z(e.cancelButtonText), 1)),
747
- e.hideConfirmButton ? $("", !0) : (d(), x("button", {
747
+ e.hideConfirmButton ? $("", !0) : (f(), x("button", {
748
748
  key: 1,
749
749
  class: a(["x-button x-button--small", `x-button--${e.confirmButtonType}`]),
750
750
  onClick: p
@@ -767,7 +767,7 @@ const ot = /* @__PURE__ */ N({
767
767
  },
768
768
  emits: ["click"],
769
769
  setup(e, { emit: s }) {
770
- const t = e, r = s, o = F("backtop"), l = I(!1), f = () => {
770
+ const t = e, r = s, o = F("backtop"), l = I(!1), m = () => {
771
771
  const c = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0;
772
772
  l.value = c >= t.visibilityHeight;
773
773
  }, g = (c) => {
@@ -780,10 +780,10 @@ const ot = /* @__PURE__ */ N({
780
780
  bottom: `${t.bottom}px`
781
781
  }));
782
782
  return be(() => {
783
- window.addEventListener("scroll", f, { passive: !0, capture: !0 }), setTimeout(f, 100);
783
+ window.addEventListener("scroll", m, { passive: !0, capture: !0 }), setTimeout(m, 100);
784
784
  }), ue(() => {
785
- window.removeEventListener("scroll", f, !0);
786
- }), (c, k) => (d(), j(q, { name: "x-fade" }, {
785
+ window.removeEventListener("scroll", m, !0);
786
+ }), (c, k) => (f(), j(q, { name: "x-fade" }, {
787
787
  default: D(() => [
788
788
  re(C("div", {
789
789
  class: a(i(o).b()),
@@ -807,7 +807,7 @@ const ot = /* @__PURE__ */ N({
807
807
  __name: "index",
808
808
  setup(e) {
809
809
  const s = F("timeline");
810
- return (t, r) => (d(), x("ul", {
810
+ return (t, r) => (f(), x("ul", {
811
811
  class: a(i(s).b())
812
812
  }, [
813
813
  S(t.$slots, "default")
@@ -827,7 +827,7 @@ const ot = /* @__PURE__ */ N({
827
827
  },
828
828
  setup(e) {
829
829
  const s = F("timeline-item");
830
- return (t, r) => (d(), x("li", {
830
+ return (t, r) => (f(), x("li", {
831
831
  class: a([i(s).b(), i(s).m(e.placement)])
832
832
  }, [
833
833
  C("div", {
@@ -838,7 +838,7 @@ const ot = /* @__PURE__ */ N({
838
838
  style: O(e.color ? { backgroundColor: e.color, borderColor: e.color } : void 0)
839
839
  }, [
840
840
  S(t.$slots, "icon", {}, () => [
841
- e.icon ? (d(), x("span", {
841
+ e.icon ? (f(), x("span", {
842
842
  key: 0,
843
843
  class: a(i(s).e("icon"))
844
844
  }, z(e.icon), 3)) : $("", !0)
@@ -847,7 +847,7 @@ const ot = /* @__PURE__ */ N({
847
847
  C("div", {
848
848
  class: a(i(s).e("wrapper"))
849
849
  }, [
850
- e.timestamp && e.placement === "top" ? (d(), x("div", {
850
+ e.timestamp && e.placement === "top" ? (f(), x("div", {
851
851
  key: 0,
852
852
  class: a(i(s).e("timestamp"))
853
853
  }, z(e.timestamp), 3)) : $("", !0),
@@ -856,7 +856,7 @@ const ot = /* @__PURE__ */ N({
856
856
  }, [
857
857
  S(t.$slots, "default")
858
858
  ], 2),
859
- e.timestamp && e.placement === "bottom" ? (d(), x("div", {
859
+ e.timestamp && e.placement === "bottom" ? (f(), x("div", {
860
860
  key: 1,
861
861
  class: a(i(s).e("timestamp"))
862
862
  }, z(e.timestamp), 3)) : $("", !0)
@@ -878,7 +878,7 @@ const ot = /* @__PURE__ */ N({
878
878
  },
879
879
  emits: ["close", "destroy"],
880
880
  setup(e, { expose: s, emit: t }) {
881
- const r = e, o = t, l = F("message"), f = I(!1), g = I(Te()), v = {
881
+ const r = e, o = t, l = F("message"), m = I(!1), g = I(Te()), v = {
882
882
  success: "✓",
883
883
  warning: "⚠",
884
884
  error: "✕",
@@ -896,28 +896,28 @@ const ot = /* @__PURE__ */ N({
896
896
  let p = null;
897
897
  const w = () => {
898
898
  r.duration > 0 && (p = setTimeout(() => {
899
- m();
899
+ d();
900
900
  }, r.duration));
901
901
  }, h = () => {
902
902
  p && (clearTimeout(p), p = null);
903
- }, m = () => {
903
+ }, d = () => {
904
904
  var y;
905
- f.value = !1, (y = r.onClose) == null || y.call(r), o("close");
905
+ m.value = !1, (y = r.onClose) == null || y.call(r), o("close");
906
906
  }, n = () => {
907
907
  o("destroy");
908
908
  };
909
909
  return be(() => {
910
- w(), f.value = !0;
910
+ w(), m.value = !0;
911
911
  }), ue(() => {
912
912
  h();
913
913
  }), s({
914
- close: m
915
- }), (y, u) => (d(), j(q, {
914
+ close: d
915
+ }), (y, u) => (f(), j(q, {
916
916
  name: "x-message-fade",
917
917
  onAfterLeave: n
918
918
  }, {
919
919
  default: D(() => [
920
- f.value ? (d(), x("div", {
920
+ m.value ? (f(), x("div", {
921
921
  key: 0,
922
922
  class: a(c.value),
923
923
  style: O(k.value),
@@ -934,10 +934,10 @@ const ot = /* @__PURE__ */ N({
934
934
  H(z(e.message), 1)
935
935
  ])
936
936
  ], 2),
937
- e.showClose ? (d(), x("button", {
937
+ e.showClose ? (f(), x("button", {
938
938
  key: 0,
939
939
  class: a(i(l).e("close")),
940
- onClick: m
940
+ onClick: d
941
941
  }, " ✕ ", 2)) : $("", !0)
942
942
  ], 38)) : $("", !0)
943
943
  ]),
@@ -957,7 +957,7 @@ function xe(e) {
957
957
  warning: { bg: "#fdf6ec", border: "#e6a23c", icon: "⚠" },
958
958
  error: { bg: "#fef0f0", border: "#f56c6c", icon: "✕" },
959
959
  info: { bg: "#f4f4f5", border: "#909399", icon: "ℹ" }
960
- }, o = e.type || "info", l = r[o] || r.info, f = Ce({
960
+ }, o = e.type || "info", l = r[o] || r.info, m = Ce({
961
961
  visible: !1,
962
962
  offset: e.offset ?? 20
963
963
  });
@@ -965,10 +965,10 @@ function xe(e) {
965
965
  J.forEach((n) => {
966
966
  const y = n.container.firstElementChild;
967
967
  y && y.offsetHeight && (g += y.offsetHeight + 16);
968
- }), f.offset = g;
968
+ }), m.offset = g;
969
969
  let v = null, c = !1;
970
970
  const k = () => {
971
- c || (f.visible = !1, setTimeout(() => {
971
+ c || (m.visible = !1, setTimeout(() => {
972
972
  if (c) return;
973
973
  c = !0;
974
974
  const n = J.findIndex((y) => y.id === s);
@@ -986,7 +986,7 @@ function xe(e) {
986
986
  v && (clearTimeout(v), v = null);
987
987
  }, h = ve({
988
988
  render() {
989
- if (!f.visible) return null;
989
+ if (!m.visible) return null;
990
990
  const n = [
991
991
  // Icon
992
992
  T("span", {
@@ -1034,7 +1034,7 @@ function xe(e) {
1034
1034
  style: {
1035
1035
  position: "fixed",
1036
1036
  left: "50%",
1037
- top: `${f.offset}px`,
1037
+ top: `${m.offset}px`,
1038
1038
  transform: "translateX(-50%)",
1039
1039
  display: "flex",
1040
1040
  alignItems: "center",
@@ -1054,10 +1054,10 @@ function xe(e) {
1054
1054
  }
1055
1055
  });
1056
1056
  h.mount(t), ee(() => {
1057
- f.visible = !0, p();
1057
+ m.visible = !0, p();
1058
1058
  });
1059
- const m = { id: s, app: h, container: t, close: k };
1060
- return J.push(m), { close: k };
1059
+ const d = { id: s, app: h, container: t, close: k };
1060
+ return J.push(d), { close: k };
1061
1061
  }
1062
1062
  function Fe(e) {
1063
1063
  return xe(typeof e == "string" ? { message: e } : e);
@@ -1109,10 +1109,10 @@ function de(e) {
1109
1109
  c.value = "", p("confirm");
1110
1110
  }, h = () => {
1111
1111
  p("cancel");
1112
- }, m = () => {
1112
+ }, d = () => {
1113
1113
  p("close");
1114
1114
  }, n = () => {
1115
- e.closeOnClickModal !== !1 && m();
1115
+ e.closeOnClickModal !== !1 && d();
1116
1116
  };
1117
1117
  return ee(() => {
1118
1118
  g.value = !0;
@@ -1123,7 +1123,7 @@ function de(e) {
1123
1123
  zIndex: k,
1124
1124
  handleConfirm: w,
1125
1125
  handleCancel: h,
1126
- handleClose: m,
1126
+ handleClose: d,
1127
1127
  handleMaskClick: n
1128
1128
  };
1129
1129
  },
@@ -1235,7 +1235,7 @@ function de(e) {
1235
1235
  }
1236
1236
  }), l = ve(o);
1237
1237
  l.mount(t);
1238
- const f = {
1238
+ const m = {
1239
1239
  app: l,
1240
1240
  container: t,
1241
1241
  close: () => {
@@ -1244,7 +1244,7 @@ function de(e) {
1244
1244
  g != null && g.handleClose && g.handleClose();
1245
1245
  }
1246
1246
  };
1247
- Q.push(f);
1247
+ Q.push(m);
1248
1248
  });
1249
1249
  }
1250
1250
  async function je(e, s, t) {
@@ -1333,7 +1333,7 @@ function we(e) {
1333
1333
  const s = Ue++, t = e.position || "top-right", r = document.createElement("div");
1334
1334
  document.body.appendChild(r);
1335
1335
  let o = null, l = !1;
1336
- const f = N({
1336
+ const m = N({
1337
1337
  name: "TNotification",
1338
1338
  setup() {
1339
1339
  const c = I(!1), k = () => {
@@ -1352,13 +1352,13 @@ function we(e) {
1352
1352
  n > 0 && (o = setTimeout(k, n));
1353
1353
  }, w = () => {
1354
1354
  o && (clearTimeout(o), o = null);
1355
- }, h = L(() => (e.offset ?? 0) + Je(t, s)), m = L(() => Qe(t, h.value));
1355
+ }, h = L(() => (e.offset ?? 0) + Je(t, s)), d = L(() => Qe(t, h.value));
1356
1356
  return ee(() => {
1357
1357
  c.value = !0, p();
1358
1358
  }), {
1359
1359
  visible: c,
1360
1360
  close: k,
1361
- positionStyles: m,
1361
+ positionStyles: d,
1362
1362
  startTimer: p,
1363
1363
  clearTimer: w
1364
1364
  };
@@ -1453,7 +1453,7 @@ function we(e) {
1453
1453
  onMouseleave: this.startTimer
1454
1454
  }, w);
1455
1455
  }
1456
- }), g = ve(f);
1456
+ }), g = ve(m);
1457
1457
  g.mount(r);
1458
1458
  const v = {
1459
1459
  id: s,
package/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@xto/core"),K=e.defineComponent({name:"XModal",inheritAttrs:!1,__name:"index",props:{modelValue:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},title:{default:""},width:{default:"50%"},top:{default:"15vh"},modal:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},center:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","update:open","close","open","ok","cancel"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("modal"),{next:s}=z.useZIndex(),d=e.ref(s()),h=e.computed({get:()=>o.modelValue!==void 0?o.modelValue:o.open!==void 0?o.open:!1,set:u=>{r("update:modelValue",u),r("update:open",u)}}),p=e.ref(),i=()=>{h.value=!1,r("cancel"),r("close")},C=()=>{r("ok")},m=()=>{o.closeOnClickModal&&o.modal&&i()};z.useEscape(()=>{o.closeOnPressEscape&&h.value&&i()}),e.watch(()=>[o.modelValue,o.open],([u,l])=>{(u!==void 0?u:l)&&(d.value=s(),r("open"))},{immediate:!0});const y=e.computed(()=>({paddingTop:o.top})),f=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width,zIndex:d.value}));return(u,l)=>{const g=e.resolveComponent("x-button");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-modal-fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("wrapper")),style:e.normalizeStyle(y.value),onClick:m},[e.createElementVNode("div",{ref_key:"modalRef",ref:p,class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(f.value),onClick:l[0]||(l[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(u.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:i}," ✕ ",2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(u.$slots,"default")],2),u.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(u.$slots,"footer",{ok:C,cancel:i})],2)):u.$slots.footer?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.createVNode(g,{onClick:i},{default:e.withCtx(()=>[...l[1]||(l[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(g,{type:"primary",style:{"margin-left":"8px"},onClick:C},{default:e.withCtx(()=>[...l[2]||(l[2]=[e.createTextVNode("确定",-1)])]),_:1})],2))],6)],6)):e.createCommentVNode("",!0)]),_:3})])}}}),Y=e.defineComponent({name:"XDrawer",inheritAttrs:!1,__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},placement:{default:void 0},direction:{default:"rtl"},width:{default:void 0},size:{default:"30%"},withHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer"),s=e.ref(2e3),d=()=>{r("update:modelValue",!1),r("close")},h=()=>{o.closeOnClickModal&&d()},p=m=>{m.key==="Escape"&&o.modelValue&&d()};e.watch(()=>o.modelValue,m=>{m?(s.value=2e3+Math.floor(Math.random()*100),r("open"),document.addEventListener("keydown",p)):document.removeEventListener("keydown",p)});const i=e.computed(()=>({zIndex:s.value})),C=e.computed(()=>{const m=o.direction??o.placement??"rtl",y=o.size??o.width??"30%",f=typeof y=="number"?`${y}px`:y;return{ltr:{width:f,height:"100%"},rtl:{width:f,height:"100%"},ttb:{width:"100%",height:f},btt:{width:"100%",height:f}}[m]});return(m,y)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-drawer-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("overlay"),{[e.unref(n).em("overlay","no-modal")]:!t.modal}]),style:e.normalizeStyle(i.value),onClick:h},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).m(t.direction??t.placement??"rtl")]),style:e.normalizeStyle(C.value),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"]))},[t.withHeader?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(m.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:d}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("body"),m.$slots.footer&&e.unref(n).em("body","has-footer")])},[e.renderSlot(m.$slots,"default")],2),m.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(m.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6),[[e.vShow,t.modelValue]])]),_:3})]))}}),G={key:0,class:"required-mark"},J=["value","placeholder","disabled","onInput"],Q=["value","placeholder","disabled","onInput"],_=["value","placeholder","disabled","onInput"],ee=["value","disabled","onChange"],te=["value"],oe=["disabled","onClick"],ne=e.defineComponent({name:"XDrawerForm",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:"配置"},size:{default:"400px"},fields:{default:()=>[]},formData:{default:()=>({})},showConfirm:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},confirmText:{default:"确认"},cancelText:{default:"取消"},disabled:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","confirm","cancel","close","field-change"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer-form"),s=e.ref({}),d=e.ref({});e.computed(()=>[n.b()]),e.watch(()=>o.formData,f=>{s.value={...f}},{immediate:!0,deep:!0});const h=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size),p=()=>{r("update:modelValue",!1),r("close")},i=()=>{r("cancel"),p()},C=()=>{m()&&(r("confirm",s.value),p())},m=()=>{d.value={};for(const f of o.fields){if(f.required){const u=s.value[f.name];if(u==null||u===""){d.value[f.name]=`${f.label}为必填项`;continue}}if(f.rules)for(const u of f.rules){const l=s.value[f.name];u.type==="email"&&l&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)&&(d.value[f.name]=u.message),u.type==="minLength"&&l&&l.length<u.min&&(d.value[f.name]=u.message)}}return Object.keys(d.value).length===0},y=(f,u)=>{s.value[f]=u,r("field-change",f,u)};return(f,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"drawer-form-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("overlay")),onClick:p},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle({width:h.value}),onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},e.toDisplayString(t.title),3),e.createElementVNode("button",{class:e.normalizeClass(e.unref(n).e("close")),onClick:p},"✕",2)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[!t.destroyOnClose||t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("form"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,l=>(e.openBlock(),e.createElementBlock("div",{key:l.name,class:e.normalizeClass(e.unref(n).e("field"))},[e.createElementVNode("label",{class:e.normalizeClass(e.unref(n).e("label"))},[e.createTextVNode(e.toDisplayString(l.label)+" ",1),l.required?(e.openBlock(),e.createElementBlock("span",G,"*")):e.createCommentVNode("",!0)],2),l.type==="input"?(e.openBlock(),e.createElementBlock("input",{key:0,class:e.normalizeClass([e.unref(n).e("input"),{"has-error":d.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,onInput:g=>y(l.name,g.target.value)},null,42,J)):l.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,class:e.normalizeClass([e.unref(n).e("textarea"),{"has-error":d.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,rows:"4",onInput:g=>y(l.name,g.target.value)},null,42,Q)):l.type==="number"?(e.openBlock(),e.createElementBlock("input",{key:2,type:"number",class:e.normalizeClass([e.unref(n).e("input"),{"has-error":d.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,onInput:g=>y(l.name,Number(g.target.value))},null,42,_)):l.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:3,class:e.normalizeClass([e.unref(n).e("select"),{"has-error":d.value[l.name]}]),value:s.value[l.name],disabled:t.disabled||l.disabled,onChange:g=>y(l.name,g.target.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,g=>(e.openBlock(),e.createElementBlock("option",{key:g.value,value:g.value},e.toDisplayString(g.label),9,te))),128))],42,ee)):l.type==="switch"?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(e.unref(n).e("switch"))},[e.createElementVNode("button",{class:e.normalizeClass(["switch-btn",{"is-on":s.value[l.name]}]),disabled:t.disabled||l.disabled,onClick:g=>y(l.name,!s.value[l.name])},e.toDisplayString(s.value[l.name]?"开启":"关闭"),11,oe)],2)):e.createCommentVNode("",!0),d.value[l.name]?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(e.unref(n).e("error"))},e.toDisplayString(d.value[l.name]),3)):e.createCommentVNode("",!0)],2))),128))],2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("footer"))},[t.showCancel?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("cancel")),onClick:i},e.toDisplayString(t.cancelText),3)):e.createCommentVNode("",!0),t.showConfirm?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(n).e("confirm")),onClick:C},e.toDisplayString(t.confirmText),3)):e.createCommentVNode("",!0)],2)],6)],2),[[e.vShow,t.modelValue]])]),_:1})]))}}),le=e.defineComponent({name:"XAlert",__name:"index",props:{type:{default:"info"},title:{default:""},description:{},closable:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},center:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("alert"),s=e.ref(!0),d={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},h=e.computed(()=>[n.b(),n.m(o.type),n.is("center",o.center),n.is("with-description",o.description)]),p=i=>{s.value=!1,r("close",i)};return(i,C)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-alert-fade"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(h.value)},[t.showIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("icon"))},e.toDisplayString(d[t.type]),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("content"))},[t.title||i.$slots.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(i.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2)):e.createCommentVNode("",!0),t.description||i.$slots.default?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("description"))},[e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])],2)):e.createCommentVNode("",!0)],2),t.closable?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(n).e("close")),onClick:p}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}}),ae=e.defineComponent({name:"XTooltip",__name:"index",props:{content:{default:""},placement:{default:"top"},effect:{default:"dark"},disabled:{type:Boolean,default:!1},offset:{default:8},transition:{default:"fade"},visibleArrow:{type:Boolean,default:!0},trigger:{default:"hover"},openDelay:{default:0},closeDelay:{default:0}},emits:["update:visible","show","hide"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("tooltip"),s=e.ref(!1),d=e.ref(),h=e.ref();let p,i;const C=e.ref({}),m=()=>{if(!d.value||!h.value)return;const b=d.value.getBoundingClientRect(),T=h.value;T.style.visibility="hidden",T.style.display="block";const N=T.offsetWidth,S=T.offsetHeight,V=o.offset,W=window.innerWidth,X=window.innerHeight;let B=0,E=0,I=o.placement;switch(o.placement){case"top":B=b.top-S-V,E=b.left+(b.width-N)/2;break;case"bottom":B=b.bottom+V,E=b.left+(b.width-N)/2;break;case"left":B=b.top+(b.height-S)/2,E=b.left-N-V;break;case"right":B=b.top+(b.height-S)/2,E=b.right+V;break}o.placement==="top"&&B<0?(I="bottom",B=b.bottom+V):o.placement==="bottom"&&B+S>X?(I="top",B=b.top-S-V):o.placement==="left"&&E<0?(I="right",E=b.right+V):o.placement==="right"&&E+N>W&&(I="left",E=b.left-N-V),E<8&&(E=8),E+N>W-8&&(E=W-N-8),B<8&&(B=8),B+S>X-8&&(B=X-S-8),C.value={position:"fixed",top:`${B}px`,left:`${E}px`,visibility:"visible",zIndex:"2000"},y.value=I},y=e.ref(o.placement),f=()=>{o.disabled||(clearTimeout(i),p=setTimeout(()=>{s.value=!0,r("update:visible",!0),r("show"),e.nextTick(()=>{m()})},o.openDelay))},u=()=>{clearTimeout(p),i=setTimeout(()=>{s.value=!1,r("update:visible",!1),r("hide")},o.closeDelay)},l=()=>{s.value?u():f()},g=()=>{o.trigger==="hover"&&f()},c=()=>{o.trigger==="hover"&&u()},v=()=>{o.trigger==="click"&&l()},$=()=>{o.trigger==="focus"&&f()},w=()=>{o.trigger==="focus"&&u()},x=b=>{var T,N;o.trigger==="click"&&!((T=d.value)!=null&&T.contains(b.target))&&!((N=h.value)!=null&&N.contains(b.target))&&u()},k=()=>{s.value&&m()};e.watch(s,b=>{b?e.nextTick(()=>{m(),o.trigger==="click"&&document.addEventListener("click",x),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k)}):(document.removeEventListener("click",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k))}),e.onUnmounted(()=>{clearTimeout(p),clearTimeout(i),document.removeEventListener("click",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)});const R=e.computed(()=>[n.b(),n.m(o.effect)]),O=e.computed(()=>[n.e("arrow"),n.e(`arrow-${y.value}`)]);return(b,T)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n).e("wrapper"))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:d,class:e.normalizeClass(e.unref(n).e("trigger")),onMouseenter:g,onMouseleave:c,onClick:v,onFocus:$,onBlur:w},[e.renderSlot(b.$slots,"default")],34),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:`x-tooltip-${t.transition}`},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"tooltipRef",ref:h,class:e.normalizeClass(R.value),style:e.normalizeStyle(C.value),onMouseenter:g,onMouseleave:c},[e.renderSlot(b.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)]),t.visibleArrow?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(O.value)},null,2)):e.createCommentVNode("",!0)],38),[[e.vShow,s.value]])]),_:3},8,["name"])]))],2))}}),se={class:"x-popconfirm-wrapper"},re={class:"x-popconfirm__main"},ie={class:"x-popconfirm__title"},ce={class:"x-popconfirm__action"},de=e.defineComponent({name:"XPopconfirm",__name:"index",props:{title:{default:""},confirmButtonText:{default:"确定"},cancelButtonText:{default:"取消"},confirmButtonType:{default:"primary"},cancelButtonType:{default:"default"},icon:{default:""},iconColor:{default:"#faad14"},hideIcon:{type:Boolean,default:!1},hideCancelButton:{type:Boolean,default:!1},hideConfirmButton:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},width:{default:200},placement:{default:"top"},offset:{default:12},showArrow:{type:Boolean,default:!0}},emits:["confirm","cancel"],setup(t,{emit:a}){const o=t,r=a,n=e.ref(!1),s=e.ref(null),d=e.ref(null),h=e.ref({}),p=()=>{if(!s.value||!d.value)return;const c=s.value.getBoundingClientRect(),v=d.value.getBoundingClientRect(),$=o.placement,w=o.offset;let x=0,k=0;switch($){case"top":x=c.top-v.height-w,k=c.left+(c.width-v.width)/2;break;case"top-start":x=c.top-v.height-w,k=c.left;break;case"top-end":x=c.top-v.height-w,k=c.right-v.width;break;case"bottom":x=c.bottom+w,k=c.left+(c.width-v.width)/2;break;case"bottom-start":x=c.bottom+w,k=c.left;break;case"bottom-end":x=c.bottom+w,k=c.right-v.width;break;case"left":x=c.top+(c.height-v.height)/2,k=c.left-v.width-w;break;case"left-start":x=c.top,k=c.left-v.width-w;break;case"left-end":x=c.bottom-v.height,k=c.left-v.width-w;break;case"right":x=c.top+(c.height-v.height)/2,k=c.right+w;break;case"right-start":x=c.top,k=c.right+w;break;case"right-end":x=c.bottom-v.height,k=c.right+w;break;default:x=c.top-v.height-w,k=c.left+(c.width-v.width)/2}const R=window.innerWidth,O=window.innerHeight;k<0&&(k=10),k+v.width>R&&(k=R-v.width-10),x<0&&(x=10),x+v.height>O&&(x=O-v.height-10),h.value={position:"fixed",top:`${x}px`,left:`${k}px`,zIndex:"2000"}},i=c=>{var v,$;n.value&&((v=s.value)!=null&&v.contains(c.target)||($=d.value)!=null&&$.contains(c.target)||(n.value=!1))},C=c=>{o.disabled||(c.stopPropagation(),n.value=!n.value,n.value&&setTimeout(p,0))},m=()=>{n.value=!1,r("confirm")},y=()=>{n.value=!1,r("cancel")},f=()=>{n.value&&p()},u=()=>{n.value&&p()};e.watch(n,c=>{c?(setTimeout(p,0),document.addEventListener("click",i),window.addEventListener("scroll",f,!0),window.addEventListener("resize",u)):(document.removeEventListener("click",i),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",u))}),e.onUnmounted(()=>{document.removeEventListener("click",i),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",u)});const l=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width})),g=e.computed(()=>{const c=o.placement,v={};switch(c){case"top":case"top-start":case"top-end":v.bottom="-6px",v.transform="rotate(45deg)";break;case"bottom":case"bottom-start":case"bottom-end":v.top="-6px",v.transform="rotate(225deg)";break;case"left":case"left-start":case"left-end":v.right="-6px",v.transform="rotate(315deg)";break;case"right":case"right-start":case"right-end":v.left="-6px",v.transform="rotate(135deg)";break}return v});return(c,v)=>(e.openBlock(),e.createElementBlock("span",se,[e.createElementVNode("span",{ref_key:"triggerRef",ref:s,class:"x-popconfirm-trigger",onClick:C},[e.renderSlot(c.$slots,"default")],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-popconfirm-fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popperRef",ref:d,class:"x-popconfirm",style:e.normalizeStyle({...h.value,...l.value}),onClick:v[0]||(v[0]=e.withModifiers(()=>{},["stop"]))},[t.showArrow?(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__arrow",style:e.normalizeStyle(g.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",re,[t.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__icon",style:e.normalizeStyle({color:t.iconColor})},[e.renderSlot(c.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon||"⚠"),1)])],4)),e.createElementVNode("div",ie,[e.renderSlot(c.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])]),e.createElementVNode("div",ce,[t.hideCancelButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"x-button p-button--default p-button--small",onClick:y},e.toDisplayString(t.cancelButtonText),1)),t.hideConfirmButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["x-button x-button--small",`x-button--${t.confirmButtonType}`]),onClick:m},e.toDisplayString(t.confirmButtonText),3))])],4)):e.createCommentVNode("",!0)]),_:3})]))]))}}),ue=e.defineComponent({name:"XBacktop",__name:"index",props:{visibilityHeight:{default:200},right:{default:40},bottom:{default:40}},emits:["click"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("backtop"),s=e.ref(!1),d=()=>{const i=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;s.value=i>=o.visibilityHeight},h=i=>{window.scrollTo({top:0,behavior:"smooth"}),r("click",i)},p=e.computed(()=>({right:`${o.right}px`,bottom:`${o.bottom}px`}));return e.onMounted(()=>{window.addEventListener("scroll",d,{passive:!0,capture:!0}),setTimeout(d,100)}),e.onUnmounted(()=>{window.removeEventListener("scroll",d,!0)}),(i,C)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(p.value),onClick:h},[e.renderSlot(i.$slots,"default",{},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("icon"))},"↑",2)])],6),[[e.vShow,s.value]])]),_:3}))}}),me=e.defineComponent({name:"XTimeline",__name:"index",setup(t){const a=z.useNamespace("timeline");return(o,r)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(e.unref(a).b())},[e.renderSlot(o.$slots,"default")],2))}}),fe=e.defineComponent({name:"XTimelineItem",__name:"TimelineItem",props:{timestamp:{},placement:{default:"bottom"},type:{default:"primary"},color:{},size:{default:"normal"},icon:{},hollow:{type:Boolean,default:!1}},setup(t){const a=z.useNamespace("timeline-item");return(o,r)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass([e.unref(a).b(),e.unref(a).m(t.placement)])},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("tail"))},null,2),e.createElementVNode("div",{class:e.normalizeClass([e.unref(a).e("node"),e.unref(a).m(t.type),e.unref(a).is("hollow",t.hollow)]),style:e.normalizeStyle(t.color?{backgroundColor:t.color,borderColor:t.color}:void 0)},[e.renderSlot(o.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(a).e("icon"))},e.toDisplayString(t.icon),3)):e.createCommentVNode("",!0)])],6),e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("wrapper"))},[t.timestamp&&t.placement==="top"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(a).e("timestamp"))},e.toDisplayString(t.timestamp),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("content"))},[e.renderSlot(o.$slots,"default")],2),t.timestamp&&t.placement==="bottom"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(a).e("timestamp"))},e.toDisplayString(t.timestamp),3)):e.createCommentVNode("",!0)],2)],2))}}),pe=e.defineComponent({name:"XMessage",__name:"index",props:{message:{default:""},type:{default:"info"},duration:{default:3e3},showClose:{type:Boolean,default:!1},center:{type:Boolean,default:!1},offset:{default:20},customClass:{},onClose:{}},emits:["close","destroy"],setup(t,{expose:a,emit:o}){const r=t,n=o,s=z.useNamespace("message"),d=e.ref(!1),h=e.ref(z.nextMessageZIndex()),p={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},i=e.computed(()=>[s.b(),s.m(r.type),s.is("center",r.center),s.is("closable",r.showClose),r.customClass]),C=e.computed(()=>({top:`${r.offset}px`,zIndex:h.value}));let m=null;const y=()=>{r.duration>0&&(m=setTimeout(()=>{u()},r.duration))},f=()=>{m&&(clearTimeout(m),m=null)},u=()=>{var g;d.value=!1,(g=r.onClose)==null||g.call(r),n("close")},l=()=>{n("destroy")};return e.onMounted(()=>{y(),d.value=!0}),e.onUnmounted(()=>{f()}),a({close:u}),(g,c)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-message-fade",onAfterLeave:l},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(C.value),onMouseenter:f,onMouseleave:y},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(s).e("icon"))},e.toDisplayString(p[t.type]),3),e.createElementVNode("span",{class:e.normalizeClass(e.unref(s).e("content"))},[e.renderSlot(g.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(s).e("close")),onClick:u}," ✕ ",2)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:3}))}}),D=[];let he=1;const ge=()=>{D.slice().forEach(t=>t.close())};function U(t){const a=he++,o=document.createElement("div");document.body.appendChild(o);const r={success:{bg:"#f0f9eb",border:"#67c23a",icon:"✓"},warning:{bg:"#fdf6ec",border:"#e6a23c",icon:"⚠"},error:{bg:"#fef0f0",border:"#f56c6c",icon:"✕"},info:{bg:"#f4f4f5",border:"#909399",icon:"ℹ"}},n=t.type||"info",s=r[n]||r.info,d=e.reactive({visible:!1,offset:t.offset??20});let h=t.offset??20;D.forEach(l=>{const g=l.container.firstElementChild;g&&g.offsetHeight&&(h+=g.offsetHeight+16)}),d.offset=h;let p=null,i=!1;const C=()=>{i||(d.visible=!1,setTimeout(()=>{if(i)return;i=!0;const l=D.findIndex(g=>g.id===a);l!==-1&&D.splice(l,1);try{f.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o)},300))},m=()=>{const l=t.duration??3e3;l>0&&(p=setTimeout(C,l))},y=()=>{p&&(clearTimeout(p),p=null)},f=e.createApp({render(){if(!d.visible)return null;const l=[e.h("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",marginRight:"10px",fontSize:"16px",color:s.border}},s.icon),e.h("span",{style:{flex:"1",fontSize:"14px",color:"#606266",lineHeight:"1.4"}},t.message||"")];return t.showClose&&l.push(e.h("button",{style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:g=>{g.stopPropagation(),C()}},"✕")),e.h("div",{class:["x-message",`x-message--${n}`,t.center?"is-center":"",t.showClose?"is-closable":""],style:{position:"fixed",left:"50%",top:`${d.offset}px`,transform:"translateX(-50%)",display:"flex",alignItems:"center",padding:t.showClose?"12px 40px 12px 16px":"12px 16px",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0,0,0,0.1)",minWidth:"280px",maxWidth:"480px",backgroundColor:s.bg,border:`1px solid ${s.border}`,zIndex:2e3+a,transition:"opacity 0.3s, transform 0.3s"},onMouseenter:y,onMouseleave:m},l)}});f.mount(o),e.nextTick(()=>{d.visible=!0,m()});const u={id:a,app:f,container:o,close:C};return D.push(u),{close:C}}function ve(t){return U(typeof t=="string"?{message:t}:t)}const A=t=>a=>U({...typeof a=="string"?{message:a}:a,type:t}),j=Object.assign(ve,{info:A("info"),success:A("success"),warning:A("warning"),error:A("error"),closeAll:ge}),ye=j,Ce=pe,ke={install(t){t.config.globalProperties.$message=j,t.provide("message",j)}},L=[],be=()=>{L.slice().forEach(t=>t.close())},xe={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}};function F(t){return new Promise(a=>{const o=document.createElement("div");document.body.appendChild(o);let r=!1;const n=e.defineComponent({name:"TMessageBox",setup(){const h=e.ref(!1),p=e.ref(t.inputValue??""),i=e.ref(""),C=2e3+L.length+1,m=g=>{r||(r=!0,h.value=!1,setTimeout(()=>{const c=L.findIndex(v=>v.container===o);c!==-1&&L.splice(c,1);try{s.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o),a({action:g,value:g==="confirm"?p.value:void 0})},300))},y=()=>{if(t.showInput&&t.inputPattern&&!t.inputPattern.test(p.value)){i.value=t.inputErrorMessage||"输入格式不正确";return}i.value="",m("confirm")},f=()=>{m("cancel")},u=()=>{m("close")},l=()=>{t.closeOnClickModal!==!1&&u()};return e.nextTick(()=>{h.value=!0}),{visible:h,inputValue:p,inputError:i,zIndex:C,handleConfirm:y,handleCancel:f,handleClose:u,handleMaskClick:l}},render(){if(!this.visible)return null;const h=t.type,p=h?xe[h]:null,i=[];p&&i.push(e.h("span",{class:"x-message-box__icon",style:{color:p.color,marginRight:"10px",fontSize:"20px"}},p.icon)),i.push(e.h("span",{class:"x-message-box__title"},t.title||"提示")),t.showClose!==!1&&i.push(e.h("button",{class:"x-message-box__close",onClick:this.handleClose},"✕"));const C=[];C.push(e.h("div",{class:"x-message-box__content"},t.message||"")),t.showInput&&C.push(e.h("div",{class:"x-message-box__input",style:{marginTop:"12px"}},[e.h("input",{class:["x-message-box__input-inner",this.inputError?"is-error":""].filter(Boolean),type:t.inputType||"text",placeholder:t.inputPlaceholder||"请输入",value:this.inputValue,onInput:y=>{this.inputValue=y.target.value,this.inputError=""},onKeyup:y=>{y.key==="Enter"&&this.handleConfirm()}}),this.inputError?e.h("div",{class:"x-message-box__error",style:{color:"#f56c6c",fontSize:"12px",marginTop:"4px"}},this.inputError):null]));const m=[];return t.showCancelButton&&m.push(e.h("button",{class:"x-button p-button--default",onClick:this.handleCancel},t.cancelButtonText||"取消")),t.showConfirmButton!==!1&&m.push(e.h("button",{class:"x-button p-button--primary",onClick:this.handleConfirm,style:{marginLeft:"10px"}},t.confirmButtonText||"确定")),e.h("div",{class:["x-message-box-wrapper",t.center?"is-center":""],style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:this.zIndex},onClick:this.handleMaskClick},[e.h("div",{class:["x-message-box",t.customClass],style:{backgroundColor:"#fff",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",minWidth:"300px",maxWidth:"500px"},onClick:y=>y.stopPropagation()},[e.h("div",{class:"x-message-box__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #eee"}},i),e.h("div",{class:"x-message-box__body",style:{padding:"20px",fontSize:"14px",color:"#606266"}},C),e.h("div",{class:"x-message-box__footer",style:{padding:"10px 20px 16px",textAlign:"right"}},m)])])}}),s=e.createApp(n);s.mount(o);const d={app:s,container:o,close:()=>{var p;const h=(p=s._instance)==null?void 0:p.proxy;h!=null&&h.handleClose&&h.handleClose()}};L.push(d)})}async function we(t,a,o){return F({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!1})}async function Be(t,a,o){return F({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!0})}async function Ee(t,a,o){return F({message:t,title:a,...o,showInput:!0,showConfirmButton:!0,showCancelButton:!0})}function ze(t){return F(t)}const M=Object.assign(ze,{alert:we,confirm:Be,prompt:Ee,closeAll:be}),Ne=M,Te={install(t){t.config.globalProperties.$msgbox=M,t.config.globalProperties.$alert=M.alert,t.config.globalProperties.$confirm=M.confirm,t.config.globalProperties.$prompt=M.prompt,t.provide("messageBox",M)}},P=[];let Ve=1;const Se=()=>{P.slice().forEach(t=>t.close())},$e={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}},Me=(t,a)=>{const o=P.filter(n=>n.position===t);let r=16;for(const n of o)if(n.id<a){const s=n.container.firstElementChild;s&&(r+=s.offsetHeight+16)}return r},Ie=(t,a)=>{const o={position:"fixed",width:"330px",zIndex:"2010"};switch(t){case"top-right":o.top=`${a}px`,o.right="16px";break;case"top-left":o.top=`${a}px`,o.left="16px";break;case"bottom-right":o.bottom=`${a}px`,o.right="16px";break;case"bottom-left":o.bottom=`${a}px`,o.left="16px";break;default:o.top=`${a}px`,o.right="16px"}return o};function Z(t){const a=Ve++,o=t.position||"top-right",r=document.createElement("div");document.body.appendChild(r);let n=null,s=!1;const d=e.defineComponent({name:"TNotification",setup(){const i=e.ref(!1),C=()=>{s||(s=!0,i.value=!1,setTimeout(()=>{var g;const l=P.findIndex(c=>c.id===a);l!==-1&&P.splice(l,1),n&&clearTimeout(n),(g=t.onClose)==null||g.call(t);try{h.unmount()}catch{}r.parentNode&&r.parentNode.removeChild(r)},300))},m=()=>{const l=t.duration??4500;l>0&&(n=setTimeout(C,l))},y=()=>{n&&(clearTimeout(n),n=null)},f=e.computed(()=>(t.offset??0)+Me(o,a)),u=e.computed(()=>Ie(o,f.value));return e.nextTick(()=>{i.value=!0,m()}),{visible:i,close:C,positionStyles:u,startTimer:m,clearTimer:y}},render(){if(!this.visible)return null;const i=t.type,C=i?$e[i]:null,m=[];t.title&&m.push(e.h("div",{class:"x-notification__title",style:{fontWeight:"600",fontSize:"16px",color:"#303133",marginBottom:t.message?"6px":"0"}},t.title)),t.message&&(t.dangerouslyUseHTMLString?m.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"},innerHTML:t.message})):m.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"}},t.message)));const y=[];return C&&y.push(e.h("div",{class:"x-notification__icon",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",marginRight:"12px",fontSize:"18px",color:C.color}},C.icon)),y.push(e.h("div",{class:"x-notification__main",style:{flex:"1"}},m)),t.showClose!==!1&&y.push(e.h("button",{class:"x-notification__close",style:{position:"absolute",top:"18px",right:"15px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:f=>{f.stopPropagation(),this.close()}},"✕")),e.h("div",{class:["x-notification",t.customClass],style:{...this.positionStyles,display:"flex",alignItems:"flex-start",padding:"14px 26px 14px 13px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"opacity 0.3s, transform 0.3s",boxSizing:"border-box"},onMouseenter:this.clearTimer,onMouseleave:this.startTimer},y)}}),h=e.createApp(d);h.mount(r);const p={id:a,app:h,container:r,position:o,close:()=>{var C;const i=(C=h._instance)==null?void 0:C.proxy;i!=null&&i.close&&i.close()}};return P.push(p),{close:p.close}}function De(t){return Z(typeof t=="string"?{message:t}:t)}const H=t=>a=>Z({...typeof a=="string"?{message:a}:a,type:t}),q=Object.assign(De,{info:H("info"),success:H("success"),warning:H("warning"),error:H("error"),closeAll:Se}),Le=q,Pe={install(t){t.config.globalProperties.$notify=q,t.provide("notification",q)}};exports.Alert=le;exports.Backtop=ue;exports.Drawer=Y;exports.DrawerForm=ne;exports.Message=ye;exports.MessageBox=Ne;exports.MessageComponent=Ce;exports.Modal=K;exports.Notification=Le;exports.Popconfirm=de;exports.TMessage=ke;exports.TMessageBox=Te;exports.TNotification=Pe;exports.Timeline=me;exports.TimelineItem=fe;exports.Tooltip=ae;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@xto/core"),K=e.defineComponent({name:"XModal",inheritAttrs:!1,__name:"index",props:{modelValue:{type:Boolean,default:void 0},open:{type:Boolean,default:void 0},title:{default:""},width:{default:"50%"},top:{default:"15vh"},modal:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},center:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","update:open","close","open","ok","cancel"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("modal"),{next:s}=z.useZIndex(),u=e.ref(s()),h=e.computed({get:()=>o.modelValue!==void 0?o.modelValue:o.open!==void 0?o.open:!1,set:d=>{o.modelValue!==void 0&&r("update:modelValue",d),o.open!==void 0&&r("update:open",d),o.modelValue===void 0&&o.open===void 0&&r("update:modelValue",d)}}),p=e.ref(),i=()=>{h.value=!1,r("cancel"),r("close")},C=()=>{r("ok")},m=()=>{o.closeOnClickModal&&o.modal&&i()};z.useEscape(()=>{o.closeOnPressEscape&&h.value&&i()}),e.watch(()=>[o.modelValue,o.open],([d,l])=>{(d!==void 0?d:l)&&(u.value=s(),r("open"))},{immediate:!0});const y=e.computed(()=>({paddingTop:o.top})),f=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width,zIndex:u.value}));return(d,l)=>{const g=e.resolveComponent("x-button");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-modal-fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("wrapper")),style:e.normalizeStyle(y.value),onClick:m},[e.createElementVNode("div",{ref_key:"modalRef",ref:p,class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(f.value),onClick:l[0]||(l[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(d.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:i}," ✕ ",2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(d.$slots,"default")],2),d.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(d.$slots,"footer",{ok:C,cancel:i})],2)):d.$slots.footer?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.createVNode(g,{onClick:i},{default:e.withCtx(()=>[...l[1]||(l[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(g,{type:"primary",style:{"margin-left":"8px"},onClick:C},{default:e.withCtx(()=>[...l[2]||(l[2]=[e.createTextVNode("确定",-1)])]),_:1})],2))],6)],6)):e.createCommentVNode("",!0)]),_:3})])}}}),Y=e.defineComponent({name:"XDrawer",inheritAttrs:!1,__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},placement:{default:void 0},direction:{default:"rtl"},width:{default:void 0},size:{default:"30%"},withHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer"),s=e.ref(2e3),u=()=>{r("update:modelValue",!1),r("close")},h=()=>{o.closeOnClickModal&&u()},p=m=>{m.key==="Escape"&&o.modelValue&&u()};e.watch(()=>o.modelValue,m=>{m?(s.value=2e3+Math.floor(Math.random()*100),r("open"),document.addEventListener("keydown",p)):document.removeEventListener("keydown",p)});const i=e.computed(()=>({zIndex:s.value})),C=e.computed(()=>{const m=o.direction??o.placement??"rtl",y=o.size??o.width??"30%",f=typeof y=="number"?`${y}px`:y;return{ltr:{width:f,height:"100%"},rtl:{width:f,height:"100%"},ttb:{width:"100%",height:f},btt:{width:"100%",height:f}}[m]});return(m,y)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-drawer-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("overlay"),{[e.unref(n).em("overlay","no-modal")]:!t.modal}]),style:e.normalizeStyle(i.value),onClick:h},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).m(t.direction??t.placement??"rtl")]),style:e.normalizeStyle(C.value),onClick:y[0]||(y[0]=e.withModifiers(()=>{},["stop"]))},[t.withHeader?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(m.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("close")),onClick:u}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).e("body"),m.$slots.footer&&e.unref(n).em("body","has-footer")])},[e.renderSlot(m.$slots,"default")],2),m.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(m.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6),[[e.vShow,t.modelValue]])]),_:3})]))}}),G={key:0,class:"required-mark"},J=["value","placeholder","disabled","onInput"],Q=["value","placeholder","disabled","onInput"],_=["value","placeholder","disabled","onInput"],ee=["value","disabled","onChange"],te=["value"],oe=["disabled","onClick"],ne=e.defineComponent({name:"XDrawerForm",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:"配置"},size:{default:"400px"},fields:{default:()=>[]},formData:{default:()=>({})},showConfirm:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},confirmText:{default:"确认"},cancelText:{default:"取消"},disabled:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","confirm","cancel","close","field-change"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer-form"),s=e.ref({}),u=e.ref({});e.computed(()=>[n.b()]),e.watch(()=>o.formData,f=>{s.value={...f}},{immediate:!0,deep:!0});const h=e.computed(()=>typeof o.size=="number"?`${o.size}px`:o.size),p=()=>{r("update:modelValue",!1),r("close")},i=()=>{r("cancel"),p()},C=()=>{m()&&(r("confirm",s.value),p())},m=()=>{u.value={};for(const f of o.fields){if(f.required){const d=s.value[f.name];if(d==null||d===""){u.value[f.name]=`${f.label}为必填项`;continue}}if(f.rules)for(const d of f.rules){const l=s.value[f.name];d.type==="email"&&l&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l)&&(u.value[f.name]=d.message),d.type==="minLength"&&l&&l.length<d.min&&(u.value[f.name]=d.message)}}return Object.keys(u.value).length===0},y=(f,d)=>{s.value[f]=d,r("field-change",f,d)};return(f,d)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"drawer-form-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("overlay")),onClick:p},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle({width:h.value}),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("header"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("title"))},e.toDisplayString(t.title),3),e.createElementVNode("button",{class:e.normalizeClass(e.unref(n).e("close")),onClick:p},"✕",2)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[!t.destroyOnClose||t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("form"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,l=>(e.openBlock(),e.createElementBlock("div",{key:l.name,class:e.normalizeClass(e.unref(n).e("field"))},[e.createElementVNode("label",{class:e.normalizeClass(e.unref(n).e("label"))},[e.createTextVNode(e.toDisplayString(l.label)+" ",1),l.required?(e.openBlock(),e.createElementBlock("span",G,"*")):e.createCommentVNode("",!0)],2),l.type==="input"?(e.openBlock(),e.createElementBlock("input",{key:0,class:e.normalizeClass([e.unref(n).e("input"),{"has-error":u.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,onInput:g=>y(l.name,g.target.value)},null,42,J)):l.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,class:e.normalizeClass([e.unref(n).e("textarea"),{"has-error":u.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,rows:"4",onInput:g=>y(l.name,g.target.value)},null,42,Q)):l.type==="number"?(e.openBlock(),e.createElementBlock("input",{key:2,type:"number",class:e.normalizeClass([e.unref(n).e("input"),{"has-error":u.value[l.name]}]),value:s.value[l.name],placeholder:l.placeholder,disabled:t.disabled||l.disabled,onInput:g=>y(l.name,Number(g.target.value))},null,42,_)):l.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:3,class:e.normalizeClass([e.unref(n).e("select"),{"has-error":u.value[l.name]}]),value:s.value[l.name],disabled:t.disabled||l.disabled,onChange:g=>y(l.name,g.target.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,g=>(e.openBlock(),e.createElementBlock("option",{key:g.value,value:g.value},e.toDisplayString(g.label),9,te))),128))],42,ee)):l.type==="switch"?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(e.unref(n).e("switch"))},[e.createElementVNode("button",{class:e.normalizeClass(["switch-btn",{"is-on":s.value[l.name]}]),disabled:t.disabled||l.disabled,onClick:g=>y(l.name,!s.value[l.name])},e.toDisplayString(s.value[l.name]?"开启":"关闭"),11,oe)],2)):e.createCommentVNode("",!0),u.value[l.name]?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(e.unref(n).e("error"))},e.toDisplayString(u.value[l.name]),3)):e.createCommentVNode("",!0)],2))),128))],2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("footer"))},[t.showCancel?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(n).e("cancel")),onClick:i},e.toDisplayString(t.cancelText),3)):e.createCommentVNode("",!0),t.showConfirm?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(n).e("confirm")),onClick:C},e.toDisplayString(t.confirmText),3)):e.createCommentVNode("",!0)],2)],6)],2),[[e.vShow,t.modelValue]])]),_:1})]))}}),le=e.defineComponent({name:"XAlert",__name:"index",props:{type:{default:"info"},title:{default:""},description:{},closable:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!1},center:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("alert"),s=e.ref(!0),u={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},h=e.computed(()=>[n.b(),n.m(o.type),n.is("center",o.center),n.is("with-description",o.description)]),p=i=>{s.value=!1,r("close",i)};return(i,C)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-alert-fade"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(h.value)},[t.showIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("icon"))},e.toDisplayString(u[t.type]),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("content"))},[t.title||i.$slots.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(i.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2)):e.createCommentVNode("",!0),t.description||i.$slots.default?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("description"))},[e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)])],2)):e.createCommentVNode("",!0)],2),t.closable?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(e.unref(n).e("close")),onClick:p}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}}),ae=e.defineComponent({name:"XTooltip",__name:"index",props:{content:{default:""},placement:{default:"top"},effect:{default:"dark"},disabled:{type:Boolean,default:!1},offset:{default:8},transition:{default:"fade"},visibleArrow:{type:Boolean,default:!0},trigger:{default:"hover"},openDelay:{default:0},closeDelay:{default:0}},emits:["update:visible","show","hide"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("tooltip"),s=e.ref(!1),u=e.ref(),h=e.ref();let p,i;const C=e.ref({}),m=()=>{if(!u.value||!h.value)return;const b=u.value.getBoundingClientRect(),T=h.value;T.style.visibility="hidden",T.style.display="block";const N=T.offsetWidth,S=T.offsetHeight,V=o.offset,W=window.innerWidth,X=window.innerHeight;let B=0,E=0,I=o.placement;switch(o.placement){case"top":B=b.top-S-V,E=b.left+(b.width-N)/2;break;case"bottom":B=b.bottom+V,E=b.left+(b.width-N)/2;break;case"left":B=b.top+(b.height-S)/2,E=b.left-N-V;break;case"right":B=b.top+(b.height-S)/2,E=b.right+V;break}o.placement==="top"&&B<0?(I="bottom",B=b.bottom+V):o.placement==="bottom"&&B+S>X?(I="top",B=b.top-S-V):o.placement==="left"&&E<0?(I="right",E=b.right+V):o.placement==="right"&&E+N>W&&(I="left",E=b.left-N-V),E<8&&(E=8),E+N>W-8&&(E=W-N-8),B<8&&(B=8),B+S>X-8&&(B=X-S-8),C.value={position:"fixed",top:`${B}px`,left:`${E}px`,visibility:"visible",zIndex:"2000"},y.value=I},y=e.ref(o.placement),f=()=>{o.disabled||(clearTimeout(i),p=setTimeout(()=>{s.value=!0,r("update:visible",!0),r("show"),e.nextTick(()=>{m()})},o.openDelay))},d=()=>{clearTimeout(p),i=setTimeout(()=>{s.value=!1,r("update:visible",!1),r("hide")},o.closeDelay)},l=()=>{s.value?d():f()},g=()=>{o.trigger==="hover"&&f()},c=()=>{o.trigger==="hover"&&d()},v=()=>{o.trigger==="click"&&l()},$=()=>{o.trigger==="focus"&&f()},w=()=>{o.trigger==="focus"&&d()},x=b=>{var T,N;o.trigger==="click"&&!((T=u.value)!=null&&T.contains(b.target))&&!((N=h.value)!=null&&N.contains(b.target))&&d()},k=()=>{s.value&&m()};e.watch(s,b=>{b?e.nextTick(()=>{m(),o.trigger==="click"&&document.addEventListener("click",x),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k)}):(document.removeEventListener("click",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k))}),e.onUnmounted(()=>{clearTimeout(p),clearTimeout(i),document.removeEventListener("click",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)});const R=e.computed(()=>[n.b(),n.m(o.effect)]),O=e.computed(()=>[n.e("arrow"),n.e(`arrow-${y.value}`)]);return(b,T)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n).e("wrapper"))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:u,class:e.normalizeClass(e.unref(n).e("trigger")),onMouseenter:g,onMouseleave:c,onClick:v,onFocus:$,onBlur:w},[e.renderSlot(b.$slots,"default")],34),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:`x-tooltip-${t.transition}`},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"tooltipRef",ref:h,class:e.normalizeClass(R.value),style:e.normalizeStyle(C.value),onMouseenter:g,onMouseleave:c},[e.renderSlot(b.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)]),t.visibleArrow?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(O.value)},null,2)):e.createCommentVNode("",!0)],38),[[e.vShow,s.value]])]),_:3},8,["name"])]))],2))}}),se={class:"x-popconfirm-wrapper"},re={class:"x-popconfirm__main"},ie={class:"x-popconfirm__title"},ce={class:"x-popconfirm__action"},de=e.defineComponent({name:"XPopconfirm",__name:"index",props:{title:{default:""},confirmButtonText:{default:"确定"},cancelButtonText:{default:"取消"},confirmButtonType:{default:"primary"},cancelButtonType:{default:"default"},icon:{default:""},iconColor:{default:"#faad14"},hideIcon:{type:Boolean,default:!1},hideCancelButton:{type:Boolean,default:!1},hideConfirmButton:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},width:{default:200},placement:{default:"top"},offset:{default:12},showArrow:{type:Boolean,default:!0}},emits:["confirm","cancel"],setup(t,{emit:a}){const o=t,r=a,n=e.ref(!1),s=e.ref(null),u=e.ref(null),h=e.ref({}),p=()=>{if(!s.value||!u.value)return;const c=s.value.getBoundingClientRect(),v=u.value.getBoundingClientRect(),$=o.placement,w=o.offset;let x=0,k=0;switch($){case"top":x=c.top-v.height-w,k=c.left+(c.width-v.width)/2;break;case"top-start":x=c.top-v.height-w,k=c.left;break;case"top-end":x=c.top-v.height-w,k=c.right-v.width;break;case"bottom":x=c.bottom+w,k=c.left+(c.width-v.width)/2;break;case"bottom-start":x=c.bottom+w,k=c.left;break;case"bottom-end":x=c.bottom+w,k=c.right-v.width;break;case"left":x=c.top+(c.height-v.height)/2,k=c.left-v.width-w;break;case"left-start":x=c.top,k=c.left-v.width-w;break;case"left-end":x=c.bottom-v.height,k=c.left-v.width-w;break;case"right":x=c.top+(c.height-v.height)/2,k=c.right+w;break;case"right-start":x=c.top,k=c.right+w;break;case"right-end":x=c.bottom-v.height,k=c.right+w;break;default:x=c.top-v.height-w,k=c.left+(c.width-v.width)/2}const R=window.innerWidth,O=window.innerHeight;k<0&&(k=10),k+v.width>R&&(k=R-v.width-10),x<0&&(x=10),x+v.height>O&&(x=O-v.height-10),h.value={position:"fixed",top:`${x}px`,left:`${k}px`,zIndex:"2000"}},i=c=>{var v,$;n.value&&((v=s.value)!=null&&v.contains(c.target)||($=u.value)!=null&&$.contains(c.target)||(n.value=!1))},C=c=>{o.disabled||(c.stopPropagation(),n.value=!n.value,n.value&&setTimeout(p,0))},m=()=>{n.value=!1,r("confirm")},y=()=>{n.value=!1,r("cancel")},f=()=>{n.value&&p()},d=()=>{n.value&&p()};e.watch(n,c=>{c?(setTimeout(p,0),document.addEventListener("click",i),window.addEventListener("scroll",f,!0),window.addEventListener("resize",d)):(document.removeEventListener("click",i),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",d))}),e.onUnmounted(()=>{document.removeEventListener("click",i),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",d)});const l=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width})),g=e.computed(()=>{const c=o.placement,v={};switch(c){case"top":case"top-start":case"top-end":v.bottom="-6px",v.transform="rotate(45deg)";break;case"bottom":case"bottom-start":case"bottom-end":v.top="-6px",v.transform="rotate(225deg)";break;case"left":case"left-start":case"left-end":v.right="-6px",v.transform="rotate(315deg)";break;case"right":case"right-start":case"right-end":v.left="-6px",v.transform="rotate(135deg)";break}return v});return(c,v)=>(e.openBlock(),e.createElementBlock("span",se,[e.createElementVNode("span",{ref_key:"triggerRef",ref:s,class:"x-popconfirm-trigger",onClick:C},[e.renderSlot(c.$slots,"default")],512),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-popconfirm-fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popperRef",ref:u,class:"x-popconfirm",style:e.normalizeStyle({...h.value,...l.value}),onClick:v[0]||(v[0]=e.withModifiers(()=>{},["stop"]))},[t.showArrow?(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__arrow",style:e.normalizeStyle(g.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",re,[t.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__icon",style:e.normalizeStyle({color:t.iconColor})},[e.renderSlot(c.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon||"⚠"),1)])],4)),e.createElementVNode("div",ie,[e.renderSlot(c.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])]),e.createElementVNode("div",ce,[t.hideCancelButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"x-button p-button--default p-button--small",onClick:y},e.toDisplayString(t.cancelButtonText),1)),t.hideConfirmButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["x-button x-button--small",`x-button--${t.confirmButtonType}`]),onClick:m},e.toDisplayString(t.confirmButtonText),3))])],4)):e.createCommentVNode("",!0)]),_:3})]))]))}}),ue=e.defineComponent({name:"XBacktop",__name:"index",props:{visibilityHeight:{default:200},right:{default:40},bottom:{default:40}},emits:["click"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("backtop"),s=e.ref(!1),u=()=>{const i=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;s.value=i>=o.visibilityHeight},h=i=>{window.scrollTo({top:0,behavior:"smooth"}),r("click",i)},p=e.computed(()=>({right:`${o.right}px`,bottom:`${o.bottom}px`}));return e.onMounted(()=>{window.addEventListener("scroll",u,{passive:!0,capture:!0}),setTimeout(u,100)}),e.onUnmounted(()=>{window.removeEventListener("scroll",u,!0)}),(i,C)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(p.value),onClick:h},[e.renderSlot(i.$slots,"default",{},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("icon"))},"↑",2)])],6),[[e.vShow,s.value]])]),_:3}))}}),me=e.defineComponent({name:"XTimeline",__name:"index",setup(t){const a=z.useNamespace("timeline");return(o,r)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(e.unref(a).b())},[e.renderSlot(o.$slots,"default")],2))}}),fe=e.defineComponent({name:"XTimelineItem",__name:"TimelineItem",props:{timestamp:{},placement:{default:"bottom"},type:{default:"primary"},color:{},size:{default:"normal"},icon:{},hollow:{type:Boolean,default:!1}},setup(t){const a=z.useNamespace("timeline-item");return(o,r)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass([e.unref(a).b(),e.unref(a).m(t.placement)])},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("tail"))},null,2),e.createElementVNode("div",{class:e.normalizeClass([e.unref(a).e("node"),e.unref(a).m(t.type),e.unref(a).is("hollow",t.hollow)]),style:e.normalizeStyle(t.color?{backgroundColor:t.color,borderColor:t.color}:void 0)},[e.renderSlot(o.$slots,"icon",{},()=>[t.icon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(a).e("icon"))},e.toDisplayString(t.icon),3)):e.createCommentVNode("",!0)])],6),e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("wrapper"))},[t.timestamp&&t.placement==="top"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(a).e("timestamp"))},e.toDisplayString(t.timestamp),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(a).e("content"))},[e.renderSlot(o.$slots,"default")],2),t.timestamp&&t.placement==="bottom"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(a).e("timestamp"))},e.toDisplayString(t.timestamp),3)):e.createCommentVNode("",!0)],2)],2))}}),pe=e.defineComponent({name:"XMessage",__name:"index",props:{message:{default:""},type:{default:"info"},duration:{default:3e3},showClose:{type:Boolean,default:!1},center:{type:Boolean,default:!1},offset:{default:20},customClass:{},onClose:{}},emits:["close","destroy"],setup(t,{expose:a,emit:o}){const r=t,n=o,s=z.useNamespace("message"),u=e.ref(!1),h=e.ref(z.nextMessageZIndex()),p={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},i=e.computed(()=>[s.b(),s.m(r.type),s.is("center",r.center),s.is("closable",r.showClose),r.customClass]),C=e.computed(()=>({top:`${r.offset}px`,zIndex:h.value}));let m=null;const y=()=>{r.duration>0&&(m=setTimeout(()=>{d()},r.duration))},f=()=>{m&&(clearTimeout(m),m=null)},d=()=>{var g;u.value=!1,(g=r.onClose)==null||g.call(r),n("close")},l=()=>{n("destroy")};return e.onMounted(()=>{y(),u.value=!0}),e.onUnmounted(()=>{f()}),a({close:d}),(g,c)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-message-fade",onAfterLeave:l},{default:e.withCtx(()=>[u.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(C.value),onMouseenter:f,onMouseleave:y},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(s).e("icon"))},e.toDisplayString(p[t.type]),3),e.createElementVNode("span",{class:e.normalizeClass(e.unref(s).e("content"))},[e.renderSlot(g.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(s).e("close")),onClick:d}," ✕ ",2)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:3}))}}),D=[];let he=1;const ge=()=>{D.slice().forEach(t=>t.close())};function U(t){const a=he++,o=document.createElement("div");document.body.appendChild(o);const r={success:{bg:"#f0f9eb",border:"#67c23a",icon:"✓"},warning:{bg:"#fdf6ec",border:"#e6a23c",icon:"⚠"},error:{bg:"#fef0f0",border:"#f56c6c",icon:"✕"},info:{bg:"#f4f4f5",border:"#909399",icon:"ℹ"}},n=t.type||"info",s=r[n]||r.info,u=e.reactive({visible:!1,offset:t.offset??20});let h=t.offset??20;D.forEach(l=>{const g=l.container.firstElementChild;g&&g.offsetHeight&&(h+=g.offsetHeight+16)}),u.offset=h;let p=null,i=!1;const C=()=>{i||(u.visible=!1,setTimeout(()=>{if(i)return;i=!0;const l=D.findIndex(g=>g.id===a);l!==-1&&D.splice(l,1);try{f.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o)},300))},m=()=>{const l=t.duration??3e3;l>0&&(p=setTimeout(C,l))},y=()=>{p&&(clearTimeout(p),p=null)},f=e.createApp({render(){if(!u.visible)return null;const l=[e.h("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",marginRight:"10px",fontSize:"16px",color:s.border}},s.icon),e.h("span",{style:{flex:"1",fontSize:"14px",color:"#606266",lineHeight:"1.4"}},t.message||"")];return t.showClose&&l.push(e.h("button",{style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:g=>{g.stopPropagation(),C()}},"✕")),e.h("div",{class:["x-message",`x-message--${n}`,t.center?"is-center":"",t.showClose?"is-closable":""],style:{position:"fixed",left:"50%",top:`${u.offset}px`,transform:"translateX(-50%)",display:"flex",alignItems:"center",padding:t.showClose?"12px 40px 12px 16px":"12px 16px",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0,0,0,0.1)",minWidth:"280px",maxWidth:"480px",backgroundColor:s.bg,border:`1px solid ${s.border}`,zIndex:2e3+a,transition:"opacity 0.3s, transform 0.3s"},onMouseenter:y,onMouseleave:m},l)}});f.mount(o),e.nextTick(()=>{u.visible=!0,m()});const d={id:a,app:f,container:o,close:C};return D.push(d),{close:C}}function ve(t){return U(typeof t=="string"?{message:t}:t)}const A=t=>a=>U({...typeof a=="string"?{message:a}:a,type:t}),j=Object.assign(ve,{info:A("info"),success:A("success"),warning:A("warning"),error:A("error"),closeAll:ge}),ye=j,Ce=pe,ke={install(t){t.config.globalProperties.$message=j,t.provide("message",j)}},L=[],be=()=>{L.slice().forEach(t=>t.close())},xe={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}};function F(t){return new Promise(a=>{const o=document.createElement("div");document.body.appendChild(o);let r=!1;const n=e.defineComponent({name:"TMessageBox",setup(){const h=e.ref(!1),p=e.ref(t.inputValue??""),i=e.ref(""),C=2e3+L.length+1,m=g=>{r||(r=!0,h.value=!1,setTimeout(()=>{const c=L.findIndex(v=>v.container===o);c!==-1&&L.splice(c,1);try{s.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o),a({action:g,value:g==="confirm"?p.value:void 0})},300))},y=()=>{if(t.showInput&&t.inputPattern&&!t.inputPattern.test(p.value)){i.value=t.inputErrorMessage||"输入格式不正确";return}i.value="",m("confirm")},f=()=>{m("cancel")},d=()=>{m("close")},l=()=>{t.closeOnClickModal!==!1&&d()};return e.nextTick(()=>{h.value=!0}),{visible:h,inputValue:p,inputError:i,zIndex:C,handleConfirm:y,handleCancel:f,handleClose:d,handleMaskClick:l}},render(){if(!this.visible)return null;const h=t.type,p=h?xe[h]:null,i=[];p&&i.push(e.h("span",{class:"x-message-box__icon",style:{color:p.color,marginRight:"10px",fontSize:"20px"}},p.icon)),i.push(e.h("span",{class:"x-message-box__title"},t.title||"提示")),t.showClose!==!1&&i.push(e.h("button",{class:"x-message-box__close",onClick:this.handleClose},"✕"));const C=[];C.push(e.h("div",{class:"x-message-box__content"},t.message||"")),t.showInput&&C.push(e.h("div",{class:"x-message-box__input",style:{marginTop:"12px"}},[e.h("input",{class:["x-message-box__input-inner",this.inputError?"is-error":""].filter(Boolean),type:t.inputType||"text",placeholder:t.inputPlaceholder||"请输入",value:this.inputValue,onInput:y=>{this.inputValue=y.target.value,this.inputError=""},onKeyup:y=>{y.key==="Enter"&&this.handleConfirm()}}),this.inputError?e.h("div",{class:"x-message-box__error",style:{color:"#f56c6c",fontSize:"12px",marginTop:"4px"}},this.inputError):null]));const m=[];return t.showCancelButton&&m.push(e.h("button",{class:"x-button p-button--default",onClick:this.handleCancel},t.cancelButtonText||"取消")),t.showConfirmButton!==!1&&m.push(e.h("button",{class:"x-button p-button--primary",onClick:this.handleConfirm,style:{marginLeft:"10px"}},t.confirmButtonText||"确定")),e.h("div",{class:["x-message-box-wrapper",t.center?"is-center":""],style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:this.zIndex},onClick:this.handleMaskClick},[e.h("div",{class:["x-message-box",t.customClass],style:{backgroundColor:"#fff",borderRadius:"4px",boxShadow:"0 2px 12px rgba(0, 0, 0, 0.1)",minWidth:"300px",maxWidth:"500px"},onClick:y=>y.stopPropagation()},[e.h("div",{class:"x-message-box__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #eee"}},i),e.h("div",{class:"x-message-box__body",style:{padding:"20px",fontSize:"14px",color:"#606266"}},C),e.h("div",{class:"x-message-box__footer",style:{padding:"10px 20px 16px",textAlign:"right"}},m)])])}}),s=e.createApp(n);s.mount(o);const u={app:s,container:o,close:()=>{var p;const h=(p=s._instance)==null?void 0:p.proxy;h!=null&&h.handleClose&&h.handleClose()}};L.push(u)})}async function we(t,a,o){return F({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!1})}async function Be(t,a,o){return F({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!0})}async function Ee(t,a,o){return F({message:t,title:a,...o,showInput:!0,showConfirmButton:!0,showCancelButton:!0})}function ze(t){return F(t)}const M=Object.assign(ze,{alert:we,confirm:Be,prompt:Ee,closeAll:be}),Ne=M,Te={install(t){t.config.globalProperties.$msgbox=M,t.config.globalProperties.$alert=M.alert,t.config.globalProperties.$confirm=M.confirm,t.config.globalProperties.$prompt=M.prompt,t.provide("messageBox",M)}},P=[];let Ve=1;const Se=()=>{P.slice().forEach(t=>t.close())},$e={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}},Me=(t,a)=>{const o=P.filter(n=>n.position===t);let r=16;for(const n of o)if(n.id<a){const s=n.container.firstElementChild;s&&(r+=s.offsetHeight+16)}return r},Ie=(t,a)=>{const o={position:"fixed",width:"330px",zIndex:"2010"};switch(t){case"top-right":o.top=`${a}px`,o.right="16px";break;case"top-left":o.top=`${a}px`,o.left="16px";break;case"bottom-right":o.bottom=`${a}px`,o.right="16px";break;case"bottom-left":o.bottom=`${a}px`,o.left="16px";break;default:o.top=`${a}px`,o.right="16px"}return o};function Z(t){const a=Ve++,o=t.position||"top-right",r=document.createElement("div");document.body.appendChild(r);let n=null,s=!1;const u=e.defineComponent({name:"TNotification",setup(){const i=e.ref(!1),C=()=>{s||(s=!0,i.value=!1,setTimeout(()=>{var g;const l=P.findIndex(c=>c.id===a);l!==-1&&P.splice(l,1),n&&clearTimeout(n),(g=t.onClose)==null||g.call(t);try{h.unmount()}catch{}r.parentNode&&r.parentNode.removeChild(r)},300))},m=()=>{const l=t.duration??4500;l>0&&(n=setTimeout(C,l))},y=()=>{n&&(clearTimeout(n),n=null)},f=e.computed(()=>(t.offset??0)+Me(o,a)),d=e.computed(()=>Ie(o,f.value));return e.nextTick(()=>{i.value=!0,m()}),{visible:i,close:C,positionStyles:d,startTimer:m,clearTimer:y}},render(){if(!this.visible)return null;const i=t.type,C=i?$e[i]:null,m=[];t.title&&m.push(e.h("div",{class:"x-notification__title",style:{fontWeight:"600",fontSize:"16px",color:"#303133",marginBottom:t.message?"6px":"0"}},t.title)),t.message&&(t.dangerouslyUseHTMLString?m.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"},innerHTML:t.message})):m.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"}},t.message)));const y=[];return C&&y.push(e.h("div",{class:"x-notification__icon",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",marginRight:"12px",fontSize:"18px",color:C.color}},C.icon)),y.push(e.h("div",{class:"x-notification__main",style:{flex:"1"}},m)),t.showClose!==!1&&y.push(e.h("button",{class:"x-notification__close",style:{position:"absolute",top:"18px",right:"15px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#909399",padding:"0"},onClick:f=>{f.stopPropagation(),this.close()}},"✕")),e.h("div",{class:["x-notification",t.customClass],style:{...this.positionStyles,display:"flex",alignItems:"flex-start",padding:"14px 26px 14px 13px",borderRadius:"8px",backgroundColor:"#fff",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"opacity 0.3s, transform 0.3s",boxSizing:"border-box"},onMouseenter:this.clearTimer,onMouseleave:this.startTimer},y)}}),h=e.createApp(u);h.mount(r);const p={id:a,app:h,container:r,position:o,close:()=>{var C;const i=(C=h._instance)==null?void 0:C.proxy;i!=null&&i.close&&i.close()}};return P.push(p),{close:p.close}}function De(t){return Z(typeof t=="string"?{message:t}:t)}const H=t=>a=>Z({...typeof a=="string"?{message:a}:a,type:t}),q=Object.assign(De,{info:H("info"),success:H("success"),warning:H("warning"),error:H("error"),closeAll:Se}),Le=q,Pe={install(t){t.config.globalProperties.$notify=q,t.provide("notification",q)}};exports.Alert=le;exports.Backtop=ue;exports.Drawer=Y;exports.DrawerForm=ne;exports.Message=ye;exports.MessageBox=Ne;exports.MessageComponent=Ce;exports.Modal=K;exports.Notification=Le;exports.Popconfirm=de;exports.TMessage=ke;exports.TMessageBox=Te;exports.TNotification=Pe;exports.Timeline=me;exports.TimelineItem=fe;exports.Tooltip=ae;
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@xto/feedback",
3
- "version": "1.1.8",
4
- "description": "Xto Feedback - Feedback components",
5
- "homepage": "https://jinguchu.github.io/xto-ui/",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/jinguchu/xto-ui.git",
9
- "directory": "packages/feedback"
10
- },
11
- "main": "./lib/index.cjs",
12
- "module": "./es/index.mjs",
13
- "types": "./es/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "import": "./es/index.mjs",
17
- "require": "./lib/index.cjs",
18
- "types": "./es/index.d.ts"
19
- },
20
- "./style.css": "./es/style.css"
21
- },
22
- "files": [
23
- "es",
24
- "lib"
25
- ],
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "dependencies": {
30
- "@xto/core": "^1.0.3"
31
- },
32
- "peerDependencies": {
33
- "vue": "^3.4.0"
34
- },
35
- "devDependencies": {
36
- "@vitejs/plugin-vue": "^5.0.4",
37
- "@vitejs/plugin-vue-jsx": "^3.1.0",
38
- "typescript": "^5.4.2",
39
- "vite": "^5.2.0",
40
- "vitest": "^1.4.0",
41
- "vue": "^3.4.21",
42
- "@xto/build": "0.1.0"
43
- },
44
- "scripts": {
45
- "build": "vite build"
46
- }
47
- }
1
+ {
2
+ "name": "@xto/feedback",
3
+ "version": "1.1.9",
4
+ "description": "Xto Feedback - Feedback components",
5
+ "homepage": "https://jinguchu.github.io/xto-ui/",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/jinguchu/xto-ui.git",
9
+ "directory": "packages/feedback"
10
+ },
11
+ "main": "./lib/index.cjs",
12
+ "module": "./es/index.mjs",
13
+ "types": "./es/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./es/index.mjs",
17
+ "require": "./lib/index.cjs",
18
+ "types": "./es/index.d.ts"
19
+ },
20
+ "./style.css": "./es/style.css"
21
+ },
22
+ "files": [
23
+ "es",
24
+ "lib"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "vite build"
31
+ },
32
+ "dependencies": {
33
+ "@xto/core": "^1.0.3"
34
+ },
35
+ "peerDependencies": {
36
+ "vue": "^3.4.0"
37
+ },
38
+ "devDependencies": {
39
+ "@vitejs/plugin-vue": "^5.0.4",
40
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
41
+ "@xto/build": "workspace:*",
42
+ "typescript": "^5.4.2",
43
+ "vite": "^5.2.0",
44
+ "vitest": "^1.4.0",
45
+ "vue": "^3.4.21"
46
+ }
47
+ }