@xto/feedback 1.1.1 → 1.1.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 +773 -604
- package/es/style.css +1 -1
- package/lib/index.cjs +1 -1
- package/lib/style.css +1 -1
- package/package.json +9 -8
package/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useNamespace as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as D, ref as z, computed as S, watch as te, resolveComponent as ke, openBlock as h, createBlock as _, Teleport as oe, createVNode as q, Transition as X, withCtx as A, createElementBlock as k, normalizeStyle as O, normalizeClass as r, unref as f, createElementVNode as C, withModifiers as ie, renderSlot as V, createTextVNode as N, toDisplayString as I, createCommentVNode as T, withDirectives as re, vShow as ce, Fragment as ge, renderList as be, nextTick as ee, onUnmounted as ue, onMounted as ye, reactive as Ce, createApp as ve, h as $ } from "vue";
|
|
2
|
+
import { useNamespace as Z, useZIndex as Be, useEscape as $e, nextMessageZIndex as Te } from "@xto/core";
|
|
3
|
+
const ot = /* @__PURE__ */ D({
|
|
4
4
|
name: "XModal",
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "index",
|
|
@@ -18,108 +18,108 @@ const Ke = /* @__PURE__ */ A({
|
|
|
18
18
|
destroyOnClose: { type: Boolean, default: !1 }
|
|
19
19
|
},
|
|
20
20
|
emits: ["update:modelValue", "update:open", "close", "open", "ok", "cancel"],
|
|
21
|
-
setup(e, { emit:
|
|
22
|
-
const t = e,
|
|
21
|
+
setup(e, { emit: c }) {
|
|
22
|
+
const t = e, a = c, o = Z("modal"), { next: s } = Be(), u = z(s()), g = S({
|
|
23
23
|
get: () => t.modelValue !== void 0 ? t.modelValue : t.open !== void 0 ? t.open : !1,
|
|
24
|
-
set: (
|
|
25
|
-
|
|
24
|
+
set: (d) => {
|
|
25
|
+
a("update:modelValue", d), a("update:open", d);
|
|
26
26
|
}
|
|
27
|
-
}),
|
|
28
|
-
|
|
27
|
+
}), v = z(), l = () => {
|
|
28
|
+
g.value = !1, a("cancel"), a("close");
|
|
29
|
+
}, w = () => {
|
|
30
|
+
a("ok");
|
|
29
31
|
}, p = () => {
|
|
30
|
-
l(
|
|
31
|
-
}, r = () => {
|
|
32
|
-
t.closeOnClickModal && t.modal && n();
|
|
32
|
+
t.closeOnClickModal && t.modal && l();
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
t.closeOnPressEscape &&
|
|
36
|
-
}),
|
|
37
|
-
(
|
|
34
|
+
$e(() => {
|
|
35
|
+
t.closeOnPressEscape && g.value && l();
|
|
36
|
+
}), te(() => [t.modelValue, t.open], ([d, n]) => {
|
|
37
|
+
(d !== void 0 ? d : n) && (u.value = s(), a("open"));
|
|
38
38
|
}, { immediate: !0 });
|
|
39
|
-
const
|
|
39
|
+
const x = S(() => ({
|
|
40
40
|
paddingTop: t.top
|
|
41
|
-
})),
|
|
41
|
+
})), m = S(() => ({
|
|
42
42
|
width: typeof t.width == "number" ? `${t.width}px` : t.width,
|
|
43
|
-
zIndex:
|
|
43
|
+
zIndex: u.value
|
|
44
44
|
}));
|
|
45
|
-
return (
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
default:
|
|
50
|
-
|
|
45
|
+
return (d, n) => {
|
|
46
|
+
const b = ke("x-button");
|
|
47
|
+
return h(), _(oe, { to: "body" }, [
|
|
48
|
+
q(X, { name: "x-modal-fade" }, {
|
|
49
|
+
default: A(() => [
|
|
50
|
+
g.value ? (h(), k("div", {
|
|
51
51
|
key: 0,
|
|
52
|
-
class:
|
|
53
|
-
style:
|
|
54
|
-
onClick:
|
|
52
|
+
class: r(f(o).e("wrapper")),
|
|
53
|
+
style: O(x.value),
|
|
54
|
+
onClick: p
|
|
55
55
|
}, [
|
|
56
|
-
|
|
56
|
+
C("div", {
|
|
57
57
|
ref_key: "modalRef",
|
|
58
|
-
ref:
|
|
59
|
-
class:
|
|
60
|
-
style:
|
|
61
|
-
onClick:
|
|
58
|
+
ref: v,
|
|
59
|
+
class: r(f(o).b()),
|
|
60
|
+
style: O(m.value),
|
|
61
|
+
onClick: n[0] || (n[0] = ie(() => {
|
|
62
62
|
}, ["stop"]))
|
|
63
63
|
}, [
|
|
64
|
-
|
|
65
|
-
class:
|
|
64
|
+
C("div", {
|
|
65
|
+
class: r(f(o).e("header"))
|
|
66
66
|
}, [
|
|
67
|
-
|
|
68
|
-
class:
|
|
67
|
+
C("span", {
|
|
68
|
+
class: r(f(o).e("title"))
|
|
69
69
|
}, [
|
|
70
|
-
|
|
71
|
-
N(
|
|
70
|
+
V(d.$slots, "title", {}, () => [
|
|
71
|
+
N(I(e.title), 1)
|
|
72
72
|
])
|
|
73
73
|
], 2),
|
|
74
|
-
e.showClose ? (
|
|
74
|
+
e.showClose ? (h(), k("button", {
|
|
75
75
|
key: 0,
|
|
76
|
-
class:
|
|
77
|
-
onClick:
|
|
78
|
-
}, " ✕ ", 2)) :
|
|
76
|
+
class: r(f(o).e("close")),
|
|
77
|
+
onClick: l
|
|
78
|
+
}, " ✕ ", 2)) : T("", !0)
|
|
79
79
|
], 2),
|
|
80
|
-
|
|
81
|
-
class:
|
|
80
|
+
C("div", {
|
|
81
|
+
class: r(f(o).e("body"))
|
|
82
82
|
}, [
|
|
83
|
-
|
|
83
|
+
V(d.$slots, "default")
|
|
84
84
|
], 2),
|
|
85
|
-
|
|
85
|
+
d.$slots.footer ? (h(), k("div", {
|
|
86
86
|
key: 0,
|
|
87
|
-
class:
|
|
87
|
+
class: r(f(o).e("footer"))
|
|
88
88
|
}, [
|
|
89
|
-
|
|
90
|
-
ok:
|
|
91
|
-
cancel:
|
|
89
|
+
V(d.$slots, "footer", {
|
|
90
|
+
ok: w,
|
|
91
|
+
cancel: l
|
|
92
92
|
})
|
|
93
|
-
], 2)) :
|
|
93
|
+
], 2)) : d.$slots.footer ? T("", !0) : (h(), k("div", {
|
|
94
94
|
key: 1,
|
|
95
|
-
class:
|
|
95
|
+
class: r(f(o).e("footer"))
|
|
96
96
|
}, [
|
|
97
|
-
|
|
98
|
-
default:
|
|
97
|
+
q(b, { onClick: l }, {
|
|
98
|
+
default: A(() => [...n[1] || (n[1] = [
|
|
99
99
|
N("取消", -1)
|
|
100
100
|
])]),
|
|
101
101
|
_: 1
|
|
102
102
|
}),
|
|
103
|
-
|
|
103
|
+
q(b, {
|
|
104
104
|
type: "primary",
|
|
105
105
|
style: { "margin-left": "8px" },
|
|
106
|
-
onClick:
|
|
106
|
+
onClick: w
|
|
107
107
|
}, {
|
|
108
|
-
default:
|
|
108
|
+
default: A(() => [...n[2] || (n[2] = [
|
|
109
109
|
N("确定", -1)
|
|
110
110
|
])]),
|
|
111
111
|
_: 1
|
|
112
112
|
})
|
|
113
113
|
], 2))
|
|
114
114
|
], 6)
|
|
115
|
-
], 6)) :
|
|
115
|
+
], 6)) : T("", !0)
|
|
116
116
|
]),
|
|
117
117
|
_: 3
|
|
118
118
|
})
|
|
119
119
|
]);
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
}),
|
|
122
|
+
}), nt = /* @__PURE__ */ D({
|
|
123
123
|
name: "XDrawer",
|
|
124
124
|
inheritAttrs: !1,
|
|
125
125
|
__name: "index",
|
|
@@ -136,80 +136,248 @@ const Ke = /* @__PURE__ */ A({
|
|
|
136
136
|
destroyOnClose: { type: Boolean, default: !1 }
|
|
137
137
|
},
|
|
138
138
|
emits: ["update:modelValue", "close", "open"],
|
|
139
|
-
setup(e, { emit:
|
|
140
|
-
const t = e,
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
t.closeOnClickModal &&
|
|
144
|
-
},
|
|
145
|
-
|
|
139
|
+
setup(e, { emit: c }) {
|
|
140
|
+
const t = e, a = c, o = Z("drawer"), s = z(2e3), u = () => {
|
|
141
|
+
a("update:modelValue", !1), a("close");
|
|
142
|
+
}, g = () => {
|
|
143
|
+
t.closeOnClickModal && u();
|
|
144
|
+
}, v = (p) => {
|
|
145
|
+
p.key === "Escape" && t.modelValue && u();
|
|
146
146
|
};
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
te(() => t.modelValue, (p) => {
|
|
148
|
+
p ? (s.value = 2e3 + Math.floor(Math.random() * 100), a("open"), document.addEventListener("keydown", v)) : document.removeEventListener("keydown", v);
|
|
149
149
|
});
|
|
150
|
-
const
|
|
151
|
-
zIndex:
|
|
152
|
-
})),
|
|
153
|
-
const
|
|
150
|
+
const l = S(() => ({
|
|
151
|
+
zIndex: s.value
|
|
152
|
+
})), w = S(() => {
|
|
153
|
+
const p = t.direction ?? t.placement ?? "rtl", x = t.size ?? t.width ?? "30%", m = typeof x == "number" ? `${x}px` : x;
|
|
154
154
|
return {
|
|
155
|
-
ltr: { width:
|
|
156
|
-
rtl: { width:
|
|
157
|
-
ttb: { width: "100%", height:
|
|
158
|
-
btt: { width: "100%", height:
|
|
159
|
-
}[
|
|
155
|
+
ltr: { width: m, height: "100%" },
|
|
156
|
+
rtl: { width: m, height: "100%" },
|
|
157
|
+
ttb: { width: "100%", height: m },
|
|
158
|
+
btt: { width: "100%", height: m }
|
|
159
|
+
}[p];
|
|
160
160
|
});
|
|
161
|
-
return (
|
|
162
|
-
|
|
163
|
-
default:
|
|
164
|
-
|
|
165
|
-
class:
|
|
166
|
-
style:
|
|
167
|
-
onClick:
|
|
161
|
+
return (p, x) => (h(), _(oe, { to: "body" }, [
|
|
162
|
+
q(X, { name: "x-drawer-fade" }, {
|
|
163
|
+
default: A(() => [
|
|
164
|
+
re(C("div", {
|
|
165
|
+
class: r(f(o).e("overlay")),
|
|
166
|
+
style: O(l.value),
|
|
167
|
+
onClick: g
|
|
168
168
|
}, [
|
|
169
|
-
|
|
170
|
-
class:
|
|
171
|
-
style:
|
|
172
|
-
onClick:
|
|
169
|
+
C("div", {
|
|
170
|
+
class: r([f(o).b(), f(o).m(e.direction ?? e.placement)]),
|
|
171
|
+
style: O(w.value),
|
|
172
|
+
onClick: x[0] || (x[0] = ie(() => {
|
|
173
173
|
}, ["stop"]))
|
|
174
174
|
}, [
|
|
175
|
-
e.withHeader ? (
|
|
175
|
+
e.withHeader ? (h(), k("div", {
|
|
176
176
|
key: 0,
|
|
177
|
-
class:
|
|
177
|
+
class: r(f(o).e("header"))
|
|
178
178
|
}, [
|
|
179
|
-
|
|
180
|
-
class:
|
|
179
|
+
C("span", {
|
|
180
|
+
class: r(f(o).e("title"))
|
|
181
181
|
}, [
|
|
182
|
-
|
|
183
|
-
N(
|
|
182
|
+
V(p.$slots, "title", {}, () => [
|
|
183
|
+
N(I(e.title), 1)
|
|
184
184
|
])
|
|
185
185
|
], 2),
|
|
186
|
-
e.showClose ? (
|
|
186
|
+
e.showClose ? (h(), k("button", {
|
|
187
187
|
key: 0,
|
|
188
|
-
class:
|
|
189
|
-
onClick:
|
|
190
|
-
}, " ✕ ", 2)) :
|
|
191
|
-
], 2)) :
|
|
192
|
-
|
|
193
|
-
class:
|
|
188
|
+
class: r(f(o).e("close")),
|
|
189
|
+
onClick: u
|
|
190
|
+
}, " ✕ ", 2)) : T("", !0)
|
|
191
|
+
], 2)) : T("", !0),
|
|
192
|
+
C("div", {
|
|
193
|
+
class: r(f(o).e("body"))
|
|
194
194
|
}, [
|
|
195
|
-
|
|
195
|
+
V(p.$slots, "default")
|
|
196
196
|
], 2),
|
|
197
|
-
|
|
197
|
+
p.$slots.footer ? (h(), k("div", {
|
|
198
198
|
key: 1,
|
|
199
|
-
class:
|
|
199
|
+
class: r(f(o).e("footer"))
|
|
200
200
|
}, [
|
|
201
|
-
|
|
202
|
-
], 2)) :
|
|
201
|
+
V(p.$slots, "footer")
|
|
202
|
+
], 2)) : T("", !0)
|
|
203
203
|
], 6)
|
|
204
204
|
], 6), [
|
|
205
|
-
[
|
|
205
|
+
[ce, e.modelValue]
|
|
206
206
|
])
|
|
207
207
|
]),
|
|
208
208
|
_: 3
|
|
209
209
|
})
|
|
210
210
|
]));
|
|
211
211
|
}
|
|
212
|
-
}),
|
|
212
|
+
}), Ee = {
|
|
213
|
+
key: 0,
|
|
214
|
+
class: "required-mark"
|
|
215
|
+
}, Me = ["value", "placeholder", "disabled", "onInput"], ze = ["value", "placeholder", "disabled", "onInput"], Ie = ["value", "placeholder", "disabled", "onInput"], Se = ["value", "disabled", "onChange"], Le = ["value"], Ve = ["disabled", "onClick"], st = /* @__PURE__ */ D({
|
|
216
|
+
name: "XDrawerForm",
|
|
217
|
+
__name: "index",
|
|
218
|
+
props: {
|
|
219
|
+
modelValue: { type: Boolean, default: !1 },
|
|
220
|
+
title: { default: "配置" },
|
|
221
|
+
size: { default: "400px" },
|
|
222
|
+
fields: { default: () => [] },
|
|
223
|
+
formData: { default: () => ({}) },
|
|
224
|
+
showConfirm: { type: Boolean, default: !0 },
|
|
225
|
+
showCancel: { type: Boolean, default: !0 },
|
|
226
|
+
confirmText: { default: "确认" },
|
|
227
|
+
cancelText: { default: "取消" },
|
|
228
|
+
disabled: { type: Boolean, default: !1 },
|
|
229
|
+
destroyOnClose: { type: Boolean, default: !1 }
|
|
230
|
+
},
|
|
231
|
+
emits: ["update:modelValue", "confirm", "cancel", "close", "field-change"],
|
|
232
|
+
setup(e, { emit: c }) {
|
|
233
|
+
const t = e, a = c, o = Z("drawer-form"), s = z({}), u = z({});
|
|
234
|
+
S(() => [
|
|
235
|
+
o.b()
|
|
236
|
+
]), te(() => t.formData, (m) => {
|
|
237
|
+
s.value = { ...m };
|
|
238
|
+
}, { immediate: !0, deep: !0 });
|
|
239
|
+
const g = S(() => typeof t.size == "number" ? `${t.size}px` : t.size), v = () => {
|
|
240
|
+
a("update:modelValue", !1), a("close");
|
|
241
|
+
}, l = () => {
|
|
242
|
+
a("cancel"), v();
|
|
243
|
+
}, w = () => {
|
|
244
|
+
p() && (a("confirm", s.value), v());
|
|
245
|
+
}, p = () => {
|
|
246
|
+
u.value = {};
|
|
247
|
+
for (const m of t.fields) {
|
|
248
|
+
if (m.required) {
|
|
249
|
+
const d = s.value[m.name];
|
|
250
|
+
if (d == null || d === "") {
|
|
251
|
+
u.value[m.name] = `${m.label}为必填项`;
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (m.rules)
|
|
256
|
+
for (const d of m.rules) {
|
|
257
|
+
const n = s.value[m.name];
|
|
258
|
+
d.type === "email" && n && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n) && (u.value[m.name] = d.message), d.type === "minLength" && n && n.length < d.min && (u.value[m.name] = d.message);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return Object.keys(u.value).length === 0;
|
|
262
|
+
}, x = (m, d) => {
|
|
263
|
+
s.value[m] = d, a("field-change", m, d);
|
|
264
|
+
};
|
|
265
|
+
return (m, d) => (h(), _(oe, { to: "body" }, [
|
|
266
|
+
q(X, { name: "drawer-form-fade" }, {
|
|
267
|
+
default: A(() => [
|
|
268
|
+
re(C("div", {
|
|
269
|
+
class: r(f(o).e("overlay")),
|
|
270
|
+
onClick: v
|
|
271
|
+
}, [
|
|
272
|
+
C("div", {
|
|
273
|
+
class: r(f(o).b()),
|
|
274
|
+
style: O({ width: g.value }),
|
|
275
|
+
onClick: d[0] || (d[0] = ie(() => {
|
|
276
|
+
}, ["stop"]))
|
|
277
|
+
}, [
|
|
278
|
+
C("div", {
|
|
279
|
+
class: r(f(o).e("header"))
|
|
280
|
+
}, [
|
|
281
|
+
C("span", {
|
|
282
|
+
class: r(f(o).e("title"))
|
|
283
|
+
}, I(e.title), 3),
|
|
284
|
+
C("button", {
|
|
285
|
+
class: r(f(o).e("close")),
|
|
286
|
+
onClick: v
|
|
287
|
+
}, "✕", 2)
|
|
288
|
+
], 2),
|
|
289
|
+
C("div", {
|
|
290
|
+
class: r(f(o).e("body"))
|
|
291
|
+
}, [
|
|
292
|
+
!e.destroyOnClose || e.modelValue ? (h(), k("div", {
|
|
293
|
+
key: 0,
|
|
294
|
+
class: r(f(o).e("form"))
|
|
295
|
+
}, [
|
|
296
|
+
(h(!0), k(ge, null, be(e.fields, (n) => (h(), k("div", {
|
|
297
|
+
key: n.name,
|
|
298
|
+
class: r(f(o).e("field"))
|
|
299
|
+
}, [
|
|
300
|
+
C("label", {
|
|
301
|
+
class: r(f(o).e("label"))
|
|
302
|
+
}, [
|
|
303
|
+
N(I(n.label) + " ", 1),
|
|
304
|
+
n.required ? (h(), k("span", Ee, "*")) : T("", !0)
|
|
305
|
+
], 2),
|
|
306
|
+
n.type === "input" ? (h(), k("input", {
|
|
307
|
+
key: 0,
|
|
308
|
+
class: r([f(o).e("input"), { "has-error": u.value[n.name] }]),
|
|
309
|
+
value: s.value[n.name],
|
|
310
|
+
placeholder: n.placeholder,
|
|
311
|
+
disabled: e.disabled || n.disabled,
|
|
312
|
+
onInput: (b) => x(n.name, b.target.value)
|
|
313
|
+
}, null, 42, Me)) : n.type === "textarea" ? (h(), k("textarea", {
|
|
314
|
+
key: 1,
|
|
315
|
+
class: r([f(o).e("textarea"), { "has-error": u.value[n.name] }]),
|
|
316
|
+
value: s.value[n.name],
|
|
317
|
+
placeholder: n.placeholder,
|
|
318
|
+
disabled: e.disabled || n.disabled,
|
|
319
|
+
rows: "4",
|
|
320
|
+
onInput: (b) => x(n.name, b.target.value)
|
|
321
|
+
}, null, 42, ze)) : n.type === "number" ? (h(), k("input", {
|
|
322
|
+
key: 2,
|
|
323
|
+
type: "number",
|
|
324
|
+
class: r([f(o).e("input"), { "has-error": u.value[n.name] }]),
|
|
325
|
+
value: s.value[n.name],
|
|
326
|
+
placeholder: n.placeholder,
|
|
327
|
+
disabled: e.disabled || n.disabled,
|
|
328
|
+
onInput: (b) => x(n.name, Number(b.target.value))
|
|
329
|
+
}, null, 42, Ie)) : n.type === "select" ? (h(), k("select", {
|
|
330
|
+
key: 3,
|
|
331
|
+
class: r([f(o).e("select"), { "has-error": u.value[n.name] }]),
|
|
332
|
+
value: s.value[n.name],
|
|
333
|
+
disabled: e.disabled || n.disabled,
|
|
334
|
+
onChange: (b) => x(n.name, b.target.value)
|
|
335
|
+
}, [
|
|
336
|
+
(h(!0), k(ge, null, be(n.options, (b) => (h(), k("option", {
|
|
337
|
+
key: b.value,
|
|
338
|
+
value: b.value
|
|
339
|
+
}, I(b.label), 9, Le))), 128))
|
|
340
|
+
], 42, Se)) : n.type === "switch" ? (h(), k("div", {
|
|
341
|
+
key: 4,
|
|
342
|
+
class: r(f(o).e("switch"))
|
|
343
|
+
}, [
|
|
344
|
+
C("button", {
|
|
345
|
+
class: r(["switch-btn", { "is-on": s.value[n.name] }]),
|
|
346
|
+
disabled: e.disabled || n.disabled,
|
|
347
|
+
onClick: (b) => x(n.name, !s.value[n.name])
|
|
348
|
+
}, I(s.value[n.name] ? "开启" : "关闭"), 11, Ve)
|
|
349
|
+
], 2)) : T("", !0),
|
|
350
|
+
u.value[n.name] ? (h(), k("span", {
|
|
351
|
+
key: 5,
|
|
352
|
+
class: r(f(o).e("error"))
|
|
353
|
+
}, I(u.value[n.name]), 3)) : T("", !0)
|
|
354
|
+
], 2))), 128))
|
|
355
|
+
], 2)) : T("", !0)
|
|
356
|
+
], 2),
|
|
357
|
+
C("div", {
|
|
358
|
+
class: r(f(o).e("footer"))
|
|
359
|
+
}, [
|
|
360
|
+
e.showCancel ? (h(), k("button", {
|
|
361
|
+
key: 0,
|
|
362
|
+
class: r(f(o).e("cancel")),
|
|
363
|
+
onClick: l
|
|
364
|
+
}, I(e.cancelText), 3)) : T("", !0),
|
|
365
|
+
e.showConfirm ? (h(), k("button", {
|
|
366
|
+
key: 1,
|
|
367
|
+
class: r(f(o).e("confirm")),
|
|
368
|
+
onClick: w
|
|
369
|
+
}, I(e.confirmText), 3)) : T("", !0)
|
|
370
|
+
], 2)
|
|
371
|
+
], 6)
|
|
372
|
+
], 2), [
|
|
373
|
+
[ce, e.modelValue]
|
|
374
|
+
])
|
|
375
|
+
]),
|
|
376
|
+
_: 1
|
|
377
|
+
})
|
|
378
|
+
]));
|
|
379
|
+
}
|
|
380
|
+
}), lt = /* @__PURE__ */ D({
|
|
213
381
|
name: "XAlert",
|
|
214
382
|
__name: "index",
|
|
215
383
|
props: {
|
|
@@ -221,61 +389,61 @@ const Ke = /* @__PURE__ */ A({
|
|
|
221
389
|
center: { type: Boolean, default: !1 }
|
|
222
390
|
},
|
|
223
391
|
emits: ["close"],
|
|
224
|
-
setup(e, { emit:
|
|
225
|
-
const t = e,
|
|
392
|
+
setup(e, { emit: c }) {
|
|
393
|
+
const t = e, a = c, o = Z("alert"), s = z(!0), u = {
|
|
226
394
|
success: "✓",
|
|
227
395
|
warning: "⚠",
|
|
228
396
|
error: "✕",
|
|
229
397
|
info: "ℹ"
|
|
230
|
-
},
|
|
398
|
+
}, g = S(() => [
|
|
231
399
|
o.b(),
|
|
232
400
|
o.m(t.type),
|
|
233
401
|
o.is("center", t.center),
|
|
234
402
|
o.is("with-description", t.description)
|
|
235
|
-
]),
|
|
236
|
-
|
|
403
|
+
]), v = (l) => {
|
|
404
|
+
s.value = !1, a("close", l);
|
|
237
405
|
};
|
|
238
|
-
return (
|
|
239
|
-
default:
|
|
240
|
-
|
|
406
|
+
return (l, w) => (h(), _(X, { name: "x-alert-fade" }, {
|
|
407
|
+
default: A(() => [
|
|
408
|
+
s.value ? (h(), k("div", {
|
|
241
409
|
key: 0,
|
|
242
|
-
class:
|
|
410
|
+
class: r(g.value)
|
|
243
411
|
}, [
|
|
244
|
-
e.showIcon ? (
|
|
412
|
+
e.showIcon ? (h(), k("span", {
|
|
245
413
|
key: 0,
|
|
246
|
-
class:
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
class:
|
|
414
|
+
class: r(f(o).e("icon"))
|
|
415
|
+
}, I(u[e.type]), 3)) : T("", !0),
|
|
416
|
+
C("div", {
|
|
417
|
+
class: r(f(o).e("content"))
|
|
250
418
|
}, [
|
|
251
|
-
e.title ||
|
|
419
|
+
e.title || l.$slots.title ? (h(), k("span", {
|
|
252
420
|
key: 0,
|
|
253
|
-
class:
|
|
421
|
+
class: r(f(o).e("title"))
|
|
254
422
|
}, [
|
|
255
|
-
|
|
256
|
-
N(
|
|
423
|
+
V(l.$slots, "title", {}, () => [
|
|
424
|
+
N(I(e.title), 1)
|
|
257
425
|
])
|
|
258
|
-
], 2)) :
|
|
259
|
-
e.description ||
|
|
426
|
+
], 2)) : T("", !0),
|
|
427
|
+
e.description || l.$slots.default ? (h(), k("span", {
|
|
260
428
|
key: 1,
|
|
261
|
-
class:
|
|
429
|
+
class: r(f(o).e("description"))
|
|
262
430
|
}, [
|
|
263
|
-
|
|
264
|
-
N(
|
|
431
|
+
V(l.$slots, "default", {}, () => [
|
|
432
|
+
N(I(e.description), 1)
|
|
265
433
|
])
|
|
266
|
-
], 2)) :
|
|
434
|
+
], 2)) : T("", !0)
|
|
267
435
|
], 2),
|
|
268
|
-
e.closable ? (
|
|
436
|
+
e.closable ? (h(), k("button", {
|
|
269
437
|
key: 1,
|
|
270
|
-
class:
|
|
271
|
-
onClick:
|
|
272
|
-
}, " ✕ ", 2)) :
|
|
273
|
-
], 2)) :
|
|
438
|
+
class: r(f(o).e("close")),
|
|
439
|
+
onClick: v
|
|
440
|
+
}, " ✕ ", 2)) : T("", !0)
|
|
441
|
+
], 2)) : T("", !0)
|
|
274
442
|
]),
|
|
275
443
|
_: 3
|
|
276
444
|
}));
|
|
277
445
|
}
|
|
278
|
-
}),
|
|
446
|
+
}), at = /* @__PURE__ */ D({
|
|
279
447
|
name: "XTooltip",
|
|
280
448
|
__name: "index",
|
|
281
449
|
props: {
|
|
@@ -291,115 +459,115 @@ const Ke = /* @__PURE__ */ A({
|
|
|
291
459
|
closeDelay: { default: 0 }
|
|
292
460
|
},
|
|
293
461
|
emits: ["update:visible", "show", "hide"],
|
|
294
|
-
setup(e, { emit:
|
|
295
|
-
const t = e,
|
|
296
|
-
let
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
let P = 0, R = 0,
|
|
462
|
+
setup(e, { emit: c }) {
|
|
463
|
+
const t = e, a = c, o = Z("tooltip"), s = z(!1), u = z(), g = z();
|
|
464
|
+
let v, l;
|
|
465
|
+
const w = z({}), p = () => {
|
|
466
|
+
if (!u.value || !g.value) return;
|
|
467
|
+
const E = u.value.getBoundingClientRect(), F = g.value;
|
|
468
|
+
F.style.visibility = "hidden", F.style.display = "block";
|
|
469
|
+
const H = F.offsetWidth, j = F.offsetHeight, W = t.offset, fe = window.innerWidth, pe = window.innerHeight;
|
|
470
|
+
let P = 0, R = 0, Y = t.placement;
|
|
303
471
|
switch (t.placement) {
|
|
304
472
|
case "top":
|
|
305
|
-
P =
|
|
473
|
+
P = E.top - j - W, R = E.left + (E.width - H) / 2;
|
|
306
474
|
break;
|
|
307
475
|
case "bottom":
|
|
308
|
-
P =
|
|
476
|
+
P = E.bottom + W, R = E.left + (E.width - H) / 2;
|
|
309
477
|
break;
|
|
310
478
|
case "left":
|
|
311
|
-
P =
|
|
479
|
+
P = E.top + (E.height - j) / 2, R = E.left - H - W;
|
|
312
480
|
break;
|
|
313
481
|
case "right":
|
|
314
|
-
P =
|
|
482
|
+
P = E.top + (E.height - j) / 2, R = E.right + W;
|
|
315
483
|
break;
|
|
316
484
|
}
|
|
317
|
-
t.placement === "top" && P < 0 ? (
|
|
485
|
+
t.placement === "top" && P < 0 ? (Y = "bottom", P = E.bottom + W) : t.placement === "bottom" && P + j > pe ? (Y = "top", P = E.top - j - W) : t.placement === "left" && R < 0 ? (Y = "right", R = E.right + W) : t.placement === "right" && R + H > fe && (Y = "left", R = E.left - H - W), R < 8 && (R = 8), R + H > fe - 8 && (R = fe - H - 8), P < 8 && (P = 8), P + j > pe - 8 && (P = pe - j - 8), w.value = {
|
|
318
486
|
position: "fixed",
|
|
319
487
|
top: `${P}px`,
|
|
320
488
|
left: `${R}px`,
|
|
321
489
|
visibility: "visible",
|
|
322
490
|
zIndex: "2000"
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
t.disabled || (clearTimeout(
|
|
326
|
-
|
|
327
|
-
|
|
491
|
+
}, x.value = Y;
|
|
492
|
+
}, x = z(t.placement), m = () => {
|
|
493
|
+
t.disabled || (clearTimeout(l), v = setTimeout(() => {
|
|
494
|
+
s.value = !0, a("update:visible", !0), a("show"), ee(() => {
|
|
495
|
+
p();
|
|
328
496
|
});
|
|
329
497
|
}, t.openDelay));
|
|
330
|
-
},
|
|
331
|
-
clearTimeout(
|
|
332
|
-
|
|
498
|
+
}, d = () => {
|
|
499
|
+
clearTimeout(v), l = setTimeout(() => {
|
|
500
|
+
s.value = !1, a("update:visible", !1), a("hide");
|
|
333
501
|
}, t.closeDelay);
|
|
334
|
-
},
|
|
335
|
-
|
|
502
|
+
}, n = () => {
|
|
503
|
+
s.value ? d() : m();
|
|
504
|
+
}, b = () => {
|
|
505
|
+
t.trigger === "hover" && m();
|
|
506
|
+
}, i = () => {
|
|
507
|
+
t.trigger === "hover" && d();
|
|
336
508
|
}, y = () => {
|
|
337
|
-
t.trigger === "
|
|
338
|
-
},
|
|
339
|
-
t.trigger === "
|
|
340
|
-
},
|
|
341
|
-
t.trigger === "
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var W, _;
|
|
348
|
-
t.trigger === "click" && !((W = f.value) != null && W.contains(B.target)) && !((_ = d.value) != null && _.contains(B.target)) && g();
|
|
349
|
-
}, k = () => {
|
|
350
|
-
a.value && r();
|
|
509
|
+
t.trigger === "click" && n();
|
|
510
|
+
}, K = () => {
|
|
511
|
+
t.trigger === "focus" && m();
|
|
512
|
+
}, L = () => {
|
|
513
|
+
t.trigger === "focus" && d();
|
|
514
|
+
}, M = (E) => {
|
|
515
|
+
var F, H;
|
|
516
|
+
t.trigger === "click" && !((F = u.value) != null && F.contains(E.target)) && !((H = g.value) != null && H.contains(E.target)) && d();
|
|
517
|
+
}, B = () => {
|
|
518
|
+
s.value && p();
|
|
351
519
|
};
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}) : (document.removeEventListener("click",
|
|
356
|
-
}),
|
|
357
|
-
clearTimeout(
|
|
520
|
+
te(s, (E) => {
|
|
521
|
+
E ? ee(() => {
|
|
522
|
+
p(), t.trigger === "click" && document.addEventListener("click", M), window.addEventListener("scroll", B, !0), window.addEventListener("resize", B);
|
|
523
|
+
}) : (document.removeEventListener("click", M), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", B));
|
|
524
|
+
}), ue(() => {
|
|
525
|
+
clearTimeout(v), clearTimeout(l), document.removeEventListener("click", M), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", B);
|
|
358
526
|
});
|
|
359
|
-
const
|
|
527
|
+
const ne = S(() => [
|
|
360
528
|
o.b(),
|
|
361
529
|
o.m(t.effect)
|
|
362
|
-
]),
|
|
530
|
+
]), se = S(() => [
|
|
363
531
|
o.e("arrow"),
|
|
364
|
-
o.e(`arrow-${
|
|
532
|
+
o.e(`arrow-${x.value}`)
|
|
365
533
|
]);
|
|
366
|
-
return (
|
|
367
|
-
class:
|
|
534
|
+
return (E, F) => (h(), k("div", {
|
|
535
|
+
class: r(f(o).e("wrapper"))
|
|
368
536
|
}, [
|
|
369
|
-
|
|
537
|
+
C("div", {
|
|
370
538
|
ref_key: "triggerRef",
|
|
371
|
-
ref:
|
|
372
|
-
class:
|
|
373
|
-
onMouseenter:
|
|
374
|
-
onMouseleave:
|
|
375
|
-
onClick:
|
|
376
|
-
onFocus:
|
|
377
|
-
onBlur:
|
|
539
|
+
ref: u,
|
|
540
|
+
class: r(f(o).e("trigger")),
|
|
541
|
+
onMouseenter: b,
|
|
542
|
+
onMouseleave: i,
|
|
543
|
+
onClick: y,
|
|
544
|
+
onFocus: K,
|
|
545
|
+
onBlur: L
|
|
378
546
|
}, [
|
|
379
|
-
|
|
547
|
+
V(E.$slots, "default")
|
|
380
548
|
], 34),
|
|
381
|
-
(
|
|
382
|
-
|
|
549
|
+
(h(), _(oe, { to: "body" }, [
|
|
550
|
+
q(X, {
|
|
383
551
|
name: `x-tooltip-${e.transition}`
|
|
384
552
|
}, {
|
|
385
|
-
default:
|
|
386
|
-
|
|
553
|
+
default: A(() => [
|
|
554
|
+
re(C("div", {
|
|
387
555
|
ref_key: "tooltipRef",
|
|
388
|
-
ref:
|
|
389
|
-
class:
|
|
390
|
-
style:
|
|
391
|
-
onMouseenter:
|
|
392
|
-
onMouseleave:
|
|
556
|
+
ref: g,
|
|
557
|
+
class: r(ne.value),
|
|
558
|
+
style: O(w.value),
|
|
559
|
+
onMouseenter: b,
|
|
560
|
+
onMouseleave: i
|
|
393
561
|
}, [
|
|
394
|
-
|
|
395
|
-
N(
|
|
562
|
+
V(E.$slots, "content", {}, () => [
|
|
563
|
+
N(I(e.content), 1)
|
|
396
564
|
]),
|
|
397
|
-
e.visibleArrow ? (
|
|
565
|
+
e.visibleArrow ? (h(), k("div", {
|
|
398
566
|
key: 0,
|
|
399
|
-
class:
|
|
400
|
-
}, null, 2)) :
|
|
567
|
+
class: r(se.value)
|
|
568
|
+
}, null, 2)) : T("", !0)
|
|
401
569
|
], 38), [
|
|
402
|
-
[
|
|
570
|
+
[ce, s.value]
|
|
403
571
|
])
|
|
404
572
|
]),
|
|
405
573
|
_: 3
|
|
@@ -407,7 +575,7 @@ const Ke = /* @__PURE__ */ A({
|
|
|
407
575
|
]))
|
|
408
576
|
], 2));
|
|
409
577
|
}
|
|
410
|
-
}),
|
|
578
|
+
}), Pe = { class: "x-popconfirm-wrapper" }, Re = { class: "x-popconfirm__main" }, Oe = { class: "x-popconfirm__title" }, Ne = { class: "x-popconfirm__action" }, it = /* @__PURE__ */ D({
|
|
411
579
|
name: "XPopconfirm",
|
|
412
580
|
__name: "index",
|
|
413
581
|
props: {
|
|
@@ -428,167 +596,167 @@ const Ke = /* @__PURE__ */ A({
|
|
|
428
596
|
showArrow: { type: Boolean, default: !0 }
|
|
429
597
|
},
|
|
430
598
|
emits: ["confirm", "cancel"],
|
|
431
|
-
setup(e, { emit:
|
|
432
|
-
const t = e,
|
|
433
|
-
if (!
|
|
434
|
-
const
|
|
435
|
-
let
|
|
436
|
-
switch (
|
|
599
|
+
setup(e, { emit: c }) {
|
|
600
|
+
const t = e, a = c, o = z(!1), s = z(null), u = z(null), g = z({}), v = () => {
|
|
601
|
+
if (!s.value || !u.value) return;
|
|
602
|
+
const i = s.value.getBoundingClientRect(), y = u.value.getBoundingClientRect(), K = t.placement, L = t.offset;
|
|
603
|
+
let M = 0, B = 0;
|
|
604
|
+
switch (K) {
|
|
437
605
|
case "top":
|
|
438
|
-
|
|
606
|
+
M = i.top - y.height - L, B = i.left + (i.width - y.width) / 2;
|
|
439
607
|
break;
|
|
440
608
|
case "top-start":
|
|
441
|
-
|
|
609
|
+
M = i.top - y.height - L, B = i.left;
|
|
442
610
|
break;
|
|
443
611
|
case "top-end":
|
|
444
|
-
|
|
612
|
+
M = i.top - y.height - L, B = i.right - y.width;
|
|
445
613
|
break;
|
|
446
614
|
case "bottom":
|
|
447
|
-
|
|
615
|
+
M = i.bottom + L, B = i.left + (i.width - y.width) / 2;
|
|
448
616
|
break;
|
|
449
617
|
case "bottom-start":
|
|
450
|
-
|
|
618
|
+
M = i.bottom + L, B = i.left;
|
|
451
619
|
break;
|
|
452
620
|
case "bottom-end":
|
|
453
|
-
|
|
621
|
+
M = i.bottom + L, B = i.right - y.width;
|
|
454
622
|
break;
|
|
455
623
|
case "left":
|
|
456
|
-
|
|
624
|
+
M = i.top + (i.height - y.height) / 2, B = i.left - y.width - L;
|
|
457
625
|
break;
|
|
458
626
|
case "left-start":
|
|
459
|
-
|
|
627
|
+
M = i.top, B = i.left - y.width - L;
|
|
460
628
|
break;
|
|
461
629
|
case "left-end":
|
|
462
|
-
|
|
630
|
+
M = i.bottom - y.height, B = i.left - y.width - L;
|
|
463
631
|
break;
|
|
464
632
|
case "right":
|
|
465
|
-
|
|
633
|
+
M = i.top + (i.height - y.height) / 2, B = i.right + L;
|
|
466
634
|
break;
|
|
467
635
|
case "right-start":
|
|
468
|
-
|
|
636
|
+
M = i.top, B = i.right + L;
|
|
469
637
|
break;
|
|
470
638
|
case "right-end":
|
|
471
|
-
|
|
639
|
+
M = i.bottom - y.height, B = i.right + L;
|
|
472
640
|
break;
|
|
473
641
|
default:
|
|
474
|
-
|
|
642
|
+
M = i.top - y.height - L, B = i.left + (i.width - y.width) / 2;
|
|
475
643
|
}
|
|
476
|
-
const
|
|
477
|
-
|
|
644
|
+
const ne = window.innerWidth, se = window.innerHeight;
|
|
645
|
+
B < 0 && (B = 10), B + y.width > ne && (B = ne - y.width - 10), M < 0 && (M = 10), M + y.height > se && (M = se - y.height - 10), g.value = {
|
|
478
646
|
position: "fixed",
|
|
479
|
-
top: `${
|
|
480
|
-
left: `${
|
|
647
|
+
top: `${M}px`,
|
|
648
|
+
left: `${B}px`,
|
|
481
649
|
zIndex: "2000"
|
|
482
650
|
};
|
|
483
|
-
},
|
|
484
|
-
var
|
|
485
|
-
o.value && ((
|
|
486
|
-
},
|
|
487
|
-
t.disabled || (
|
|
488
|
-
},
|
|
489
|
-
o.value = !1,
|
|
651
|
+
}, l = (i) => {
|
|
652
|
+
var y, K;
|
|
653
|
+
o.value && ((y = s.value) != null && y.contains(i.target) || (K = u.value) != null && K.contains(i.target) || (o.value = !1));
|
|
654
|
+
}, w = (i) => {
|
|
655
|
+
t.disabled || (i.stopPropagation(), o.value = !o.value, o.value && setTimeout(v, 0));
|
|
656
|
+
}, p = () => {
|
|
657
|
+
o.value = !1, a("confirm");
|
|
658
|
+
}, x = () => {
|
|
659
|
+
o.value = !1, a("cancel");
|
|
490
660
|
}, m = () => {
|
|
491
|
-
o.value
|
|
492
|
-
},
|
|
493
|
-
o.value &&
|
|
494
|
-
}, g = () => {
|
|
495
|
-
o.value && u();
|
|
661
|
+
o.value && v();
|
|
662
|
+
}, d = () => {
|
|
663
|
+
o.value && v();
|
|
496
664
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}),
|
|
500
|
-
document.removeEventListener("click",
|
|
665
|
+
te(o, (i) => {
|
|
666
|
+
i ? (setTimeout(v, 0), document.addEventListener("click", l), window.addEventListener("scroll", m, !0), window.addEventListener("resize", d)) : (document.removeEventListener("click", l), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", d));
|
|
667
|
+
}), ue(() => {
|
|
668
|
+
document.removeEventListener("click", l), window.removeEventListener("scroll", m, !0), window.removeEventListener("resize", d);
|
|
501
669
|
});
|
|
502
|
-
const
|
|
670
|
+
const n = S(() => ({
|
|
503
671
|
width: typeof t.width == "number" ? `${t.width}px` : t.width
|
|
504
|
-
})),
|
|
505
|
-
const
|
|
506
|
-
switch (
|
|
672
|
+
})), b = S(() => {
|
|
673
|
+
const i = t.placement, y = {};
|
|
674
|
+
switch (i) {
|
|
507
675
|
case "top":
|
|
508
676
|
case "top-start":
|
|
509
677
|
case "top-end":
|
|
510
|
-
|
|
678
|
+
y.bottom = "-6px", y.transform = "rotate(45deg)";
|
|
511
679
|
break;
|
|
512
680
|
case "bottom":
|
|
513
681
|
case "bottom-start":
|
|
514
682
|
case "bottom-end":
|
|
515
|
-
|
|
683
|
+
y.top = "-6px", y.transform = "rotate(225deg)";
|
|
516
684
|
break;
|
|
517
685
|
case "left":
|
|
518
686
|
case "left-start":
|
|
519
687
|
case "left-end":
|
|
520
|
-
|
|
688
|
+
y.right = "-6px", y.transform = "rotate(315deg)";
|
|
521
689
|
break;
|
|
522
690
|
case "right":
|
|
523
691
|
case "right-start":
|
|
524
692
|
case "right-end":
|
|
525
|
-
|
|
693
|
+
y.left = "-6px", y.transform = "rotate(135deg)";
|
|
526
694
|
break;
|
|
527
695
|
}
|
|
528
|
-
return
|
|
696
|
+
return y;
|
|
529
697
|
});
|
|
530
|
-
return (
|
|
531
|
-
|
|
698
|
+
return (i, y) => (h(), k("span", Pe, [
|
|
699
|
+
C("span", {
|
|
532
700
|
ref_key: "triggerRef",
|
|
533
|
-
ref:
|
|
701
|
+
ref: s,
|
|
534
702
|
class: "x-popconfirm-trigger",
|
|
535
|
-
onClick:
|
|
703
|
+
onClick: w
|
|
536
704
|
}, [
|
|
537
|
-
|
|
705
|
+
V(i.$slots, "default")
|
|
538
706
|
], 512),
|
|
539
|
-
(
|
|
540
|
-
|
|
541
|
-
default:
|
|
542
|
-
o.value ? (
|
|
707
|
+
(h(), _(oe, { to: "body" }, [
|
|
708
|
+
q(X, { name: "x-popconfirm-fade" }, {
|
|
709
|
+
default: A(() => [
|
|
710
|
+
o.value ? (h(), k("div", {
|
|
543
711
|
key: 0,
|
|
544
712
|
ref_key: "popperRef",
|
|
545
|
-
ref:
|
|
713
|
+
ref: u,
|
|
546
714
|
class: "x-popconfirm",
|
|
547
|
-
style:
|
|
548
|
-
onClick:
|
|
715
|
+
style: O({ ...g.value, ...n.value }),
|
|
716
|
+
onClick: y[0] || (y[0] = ie(() => {
|
|
549
717
|
}, ["stop"]))
|
|
550
718
|
}, [
|
|
551
|
-
e.showArrow ? (
|
|
719
|
+
e.showArrow ? (h(), k("span", {
|
|
552
720
|
key: 0,
|
|
553
721
|
class: "x-popconfirm__arrow",
|
|
554
|
-
style:
|
|
555
|
-
}, null, 4)) :
|
|
556
|
-
|
|
557
|
-
e.hideIcon ?
|
|
722
|
+
style: O(b.value)
|
|
723
|
+
}, null, 4)) : T("", !0),
|
|
724
|
+
C("div", Re, [
|
|
725
|
+
e.hideIcon ? T("", !0) : (h(), k("span", {
|
|
558
726
|
key: 0,
|
|
559
727
|
class: "x-popconfirm__icon",
|
|
560
|
-
style:
|
|
728
|
+
style: O({ color: e.iconColor })
|
|
561
729
|
}, [
|
|
562
|
-
|
|
563
|
-
N(
|
|
730
|
+
V(i.$slots, "icon", {}, () => [
|
|
731
|
+
N(I(e.icon || "⚠"), 1)
|
|
564
732
|
])
|
|
565
733
|
], 4)),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
N(
|
|
734
|
+
C("div", Oe, [
|
|
735
|
+
V(i.$slots, "title", {}, () => [
|
|
736
|
+
N(I(e.title), 1)
|
|
569
737
|
])
|
|
570
738
|
])
|
|
571
739
|
]),
|
|
572
|
-
|
|
573
|
-
e.hideCancelButton ?
|
|
740
|
+
C("div", Ne, [
|
|
741
|
+
e.hideCancelButton ? T("", !0) : (h(), k("button", {
|
|
574
742
|
key: 0,
|
|
575
743
|
class: "x-button p-button--default p-button--small",
|
|
576
|
-
onClick:
|
|
577
|
-
},
|
|
578
|
-
e.hideConfirmButton ?
|
|
744
|
+
onClick: x
|
|
745
|
+
}, I(e.cancelButtonText), 1)),
|
|
746
|
+
e.hideConfirmButton ? T("", !0) : (h(), k("button", {
|
|
579
747
|
key: 1,
|
|
580
|
-
class:
|
|
581
|
-
onClick:
|
|
582
|
-
},
|
|
748
|
+
class: r(["x-button x-button--small", `x-button--${e.confirmButtonType}`]),
|
|
749
|
+
onClick: p
|
|
750
|
+
}, I(e.confirmButtonText), 3))
|
|
583
751
|
])
|
|
584
|
-
], 4)) :
|
|
752
|
+
], 4)) : T("", !0)
|
|
585
753
|
]),
|
|
586
754
|
_: 3
|
|
587
755
|
})
|
|
588
756
|
]))
|
|
589
757
|
]));
|
|
590
758
|
}
|
|
591
|
-
}),
|
|
759
|
+
}), rt = /* @__PURE__ */ D({
|
|
592
760
|
name: "XBacktop",
|
|
593
761
|
__name: "index",
|
|
594
762
|
props: {
|
|
@@ -597,43 +765,43 @@ const Ke = /* @__PURE__ */ A({
|
|
|
597
765
|
bottom: { default: 40 }
|
|
598
766
|
},
|
|
599
767
|
emits: ["click"],
|
|
600
|
-
setup(e, { emit:
|
|
601
|
-
const t = e,
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
},
|
|
768
|
+
setup(e, { emit: c }) {
|
|
769
|
+
const t = e, a = c, o = Z("backtop"), s = z(!1), u = () => {
|
|
770
|
+
const l = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
771
|
+
s.value = l >= t.visibilityHeight;
|
|
772
|
+
}, g = (l) => {
|
|
605
773
|
window.scrollTo({
|
|
606
774
|
top: 0,
|
|
607
775
|
behavior: "smooth"
|
|
608
|
-
}),
|
|
609
|
-
},
|
|
776
|
+
}), a("click", l);
|
|
777
|
+
}, v = S(() => ({
|
|
610
778
|
right: `${t.right}px`,
|
|
611
779
|
bottom: `${t.bottom}px`
|
|
612
780
|
}));
|
|
613
|
-
return
|
|
614
|
-
window.addEventListener("scroll",
|
|
615
|
-
}),
|
|
616
|
-
window.removeEventListener("scroll",
|
|
617
|
-
}), (
|
|
618
|
-
default:
|
|
619
|
-
|
|
620
|
-
class:
|
|
621
|
-
style:
|
|
622
|
-
onClick:
|
|
781
|
+
return ye(() => {
|
|
782
|
+
window.addEventListener("scroll", u, { passive: !0, capture: !0 }), setTimeout(u, 100);
|
|
783
|
+
}), ue(() => {
|
|
784
|
+
window.removeEventListener("scroll", u, !0);
|
|
785
|
+
}), (l, w) => (h(), _(X, { name: "x-fade" }, {
|
|
786
|
+
default: A(() => [
|
|
787
|
+
re(C("div", {
|
|
788
|
+
class: r(f(o).b()),
|
|
789
|
+
style: O(v.value),
|
|
790
|
+
onClick: g
|
|
623
791
|
}, [
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
class:
|
|
792
|
+
V(l.$slots, "default", {}, () => [
|
|
793
|
+
C("span", {
|
|
794
|
+
class: r(f(o).e("icon"))
|
|
627
795
|
}, "↑", 2)
|
|
628
796
|
])
|
|
629
797
|
], 6), [
|
|
630
|
-
[
|
|
798
|
+
[ce, s.value]
|
|
631
799
|
])
|
|
632
800
|
]),
|
|
633
801
|
_: 3
|
|
634
802
|
}));
|
|
635
803
|
}
|
|
636
|
-
}),
|
|
804
|
+
}), He = /* @__PURE__ */ D({
|
|
637
805
|
name: "XMessage",
|
|
638
806
|
__name: "index",
|
|
639
807
|
props: {
|
|
@@ -647,119 +815,119 @@ const Ke = /* @__PURE__ */ A({
|
|
|
647
815
|
onClose: {}
|
|
648
816
|
},
|
|
649
817
|
emits: ["close", "destroy"],
|
|
650
|
-
setup(e, { expose:
|
|
651
|
-
const
|
|
818
|
+
setup(e, { expose: c, emit: t }) {
|
|
819
|
+
const a = e, o = t, s = Z("message"), u = z(!1), g = z(Te()), v = {
|
|
652
820
|
success: "✓",
|
|
653
821
|
warning: "⚠",
|
|
654
822
|
error: "✕",
|
|
655
823
|
info: "ℹ"
|
|
656
|
-
},
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
]),
|
|
663
|
-
top: `${
|
|
664
|
-
zIndex:
|
|
824
|
+
}, l = S(() => [
|
|
825
|
+
s.b(),
|
|
826
|
+
s.m(a.type),
|
|
827
|
+
s.is("center", a.center),
|
|
828
|
+
s.is("closable", a.showClose),
|
|
829
|
+
a.customClass
|
|
830
|
+
]), w = S(() => ({
|
|
831
|
+
top: `${a.offset}px`,
|
|
832
|
+
zIndex: g.value
|
|
665
833
|
}));
|
|
666
|
-
let
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
},
|
|
671
|
-
},
|
|
672
|
-
|
|
673
|
-
},
|
|
674
|
-
var
|
|
675
|
-
|
|
676
|
-
},
|
|
834
|
+
let p = null;
|
|
835
|
+
const x = () => {
|
|
836
|
+
a.duration > 0 && (p = setTimeout(() => {
|
|
837
|
+
d();
|
|
838
|
+
}, a.duration));
|
|
839
|
+
}, m = () => {
|
|
840
|
+
p && (clearTimeout(p), p = null);
|
|
841
|
+
}, d = () => {
|
|
842
|
+
var b;
|
|
843
|
+
u.value = !1, (b = a.onClose) == null || b.call(a), o("close");
|
|
844
|
+
}, n = () => {
|
|
677
845
|
o("destroy");
|
|
678
846
|
};
|
|
679
|
-
return
|
|
680
|
-
|
|
681
|
-
}),
|
|
682
|
-
|
|
683
|
-
}),
|
|
684
|
-
close:
|
|
685
|
-
}), (
|
|
847
|
+
return ye(() => {
|
|
848
|
+
x(), u.value = !0;
|
|
849
|
+
}), ue(() => {
|
|
850
|
+
m();
|
|
851
|
+
}), c({
|
|
852
|
+
close: d
|
|
853
|
+
}), (b, i) => (h(), _(X, {
|
|
686
854
|
name: "x-message-fade",
|
|
687
|
-
onAfterLeave:
|
|
855
|
+
onAfterLeave: n
|
|
688
856
|
}, {
|
|
689
|
-
default:
|
|
690
|
-
|
|
857
|
+
default: A(() => [
|
|
858
|
+
u.value ? (h(), k("div", {
|
|
691
859
|
key: 0,
|
|
692
|
-
class:
|
|
693
|
-
style:
|
|
694
|
-
onMouseenter:
|
|
695
|
-
onMouseleave:
|
|
860
|
+
class: r(l.value),
|
|
861
|
+
style: O(w.value),
|
|
862
|
+
onMouseenter: m,
|
|
863
|
+
onMouseleave: x
|
|
696
864
|
}, [
|
|
697
|
-
|
|
698
|
-
class:
|
|
699
|
-
},
|
|
700
|
-
|
|
701
|
-
class:
|
|
865
|
+
C("span", {
|
|
866
|
+
class: r(f(s).e("icon"))
|
|
867
|
+
}, I(v[e.type]), 3),
|
|
868
|
+
C("span", {
|
|
869
|
+
class: r(f(s).e("content"))
|
|
702
870
|
}, [
|
|
703
|
-
|
|
704
|
-
N(
|
|
871
|
+
V(b.$slots, "default", {}, () => [
|
|
872
|
+
N(I(e.message), 1)
|
|
705
873
|
])
|
|
706
874
|
], 2),
|
|
707
|
-
e.showClose ? (
|
|
875
|
+
e.showClose ? (h(), k("button", {
|
|
708
876
|
key: 0,
|
|
709
|
-
class:
|
|
710
|
-
onClick:
|
|
711
|
-
}, " ✕ ", 2)) :
|
|
712
|
-
], 38)) :
|
|
877
|
+
class: r(f(s).e("close")),
|
|
878
|
+
onClick: d
|
|
879
|
+
}, " ✕ ", 2)) : T("", !0)
|
|
880
|
+
], 38)) : T("", !0)
|
|
713
881
|
]),
|
|
714
882
|
_: 3
|
|
715
883
|
}));
|
|
716
884
|
}
|
|
717
885
|
}), G = [];
|
|
718
|
-
let
|
|
719
|
-
const
|
|
886
|
+
let Ae = 1;
|
|
887
|
+
const De = () => {
|
|
720
888
|
G.slice().forEach((e) => e.close());
|
|
721
889
|
};
|
|
722
890
|
function xe(e) {
|
|
723
|
-
const
|
|
891
|
+
const c = Ae++, t = document.createElement("div");
|
|
724
892
|
document.body.appendChild(t);
|
|
725
|
-
const
|
|
893
|
+
const a = {
|
|
726
894
|
success: { bg: "#f0f9eb", border: "#67c23a", icon: "✓" },
|
|
727
895
|
warning: { bg: "#fdf6ec", border: "#e6a23c", icon: "⚠" },
|
|
728
896
|
error: { bg: "#fef0f0", border: "#f56c6c", icon: "✕" },
|
|
729
897
|
info: { bg: "#f4f4f5", border: "#909399", icon: "ℹ" }
|
|
730
|
-
}, o = e.type || "info",
|
|
898
|
+
}, o = e.type || "info", s = a[o] || a.info, u = Ce({
|
|
731
899
|
visible: !1,
|
|
732
900
|
offset: e.offset ?? 20
|
|
733
901
|
});
|
|
734
|
-
let
|
|
735
|
-
G.forEach((
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
}),
|
|
739
|
-
let
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
if (
|
|
743
|
-
|
|
744
|
-
const
|
|
745
|
-
|
|
902
|
+
let g = e.offset ?? 20;
|
|
903
|
+
G.forEach((n) => {
|
|
904
|
+
const b = n.container.firstElementChild;
|
|
905
|
+
b && b.offsetHeight && (g += b.offsetHeight + 16);
|
|
906
|
+
}), u.offset = g;
|
|
907
|
+
let v = null, l = !1;
|
|
908
|
+
const w = () => {
|
|
909
|
+
l || (u.visible = !1, setTimeout(() => {
|
|
910
|
+
if (l) return;
|
|
911
|
+
l = !0;
|
|
912
|
+
const n = G.findIndex((b) => b.id === c);
|
|
913
|
+
n !== -1 && G.splice(n, 1);
|
|
746
914
|
try {
|
|
747
|
-
|
|
915
|
+
m.unmount();
|
|
748
916
|
} catch {
|
|
749
917
|
}
|
|
750
918
|
t.parentNode && t.parentNode.removeChild(t);
|
|
751
919
|
}, 300));
|
|
752
|
-
},
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
},
|
|
756
|
-
|
|
757
|
-
},
|
|
920
|
+
}, p = () => {
|
|
921
|
+
const n = e.duration ?? 3e3;
|
|
922
|
+
n > 0 && (v = setTimeout(w, n));
|
|
923
|
+
}, x = () => {
|
|
924
|
+
v && (clearTimeout(v), v = null);
|
|
925
|
+
}, m = ve({
|
|
758
926
|
render() {
|
|
759
|
-
if (!
|
|
760
|
-
const
|
|
927
|
+
if (!u.visible) return null;
|
|
928
|
+
const n = [
|
|
761
929
|
// Icon
|
|
762
|
-
|
|
930
|
+
$("span", {
|
|
763
931
|
style: {
|
|
764
932
|
display: "inline-flex",
|
|
765
933
|
alignItems: "center",
|
|
@@ -768,11 +936,11 @@ function xe(e) {
|
|
|
768
936
|
height: "20px",
|
|
769
937
|
marginRight: "10px",
|
|
770
938
|
fontSize: "16px",
|
|
771
|
-
color:
|
|
939
|
+
color: s.border
|
|
772
940
|
}
|
|
773
|
-
},
|
|
941
|
+
}, s.icon),
|
|
774
942
|
// Content
|
|
775
|
-
|
|
943
|
+
$("span", {
|
|
776
944
|
style: {
|
|
777
945
|
flex: "1",
|
|
778
946
|
fontSize: "14px",
|
|
@@ -781,8 +949,8 @@ function xe(e) {
|
|
|
781
949
|
}
|
|
782
950
|
}, e.message || "")
|
|
783
951
|
];
|
|
784
|
-
return e.showClose &&
|
|
785
|
-
|
|
952
|
+
return e.showClose && n.push(
|
|
953
|
+
$("button", {
|
|
786
954
|
style: {
|
|
787
955
|
position: "absolute",
|
|
788
956
|
top: "50%",
|
|
@@ -795,16 +963,16 @@ function xe(e) {
|
|
|
795
963
|
color: "#909399",
|
|
796
964
|
padding: "0"
|
|
797
965
|
},
|
|
798
|
-
onClick: (
|
|
799
|
-
|
|
966
|
+
onClick: (b) => {
|
|
967
|
+
b.stopPropagation(), w();
|
|
800
968
|
}
|
|
801
969
|
}, "✕")
|
|
802
|
-
),
|
|
970
|
+
), $("div", {
|
|
803
971
|
class: ["x-message", `x-message--${o}`, e.center ? "is-center" : "", e.showClose ? "is-closable" : ""],
|
|
804
972
|
style: {
|
|
805
973
|
position: "fixed",
|
|
806
974
|
left: "50%",
|
|
807
|
-
top: `${
|
|
975
|
+
top: `${u.offset}px`,
|
|
808
976
|
transform: "translateX(-50%)",
|
|
809
977
|
display: "flex",
|
|
810
978
|
alignItems: "center",
|
|
@@ -813,139 +981,139 @@ function xe(e) {
|
|
|
813
981
|
boxShadow: "0 2px 12px rgba(0,0,0,0.1)",
|
|
814
982
|
minWidth: "280px",
|
|
815
983
|
maxWidth: "480px",
|
|
816
|
-
backgroundColor:
|
|
817
|
-
border: `1px solid ${
|
|
818
|
-
zIndex: 2e3 +
|
|
984
|
+
backgroundColor: s.bg,
|
|
985
|
+
border: `1px solid ${s.border}`,
|
|
986
|
+
zIndex: 2e3 + c,
|
|
819
987
|
transition: "opacity 0.3s, transform 0.3s"
|
|
820
988
|
},
|
|
821
|
-
onMouseenter:
|
|
822
|
-
onMouseleave:
|
|
823
|
-
},
|
|
989
|
+
onMouseenter: x,
|
|
990
|
+
onMouseleave: p
|
|
991
|
+
}, n);
|
|
824
992
|
}
|
|
825
993
|
});
|
|
826
|
-
|
|
827
|
-
|
|
994
|
+
m.mount(t), ee(() => {
|
|
995
|
+
u.visible = !0, p();
|
|
828
996
|
});
|
|
829
|
-
const
|
|
830
|
-
return G.push(
|
|
997
|
+
const d = { id: c, app: m, container: t, close: w };
|
|
998
|
+
return G.push(d), { close: w };
|
|
831
999
|
}
|
|
832
|
-
function
|
|
1000
|
+
function Fe(e) {
|
|
833
1001
|
return xe(typeof e == "string" ? { message: e } : e);
|
|
834
1002
|
}
|
|
835
|
-
const
|
|
836
|
-
info:
|
|
837
|
-
success:
|
|
838
|
-
warning:
|
|
839
|
-
error:
|
|
840
|
-
closeAll:
|
|
841
|
-
}),
|
|
1003
|
+
const le = (e) => (c) => xe({ ...typeof c == "string" ? { message: c } : c, type: e }), me = Object.assign(Fe, {
|
|
1004
|
+
info: le("info"),
|
|
1005
|
+
success: le("success"),
|
|
1006
|
+
warning: le("warning"),
|
|
1007
|
+
error: le("error"),
|
|
1008
|
+
closeAll: De
|
|
1009
|
+
}), ct = me, ut = He, dt = {
|
|
842
1010
|
install(e) {
|
|
843
|
-
e.config.globalProperties.$message =
|
|
1011
|
+
e.config.globalProperties.$message = me, e.provide("message", me);
|
|
844
1012
|
}
|
|
845
|
-
}, J = [],
|
|
1013
|
+
}, J = [], We = () => {
|
|
846
1014
|
J.slice().forEach((e) => e.close());
|
|
847
|
-
},
|
|
1015
|
+
}, _e = {
|
|
848
1016
|
success: { icon: "✓", color: "#67c23a" },
|
|
849
1017
|
warning: { icon: "⚠", color: "#e6a23c" },
|
|
850
1018
|
error: { icon: "✕", color: "#f56c6c" },
|
|
851
1019
|
info: { icon: "ℹ", color: "#909399" }
|
|
852
1020
|
};
|
|
853
|
-
function
|
|
854
|
-
return new Promise((
|
|
1021
|
+
function de(e) {
|
|
1022
|
+
return new Promise((c) => {
|
|
855
1023
|
const t = document.createElement("div");
|
|
856
1024
|
document.body.appendChild(t);
|
|
857
|
-
let
|
|
858
|
-
const o =
|
|
1025
|
+
let a = !1;
|
|
1026
|
+
const o = D({
|
|
859
1027
|
name: "TMessageBox",
|
|
860
1028
|
setup() {
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
|
|
1029
|
+
const g = z(!1), v = z(e.inputValue ?? ""), l = z(""), w = 2e3 + J.length + 1, p = (b) => {
|
|
1030
|
+
a || (a = !0, g.value = !1, setTimeout(() => {
|
|
1031
|
+
const i = J.findIndex((y) => y.container === t);
|
|
1032
|
+
i !== -1 && J.splice(i, 1);
|
|
865
1033
|
try {
|
|
866
|
-
|
|
1034
|
+
s.unmount();
|
|
867
1035
|
} catch {
|
|
868
1036
|
}
|
|
869
|
-
t.parentNode && t.parentNode.removeChild(t),
|
|
870
|
-
action:
|
|
871
|
-
value:
|
|
1037
|
+
t.parentNode && t.parentNode.removeChild(t), c({
|
|
1038
|
+
action: b,
|
|
1039
|
+
value: b === "confirm" ? v.value : void 0
|
|
872
1040
|
});
|
|
873
1041
|
}, 300));
|
|
874
|
-
},
|
|
875
|
-
if (e.showInput && e.inputPattern && !e.inputPattern.test(
|
|
876
|
-
|
|
1042
|
+
}, x = () => {
|
|
1043
|
+
if (e.showInput && e.inputPattern && !e.inputPattern.test(v.value)) {
|
|
1044
|
+
l.value = e.inputErrorMessage || "输入格式不正确";
|
|
877
1045
|
return;
|
|
878
1046
|
}
|
|
879
|
-
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
-
},
|
|
883
|
-
|
|
884
|
-
},
|
|
885
|
-
e.closeOnClickModal !== !1 &&
|
|
1047
|
+
l.value = "", p("confirm");
|
|
1048
|
+
}, m = () => {
|
|
1049
|
+
p("cancel");
|
|
1050
|
+
}, d = () => {
|
|
1051
|
+
p("close");
|
|
1052
|
+
}, n = () => {
|
|
1053
|
+
e.closeOnClickModal !== !1 && d();
|
|
886
1054
|
};
|
|
887
1055
|
return ee(() => {
|
|
888
|
-
|
|
1056
|
+
g.value = !0;
|
|
889
1057
|
}), {
|
|
890
|
-
visible:
|
|
891
|
-
inputValue:
|
|
892
|
-
inputError:
|
|
893
|
-
zIndex:
|
|
894
|
-
handleConfirm:
|
|
895
|
-
handleCancel:
|
|
896
|
-
handleClose:
|
|
897
|
-
handleMaskClick:
|
|
1058
|
+
visible: g,
|
|
1059
|
+
inputValue: v,
|
|
1060
|
+
inputError: l,
|
|
1061
|
+
zIndex: w,
|
|
1062
|
+
handleConfirm: x,
|
|
1063
|
+
handleCancel: m,
|
|
1064
|
+
handleClose: d,
|
|
1065
|
+
handleMaskClick: n
|
|
898
1066
|
};
|
|
899
1067
|
},
|
|
900
1068
|
render() {
|
|
901
1069
|
if (!this.visible) return null;
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
1070
|
+
const g = e.type, v = g ? _e[g] : null, l = [];
|
|
1071
|
+
v && l.push(
|
|
1072
|
+
$("span", {
|
|
905
1073
|
class: "x-message-box__icon",
|
|
906
|
-
style: { color:
|
|
907
|
-
},
|
|
908
|
-
),
|
|
909
|
-
|
|
910
|
-
), e.showClose !== !1 &&
|
|
911
|
-
|
|
1074
|
+
style: { color: v.color, marginRight: "10px", fontSize: "20px" }
|
|
1075
|
+
}, v.icon)
|
|
1076
|
+
), l.push(
|
|
1077
|
+
$("span", { class: "x-message-box__title" }, e.title || "提示")
|
|
1078
|
+
), e.showClose !== !1 && l.push(
|
|
1079
|
+
$("button", {
|
|
912
1080
|
class: "x-message-box__close",
|
|
913
1081
|
onClick: this.handleClose
|
|
914
1082
|
}, "✕")
|
|
915
1083
|
);
|
|
916
|
-
const
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
), e.showInput &&
|
|
920
|
-
|
|
921
|
-
|
|
1084
|
+
const w = [];
|
|
1085
|
+
w.push(
|
|
1086
|
+
$("div", { class: "x-message-box__content" }, e.message || "")
|
|
1087
|
+
), e.showInput && w.push(
|
|
1088
|
+
$("div", { class: "x-message-box__input", style: { marginTop: "12px" } }, [
|
|
1089
|
+
$("input", {
|
|
922
1090
|
class: ["x-message-box__input-inner", this.inputError ? "is-error" : ""].filter(Boolean),
|
|
923
1091
|
type: e.inputType || "text",
|
|
924
1092
|
placeholder: e.inputPlaceholder || "请输入",
|
|
925
1093
|
value: this.inputValue,
|
|
926
|
-
onInput: (
|
|
927
|
-
this.inputValue =
|
|
1094
|
+
onInput: (x) => {
|
|
1095
|
+
this.inputValue = x.target.value, this.inputError = "";
|
|
928
1096
|
},
|
|
929
|
-
onKeyup: (
|
|
930
|
-
|
|
1097
|
+
onKeyup: (x) => {
|
|
1098
|
+
x.key === "Enter" && this.handleConfirm();
|
|
931
1099
|
}
|
|
932
1100
|
}),
|
|
933
|
-
this.inputError ?
|
|
1101
|
+
this.inputError ? $("div", { class: "x-message-box__error", style: { color: "#f56c6c", fontSize: "12px", marginTop: "4px" } }, this.inputError) : null
|
|
934
1102
|
])
|
|
935
1103
|
);
|
|
936
|
-
const
|
|
937
|
-
return e.showCancelButton &&
|
|
938
|
-
|
|
1104
|
+
const p = [];
|
|
1105
|
+
return e.showCancelButton && p.push(
|
|
1106
|
+
$("button", {
|
|
939
1107
|
class: "x-button p-button--default",
|
|
940
1108
|
onClick: this.handleCancel
|
|
941
1109
|
}, e.cancelButtonText || "取消")
|
|
942
|
-
), e.showConfirmButton !== !1 &&
|
|
943
|
-
|
|
1110
|
+
), e.showConfirmButton !== !1 && p.push(
|
|
1111
|
+
$("button", {
|
|
944
1112
|
class: "x-button p-button--primary",
|
|
945
1113
|
onClick: this.handleConfirm,
|
|
946
1114
|
style: { marginLeft: "10px" }
|
|
947
1115
|
}, e.confirmButtonText || "确定")
|
|
948
|
-
),
|
|
1116
|
+
), $("div", {
|
|
949
1117
|
class: ["x-message-box-wrapper", e.center ? "is-center" : ""],
|
|
950
1118
|
style: {
|
|
951
1119
|
position: "fixed",
|
|
@@ -961,7 +1129,7 @@ function re(e) {
|
|
|
961
1129
|
},
|
|
962
1130
|
onClick: this.handleMaskClick
|
|
963
1131
|
}, [
|
|
964
|
-
|
|
1132
|
+
$("div", {
|
|
965
1133
|
class: ["x-message-box", e.customClass],
|
|
966
1134
|
style: {
|
|
967
1135
|
backgroundColor: "#fff",
|
|
@@ -970,10 +1138,10 @@ function re(e) {
|
|
|
970
1138
|
minWidth: "300px",
|
|
971
1139
|
maxWidth: "500px"
|
|
972
1140
|
},
|
|
973
|
-
onClick: (
|
|
1141
|
+
onClick: (x) => x.stopPropagation()
|
|
974
1142
|
}, [
|
|
975
1143
|
// Header
|
|
976
|
-
|
|
1144
|
+
$("div", {
|
|
977
1145
|
class: "x-message-box__header",
|
|
978
1146
|
style: {
|
|
979
1147
|
display: "flex",
|
|
@@ -982,100 +1150,100 @@ function re(e) {
|
|
|
982
1150
|
padding: "16px 20px",
|
|
983
1151
|
borderBottom: "1px solid #eee"
|
|
984
1152
|
}
|
|
985
|
-
},
|
|
1153
|
+
}, l),
|
|
986
1154
|
// Body
|
|
987
|
-
|
|
1155
|
+
$("div", {
|
|
988
1156
|
class: "x-message-box__body",
|
|
989
1157
|
style: {
|
|
990
1158
|
padding: "20px",
|
|
991
1159
|
fontSize: "14px",
|
|
992
1160
|
color: "#606266"
|
|
993
1161
|
}
|
|
994
|
-
},
|
|
1162
|
+
}, w),
|
|
995
1163
|
// Footer
|
|
996
|
-
|
|
1164
|
+
$("div", {
|
|
997
1165
|
class: "x-message-box__footer",
|
|
998
1166
|
style: {
|
|
999
1167
|
padding: "10px 20px 16px",
|
|
1000
1168
|
textAlign: "right"
|
|
1001
1169
|
}
|
|
1002
|
-
},
|
|
1170
|
+
}, p)
|
|
1003
1171
|
])
|
|
1004
1172
|
]);
|
|
1005
1173
|
}
|
|
1006
|
-
}),
|
|
1007
|
-
|
|
1008
|
-
const
|
|
1009
|
-
app:
|
|
1174
|
+
}), s = ve(o);
|
|
1175
|
+
s.mount(t);
|
|
1176
|
+
const u = {
|
|
1177
|
+
app: s,
|
|
1010
1178
|
container: t,
|
|
1011
1179
|
close: () => {
|
|
1012
|
-
var
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1180
|
+
var v;
|
|
1181
|
+
const g = (v = s._instance) == null ? void 0 : v.proxy;
|
|
1182
|
+
g != null && g.handleClose && g.handleClose();
|
|
1015
1183
|
}
|
|
1016
1184
|
};
|
|
1017
|
-
J.push(
|
|
1185
|
+
J.push(u);
|
|
1018
1186
|
});
|
|
1019
1187
|
}
|
|
1020
|
-
async function
|
|
1021
|
-
return
|
|
1188
|
+
async function Xe(e, c, t) {
|
|
1189
|
+
return de({
|
|
1022
1190
|
message: e,
|
|
1023
|
-
title:
|
|
1191
|
+
title: c,
|
|
1024
1192
|
...t,
|
|
1025
1193
|
showConfirmButton: !0,
|
|
1026
1194
|
showCancelButton: !1
|
|
1027
1195
|
});
|
|
1028
1196
|
}
|
|
1029
|
-
async function
|
|
1030
|
-
return
|
|
1197
|
+
async function je(e, c, t) {
|
|
1198
|
+
return de({
|
|
1031
1199
|
message: e,
|
|
1032
|
-
title:
|
|
1200
|
+
title: c,
|
|
1033
1201
|
...t,
|
|
1034
1202
|
showConfirmButton: !0,
|
|
1035
1203
|
showCancelButton: !0
|
|
1036
1204
|
});
|
|
1037
1205
|
}
|
|
1038
|
-
async function
|
|
1039
|
-
return
|
|
1206
|
+
async function qe(e, c, t) {
|
|
1207
|
+
return de({
|
|
1040
1208
|
message: e,
|
|
1041
|
-
title:
|
|
1209
|
+
title: c,
|
|
1042
1210
|
...t,
|
|
1043
1211
|
showInput: !0,
|
|
1044
1212
|
showConfirmButton: !0,
|
|
1045
1213
|
showCancelButton: !0
|
|
1046
1214
|
});
|
|
1047
1215
|
}
|
|
1048
|
-
function
|
|
1049
|
-
return
|
|
1216
|
+
function Ze(e) {
|
|
1217
|
+
return de(e);
|
|
1050
1218
|
}
|
|
1051
|
-
const
|
|
1052
|
-
alert:
|
|
1053
|
-
confirm:
|
|
1054
|
-
prompt:
|
|
1055
|
-
closeAll:
|
|
1056
|
-
}),
|
|
1219
|
+
const U = Object.assign(Ze, {
|
|
1220
|
+
alert: Xe,
|
|
1221
|
+
confirm: je,
|
|
1222
|
+
prompt: qe,
|
|
1223
|
+
closeAll: We
|
|
1224
|
+
}), ft = U, pt = {
|
|
1057
1225
|
install(e) {
|
|
1058
|
-
e.config.globalProperties.$msgbox =
|
|
1226
|
+
e.config.globalProperties.$msgbox = U, e.config.globalProperties.$alert = U.alert, e.config.globalProperties.$confirm = U.confirm, e.config.globalProperties.$prompt = U.prompt, e.provide("messageBox", U);
|
|
1059
1227
|
}
|
|
1060
1228
|
}, Q = [];
|
|
1061
|
-
let
|
|
1062
|
-
const
|
|
1229
|
+
let Ke = 1;
|
|
1230
|
+
const Ue = () => {
|
|
1063
1231
|
Q.slice().forEach((e) => e.close());
|
|
1064
|
-
},
|
|
1232
|
+
}, Ye = {
|
|
1065
1233
|
success: { icon: "✓", color: "#67c23a" },
|
|
1066
1234
|
warning: { icon: "⚠", color: "#e6a23c" },
|
|
1067
1235
|
error: { icon: "✕", color: "#f56c6c" },
|
|
1068
1236
|
info: { icon: "ℹ", color: "#909399" }
|
|
1069
|
-
},
|
|
1237
|
+
}, Ge = (e, c) => {
|
|
1070
1238
|
const t = Q.filter((o) => o.position === e);
|
|
1071
|
-
let
|
|
1239
|
+
let a = 16;
|
|
1072
1240
|
for (const o of t)
|
|
1073
|
-
if (o.id <
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1241
|
+
if (o.id < c) {
|
|
1242
|
+
const s = o.container.firstElementChild;
|
|
1243
|
+
s && (a += s.offsetHeight + 16);
|
|
1076
1244
|
}
|
|
1077
|
-
return
|
|
1078
|
-
},
|
|
1245
|
+
return a;
|
|
1246
|
+
}, Je = (e, c) => {
|
|
1079
1247
|
const t = {
|
|
1080
1248
|
position: "fixed",
|
|
1081
1249
|
width: "330px",
|
|
@@ -1083,61 +1251,61 @@ const Ae = () => {
|
|
|
1083
1251
|
};
|
|
1084
1252
|
switch (e) {
|
|
1085
1253
|
case "top-right":
|
|
1086
|
-
t.top = `${
|
|
1254
|
+
t.top = `${c}px`, t.right = "16px";
|
|
1087
1255
|
break;
|
|
1088
1256
|
case "top-left":
|
|
1089
|
-
t.top = `${
|
|
1257
|
+
t.top = `${c}px`, t.left = "16px";
|
|
1090
1258
|
break;
|
|
1091
1259
|
case "bottom-right":
|
|
1092
|
-
t.bottom = `${
|
|
1260
|
+
t.bottom = `${c}px`, t.right = "16px";
|
|
1093
1261
|
break;
|
|
1094
1262
|
case "bottom-left":
|
|
1095
|
-
t.bottom = `${
|
|
1263
|
+
t.bottom = `${c}px`, t.left = "16px";
|
|
1096
1264
|
break;
|
|
1097
1265
|
default:
|
|
1098
|
-
t.top = `${
|
|
1266
|
+
t.top = `${c}px`, t.right = "16px";
|
|
1099
1267
|
}
|
|
1100
1268
|
return t;
|
|
1101
1269
|
};
|
|
1102
|
-
function
|
|
1103
|
-
const
|
|
1104
|
-
document.body.appendChild(
|
|
1105
|
-
let o = null,
|
|
1106
|
-
const
|
|
1270
|
+
function we(e) {
|
|
1271
|
+
const c = Ke++, t = e.position || "top-right", a = document.createElement("div");
|
|
1272
|
+
document.body.appendChild(a);
|
|
1273
|
+
let o = null, s = !1;
|
|
1274
|
+
const u = D({
|
|
1107
1275
|
name: "TNotification",
|
|
1108
1276
|
setup() {
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
var
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1277
|
+
const l = z(!1), w = () => {
|
|
1278
|
+
s || (s = !0, l.value = !1, setTimeout(() => {
|
|
1279
|
+
var b;
|
|
1280
|
+
const n = Q.findIndex((i) => i.id === c);
|
|
1281
|
+
n !== -1 && Q.splice(n, 1), o && clearTimeout(o), (b = e.onClose) == null || b.call(e);
|
|
1114
1282
|
try {
|
|
1115
|
-
|
|
1283
|
+
g.unmount();
|
|
1116
1284
|
} catch {
|
|
1117
1285
|
}
|
|
1118
|
-
|
|
1286
|
+
a.parentNode && a.parentNode.removeChild(a);
|
|
1119
1287
|
}, 300));
|
|
1120
|
-
},
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1123
|
-
},
|
|
1288
|
+
}, p = () => {
|
|
1289
|
+
const n = e.duration ?? 4500;
|
|
1290
|
+
n > 0 && (o = setTimeout(w, n));
|
|
1291
|
+
}, x = () => {
|
|
1124
1292
|
o && (clearTimeout(o), o = null);
|
|
1125
|
-
},
|
|
1293
|
+
}, m = S(() => (e.offset ?? 0) + Ge(t, c)), d = S(() => Je(t, m.value));
|
|
1126
1294
|
return ee(() => {
|
|
1127
|
-
|
|
1295
|
+
l.value = !0, p();
|
|
1128
1296
|
}), {
|
|
1129
|
-
visible:
|
|
1130
|
-
close:
|
|
1131
|
-
positionStyles:
|
|
1132
|
-
startTimer:
|
|
1133
|
-
clearTimer:
|
|
1297
|
+
visible: l,
|
|
1298
|
+
close: w,
|
|
1299
|
+
positionStyles: d,
|
|
1300
|
+
startTimer: p,
|
|
1301
|
+
clearTimer: x
|
|
1134
1302
|
};
|
|
1135
1303
|
},
|
|
1136
1304
|
render() {
|
|
1137
1305
|
if (!this.visible) return null;
|
|
1138
|
-
const
|
|
1139
|
-
e.title &&
|
|
1140
|
-
|
|
1306
|
+
const l = e.type, w = l ? Ye[l] : null, p = [];
|
|
1307
|
+
e.title && p.push(
|
|
1308
|
+
$("div", {
|
|
1141
1309
|
class: "x-notification__title",
|
|
1142
1310
|
style: {
|
|
1143
1311
|
fontWeight: "600",
|
|
@@ -1146,8 +1314,8 @@ function ye(e) {
|
|
|
1146
1314
|
marginBottom: e.message ? "6px" : "0"
|
|
1147
1315
|
}
|
|
1148
1316
|
}, e.title)
|
|
1149
|
-
), e.message && (e.dangerouslyUseHTMLString ?
|
|
1150
|
-
|
|
1317
|
+
), e.message && (e.dangerouslyUseHTMLString ? p.push(
|
|
1318
|
+
$("div", {
|
|
1151
1319
|
class: "x-notification__content",
|
|
1152
1320
|
style: {
|
|
1153
1321
|
fontSize: "14px",
|
|
@@ -1156,8 +1324,8 @@ function ye(e) {
|
|
|
1156
1324
|
},
|
|
1157
1325
|
innerHTML: e.message
|
|
1158
1326
|
})
|
|
1159
|
-
) :
|
|
1160
|
-
|
|
1327
|
+
) : p.push(
|
|
1328
|
+
$("div", {
|
|
1161
1329
|
class: "x-notification__content",
|
|
1162
1330
|
style: {
|
|
1163
1331
|
fontSize: "14px",
|
|
@@ -1166,9 +1334,9 @@ function ye(e) {
|
|
|
1166
1334
|
}
|
|
1167
1335
|
}, e.message)
|
|
1168
1336
|
));
|
|
1169
|
-
const
|
|
1170
|
-
return
|
|
1171
|
-
|
|
1337
|
+
const x = [];
|
|
1338
|
+
return w && x.push(
|
|
1339
|
+
$("div", {
|
|
1172
1340
|
class: "x-notification__icon",
|
|
1173
1341
|
style: {
|
|
1174
1342
|
display: "flex",
|
|
@@ -1178,18 +1346,18 @@ function ye(e) {
|
|
|
1178
1346
|
height: "24px",
|
|
1179
1347
|
marginRight: "12px",
|
|
1180
1348
|
fontSize: "18px",
|
|
1181
|
-
color:
|
|
1349
|
+
color: w.color
|
|
1182
1350
|
}
|
|
1183
|
-
},
|
|
1184
|
-
),
|
|
1185
|
-
|
|
1351
|
+
}, w.icon)
|
|
1352
|
+
), x.push(
|
|
1353
|
+
$("div", {
|
|
1186
1354
|
class: "x-notification__main",
|
|
1187
1355
|
style: {
|
|
1188
1356
|
flex: "1"
|
|
1189
1357
|
}
|
|
1190
|
-
},
|
|
1191
|
-
), e.showClose !== !1 &&
|
|
1192
|
-
|
|
1358
|
+
}, p)
|
|
1359
|
+
), e.showClose !== !1 && x.push(
|
|
1360
|
+
$("button", {
|
|
1193
1361
|
class: "x-notification__close",
|
|
1194
1362
|
style: {
|
|
1195
1363
|
position: "absolute",
|
|
@@ -1202,11 +1370,11 @@ function ye(e) {
|
|
|
1202
1370
|
color: "#909399",
|
|
1203
1371
|
padding: "0"
|
|
1204
1372
|
},
|
|
1205
|
-
onClick: (
|
|
1206
|
-
|
|
1373
|
+
onClick: (m) => {
|
|
1374
|
+
m.stopPropagation(), this.close();
|
|
1207
1375
|
}
|
|
1208
1376
|
}, "✕")
|
|
1209
|
-
),
|
|
1377
|
+
), $("div", {
|
|
1210
1378
|
class: ["x-notification", e.customClass],
|
|
1211
1379
|
style: {
|
|
1212
1380
|
...this.positionStyles,
|
|
@@ -1221,49 +1389,50 @@ function ye(e) {
|
|
|
1221
1389
|
},
|
|
1222
1390
|
onMouseenter: this.clearTimer,
|
|
1223
1391
|
onMouseleave: this.startTimer
|
|
1224
|
-
},
|
|
1392
|
+
}, x);
|
|
1225
1393
|
}
|
|
1226
|
-
}),
|
|
1227
|
-
|
|
1228
|
-
const
|
|
1229
|
-
id:
|
|
1230
|
-
app:
|
|
1231
|
-
container:
|
|
1394
|
+
}), g = ve(u);
|
|
1395
|
+
g.mount(a);
|
|
1396
|
+
const v = {
|
|
1397
|
+
id: c,
|
|
1398
|
+
app: g,
|
|
1399
|
+
container: a,
|
|
1232
1400
|
position: t,
|
|
1233
1401
|
close: () => {
|
|
1234
|
-
var
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1402
|
+
var w;
|
|
1403
|
+
const l = (w = g._instance) == null ? void 0 : w.proxy;
|
|
1404
|
+
l != null && l.close && l.close();
|
|
1237
1405
|
}
|
|
1238
1406
|
};
|
|
1239
|
-
return Q.push(
|
|
1407
|
+
return Q.push(v), { close: v.close };
|
|
1240
1408
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return
|
|
1409
|
+
function Qe(e) {
|
|
1410
|
+
return we(typeof e == "string" ? { message: e } : e);
|
|
1243
1411
|
}
|
|
1244
|
-
const
|
|
1245
|
-
info:
|
|
1246
|
-
success:
|
|
1247
|
-
warning:
|
|
1248
|
-
error:
|
|
1249
|
-
closeAll:
|
|
1250
|
-
}),
|
|
1412
|
+
const ae = (e) => (c) => we({ ...typeof c == "string" ? { message: c } : c, type: e }), he = Object.assign(Qe, {
|
|
1413
|
+
info: ae("info"),
|
|
1414
|
+
success: ae("success"),
|
|
1415
|
+
warning: ae("warning"),
|
|
1416
|
+
error: ae("error"),
|
|
1417
|
+
closeAll: Ue
|
|
1418
|
+
}), mt = he, ht = {
|
|
1251
1419
|
install(e) {
|
|
1252
|
-
e.config.globalProperties.$notify =
|
|
1420
|
+
e.config.globalProperties.$notify = he, e.provide("notification", he);
|
|
1253
1421
|
}
|
|
1254
1422
|
};
|
|
1255
1423
|
export {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1424
|
+
lt as Alert,
|
|
1425
|
+
rt as Backtop,
|
|
1426
|
+
nt as Drawer,
|
|
1427
|
+
st as DrawerForm,
|
|
1428
|
+
ct as Message,
|
|
1429
|
+
ft as MessageBox,
|
|
1430
|
+
ut as MessageComponent,
|
|
1431
|
+
ot as Modal,
|
|
1432
|
+
mt as Notification,
|
|
1433
|
+
it as Popconfirm,
|
|
1434
|
+
dt as TMessage,
|
|
1435
|
+
pt as TMessageBox,
|
|
1436
|
+
ht as TNotification,
|
|
1437
|
+
at as Tooltip
|
|
1269
1438
|
};
|