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