@xto/feedback 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +162 -159
- package/lib/index.cjs +1 -1
- package/package.json +2 -2
package/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as O, ref as E, computed as I, watch as ne, openBlock as v, createBlock as X, Teleport as le, createVNode as ie, Transition as j, withCtx as F, createElementBlock as $, normalizeStyle as N, normalizeClass as g, unref as x, createElementVNode as z, withModifiers as pe, renderSlot as L, createTextVNode as W, toDisplayString as V, createCommentVNode as M, nextTick as Q, onUnmounted as ae, withDirectives as he, vShow as ge, onMounted as ve, reactive as be, createApp as me, h as b } from "vue";
|
|
2
2
|
import { useNamespace as U, useZIndex as we, useEscape as Ce, nextMessageZIndex as ke } from "@xto/core";
|
|
3
|
-
const Ze = /* @__PURE__ */
|
|
3
|
+
const Ze = /* @__PURE__ */ O({
|
|
4
4
|
name: "XModal",
|
|
5
5
|
__name: "index",
|
|
6
6
|
props: {
|
|
@@ -19,16 +19,16 @@ const Ze = /* @__PURE__ */ N({
|
|
|
19
19
|
setup(e, { emit: l }) {
|
|
20
20
|
const t = e, a = l, o = U("modal"), { next: i } = we(), f = E(i()), d = I({
|
|
21
21
|
get: () => t.modelValue,
|
|
22
|
-
set: (
|
|
22
|
+
set: (p) => a("update:modelValue", p)
|
|
23
23
|
}), u = E(), n = () => {
|
|
24
24
|
d.value = !1, a("close");
|
|
25
|
-
},
|
|
25
|
+
}, m = () => {
|
|
26
26
|
t.closeOnClickModal && t.modal && n();
|
|
27
27
|
};
|
|
28
28
|
Ce(() => {
|
|
29
29
|
t.closeOnPressEscape && d.value && n();
|
|
30
|
-
}), ne(() => t.modelValue, (
|
|
31
|
-
|
|
30
|
+
}), ne(() => t.modelValue, (p) => {
|
|
31
|
+
p && (f.value = i(), a("open"));
|
|
32
32
|
});
|
|
33
33
|
const r = I(() => ({
|
|
34
34
|
paddingTop: t.top
|
|
@@ -36,49 +36,49 @@ const Ze = /* @__PURE__ */ N({
|
|
|
36
36
|
width: typeof t.width == "number" ? `${t.width}px` : t.width,
|
|
37
37
|
zIndex: f.value
|
|
38
38
|
}));
|
|
39
|
-
return (
|
|
39
|
+
return (p, B) => (v(), X(le, { to: "body" }, [
|
|
40
40
|
ie(j, { name: "x-modal-fade" }, {
|
|
41
41
|
default: F(() => [
|
|
42
|
-
e.modelValue ? (
|
|
42
|
+
e.modelValue ? (v(), $("div", {
|
|
43
43
|
key: 0,
|
|
44
|
-
class:
|
|
45
|
-
style:
|
|
46
|
-
onClick:
|
|
44
|
+
class: g(x(o).e("wrapper")),
|
|
45
|
+
style: N(r.value),
|
|
46
|
+
onClick: m
|
|
47
47
|
}, [
|
|
48
48
|
z("div", {
|
|
49
49
|
ref_key: "modalRef",
|
|
50
50
|
ref: u,
|
|
51
|
-
class:
|
|
52
|
-
style:
|
|
51
|
+
class: g(x(o).b()),
|
|
52
|
+
style: N(h.value),
|
|
53
53
|
onClick: B[0] || (B[0] = pe(() => {
|
|
54
54
|
}, ["stop"]))
|
|
55
55
|
}, [
|
|
56
56
|
z("div", {
|
|
57
|
-
class:
|
|
57
|
+
class: g(x(o).e("header"))
|
|
58
58
|
}, [
|
|
59
59
|
z("span", {
|
|
60
|
-
class:
|
|
60
|
+
class: g(x(o).e("title"))
|
|
61
61
|
}, [
|
|
62
|
-
L(
|
|
62
|
+
L(p.$slots, "title", {}, () => [
|
|
63
63
|
W(V(e.title), 1)
|
|
64
64
|
])
|
|
65
65
|
], 2),
|
|
66
|
-
e.showClose ? (
|
|
66
|
+
e.showClose ? (v(), $("button", {
|
|
67
67
|
key: 0,
|
|
68
|
-
class:
|
|
68
|
+
class: g(x(o).e("close")),
|
|
69
69
|
onClick: n
|
|
70
70
|
}, " ✕ ", 2)) : M("", !0)
|
|
71
71
|
], 2),
|
|
72
72
|
z("div", {
|
|
73
|
-
class:
|
|
73
|
+
class: g(x(o).e("body"))
|
|
74
74
|
}, [
|
|
75
|
-
L(
|
|
75
|
+
L(p.$slots, "default")
|
|
76
76
|
], 2),
|
|
77
|
-
|
|
77
|
+
p.$slots.footer ? (v(), $("div", {
|
|
78
78
|
key: 0,
|
|
79
|
-
class:
|
|
79
|
+
class: g(x(o).e("footer"))
|
|
80
80
|
}, [
|
|
81
|
-
L(
|
|
81
|
+
L(p.$slots, "footer")
|
|
82
82
|
], 2)) : M("", !0)
|
|
83
83
|
], 6)
|
|
84
84
|
], 6)) : M("", !0)
|
|
@@ -87,13 +87,16 @@ const Ze = /* @__PURE__ */ N({
|
|
|
87
87
|
})
|
|
88
88
|
]));
|
|
89
89
|
}
|
|
90
|
-
}), Ke = /* @__PURE__ */
|
|
90
|
+
}), Ke = /* @__PURE__ */ O({
|
|
91
91
|
name: "XDrawer",
|
|
92
|
+
inheritAttrs: !1,
|
|
92
93
|
__name: "index",
|
|
93
94
|
props: {
|
|
94
95
|
modelValue: { type: Boolean, default: !1 },
|
|
95
96
|
title: { default: "" },
|
|
97
|
+
placement: { default: void 0 },
|
|
96
98
|
direction: { default: "rtl" },
|
|
99
|
+
width: { default: void 0 },
|
|
97
100
|
size: { default: "30%" },
|
|
98
101
|
withHeader: { type: Boolean, default: !0 },
|
|
99
102
|
showClose: { type: Boolean, default: !0 },
|
|
@@ -114,55 +117,55 @@ const Ze = /* @__PURE__ */ N({
|
|
|
114
117
|
});
|
|
115
118
|
const n = I(() => ({
|
|
116
119
|
zIndex: i.value
|
|
117
|
-
})),
|
|
118
|
-
const r =
|
|
120
|
+
})), m = I(() => {
|
|
121
|
+
const r = t.direction ?? t.placement ?? "rtl", h = t.size ?? t.width ?? "30%", p = typeof h == "number" ? `${h}px` : h;
|
|
119
122
|
return {
|
|
120
|
-
ltr: { width:
|
|
121
|
-
rtl: { width:
|
|
122
|
-
ttb: { width: "100%", height:
|
|
123
|
-
btt: { width: "100%", height:
|
|
124
|
-
}[
|
|
123
|
+
ltr: { width: p, height: "100%" },
|
|
124
|
+
rtl: { width: p, height: "100%" },
|
|
125
|
+
ttb: { width: "100%", height: p },
|
|
126
|
+
btt: { width: "100%", height: p }
|
|
127
|
+
}[r];
|
|
125
128
|
});
|
|
126
|
-
return (r, h) => (
|
|
129
|
+
return (r, h) => (v(), X(le, { to: "body" }, [
|
|
127
130
|
ie(j, { name: "x-drawer-fade" }, {
|
|
128
131
|
default: F(() => [
|
|
129
|
-
e.modelValue ? (
|
|
132
|
+
e.modelValue ? (v(), $("div", {
|
|
130
133
|
key: 0,
|
|
131
|
-
class:
|
|
132
|
-
style:
|
|
134
|
+
class: g(x(o).e("overlay")),
|
|
135
|
+
style: N(n.value),
|
|
133
136
|
onClick: d
|
|
134
137
|
}, [
|
|
135
138
|
z("div", {
|
|
136
|
-
class:
|
|
137
|
-
style:
|
|
139
|
+
class: g([x(o).b(), x(o).m(e.direction ?? e.placement)]),
|
|
140
|
+
style: N(m.value),
|
|
138
141
|
onClick: h[0] || (h[0] = pe(() => {
|
|
139
142
|
}, ["stop"]))
|
|
140
143
|
}, [
|
|
141
|
-
e.withHeader ? (
|
|
144
|
+
e.withHeader ? (v(), $("div", {
|
|
142
145
|
key: 0,
|
|
143
|
-
class:
|
|
146
|
+
class: g(x(o).e("header"))
|
|
144
147
|
}, [
|
|
145
148
|
z("span", {
|
|
146
|
-
class:
|
|
149
|
+
class: g(x(o).e("title"))
|
|
147
150
|
}, [
|
|
148
151
|
L(r.$slots, "title", {}, () => [
|
|
149
152
|
W(V(e.title), 1)
|
|
150
153
|
])
|
|
151
154
|
], 2),
|
|
152
|
-
e.showClose ? (
|
|
155
|
+
e.showClose ? (v(), $("button", {
|
|
153
156
|
key: 0,
|
|
154
|
-
class:
|
|
157
|
+
class: g(x(o).e("close")),
|
|
155
158
|
onClick: f
|
|
156
159
|
}, " ✕ ", 2)) : M("", !0)
|
|
157
160
|
], 2)) : M("", !0),
|
|
158
161
|
z("div", {
|
|
159
|
-
class:
|
|
162
|
+
class: g(x(o).e("body"))
|
|
160
163
|
}, [
|
|
161
164
|
L(r.$slots, "default")
|
|
162
165
|
], 2),
|
|
163
|
-
r.$slots.footer ? (
|
|
166
|
+
r.$slots.footer ? (v(), $("div", {
|
|
164
167
|
key: 1,
|
|
165
|
-
class:
|
|
168
|
+
class: g(x(o).e("footer"))
|
|
166
169
|
}, [
|
|
167
170
|
L(r.$slots, "footer")
|
|
168
171
|
], 2)) : M("", !0)
|
|
@@ -173,7 +176,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
173
176
|
})
|
|
174
177
|
]));
|
|
175
178
|
}
|
|
176
|
-
}), Ue = /* @__PURE__ */
|
|
179
|
+
}), Ue = /* @__PURE__ */ O({
|
|
177
180
|
name: "XAlert",
|
|
178
181
|
__name: "index",
|
|
179
182
|
props: {
|
|
@@ -199,39 +202,39 @@ const Ze = /* @__PURE__ */ N({
|
|
|
199
202
|
]), u = (n) => {
|
|
200
203
|
i.value = !1, a("close", n);
|
|
201
204
|
};
|
|
202
|
-
return (n,
|
|
205
|
+
return (n, m) => (v(), X(j, { name: "x-alert-fade" }, {
|
|
203
206
|
default: F(() => [
|
|
204
|
-
i.value ? (
|
|
207
|
+
i.value ? (v(), $("div", {
|
|
205
208
|
key: 0,
|
|
206
|
-
class:
|
|
209
|
+
class: g(d.value)
|
|
207
210
|
}, [
|
|
208
|
-
e.showIcon ? (
|
|
211
|
+
e.showIcon ? (v(), $("span", {
|
|
209
212
|
key: 0,
|
|
210
|
-
class:
|
|
213
|
+
class: g(x(o).e("icon"))
|
|
211
214
|
}, V(f[e.type]), 3)) : M("", !0),
|
|
212
215
|
z("div", {
|
|
213
|
-
class:
|
|
216
|
+
class: g(x(o).e("content"))
|
|
214
217
|
}, [
|
|
215
|
-
e.title || n.$slots.title ? (
|
|
218
|
+
e.title || n.$slots.title ? (v(), $("span", {
|
|
216
219
|
key: 0,
|
|
217
|
-
class:
|
|
220
|
+
class: g(x(o).e("title"))
|
|
218
221
|
}, [
|
|
219
222
|
L(n.$slots, "title", {}, () => [
|
|
220
223
|
W(V(e.title), 1)
|
|
221
224
|
])
|
|
222
225
|
], 2)) : M("", !0),
|
|
223
|
-
e.description || n.$slots.default ? (
|
|
226
|
+
e.description || n.$slots.default ? (v(), $("span", {
|
|
224
227
|
key: 1,
|
|
225
|
-
class:
|
|
228
|
+
class: g(x(o).e("description"))
|
|
226
229
|
}, [
|
|
227
230
|
L(n.$slots, "default", {}, () => [
|
|
228
231
|
W(V(e.description), 1)
|
|
229
232
|
])
|
|
230
233
|
], 2)) : M("", !0)
|
|
231
234
|
], 2),
|
|
232
|
-
e.closable ? (
|
|
235
|
+
e.closable ? (v(), $("button", {
|
|
233
236
|
key: 1,
|
|
234
|
-
class:
|
|
237
|
+
class: g(x(o).e("close")),
|
|
235
238
|
onClick: u
|
|
236
239
|
}, " ✕ ", 2)) : M("", !0)
|
|
237
240
|
], 2)) : M("", !0)
|
|
@@ -239,7 +242,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
239
242
|
_: 3
|
|
240
243
|
}));
|
|
241
244
|
}
|
|
242
|
-
}), Ye = /* @__PURE__ */
|
|
245
|
+
}), Ye = /* @__PURE__ */ O({
|
|
243
246
|
name: "XTooltip",
|
|
244
247
|
__name: "index",
|
|
245
248
|
props: {
|
|
@@ -258,34 +261,34 @@ const Ze = /* @__PURE__ */ N({
|
|
|
258
261
|
setup(e, { emit: l }) {
|
|
259
262
|
const t = e, a = l, o = U("tooltip"), i = E(!1), f = E(), d = E();
|
|
260
263
|
let u, n;
|
|
261
|
-
const
|
|
264
|
+
const m = E({}), r = () => {
|
|
262
265
|
if (!f.value || !d.value) return;
|
|
263
|
-
const k = f.value.getBoundingClientRect(),
|
|
264
|
-
|
|
265
|
-
const
|
|
266
|
+
const k = f.value.getBoundingClientRect(), _ = d.value;
|
|
267
|
+
_.style.visibility = "hidden", _.style.display = "block";
|
|
268
|
+
const H = _.offsetWidth, D = _.offsetHeight, A = t.offset, ce = window.innerWidth, de = window.innerHeight;
|
|
266
269
|
let P = 0, R = 0, Y = t.placement;
|
|
267
270
|
switch (t.placement) {
|
|
268
271
|
case "top":
|
|
269
|
-
P = k.top - D - A, R = k.left + (k.width -
|
|
272
|
+
P = k.top - D - A, R = k.left + (k.width - H) / 2;
|
|
270
273
|
break;
|
|
271
274
|
case "bottom":
|
|
272
|
-
P = k.bottom + A, R = k.left + (k.width -
|
|
275
|
+
P = k.bottom + A, R = k.left + (k.width - H) / 2;
|
|
273
276
|
break;
|
|
274
277
|
case "left":
|
|
275
|
-
P = k.top + (k.height - D) / 2, R = k.left -
|
|
278
|
+
P = k.top + (k.height - D) / 2, R = k.left - H - A;
|
|
276
279
|
break;
|
|
277
280
|
case "right":
|
|
278
281
|
P = k.top + (k.height - D) / 2, R = k.right + A;
|
|
279
282
|
break;
|
|
280
283
|
}
|
|
281
|
-
t.placement === "top" && P < 0 ? (Y = "bottom", P = k.bottom + A) : t.placement === "bottom" && P + D > de ? (Y = "top", P = k.top - D - A) : t.placement === "left" && R < 0 ? (Y = "right", R = k.right + A) : t.placement === "right" && R +
|
|
284
|
+
t.placement === "top" && P < 0 ? (Y = "bottom", P = k.bottom + A) : t.placement === "bottom" && P + D > de ? (Y = "top", P = k.top - D - A) : t.placement === "left" && R < 0 ? (Y = "right", R = k.right + A) : t.placement === "right" && R + H > ce && (Y = "left", R = k.left - H - A), R < 8 && (R = 8), R + H > ce - 8 && (R = ce - H - 8), P < 8 && (P = 8), P + D > de - 8 && (P = de - D - 8), m.value = {
|
|
282
285
|
position: "fixed",
|
|
283
286
|
top: `${P}px`,
|
|
284
287
|
left: `${R}px`,
|
|
285
288
|
visibility: "visible",
|
|
286
289
|
zIndex: "2000"
|
|
287
290
|
}, h.value = Y;
|
|
288
|
-
}, h = E(t.placement),
|
|
291
|
+
}, h = E(t.placement), p = () => {
|
|
289
292
|
t.disabled || (clearTimeout(n), u = setTimeout(() => {
|
|
290
293
|
i.value = !0, a("update:visible", !0), a("show"), Q(() => {
|
|
291
294
|
r();
|
|
@@ -296,20 +299,20 @@ const Ze = /* @__PURE__ */ N({
|
|
|
296
299
|
i.value = !1, a("update:visible", !1), a("hide");
|
|
297
300
|
}, t.closeDelay);
|
|
298
301
|
}, w = () => {
|
|
299
|
-
i.value ? B() :
|
|
302
|
+
i.value ? B() : p();
|
|
300
303
|
}, C = () => {
|
|
301
|
-
t.trigger === "hover" &&
|
|
304
|
+
t.trigger === "hover" && p();
|
|
302
305
|
}, s = () => {
|
|
303
306
|
t.trigger === "hover" && B();
|
|
304
307
|
}, c = () => {
|
|
305
308
|
t.trigger === "click" && w();
|
|
306
309
|
}, Z = () => {
|
|
307
|
-
t.trigger === "focus" &&
|
|
310
|
+
t.trigger === "focus" && p();
|
|
308
311
|
}, S = () => {
|
|
309
312
|
t.trigger === "focus" && B();
|
|
310
313
|
}, T = (k) => {
|
|
311
|
-
var
|
|
312
|
-
t.trigger === "click" && !((
|
|
314
|
+
var _, H;
|
|
315
|
+
t.trigger === "click" && !((_ = f.value) != null && _.contains(k.target)) && !((H = d.value) != null && H.contains(k.target)) && B();
|
|
313
316
|
}, y = () => {
|
|
314
317
|
i.value && r();
|
|
315
318
|
};
|
|
@@ -327,13 +330,13 @@ const Ze = /* @__PURE__ */ N({
|
|
|
327
330
|
o.e("arrow"),
|
|
328
331
|
o.e(`arrow-${h.value}`)
|
|
329
332
|
]);
|
|
330
|
-
return (k,
|
|
331
|
-
class:
|
|
333
|
+
return (k, _) => (v(), $("div", {
|
|
334
|
+
class: g(x(o).e("wrapper"))
|
|
332
335
|
}, [
|
|
333
336
|
z("div", {
|
|
334
337
|
ref_key: "triggerRef",
|
|
335
338
|
ref: f,
|
|
336
|
-
class:
|
|
339
|
+
class: g(x(o).e("trigger")),
|
|
337
340
|
onMouseenter: C,
|
|
338
341
|
onMouseleave: s,
|
|
339
342
|
onClick: c,
|
|
@@ -342,7 +345,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
342
345
|
}, [
|
|
343
346
|
L(k.$slots, "default")
|
|
344
347
|
], 34),
|
|
345
|
-
(
|
|
348
|
+
(v(), X(le, { to: "body" }, [
|
|
346
349
|
ie(j, {
|
|
347
350
|
name: `x-tooltip-${e.transition}`
|
|
348
351
|
}, {
|
|
@@ -350,17 +353,17 @@ const Ze = /* @__PURE__ */ N({
|
|
|
350
353
|
he(z("div", {
|
|
351
354
|
ref_key: "tooltipRef",
|
|
352
355
|
ref: d,
|
|
353
|
-
class:
|
|
354
|
-
style:
|
|
356
|
+
class: g(ee.value),
|
|
357
|
+
style: N(m.value),
|
|
355
358
|
onMouseenter: C,
|
|
356
359
|
onMouseleave: s
|
|
357
360
|
}, [
|
|
358
361
|
L(k.$slots, "content", {}, () => [
|
|
359
362
|
W(V(e.content), 1)
|
|
360
363
|
]),
|
|
361
|
-
e.visibleArrow ? (
|
|
364
|
+
e.visibleArrow ? (v(), $("div", {
|
|
362
365
|
key: 0,
|
|
363
|
-
class:
|
|
366
|
+
class: g(te.value)
|
|
364
367
|
}, null, 2)) : M("", !0)
|
|
365
368
|
], 38), [
|
|
366
369
|
[ge, i.value]
|
|
@@ -371,7 +374,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
371
374
|
]))
|
|
372
375
|
], 2));
|
|
373
376
|
}
|
|
374
|
-
}), Be = { class: "x-popconfirm-wrapper" }, Te = { class: "x-popconfirm__main" }, $e = { class: "x-popconfirm__title" }, Ee = { class: "x-popconfirm__action" }, qe = /* @__PURE__ */
|
|
377
|
+
}), Be = { class: "x-popconfirm-wrapper" }, Te = { class: "x-popconfirm__main" }, $e = { class: "x-popconfirm__title" }, Ee = { class: "x-popconfirm__action" }, qe = /* @__PURE__ */ O({
|
|
375
378
|
name: "XPopconfirm",
|
|
376
379
|
__name: "index",
|
|
377
380
|
props: {
|
|
@@ -447,21 +450,21 @@ const Ze = /* @__PURE__ */ N({
|
|
|
447
450
|
}, n = (s) => {
|
|
448
451
|
var c, Z;
|
|
449
452
|
o.value && ((c = i.value) != null && c.contains(s.target) || (Z = f.value) != null && Z.contains(s.target) || (o.value = !1));
|
|
450
|
-
},
|
|
453
|
+
}, m = (s) => {
|
|
451
454
|
t.disabled || (s.stopPropagation(), o.value = !o.value, o.value && setTimeout(u, 0));
|
|
452
455
|
}, r = () => {
|
|
453
456
|
o.value = !1, a("confirm");
|
|
454
457
|
}, h = () => {
|
|
455
458
|
o.value = !1, a("cancel");
|
|
456
|
-
},
|
|
459
|
+
}, p = () => {
|
|
457
460
|
o.value && u();
|
|
458
461
|
}, B = () => {
|
|
459
462
|
o.value && u();
|
|
460
463
|
};
|
|
461
464
|
ne(o, (s) => {
|
|
462
|
-
s ? (setTimeout(u, 0), document.addEventListener("click", n), window.addEventListener("scroll",
|
|
465
|
+
s ? (setTimeout(u, 0), document.addEventListener("click", n), window.addEventListener("scroll", p, !0), window.addEventListener("resize", B)) : (document.removeEventListener("click", n), window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", B));
|
|
463
466
|
}), ae(() => {
|
|
464
|
-
document.removeEventListener("click", n), window.removeEventListener("scroll",
|
|
467
|
+
document.removeEventListener("click", n), window.removeEventListener("scroll", p, !0), window.removeEventListener("resize", B);
|
|
465
468
|
});
|
|
466
469
|
const w = I(() => ({
|
|
467
470
|
width: typeof t.width == "number" ? `${t.width}px` : t.width
|
|
@@ -491,37 +494,37 @@ const Ze = /* @__PURE__ */ N({
|
|
|
491
494
|
}
|
|
492
495
|
return c;
|
|
493
496
|
});
|
|
494
|
-
return (s, c) => (
|
|
497
|
+
return (s, c) => (v(), $("span", Be, [
|
|
495
498
|
z("span", {
|
|
496
499
|
ref_key: "triggerRef",
|
|
497
500
|
ref: i,
|
|
498
501
|
class: "x-popconfirm-trigger",
|
|
499
|
-
onClick:
|
|
502
|
+
onClick: m
|
|
500
503
|
}, [
|
|
501
504
|
L(s.$slots, "default")
|
|
502
505
|
], 512),
|
|
503
|
-
(
|
|
506
|
+
(v(), X(le, { to: "body" }, [
|
|
504
507
|
ie(j, { name: "x-popconfirm-fade" }, {
|
|
505
508
|
default: F(() => [
|
|
506
|
-
o.value ? (
|
|
509
|
+
o.value ? (v(), $("div", {
|
|
507
510
|
key: 0,
|
|
508
511
|
ref_key: "popperRef",
|
|
509
512
|
ref: f,
|
|
510
513
|
class: "x-popconfirm",
|
|
511
|
-
style:
|
|
514
|
+
style: N({ ...d.value, ...w.value }),
|
|
512
515
|
onClick: c[0] || (c[0] = pe(() => {
|
|
513
516
|
}, ["stop"]))
|
|
514
517
|
}, [
|
|
515
|
-
e.showArrow ? (
|
|
518
|
+
e.showArrow ? (v(), $("span", {
|
|
516
519
|
key: 0,
|
|
517
520
|
class: "x-popconfirm__arrow",
|
|
518
|
-
style:
|
|
521
|
+
style: N(C.value)
|
|
519
522
|
}, null, 4)) : M("", !0),
|
|
520
523
|
z("div", Te, [
|
|
521
|
-
e.hideIcon ? M("", !0) : (
|
|
524
|
+
e.hideIcon ? M("", !0) : (v(), $("span", {
|
|
522
525
|
key: 0,
|
|
523
526
|
class: "x-popconfirm__icon",
|
|
524
|
-
style:
|
|
527
|
+
style: N({ color: e.iconColor })
|
|
525
528
|
}, [
|
|
526
529
|
L(s.$slots, "icon", {}, () => [
|
|
527
530
|
W(V(e.icon || "⚠"), 1)
|
|
@@ -534,14 +537,14 @@ const Ze = /* @__PURE__ */ N({
|
|
|
534
537
|
])
|
|
535
538
|
]),
|
|
536
539
|
z("div", Ee, [
|
|
537
|
-
e.hideCancelButton ? M("", !0) : (
|
|
540
|
+
e.hideCancelButton ? M("", !0) : (v(), $("button", {
|
|
538
541
|
key: 0,
|
|
539
542
|
class: "x-button p-button--default p-button--small",
|
|
540
543
|
onClick: h
|
|
541
544
|
}, V(e.cancelButtonText), 1)),
|
|
542
|
-
e.hideConfirmButton ? M("", !0) : (
|
|
545
|
+
e.hideConfirmButton ? M("", !0) : (v(), $("button", {
|
|
543
546
|
key: 1,
|
|
544
|
-
class:
|
|
547
|
+
class: g(["x-button x-button--small", `x-button--${e.confirmButtonType}`]),
|
|
545
548
|
onClick: r
|
|
546
549
|
}, V(e.confirmButtonText), 3))
|
|
547
550
|
])
|
|
@@ -552,7 +555,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
552
555
|
]))
|
|
553
556
|
]));
|
|
554
557
|
}
|
|
555
|
-
}), Ge = /* @__PURE__ */
|
|
558
|
+
}), Ge = /* @__PURE__ */ O({
|
|
556
559
|
name: "XBacktop",
|
|
557
560
|
__name: "index",
|
|
558
561
|
props: {
|
|
@@ -574,20 +577,20 @@ const Ze = /* @__PURE__ */ N({
|
|
|
574
577
|
right: `${t.right}px`,
|
|
575
578
|
bottom: `${t.bottom}px`
|
|
576
579
|
}));
|
|
577
|
-
return
|
|
580
|
+
return ve(() => {
|
|
578
581
|
window.addEventListener("scroll", f, { passive: !0, capture: !0 }), setTimeout(f, 100);
|
|
579
582
|
}), ae(() => {
|
|
580
583
|
window.removeEventListener("scroll", f, !0);
|
|
581
|
-
}), (n,
|
|
584
|
+
}), (n, m) => (v(), X(j, { name: "x-fade" }, {
|
|
582
585
|
default: F(() => [
|
|
583
586
|
he(z("div", {
|
|
584
|
-
class:
|
|
585
|
-
style:
|
|
587
|
+
class: g(x(o).b()),
|
|
588
|
+
style: N(u.value),
|
|
586
589
|
onClick: d
|
|
587
590
|
}, [
|
|
588
591
|
L(n.$slots, "default", {}, () => [
|
|
589
592
|
z("span", {
|
|
590
|
-
class:
|
|
593
|
+
class: g(x(o).e("icon"))
|
|
591
594
|
}, "↑", 2)
|
|
592
595
|
])
|
|
593
596
|
], 6), [
|
|
@@ -597,7 +600,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
597
600
|
_: 3
|
|
598
601
|
}));
|
|
599
602
|
}
|
|
600
|
-
}), Me = /* @__PURE__ */
|
|
603
|
+
}), Me = /* @__PURE__ */ O({
|
|
601
604
|
name: "XMessage",
|
|
602
605
|
__name: "index",
|
|
603
606
|
props: {
|
|
@@ -623,7 +626,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
623
626
|
i.is("center", a.center),
|
|
624
627
|
i.is("closable", a.showClose),
|
|
625
628
|
a.customClass
|
|
626
|
-
]),
|
|
629
|
+
]), m = I(() => ({
|
|
627
630
|
top: `${a.offset}px`,
|
|
628
631
|
zIndex: d.value
|
|
629
632
|
}));
|
|
@@ -632,7 +635,7 @@ const Ze = /* @__PURE__ */ N({
|
|
|
632
635
|
a.duration > 0 && (r = setTimeout(() => {
|
|
633
636
|
B();
|
|
634
637
|
}, a.duration));
|
|
635
|
-
},
|
|
638
|
+
}, p = () => {
|
|
636
639
|
r && (clearTimeout(r), r = null);
|
|
637
640
|
}, B = () => {
|
|
638
641
|
var C;
|
|
@@ -640,37 +643,37 @@ const Ze = /* @__PURE__ */ N({
|
|
|
640
643
|
}, w = () => {
|
|
641
644
|
o("destroy");
|
|
642
645
|
};
|
|
643
|
-
return
|
|
646
|
+
return ve(() => {
|
|
644
647
|
h(), f.value = !0;
|
|
645
648
|
}), ae(() => {
|
|
646
|
-
|
|
649
|
+
p();
|
|
647
650
|
}), l({
|
|
648
651
|
close: B
|
|
649
|
-
}), (C, s) => (
|
|
652
|
+
}), (C, s) => (v(), X(j, {
|
|
650
653
|
name: "x-message-fade",
|
|
651
654
|
onAfterLeave: w
|
|
652
655
|
}, {
|
|
653
656
|
default: F(() => [
|
|
654
|
-
f.value ? (
|
|
657
|
+
f.value ? (v(), $("div", {
|
|
655
658
|
key: 0,
|
|
656
|
-
class:
|
|
657
|
-
style:
|
|
658
|
-
onMouseenter:
|
|
659
|
+
class: g(n.value),
|
|
660
|
+
style: N(m.value),
|
|
661
|
+
onMouseenter: p,
|
|
659
662
|
onMouseleave: h
|
|
660
663
|
}, [
|
|
661
664
|
z("span", {
|
|
662
|
-
class:
|
|
665
|
+
class: g(x(i).e("icon"))
|
|
663
666
|
}, V(u[e.type]), 3),
|
|
664
667
|
z("span", {
|
|
665
|
-
class:
|
|
668
|
+
class: g(x(i).e("content"))
|
|
666
669
|
}, [
|
|
667
670
|
L(C.$slots, "default", {}, () => [
|
|
668
671
|
W(V(e.message), 1)
|
|
669
672
|
])
|
|
670
673
|
], 2),
|
|
671
|
-
e.showClose ? (
|
|
674
|
+
e.showClose ? (v(), $("button", {
|
|
672
675
|
key: 0,
|
|
673
|
-
class:
|
|
676
|
+
class: g(x(i).e("close")),
|
|
674
677
|
onClick: B
|
|
675
678
|
}, " ✕ ", 2)) : M("", !0)
|
|
676
679
|
], 38)) : M("", !0)
|
|
@@ -683,7 +686,7 @@ let ze = 1;
|
|
|
683
686
|
const Se = () => {
|
|
684
687
|
q.slice().forEach((e) => e.close());
|
|
685
688
|
};
|
|
686
|
-
function
|
|
689
|
+
function xe(e) {
|
|
687
690
|
const l = ze++, t = document.createElement("div");
|
|
688
691
|
document.body.appendChild(t);
|
|
689
692
|
const a = {
|
|
@@ -701,24 +704,24 @@ function ve(e) {
|
|
|
701
704
|
C && C.offsetHeight && (d += C.offsetHeight + 16);
|
|
702
705
|
}), f.offset = d;
|
|
703
706
|
let u = null, n = !1;
|
|
704
|
-
const
|
|
707
|
+
const m = () => {
|
|
705
708
|
n || (f.visible = !1, setTimeout(() => {
|
|
706
709
|
if (n) return;
|
|
707
710
|
n = !0;
|
|
708
711
|
const w = q.findIndex((C) => C.id === l);
|
|
709
712
|
w !== -1 && q.splice(w, 1);
|
|
710
713
|
try {
|
|
711
|
-
|
|
714
|
+
p.unmount();
|
|
712
715
|
} catch {
|
|
713
716
|
}
|
|
714
717
|
t.parentNode && t.parentNode.removeChild(t);
|
|
715
718
|
}, 300));
|
|
716
719
|
}, r = () => {
|
|
717
720
|
const w = e.duration ?? 3e3;
|
|
718
|
-
w > 0 && (u = setTimeout(
|
|
721
|
+
w > 0 && (u = setTimeout(m, w));
|
|
719
722
|
}, h = () => {
|
|
720
723
|
u && (clearTimeout(u), u = null);
|
|
721
|
-
},
|
|
724
|
+
}, p = me({
|
|
722
725
|
render() {
|
|
723
726
|
if (!f.visible) return null;
|
|
724
727
|
const w = [
|
|
@@ -760,7 +763,7 @@ function ve(e) {
|
|
|
760
763
|
padding: "0"
|
|
761
764
|
},
|
|
762
765
|
onClick: (C) => {
|
|
763
|
-
C.stopPropagation(),
|
|
766
|
+
C.stopPropagation(), m();
|
|
764
767
|
}
|
|
765
768
|
}, "✕")
|
|
766
769
|
), b("div", {
|
|
@@ -787,16 +790,16 @@ function ve(e) {
|
|
|
787
790
|
}, w);
|
|
788
791
|
}
|
|
789
792
|
});
|
|
790
|
-
|
|
793
|
+
p.mount(t), Q(() => {
|
|
791
794
|
f.visible = !0, r();
|
|
792
795
|
});
|
|
793
|
-
const B = { id: l, app:
|
|
794
|
-
return q.push(B), { close:
|
|
796
|
+
const B = { id: l, app: p, container: t, close: m };
|
|
797
|
+
return q.push(B), { close: m };
|
|
795
798
|
}
|
|
796
799
|
function Ie(e) {
|
|
797
|
-
return
|
|
800
|
+
return xe(typeof e == "string" ? { message: e } : e);
|
|
798
801
|
}
|
|
799
|
-
const oe = (e) => (l) =>
|
|
802
|
+
const oe = (e) => (l) => xe({ ...typeof l == "string" ? { message: l } : l, type: e }), ue = Object.assign(Ie, {
|
|
800
803
|
info: oe("info"),
|
|
801
804
|
success: oe("success"),
|
|
802
805
|
warning: oe("warning"),
|
|
@@ -819,10 +822,10 @@ function re(e) {
|
|
|
819
822
|
const t = document.createElement("div");
|
|
820
823
|
document.body.appendChild(t);
|
|
821
824
|
let a = !1;
|
|
822
|
-
const o =
|
|
825
|
+
const o = O({
|
|
823
826
|
name: "TMessageBox",
|
|
824
827
|
setup() {
|
|
825
|
-
const d = E(!1), u = E(e.inputValue ?? ""), n = E(""),
|
|
828
|
+
const d = E(!1), u = E(e.inputValue ?? ""), n = E(""), m = 2e3 + G.length + 1, r = (C) => {
|
|
826
829
|
a || (a = !0, d.value = !1, setTimeout(() => {
|
|
827
830
|
const s = G.findIndex((c) => c.container === t);
|
|
828
831
|
s !== -1 && G.splice(s, 1);
|
|
@@ -841,7 +844,7 @@ function re(e) {
|
|
|
841
844
|
return;
|
|
842
845
|
}
|
|
843
846
|
n.value = "", r("confirm");
|
|
844
|
-
},
|
|
847
|
+
}, p = () => {
|
|
845
848
|
r("cancel");
|
|
846
849
|
}, B = () => {
|
|
847
850
|
r("close");
|
|
@@ -854,9 +857,9 @@ function re(e) {
|
|
|
854
857
|
visible: d,
|
|
855
858
|
inputValue: u,
|
|
856
859
|
inputError: n,
|
|
857
|
-
zIndex:
|
|
860
|
+
zIndex: m,
|
|
858
861
|
handleConfirm: h,
|
|
859
|
-
handleCancel:
|
|
862
|
+
handleCancel: p,
|
|
860
863
|
handleClose: B,
|
|
861
864
|
handleMaskClick: w
|
|
862
865
|
};
|
|
@@ -877,10 +880,10 @@ function re(e) {
|
|
|
877
880
|
onClick: this.handleClose
|
|
878
881
|
}, "✕")
|
|
879
882
|
);
|
|
880
|
-
const
|
|
881
|
-
|
|
883
|
+
const m = [];
|
|
884
|
+
m.push(
|
|
882
885
|
b("div", { class: "x-message-box__content" }, e.message || "")
|
|
883
|
-
), e.showInput &&
|
|
886
|
+
), e.showInput && m.push(
|
|
884
887
|
b("div", { class: "x-message-box__input", style: { marginTop: "12px" } }, [
|
|
885
888
|
b("input", {
|
|
886
889
|
class: ["x-message-box__input-inner", this.inputError ? "is-error" : ""].filter(Boolean),
|
|
@@ -955,7 +958,7 @@ function re(e) {
|
|
|
955
958
|
fontSize: "14px",
|
|
956
959
|
color: "#606266"
|
|
957
960
|
}
|
|
958
|
-
},
|
|
961
|
+
}, m),
|
|
959
962
|
// Footer
|
|
960
963
|
b("div", {
|
|
961
964
|
class: "x-message-box__footer",
|
|
@@ -999,7 +1002,7 @@ async function Ve(e, l, t) {
|
|
|
999
1002
|
showCancelButton: !0
|
|
1000
1003
|
});
|
|
1001
1004
|
}
|
|
1002
|
-
async function
|
|
1005
|
+
async function He(e, l, t) {
|
|
1003
1006
|
return re({
|
|
1004
1007
|
message: e,
|
|
1005
1008
|
title: l,
|
|
@@ -1009,21 +1012,21 @@ async function _e(e, l, t) {
|
|
|
1009
1012
|
showCancelButton: !0
|
|
1010
1013
|
});
|
|
1011
1014
|
}
|
|
1012
|
-
function
|
|
1015
|
+
function Ne(e) {
|
|
1013
1016
|
return re(e);
|
|
1014
1017
|
}
|
|
1015
|
-
const K = Object.assign(
|
|
1018
|
+
const K = Object.assign(Ne, {
|
|
1016
1019
|
alert: Re,
|
|
1017
1020
|
confirm: Ve,
|
|
1018
|
-
prompt:
|
|
1021
|
+
prompt: He,
|
|
1019
1022
|
closeAll: Le
|
|
1020
1023
|
}), tt = K, ot = {
|
|
1021
1024
|
install(e) {
|
|
1022
1025
|
e.config.globalProperties.$msgbox = K, e.config.globalProperties.$alert = K.alert, e.config.globalProperties.$confirm = K.confirm, e.config.globalProperties.$prompt = K.prompt, e.provide("messageBox", K);
|
|
1023
1026
|
}
|
|
1024
1027
|
}, J = [];
|
|
1025
|
-
let
|
|
1026
|
-
const
|
|
1028
|
+
let Oe = 1;
|
|
1029
|
+
const _e = () => {
|
|
1027
1030
|
J.slice().forEach((e) => e.close());
|
|
1028
1031
|
}, Ae = {
|
|
1029
1032
|
success: { icon: "✓", color: "#67c23a" },
|
|
@@ -1064,13 +1067,13 @@ const Oe = () => {
|
|
|
1064
1067
|
return t;
|
|
1065
1068
|
};
|
|
1066
1069
|
function ye(e) {
|
|
1067
|
-
const l =
|
|
1070
|
+
const l = Oe++, t = e.position || "top-right", a = document.createElement("div");
|
|
1068
1071
|
document.body.appendChild(a);
|
|
1069
1072
|
let o = null, i = !1;
|
|
1070
|
-
const f =
|
|
1073
|
+
const f = O({
|
|
1071
1074
|
name: "TNotification",
|
|
1072
1075
|
setup() {
|
|
1073
|
-
const n = E(!1),
|
|
1076
|
+
const n = E(!1), m = () => {
|
|
1074
1077
|
i || (i = !0, n.value = !1, setTimeout(() => {
|
|
1075
1078
|
var C;
|
|
1076
1079
|
const w = J.findIndex((s) => s.id === l);
|
|
@@ -1083,15 +1086,15 @@ function ye(e) {
|
|
|
1083
1086
|
}, 300));
|
|
1084
1087
|
}, r = () => {
|
|
1085
1088
|
const w = e.duration ?? 4500;
|
|
1086
|
-
w > 0 && (o = setTimeout(
|
|
1089
|
+
w > 0 && (o = setTimeout(m, w));
|
|
1087
1090
|
}, h = () => {
|
|
1088
1091
|
o && (clearTimeout(o), o = null);
|
|
1089
|
-
},
|
|
1092
|
+
}, p = I(() => (e.offset ?? 0) + We(t, l)), B = I(() => De(t, p.value));
|
|
1090
1093
|
return Q(() => {
|
|
1091
1094
|
n.value = !0, r();
|
|
1092
1095
|
}), {
|
|
1093
1096
|
visible: n,
|
|
1094
|
-
close:
|
|
1097
|
+
close: m,
|
|
1095
1098
|
positionStyles: B,
|
|
1096
1099
|
startTimer: r,
|
|
1097
1100
|
clearTimer: h
|
|
@@ -1099,7 +1102,7 @@ function ye(e) {
|
|
|
1099
1102
|
},
|
|
1100
1103
|
render() {
|
|
1101
1104
|
if (!this.visible) return null;
|
|
1102
|
-
const n = e.type,
|
|
1105
|
+
const n = e.type, m = n ? Ae[n] : null, r = [];
|
|
1103
1106
|
e.title && r.push(
|
|
1104
1107
|
b("div", {
|
|
1105
1108
|
class: "x-notification__title",
|
|
@@ -1131,7 +1134,7 @@ function ye(e) {
|
|
|
1131
1134
|
}, e.message)
|
|
1132
1135
|
));
|
|
1133
1136
|
const h = [];
|
|
1134
|
-
return
|
|
1137
|
+
return m && h.push(
|
|
1135
1138
|
b("div", {
|
|
1136
1139
|
class: "x-notification__icon",
|
|
1137
1140
|
style: {
|
|
@@ -1142,9 +1145,9 @@ function ye(e) {
|
|
|
1142
1145
|
height: "24px",
|
|
1143
1146
|
marginRight: "12px",
|
|
1144
1147
|
fontSize: "18px",
|
|
1145
|
-
color:
|
|
1148
|
+
color: m.color
|
|
1146
1149
|
}
|
|
1147
|
-
},
|
|
1150
|
+
}, m.icon)
|
|
1148
1151
|
), h.push(
|
|
1149
1152
|
b("div", {
|
|
1150
1153
|
class: "x-notification__main",
|
|
@@ -1166,8 +1169,8 @@ function ye(e) {
|
|
|
1166
1169
|
color: "#909399",
|
|
1167
1170
|
padding: "0"
|
|
1168
1171
|
},
|
|
1169
|
-
onClick: (
|
|
1170
|
-
|
|
1172
|
+
onClick: (p) => {
|
|
1173
|
+
p.stopPropagation(), this.close();
|
|
1171
1174
|
}
|
|
1172
1175
|
}, "✕")
|
|
1173
1176
|
), b("div", {
|
|
@@ -1195,8 +1198,8 @@ function ye(e) {
|
|
|
1195
1198
|
container: a,
|
|
1196
1199
|
position: t,
|
|
1197
1200
|
close: () => {
|
|
1198
|
-
var
|
|
1199
|
-
const n = (
|
|
1201
|
+
var m;
|
|
1202
|
+
const n = (m = d._instance) == null ? void 0 : m.proxy;
|
|
1200
1203
|
n != null && n.close && n.close();
|
|
1201
1204
|
}
|
|
1202
1205
|
};
|
|
@@ -1210,7 +1213,7 @@ const se = (e) => (l) => ye({ ...typeof l == "string" ? { message: l } : l, type
|
|
|
1210
1213
|
success: se("success"),
|
|
1211
1214
|
warning: se("warning"),
|
|
1212
1215
|
error: se("error"),
|
|
1213
|
-
closeAll:
|
|
1216
|
+
closeAll: _e
|
|
1214
1217
|
}), st = fe, nt = {
|
|
1215
1218
|
install(e) {
|
|
1216
1219
|
e.config.globalProperties.$notify = fe, e.provide("notification", fe);
|
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"),q=e.defineComponent({name:"XModal",__name:"index",props:{modelValue:{type:Boolean,default:!1},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","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("modal"),{next:i}=z.useZIndex(),m=e.ref(i()),u=e.computed({get:()=>o.modelValue,set:g=>r("update:modelValue",g)}),f=e.ref(),l=()=>{u.value=!1,r("close")},p=()=>{o.closeOnClickModal&&o.modal&&l()};z.useEscape(()=>{o.closeOnPressEscape&&u.value&&l()}),e.watch(()=>o.modelValue,g=>{g&&(m.value=i(),r("open"))});const c=e.computed(()=>({paddingTop:o.top})),h=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width,zIndex:m.value}));return(g,C)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-modal-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("wrapper")),style:e.normalizeStyle(c.value),onClick:p},[e.createElementVNode("div",{ref_key:"modalRef",ref:f,class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(h.value),onClick:C[0]||(C[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(g.$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:l}," ✕ ",2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(g.$slots,"default")],2),g.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(g.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),K=e.defineComponent({name:"XDrawer",__name:"index",props:{modelValue:{type:Boolean,default:!1},title:{default:""},direction:{default:"rtl"},size:{default:"30%"},withHeader:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer"),i=e.ref(2e3),m=()=>{r("update:modelValue",!1),r("close")},u=()=>{o.closeOnClickModal&&m()},f=c=>{c.key==="Escape"&&o.modelValue&&m()};e.watch(()=>o.modelValue,c=>{c?(i.value=2e3+Math.floor(Math.random()*100),r("open"),document.addEventListener("keydown",f)):document.removeEventListener("keydown",f)});const l=e.computed(()=>({zIndex:i.value})),p=e.computed(()=>{const c=typeof o.size=="number"?`${o.size}px`:o.size;return{ltr:{width:c,height:"100%"},rtl:{width:c,height:"100%"},ttb:{width:"100%",height:c},btt:{width:"100%",height:c}}[o.direction]});return(c,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-drawer-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("overlay")),style:e.normalizeStyle(l.value),onClick:u},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).m(t.direction)]),style:e.normalizeStyle(p.value),onClick:h[0]||(h[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(c.$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:m}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(c.$slots,"default")],2),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(c.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),Y=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"),i=e.ref(!0),m={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},u=e.computed(()=>[n.b(),n.m(o.type),n.is("center",o.center),n.is("with-description",o.description)]),f=l=>{i.value=!1,r("close",l)};return(l,p)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-alert-fade"},{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(u.value)},[t.showIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("icon"))},e.toDisplayString(m[t.type]),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("content"))},[t.title||l.$slots.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(l.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2)):e.createCommentVNode("",!0),t.description||l.$slots.default?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("description"))},[e.renderSlot(l.$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:f}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}}),G=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"),i=e.ref(!1),m=e.ref(),u=e.ref();let f,l;const p=e.ref({}),c=()=>{if(!m.value||!u.value)return;const b=m.value.getBoundingClientRect(),S=u.value;S.style.visibility="hidden",S.style.display="block";const E=S.offsetWidth,V=S.offsetHeight,N=o.offset,W=window.innerWidth,j=window.innerHeight;let B=0,T=0,I=o.placement;switch(o.placement){case"top":B=b.top-V-N,T=b.left+(b.width-E)/2;break;case"bottom":B=b.bottom+N,T=b.left+(b.width-E)/2;break;case"left":B=b.top+(b.height-V)/2,T=b.left-E-N;break;case"right":B=b.top+(b.height-V)/2,T=b.right+N;break}o.placement==="top"&&B<0?(I="bottom",B=b.bottom+N):o.placement==="bottom"&&B+V>j?(I="top",B=b.top-V-N):o.placement==="left"&&T<0?(I="right",T=b.right+N):o.placement==="right"&&T+E>W&&(I="left",T=b.left-E-N),T<8&&(T=8),T+E>W-8&&(T=W-E-8),B<8&&(B=8),B+V>j-8&&(B=j-V-8),p.value={position:"fixed",top:`${B}px`,left:`${T}px`,visibility:"visible",zIndex:"2000"},h.value=I},h=e.ref(o.placement),g=()=>{o.disabled||(clearTimeout(l),f=setTimeout(()=>{i.value=!0,r("update:visible",!0),r("show"),e.nextTick(()=>{c()})},o.openDelay))},C=()=>{clearTimeout(f),l=setTimeout(()=>{i.value=!1,r("update:visible",!1),r("hide")},o.closeDelay)},y=()=>{i.value?C():g()},v=()=>{o.trigger==="hover"&&g()},s=()=>{o.trigger==="hover"&&C()},d=()=>{o.trigger==="click"&&y()},$=()=>{o.trigger==="focus"&&g()},w=()=>{o.trigger==="focus"&&C()},k=b=>{var S,E;o.trigger==="click"&&!((S=m.value)!=null&&S.contains(b.target))&&!((E=u.value)!=null&&E.contains(b.target))&&C()},x=()=>{i.value&&c()};e.watch(i,b=>{b?e.nextTick(()=>{c(),o.trigger==="click"&&document.addEventListener("click",k),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x)}):(document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x))}),e.onUnmounted(()=>{clearTimeout(f),clearTimeout(l),document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)});const D=e.computed(()=>[n.b(),n.m(o.effect)]),_=e.computed(()=>[n.e("arrow"),n.e(`arrow-${h.value}`)]);return(b,S)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n).e("wrapper"))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:m,class:e.normalizeClass(e.unref(n).e("trigger")),onMouseenter:v,onMouseleave:s,onClick:d,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:u,class:e.normalizeClass(D.value),style:e.normalizeStyle(p.value),onMouseenter:v,onMouseleave:s},[e.renderSlot(b.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)]),t.visibleArrow?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(_.value)},null,2)):e.createCommentVNode("",!0)],38),[[e.vShow,i.value]])]),_:3},8,["name"])]))],2))}}),J={class:"x-popconfirm-wrapper"},Q={class:"x-popconfirm__main"},ee={class:"x-popconfirm__title"},te={class:"x-popconfirm__action"},oe=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),i=e.ref(null),m=e.ref(null),u=e.ref({}),f=()=>{if(!i.value||!m.value)return;const s=i.value.getBoundingClientRect(),d=m.value.getBoundingClientRect(),$=o.placement,w=o.offset;let k=0,x=0;switch($){case"top":k=s.top-d.height-w,x=s.left+(s.width-d.width)/2;break;case"top-start":k=s.top-d.height-w,x=s.left;break;case"top-end":k=s.top-d.height-w,x=s.right-d.width;break;case"bottom":k=s.bottom+w,x=s.left+(s.width-d.width)/2;break;case"bottom-start":k=s.bottom+w,x=s.left;break;case"bottom-end":k=s.bottom+w,x=s.right-d.width;break;case"left":k=s.top+(s.height-d.height)/2,x=s.left-d.width-w;break;case"left-start":k=s.top,x=s.left-d.width-w;break;case"left-end":k=s.bottom-d.height,x=s.left-d.width-w;break;case"right":k=s.top+(s.height-d.height)/2,x=s.right+w;break;case"right-start":k=s.top,x=s.right+w;break;case"right-end":k=s.bottom-d.height,x=s.right+w;break;default:k=s.top-d.height-w,x=s.left+(s.width-d.width)/2}const D=window.innerWidth,_=window.innerHeight;x<0&&(x=10),x+d.width>D&&(x=D-d.width-10),k<0&&(k=10),k+d.height>_&&(k=_-d.height-10),u.value={position:"fixed",top:`${k}px`,left:`${x}px`,zIndex:"2000"}},l=s=>{var d,$;n.value&&((d=i.value)!=null&&d.contains(s.target)||($=m.value)!=null&&$.contains(s.target)||(n.value=!1))},p=s=>{o.disabled||(s.stopPropagation(),n.value=!n.value,n.value&&setTimeout(f,0))},c=()=>{n.value=!1,r("confirm")},h=()=>{n.value=!1,r("cancel")},g=()=>{n.value&&f()},C=()=>{n.value&&f()};e.watch(n,s=>{s?(setTimeout(f,0),document.addEventListener("click",l),window.addEventListener("scroll",g,!0),window.addEventListener("resize",C)):(document.removeEventListener("click",l),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",C))}),e.onUnmounted(()=>{document.removeEventListener("click",l),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",C)});const y=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width})),v=e.computed(()=>{const s=o.placement,d={};switch(s){case"top":case"top-start":case"top-end":d.bottom="-6px",d.transform="rotate(45deg)";break;case"bottom":case"bottom-start":case"bottom-end":d.top="-6px",d.transform="rotate(225deg)";break;case"left":case"left-start":case"left-end":d.right="-6px",d.transform="rotate(315deg)";break;case"right":case"right-start":case"right-end":d.left="-6px",d.transform="rotate(135deg)";break}return d});return(s,d)=>(e.openBlock(),e.createElementBlock("span",J,[e.createElementVNode("span",{ref_key:"triggerRef",ref:i,class:"x-popconfirm-trigger",onClick:p},[e.renderSlot(s.$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:m,class:"x-popconfirm",style:e.normalizeStyle({...u.value,...y.value}),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},[t.showArrow?(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__arrow",style:e.normalizeStyle(v.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[t.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__icon",style:e.normalizeStyle({color:t.iconColor})},[e.renderSlot(s.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon||"⚠"),1)])],4)),e.createElementVNode("div",ee,[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])]),e.createElementVNode("div",te,[t.hideCancelButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"x-button p-button--default p-button--small",onClick:h},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:c},e.toDisplayString(t.confirmButtonText),3))])],4)):e.createCommentVNode("",!0)]),_:3})]))]))}}),ne=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"),i=e.ref(!1),m=()=>{const l=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;i.value=l>=o.visibilityHeight},u=l=>{window.scrollTo({top:0,behavior:"smooth"}),r("click",l)},f=e.computed(()=>({right:`${o.right}px`,bottom:`${o.bottom}px`}));return e.onMounted(()=>{window.addEventListener("scroll",m,{passive:!0,capture:!0}),setTimeout(m,100)}),e.onUnmounted(()=>{window.removeEventListener("scroll",m,!0)}),(l,p)=>(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(f.value),onClick:u},[e.renderSlot(l.$slots,"default",{},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("icon"))},"↑",2)])],6),[[e.vShow,i.value]])]),_:3}))}}),se=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,i=z.useNamespace("message"),m=e.ref(!1),u=e.ref(z.nextMessageZIndex()),f={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},l=e.computed(()=>[i.b(),i.m(r.type),i.is("center",r.center),i.is("closable",r.showClose),r.customClass]),p=e.computed(()=>({top:`${r.offset}px`,zIndex:u.value}));let c=null;const h=()=>{r.duration>0&&(c=setTimeout(()=>{C()},r.duration))},g=()=>{c&&(clearTimeout(c),c=null)},C=()=>{var v;m.value=!1,(v=r.onClose)==null||v.call(r),n("close")},y=()=>{n("destroy")};return e.onMounted(()=>{h(),m.value=!0}),e.onUnmounted(()=>{g()}),a({close:C}),(v,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-message-fade",onAfterLeave:y},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.value),style:e.normalizeStyle(p.value),onMouseenter:g,onMouseleave:h},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("icon"))},e.toDisplayString(f[t.type]),3),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("content"))},[e.renderSlot(v.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(i).e("close")),onClick:C}," ✕ ",2)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:3}))}}),L=[];let le=1;const ae=()=>{L.slice().forEach(t=>t.close())};function U(t){const a=le++,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",i=r[n]||r.info,m=e.reactive({visible:!1,offset:t.offset??20});let u=t.offset??20;L.forEach(y=>{const v=y.container.firstElementChild;v&&v.offsetHeight&&(u+=v.offsetHeight+16)}),m.offset=u;let f=null,l=!1;const p=()=>{l||(m.visible=!1,setTimeout(()=>{if(l)return;l=!0;const y=L.findIndex(v=>v.id===a);y!==-1&&L.splice(y,1);try{g.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o)},300))},c=()=>{const y=t.duration??3e3;y>0&&(f=setTimeout(p,y))},h=()=>{f&&(clearTimeout(f),f=null)},g=e.createApp({render(){if(!m.visible)return null;const y=[e.h("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",marginRight:"10px",fontSize:"16px",color:i.border}},i.icon),e.h("span",{style:{flex:"1",fontSize:"14px",color:"#606266",lineHeight:"1.4"}},t.message||"")];return t.showClose&&y.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:v=>{v.stopPropagation(),p()}},"✕")),e.h("div",{class:["x-message",`x-message--${n}`,t.center?"is-center":"",t.showClose?"is-closable":""],style:{position:"fixed",left:"50%",top:`${m.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:i.bg,border:`1px solid ${i.border}`,zIndex:2e3+a,transition:"opacity 0.3s, transform 0.3s"},onMouseenter:h,onMouseleave:c},y)}});g.mount(o),e.nextTick(()=>{m.visible=!0,c()});const C={id:a,app:g,container:o,close:p};return L.push(C),{close:p}}function ie(t){return U(typeof t=="string"?{message:t}:t)}const H=t=>a=>U({...typeof a=="string"?{message:a}:a,type:t}),X=Object.assign(ie,{info:H("info"),success:H("success"),warning:H("warning"),error:H("error"),closeAll:ae}),re=X,ce=se,de={install(t){t.config.globalProperties.$message=X,t.provide("message",X)}},P=[],ue=()=>{P.slice().forEach(t=>t.close())},fe={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}};function A(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 u=e.ref(!1),f=e.ref(t.inputValue??""),l=e.ref(""),p=2e3+P.length+1,c=v=>{r||(r=!0,u.value=!1,setTimeout(()=>{const s=P.findIndex(d=>d.container===o);s!==-1&&P.splice(s,1);try{i.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o),a({action:v,value:v==="confirm"?f.value:void 0})},300))},h=()=>{if(t.showInput&&t.inputPattern&&!t.inputPattern.test(f.value)){l.value=t.inputErrorMessage||"输入格式不正确";return}l.value="",c("confirm")},g=()=>{c("cancel")},C=()=>{c("close")},y=()=>{t.closeOnClickModal!==!1&&C()};return e.nextTick(()=>{u.value=!0}),{visible:u,inputValue:f,inputError:l,zIndex:p,handleConfirm:h,handleCancel:g,handleClose:C,handleMaskClick:y}},render(){if(!this.visible)return null;const u=t.type,f=u?fe[u]:null,l=[];f&&l.push(e.h("span",{class:"x-message-box__icon",style:{color:f.color,marginRight:"10px",fontSize:"20px"}},f.icon)),l.push(e.h("span",{class:"x-message-box__title"},t.title||"提示")),t.showClose!==!1&&l.push(e.h("button",{class:"x-message-box__close",onClick:this.handleClose},"✕"));const p=[];p.push(e.h("div",{class:"x-message-box__content"},t.message||"")),t.showInput&&p.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:h=>{this.inputValue=h.target.value,this.inputError=""},onKeyup:h=>{h.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 c=[];return t.showCancelButton&&c.push(e.h("button",{class:"x-button p-button--default",onClick:this.handleCancel},t.cancelButtonText||"取消")),t.showConfirmButton!==!1&&c.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:h=>h.stopPropagation()},[e.h("div",{class:"x-message-box__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #eee"}},l),e.h("div",{class:"x-message-box__body",style:{padding:"20px",fontSize:"14px",color:"#606266"}},p),e.h("div",{class:"x-message-box__footer",style:{padding:"10px 20px 16px",textAlign:"right"}},c)])])}}),i=e.createApp(n);i.mount(o);const m={app:i,container:o,close:()=>{var f;const u=(f=i._instance)==null?void 0:f.proxy;u!=null&&u.handleClose&&u.handleClose()}};P.push(m)})}async function me(t,a,o){return A({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!1})}async function pe(t,a,o){return A({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!0})}async function he(t,a,o){return A({message:t,title:a,...o,showInput:!0,showConfirmButton:!0,showCancelButton:!0})}function ge(t){return A(t)}const M=Object.assign(ge,{alert:me,confirm:pe,prompt:he,closeAll:ue}),xe=M,ye={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)}},R=[];let ve=1;const be=()=>{R.slice().forEach(t=>t.close())},Ce={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}},ke=(t,a)=>{const o=R.filter(n=>n.position===t);let r=16;for(const n of o)if(n.id<a){const i=n.container.firstElementChild;i&&(r+=i.offsetHeight+16)}return r},we=(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,i=!1;const m=e.defineComponent({name:"TNotification",setup(){const l=e.ref(!1),p=()=>{i||(i=!0,l.value=!1,setTimeout(()=>{var v;const y=R.findIndex(s=>s.id===a);y!==-1&&R.splice(y,1),n&&clearTimeout(n),(v=t.onClose)==null||v.call(t);try{u.unmount()}catch{}r.parentNode&&r.parentNode.removeChild(r)},300))},c=()=>{const y=t.duration??4500;y>0&&(n=setTimeout(p,y))},h=()=>{n&&(clearTimeout(n),n=null)},g=e.computed(()=>(t.offset??0)+ke(o,a)),C=e.computed(()=>we(o,g.value));return e.nextTick(()=>{l.value=!0,c()}),{visible:l,close:p,positionStyles:C,startTimer:c,clearTimer:h}},render(){if(!this.visible)return null;const l=t.type,p=l?Ce[l]:null,c=[];t.title&&c.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?c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"},innerHTML:t.message})):c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"}},t.message)));const h=[];return p&&h.push(e.h("div",{class:"x-notification__icon",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",marginRight:"12px",fontSize:"18px",color:p.color}},p.icon)),h.push(e.h("div",{class:"x-notification__main",style:{flex:"1"}},c)),t.showClose!==!1&&h.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:g=>{g.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},h)}}),u=e.createApp(m);u.mount(r);const f={id:a,app:u,container:r,position:o,close:()=>{var p;const l=(p=u._instance)==null?void 0:p.proxy;l!=null&&l.close&&l.close()}};return R.push(f),{close:f.close}}function Be(t){return Z(typeof t=="string"?{message:t}:t)}const O=t=>a=>Z({...typeof a=="string"?{message:a}:a,type:t}),F=Object.assign(Be,{info:O("info"),success:O("success"),warning:O("warning"),error:O("error"),closeAll:be}),Te=F,Ee={install(t){t.config.globalProperties.$notify=F,t.provide("notification",F)}};exports.Alert=Y;exports.Backtop=ne;exports.Drawer=K;exports.Message=re;exports.MessageBox=xe;exports.MessageComponent=ce;exports.Modal=q;exports.Notification=Te;exports.Popconfirm=oe;exports.TMessage=de;exports.TMessageBox=ye;exports.TNotification=Ee;exports.Tooltip=G;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),z=require("@xto/core"),q=e.defineComponent({name:"XModal",__name:"index",props:{modelValue:{type:Boolean,default:!1},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","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("modal"),{next:i}=z.useZIndex(),m=e.ref(i()),u=e.computed({get:()=>o.modelValue,set:p=>r("update:modelValue",p)}),f=e.ref(),l=()=>{u.value=!1,r("close")},h=()=>{o.closeOnClickModal&&o.modal&&l()};z.useEscape(()=>{o.closeOnPressEscape&&u.value&&l()}),e.watch(()=>o.modelValue,p=>{p&&(m.value=i(),r("open"))});const c=e.computed(()=>({paddingTop:o.top})),g=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width,zIndex:m.value}));return(p,C)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-modal-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("wrapper")),style:e.normalizeStyle(c.value),onClick:h},[e.createElementVNode("div",{ref_key:"modalRef",ref:f,class:e.normalizeClass(e.unref(n).b()),style:e.normalizeStyle(g.value),onClick:C[0]||(C[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(p.$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:l}," ✕ ",2)):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(p.$slots,"default")],2),p.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(p.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),K=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}},emits:["update:modelValue","close","open"],setup(t,{emit:a}){const o=t,r=a,n=z.useNamespace("drawer"),i=e.ref(2e3),m=()=>{r("update:modelValue",!1),r("close")},u=()=>{o.closeOnClickModal&&m()},f=c=>{c.key==="Escape"&&o.modelValue&&m()};e.watch(()=>o.modelValue,c=>{c?(i.value=2e3+Math.floor(Math.random()*100),r("open"),document.addEventListener("keydown",f)):document.removeEventListener("keydown",f)});const l=e.computed(()=>({zIndex:i.value})),h=e.computed(()=>{const c=o.direction??o.placement??"rtl",g=o.size??o.width??"30%",p=typeof g=="number"?`${g}px`:g;return{ltr:{width:p,height:"100%"},rtl:{width:p,height:"100%"},ttb:{width:"100%",height:p},btt:{width:"100%",height:p}}[c]});return(c,g)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"x-drawer-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n).e("overlay")),style:e.normalizeStyle(l.value),onClick:u},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(n).b(),e.unref(n).m(t.direction??t.placement)]),style:e.normalizeStyle(h.value),onClick:g[0]||(g[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(c.$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:m}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("body"))},[e.renderSlot(c.$slots,"default")],2),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n).e("footer"))},[e.renderSlot(c.$slots,"footer")],2)):e.createCommentVNode("",!0)],6)],6)):e.createCommentVNode("",!0)]),_:3})]))}}),Y=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"),i=e.ref(!0),m={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},u=e.computed(()=>[n.b(),n.m(o.type),n.is("center",o.center),n.is("with-description",o.description)]),f=l=>{i.value=!1,r("close",l)};return(l,h)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-alert-fade"},{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(u.value)},[t.showIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("icon"))},e.toDisplayString(m[t.type]),3)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(n).e("content"))},[t.title||l.$slots.title?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n).e("title"))},[e.renderSlot(l.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])],2)):e.createCommentVNode("",!0),t.description||l.$slots.default?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n).e("description"))},[e.renderSlot(l.$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:f}," ✕ ",2)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}}),G=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"),i=e.ref(!1),m=e.ref(),u=e.ref();let f,l;const h=e.ref({}),c=()=>{if(!m.value||!u.value)return;const b=m.value.getBoundingClientRect(),S=u.value;S.style.visibility="hidden",S.style.display="block";const E=S.offsetWidth,V=S.offsetHeight,N=o.offset,W=window.innerWidth,j=window.innerHeight;let B=0,T=0,I=o.placement;switch(o.placement){case"top":B=b.top-V-N,T=b.left+(b.width-E)/2;break;case"bottom":B=b.bottom+N,T=b.left+(b.width-E)/2;break;case"left":B=b.top+(b.height-V)/2,T=b.left-E-N;break;case"right":B=b.top+(b.height-V)/2,T=b.right+N;break}o.placement==="top"&&B<0?(I="bottom",B=b.bottom+N):o.placement==="bottom"&&B+V>j?(I="top",B=b.top-V-N):o.placement==="left"&&T<0?(I="right",T=b.right+N):o.placement==="right"&&T+E>W&&(I="left",T=b.left-E-N),T<8&&(T=8),T+E>W-8&&(T=W-E-8),B<8&&(B=8),B+V>j-8&&(B=j-V-8),h.value={position:"fixed",top:`${B}px`,left:`${T}px`,visibility:"visible",zIndex:"2000"},g.value=I},g=e.ref(o.placement),p=()=>{o.disabled||(clearTimeout(l),f=setTimeout(()=>{i.value=!0,r("update:visible",!0),r("show"),e.nextTick(()=>{c()})},o.openDelay))},C=()=>{clearTimeout(f),l=setTimeout(()=>{i.value=!1,r("update:visible",!1),r("hide")},o.closeDelay)},y=()=>{i.value?C():p()},v=()=>{o.trigger==="hover"&&p()},s=()=>{o.trigger==="hover"&&C()},d=()=>{o.trigger==="click"&&y()},$=()=>{o.trigger==="focus"&&p()},w=()=>{o.trigger==="focus"&&C()},k=b=>{var S,E;o.trigger==="click"&&!((S=m.value)!=null&&S.contains(b.target))&&!((E=u.value)!=null&&E.contains(b.target))&&C()},x=()=>{i.value&&c()};e.watch(i,b=>{b?e.nextTick(()=>{c(),o.trigger==="click"&&document.addEventListener("click",k),window.addEventListener("scroll",x,!0),window.addEventListener("resize",x)}):(document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x))}),e.onUnmounted(()=>{clearTimeout(f),clearTimeout(l),document.removeEventListener("click",k),window.removeEventListener("scroll",x,!0),window.removeEventListener("resize",x)});const D=e.computed(()=>[n.b(),n.m(o.effect)]),H=e.computed(()=>[n.e("arrow"),n.e(`arrow-${g.value}`)]);return(b,S)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n).e("wrapper"))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:m,class:e.normalizeClass(e.unref(n).e("trigger")),onMouseenter:v,onMouseleave:s,onClick:d,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:u,class:e.normalizeClass(D.value),style:e.normalizeStyle(h.value),onMouseenter:v,onMouseleave:s},[e.renderSlot(b.$slots,"content",{},()=>[e.createTextVNode(e.toDisplayString(t.content),1)]),t.visibleArrow?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(H.value)},null,2)):e.createCommentVNode("",!0)],38),[[e.vShow,i.value]])]),_:3},8,["name"])]))],2))}}),J={class:"x-popconfirm-wrapper"},Q={class:"x-popconfirm__main"},ee={class:"x-popconfirm__title"},te={class:"x-popconfirm__action"},oe=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),i=e.ref(null),m=e.ref(null),u=e.ref({}),f=()=>{if(!i.value||!m.value)return;const s=i.value.getBoundingClientRect(),d=m.value.getBoundingClientRect(),$=o.placement,w=o.offset;let k=0,x=0;switch($){case"top":k=s.top-d.height-w,x=s.left+(s.width-d.width)/2;break;case"top-start":k=s.top-d.height-w,x=s.left;break;case"top-end":k=s.top-d.height-w,x=s.right-d.width;break;case"bottom":k=s.bottom+w,x=s.left+(s.width-d.width)/2;break;case"bottom-start":k=s.bottom+w,x=s.left;break;case"bottom-end":k=s.bottom+w,x=s.right-d.width;break;case"left":k=s.top+(s.height-d.height)/2,x=s.left-d.width-w;break;case"left-start":k=s.top,x=s.left-d.width-w;break;case"left-end":k=s.bottom-d.height,x=s.left-d.width-w;break;case"right":k=s.top+(s.height-d.height)/2,x=s.right+w;break;case"right-start":k=s.top,x=s.right+w;break;case"right-end":k=s.bottom-d.height,x=s.right+w;break;default:k=s.top-d.height-w,x=s.left+(s.width-d.width)/2}const D=window.innerWidth,H=window.innerHeight;x<0&&(x=10),x+d.width>D&&(x=D-d.width-10),k<0&&(k=10),k+d.height>H&&(k=H-d.height-10),u.value={position:"fixed",top:`${k}px`,left:`${x}px`,zIndex:"2000"}},l=s=>{var d,$;n.value&&((d=i.value)!=null&&d.contains(s.target)||($=m.value)!=null&&$.contains(s.target)||(n.value=!1))},h=s=>{o.disabled||(s.stopPropagation(),n.value=!n.value,n.value&&setTimeout(f,0))},c=()=>{n.value=!1,r("confirm")},g=()=>{n.value=!1,r("cancel")},p=()=>{n.value&&f()},C=()=>{n.value&&f()};e.watch(n,s=>{s?(setTimeout(f,0),document.addEventListener("click",l),window.addEventListener("scroll",p,!0),window.addEventListener("resize",C)):(document.removeEventListener("click",l),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",C))}),e.onUnmounted(()=>{document.removeEventListener("click",l),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",C)});const y=e.computed(()=>({width:typeof o.width=="number"?`${o.width}px`:o.width})),v=e.computed(()=>{const s=o.placement,d={};switch(s){case"top":case"top-start":case"top-end":d.bottom="-6px",d.transform="rotate(45deg)";break;case"bottom":case"bottom-start":case"bottom-end":d.top="-6px",d.transform="rotate(225deg)";break;case"left":case"left-start":case"left-end":d.right="-6px",d.transform="rotate(315deg)";break;case"right":case"right-start":case"right-end":d.left="-6px",d.transform="rotate(135deg)";break}return d});return(s,d)=>(e.openBlock(),e.createElementBlock("span",J,[e.createElementVNode("span",{ref_key:"triggerRef",ref:i,class:"x-popconfirm-trigger",onClick:h},[e.renderSlot(s.$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:m,class:"x-popconfirm",style:e.normalizeStyle({...u.value,...y.value}),onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},[t.showArrow?(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__arrow",style:e.normalizeStyle(v.value)},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[t.hideIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"x-popconfirm__icon",style:e.normalizeStyle({color:t.iconColor})},[e.renderSlot(s.$slots,"icon",{},()=>[e.createTextVNode(e.toDisplayString(t.icon||"⚠"),1)])],4)),e.createElementVNode("div",ee,[e.renderSlot(s.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)])])]),e.createElementVNode("div",te,[t.hideCancelButton?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"x-button p-button--default p-button--small",onClick:g},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:c},e.toDisplayString(t.confirmButtonText),3))])],4)):e.createCommentVNode("",!0)]),_:3})]))]))}}),ne=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"),i=e.ref(!1),m=()=>{const l=window.scrollY||document.documentElement.scrollTop||document.body.scrollTop||0;i.value=l>=o.visibilityHeight},u=l=>{window.scrollTo({top:0,behavior:"smooth"}),r("click",l)},f=e.computed(()=>({right:`${o.right}px`,bottom:`${o.bottom}px`}));return e.onMounted(()=>{window.addEventListener("scroll",m,{passive:!0,capture:!0}),setTimeout(m,100)}),e.onUnmounted(()=>{window.removeEventListener("scroll",m,!0)}),(l,h)=>(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(f.value),onClick:u},[e.renderSlot(l.$slots,"default",{},()=>[e.createElementVNode("span",{class:e.normalizeClass(e.unref(n).e("icon"))},"↑",2)])],6),[[e.vShow,i.value]])]),_:3}))}}),se=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,i=z.useNamespace("message"),m=e.ref(!1),u=e.ref(z.nextMessageZIndex()),f={success:"✓",warning:"⚠",error:"✕",info:"ℹ"},l=e.computed(()=>[i.b(),i.m(r.type),i.is("center",r.center),i.is("closable",r.showClose),r.customClass]),h=e.computed(()=>({top:`${r.offset}px`,zIndex:u.value}));let c=null;const g=()=>{r.duration>0&&(c=setTimeout(()=>{C()},r.duration))},p=()=>{c&&(clearTimeout(c),c=null)},C=()=>{var v;m.value=!1,(v=r.onClose)==null||v.call(r),n("close")},y=()=>{n("destroy")};return e.onMounted(()=>{g(),m.value=!0}),e.onUnmounted(()=>{p()}),a({close:C}),(v,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"x-message-fade",onAfterLeave:y},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.value),style:e.normalizeStyle(h.value),onMouseenter:p,onMouseleave:g},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("icon"))},e.toDisplayString(f[t.type]),3),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i).e("content"))},[e.renderSlot(v.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)])],2),t.showClose?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(e.unref(i).e("close")),onClick:C}," ✕ ",2)):e.createCommentVNode("",!0)],38)):e.createCommentVNode("",!0)]),_:3}))}}),L=[];let le=1;const ae=()=>{L.slice().forEach(t=>t.close())};function U(t){const a=le++,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",i=r[n]||r.info,m=e.reactive({visible:!1,offset:t.offset??20});let u=t.offset??20;L.forEach(y=>{const v=y.container.firstElementChild;v&&v.offsetHeight&&(u+=v.offsetHeight+16)}),m.offset=u;let f=null,l=!1;const h=()=>{l||(m.visible=!1,setTimeout(()=>{if(l)return;l=!0;const y=L.findIndex(v=>v.id===a);y!==-1&&L.splice(y,1);try{p.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o)},300))},c=()=>{const y=t.duration??3e3;y>0&&(f=setTimeout(h,y))},g=()=>{f&&(clearTimeout(f),f=null)},p=e.createApp({render(){if(!m.visible)return null;const y=[e.h("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",marginRight:"10px",fontSize:"16px",color:i.border}},i.icon),e.h("span",{style:{flex:"1",fontSize:"14px",color:"#606266",lineHeight:"1.4"}},t.message||"")];return t.showClose&&y.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:v=>{v.stopPropagation(),h()}},"✕")),e.h("div",{class:["x-message",`x-message--${n}`,t.center?"is-center":"",t.showClose?"is-closable":""],style:{position:"fixed",left:"50%",top:`${m.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:i.bg,border:`1px solid ${i.border}`,zIndex:2e3+a,transition:"opacity 0.3s, transform 0.3s"},onMouseenter:g,onMouseleave:c},y)}});p.mount(o),e.nextTick(()=>{m.visible=!0,c()});const C={id:a,app:p,container:o,close:h};return L.push(C),{close:h}}function ie(t){return U(typeof t=="string"?{message:t}:t)}const O=t=>a=>U({...typeof a=="string"?{message:a}:a,type:t}),X=Object.assign(ie,{info:O("info"),success:O("success"),warning:O("warning"),error:O("error"),closeAll:ae}),re=X,ce=se,de={install(t){t.config.globalProperties.$message=X,t.provide("message",X)}},P=[],ue=()=>{P.slice().forEach(t=>t.close())},fe={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}};function _(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 u=e.ref(!1),f=e.ref(t.inputValue??""),l=e.ref(""),h=2e3+P.length+1,c=v=>{r||(r=!0,u.value=!1,setTimeout(()=>{const s=P.findIndex(d=>d.container===o);s!==-1&&P.splice(s,1);try{i.unmount()}catch{}o.parentNode&&o.parentNode.removeChild(o),a({action:v,value:v==="confirm"?f.value:void 0})},300))},g=()=>{if(t.showInput&&t.inputPattern&&!t.inputPattern.test(f.value)){l.value=t.inputErrorMessage||"输入格式不正确";return}l.value="",c("confirm")},p=()=>{c("cancel")},C=()=>{c("close")},y=()=>{t.closeOnClickModal!==!1&&C()};return e.nextTick(()=>{u.value=!0}),{visible:u,inputValue:f,inputError:l,zIndex:h,handleConfirm:g,handleCancel:p,handleClose:C,handleMaskClick:y}},render(){if(!this.visible)return null;const u=t.type,f=u?fe[u]:null,l=[];f&&l.push(e.h("span",{class:"x-message-box__icon",style:{color:f.color,marginRight:"10px",fontSize:"20px"}},f.icon)),l.push(e.h("span",{class:"x-message-box__title"},t.title||"提示")),t.showClose!==!1&&l.push(e.h("button",{class:"x-message-box__close",onClick:this.handleClose},"✕"));const h=[];h.push(e.h("div",{class:"x-message-box__content"},t.message||"")),t.showInput&&h.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:g=>{this.inputValue=g.target.value,this.inputError=""},onKeyup:g=>{g.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 c=[];return t.showCancelButton&&c.push(e.h("button",{class:"x-button p-button--default",onClick:this.handleCancel},t.cancelButtonText||"取消")),t.showConfirmButton!==!1&&c.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:g=>g.stopPropagation()},[e.h("div",{class:"x-message-box__header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #eee"}},l),e.h("div",{class:"x-message-box__body",style:{padding:"20px",fontSize:"14px",color:"#606266"}},h),e.h("div",{class:"x-message-box__footer",style:{padding:"10px 20px 16px",textAlign:"right"}},c)])])}}),i=e.createApp(n);i.mount(o);const m={app:i,container:o,close:()=>{var f;const u=(f=i._instance)==null?void 0:f.proxy;u!=null&&u.handleClose&&u.handleClose()}};P.push(m)})}async function me(t,a,o){return _({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!1})}async function pe(t,a,o){return _({message:t,title:a,...o,showConfirmButton:!0,showCancelButton:!0})}async function he(t,a,o){return _({message:t,title:a,...o,showInput:!0,showConfirmButton:!0,showCancelButton:!0})}function ge(t){return _(t)}const M=Object.assign(ge,{alert:me,confirm:pe,prompt:he,closeAll:ue}),xe=M,ye={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)}},R=[];let ve=1;const be=()=>{R.slice().forEach(t=>t.close())},Ce={success:{icon:"✓",color:"#67c23a"},warning:{icon:"⚠",color:"#e6a23c"},error:{icon:"✕",color:"#f56c6c"},info:{icon:"ℹ",color:"#909399"}},ke=(t,a)=>{const o=R.filter(n=>n.position===t);let r=16;for(const n of o)if(n.id<a){const i=n.container.firstElementChild;i&&(r+=i.offsetHeight+16)}return r},we=(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,i=!1;const m=e.defineComponent({name:"TNotification",setup(){const l=e.ref(!1),h=()=>{i||(i=!0,l.value=!1,setTimeout(()=>{var v;const y=R.findIndex(s=>s.id===a);y!==-1&&R.splice(y,1),n&&clearTimeout(n),(v=t.onClose)==null||v.call(t);try{u.unmount()}catch{}r.parentNode&&r.parentNode.removeChild(r)},300))},c=()=>{const y=t.duration??4500;y>0&&(n=setTimeout(h,y))},g=()=>{n&&(clearTimeout(n),n=null)},p=e.computed(()=>(t.offset??0)+ke(o,a)),C=e.computed(()=>we(o,p.value));return e.nextTick(()=>{l.value=!0,c()}),{visible:l,close:h,positionStyles:C,startTimer:c,clearTimer:g}},render(){if(!this.visible)return null;const l=t.type,h=l?Ce[l]:null,c=[];t.title&&c.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?c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"},innerHTML:t.message})):c.push(e.h("div",{class:"x-notification__content",style:{fontSize:"14px",color:"#606266",lineHeight:"1.5"}},t.message)));const g=[];return h&&g.push(e.h("div",{class:"x-notification__icon",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",marginRight:"12px",fontSize:"18px",color:h.color}},h.icon)),g.push(e.h("div",{class:"x-notification__main",style:{flex:"1"}},c)),t.showClose!==!1&&g.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:p=>{p.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},g)}}),u=e.createApp(m);u.mount(r);const f={id:a,app:u,container:r,position:o,close:()=>{var h;const l=(h=u._instance)==null?void 0:h.proxy;l!=null&&l.close&&l.close()}};return R.push(f),{close:f.close}}function Be(t){return Z(typeof t=="string"?{message:t}:t)}const A=t=>a=>Z({...typeof a=="string"?{message:a}:a,type:t}),F=Object.assign(Be,{info:A("info"),success:A("success"),warning:A("warning"),error:A("error"),closeAll:be}),Te=F,Ee={install(t){t.config.globalProperties.$notify=F,t.provide("notification",F)}};exports.Alert=Y;exports.Backtop=ne;exports.Drawer=K;exports.Message=re;exports.MessageBox=xe;exports.MessageComponent=ce;exports.Modal=q;exports.Notification=Te;exports.Popconfirm=oe;exports.TMessage=de;exports.TMessageBox=ye;exports.TNotification=Ee;exports.Tooltip=G;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xto/feedback",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Xto Feedback - Feedback components",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./es/index.mjs",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "vite build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@xto/core": "
|
|
26
|
+
"@xto/core": "^1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^3.4.0"
|