vue-modal-utils 0.3.0 → 0.4.0
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.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动画时长解析配置。
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export interface AnimationDurationConfig {
|
|
7
|
+
/** 全局动画时长配置。 */
|
|
8
|
+
animationDuration?: number | string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 将数字、ms、s 或纯数字字符串解析为毫秒数。
|
|
12
|
+
*
|
|
13
|
+
* @param value - 待解析的动画时长。
|
|
14
|
+
* @returns 解析后的非负毫秒数,无法解析时返回 `null`。
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseAnimationDuration(value: unknown): number | null;
|
|
18
|
+
/**
|
|
19
|
+
* 按调用配置、全局配置、Vant CSS 变量、默认值的顺序解析动画时长。
|
|
20
|
+
*
|
|
21
|
+
* @param options - 单次调用配置。
|
|
22
|
+
* @param globalConfig - 全局配置。
|
|
23
|
+
* @returns 最终动画时长,单位为毫秒。
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveAnimationDuration(options?: AnimationDurationConfig, globalConfig?: AnimationDurationConfig): number;
|
package/dist/vue-modal-utils.mjs
CHANGED
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
import { createApp as W, defineComponent as P, openBlock as c, createBlock as d, withCtx as _, createElementVNode as f, createCommentVNode as b, toDisplayString as C, createVNode as
|
|
2
|
-
import { Popup as
|
|
1
|
+
import { createApp as W, defineComponent as P, openBlock as c, createBlock as d, withCtx as _, createElementVNode as f, createCommentVNode as b, toDisplayString as C, createVNode as z, createTextVNode as T, ref as I, watch as X, computed as M, resolveDynamicComponent as S, mergeProps as Y, createElementBlock as A, Fragment as N, unref as Z, renderList as ee, h as B } from "vue";
|
|
2
|
+
import { Popup as E, Icon as q, Button as j } from "vant/es";
|
|
3
3
|
import "vant/es/popup/style/index";
|
|
4
4
|
import "vant/es/button/style/index";
|
|
5
5
|
import "vant/es/icon/style/index";
|
|
6
|
-
function
|
|
7
|
-
const { unmountDelay: t = 0, parent: n = document.body } =
|
|
6
|
+
function L(e, s = {}) {
|
|
7
|
+
const { unmountDelay: t = 0, parent: n = document.body } = s, o = W(e), r = document.createElement("div");
|
|
8
8
|
n.appendChild(r);
|
|
9
|
-
const m =
|
|
10
|
-
|
|
9
|
+
const m = o.mount(r), l = () => {
|
|
10
|
+
o.unmount(), r.remove();
|
|
11
11
|
};
|
|
12
|
-
return { app:
|
|
12
|
+
return { app: o, instance: m, container: r, unmount: (u) => {
|
|
13
13
|
const p = () => {
|
|
14
14
|
l(), u == null || u();
|
|
15
15
|
};
|
|
16
16
|
t > 0 ? setTimeout(p, t) : p();
|
|
17
17
|
} };
|
|
18
18
|
}
|
|
19
|
-
const te =
|
|
19
|
+
const te = 300, ne = ["--van-duration-base", "--van-animation-duration-base"];
|
|
20
|
+
function V(e) {
|
|
21
|
+
var r;
|
|
22
|
+
if (typeof e == "number" && Number.isFinite(e))
|
|
23
|
+
return Math.max(0, Math.round(e));
|
|
24
|
+
if (typeof e != "string") return null;
|
|
25
|
+
const s = (r = e.trim().split(",")[0]) == null ? void 0 : r.trim();
|
|
26
|
+
if (!s) return null;
|
|
27
|
+
const t = s.match(/^(-?\d+(?:\.\d+)?)ms$/i);
|
|
28
|
+
if (t) return Math.max(0, Math.round(Number(t[1])));
|
|
29
|
+
const n = s.match(/^(-?\d+(?:\.\d+)?)s$/i);
|
|
30
|
+
if (n) return Math.max(0, Math.round(Number(n[1]) * 1e3));
|
|
31
|
+
const o = Number(s);
|
|
32
|
+
return Number.isFinite(o) ? Math.max(0, Math.round(o)) : null;
|
|
33
|
+
}
|
|
34
|
+
function oe() {
|
|
35
|
+
if (typeof window > "u" || typeof document > "u") return null;
|
|
36
|
+
const e = window.getComputedStyle(document.documentElement);
|
|
37
|
+
for (const s of ne) {
|
|
38
|
+
const t = e.getPropertyValue(s), n = V(t);
|
|
39
|
+
if (n !== null) return n;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function G(e = {}, s = {}) {
|
|
44
|
+
const t = V(e.animationDuration);
|
|
45
|
+
if (t !== null) return t;
|
|
46
|
+
const n = V(s.animationDuration);
|
|
47
|
+
if (n !== null) return n;
|
|
48
|
+
const o = oe();
|
|
49
|
+
return o !== null ? o : te;
|
|
50
|
+
}
|
|
51
|
+
const ae = { class: "validate-content" }, se = { class: "popup-header" }, re = { class: "title" }, le = { class: "validate-card" }, ce = { class: "validate-text" }, ue = /* @__PURE__ */ P({
|
|
20
52
|
__name: "BottomPopup",
|
|
21
53
|
props: {
|
|
22
54
|
show: { type: Boolean, default: !1 },
|
|
@@ -26,14 +58,14 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
26
58
|
showClose: { type: Boolean, default: !0 }
|
|
27
59
|
},
|
|
28
60
|
emits: ["update:show", "confirm"],
|
|
29
|
-
setup(e, { emit:
|
|
30
|
-
const t = e, n =
|
|
61
|
+
setup(e, { emit: s }) {
|
|
62
|
+
const t = e, n = s, o = () => {
|
|
31
63
|
n("update:show", !1);
|
|
32
64
|
}, r = () => {
|
|
33
65
|
n("confirm");
|
|
34
66
|
};
|
|
35
67
|
return (m, l) => {
|
|
36
|
-
const u =
|
|
68
|
+
const u = q, p = j, k = E;
|
|
37
69
|
return c(), d(k, {
|
|
38
70
|
show: t.show,
|
|
39
71
|
"onUpdate:show": l[0] || (l[0] = (w) => n("update:show", w)),
|
|
@@ -43,27 +75,27 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
43
75
|
"close-on-click-overlay": !0
|
|
44
76
|
}, {
|
|
45
77
|
default: _(() => [
|
|
46
|
-
f("div",
|
|
47
|
-
f("div",
|
|
78
|
+
f("div", ae, [
|
|
79
|
+
f("div", se, [
|
|
48
80
|
t.showClose ? (c(), d(u, {
|
|
49
81
|
key: 0,
|
|
50
82
|
name: "cross",
|
|
51
83
|
size: "20",
|
|
52
84
|
style: { visibility: "hidden", padding: "8px" }
|
|
53
85
|
})) : b("", !0),
|
|
54
|
-
f("div",
|
|
86
|
+
f("div", re, C(t.title), 1),
|
|
55
87
|
t.showClose ? (c(), d(u, {
|
|
56
88
|
key: 1,
|
|
57
89
|
class: "icon",
|
|
58
90
|
name: "cross",
|
|
59
91
|
size: "20",
|
|
60
92
|
color: "#999",
|
|
61
|
-
onClick:
|
|
93
|
+
onClick: o
|
|
62
94
|
})) : b("", !0)
|
|
63
95
|
]),
|
|
64
|
-
f("div",
|
|
65
|
-
f("p",
|
|
66
|
-
|
|
96
|
+
f("div", le, [
|
|
97
|
+
f("p", ce, C(t.message), 1),
|
|
98
|
+
z(p, {
|
|
67
99
|
type: "primary",
|
|
68
100
|
block: "",
|
|
69
101
|
class: "validate-btn",
|
|
@@ -81,15 +113,15 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
81
113
|
}, 8, ["show"]);
|
|
82
114
|
};
|
|
83
115
|
}
|
|
84
|
-
}),
|
|
116
|
+
}), R = (e, s) => {
|
|
85
117
|
const t = e.__vccOpts || e;
|
|
86
|
-
for (const [n,
|
|
87
|
-
t[n] =
|
|
118
|
+
for (const [n, o] of s)
|
|
119
|
+
t[n] = o;
|
|
88
120
|
return t;
|
|
89
|
-
},
|
|
121
|
+
}, ie = /* @__PURE__ */ R(ue, [["__scopeId", "data-v-84e1a364"]]), me = { class: "modal-renderer-content" }, de = { class: "modal-renderer-header" }, fe = { class: "modal-renderer-title" }, pe = { class: "modal-renderer-body" }, he = {
|
|
90
122
|
key: 0,
|
|
91
123
|
class: "modal-renderer-text"
|
|
92
|
-
},
|
|
124
|
+
}, Ce = { class: "modal-renderer-footer" }, ye = /* @__PURE__ */ P({
|
|
93
125
|
__name: "ModalRenderer",
|
|
94
126
|
props: {
|
|
95
127
|
show: { type: Boolean, default: !0 },
|
|
@@ -108,12 +140,12 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
108
140
|
buttons: { default: null }
|
|
109
141
|
},
|
|
110
142
|
emits: ["update:show", "confirm", "cancel", "close", "action"],
|
|
111
|
-
setup(e, { emit:
|
|
112
|
-
const t = e, n =
|
|
143
|
+
setup(e, { emit: s }) {
|
|
144
|
+
const t = e, n = s, o = I(t.show);
|
|
113
145
|
X(
|
|
114
146
|
() => t.show,
|
|
115
147
|
(a) => {
|
|
116
|
-
|
|
148
|
+
o.value = a;
|
|
117
149
|
}
|
|
118
150
|
);
|
|
119
151
|
const r = M(() => !!(t.content || t.component)), m = M(() => Array.isArray(t.buttons) && t.buttons.length > 0), l = () => n("action", "overlay"), u = () => {
|
|
@@ -124,8 +156,8 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
124
156
|
const g = a.key ?? String(v);
|
|
125
157
|
n("action", g), typeof a.onClick == "function" && a.onClick();
|
|
126
158
|
}, w = () => n("action", "close"), i = (a) => {
|
|
127
|
-
|
|
128
|
-
}, y = (a, v) => n("action", a, v), h = (a) => n("action", "confirm", a),
|
|
159
|
+
o.value = a, n("update:show", a), a || n("action", "close");
|
|
160
|
+
}, y = (a, v) => n("action", a, v), h = (a) => n("action", "confirm", a), O = (a) => n("action", "cancel", a), $ = (a) => n("action", "close", a), H = () => {
|
|
129
161
|
var a;
|
|
130
162
|
return t.component ? B(t.component, t.componentProps) : typeof t.content == "function" ? t.content() : (a = t.content) != null && a.render ? t.content.render() : t.message ? B("p", { class: "modal-renderer-message" }, t.message) : null;
|
|
131
163
|
}, J = P({
|
|
@@ -146,25 +178,25 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
146
178
|
// componentProps: props.componentProps,
|
|
147
179
|
// buttons: props.buttons,
|
|
148
180
|
...t.modalComponentProps,
|
|
149
|
-
show:
|
|
181
|
+
show: o.value,
|
|
150
182
|
requestAction: y,
|
|
151
183
|
requestConfirm: h,
|
|
152
|
-
requestCancel:
|
|
153
|
-
requestClose:
|
|
184
|
+
requestCancel: O,
|
|
185
|
+
requestClose: $
|
|
154
186
|
}));
|
|
155
187
|
return (a, v) => {
|
|
156
|
-
const g =
|
|
157
|
-
return e.modalComponent ? (c(), d(
|
|
188
|
+
const g = q, D = j, Q = E;
|
|
189
|
+
return e.modalComponent ? (c(), d(S(e.modalComponent), Y({ key: 0 }, K.value, {
|
|
158
190
|
"onUpdate:show": i,
|
|
159
191
|
onAction: y,
|
|
160
192
|
onConfirm: h,
|
|
161
|
-
onCancel:
|
|
162
|
-
onClose:
|
|
193
|
+
onCancel: O,
|
|
194
|
+
onClose: $
|
|
163
195
|
}), null, 16)) : (c(), d(Q, {
|
|
164
196
|
key: 1,
|
|
165
|
-
show:
|
|
197
|
+
show: o.value,
|
|
166
198
|
"onUpdate:show": [
|
|
167
|
-
v[0] || (v[0] = (x) =>
|
|
199
|
+
v[0] || (v[0] = (x) => o.value = x),
|
|
168
200
|
i
|
|
169
201
|
],
|
|
170
202
|
position: e.position,
|
|
@@ -174,15 +206,15 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
174
206
|
onClickOverlay: l
|
|
175
207
|
}, {
|
|
176
208
|
default: _(() => [
|
|
177
|
-
f("div",
|
|
178
|
-
f("div",
|
|
209
|
+
f("div", me, [
|
|
210
|
+
f("div", de, [
|
|
179
211
|
e.showClose ? (c(), d(g, {
|
|
180
212
|
key: 0,
|
|
181
213
|
name: "cross",
|
|
182
214
|
size: "20",
|
|
183
215
|
style: { visibility: "hidden", padding: "8px" }
|
|
184
216
|
})) : b("", !0),
|
|
185
|
-
f("div",
|
|
217
|
+
f("div", fe, C(e.title), 1),
|
|
186
218
|
e.showClose ? (c(), d(g, {
|
|
187
219
|
key: 1,
|
|
188
220
|
class: "modal-renderer-close",
|
|
@@ -192,17 +224,17 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
192
224
|
onClick: w
|
|
193
225
|
})) : b("", !0)
|
|
194
226
|
]),
|
|
195
|
-
f("div",
|
|
196
|
-
r.value ? (c(), d(
|
|
197
|
-
e.message ? (c(), A("p",
|
|
227
|
+
f("div", pe, [
|
|
228
|
+
r.value ? (c(), d(S(Z(J)), { key: 1 })) : (c(), A(N, { key: 0 }, [
|
|
229
|
+
e.message ? (c(), A("p", he, C(e.message), 1)) : b("", !0)
|
|
198
230
|
], 64))
|
|
199
231
|
]),
|
|
200
|
-
f("div",
|
|
201
|
-
m.value ? (c(!0), A(N, { key: 0 }, ee(e.buttons, (x,
|
|
202
|
-
key:
|
|
232
|
+
f("div", Ce, [
|
|
233
|
+
m.value ? (c(!0), A(N, { key: 0 }, ee(e.buttons, (x, F) => (c(), d(D, {
|
|
234
|
+
key: F,
|
|
203
235
|
type: x.type || "default",
|
|
204
236
|
class: "modal-renderer-btn",
|
|
205
|
-
onClick: (_e) => k(x,
|
|
237
|
+
onClick: (_e) => k(x, F)
|
|
206
238
|
}, {
|
|
207
239
|
default: _(() => [
|
|
208
240
|
T(C(x.text), 1)
|
|
@@ -220,7 +252,7 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
220
252
|
]),
|
|
221
253
|
_: 1
|
|
222
254
|
})) : b("", !0),
|
|
223
|
-
|
|
255
|
+
z(D, {
|
|
224
256
|
type: "primary",
|
|
225
257
|
class: "modal-renderer-btn modal-renderer-btn-confirm",
|
|
226
258
|
onClick: u
|
|
@@ -238,53 +270,22 @@ const te = { class: "validate-content" }, ne = { class: "popup-header" }, oe = {
|
|
|
238
270
|
}, 8, ["show", "position"]));
|
|
239
271
|
};
|
|
240
272
|
}
|
|
241
|
-
}),
|
|
273
|
+
}), we = /* @__PURE__ */ R(ye, [["__scopeId", "data-v-3f28a77f"]]), U = {
|
|
242
274
|
animationDuration: void 0
|
|
243
275
|
};
|
|
244
|
-
function V(e) {
|
|
245
|
-
var r;
|
|
246
|
-
if (typeof e == "number" && Number.isFinite(e))
|
|
247
|
-
return Math.max(0, Math.round(e));
|
|
248
|
-
if (typeof e != "string") return null;
|
|
249
|
-
const o = (r = e.trim().split(",")[0]) == null ? void 0 : r.trim();
|
|
250
|
-
if (!o) return null;
|
|
251
|
-
const t = o.match(/^(-?\d+(?:\.\d+)?)ms$/i);
|
|
252
|
-
if (t) return Math.max(0, Math.round(Number(t[1])));
|
|
253
|
-
const n = o.match(/^(-?\d+(?:\.\d+)?)s$/i);
|
|
254
|
-
if (n) return Math.max(0, Math.round(Number(n[1]) * 1e3));
|
|
255
|
-
const s = Number(o);
|
|
256
|
-
return Number.isFinite(s) ? Math.max(0, Math.round(s)) : null;
|
|
257
|
-
}
|
|
258
|
-
function we() {
|
|
259
|
-
if (typeof window > "u" || typeof document > "u") return null;
|
|
260
|
-
const e = window.getComputedStyle(document.documentElement);
|
|
261
|
-
for (const o of ye) {
|
|
262
|
-
const t = e.getPropertyValue(o), n = V(t);
|
|
263
|
-
if (n !== null) return n;
|
|
264
|
-
}
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
function R(e = {}) {
|
|
268
|
-
const o = V(e.animationDuration);
|
|
269
|
-
if (o !== null) return o;
|
|
270
|
-
const t = V(G.animationDuration);
|
|
271
|
-
if (t !== null) return t;
|
|
272
|
-
const n = we();
|
|
273
|
-
return n !== null ? n : Ce;
|
|
274
|
-
}
|
|
275
276
|
function Te(e = {}) {
|
|
276
|
-
!e || typeof e != "object" || "animationDuration" in e && (
|
|
277
|
+
!e || typeof e != "object" || "animationDuration" in e && (U.animationDuration = e.animationDuration);
|
|
277
278
|
}
|
|
278
279
|
function ve(e = {}) {
|
|
279
|
-
return new Promise((
|
|
280
|
-
const t = { fn: null }, n =
|
|
280
|
+
return new Promise((s) => {
|
|
281
|
+
const t = { fn: null }, n = G(e, U), { unmount: o } = L(
|
|
281
282
|
{
|
|
282
283
|
setup() {
|
|
283
284
|
const r = I(!0), m = () => {
|
|
284
285
|
var l;
|
|
285
286
|
r.value = !1, (l = t.fn) == null || l.call(t);
|
|
286
287
|
};
|
|
287
|
-
return () => B(
|
|
288
|
+
return () => B(ie, {
|
|
288
289
|
show: r.value,
|
|
289
290
|
"onUpdate:show": (l) => {
|
|
290
291
|
var u;
|
|
@@ -300,14 +301,14 @@ function ve(e = {}) {
|
|
|
300
301
|
},
|
|
301
302
|
{ unmountDelay: n }
|
|
302
303
|
);
|
|
303
|
-
t.fn = () =>
|
|
304
|
+
t.fn = () => o(() => s());
|
|
304
305
|
});
|
|
305
306
|
}
|
|
306
307
|
const Be = ve;
|
|
307
308
|
function De(e = {}) {
|
|
308
|
-
return new Promise((
|
|
309
|
+
return new Promise((s, t) => {
|
|
309
310
|
var w;
|
|
310
|
-
const n = { fn: null },
|
|
311
|
+
const n = { fn: null }, o = G(e, U), r = I(!0);
|
|
311
312
|
let m = !1, l = !1;
|
|
312
313
|
const u = (i) => {
|
|
313
314
|
var y, h;
|
|
@@ -328,10 +329,10 @@ function De(e = {}) {
|
|
|
328
329
|
}
|
|
329
330
|
};
|
|
330
331
|
(w = e.onOpen) == null || w.call(e);
|
|
331
|
-
const { unmount: k } =
|
|
332
|
+
const { unmount: k } = L(
|
|
332
333
|
{
|
|
333
334
|
setup() {
|
|
334
|
-
return () => B(
|
|
335
|
+
return () => B(we, {
|
|
335
336
|
show: r.value,
|
|
336
337
|
"onUpdate:show": (i) => {
|
|
337
338
|
r.value = i;
|
|
@@ -353,9 +354,9 @@ function De(e = {}) {
|
|
|
353
354
|
});
|
|
354
355
|
}
|
|
355
356
|
},
|
|
356
|
-
{ unmountDelay:
|
|
357
|
+
{ unmountDelay: o }
|
|
357
358
|
);
|
|
358
|
-
n.fn = (i) => k(() =>
|
|
359
|
+
n.fn = (i) => k(() => s(i));
|
|
359
360
|
});
|
|
360
361
|
}
|
|
361
362
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-modal-utils.mjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as m } from \"vue\";\nconst a = (e, n) => typeof e == \"string\" ? e : e && typeof e == \"object\" && typeof e.message == \"string\" ? e.message : typeof n.message == \"string\" ? n.message : \"\";\nfunction L(e, n = {}) {\n const t = {\n enableConsoleLog: n.enableConsoleLog ?? !0,\n logPrefix: n.logPrefix ?? \"[notifier]\"\n }, g = n.resolveLogMessage ?? a, s = n.logger ?? console.log;\n return { notify: (r, o = {}) => {\n const c = e(r, o);\n if (typeof o.enableConsoleLog == \"boolean\" ? o.enableConsoleLog : t.enableConsoleLog) {\n const l = g(r, o);\n s(t.logPrefix, l, { payload: r, options: o });\n }\n return c;\n }, setConfig: (r = {}) => {\n typeof r != \"object\" || r === null || Object.assign(t, r);\n }, getConfig: () => ({ ...t }) };\n}\nfunction d(e) {\n if (!e) return \"\";\n const n = String(e);\n if (typeof document > \"u\") return n;\n const t = document.createElement(\"textarea\");\n return t.innerHTML = n, t.value;\n}\nfunction v(e, n = {}) {\n const { unmountDelay: t = 0, parent: g = document.body } = n, s = m(e), u = document.createElement(\"div\");\n g.appendChild(u);\n const f = s.mount(u), i = () => {\n s.unmount(), u.remove();\n };\n return { app: s, instance: f, container: u, unmount: (o) => {\n const c = () => {\n i(), o == null || o();\n };\n t > 0 ? setTimeout(c, t) : c();\n } };\n}\nexport {\n L as createNotifier,\n d as decodeHtmlEntities,\n v as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n // FIX: custom modal should not inherit these from props\n // position: props.position,\n // title: props.title,\n // message: props.message,\n // confirmText: props.confirmText,\n // cancelText: props.cancelText,\n // showCancelButton: props.showCancelButton,\n // showClose: props.showClose,\n // content: props.content,\n // component: props.component,\n // componentProps: props.componentProps,\n // buttons: props.buttons,\n ...props.modalComponentProps,\n show: internalShow.value,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"true\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options: { animationDuration?: number | string } = {}): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n let handlingAction = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved || handlingAction) return\n handlingAction = true\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) {\n handlingAction = false\n return\n }\n } catch (e) {\n handlingAction = false\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["v","n","g","m","u","f","i","o","c","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","handlingAction","finish","_b","handleAction","e","ModalRenderer"],"mappings":";;;;;AAyBA,SAASA,EAAE,GAAGC,IAAI,IAAI;AACpB,QAAM,EAAE,cAAc,IAAI,GAAG,QAAQC,IAAI,SAAS,KAAI,IAAKD,GAAG,IAAIE,EAAE,CAAC,GAAGC,IAAI,SAAS,cAAc,KAAK;AACxG,EAAAF,EAAE,YAAYE,CAAC;AACf,QAAMC,IAAI,EAAE,MAAMD,CAAC,GAAGE,IAAI,MAAM;AAC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AAA,YAC5B,aAAaA,EAAQ,eAAe;AAAA,YACpC,YAAYA,EAAQ,cAAc;AAAA,YAClC,kBAAkBA,EAAQ,oBAAoB;AAAA,YAC9C,WAAWA,EAAQ,aAAa;AAAA,YAChC,SAASA,EAAQ,WAAW;AAAA,YAC5B,WAAWA,EAAQ,aAAa;AAAA,YAChC,gBAAgBA,EAAQ,kBAAkB,CAAA;AAAA,YAC1C,gBAAgBA,EAAQ,kBAAkB;AAAA,YAC1C,qBAAqBA,EAAQ,uBAAuB,CAAA;AAAA,YACpD,SAASA,EAAQ,WAAW;AAAA,UAAA,CAC7B;AAAA,QACL;AAAA,MAAA;AAAA,MAEF,EAAE,cAAAS,EAAA;AAAA,IAAa;AAGjB,IAAAD,EAAS,KAAK,CAAC3C,MAAW6C,EAAQ,MAAMH,EAAQ1C,CAAM,CAAC;AAAA,EACzD,CAAC;AACH;"}
|
|
1
|
+
{"version":3,"file":"vue-modal-utils.mjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/animationDuration.ts","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as m } from \"vue\";\nconst a = (e, n) => typeof e == \"string\" ? e : e && typeof e == \"object\" && typeof e.message == \"string\" ? e.message : typeof n.message == \"string\" ? n.message : \"\";\nfunction L(e, n = {}) {\n const t = {\n enableConsoleLog: n.enableConsoleLog ?? !0,\n logPrefix: n.logPrefix ?? \"[notifier]\"\n }, g = n.resolveLogMessage ?? a, s = n.logger ?? console.log;\n return { notify: (r, o = {}) => {\n const c = e(r, o);\n if (typeof o.enableConsoleLog == \"boolean\" ? o.enableConsoleLog : t.enableConsoleLog) {\n const l = g(r, o);\n s(t.logPrefix, l, { payload: r, options: o });\n }\n return c;\n }, setConfig: (r = {}) => {\n typeof r != \"object\" || r === null || Object.assign(t, r);\n }, getConfig: () => ({ ...t }) };\n}\nfunction d(e) {\n if (!e) return \"\";\n const n = String(e);\n if (typeof document > \"u\") return n;\n const t = document.createElement(\"textarea\");\n return t.innerHTML = n, t.value;\n}\nfunction v(e, n = {}) {\n const { unmountDelay: t = 0, parent: g = document.body } = n, s = m(e), u = document.createElement(\"div\");\n g.appendChild(u);\n const f = s.mount(u), i = () => {\n s.unmount(), u.remove();\n };\n return { app: s, instance: f, container: u, unmount: (o) => {\n const c = () => {\n i(), o == null || o();\n };\n t > 0 ? setTimeout(c, t) : c();\n } };\n}\nexport {\n L as createNotifier,\n d as decodeHtmlEntities,\n v as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","const DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\n/**\n * 动画时长解析配置。\n *\n * @internal\n */\nexport interface AnimationDurationConfig {\n /** 全局动画时长配置。 */\n animationDuration?: number | string\n}\n\n/**\n * 将数字、ms、s 或纯数字字符串解析为毫秒数。\n *\n * @param value - 待解析的动画时长。\n * @returns 解析后的非负毫秒数,无法解析时返回 `null`。\n * @internal\n */\nexport function parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\n/**\n * 按调用配置、全局配置、Vant CSS 变量、默认值的顺序解析动画时长。\n *\n * @param options - 单次调用配置。\n * @param globalConfig - 全局配置。\n * @returns 最终动画时长,单位为毫秒。\n * @internal\n */\nexport function resolveAnimationDuration(\n options: AnimationDurationConfig = {},\n globalConfig: AnimationDurationConfig = {}\n): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(globalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n // FIX: custom modal should not inherit these from props\n // position: props.position,\n // title: props.title,\n // message: props.message,\n // confirmText: props.confirmText,\n // cancelText: props.cancelText,\n // showCancelButton: props.showCancelButton,\n // showClose: props.showClose,\n // content: props.content,\n // component: props.component,\n // componentProps: props.componentProps,\n // buttons: props.buttons,\n ...props.modalComponentProps,\n show: internalShow.value,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"true\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport { resolveAnimationDuration } from './animationDuration'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options, modalConfig)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options, modalConfig)\n\n const show = ref(true)\n let resolved = false\n let handlingAction = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved || handlingAction) return\n handlingAction = true\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) {\n handlingAction = false\n return\n }\n } catch (e) {\n handlingAction = false\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["v","n","g","s","m","u","f","i","o","c","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","parseAnimationDuration","value","normalized","_a","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","globalConfig","fromCall","fromGlobalConfig","fromVantCssVar","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","modalConfig","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","handlingAction","finish","_b","handleAction","e","ModalRenderer"],"mappings":";;;;;AAyBA,SAASA,EAAE,GAAGC,IAAI,IAAI;AACpB,QAAM,EAAE,cAAc,IAAI,GAAG,QAAQC,IAAI,SAAS,KAAI,IAAKD,GAAGE,IAAIC,EAAE,CAAC,GAAGC,IAAI,SAAS,cAAc,KAAK;AACxG,EAAAH,EAAE,YAAYG,CAAC;AACf,QAAMC,IAAIH,EAAE,MAAME,CAAC,GAAGE,IAAI,MAAM;AAC9B,IAAAJ,EAAE,QAAO,GAAIE,EAAE,OAAM;AAAA,EACvB;AACA,SAAO,EAAE,KAAKF,GAAG,UAAUG,GAAG,WAAWD,GAAG,SAAS,CAACG,MAAM;AAC1D,UAAMC,IAAI,MAAM;AACd,MAAAF,KAAKC,KAAK,QAAQA,EAAC;AAAA,IACr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AW;AAAA,YAC5B,WAAWA,EAAQ,aAAa;AAAA,YAChC,gBAAgBA,EAAQ,kBAAkB,CAAA;AAAA,YAC1C,gBAAgBA,EAAQ,kBAAkB;AAAA,YAC1C,qBAAqBA,EAAQ,uBAAuB,CAAA;AAAA,YACpD,SAASA,EAAQ,WAAW;AAAA,UAAA,CAC7B;AAAA,QACL;AAAA,MAAA;AAAA,MAEF,EAAE,cAAAkE,EAAA;AAAA,IAAa;AAGjB,IAAAD,EAAS,KAAK,CAACxB,MAAW0B,EAAQ,MAAMH,EAAQvB,CAAM,CAAC;AAAA,EACzD,CAAC;AACH;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("vant/es");require("vant/es/popup/style/index");require("vant/es/button/style/index");require("vant/es/icon/style/index");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("vant/es");require("vant/es/popup/style/index");require("vant/es/button/style/index");require("vant/es/icon/style/index");function V(t,r={}){const{unmountDelay:o=0,parent:n=document.body}=r,a=e.createApp(t),l=document.createElement("div");n.appendChild(l);const m=a.mount(l),s=()=>{a.unmount(),l.remove()};return{app:a,instance:m,container:l,unmount:u=>{const d=()=>{s(),u==null||u()};o>0?setTimeout(d,o):d()}}}const I=300,U=["--van-duration-base","--van-animation-duration-base"];function _(t){var l;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,Math.round(t));if(typeof t!="string")return null;const r=(l=t.trim().split(",")[0])==null?void 0:l.trim();if(!r)return null;const o=r.match(/^(-?\d+(?:\.\d+)?)ms$/i);if(o)return Math.max(0,Math.round(Number(o[1])));const n=r.match(/^(-?\d+(?:\.\d+)?)s$/i);if(n)return Math.max(0,Math.round(Number(n[1])*1e3));const a=Number(r);return Number.isFinite(a)?Math.max(0,Math.round(a)):null}function O(){if(typeof window>"u"||typeof document>"u")return null;const t=window.getComputedStyle(document.documentElement);for(const r of U){const o=t.getPropertyValue(r),n=_(o);if(n!==null)return n}return null}function D(t={},r={}){const o=_(t.animationDuration);if(o!==null)return o;const n=_(r.animationDuration);if(n!==null)return n;const a=O();return a!==null?a:I}const q={class:"validate-content"},$={class:"popup-header"},F={class:"title"},z={class:"validate-card"},j={class:"validate-text"},L=e.defineComponent({__name:"BottomPopup",props:{show:{type:Boolean,default:!1},title:{default:"提示"},message:{},buttonText:{default:"知道了"},showClose:{type:Boolean,default:!0}},emits:["update:show","confirm"],setup(t,{emit:r}){const o=t,n=r,a=()=>{n("update:show",!1)},l=()=>{n("confirm")};return(m,s)=>{const u=y.Icon,d=y.Button,w=y.Popup;return e.openBlock(),e.createBlock(w,{show:o.show,"onUpdate:show":s[0]||(s[0]=h=>n("update:show",h)),position:"bottom",round:!0,class:"validate-popup","close-on-click-overlay":!0},{default:e.withCtx(()=>[e.createElementVNode("div",q,[e.createElementVNode("div",$,[o.showClose?(e.openBlock(),e.createBlock(u,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",F,e.toDisplayString(o.title),1),o.showClose?(e.openBlock(),e.createBlock(u,{key:1,class:"icon",name:"cross",size:"20",color:"#999",onClick:a})):e.createCommentVNode("",!0)]),e.createElementVNode("div",z,[e.createElementVNode("p",j,e.toDisplayString(o.message),1),e.createVNode(d,{type:"primary",block:"",class:"validate-btn",onClick:l},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.buttonText),1)]),_:1})])])]),_:1},8,["show"])}}}),T=(t,r)=>{const o=t.__vccOpts||t;for(const[n,a]of r)o[n]=a;return o},G=T(L,[["__scopeId","data-v-84e1a364"]]),R={class:"modal-renderer-content"},H={class:"modal-renderer-header"},J={class:"modal-renderer-title"},K={class:"modal-renderer-body"},Q={key:0,class:"modal-renderer-text"},W={class:"modal-renderer-footer"},X=e.defineComponent({__name:"ModalRenderer",props:{show:{type:Boolean,default:!0},position:{default:"bottom"},title:{default:"提示"},message:{default:""},confirmText:{default:"确认"},cancelText:{default:"取消"},showCancelButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},content:{type:[Function,Object,null],default:null},component:{default:null},componentProps:{default:()=>({})},modalComponent:{default:null},modalComponentProps:{default:()=>({})},buttons:{default:null}},emits:["update:show","confirm","cancel","close","action"],setup(t,{emit:r}){const o=t,n=r,a=e.ref(o.show);e.watch(()=>o.show,c=>{a.value=c});const l=e.computed(()=>!!(o.content||o.component)),m=e.computed(()=>Array.isArray(o.buttons)&&o.buttons.length>0),s=()=>n("action","overlay"),u=()=>{n("confirm"),n("action","confirm")},d=()=>{n("cancel"),n("action","cancel")},w=(c,C)=>{const v=c.key??String(C);n("action",v),typeof c.onClick=="function"&&c.onClick()},h=()=>n("action","close"),i=c=>{a.value=c,n("update:show",c),c||n("action","close")},p=(c,C)=>n("action",c,C),f=c=>n("action","confirm",c),g=c=>n("action","cancel",c),N=c=>n("action","close",c),M=()=>{var c;return o.component?e.h(o.component,o.componentProps):typeof o.content=="function"?o.content():(c=o.content)!=null&&c.render?o.content.render():o.message?e.h("p",{class:"modal-renderer-message"},o.message):null},P=e.defineComponent({setup(){return()=>M()}}),E=e.computed(()=>({...o.modalComponentProps,show:a.value,requestAction:p,requestConfirm:f,requestCancel:g,requestClose:N}));return(c,C)=>{const v=y.Icon,B=y.Button,S=y.Popup;return t.modalComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.modalComponent),e.mergeProps({key:0},E.value,{"onUpdate:show":i,onAction:p,onConfirm:f,onCancel:g,onClose:N}),null,16)):(e.openBlock(),e.createBlock(S,{key:1,show:a.value,"onUpdate:show":[C[0]||(C[0]=k=>a.value=k),i],position:t.position,round:!0,class:"modal-renderer-popup","close-on-click-overlay":!1,onClickOverlay:s},{default:e.withCtx(()=>[e.createElementVNode("div",R,[e.createElementVNode("div",H,[t.showClose?(e.openBlock(),e.createBlock(v,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",J,e.toDisplayString(t.title),1),t.showClose?(e.openBlock(),e.createBlock(v,{key:1,class:"modal-renderer-close",name:"cross",size:"20",color:"#999",onClick:h})):e.createCommentVNode("",!0)]),e.createElementVNode("div",K,[l.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(P)),{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.message?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(t.message),1)):e.createCommentVNode("",!0)],64))]),e.createElementVNode("div",W,[m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.buttons,(k,x)=>(e.openBlock(),e.createBlock(B,{key:x,type:k.type||"default",class:"modal-renderer-btn",onClick:oe=>w(k,x)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k.text),1)]),_:2},1032,["type","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancelButton?(e.openBlock(),e.createBlock(B,{key:0,type:"default",class:"modal-renderer-btn modal-renderer-btn-cancel",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelText),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(B,{type:"primary",class:"modal-renderer-btn modal-renderer-btn-confirm",onClick:u},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmText),1)]),_:1})],64))])])]),_:1},8,["show","position"]))}}}),Y=T(X,[["__scopeId","data-v-3f28a77f"]]),b={animationDuration:void 0};function Z(t={}){!t||typeof t!="object"||"animationDuration"in t&&(b.animationDuration=t.animationDuration)}function A(t={}){return new Promise(r=>{const o={fn:null},n=D(t,b),{unmount:a}=V({setup(){const l=e.ref(!0),m=()=>{var s;l.value=!1,(s=o.fn)==null||s.call(o)};return()=>e.h(G,{show:l.value,"onUpdate:show":s=>{var u;l.value=s,s||(u=o.fn)==null||u.call(o)},title:t.title??"提示",message:t.message??"",buttonText:t.buttonText??"知道了",showClose:t.showClose??!0,onConfirm:m})}},{unmountDelay:n});o.fn=()=>a(()=>r())})}const ee=A;function te(t={}){return new Promise((r,o)=>{var h;const n={fn:null},a=D(t,b),l=e.ref(!0);let m=!1,s=!1;const u=i=>{var p,f;m||(m=!0,l.value=!1,(p=t.onClose)==null||p.call(t),(f=n.fn)==null||f.call(n,i))},d=async(i,p)=>{if(!(m||s)){if(s=!0,typeof t.beforeClose=="function")try{if(await t.beforeClose(i,p)===!1){s=!1;return}}catch(f){s=!1,o(f);return}u(i)}};(h=t.onOpen)==null||h.call(t);const{unmount:w}=V({setup(){return()=>e.h(Y,{show:l.value,"onUpdate:show":i=>{l.value=i},onAction:d,position:t.position??"bottom",title:t.title??"提示",message:t.message??"",confirmText:t.confirmText??"确认",cancelText:t.cancelText??"取消",showCancelButton:t.showCancelButton??!1,showClose:t.showClose??!0,content:t.content??null,component:t.component??null,componentProps:t.componentProps??{},modalComponent:t.modalComponent??null,modalComponentProps:t.modalComponentProps??{},buttons:t.buttons??null})}},{unmountDelay:a});n.fn=i=>w(()=>r(i))})}exports.configureModalUtils=Z;exports.showBottomTip=ee;exports.showCommonBottomPopup=A;exports.showModal=te;
|
|
2
2
|
//# sourceMappingURL=vue-modal-utils.umd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-modal-utils.umd.cjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as m } from \"vue\";\nconst a = (e, n) => typeof e == \"string\" ? e : e && typeof e == \"object\" && typeof e.message == \"string\" ? e.message : typeof n.message == \"string\" ? n.message : \"\";\nfunction L(e, n = {}) {\n const t = {\n enableConsoleLog: n.enableConsoleLog ?? !0,\n logPrefix: n.logPrefix ?? \"[notifier]\"\n }, g = n.resolveLogMessage ?? a, s = n.logger ?? console.log;\n return { notify: (r, o = {}) => {\n const c = e(r, o);\n if (typeof o.enableConsoleLog == \"boolean\" ? o.enableConsoleLog : t.enableConsoleLog) {\n const l = g(r, o);\n s(t.logPrefix, l, { payload: r, options: o });\n }\n return c;\n }, setConfig: (r = {}) => {\n typeof r != \"object\" || r === null || Object.assign(t, r);\n }, getConfig: () => ({ ...t }) };\n}\nfunction d(e) {\n if (!e) return \"\";\n const n = String(e);\n if (typeof document > \"u\") return n;\n const t = document.createElement(\"textarea\");\n return t.innerHTML = n, t.value;\n}\nfunction v(e, n = {}) {\n const { unmountDelay: t = 0, parent: g = document.body } = n, s = m(e), u = document.createElement(\"div\");\n g.appendChild(u);\n const f = s.mount(u), i = () => {\n s.unmount(), u.remove();\n };\n return { app: s, instance: f, container: u, unmount: (o) => {\n const c = () => {\n i(), o == null || o();\n };\n t > 0 ? setTimeout(c, t) : c();\n } };\n}\nexport {\n L as createNotifier,\n d as decodeHtmlEntities,\n v as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n // FIX: custom modal should not inherit these from props\n // position: props.position,\n // title: props.title,\n // message: props.message,\n // confirmText: props.confirmText,\n // cancelText: props.cancelText,\n // showCancelButton: props.showCancelButton,\n // showClose: props.showClose,\n // content: props.content,\n // component: props.component,\n // componentProps: props.componentProps,\n // buttons: props.buttons,\n ...props.modalComponentProps,\n show: internalShow.value,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"true\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\nfunction resolveAnimationDuration(options: { animationDuration?: number | string } = {}): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(modalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n let handlingAction = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved || handlingAction) return\n handlingAction = true\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) {\n handlingAction = false\n return\n }\n } catch (e) {\n handlingAction = false\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["v","e","n","t","g","s","m","u","f","i","o","c","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","_a","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","modalConfig","parseAnimationDuration","value","normalized","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","fromCall","fromGlobalConfig","fromVantCssVar","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","handlingAction","finish","_b","handleAction","ModalRenderer"],"mappings":"2OAyBA,SAASA,EAAEC,EAAGC,EAAI,GAAI,CACpB,KAAM,CAAE,aAAcC,EAAI,EAAG,OAAQC,EAAI,SAAS,IAAI,EAAKF,EAAGG,EAAIC,EAAAA,UAAEL,CAAC,EAAGM,EAAI,SAAS,cAAc,KAAK,EACxGH,EAAE,YAAYG,CAAC,EACf,MAAMC,EAAIH,EAAE,MAAME,CAAC,EAAGE,EAAI,IAAM,CAC9BJ,EAAE,QAAO,EAAIE,EAAE,OAAM,CACvB,EACA,MAAO,CAAE,IAAKF,EAAG,SAAUG,EAAG,UAAWD,EAAG,QAAUG,GAAM,CAC1D,MAAMC,EAAI,IAAM,CACdF,IAAKC,GAAK,MAAQA,EAAC,CACrB,EACAP,EAAI,EAAI,WAAWQ,EAAGR,CAAC,EAAIQ,EAAC,CAC9B,CAAC,CACH,qWC3BE,MAAMC,EAAQC,EAORC,EAAOC,EAKPC,EAAQ,IAAM,CAClBF,EAAK,cAAe,EAAK,CAC3B,EACMG,EAAY,IAAM,CACtBH,EAAK,SAAS,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AAOA,EAAQ,OAAS,KACxB,QAASA,EAAQ,SAAW,GAC5B,YAAaA,EAAQ,aAAe,KACpC,WAAYA,EAAQ,YAAc,KAClC,iBAAkBA,EAAQ,kBAAoB,GAC9C,UAAWA,EAAQ,WAAa,GAChC,QAASA,EAAQ,SAAW,KAC5B,UAAWA,EAAQ,WAAa,KAChC,eAAgBA,EAAQ,gBAAkB,CAAA,EAC1C,eAAgBA,EAAQ,gBAAkB,KAC1C,oBAAqBA,EAAQ,qBAAuB,CAAA,EACpD,QAASA,EAAQ,SAAW,IAAA,CAC7B,CACL,CAAA,EAEF,CAAE,aAAAS,CAAA,CAAa,EAGjBD,EAAS,GAAM3C,GAAW6C,EAAQ,IAAMH,EAAQ1C,CAAM,CAAC,CACzD,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"vue-modal-utils.umd.cjs","sources":["../../vue-shared-utils/dist/vue-shared-utils.mjs","../src/animationDuration.ts","../src/components/BottomPopup.vue","../src/ModalRenderer.vue","../src/index.ts"],"sourcesContent":["import { createApp as m } from \"vue\";\nconst a = (e, n) => typeof e == \"string\" ? e : e && typeof e == \"object\" && typeof e.message == \"string\" ? e.message : typeof n.message == \"string\" ? n.message : \"\";\nfunction L(e, n = {}) {\n const t = {\n enableConsoleLog: n.enableConsoleLog ?? !0,\n logPrefix: n.logPrefix ?? \"[notifier]\"\n }, g = n.resolveLogMessage ?? a, s = n.logger ?? console.log;\n return { notify: (r, o = {}) => {\n const c = e(r, o);\n if (typeof o.enableConsoleLog == \"boolean\" ? o.enableConsoleLog : t.enableConsoleLog) {\n const l = g(r, o);\n s(t.logPrefix, l, { payload: r, options: o });\n }\n return c;\n }, setConfig: (r = {}) => {\n typeof r != \"object\" || r === null || Object.assign(t, r);\n }, getConfig: () => ({ ...t }) };\n}\nfunction d(e) {\n if (!e) return \"\";\n const n = String(e);\n if (typeof document > \"u\") return n;\n const t = document.createElement(\"textarea\");\n return t.innerHTML = n, t.value;\n}\nfunction v(e, n = {}) {\n const { unmountDelay: t = 0, parent: g = document.body } = n, s = m(e), u = document.createElement(\"div\");\n g.appendChild(u);\n const f = s.mount(u), i = () => {\n s.unmount(), u.remove();\n };\n return { app: s, instance: f, container: u, unmount: (o) => {\n const c = () => {\n i(), o == null || o();\n };\n t > 0 ? setTimeout(c, t) : c();\n } };\n}\nexport {\n L as createNotifier,\n d as decodeHtmlEntities,\n v as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","const DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\n/**\n * 动画时长解析配置。\n *\n * @internal\n */\nexport interface AnimationDurationConfig {\n /** 全局动画时长配置。 */\n animationDuration?: number | string\n}\n\n/**\n * 将数字、ms、s 或纯数字字符串解析为毫秒数。\n *\n * @param value - 待解析的动画时长。\n * @returns 解析后的非负毫秒数,无法解析时返回 `null`。\n * @internal\n */\nexport function parseAnimationDuration(value: unknown): number | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return Math.max(0, Math.round(value))\n }\n\n if (typeof value !== 'string') return null\n\n const normalized = value.trim().split(',')[0]?.trim()\n if (!normalized) return null\n\n const msMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)ms$/i)\n if (msMatch) return Math.max(0, Math.round(Number(msMatch[1])))\n\n const sMatch = normalized.match(/^(-?\\d+(?:\\.\\d+)?)s$/i)\n if (sMatch) return Math.max(0, Math.round(Number(sMatch[1]) * 1000))\n\n const rawNumber = Number(normalized)\n return Number.isFinite(rawNumber) ? Math.max(0, Math.round(rawNumber)) : null\n}\n\nfunction readVantAnimationDurationFromCssVar(): number | null {\n if (typeof window === 'undefined' || typeof document === 'undefined') return null\n\n const styles = window.getComputedStyle(document.documentElement)\n for (const cssVarName of VANT_ANIMATION_DURATION_VARS) {\n const cssVarValue = styles.getPropertyValue(cssVarName)\n const parsed = parseAnimationDuration(cssVarValue)\n if (parsed !== null) return parsed\n }\n\n return null\n}\n\n/**\n * 按调用配置、全局配置、Vant CSS 变量、默认值的顺序解析动画时长。\n *\n * @param options - 单次调用配置。\n * @param globalConfig - 全局配置。\n * @returns 最终动画时长,单位为毫秒。\n * @internal\n */\nexport function resolveAnimationDuration(\n options: AnimationDurationConfig = {},\n globalConfig: AnimationDurationConfig = {}\n): number {\n const fromCall = parseAnimationDuration(options.animationDuration)\n if (fromCall !== null) return fromCall\n\n const fromGlobalConfig = parseAnimationDuration(globalConfig.animationDuration)\n if (fromGlobalConfig !== null) return fromGlobalConfig\n\n const fromVantCssVar = readVantAnimationDurationFromCssVar()\n if (fromVantCssVar !== null) return fromVantCssVar\n\n return DEFAULT_ANIMATION_DURATION\n}\n","<script setup lang=\"ts\">\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n interface BottomPopupProps {\n show?: boolean\n title?: string\n message: string\n buttonText?: string\n showClose?: boolean\n }\n\n const props = withDefaults(defineProps<BottomPopupProps>(), {\n show: false,\n title: '提示',\n buttonText: '知道了',\n showClose: true,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n }>()\n\n const close = () => {\n emit('update:show', false)\n }\n const onConfirm = () => {\n emit('confirm')\n }\n</script>\n\n<template>\n <van-popup\n :show=\"props.show\"\n @update:show=\"emit('update:show', $event)\"\n position=\"bottom\"\n :round=\"true\"\n class=\"validate-popup\"\n :close-on-click-overlay=\"true\"\n >\n <div class=\"validate-content\">\n <div class=\"popup-header\">\n <van-icon\n v-if=\"props.showClose\"\n name=\"cross\"\n size=\"20\"\n style=\"visibility: hidden; padding: 8px\"\n />\n <div class=\"title\">{{ props.title }}</div>\n <van-icon\n v-if=\"props.showClose\"\n class=\"icon\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"close\"\n />\n </div>\n <div class=\"validate-card\">\n <p class=\"validate-text\">{{ props.message }}</p>\n <van-button type=\"primary\" block class=\"validate-btn\" @click=\"onConfirm\">\n {{ props.buttonText }}\n </van-button>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .validate-popup {\n .validate-content {\n padding: 16px;\n }\n .validate-card {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n }\n .popup-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .title {\n margin-left: auto;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .icon {\n padding: 8px;\n margin-left: auto;\n }\n }\n .validate-text {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .validate-btn {\n background-color: #ff5712;\n border-radius: 6px;\n border-width: 0;\n font-size: 14px;\n font-weight: 600;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent, h } from 'vue'\n import type { ModalAction, ModalButton, ModalRendererProps } from './types'\n\n const props = withDefaults(defineProps<ModalRendererProps>(), {\n show: true,\n position: 'bottom',\n title: '提示',\n message: '',\n confirmText: '确认',\n cancelText: '取消',\n showCancelButton: false,\n showClose: true,\n content: null,\n component: null,\n componentProps: () => ({}),\n modalComponent: null,\n modalComponentProps: () => ({}),\n buttons: null,\n })\n\n const emit = defineEmits<{\n (e: 'update:show', value: boolean): void\n (e: 'confirm'): void\n (e: 'cancel'): void\n (e: 'close'): void\n (e: 'action', action: ModalAction, payload?: unknown): void\n }>()\n\n const internalShow = ref(props.show)\n\n watch(\n () => props.show,\n (v) => {\n internalShow.value = v\n }\n )\n\n const hasCustomContent = computed(() => !!(props.content || props.component))\n const hasMultipleButtons = computed(() => Array.isArray(props.buttons) && props.buttons.length > 0)\n\n const onOverlayClick = () => emit('action', 'overlay')\n const onConfirm = () => {\n emit('confirm')\n emit('action', 'confirm')\n }\n const onCancel = () => {\n emit('cancel')\n emit('action', 'cancel')\n }\n const onButtonClick = (btn: ModalButton, index: number) => {\n const key = btn.key ?? String(index)\n emit('action', key)\n if (typeof btn.onClick === 'function') btn.onClick()\n }\n const onCloseIconClick = () => emit('action', 'close')\n const onShowUpdate = (v: boolean) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action: ModalAction, payload?: unknown) => emit('action', action, payload)\n const onCustomConfirm = (payload?: unknown) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload?: unknown) => emit('action', 'cancel', payload)\n const onCustomClose = (payload?: unknown) => emit('action', 'close', payload)\n\n const renderContent = () => {\n if (props.component) return h(props.component, props.componentProps)\n if (typeof props.content === 'function') return props.content()\n if (props.content?.render) return props.content.render()\n return props.message ? h('p', { class: 'modal-renderer-message' }, props.message) : null\n }\n\n const DynamicContent = defineComponent({\n setup() {\n return () => renderContent()\n },\n })\n\n const customModalProps = computed(() => ({\n // FIX: custom modal should not inherit these from props\n // position: props.position,\n // title: props.title,\n // message: props.message,\n // confirmText: props.confirmText,\n // cancelText: props.cancelText,\n // showCancelButton: props.showCancelButton,\n // showClose: props.showClose,\n // content: props.content,\n // component: props.component,\n // componentProps: props.componentProps,\n // buttons: props.buttons,\n ...props.modalComponentProps,\n show: internalShow.value,\n requestAction: onCustomAction,\n requestConfirm: onCustomConfirm,\n requestCancel: onCustomCancel,\n requestClose: onCustomClose,\n }))\n</script>\n\n<template>\n <component\n v-if=\"modalComponent\"\n :is=\"modalComponent\"\n v-bind=\"customModalProps\"\n @update:show=\"onShowUpdate\"\n @action=\"onCustomAction\"\n @confirm=\"onCustomConfirm\"\n @cancel=\"onCustomCancel\"\n @close=\"onCustomClose\"\n />\n <van-popup\n v-else\n v-model:show=\"internalShow\"\n :position=\"position\"\n :round=\"true\"\n class=\"modal-renderer-popup\"\n :close-on-click-overlay=\"false\"\n @update:show=\"onShowUpdate\"\n @click-overlay=\"onOverlayClick\"\n >\n <div class=\"modal-renderer-content\">\n <div class=\"modal-renderer-header\">\n <van-icon v-if=\"showClose\" name=\"cross\" size=\"20\" style=\"visibility: hidden; padding: 8px\" />\n <div class=\"modal-renderer-title\">{{ title }}</div>\n <van-icon\n v-if=\"showClose\"\n class=\"modal-renderer-close\"\n name=\"cross\"\n size=\"20\"\n color=\"#999\"\n @click=\"onCloseIconClick\"\n />\n </div>\n <div class=\"modal-renderer-body\">\n <template v-if=\"!hasCustomContent\">\n <p v-if=\"message\" class=\"modal-renderer-text\">{{ message }}</p>\n </template>\n <component v-else :is=\"DynamicContent\" />\n </div>\n <div class=\"modal-renderer-footer\">\n <template v-if=\"hasMultipleButtons\">\n <van-button\n v-for=\"(btn, idx) in buttons\"\n :key=\"idx\"\n :type=\"btn.type || 'default'\"\n class=\"modal-renderer-btn\"\n @click=\"onButtonClick(btn, idx)\"\n >\n {{ btn.text }}\n </van-button>\n </template>\n <template v-else>\n <van-button\n v-if=\"showCancelButton\"\n type=\"default\"\n class=\"modal-renderer-btn modal-renderer-btn-cancel\"\n @click=\"onCancel\"\n >\n {{ cancelText }}\n </van-button>\n <van-button\n type=\"primary\"\n class=\"modal-renderer-btn modal-renderer-btn-confirm\"\n @click=\"onConfirm\"\n >\n {{ confirmText }}\n </van-button>\n </template>\n </div>\n </div>\n </van-popup>\n</template>\n\n<style scoped lang=\"scss\">\n .modal-renderer-popup {\n .modal-renderer-content { padding: 16px; }\n .modal-renderer-header {\n height: 40px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 8px;\n .modal-renderer-title {\n flex: 1;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 1;\n color: #333;\n }\n .modal-renderer-close { padding: 8px; }\n }\n .modal-renderer-body {\n background: #fff;\n border-radius: 8px;\n padding: 16px;\n padding-top: 14px;\n min-height: 40px;\n }\n .modal-renderer-text, .modal-renderer-message {\n font-size: 14px;\n line-height: 20px;\n color: #333;\n text-align: center;\n margin-bottom: 24px;\n }\n .modal-renderer-footer {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-top: 16px;\n .modal-renderer-btn {\n flex: 1;\n border-radius: 6px;\n font-size: 14px;\n font-weight: 600;\n &.modal-renderer-btn-cancel {\n border: 1px solid #dcdee0;\n color: #333;\n background: #fff;\n }\n &.modal-renderer-btn-confirm {\n background-color: #ff5712;\n border: none;\n }\n }\n }\n }\n</style>\n","/**\n * `vue-modal-utils` 弹窗命令式 API 入口。\n *\n * @packageDocumentation\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport { resolveAnimationDuration } from './animationDuration'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\nimport type {\n ModalAction,\n ModalGlobalConfig,\n ShowCommonBottomPopupOptions,\n ShowModalOptions,\n} from './types'\n\nconst modalConfig: ModalGlobalConfig = {\n animationDuration: undefined,\n}\n\n/**\n * 配置 `vue-modal-utils` 的全局行为。\n *\n * @param config - 全局配置。\n * @public\n */\nexport function configureModalUtils(config: ModalGlobalConfig = {}): void {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * 展示单按钮底部弹窗。\n *\n * @param options - 弹窗展示参数。\n * @returns 用户关闭弹窗后的完成信号。\n * @public\n */\nexport function showCommonBottomPopup(options: ShowCommonBottomPopupOptions = {}): Promise<void> {\n return new Promise((resolve) => {\n const closeRef: { fn: null | (() => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options, modalConfig)\n\n const { unmount } = mountComponent(\n {\n setup() {\n const show = ref(true)\n const handleConfirm = () => {\n show.value = false\n closeRef.fn?.()\n }\n return () =>\n h(BottomPopup, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n if (!v) closeRef.fn?.()\n },\n title: options.title ?? '提示',\n message: options.message ?? '',\n buttonText: options.buttonText ?? '知道了',\n showClose: options.showClose ?? true,\n onConfirm: handleConfirm,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = () => unmount(() => resolve())\n })\n}\n\n/**\n * `showCommonBottomPopup` 的别名。\n *\n * @public\n */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * 展示统一弹窗(支持位置、按钮组、自定义内容与自定义组件)。\n *\n * @param options - 弹窗展示参数。\n * @returns Promise resolve 为关闭动作类型。\n * @remarks\n * 若传入 `beforeClose` 且返回 `false`,将阻止当前关闭动作。\n * @public\n */\nexport function showModal(options: ShowModalOptions = {}): Promise<ModalAction> {\n return new Promise((resolve, reject) => {\n const closeRef: { fn: null | ((action: ModalAction) => void) } = { fn: null }\n const unmountDelay = resolveAnimationDuration(options, modalConfig)\n\n const show = ref(true)\n let resolved = false\n let handlingAction = false\n const finish = (action: ModalAction) => {\n if (resolved) return\n resolved = true\n show.value = false\n options.onClose?.()\n closeRef.fn?.(action)\n }\n\n const handleAction = async (action: ModalAction, payload?: unknown) => {\n if (resolved || handlingAction) return\n handlingAction = true\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) {\n handlingAction = false\n return\n }\n } catch (e) {\n handlingAction = false\n reject(e)\n return\n }\n }\n finish(action)\n }\n\n options.onOpen?.()\n\n const { unmount } = mountComponent(\n {\n setup() {\n return () =>\n h(ModalRenderer, {\n show: show.value,\n 'onUpdate:show': (v: boolean) => {\n show.value = v\n },\n onAction: handleAction,\n position: options.position ?? 'bottom',\n title: options.title ?? '提示',\n message: options.message ?? '',\n confirmText: options.confirmText ?? '确认',\n cancelText: options.cancelText ?? '取消',\n showCancelButton: options.showCancelButton ?? false,\n showClose: options.showClose ?? true,\n content: options.content ?? null,\n component: options.component ?? null,\n componentProps: options.componentProps ?? {},\n modalComponent: options.modalComponent ?? null,\n modalComponentProps: options.modalComponentProps ?? {},\n buttons: options.buttons ?? null,\n })\n },\n },\n { unmountDelay }\n )\n\n closeRef.fn = (action) => unmount(() => resolve(action))\n })\n}\n\nexport type { ModalAction, ModalGlobalConfig, ShowCommonBottomPopupOptions, ShowModalOptions } from './types'\n"],"names":["v","e","n","t","g","s","m","u","f","i","o","c","DEFAULT_ANIMATION_DURATION","VANT_ANIMATION_DURATION_VARS","parseAnimationDuration","value","normalized","_a","msMatch","sMatch","rawNumber","readVantAnimationDurationFromCssVar","styles","cssVarName","cssVarValue","parsed","resolveAnimationDuration","options","globalConfig","fromCall","fromGlobalConfig","fromVantCssVar","props","__props","emit","__emit","close","onConfirm","_createBlock","_component_van_popup","_cache","$event","_createElementVNode","_hoisted_1","_hoisted_2","_component_van_icon","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_createVNode","_component_van_button","_createTextVNode","internalShow","ref","watch","hasCustomContent","computed","hasMultipleButtons","onOverlayClick","onCancel","onButtonClick","btn","index","key","onCloseIconClick","onShowUpdate","onCustomAction","action","payload","onCustomConfirm","onCustomCancel","onCustomClose","renderContent","h","DynamicContent","defineComponent","customModalProps","_openBlock","_resolveDynamicComponent","_mergeProps","_unref","_createElementBlock","_Fragment","_hoisted_6","_renderList","idx","modalConfig","configureModalUtils","config","showCommonBottomPopup","resolve","closeRef","unmountDelay","unmount","mountComponent","show","handleConfirm","BottomPopup","showBottomTip","showModal","reject","resolved","handlingAction","finish","_b","handleAction","ModalRenderer"],"mappings":"2OAyBA,SAASA,EAAEC,EAAGC,EAAI,GAAI,CACpB,KAAM,CAAE,aAAcC,EAAI,EAAG,OAAQC,EAAI,SAAS,IAAI,EAAKF,EAAGG,EAAIC,EAAAA,UAAEL,CAAC,EAAGM,EAAI,SAAS,cAAc,KAAK,EACxGH,EAAE,YAAYG,CAAC,EACf,MAAMC,EAAIH,EAAE,MAAME,CAAC,EAAGE,EAAI,IAAM,CAC9BJ,EAAE,QAAO,EAAIE,EAAE,OAAM,CACvB,EACA,MAAO,CAAE,IAAKF,EAAG,SAAUG,EAAG,UAAWD,EAAG,QAAUG,GAAM,CAC1D,MAAMC,EAAI,IAAM,CACdF,IAAKC,GAAK,MAAQA,EAAC,CACrB,EACAP,EAAI,EAAI,WAAWQ,EAAGR,CAAC,EAAIQ,EAAC,CAC9B,CAAC,CACH,CCrCA,MAAMC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IACLrB,EAAAA,EAAEiC,EAAe,CACf,KAAMX,EAAK,MACX,gBAAkBhG,GAAe,CAC/BgG,EAAK,MAAQhG,CACf,EACA,SAAU0G,EACV,SAAU/E,EAAQ,UAAY,SAC9B,MAAOA,EAAQ,OAAS,KACxB,QAASA,EAAQ,SAAW,GAC5B,YAAaA,EAAQ,aAAe,KACpC,WAAYA,EAAQ,YAAc,KAClC,iBAAkBA,EAAQ,kBAAoB,GAC9C,UAAWA,EAAQ,WAAa,GAChC,QAASA,EAAQ,SAAW,KAC5B,UAAWA,EAAQ,WAAa,KAChC,eAAgBA,EAAQ,gBAAkB,CAAA,EAC1C,eAAgBA,EAAQ,gBAAkB,KAC1C,oBAAqBA,EAAQ,qBAAuB,CAAA,EACpD,QAASA,EAAQ,SAAW,IAAA,CAC7B,CACL,CAAA,EAEF,CAAE,aAAAkE,CAAA,CAAa,EAGjBD,EAAS,GAAMxB,GAAW0B,EAAQ,IAAMH,EAAQvB,CAAM,CAAC,CACzD,CAAC,CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-modal-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue 3 弹窗命令式调用 API,基于 Vant",
|
|
6
6
|
"main": "dist/vue-modal-utils.umd.cjs",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
19
23
|
"peerDependencies": {
|
|
20
24
|
"vant": "^4.9.0",
|
|
21
25
|
"vue": "^3.5.0"
|
|
@@ -28,11 +32,7 @@
|
|
|
28
32
|
"vant": "^4.9.19",
|
|
29
33
|
"vite": "^6.3.5",
|
|
30
34
|
"vue": "^3.5.13",
|
|
31
|
-
"vue-shared-utils": "
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "vite build && tsc -p tsconfig.json",
|
|
35
|
-
"dev": "vite build --watch"
|
|
35
|
+
"vue-shared-utils": "0.1.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"vue",
|
|
@@ -46,5 +46,9 @@
|
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "https://github.com/JohnieXu/vue-toolkit"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "vite build && tsc -p tsconfig.json",
|
|
52
|
+
"dev": "vite build --watch"
|
|
49
53
|
}
|
|
50
|
-
}
|
|
54
|
+
}
|