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