vue-modal-utils 0.1.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.
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# vue-modal-utils
|
|
2
|
+
|
|
3
|
+
Vue 3 弹窗命令式调用 API,基于 Vant。详见 [docs/vue-modal-utils.md](../../docs/vue-modal-utils.md)。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add vue-modal-utils vue vant
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
入口引入样式和 API:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import 'vue-modal-utils/style'
|
|
17
|
+
import {
|
|
18
|
+
configureModalUtils,
|
|
19
|
+
showCommonBottomPopup,
|
|
20
|
+
showModal,
|
|
21
|
+
showBottomTip,
|
|
22
|
+
} from 'vue-modal-utils'
|
|
23
|
+
|
|
24
|
+
configureModalUtils({
|
|
25
|
+
// 可选:全局动画时长,支持 number(ms) 或 "0.3s"/"300ms"
|
|
26
|
+
animationDuration: '0.3s',
|
|
27
|
+
})
|
|
28
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.validate-popup .validate-content[data-v-d8ab28e4]{padding:16px}.validate-popup .validate-card[data-v-d8ab28e4]{background:#fff;border-radius:8px;padding:14px 16px 16px}.validate-popup .popup-header[data-v-d8ab28e4]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.validate-popup .popup-header .title[data-v-d8ab28e4]{margin-left:auto;font-size:16px;font-weight:600;line-height:1;color:#333}.validate-popup .popup-header .icon[data-v-d8ab28e4]{padding:8px;margin-left:auto}.validate-popup .validate-text[data-v-d8ab28e4]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.validate-popup .validate-btn[data-v-d8ab28e4]{background-color:#ff5712;border-radius:6px;border-width:0;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-content[data-v-c1845810]{padding:16px}.modal-renderer-popup .modal-renderer-header[data-v-c1845810]{height:40px;display:flex;justify-content:center;align-items:center;margin-bottom:8px}.modal-renderer-popup .modal-renderer-header .modal-renderer-title[data-v-c1845810]{flex:1;text-align:center;font-size:16px;font-weight:600;line-height:1;color:#333}.modal-renderer-popup .modal-renderer-header .modal-renderer-close[data-v-c1845810]{padding:8px}.modal-renderer-popup .modal-renderer-body[data-v-c1845810]{background:#fff;border-radius:8px;padding:14px 16px 16px;min-height:40px}.modal-renderer-popup .modal-renderer-text[data-v-c1845810],.modal-renderer-popup .modal-renderer-message[data-v-c1845810]{font-size:14px;line-height:20px;color:#333;text-align:center;margin-bottom:24px}.modal-renderer-popup .modal-renderer-footer[data-v-c1845810]{display:flex;align-items:center;gap:12px;margin-top:16px}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn[data-v-c1845810]{flex:1;border-radius:6px;font-size:14px;font-weight:600}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-cancel[data-v-c1845810]{border:1px solid #dcdee0;color:#333;background:#fff}.modal-renderer-popup .modal-renderer-footer .modal-renderer-btn.modal-renderer-btn-confirm[data-v-c1845810]{background-color:#ff5712;border:none}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { createApp as Q, openBlock as l, createBlock as d, withCtx as b, createElementVNode as f, createCommentVNode as _, toDisplayString as C, createVNode as $, createTextVNode as T, ref as N, watch as W, computed as P, defineComponent as X, resolveDynamicComponent as U, mergeProps as Y, createElementBlock as x, Fragment as D, unref as Z, renderList as tt, h as A } from "vue";
|
|
2
|
+
import { Popup as F, Icon as j, Button as q } from "vant/es";
|
|
3
|
+
import "vant/es/popup/style/index";
|
|
4
|
+
import "vant/es/button/style/index";
|
|
5
|
+
import "vant/es/icon/style/index";
|
|
6
|
+
function z(t, o = {}) {
|
|
7
|
+
const { unmountDelay: e = 0, parent: n = document.body } = o, a = Q(t), r = document.createElement("div");
|
|
8
|
+
n.appendChild(r);
|
|
9
|
+
const m = a.mount(r), c = () => {
|
|
10
|
+
a.unmount(), r.remove();
|
|
11
|
+
};
|
|
12
|
+
return { app: a, instance: m, container: r, unmount: (u) => {
|
|
13
|
+
const p = () => {
|
|
14
|
+
c(), u == null || u();
|
|
15
|
+
};
|
|
16
|
+
e > 0 ? setTimeout(p, e) : p();
|
|
17
|
+
} };
|
|
18
|
+
}
|
|
19
|
+
const E = (t, o) => {
|
|
20
|
+
const e = t.__vccOpts || t;
|
|
21
|
+
for (const [n, a] of o)
|
|
22
|
+
e[n] = a;
|
|
23
|
+
return e;
|
|
24
|
+
}, et = { class: "validate-content" }, nt = { class: "popup-header" }, ot = { class: "title" }, st = { class: "validate-card" }, at = { class: "validate-text" }, rt = {
|
|
25
|
+
__name: "BottomPopup",
|
|
26
|
+
props: {
|
|
27
|
+
show: { type: Boolean, default: !1 },
|
|
28
|
+
title: { type: String, default: "提示" },
|
|
29
|
+
message: { type: String, required: !0 },
|
|
30
|
+
buttonText: { type: String, default: "知道了" },
|
|
31
|
+
showClose: { type: Boolean, default: !0 }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:show", "confirm"],
|
|
34
|
+
setup(t, { emit: o }) {
|
|
35
|
+
const e = t, n = o, a = () => {
|
|
36
|
+
n("update:show", !1);
|
|
37
|
+
}, r = () => {
|
|
38
|
+
n("confirm");
|
|
39
|
+
};
|
|
40
|
+
return (m, c) => {
|
|
41
|
+
const u = j, p = q, w = F;
|
|
42
|
+
return l(), d(w, {
|
|
43
|
+
show: e.show,
|
|
44
|
+
"onUpdate:show": c[0] || (c[0] = (i) => e.show = i),
|
|
45
|
+
position: "bottom",
|
|
46
|
+
round: !0,
|
|
47
|
+
class: "validate-popup",
|
|
48
|
+
"close-on-click-overlay": !0
|
|
49
|
+
}, {
|
|
50
|
+
default: b(() => [
|
|
51
|
+
f("div", et, [
|
|
52
|
+
f("div", nt, [
|
|
53
|
+
e.showClose ? (l(), d(u, {
|
|
54
|
+
key: 0,
|
|
55
|
+
name: "cross",
|
|
56
|
+
size: "20",
|
|
57
|
+
style: { visibility: "hidden", padding: "8px" }
|
|
58
|
+
})) : _("", !0),
|
|
59
|
+
f("div", ot, C(e.title), 1),
|
|
60
|
+
e.showClose ? (l(), d(u, {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "icon",
|
|
63
|
+
name: "cross",
|
|
64
|
+
size: "20",
|
|
65
|
+
color: "#999",
|
|
66
|
+
onClick: a
|
|
67
|
+
})) : _("", !0)
|
|
68
|
+
]),
|
|
69
|
+
f("div", st, [
|
|
70
|
+
f("p", at, C(e.message), 1),
|
|
71
|
+
$(p, {
|
|
72
|
+
type: "primary",
|
|
73
|
+
block: "",
|
|
74
|
+
class: "validate-btn",
|
|
75
|
+
onClick: r
|
|
76
|
+
}, {
|
|
77
|
+
default: b(() => [
|
|
78
|
+
T(C(e.buttonText), 1)
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
})
|
|
82
|
+
])
|
|
83
|
+
])
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["show"]);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}, ct = /* @__PURE__ */ E(rt, [["__scopeId", "data-v-d8ab28e4"]]), lt = { class: "modal-renderer-content" }, ut = { class: "modal-renderer-header" }, it = { class: "modal-renderer-title" }, mt = { class: "modal-renderer-body" }, dt = {
|
|
90
|
+
key: 0,
|
|
91
|
+
class: "modal-renderer-text"
|
|
92
|
+
}, ft = { class: "modal-renderer-footer" }, pt = {
|
|
93
|
+
__name: "ModalRenderer",
|
|
94
|
+
props: {
|
|
95
|
+
show: { type: Boolean, default: !0 },
|
|
96
|
+
position: { type: String, default: "bottom" },
|
|
97
|
+
title: { type: String, default: "提示" },
|
|
98
|
+
message: { type: String, default: "" },
|
|
99
|
+
confirmText: { type: String, default: "确认" },
|
|
100
|
+
cancelText: { type: String, default: "取消" },
|
|
101
|
+
showCancelButton: { type: Boolean, default: !1 },
|
|
102
|
+
showClose: { type: Boolean, default: !0 },
|
|
103
|
+
content: { type: [Function, Object], default: null },
|
|
104
|
+
component: { type: [Object, Function], default: null },
|
|
105
|
+
componentProps: { type: Object, default: () => ({}) },
|
|
106
|
+
modalComponent: { type: [Object, Function], default: null },
|
|
107
|
+
modalComponentProps: { type: Object, default: () => ({}) },
|
|
108
|
+
buttons: { type: Array, default: null }
|
|
109
|
+
},
|
|
110
|
+
emits: ["update:show", "confirm", "cancel", "action", "close"],
|
|
111
|
+
setup(t, { emit: o }) {
|
|
112
|
+
const e = t, n = o, a = N(e.show);
|
|
113
|
+
W(
|
|
114
|
+
() => e.show,
|
|
115
|
+
(s) => {
|
|
116
|
+
a.value = s;
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
const r = P(() => e.content || e.component), m = P(() => Array.isArray(e.buttons) && e.buttons.length > 0), c = () => n("action", "overlay"), u = () => {
|
|
120
|
+
n("confirm"), n("action", "confirm");
|
|
121
|
+
}, p = () => {
|
|
122
|
+
n("cancel"), n("action", "cancel");
|
|
123
|
+
}, w = (s, v) => {
|
|
124
|
+
const g = s.key ?? String(v);
|
|
125
|
+
n("action", g), typeof s.onClick == "function" && s.onClick();
|
|
126
|
+
}, i = () => n("action", "close"), y = (s) => {
|
|
127
|
+
a.value = s, n("update:show", s), s || n("action", "close");
|
|
128
|
+
}, h = (s, v) => n("action", s, v), S = (s) => n("action", "confirm", s), V = (s) => n("action", "cancel", s), O = (s) => n("action", "close", s), R = () => {
|
|
129
|
+
var s;
|
|
130
|
+
return e.component ? A(e.component, e.componentProps) : typeof e.content == "function" ? e.content() : (s = e.content) != null && s.render ? e.content.render() : e.message ? A("p", { class: "modal-renderer-message" }, e.message) : null;
|
|
131
|
+
}, H = X({
|
|
132
|
+
setup() {
|
|
133
|
+
return () => R();
|
|
134
|
+
}
|
|
135
|
+
}), J = P(() => ({
|
|
136
|
+
...e.modalComponentProps,
|
|
137
|
+
show: a.value,
|
|
138
|
+
position: e.position,
|
|
139
|
+
title: e.title,
|
|
140
|
+
message: e.message,
|
|
141
|
+
confirmText: e.confirmText,
|
|
142
|
+
cancelText: e.cancelText,
|
|
143
|
+
showCancelButton: e.showCancelButton,
|
|
144
|
+
showClose: e.showClose,
|
|
145
|
+
content: e.content,
|
|
146
|
+
component: e.component,
|
|
147
|
+
componentProps: e.componentProps,
|
|
148
|
+
buttons: e.buttons,
|
|
149
|
+
requestAction: h,
|
|
150
|
+
requestConfirm: S,
|
|
151
|
+
requestCancel: V,
|
|
152
|
+
requestClose: O
|
|
153
|
+
}));
|
|
154
|
+
return (s, v) => {
|
|
155
|
+
const g = j, B = q, K = F;
|
|
156
|
+
return t.modalComponent ? (l(), d(U(t.modalComponent), Y({ key: 0 }, J.value, {
|
|
157
|
+
"onUpdate:show": y,
|
|
158
|
+
onAction: h,
|
|
159
|
+
onConfirm: S,
|
|
160
|
+
onCancel: V,
|
|
161
|
+
onClose: O
|
|
162
|
+
}), null, 16)) : (l(), d(K, {
|
|
163
|
+
key: 1,
|
|
164
|
+
show: a.value,
|
|
165
|
+
"onUpdate:show": [
|
|
166
|
+
v[0] || (v[0] = (k) => a.value = k),
|
|
167
|
+
y
|
|
168
|
+
],
|
|
169
|
+
position: t.position,
|
|
170
|
+
round: t.position === "bottom",
|
|
171
|
+
class: "modal-renderer-popup",
|
|
172
|
+
"close-on-click-overlay": !1,
|
|
173
|
+
onClickOverlay: c
|
|
174
|
+
}, {
|
|
175
|
+
default: b(() => [
|
|
176
|
+
f("div", lt, [
|
|
177
|
+
f("div", ut, [
|
|
178
|
+
t.showClose ? (l(), d(g, {
|
|
179
|
+
key: 0,
|
|
180
|
+
name: "cross",
|
|
181
|
+
size: "20",
|
|
182
|
+
style: { visibility: "hidden", padding: "8px" }
|
|
183
|
+
})) : _("", !0),
|
|
184
|
+
f("div", it, C(t.title), 1),
|
|
185
|
+
t.showClose ? (l(), d(g, {
|
|
186
|
+
key: 1,
|
|
187
|
+
class: "modal-renderer-close",
|
|
188
|
+
name: "cross",
|
|
189
|
+
size: "20",
|
|
190
|
+
color: "#999",
|
|
191
|
+
onClick: i
|
|
192
|
+
})) : _("", !0)
|
|
193
|
+
]),
|
|
194
|
+
f("div", mt, [
|
|
195
|
+
r.value ? (l(), d(U(Z(H)), { key: 1 })) : (l(), x(D, { key: 0 }, [
|
|
196
|
+
t.message ? (l(), x("p", dt, C(t.message), 1)) : _("", !0)
|
|
197
|
+
], 64))
|
|
198
|
+
]),
|
|
199
|
+
f("div", ft, [
|
|
200
|
+
m.value ? (l(!0), x(D, { key: 0 }, tt(t.buttons, (k, I) => (l(), d(B, {
|
|
201
|
+
key: I,
|
|
202
|
+
type: k.type || "default",
|
|
203
|
+
class: "modal-renderer-btn",
|
|
204
|
+
onClick: (bt) => w(k, I)
|
|
205
|
+
}, {
|
|
206
|
+
default: b(() => [
|
|
207
|
+
T(C(k.text), 1)
|
|
208
|
+
]),
|
|
209
|
+
_: 2
|
|
210
|
+
}, 1032, ["type", "onClick"]))), 128)) : (l(), x(D, { key: 1 }, [
|
|
211
|
+
t.showCancelButton ? (l(), d(B, {
|
|
212
|
+
key: 0,
|
|
213
|
+
type: "default",
|
|
214
|
+
class: "modal-renderer-btn modal-renderer-btn-cancel",
|
|
215
|
+
onClick: p
|
|
216
|
+
}, {
|
|
217
|
+
default: b(() => [
|
|
218
|
+
T(C(t.cancelText), 1)
|
|
219
|
+
]),
|
|
220
|
+
_: 1
|
|
221
|
+
})) : _("", !0),
|
|
222
|
+
$(B, {
|
|
223
|
+
type: "primary",
|
|
224
|
+
class: "modal-renderer-btn modal-renderer-btn-confirm",
|
|
225
|
+
onClick: u
|
|
226
|
+
}, {
|
|
227
|
+
default: b(() => [
|
|
228
|
+
T(C(t.confirmText), 1)
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
})
|
|
232
|
+
], 64))
|
|
233
|
+
])
|
|
234
|
+
])
|
|
235
|
+
]),
|
|
236
|
+
_: 1
|
|
237
|
+
}, 8, ["show", "position", "round"]));
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}, ht = /* @__PURE__ */ E(pt, [["__scopeId", "data-v-c1845810"]]), Ct = 300, yt = ["--van-duration-base", "--van-animation-duration-base"], L = {
|
|
241
|
+
animationDuration: void 0
|
|
242
|
+
};
|
|
243
|
+
function M(t) {
|
|
244
|
+
var r;
|
|
245
|
+
if (typeof t == "number" && Number.isFinite(t))
|
|
246
|
+
return Math.max(0, Math.round(t));
|
|
247
|
+
if (typeof t != "string") return null;
|
|
248
|
+
const o = (r = t.trim().split(",")[0]) == null ? void 0 : r.trim();
|
|
249
|
+
if (!o) return null;
|
|
250
|
+
const e = o.match(/^(-?\d+(?:\.\d+)?)ms$/i);
|
|
251
|
+
if (e) return Math.max(0, Math.round(Number(e[1])));
|
|
252
|
+
const n = o.match(/^(-?\d+(?:\.\d+)?)s$/i);
|
|
253
|
+
if (n) return Math.max(0, Math.round(Number(n[1]) * 1e3));
|
|
254
|
+
const a = Number(o);
|
|
255
|
+
return Number.isFinite(a) ? Math.max(0, Math.round(a)) : null;
|
|
256
|
+
}
|
|
257
|
+
function wt() {
|
|
258
|
+
if (typeof window > "u" || typeof document > "u") return null;
|
|
259
|
+
const t = window.getComputedStyle(document.documentElement);
|
|
260
|
+
for (const o of yt) {
|
|
261
|
+
const e = t.getPropertyValue(o), n = M(e);
|
|
262
|
+
if (n !== null) return n;
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
function G(t = {}) {
|
|
267
|
+
const o = M(t.animationDuration);
|
|
268
|
+
if (o !== null) return o;
|
|
269
|
+
const e = M(L.animationDuration);
|
|
270
|
+
if (e !== null) return e;
|
|
271
|
+
const n = wt();
|
|
272
|
+
return n !== null ? n : Ct;
|
|
273
|
+
}
|
|
274
|
+
function At(t = {}) {
|
|
275
|
+
!t || typeof t != "object" || "animationDuration" in t && (L.animationDuration = t.animationDuration);
|
|
276
|
+
}
|
|
277
|
+
function vt(t = {}) {
|
|
278
|
+
return new Promise((o) => {
|
|
279
|
+
const e = { fn: null }, n = G(t), { unmount: a } = z(
|
|
280
|
+
{
|
|
281
|
+
setup() {
|
|
282
|
+
const r = N(!0), m = () => {
|
|
283
|
+
var c;
|
|
284
|
+
r.value = !1, (c = e.fn) == null || c.call(e);
|
|
285
|
+
};
|
|
286
|
+
return () => A(ct, {
|
|
287
|
+
show: r.value,
|
|
288
|
+
"onUpdate:show": (c) => {
|
|
289
|
+
var u;
|
|
290
|
+
r.value = c, c || (u = e.fn) == null || u.call(e);
|
|
291
|
+
},
|
|
292
|
+
title: t.title ?? "提示",
|
|
293
|
+
message: t.message ?? "",
|
|
294
|
+
buttonText: t.buttonText ?? "知道了",
|
|
295
|
+
showClose: t.showClose ?? !0,
|
|
296
|
+
onConfirm: m
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
{ unmountDelay: n }
|
|
301
|
+
);
|
|
302
|
+
e.fn = () => a(() => o());
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
const Bt = vt;
|
|
306
|
+
function Pt(t = {}) {
|
|
307
|
+
return new Promise((o, e) => {
|
|
308
|
+
var w;
|
|
309
|
+
const n = { fn: null }, a = G(t), r = N(!0);
|
|
310
|
+
let m = !1;
|
|
311
|
+
const c = (i) => {
|
|
312
|
+
var y, h;
|
|
313
|
+
m || (m = !0, r.value = !1, (y = t.onClose) == null || y.call(t), (h = n.fn) == null || h.call(n, i));
|
|
314
|
+
}, u = async (i, y) => {
|
|
315
|
+
if (!m) {
|
|
316
|
+
if (typeof t.beforeClose == "function")
|
|
317
|
+
try {
|
|
318
|
+
if (await t.beforeClose(i, y) === !1) return;
|
|
319
|
+
} catch (h) {
|
|
320
|
+
e(h);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
c(i);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
(w = t.onOpen) == null || w.call(t);
|
|
327
|
+
const { unmount: p } = z(
|
|
328
|
+
{
|
|
329
|
+
setup() {
|
|
330
|
+
return () => A(ht, {
|
|
331
|
+
show: r.value,
|
|
332
|
+
"onUpdate:show": (i) => {
|
|
333
|
+
r.value = i;
|
|
334
|
+
},
|
|
335
|
+
onAction: u,
|
|
336
|
+
position: t.position ?? "bottom",
|
|
337
|
+
title: t.title ?? "提示",
|
|
338
|
+
message: t.message ?? "",
|
|
339
|
+
confirmText: t.confirmText ?? "确认",
|
|
340
|
+
cancelText: t.cancelText ?? "取消",
|
|
341
|
+
showCancelButton: t.showCancelButton ?? !1,
|
|
342
|
+
showClose: t.showClose ?? !0,
|
|
343
|
+
content: t.content ?? null,
|
|
344
|
+
component: t.component ?? null,
|
|
345
|
+
componentProps: t.componentProps ?? {},
|
|
346
|
+
modalComponent: t.modalComponent ?? null,
|
|
347
|
+
modalComponentProps: t.modalComponentProps ?? {},
|
|
348
|
+
buttons: t.buttons ?? null
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{ unmountDelay: a }
|
|
353
|
+
);
|
|
354
|
+
n.fn = (i) => p(() => o(i));
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
export {
|
|
358
|
+
At as configureModalUtils,
|
|
359
|
+
Bt as showBottomTip,
|
|
360
|
+
vt as showCommonBottomPopup,
|
|
361
|
+
Pt as showModal
|
|
362
|
+
};
|
|
363
|
+
//# sourceMappingURL=vue-modal-utils.mjs.map
|
|
@@ -0,0 +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.js"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup>\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n const props = defineProps({\n show: { type: Boolean, default: false },\n title: { type: String, default: '提示' },\n message: { type: String, required: true },\n buttonText: { type: String, default: '知道了' },\n showClose: { type: Boolean, default: true },\n })\n\n const emit = defineEmits(['update:show', 'confirm'])\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 v-model:show=\"props.show\"\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>\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent } from 'vue'\n import { h } from 'vue'\n\n const props = defineProps({\n show: { type: Boolean, default: true },\n position: { type: String, default: 'bottom' },\n title: { type: String, default: '提示' },\n message: { type: String, default: '' },\n confirmText: { type: String, default: '确认' },\n cancelText: { type: String, default: '取消' },\n showCancelButton: { type: Boolean, default: false },\n showClose: { type: Boolean, default: true },\n content: { type: [Function, Object], default: null },\n component: { type: [Object, Function], default: null },\n componentProps: { type: Object, default: () => ({}) },\n modalComponent: { type: [Object, Function], default: null },\n modalComponentProps: { type: Object, default: () => ({}) },\n buttons: { type: Array, default: null },\n })\n\n const emit = defineEmits(['update:show', 'confirm', 'cancel', 'action', 'close'])\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, index) => {\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) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action, payload) => emit('action', action, payload)\n const onCustomConfirm = (payload) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload) => emit('action', 'cancel', payload)\n const onCustomClose = (payload) => 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 ...props.modalComponentProps,\n show: internalShow.value,\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 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=\"position === 'bottom'\"\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\n * 弹窗命令式调用 API:showCommonBottomPopup、showModal、showBottomTip\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value) {\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() {\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 = {}) {\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 * @param {Object} [config]\n * @param {number|string} [config.animationDuration] - 动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n */\nexport function configureModalUtils(config = {}) {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * Phase 1: 单按钮底部弹窗\n * @param {Object} options\n * @param {string} [options.title='提示']\n * @param {string} options.message\n * @param {string} [options.buttonText='知道了']\n * @param {boolean} [options.showClose=true]\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<void>}\n */\nexport function showCommonBottomPopup(options = {}) {\n return new Promise((resolve) => {\n const closeRef = { 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) => {\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/** showCommonBottomPopup 的别名 */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * Phase 2/3: 统一弹窗 API\n * @param {Object} options\n * @param {'bottom'|'center'|'top'} [options.position='bottom']\n * @param {string} [options.title='提示']\n * @param {string} [options.message]\n * @param {string} [options.confirmText='确认']\n * @param {string} [options.cancelText='取消']\n * @param {boolean} [options.showCancelButton=false]\n * @param {boolean} [options.showClose=true]\n * @param {Function|Object} [options.content] - 渲染函数 () => VNode\n * @param {Object|Function} [options.component] - 业务组件\n * @param {Object} [options.componentProps] - 组件 props\n * @param {Object|Function} [options.modalComponent] - 完全自定义弹窗组件\n * @param {Object} [options.modalComponentProps] - 完全自定义弹窗组件 props\n * @param {Array} [options.buttons] - [{ text, type?, key? }]\n * @param {Function} [options.onOpen]\n * @param {Function} [options.onClose]\n * @param {Function} [options.beforeClose] - async, 返回 false 可阻止关闭;签名 (action, payload)\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<'confirm'|'cancel'|'overlay'|'close'|string>}\n */\nexport function showModal(options = {}) {\n return new Promise((resolve, reject) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action) => {\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, payload) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\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) => {\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"],"names":["l","m","c","u","r","n","a","t","p","s","o","e","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","v","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","finish","_b","handleAction","ModalRenderer"],"mappings":";;;;;AACA,SAASA,EAAEC,GAAGC,IAAI,IAAI;AACpB,QAAM,EAAE,cAAcC,IAAI,GAAG,QAAQC,IAAI,SAAS,KAAI,IAAKF,GAAGG,IAAIC,EAAEL,CAAC,GAAGM,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,IACrB;AACA,IAAAP,IAAI,IAAI,WAAWQ,GAAGR,CAAC,IAAIQ,EAAC;AAAA,EAC9B,EAAC;AACH;;;;;;;;;;;;;;;;;ACXE,UAAMC,IAAQC,GAQRC,IAAOC,GAEPC,IAAQ,MAAM;AAClB,MAAAF,EAAK,eAAe,EAAK;AAAA,IAC3B,GACMG,IAAY,MAAM;AACtB,MAAAH,EAAK,SAAS;AAAA,IAChB;;;kBAIAI,EAgCYC,GAAA;AAAA,QA/BF,MAAMP,EAAM;AAAA,QAAN,iBAAAQ,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAAT,EAAM,OAAIS;AAAA,QACxB,UAAS;AAAA,QACR,OAAO;AAAA,QACR,OAAM;AAAA,QACL,0BAAwB;AAAA;mBAEzB,MAwBM;AAAA,UAxBNC,EAwBM,OAxB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,MAAMA,EAAQ,YAAYnC,GAAQC,CAAO,MACzC,GAAO;AAAA,UACxB,SAASvC,GAAG;AACV,YAAA0F,EAAO1F,CAAC;AACR;AAAA,UACF;AAEF,QAAA4F,EAAOtD,CAAM;AAAA;AAAA,IACf;AAEA,KAAAO,IAAA4B,EAAQ,WAAR,QAAA5B,EAAA,KAAA4B;AAEA,UAAM,EAAE,SAAAU,EAAO,IAAKC;AAAAA,MAClB;AAAA,QACE,QAAQ;AACN,iBAAO,MACLxC,EAAEmD,IAAe;AAAA,YACf,MAAMV,EAAK;AAAA,YACX,iBAAiB,CAAC5D,MAAM;AACtB,cAAA4D,EAAK,QAAQ5D;AAAA,YACf;AAAA,YACA,UAAUqE;AAAA,YACV,UAAUrB,EAAQ,YAAY;AAAA,YAC9B,OAAOA,EAAQ,SAAS;AAAA,YACxB,SAASA,EAAQ,WAAW;AAAA,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,UAC1C,CAAa;AAAA,QACL;AAAA,MACR;AAAA,MACM,EAAE,cAAAS,EAAY;AAAA,IACpB;AAEI,IAAAD,EAAS,KAAK,CAAC3C,MAAW6C,EAAQ,MAAMH,EAAQ1C,CAAM,CAAC;AAAA,EACzD,CAAC;AACH;"}
|
|
@@ -0,0 +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 N(t,c={}){const{unmountDelay:o=0,parent:n=document.body}=c,r=e.createApp(t),s=document.createElement("div");n.appendChild(s);const m=r.mount(s),l=()=>{r.unmount(),s.remove()};return{app:r,instance:m,container:s,unmount:i=>{const d=()=>{l(),i==null||i()};o>0?setTimeout(d,o):d()}}}const V=(t,c)=>{const o=t.__vccOpts||t;for(const[n,r]of c)o[n]=r;return o},O={class:"validate-content"},I={class:"popup-header"},U={class:"title"},q={class:"validate-card"},F={class:"validate-text"},$={__name:"BottomPopup",props:{show:{type:Boolean,default:!1},title:{type:String,default:"提示"},message:{type:String,required:!0},buttonText:{type:String,default:"知道了"},showClose:{type:Boolean,default:!0}},emits:["update:show","confirm"],setup(t,{emit:c}){const o=t,n=c,r=()=>{n("update:show",!1)},s=()=>{n("confirm")};return(m,l)=>{const i=y.Icon,d=y.Button,h=y.Popup;return e.openBlock(),e.createBlock(h,{show:o.show,"onUpdate:show":l[0]||(l[0]=u=>o.show=u),position:"bottom",round:!0,class:"validate-popup","close-on-click-overlay":!0},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("div",I,[o.showClose?(e.openBlock(),e.createBlock(i,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",U,e.toDisplayString(o.title),1),o.showClose?(e.openBlock(),e.createBlock(i,{key:1,class:"icon",name:"cross",size:"20",color:"#999",onClick:r})):e.createCommentVNode("",!0)]),e.createElementVNode("div",q,[e.createElementVNode("p",F,e.toDisplayString(o.message),1),e.createVNode(d,{type:"primary",block:"",class:"validate-btn",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.buttonText),1)]),_:1})])])]),_:1},8,["show"])}}},j=V($,[["__scopeId","data-v-d8ab28e4"]]),z={class:"modal-renderer-content"},L={class:"modal-renderer-header"},G={class:"modal-renderer-title"},R={class:"modal-renderer-body"},H={key:0,class:"modal-renderer-text"},J={class:"modal-renderer-footer"},K={__name:"ModalRenderer",props:{show:{type:Boolean,default:!0},position:{type:String,default:"bottom"},title:{type:String,default:"提示"},message:{type:String,default:""},confirmText:{type:String,default:"确认"},cancelText:{type:String,default:"取消"},showCancelButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},content:{type:[Function,Object],default:null},component:{type:[Object,Function],default:null},componentProps:{type:Object,default:()=>({})},modalComponent:{type:[Object,Function],default:null},modalComponentProps:{type:Object,default:()=>({})},buttons:{type:Array,default:null}},emits:["update:show","confirm","cancel","action","close"],setup(t,{emit:c}){const o=t,n=c,r=e.ref(o.show);e.watch(()=>o.show,a=>{r.value=a});const s=e.computed(()=>o.content||o.component),m=e.computed(()=>Array.isArray(o.buttons)&&o.buttons.length>0),l=()=>n("action","overlay"),i=()=>{n("confirm"),n("action","confirm")},d=()=>{n("cancel"),n("action","cancel")},h=(a,C)=>{const k=a.key??String(C);n("action",k),typeof a.onClick=="function"&&a.onClick()},u=()=>n("action","close"),f=a=>{r.value=a,n("update:show",a),a||n("action","close")},p=(a,C)=>n("action",a,C),b=a=>n("action","confirm",a),g=a=>n("action","cancel",a),_=a=>n("action","close",a),P=()=>{var a;return o.component?e.h(o.component,o.componentProps):typeof o.content=="function"?o.content():(a=o.content)!=null&&a.render?o.content.render():o.message?e.h("p",{class:"modal-renderer-message"},o.message):null},A=e.defineComponent({setup(){return()=>P()}}),M=e.computed(()=>({...o.modalComponentProps,show:r.value,position:o.position,title:o.title,message:o.message,confirmText:o.confirmText,cancelText:o.cancelText,showCancelButton:o.showCancelButton,showClose:o.showClose,content:o.content,component:o.component,componentProps:o.componentProps,buttons:o.buttons,requestAction:p,requestConfirm:b,requestCancel:g,requestClose:_}));return(a,C)=>{const k=y.Icon,v=y.Button,E=y.Popup;return t.modalComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.modalComponent),e.mergeProps({key:0},M.value,{"onUpdate:show":f,onAction:p,onConfirm:b,onCancel:g,onClose:_}),null,16)):(e.openBlock(),e.createBlock(E,{key:1,show:r.value,"onUpdate:show":[C[0]||(C[0]=w=>r.value=w),f],position:t.position,round:t.position==="bottom",class:"modal-renderer-popup","close-on-click-overlay":!1,onClickOverlay:l},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createElementVNode("div",L,[t.showClose?(e.openBlock(),e.createBlock(k,{key:0,name:"cross",size:"20",style:{visibility:"hidden",padding:"8px"}})):e.createCommentVNode("",!0),e.createElementVNode("div",G,e.toDisplayString(t.title),1),t.showClose?(e.openBlock(),e.createBlock(k,{key:1,class:"modal-renderer-close",name:"cross",size:"20",color:"#999",onClick:u})):e.createCommentVNode("",!0)]),e.createElementVNode("div",R,[s.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(A)),{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.message?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(t.message),1)):e.createCommentVNode("",!0)],64))]),e.createElementVNode("div",J,[m.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.buttons,(w,x)=>(e.openBlock(),e.createBlock(v,{key:x,type:w.type||"default",class:"modal-renderer-btn",onClick:oe=>h(w,x)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.text),1)]),_:2},1032,["type","onClick"]))),128)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.showCancelButton?(e.openBlock(),e.createBlock(v,{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(v,{type:"primary",class:"modal-renderer-btn modal-renderer-btn-confirm",onClick:i},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.confirmText),1)]),_:1})],64))])])]),_:1},8,["show","position","round"]))}}},Q=V(K,[["__scopeId","data-v-c1845810"]]),W=300,X=["--van-duration-base","--van-animation-duration-base"],T={animationDuration:void 0};function B(t){var s;if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,Math.round(t));if(typeof t!="string")return null;const c=(s=t.trim().split(",")[0])==null?void 0:s.trim();if(!c)return null;const o=c.match(/^(-?\d+(?:\.\d+)?)ms$/i);if(o)return Math.max(0,Math.round(Number(o[1])));const n=c.match(/^(-?\d+(?:\.\d+)?)s$/i);if(n)return Math.max(0,Math.round(Number(n[1])*1e3));const r=Number(c);return Number.isFinite(r)?Math.max(0,Math.round(r)):null}function Y(){if(typeof window>"u"||typeof document>"u")return null;const t=window.getComputedStyle(document.documentElement);for(const c of X){const o=t.getPropertyValue(c),n=B(o);if(n!==null)return n}return null}function D(t={}){const c=B(t.animationDuration);if(c!==null)return c;const o=B(T.animationDuration);if(o!==null)return o;const n=Y();return n!==null?n:W}function Z(t={}){!t||typeof t!="object"||"animationDuration"in t&&(T.animationDuration=t.animationDuration)}function S(t={}){return new Promise(c=>{const o={fn:null},n=D(t),{unmount:r}=N({setup(){const s=e.ref(!0),m=()=>{var l;s.value=!1,(l=o.fn)==null||l.call(o)};return()=>e.h(j,{show:s.value,"onUpdate:show":l=>{var i;s.value=l,l||(i=o.fn)==null||i.call(o)},title:t.title??"提示",message:t.message??"",buttonText:t.buttonText??"知道了",showClose:t.showClose??!0,onConfirm:m})}},{unmountDelay:n});o.fn=()=>r(()=>c())})}const ee=S;function te(t={}){return new Promise((c,o)=>{var h;const n={fn:null},r=D(t),s=e.ref(!0);let m=!1;const l=u=>{var f,p;m||(m=!0,s.value=!1,(f=t.onClose)==null||f.call(t),(p=n.fn)==null||p.call(n,u))},i=async(u,f)=>{if(!m){if(typeof t.beforeClose=="function")try{if(await t.beforeClose(u,f)===!1)return}catch(p){o(p);return}l(u)}};(h=t.onOpen)==null||h.call(t);const{unmount:d}=N({setup(){return()=>e.h(Q,{show:s.value,"onUpdate:show":u=>{s.value=u},onAction:i,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:r});n.fn=u=>d(()=>c(u))})}exports.configureModalUtils=Z;exports.showBottomTip=ee;exports.showCommonBottomPopup=S;exports.showModal=te;
|
|
2
|
+
//# sourceMappingURL=vue-modal-utils.umd.cjs.map
|
|
@@ -0,0 +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.js"],"sourcesContent":["import { createApp as a } from \"vue\";\nfunction l(m, c = {}) {\n const { unmountDelay: u = 0, parent: r = document.body } = c, n = a(m), t = document.createElement(\"div\");\n r.appendChild(t);\n const p = n.mount(t), s = () => {\n n.unmount(), t.remove();\n };\n return { app: n, instance: p, container: t, unmount: (o) => {\n const e = () => {\n s(), o == null || o();\n };\n u > 0 ? setTimeout(e, u) : e();\n } };\n}\nexport {\n l as mountComponent\n};\n//# sourceMappingURL=vue-shared-utils.mjs.map\n","<script setup>\n /* 单按钮底部弹窗组件(供 showCommonBottomPopup 使用) */\n const props = defineProps({\n show: { type: Boolean, default: false },\n title: { type: String, default: '提示' },\n message: { type: String, required: true },\n buttonText: { type: String, default: '知道了' },\n showClose: { type: Boolean, default: true },\n })\n\n const emit = defineEmits(['update:show', 'confirm'])\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 v-model:show=\"props.show\"\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>\n /* 通用弹窗渲染组件,供 showModal 命令式调用使用 */\n import { ref, computed, watch, defineComponent } from 'vue'\n import { h } from 'vue'\n\n const props = defineProps({\n show: { type: Boolean, default: true },\n position: { type: String, default: 'bottom' },\n title: { type: String, default: '提示' },\n message: { type: String, default: '' },\n confirmText: { type: String, default: '确认' },\n cancelText: { type: String, default: '取消' },\n showCancelButton: { type: Boolean, default: false },\n showClose: { type: Boolean, default: true },\n content: { type: [Function, Object], default: null },\n component: { type: [Object, Function], default: null },\n componentProps: { type: Object, default: () => ({}) },\n modalComponent: { type: [Object, Function], default: null },\n modalComponentProps: { type: Object, default: () => ({}) },\n buttons: { type: Array, default: null },\n })\n\n const emit = defineEmits(['update:show', 'confirm', 'cancel', 'action', 'close'])\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, index) => {\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) => {\n internalShow.value = v\n emit('update:show', v)\n if (!v) emit('action', 'close')\n }\n const onCustomAction = (action, payload) => emit('action', action, payload)\n const onCustomConfirm = (payload) => emit('action', 'confirm', payload)\n const onCustomCancel = (payload) => emit('action', 'cancel', payload)\n const onCustomClose = (payload) => 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 ...props.modalComponentProps,\n show: internalShow.value,\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 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=\"position === 'bottom'\"\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\n * 弹窗命令式调用 API:showCommonBottomPopup、showModal、showBottomTip\n */\nimport { h, ref } from 'vue'\nimport { mountComponent } from 'vue-shared-utils'\nimport BottomPopup from './components/BottomPopup.vue'\nimport ModalRenderer from './ModalRenderer.vue'\n\nconst DEFAULT_ANIMATION_DURATION = 300\nconst VANT_ANIMATION_DURATION_VARS = ['--van-duration-base', '--van-animation-duration-base']\n\nconst modalConfig = {\n animationDuration: undefined,\n}\n\nfunction parseAnimationDuration(value) {\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() {\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 = {}) {\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 * @param {Object} [config]\n * @param {number|string} [config.animationDuration] - 动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n */\nexport function configureModalUtils(config = {}) {\n if (!config || typeof config !== 'object') return\n if ('animationDuration' in config) {\n modalConfig.animationDuration = config.animationDuration\n }\n}\n\n/**\n * Phase 1: 单按钮底部弹窗\n * @param {Object} options\n * @param {string} [options.title='提示']\n * @param {string} options.message\n * @param {string} [options.buttonText='知道了']\n * @param {boolean} [options.showClose=true]\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<void>}\n */\nexport function showCommonBottomPopup(options = {}) {\n return new Promise((resolve) => {\n const closeRef = { 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) => {\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/** showCommonBottomPopup 的别名 */\nexport const showBottomTip = showCommonBottomPopup\n\n/**\n * Phase 2/3: 统一弹窗 API\n * @param {Object} options\n * @param {'bottom'|'center'|'top'} [options.position='bottom']\n * @param {string} [options.title='提示']\n * @param {string} [options.message]\n * @param {string} [options.confirmText='确认']\n * @param {string} [options.cancelText='取消']\n * @param {boolean} [options.showCancelButton=false]\n * @param {boolean} [options.showClose=true]\n * @param {Function|Object} [options.content] - 渲染函数 () => VNode\n * @param {Object|Function} [options.component] - 业务组件\n * @param {Object} [options.componentProps] - 组件 props\n * @param {Object|Function} [options.modalComponent] - 完全自定义弹窗组件\n * @param {Object} [options.modalComponentProps] - 完全自定义弹窗组件 props\n * @param {Array} [options.buttons] - [{ text, type?, key? }]\n * @param {Function} [options.onOpen]\n * @param {Function} [options.onClose]\n * @param {Function} [options.beforeClose] - async, 返回 false 可阻止关闭;签名 (action, payload)\n * @param {number|string} [options.animationDuration] - 单次调用动画时长,支持数字(ms)或 \"0.3s\"/\"300ms\"\n * @returns {Promise<'confirm'|'cancel'|'overlay'|'close'|string>}\n */\nexport function showModal(options = {}) {\n return new Promise((resolve, reject) => {\n const closeRef = { fn: null }\n const unmountDelay = resolveAnimationDuration(options)\n\n const show = ref(true)\n let resolved = false\n const finish = (action) => {\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, payload) => {\n if (resolved) return\n if (typeof options.beforeClose === 'function') {\n try {\n const result = await options.beforeClose(action, payload)\n if (result === false) return\n } catch (e) {\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) => {\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"],"names":["l","m","u","r","n","a","t","p","s","o","e","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","v","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","finish","_b","handleAction","ModalRenderer"],"mappings":"2OACA,SAASA,EAAEC,EAAG,EAAI,GAAI,CACpB,KAAM,CAAE,aAAcC,EAAI,EAAG,OAAQC,EAAI,SAAS,IAAI,EAAK,EAAGC,EAAIC,EAAAA,UAAEJ,CAAC,EAAGK,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,IAAK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ACf,GAEAO,EAAA4B,EAAQ,SAAR,MAAA5B,EAAA,KAAA4B,GAEA,KAAM,CAAE,QAAAU,CAAO,EAAKC,EAClB,CACE,OAAQ,CACN,MAAO,IACLxC,EAAAA,EAAEmD,EAAe,CACf,KAAMV,EAAK,MACX,gBAAkB5D,GAAM,CACtB4D,EAAK,MAAQ5D,CACf,EACA,SAAUqE,EACV,SAAUrB,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,IAC1C,CAAa,CACL,CACR,EACM,CAAE,aAAAS,CAAY,CACpB,EAEID,EAAS,GAAM3C,GAAW6C,EAAQ,IAAMH,EAAQ1C,CAAM,CAAC,CACzD,CAAC,CACH"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-modal-utils",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Vue 3 弹窗命令式调用 API,基于 Vant",
|
|
6
|
+
"main": "dist/vue-modal-utils.umd.cjs",
|
|
7
|
+
"module": "dist/vue-modal-utils.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/vue-modal-utils.mjs",
|
|
11
|
+
"require": "./dist/vue-modal-utils.umd.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./style": "./dist/vue-modal-utils.css"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vant": "^4.9.0",
|
|
20
|
+
"vue": "^3.5.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
24
|
+
"sass": "^1.42.1",
|
|
25
|
+
"unplugin-vue-components": "^28.7.0",
|
|
26
|
+
"vant": "^4.9.19",
|
|
27
|
+
"vite": "^6.3.5",
|
|
28
|
+
"vue": "^3.5.13",
|
|
29
|
+
"vue-shared-utils": "workspace:*"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"dev": "vite build --watch"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"vue",
|
|
37
|
+
"vue3",
|
|
38
|
+
"modal",
|
|
39
|
+
"vant",
|
|
40
|
+
"command",
|
|
41
|
+
"imperative"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/JohnieXu/vue-toolkit"
|
|
47
|
+
}
|
|
48
|
+
}
|