zan-layer 1.0.0 → 1.0.2
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/lib/zan-layer.js +122 -121
- package/lib/zan-layer.umd.js +1 -1
- package/package.json +1 -1
- package/types/component/Render.vue.d.ts +11 -4
- package/types/component/ZanLayer.vue.d.ts +1 -1
- package/types/utils/index.d.ts +1 -1
package/lib/zan-layer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as M, computed as I, openBlock as d, createElementBlock as m, normalizeStyle as V, createCommentVNode as p, h as He, renderSlot as ee, createVNode as te, unref as x, withModifiers as re, normalizeClass as N, createElementVNode as B, toDisplayString as P, ref as b, watch as j, onMounted as ye, nextTick as D, Fragment as R, renderList as Ee, shallowRef as lt, withDirectives as ke, vModelText as at, vModelDynamic as ot, useSlots as st, onUnmounted as it, createBlock as A, Teleport as ut, Transition as rt, withCtx as ce, render as Z, isVNode as Se } from "vue";
|
|
2
|
+
const ct = /* @__PURE__ */ M({
|
|
3
3
|
name: "Shade",
|
|
4
4
|
__name: "Shade",
|
|
5
5
|
props: {
|
|
@@ -29,7 +29,7 @@ const dt = /* @__PURE__ */ A({
|
|
|
29
29
|
onClick: i
|
|
30
30
|
}, null, 4)) : p("", !0);
|
|
31
31
|
}
|
|
32
|
-
}),
|
|
32
|
+
}), dt = ["src"], ft = /* @__PURE__ */ M({
|
|
33
33
|
name: "Iframe",
|
|
34
34
|
__name: "Iframe",
|
|
35
35
|
props: {
|
|
@@ -43,17 +43,18 @@ const dt = /* @__PURE__ */ A({
|
|
|
43
43
|
allowtransparency: "true",
|
|
44
44
|
frameborder: "0",
|
|
45
45
|
src: l.value
|
|
46
|
-
}, null, 8,
|
|
46
|
+
}, null, 8, dt));
|
|
47
47
|
}
|
|
48
|
-
}), oe =
|
|
48
|
+
}), oe = M({
|
|
49
49
|
name: "ZanRender",
|
|
50
|
-
__name: "Render",
|
|
51
50
|
props: {
|
|
52
|
-
render: {
|
|
51
|
+
render: {
|
|
52
|
+
type: Function,
|
|
53
|
+
required: !0
|
|
54
|
+
}
|
|
53
55
|
},
|
|
54
56
|
setup(e) {
|
|
55
|
-
|
|
56
|
-
return (l, t) => (d(), M(lt(n.render())));
|
|
57
|
+
return () => e.render();
|
|
57
58
|
}
|
|
58
59
|
}), ne = function(e) {
|
|
59
60
|
return typeof e == "function" ? e() : typeof e == "string" ? He("span", e) : e;
|
|
@@ -64,16 +65,16 @@ function Me() {
|
|
|
64
65
|
e[t] = n.substr(Math.floor(Math.random() * 16), 1);
|
|
65
66
|
return e[14] = "4", e[19] = n.substr(e[19] & 3 | 8, 1), e[8] = e[13] = e[18] = e[23] = "-", e.join("").replaceAll("-", "");
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
return e != "drawer"
|
|
68
|
+
function mt(e, n, l) {
|
|
69
|
+
return e != "drawer" && e != 4 ? vt(n) : Ae(l, n);
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function vt(e) {
|
|
71
72
|
return e === void 0 || e === "auto" ? [] : typeof e == "string" ? [e] : e[1] && e[1] === "auto" ? e[0] && e[0] === "auto" ? [] : [e[0]] : e[0] && e[0] === "auto" ? e[1] && e[1] != "auto" ? [void 0, e[1]] : [] : [...e];
|
|
72
73
|
}
|
|
73
74
|
function Ae(e, n = "30%") {
|
|
74
75
|
return n instanceof Array ? n : (n === "auto" && (n = "30%"), e === "l" || e === "r" || e === "lt" || e === "lb" || e === "rt" || e === "rb" ? [n, "100%"] : e === "t" || e === "b" || e === "tr" || e === "tl" || e === "br" || e === "bl" ? ["100%", n] : [n, "100%"]);
|
|
75
76
|
}
|
|
76
|
-
function de(e, n, l) {
|
|
77
|
+
function de(e = "auto", n, l) {
|
|
77
78
|
const t = [
|
|
78
79
|
"t",
|
|
79
80
|
"r",
|
|
@@ -88,9 +89,9 @@ function de(e, n, l) {
|
|
|
88
89
|
"rb",
|
|
89
90
|
"br"
|
|
90
91
|
], a = [];
|
|
91
|
-
return e === "auto" && l == 4 && (e = "r"), typeof e == "string" ? t.indexOf(e) > -1 ? (e === "t" && (a[0] = "0px", a[1] = "calc(50% - " + n[0] + "/2)"), e === "l" && (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "0px"), e === "b" && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "calc(50% - " + n[0] + "/2)"), e === "r" && (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "calc(100% - " + n[0] + ")"), (e === "lt" || e === "tl") && (a[0] = "0px", a[1] = "0px"), (e === "lb" || e === "bl") && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "0px"), (e === "rt" || e === "tr") && (a[0] = "0px", a[1] = "calc(100% - " + n[0] + ")"), (e === "rb" || e === "br") && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "calc(100% - " + n[0] + ")")) : e == "auto" ? (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "calc(50% - " + n[0] + "/2)") : (a[0] = e, a[1] = "calc(50% - " + n[0] + "/2)") : (a[0] = e[0], a[1] = e[1]), a;
|
|
92
|
+
return e === "auto" && l == 4 && (e = "r"), typeof e == "string" ? t.indexOf(e) > -1 ? (e === "t" && (a[0] = "0px", a[1] = "calc(50% - " + n[0] + "/2)"), e === "l" && (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "0px"), e === "b" && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "calc(50% - " + n[0] + "/2)"), e === "r" && (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "calc(100% - " + n[0] + ")"), (e === "lt" || e === "tl") && (a[0] = "0px", a[1] = "0px"), (e === "lb" || e === "bl") && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "0px"), (e === "rt" || e === "tr") && (a[0] = "0px", a[1] = "calc(100% - " + n[0] + ")"), (e === "rb" || e === "br") && (a[0] = "calc(100% - " + n[1] + ")", a[1] = "calc(100% - " + n[0] + ")")) : e == "auto" ? (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "calc(50% - " + n[0] + "/2)") : (a[0] = e, a[1] = "calc(50% - " + n[0] + "/2)") : e && e[0] !== void 0 && e[1] !== void 0 ? (a[0] = e[0], a[1] = e[1]) : (a[0] = "calc(50% - " + n[1] + "/2)", a[1] = "calc(50% - " + n[0] + "/2)"), a;
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
+
function yt(e) {
|
|
94
95
|
return e === "dialog" || e == 0 ? 0 : e === "page" || e == 1 ? 1 : e === "iframe" || e == 2 ? 2 : e === "loading" || e == 3 ? 3 : e === "drawer" || e == 4 ? 4 : e === "photos" || e == 5 ? 5 : e === "notify" || e == 6 ? 6 : e === "prompt" || e == 7 ? 7 : 0;
|
|
95
96
|
}
|
|
96
97
|
function Le() {
|
|
@@ -149,7 +150,7 @@ function me(e, n) {
|
|
|
149
150
|
return a;
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function pt(e, n, l) {
|
|
153
154
|
const t = ["lt", "lb", "rt", "rb"];
|
|
154
155
|
let a = "0", i = "0", o = 15;
|
|
155
156
|
window.NotifiyQueen = window.NotifiyQueen || [];
|
|
@@ -174,7 +175,7 @@ function ht(e, n, l) {
|
|
|
174
175
|
offset: e
|
|
175
176
|
}), [a, i];
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
+
function ht(e) {
|
|
178
179
|
const n = me("zan-layer", e);
|
|
179
180
|
if (!n) return;
|
|
180
181
|
const l = 15, t = n.offsetHeight;
|
|
@@ -193,12 +194,12 @@ function gt(e) {
|
|
|
193
194
|
}
|
|
194
195
|
}), a.splice(i, 1);
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function gt(e) {
|
|
197
198
|
const n = "zan-layer-drawer-anim zan-layer-anim";
|
|
198
199
|
let l = "";
|
|
199
200
|
return e === "lt" || e === "lb" ? l = "lr" : l = "rl", `${n}-${l}`;
|
|
200
201
|
}
|
|
201
|
-
const
|
|
202
|
+
const xt = /* @__PURE__ */ M({
|
|
202
203
|
name: "Header",
|
|
203
204
|
__name: "Header",
|
|
204
205
|
props: {
|
|
@@ -219,7 +220,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
219
220
|
])
|
|
220
221
|
], 4));
|
|
221
222
|
}
|
|
222
|
-
}),
|
|
223
|
+
}), bt = /* @__PURE__ */ M({
|
|
223
224
|
name: "Footer",
|
|
224
225
|
__name: "Footer",
|
|
225
226
|
props: {
|
|
@@ -238,7 +239,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
238
239
|
])
|
|
239
240
|
], 4));
|
|
240
241
|
}
|
|
241
|
-
}),
|
|
242
|
+
}), zt = { class: "zan-layer-setwin" }, Ct = { class: "zan-tooltip" }, wt = { class: "zan-tooltip" }, kt = /* @__PURE__ */ M({
|
|
242
243
|
name: "HeaderBtn",
|
|
243
244
|
__name: "HeaderBtn",
|
|
244
245
|
props: {
|
|
@@ -256,20 +257,20 @@ const bt = /* @__PURE__ */ A({
|
|
|
256
257
|
}, c = () => {
|
|
257
258
|
t("onClose");
|
|
258
259
|
};
|
|
259
|
-
return (o, s) => (d(), m("span",
|
|
260
|
+
return (o, s) => (d(), m("span", zt, [
|
|
260
261
|
l.maxmin && !l.max ? (d(), m("i", {
|
|
261
262
|
key: 0,
|
|
262
263
|
class: N(["zan-icon-btn", l.min ? "zan-icon-full" : "zan-icon-min"]),
|
|
263
264
|
onClick: re(a, ["stop"])
|
|
264
265
|
}, [
|
|
265
|
-
B("span",
|
|
266
|
+
B("span", Ct, P(l.min ? "还原" : "最小化"), 1)
|
|
266
267
|
], 2)) : p("", !0),
|
|
267
268
|
l.maxmin && !l.min ? (d(), m("i", {
|
|
268
269
|
key: 1,
|
|
269
270
|
class: N(["zan-icon-btn", l.max ? "zan-icon-restore" : "zan-icon-max"]),
|
|
270
271
|
onClick: re(i, ["stop"])
|
|
271
272
|
}, [
|
|
272
|
-
B("span",
|
|
273
|
+
B("span", wt, P(l.max ? "还原" : "最大化"), 1)
|
|
273
274
|
], 2)) : p("", !0),
|
|
274
275
|
l.closeBtn ? (d(), m("i", {
|
|
275
276
|
key: 2,
|
|
@@ -280,24 +281,24 @@ const bt = /* @__PURE__ */ A({
|
|
|
280
281
|
])], 2)) : p("", !0)
|
|
281
282
|
]));
|
|
282
283
|
}
|
|
283
|
-
}),
|
|
284
|
+
}), St = (e, n) => {
|
|
284
285
|
const l = e.__vccOpts || e;
|
|
285
286
|
for (const [t, a] of n)
|
|
286
287
|
l[t] = a;
|
|
287
288
|
return l;
|
|
288
|
-
},
|
|
289
|
+
}, Lt = /* @__PURE__ */ St(kt, [["__scopeId", "data-v-8d683fcb"]]), $t = { class: "zan-layer-phimg" }, It = ["src"], Bt = {
|
|
289
290
|
key: 0,
|
|
290
291
|
class: "zan-layer-imgsee"
|
|
291
|
-
},
|
|
292
|
+
}, Ot = {
|
|
292
293
|
key: 0,
|
|
293
294
|
class: "zan-layer-imguide"
|
|
294
|
-
},
|
|
295
|
+
}, Ft = {
|
|
295
296
|
key: 0,
|
|
296
297
|
class: "thumb-row"
|
|
297
|
-
},
|
|
298
|
+
}, Ht = ["onClick"], Et = ["src"], Mt = {
|
|
298
299
|
key: 1,
|
|
299
300
|
class: "zan-layer-imgtit"
|
|
300
|
-
},
|
|
301
|
+
}, At = { key: 0 }, Dt = { key: 1 }, Nt = /* @__PURE__ */ M({
|
|
301
302
|
name: "Photos",
|
|
302
303
|
__name: "Photos",
|
|
303
304
|
props: {
|
|
@@ -307,7 +308,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
307
308
|
emits: ["resetCalculationPohtosArea"],
|
|
308
309
|
setup(e, { emit: n }) {
|
|
309
310
|
const l = n, t = e, a = b(t.startIndex);
|
|
310
|
-
|
|
311
|
+
j(a, () => {
|
|
311
312
|
l("resetCalculationPohtosArea", a.value);
|
|
312
313
|
});
|
|
313
314
|
const i = (s) => {
|
|
@@ -327,12 +328,12 @@ const bt = /* @__PURE__ */ A({
|
|
|
327
328
|
f.thumb && (s = !0);
|
|
328
329
|
}), s;
|
|
329
330
|
});
|
|
330
|
-
return (s, f) => (d(), m("div",
|
|
331
|
+
return (s, f) => (d(), m("div", $t, [
|
|
331
332
|
B("img", {
|
|
332
333
|
src: e.imgList[a.value].src
|
|
333
|
-
}, null, 8,
|
|
334
|
-
e.imgList.length > 0 ? (d(), m("div",
|
|
335
|
-
e.imgList.length > 1 ? (d(), m("span",
|
|
334
|
+
}, null, 8, It),
|
|
335
|
+
e.imgList.length > 0 ? (d(), m("div", Bt, [
|
|
336
|
+
e.imgList.length > 1 ? (d(), m("span", Ot, [
|
|
336
337
|
B("a", {
|
|
337
338
|
href: "javascript:;",
|
|
338
339
|
class: "zan-layer-iconext zan-layer-imgprev",
|
|
@@ -349,34 +350,34 @@ const bt = /* @__PURE__ */ A({
|
|
|
349
350
|
class: "zan-layer-imgbar",
|
|
350
351
|
style: V({ opacity: c.value ? 1 : 0 })
|
|
351
352
|
}, [
|
|
352
|
-
o.value ? (d(), m("div",
|
|
353
|
-
(d(!0), m(
|
|
353
|
+
o.value ? (d(), m("div", Ft, [
|
|
354
|
+
(d(!0), m(R, null, Ee(e.imgList, (r, u) => (d(), m("div", {
|
|
354
355
|
class: "thumb-box",
|
|
355
356
|
key: "thumb-box" + u,
|
|
356
357
|
onClick: (y) => a.value = u
|
|
357
358
|
}, [
|
|
358
359
|
B("img", {
|
|
359
360
|
src: r.thumb
|
|
360
|
-
}, null, 8,
|
|
361
|
-
], 8,
|
|
361
|
+
}, null, 8, Et)
|
|
362
|
+
], 8, Ht))), 128)),
|
|
362
363
|
B("div", {
|
|
363
364
|
class: "thumb-box-border",
|
|
364
365
|
style: V({
|
|
365
366
|
left: `calc(calc( calc(100% - ${100 * e.imgList.length}px) / 2) + ${a.value * 100}px)`
|
|
366
367
|
})
|
|
367
368
|
}, null, 4)
|
|
368
|
-
])) : (d(), m("span",
|
|
369
|
-
e.imgList[a.value].alt ? (d(), m("span",
|
|
370
|
-
e.imgList.length > 1 ? (d(), m("em",
|
|
369
|
+
])) : (d(), m("span", Mt, [
|
|
370
|
+
e.imgList[a.value].alt ? (d(), m("span", At, P(e.imgList[a.value].alt), 1)) : p("", !0),
|
|
371
|
+
e.imgList.length > 1 ? (d(), m("em", Dt, P(a.value + 1) + " / " + P(e.imgList.length), 1)) : p("", !0)
|
|
371
372
|
]))
|
|
372
373
|
], 4)) : p("", !0)
|
|
373
374
|
])) : p("", !0)
|
|
374
375
|
]));
|
|
375
376
|
}
|
|
376
|
-
}),
|
|
377
|
+
}), Vt = { class: "title" }, Pt = {
|
|
377
378
|
key: 0,
|
|
378
379
|
class: "content"
|
|
379
|
-
},
|
|
380
|
+
}, Tt = ["innerHTML"], jt = /* @__PURE__ */ M({
|
|
380
381
|
name: "Notifiy",
|
|
381
382
|
__name: "Notifiy",
|
|
382
383
|
props: {
|
|
@@ -388,7 +389,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
388
389
|
},
|
|
389
390
|
emits: ["close"],
|
|
390
391
|
setup(e, { emit: n }) {
|
|
391
|
-
const l = e, t = n, a =
|
|
392
|
+
const l = e, t = n, a = lt(null), i = () => {
|
|
392
393
|
t("close");
|
|
393
394
|
};
|
|
394
395
|
function c(o, s) {
|
|
@@ -410,14 +411,14 @@ const bt = /* @__PURE__ */ A({
|
|
|
410
411
|
ref_key: "notifyRef",
|
|
411
412
|
ref: a
|
|
412
413
|
}, [
|
|
413
|
-
B("h2",
|
|
414
|
+
B("h2", Vt, [
|
|
414
415
|
e.icon ? (d(), m("i", {
|
|
415
416
|
key: 0,
|
|
416
417
|
class: N(e.iconClass)
|
|
417
418
|
}, null, 2)) : p("", !0),
|
|
418
419
|
B("span", null, P(e.title), 1)
|
|
419
420
|
]),
|
|
420
|
-
!e.isHtmlFragment && e.content ? (d(), m("div",
|
|
421
|
+
!e.isHtmlFragment && e.content ? (d(), m("div", Pt, [
|
|
421
422
|
te(oe, {
|
|
422
423
|
render: () => x(ne)(l.content)
|
|
423
424
|
}, null, 8, ["render"])
|
|
@@ -425,7 +426,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
425
426
|
key: 1,
|
|
426
427
|
class: "content",
|
|
427
428
|
innerHTML: e.content
|
|
428
|
-
}, null, 8,
|
|
429
|
+
}, null, 8, Tt)) : p("", !0),
|
|
429
430
|
B("i", {
|
|
430
431
|
class: "zan-icon-close",
|
|
431
432
|
onClick: i
|
|
@@ -443,7 +444,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
443
444
|
])])
|
|
444
445
|
], 512));
|
|
445
446
|
}
|
|
446
|
-
}), Rt = ["maxlength", "placeholder"],
|
|
447
|
+
}), Rt = ["maxlength", "placeholder"], _t = ["type", "placeholder"], Wt = /* @__PURE__ */ M({
|
|
447
448
|
name: "Prompt",
|
|
448
449
|
__name: "Prompt",
|
|
449
450
|
props: {
|
|
@@ -474,7 +475,7 @@ const bt = /* @__PURE__ */ A({
|
|
|
474
475
|
placeholder: l.placeholder,
|
|
475
476
|
class: "zan-textarea"
|
|
476
477
|
}, null, 40, Rt)), [
|
|
477
|
-
[
|
|
478
|
+
[at, t.value]
|
|
478
479
|
]) : ke((d(), m("input", {
|
|
479
480
|
key: 1,
|
|
480
481
|
onInput: o[2] || (o[2] = (s) => c.$emit("update:promptValue", t.value)),
|
|
@@ -482,12 +483,12 @@ const bt = /* @__PURE__ */ A({
|
|
|
482
483
|
type: i.value ? "password" : "text",
|
|
483
484
|
placeholder: l.placeholder,
|
|
484
485
|
class: "zan-input"
|
|
485
|
-
}, null, 40,
|
|
486
|
-
[
|
|
486
|
+
}, null, 40, _t)), [
|
|
487
|
+
[ot, t.value]
|
|
487
488
|
]);
|
|
488
489
|
}
|
|
489
490
|
});
|
|
490
|
-
function
|
|
491
|
+
function Xt(e) {
|
|
491
492
|
for (; e && e.parentNode; )
|
|
492
493
|
if (e = e.parentNode, e && getComputedStyle(e).position === "relative")
|
|
493
494
|
return e;
|
|
@@ -497,7 +498,7 @@ const ae = (e) => {
|
|
|
497
498
|
document.querySelectorAll(".zan-layer iframe").forEach((l) => {
|
|
498
499
|
l.style.pointerEvents = e;
|
|
499
500
|
});
|
|
500
|
-
},
|
|
501
|
+
}, Yt = function(e, n, l, t, a) {
|
|
501
502
|
let i, c, o = 0, s = 0, f = !0;
|
|
502
503
|
e != null && e.addEventListener("mousedown", function(r) {
|
|
503
504
|
if ((r.composedPath && r.composedPath() || r.path)[0].className === "zan-layer-title" && r.button == 0 && e != null) {
|
|
@@ -512,7 +513,7 @@ const ae = (e) => {
|
|
|
512
513
|
if (!n) {
|
|
513
514
|
let O = k - e.offsetWidth, F = S - e.offsetHeight;
|
|
514
515
|
if (e.style.position === "absolute") {
|
|
515
|
-
const E =
|
|
516
|
+
const E = Xt(e);
|
|
516
517
|
E != null && (O = E.clientWidth - e.offsetWidth, F = E.clientHeight - e.offsetHeight);
|
|
517
518
|
}
|
|
518
519
|
h < 0 ? h = 0 : h > O && (h = O), g < 0 ? g = 0 : g > F && (g = F);
|
|
@@ -527,7 +528,7 @@ const ae = (e) => {
|
|
|
527
528
|
}
|
|
528
529
|
return !1;
|
|
529
530
|
});
|
|
530
|
-
},
|
|
531
|
+
}, Qt = function(e, n, l, t) {
|
|
531
532
|
let a = 0, i = 0, c = !0;
|
|
532
533
|
e != null && e.addEventListener("mousedown", function(o) {
|
|
533
534
|
if ((o.composedPath && o.composedPath() || o.path)[0].className === "zan-layer-resize" && o.button == 0 && e != null) {
|
|
@@ -552,18 +553,18 @@ const ae = (e) => {
|
|
|
552
553
|
}
|
|
553
554
|
return !1;
|
|
554
555
|
});
|
|
555
|
-
},
|
|
556
|
-
let
|
|
556
|
+
}, Gt = Symbol("zIndex");
|
|
557
|
+
let Ut = 99999;
|
|
557
558
|
function Fe() {
|
|
558
|
-
return ++
|
|
559
|
+
return ++Ut;
|
|
559
560
|
}
|
|
560
|
-
const
|
|
561
|
+
const Zt = ["id"], qt = {
|
|
561
562
|
key: 1,
|
|
562
563
|
class: "slot-fragment"
|
|
563
|
-
},
|
|
564
|
+
}, Kt = ["innerHTML"], Jt = ["onClick"], en = {
|
|
564
565
|
key: 2,
|
|
565
566
|
class: "zan-layer-resize"
|
|
566
|
-
}, ve = /* @__PURE__ */
|
|
567
|
+
}, ve = /* @__PURE__ */ M({
|
|
567
568
|
name: "ZanLayer",
|
|
568
569
|
__name: "ZanLayer",
|
|
569
570
|
props: {
|
|
@@ -640,12 +641,12 @@ const qt = ["id"], Kt = {
|
|
|
640
641
|
},
|
|
641
642
|
emits: ["close", "update:modelValue"],
|
|
642
643
|
setup(e, { expose: n, emit: l }) {
|
|
643
|
-
const t = e, a = l, i =
|
|
644
|
-
|
|
644
|
+
const t = e, a = l, i = st(), c = b(!1), o = b(!1), s = b(t.id || Me()), f = b(null), r = b(), u = yt(t.type), y = b(
|
|
645
|
+
mt(t.type, t.area, t.offset)
|
|
645
646
|
), $ = b(
|
|
646
647
|
de(t.offset, y.value, u)
|
|
647
|
-
), H = b(99999), C = b(!1), h = b(y.value[0]), g = b(y.value[1]), k = b($.value[0]), S = b($.value[1]), O = b(""), F = b(""), E = b(""),
|
|
648
|
-
|
|
648
|
+
), H = b(99999), C = b(!1), h = b(y.value[0]), g = b(y.value[1]), k = b($.value[0]), S = b($.value[1]), O = b(""), F = b(""), E = b(""), _ = b(""), G = b(t.value);
|
|
649
|
+
j(
|
|
649
650
|
() => t.value,
|
|
650
651
|
() => {
|
|
651
652
|
G.value = t.value;
|
|
@@ -654,7 +655,7 @@ const qt = ["id"], Kt = {
|
|
|
654
655
|
const pe = () => {
|
|
655
656
|
H.value = t.zIndex ?? Fe();
|
|
656
657
|
};
|
|
657
|
-
|
|
658
|
+
j(
|
|
658
659
|
() => t.zIndex,
|
|
659
660
|
() => {
|
|
660
661
|
pe();
|
|
@@ -667,28 +668,28 @@ const qt = ["id"], Kt = {
|
|
|
667
668
|
t.imgList[t.startIndex].src
|
|
668
669
|
));
|
|
669
670
|
let v = y.value;
|
|
670
|
-
(v[0] == null || v[1] == null) && (v = Ie(f.value)), u == 6 && ($.value =
|
|
671
|
+
(v[0] == null || v[1] == null) && (v = Ie(f.value)), u == 6 && ($.value = pt(t.offset, v, s.value)), U(), we(), Ve();
|
|
671
672
|
});
|
|
672
673
|
}, De = function() {
|
|
673
|
-
o.value && ze(), c.value && xe(), O.value = "", F.value = "", E.value = "",
|
|
674
|
+
o.value && ze(), c.value && xe(), O.value = "", F.value = "", E.value = "", _.value = "";
|
|
674
675
|
}, ge = () => {
|
|
675
|
-
E.value = k.value,
|
|
676
|
+
E.value = k.value, _.value = S.value, O.value = h.value, F.value = g.value, h.value = Le().w, g.value = Le().h, k.value = $e().t, S.value = $e().l;
|
|
676
677
|
}, xe = () => {
|
|
677
678
|
c.value ? (X(), h.value = O.value, g.value = F.value, t.revert(s.value)) : (Y(), ge(), t.full(s.value)), c.value = !c.value;
|
|
678
679
|
}, be = () => {
|
|
679
680
|
let ue = 10 + 190 * q(s.value, !0);
|
|
680
681
|
const nt = document.documentElement.clientWidth;
|
|
681
|
-
ue + 180 > nt && (ue = 10), O.value = h.value, F.value = g.value, E.value = k.value,
|
|
682
|
+
ue + 180 > nt && (ue = 10), O.value = h.value, F.value = g.value, E.value = k.value, _.value = S.value, g.value = "51px", h.value = "180px", k.value = "calc(100% - 51px)", S.value = ue + "px";
|
|
682
683
|
}, ze = async () => {
|
|
683
684
|
o.value ? (X(), q(s.value, !1), h.value = O.value, g.value = F.value, t.revert(s.value)) : (Y(), be(), t.min(s.value)), o.value = !o.value;
|
|
684
685
|
};
|
|
685
|
-
|
|
686
|
+
j(
|
|
686
687
|
() => t.modelValue,
|
|
687
688
|
() => {
|
|
688
689
|
C.value = t.modelValue, C.value ? (he(), pe()) : De();
|
|
689
690
|
},
|
|
690
691
|
{ deep: !0, immediate: !0 }
|
|
691
|
-
),
|
|
692
|
+
), j(
|
|
692
693
|
() => C.value,
|
|
693
694
|
() => {
|
|
694
695
|
C.value && (t.isFunction && he(), D(() => {
|
|
@@ -696,7 +697,7 @@ const qt = ["id"], Kt = {
|
|
|
696
697
|
}));
|
|
697
698
|
},
|
|
698
699
|
{ immediate: !0, flush: "post" }
|
|
699
|
-
),
|
|
700
|
+
), j(
|
|
700
701
|
() => C.value,
|
|
701
702
|
() => {
|
|
702
703
|
C.value || t.end(s.value);
|
|
@@ -717,11 +718,11 @@ const qt = ["id"], Kt = {
|
|
|
717
718
|
t.layerClasses
|
|
718
719
|
]), Ve = function() {
|
|
719
720
|
t.move && u != 4 && D(() => {
|
|
720
|
-
f.value && (
|
|
721
|
+
f.value && (Yt(
|
|
721
722
|
f.value,
|
|
722
723
|
t.moveOut,
|
|
723
724
|
(v, z) => {
|
|
724
|
-
S.value = v, k.value = z, o.value || (
|
|
725
|
+
S.value = v, k.value = z, o.value || (_.value = v, E.value = z), t.moving(s.value, { top: z, left: v });
|
|
725
726
|
},
|
|
726
727
|
() => {
|
|
727
728
|
const v = {
|
|
@@ -735,7 +736,7 @@ const qt = ["id"], Kt = {
|
|
|
735
736
|
() => {
|
|
736
737
|
t.moveStart(s.value);
|
|
737
738
|
}
|
|
738
|
-
),
|
|
739
|
+
), Qt(
|
|
739
740
|
f.value,
|
|
740
741
|
(v, z) => {
|
|
741
742
|
g.value = z, h.value = v, F.value = z, O.value = v, t.resizing(s.value, { width: v, height: z });
|
|
@@ -768,14 +769,14 @@ const qt = ["id"], Kt = {
|
|
|
768
769
|
const v = t.beforeClose(s.value);
|
|
769
770
|
(v === void 0 || v != null && v === !0) && (t.close(s.value), a("close"), a("update:modelValue", !1), t.internalDestroy && t.internalDestroy(), o.value && q(s.value, !o.value));
|
|
770
771
|
}
|
|
771
|
-
},
|
|
772
|
+
}, je = (...v) => {
|
|
772
773
|
typeof t.yes == "function" ? t.yes(...v) : le();
|
|
773
|
-
},
|
|
774
|
+
}, Re = () => {
|
|
774
775
|
t.shadeClose && le();
|
|
775
|
-
}, Ce = I(() => ["zan-icon", `zan-icon-ico${t.icon}`]),
|
|
776
|
+
}, Ce = I(() => ["zan-icon", `zan-icon-ico${t.icon}`]), _e = I(() => u === 4 ? Be(t.offset) : u === 6 ? gt(t.offset) : `zan-layer-anim-0${t.anim}`), We = I(() => u === 4 ? Be(t.offset, !0) : t.isOutAnim ? "zan-layer-anim-close" : ""), Xe = () => {
|
|
776
777
|
C.value = !0;
|
|
777
778
|
}, Ye = () => {
|
|
778
|
-
C.value = !1, u === 6 &&
|
|
779
|
+
C.value = !1, u === 6 && ht(s.value);
|
|
779
780
|
}, Qe = I(() => C.value && t.shade && !o.value), Ge = I(() => t.resize && !c.value && !o.value), Ue = I(() => t.title && u != 3 && u != 5 && u != 6), Ze = function(v) {
|
|
780
781
|
D(async () => {
|
|
781
782
|
y.value = await Oe(t.imgList[v].src), $.value = de(t.offset, y.value, u), h.value = y.value[0], g.value = y.value[1], k.value = $.value[0], S.value = $.value[1], O.value = y.value[0], F.value = y.value[1];
|
|
@@ -785,9 +786,9 @@ const qt = ["id"], Kt = {
|
|
|
785
786
|
};
|
|
786
787
|
ye(() => {
|
|
787
788
|
X();
|
|
788
|
-
}),
|
|
789
|
+
}), it(() => {
|
|
789
790
|
Y();
|
|
790
|
-
}),
|
|
791
|
+
}), j(
|
|
791
792
|
() => t.modelValue,
|
|
792
793
|
() => {
|
|
793
794
|
t.modelValue ? X() : Y();
|
|
@@ -807,11 +808,11 @@ const qt = ["id"], Kt = {
|
|
|
807
808
|
}, Y = function() {
|
|
808
809
|
W && r.value && (W.unobserve(r.value), W = void 0);
|
|
809
810
|
}, U = function(v = !1) {
|
|
810
|
-
k.value = v && t.lastPosition && E.value || $.value[0], S.value = v && t.lastPosition &&
|
|
811
|
+
k.value = v && t.lastPosition && E.value || $.value[0], S.value = v && t.lastPosition && _.value || $.value[1];
|
|
811
812
|
}, we = function() {
|
|
812
813
|
h.value = y.value[0], g.value = y.value[1], O.value = y.value[0], F.value = y.value[1];
|
|
813
814
|
}, Ke = function() {
|
|
814
|
-
X(), q(s.value, !1), o.value = !1, c.value = !1, E.value = "",
|
|
815
|
+
X(), q(s.value, !1), o.value = !1, c.value = !1, E.value = "", _.value = "", U(), we(), t.modelValue || a("update:modelValue", !0);
|
|
815
816
|
}, Je = async function() {
|
|
816
817
|
o.value && (se(), U(!0)), c.value || (await D(), Y(), ge(), c.value = !0);
|
|
817
818
|
}, et = async function() {
|
|
@@ -819,21 +820,21 @@ const qt = ["id"], Kt = {
|
|
|
819
820
|
}, se = () => {
|
|
820
821
|
X(), q(s.value, !1), o.value = !1, c.value = !1, h.value = O.value, g.value = F.value;
|
|
821
822
|
};
|
|
822
|
-
return n({ reset: Ke, open: Xe, close: Ye, full: Je, min: et, revert: se }), (v, z) => (d(),
|
|
823
|
+
return n({ reset: Ke, open: Xe, close: Ye, full: Je, min: et, revert: se }), (v, z) => (d(), A(ut, {
|
|
823
824
|
to: e.teleport,
|
|
824
825
|
disabled: e.teleportDisabled
|
|
825
826
|
}, [
|
|
826
|
-
te(
|
|
827
|
+
te(ct, {
|
|
827
828
|
index: H.value,
|
|
828
829
|
"shade-style": e.shadeStyle,
|
|
829
830
|
visible: Qe.value,
|
|
830
831
|
opacity: e.shadeOpacity,
|
|
831
832
|
teleport: e.teleport,
|
|
832
833
|
teleportDisabled: e.teleportDisabled,
|
|
833
|
-
onShadeClick:
|
|
834
|
+
onShadeClick: Re
|
|
834
835
|
}, null, 8, ["index", "shade-style", "visible", "opacity", "teleport", "teleportDisabled"]),
|
|
835
|
-
te(
|
|
836
|
-
"enter-active-class":
|
|
836
|
+
te(rt, {
|
|
837
|
+
"enter-active-class": _e.value,
|
|
837
838
|
"leave-active-class": We.value
|
|
838
839
|
}, {
|
|
839
840
|
default: ce(() => [
|
|
@@ -845,7 +846,7 @@ const qt = ["id"], Kt = {
|
|
|
845
846
|
id: s.value,
|
|
846
847
|
style: V(Pe.value)
|
|
847
848
|
}, [
|
|
848
|
-
Ue.value ? (d(),
|
|
849
|
+
Ue.value ? (d(), A(xt, {
|
|
849
850
|
key: 0,
|
|
850
851
|
title: e.title,
|
|
851
852
|
titleStyle: e.titleStyle,
|
|
@@ -863,27 +864,27 @@ const qt = ["id"], Kt = {
|
|
|
863
864
|
class: N(["zan-layer-content", Te.value]),
|
|
864
865
|
style: V(o.value === !0 ? "display:none" : "")
|
|
865
866
|
}, [
|
|
866
|
-
x(u) === 0 || x(u) === 1 || x(u) === 4 ? (d(), m(
|
|
867
|
+
x(u) === 0 || x(u) === 1 || x(u) === 4 ? (d(), m(R, { key: 0 }, [
|
|
867
868
|
e.icon ? (d(), m("i", {
|
|
868
869
|
key: 0,
|
|
869
870
|
class: N(Ce.value)
|
|
870
871
|
}, null, 2)) : p("", !0),
|
|
871
|
-
x(i).default ? (d(), m("div",
|
|
872
|
+
x(i).default ? (d(), m("div", qt, [
|
|
872
873
|
ee(v.$slots, "default")
|
|
873
|
-
])) : (d(), m(
|
|
874
|
+
])) : (d(), m(R, { key: 2 }, [
|
|
874
875
|
e.isHtmlFragment ? (d(), m("div", {
|
|
875
876
|
key: 0,
|
|
876
877
|
class: "html-fragment",
|
|
877
878
|
innerHTML: x(ne)(t.content)
|
|
878
|
-
}, null, 8,
|
|
879
|
-
t.content ? (d(),
|
|
879
|
+
}, null, 8, Kt)) : (d(), m(R, { key: 1 }, [
|
|
880
|
+
t.content ? (d(), A(oe, {
|
|
880
881
|
key: 0,
|
|
881
882
|
render: () => x(ne)(t.content)
|
|
882
883
|
}, null, 8, ["render"])) : p("", !0)
|
|
883
884
|
], 64))
|
|
884
885
|
], 64))
|
|
885
886
|
], 64)) : p("", !0),
|
|
886
|
-
x(u) === 7 ? (d(),
|
|
887
|
+
x(u) === 7 ? (d(), A(Wt, {
|
|
887
888
|
key: 1,
|
|
888
889
|
"prompt-value": G.value,
|
|
889
890
|
"onUpdate:promptValue": z[0] || (z[0] = (w) => G.value = w),
|
|
@@ -891,17 +892,17 @@ const qt = ["id"], Kt = {
|
|
|
891
892
|
maxLength: t.maxLength,
|
|
892
893
|
placeholder: t.placeholder
|
|
893
894
|
}, null, 8, ["prompt-value", "formType", "maxLength", "placeholder"])) : p("", !0),
|
|
894
|
-
x(u) === 2 ? (d(),
|
|
895
|
+
x(u) === 2 ? (d(), A(ft, {
|
|
895
896
|
key: 2,
|
|
896
897
|
src: t.content
|
|
897
898
|
}, null, 8, ["src"])) : p("", !0),
|
|
898
|
-
x(u) === 5 ? (d(),
|
|
899
|
+
x(u) === 5 ? (d(), A(Nt, {
|
|
899
900
|
key: 3,
|
|
900
901
|
imgList: t.imgList,
|
|
901
902
|
startIndex: t.startIndex,
|
|
902
903
|
onResetCalculationPohtosArea: Ze
|
|
903
904
|
}, null, 8, ["imgList", "startIndex"])) : p("", !0),
|
|
904
|
-
x(u) === 6 ? (d(),
|
|
905
|
+
x(u) === 6 ? (d(), A(jt, {
|
|
905
906
|
key: 4,
|
|
906
907
|
onClose: le,
|
|
907
908
|
title: t.title,
|
|
@@ -911,7 +912,7 @@ const qt = ["id"], Kt = {
|
|
|
911
912
|
iconClass: Ce.value
|
|
912
913
|
}, null, 8, ["title", "content", "isHtmlFragment", "icon", "iconClass"])) : p("", !0)
|
|
913
914
|
], 6),
|
|
914
|
-
x(u) != 3 && x(u) != 5 && x(u) != 6 ? (d(),
|
|
915
|
+
x(u) != 3 && x(u) != 5 && x(u) != 6 ? (d(), A(Lt, {
|
|
915
916
|
key: 1,
|
|
916
917
|
maxmin: e.maxmin,
|
|
917
918
|
max: c.value,
|
|
@@ -924,7 +925,7 @@ const qt = ["id"], Kt = {
|
|
|
924
925
|
B("div", {
|
|
925
926
|
style: V(o.value === !0 ? "display:none" : "")
|
|
926
927
|
}, [
|
|
927
|
-
x(i).footer || t.footer ? (d(),
|
|
928
|
+
x(i).footer || t.footer ? (d(), A(bt, {
|
|
928
929
|
key: 0,
|
|
929
930
|
footer: t.footer,
|
|
930
931
|
footerStyle: t.footerStyle
|
|
@@ -933,12 +934,12 @@ const qt = ["id"], Kt = {
|
|
|
933
934
|
ee(v.$slots, "footer")
|
|
934
935
|
]),
|
|
935
936
|
_: 3
|
|
936
|
-
}, 8, ["footer", "footerStyle"])) : (d(), m(
|
|
937
|
+
}, 8, ["footer", "footerStyle"])) : (d(), m(R, { key: 1 }, [
|
|
937
938
|
(e.btn && e.btn.length > 0 || x(u) === 0 || x(u) === 7) && !e.isMessage ? (d(), m("div", {
|
|
938
939
|
key: 0,
|
|
939
940
|
class: N(["zan-layer-btn", [`zan-layer-btn-${e.btnAlign}`]])
|
|
940
941
|
}, [
|
|
941
|
-
e.btn && e.btn.length > 0 ? (d(!0), m(
|
|
942
|
+
e.btn && e.btn.length > 0 ? (d(!0), m(R, { key: 0 }, Ee(e.btn, (w, ie) => (d(), m("a", {
|
|
942
943
|
key: ie,
|
|
943
944
|
style: V(w.style),
|
|
944
945
|
class: N([
|
|
@@ -947,30 +948,30 @@ const qt = ["id"], Kt = {
|
|
|
947
948
|
{ "zan-layer-btn-disabled": w.disabled }
|
|
948
949
|
]),
|
|
949
950
|
onClick: (tt) => !w.disabled && (x(u) === 7 ? w.callback(s.value, G.value) : w.callback(s.value))
|
|
950
|
-
}, P(w.text), 15,
|
|
951
|
+
}, P(w.text), 15, Jt))), 128)) : (d(), m(R, { key: 1 }, [
|
|
951
952
|
x(u) === 0 || x(u) === 7 ? (d(), m("a", {
|
|
952
953
|
key: 0,
|
|
953
954
|
class: "zan-layer-btn0",
|
|
954
|
-
onClick: z[1] || (z[1] = (w) =>
|
|
955
|
+
onClick: z[1] || (z[1] = (w) => je(s.value, G.value))
|
|
955
956
|
}, P(e.yesText), 1)) : p("", !0)
|
|
956
957
|
], 64))
|
|
957
958
|
], 2)) : p("", !0)
|
|
958
959
|
], 64))
|
|
959
960
|
], 4),
|
|
960
|
-
Ge.value ? (d(), m("span",
|
|
961
|
-
], 14,
|
|
961
|
+
Ge.value ? (d(), m("span", en)) : p("", !0)
|
|
962
|
+
], 14, Zt)) : p("", !0)
|
|
962
963
|
]),
|
|
963
964
|
_: 3
|
|
964
965
|
}, 8, ["enter-active-class", "leave-active-class"])
|
|
965
966
|
], 8, ["to", "disabled"]));
|
|
966
967
|
}
|
|
967
|
-
}), T = [],
|
|
968
|
+
}), T = [], tn = (e) => {
|
|
968
969
|
T.push(e);
|
|
969
970
|
}, fe = (e) => {
|
|
970
971
|
T.forEach((n, l) => {
|
|
971
972
|
n.modalContainer.id === e && T.splice(l, 1);
|
|
972
973
|
});
|
|
973
|
-
},
|
|
974
|
+
}, nn = () => {
|
|
974
975
|
T.splice(0, T.length);
|
|
975
976
|
}, K = (e) => {
|
|
976
977
|
let n = !1;
|
|
@@ -982,10 +983,10 @@ const qt = ["id"], Kt = {
|
|
|
982
983
|
return T.forEach((l, t) => {
|
|
983
984
|
l.modalContainer.id === e && (n = l);
|
|
984
985
|
}), n;
|
|
985
|
-
},
|
|
986
|
+
}, ln = (e, n) => (e && (n = Object.assign(n, e)), n), an = (e) => {
|
|
986
987
|
const n = document.createElement("div");
|
|
987
988
|
return n.id = e.id, document.body.appendChild(n), n;
|
|
988
|
-
},
|
|
989
|
+
}, on = (e) => typeof e == "function" ? Se(e()) ? { default: () => e() } : void 0 : Se(e) ? { default: () => e } : void 0, L = {
|
|
989
990
|
_context: null,
|
|
990
991
|
// 打开弹窗
|
|
991
992
|
open: (e) => {
|
|
@@ -1076,9 +1077,9 @@ const qt = ["id"], Kt = {
|
|
|
1076
1077
|
create: (e, n, l) => {
|
|
1077
1078
|
var o, s;
|
|
1078
1079
|
let t;
|
|
1079
|
-
const a =
|
|
1080
|
+
const a = ln(e, n);
|
|
1080
1081
|
a.hasOwnProperty("id") ? L.close(a.id) : a.id = Me();
|
|
1081
|
-
const i =
|
|
1082
|
+
const i = an(a), c = He(
|
|
1082
1083
|
ve,
|
|
1083
1084
|
{
|
|
1084
1085
|
...a,
|
|
@@ -1090,14 +1091,14 @@ const qt = ["id"], Kt = {
|
|
|
1090
1091
|
}, 500), fe(i.id);
|
|
1091
1092
|
}
|
|
1092
1093
|
},
|
|
1093
|
-
|
|
1094
|
+
on(a.content)
|
|
1094
1095
|
);
|
|
1095
1096
|
return c.appContext = a.appContext || L._context, Z(c, i), (s = (o = c.component) == null ? void 0 : o.exposed) == null || s.open(), n && n.time != null && n.time != 0 && (t = setTimeout(() => {
|
|
1096
1097
|
var f, r;
|
|
1097
1098
|
(r = (f = c.component) == null ? void 0 : f.exposed) == null || r.close(), l && l(i.id), setTimeout(() => {
|
|
1098
1099
|
Z(null, i), document.body.contains(i) && document.body.removeChild(i);
|
|
1099
1100
|
}, 500), fe(i.id);
|
|
1100
|
-
}, n.time)),
|
|
1101
|
+
}, n.time)), tn({ modalContainer: i, modalInstance: c }), i.id;
|
|
1101
1102
|
},
|
|
1102
1103
|
// 关闭弹窗
|
|
1103
1104
|
close: (e) => {
|
|
@@ -1117,7 +1118,7 @@ const qt = ["id"], Kt = {
|
|
|
1117
1118
|
(l = (n = e.modalInstance.component) == null ? void 0 : n.exposed) == null || l.close(), setTimeout(() => {
|
|
1118
1119
|
Z(null, e.modalContainer), document.body.contains(e.modalContainer) && document.body.removeChild(e.modalContainer);
|
|
1119
1120
|
}, 500);
|
|
1120
|
-
}),
|
|
1121
|
+
}), nn();
|
|
1121
1122
|
},
|
|
1122
1123
|
// 重置位置
|
|
1123
1124
|
reset: (e) => {
|
|
@@ -1139,12 +1140,12 @@ const qt = ["id"], Kt = {
|
|
|
1139
1140
|
var n, l;
|
|
1140
1141
|
e != null && K(e) && ((l = (n = J(e).modalInstance.component) == null ? void 0 : n.exposed) == null || l.revert());
|
|
1141
1142
|
}
|
|
1142
|
-
},
|
|
1143
|
-
L._context = e._context, e.component(ve.name, ve), e.config.globalProperties.$layer = L, n && typeof n.zIndex == "number" && e.provide(
|
|
1144
|
-
},
|
|
1143
|
+
}, sn = (e, n) => {
|
|
1144
|
+
L._context = e._context, e.component(ve.name, ve), e.config.globalProperties.$layer = L, n && typeof n.zIndex == "number" && e.provide(Gt, b(n.zIndex));
|
|
1145
|
+
}, rn = { install: sn };
|
|
1145
1146
|
export {
|
|
1146
1147
|
ve as ZanLayer,
|
|
1147
|
-
|
|
1148
|
+
rn as default,
|
|
1148
1149
|
L as layer,
|
|
1149
1150
|
L as zanLayer
|
|
1150
1151
|
};
|
package/lib/zan-layer.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(w,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(w=typeof globalThis<"u"?globalThis:w||self,t(w.ZanLayer={},w.Vue))})(this,function(w,t){"use strict";const fe=t.defineComponent({name:"Shade",__name:"Shade",props:{visible:{type:[Boolean,String]},opacity:{},index:{type:[Number,Function]},teleport:{},teleportDisabled:{type:Boolean},shadeStyle:{type:[Boolean,null,String,Object,Array]}},emits:["shadeClick"],setup(e,{emit:l}){const o=e,n=l,a=t.computed(()=>[{opacity:o.opacity,position:o.teleportDisabled||o.teleport!="body"?"absolute":"fixed",zIndex:o.index},o.shadeStyle]),r=()=>{n("shadeClick")};return(m,i)=>e.visible?(t.openBlock(),t.createElementBlock("div",{key:0,class:"zan-layer-shade",style:t.normalizeStyle(a.value),onClick:r},null,4)):t.createCommentVNode("",!0)}}),pe=["src"],ye=t.defineComponent({name:"Iframe",__name:"Iframe",props:{src:{}},setup(e){const l=e,o=t.computed(()=>l.src);return(n,a)=>(t.openBlock(),t.createElementBlock("iframe",{scrolling:"auto",class:"zan-layer-iframe",allowtransparency:"true",frameborder:"0",src:o.value},null,8,pe))}}),_=t.defineComponent({name:"ZanRender",__name:"Render",props:{render:{type:Function}},setup(e){const l=e;return(o,n)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.render())))}}),M=function(e){return typeof e=="function"?e():typeof e=="string"?t.h("span",e):e};function q(){const e=[],l="0123456789abcdef";for(let n=0;n<36;n++)e[n]=l.substr(Math.floor(Math.random()*16),1);return e[14]="4",e[19]=l.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").replaceAll("-","")}function he(e,l,o){return e!="drawer"||e!=4?ge(l):K(o,l)}function ge(e){return e===void 0||e==="auto"?[]:typeof e=="string"?[e]:e[1]&&e[1]==="auto"?e[0]&&e[0]==="auto"?[]:[e[0]]:e[0]&&e[0]==="auto"?e[1]&&e[1]!="auto"?[void 0,e[1]]:[]:[...e]}function K(e,l="30%"){return l instanceof Array?l:(l==="auto"&&(l="30%"),e==="l"||e==="r"||e==="lt"||e==="lb"||e==="rt"||e==="rb"?[l,"100%"]:e==="t"||e==="b"||e==="tr"||e==="tl"||e==="br"||e==="bl"?["100%",l]:[l,"100%"])}function X(e,l,o){const n=["t","r","b","l","lt","tl","lb","bl","rt","tr","rb","br"],a=[];return e==="auto"&&o==4&&(e="r"),typeof e=="string"?n.indexOf(e)>-1?(e==="t"&&(a[0]="0px",a[1]="calc(50% - "+l[0]+"/2)"),e==="l"&&(a[0]="calc(50% - "+l[1]+"/2)",a[1]="0px"),e==="b"&&(a[0]="calc(100% - "+l[1]+")",a[1]="calc(50% - "+l[0]+"/2)"),e==="r"&&(a[0]="calc(50% - "+l[1]+"/2)",a[1]="calc(100% - "+l[0]+")"),(e==="lt"||e==="tl")&&(a[0]="0px",a[1]="0px"),(e==="lb"||e==="bl")&&(a[0]="calc(100% - "+l[1]+")",a[1]="0px"),(e==="rt"||e==="tr")&&(a[0]="0px",a[1]="calc(100% - "+l[0]+")"),(e==="rb"||e==="br")&&(a[0]="calc(100% - "+l[1]+")",a[1]="calc(100% - "+l[0]+")")):e=="auto"?(a[0]="calc(50% - "+l[1]+"/2)",a[1]="calc(50% - "+l[0]+"/2)"):(a[0]=e,a[1]="calc(50% - "+l[0]+"/2)"):(a[0]=e[0],a[1]=e[1]),a}function xe(e){return e==="dialog"||e==0?0:e==="page"||e==1?1:e==="iframe"||e==2?2:e==="loading"||e==3?3:e==="drawer"||e==4?4:e==="photos"||e==5?5:e==="notify"||e==6?6:e==="prompt"||e==7?7:0}function J(){return{w:"100%",h:"100%"}}function ee(){return{t:"0px",l:"0px"}}function te(e){var n,a;const l=(n=getComputedStyle(e,null))==null?void 0:n.width,o=(a=getComputedStyle(e,null))==null?void 0:a.height;return[l,o]}const $=[];function H(e,l){let o=0;if(l){const n=$.findIndex(a=>a===void 0);n===-1?($.push(e),o=$.length-1):($[n]=e,o=n)}else delete $[$.findIndex(n=>n==e)],o=-1;return o}function ne(e,l=!1){const o=["rl"],n="zan-layer-drawer-anim zan-layer-anim";return e==="l"||e==="lt"||e==="lb"?o[0]="lr":e==="r"||e==="rt"||e==="rb"?o[0]="rl":e==="t"||e==="tr"||e==="tl"?o[0]="tb":(e==="b"||e==="br"||e==="bl")&&(o[0]="bt"),l?`${n}-${o[0]}-close`:`${n}-${o[0]}`}async function le(e,l){const o=new Image;return o.src=e,new Promise((a,r)=>{if(o.complete){a(n(o));return}const m=x.load(2,{shadeOpacity:"0"});o.onload=()=>{x.close(m),a(n(o))},o.onerror=()=>{x.close(m),x.msg("图片加载失败"),r(!1)}});function n(a){const r=[a.width,a.height],m=[window.innerWidth-250,window.innerHeight-250];if(r[0]>m[0]||r[1]>m[1]){const i=[r[0]/m[0],r[1]/m[1]];i[0]>i[1]?(r[0]=r[0]/i[0],r[1]=r[1]/i[0]):i[0]<i[1]&&(r[0]=r[0]/i[1],r[1]=r[1]/i[1])}return[r[0]+"px",r[1]+"px"]}}function Y(e,l){const o=document.getElementsByClassName(e);for(let n=0;n<o.length;n++){const a=o[n];if(a.id===l)return a}}function ke(e,l,o){const n=["lt","lb","rt","rb"];let a="0",r="0",i=15;window.NotifiyQueen=window.NotifiyQueen||[];const s=window.NotifiyQueen;(typeof e!="string"||n.indexOf(e)===-1)&&(e="rt");const u=s.filter(c=>{if(c.offset===e)return c});let d=u.length>0?u[u.length-1]:null;if(d)if(d=Y("zan-layer",d.id),e==="rt"||e==="lt")i+=d.offsetHeight+parseFloat(d.style.top);else{const c=parseFloat(d.style.top.split(" - ")[1]);i+=d.offsetHeight+c}else(e==="rb"||e==="lb")&&(i+=parseFloat(l[1]));return e==="rt"?(a=i+"px",r="calc(100% - "+(parseFloat(l[0])+15)+"px)"):e==="rb"?(a="calc(100% - "+i+"px)",r="calc(100% - "+(parseFloat(l[0])+15)+"px)"):e==="lt"?(a=i+"px",r="15px"):e==="lb"&&(a="calc(100% - "+i+"px)",r="15px"),s.push({id:o,offset:e}),[a,r]}function Be(e){const l=Y("zan-layer",e);if(!l)return;const o=15,n=l.offsetHeight;window.NotifiyQueen=window.NotifiyQueen||[];const a=window.NotifiyQueen,r=a.findIndex(d=>d.id===e),m=a[r].offset,i=a.filter(d=>{if(d.offset===m)return d}),s=i.findIndex(d=>d.id===e);i.slice(s+1).forEach(d=>{const c=Y("zan-layer",d.id);if(m==="rt"||m==="lt")c.style.top=parseFloat(c.style.top)-o-n+"px";else{const p=parseFloat(c.style.top.split(" - ")[1])-o-n;c.style.top="calc(100% - "+p+"px)"}}),a.splice(r,1)}function be(e){const l="zan-layer-drawer-anim zan-layer-anim";let o="";return e==="lt"||e==="lb"?o="lr":o="rl",`${l}-${o}`}const Ce=t.defineComponent({name:"Header",__name:"Header",props:{title:{type:[String,Object,Symbol,Function,Boolean]},titleStyle:{type:[String,Boolean,null,Object,Array]},move:{type:Boolean}},setup(e){const l=e,o=t.computed(()=>[l.move?"cursor: move":"",l.titleStyle]);return(n,a)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-title",style:t.normalizeStyle(o.value)},[t.renderSlot(n.$slots,"default",{},()=>[t.createVNode(_,{render:()=>t.unref(M)(e.title)},null,8,["render"])])],4))}}),ze=t.defineComponent({name:"Footer",__name:"Footer",props:{footer:{type:[String,Object,Symbol,Function,Boolean]},footerStyle:{type:[String,Boolean,null,Object,Array]}},setup(e){return(l,o)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-footer",style:t.normalizeStyle(e.footerStyle)},[t.renderSlot(l.$slots,"default",{},()=>[t.createVNode(_,{render:()=>t.unref(M)(e.footer)},null,8,["render"])])],4))}}),Ee={class:"zan-layer-setwin"},Se={class:"zan-tooltip"},we={class:"zan-tooltip"},Ne=((e,l)=>{const o=e.__vccOpts||e;for(const[n,a]of l)o[n]=a;return o})(t.defineComponent({name:"HeaderBtn",__name:"HeaderBtn",props:{maxmin:{type:Boolean},min:{type:Boolean},max:{type:Boolean},closeBtn:{type:[String,Boolean],default:"1"}},emits:["onMin","onMax","onClose"],setup(e,{emit:l}){const o=e,n=l,a=()=>{n("onMin")},r=()=>{n("onMax")},m=()=>{n("onClose")};return(i,s)=>(t.openBlock(),t.createElementBlock("span",Ee,[o.maxmin&&!o.max?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(["zan-icon-btn",o.min?"zan-icon-full":"zan-icon-min"]),onClick:t.withModifiers(a,["stop"])},[t.createElementVNode("span",Se,t.toDisplayString(o.min?"还原":"最小化"),1)],2)):t.createCommentVNode("",!0),o.maxmin&&!o.min?(t.openBlock(),t.createElementBlock("i",{key:1,class:t.normalizeClass(["zan-icon-btn",o.max?"zan-icon-restore":"zan-icon-max"]),onClick:t.withModifiers(r,["stop"])},[t.createElementVNode("span",we,t.toDisplayString(o.max?"还原":"最大化"),1)],2)):t.createCommentVNode("",!0),o.closeBtn?(t.openBlock(),t.createElementBlock("i",{key:2,class:t.normalizeClass(["zan-icon-btn zan-icon-close-btn",`zan-layer-close${e.closeBtn}`]),onClick:t.withModifiers(m,["stop"])},[...s[0]||(s[0]=[t.createElementVNode("span",{class:"zan-tooltip"},"关闭",-1)])],2)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-8d683fcb"]]),Ve={class:"zan-layer-phimg"},Le=["src"],$e={key:0,class:"zan-layer-imgsee"},ve={key:0,class:"zan-layer-imguide"},Ie={key:0,class:"thumb-row"},Fe=["onClick"],Oe=["src"],Me={key:1,class:"zan-layer-imgtit"},He={key:0},De={key:1},Te=t.defineComponent({name:"Photos",__name:"Photos",props:{imgList:{},startIndex:{default:0}},emits:["resetCalculationPohtosArea"],setup(e,{emit:l}){const o=l,n=e,a=t.ref(n.startIndex);t.watch(a,()=>{o("resetCalculationPohtosArea",a.value)});const r=s=>{let d=a.value+s;d<0&&(d=n.imgList.length-1),d>=n.imgList.length&&(d=0),a.value=d},m=t.ref(!1);t.onMounted(()=>{t.nextTick(()=>{setTimeout(()=>{m.value=!0},400)})});const i=t.computed(()=>{let s=!1;return n.imgList.forEach(u=>{u.thumb&&(s=!0)}),s});return(s,u)=>(t.openBlock(),t.createElementBlock("div",Ve,[t.createElementVNode("img",{src:e.imgList[a.value].src},null,8,Le),e.imgList.length>0?(t.openBlock(),t.createElementBlock("div",$e,[e.imgList.length>1?(t.openBlock(),t.createElementBlock("span",ve,[t.createElementVNode("a",{href:"javascript:;",class:"zan-layer-iconext zan-layer-imgprev",onClick:u[0]||(u[0]=d=>r(-1))},"‹"),t.createElementVNode("a",{href:"javascript:;",class:"zan-layer-iconext zan-layer-imgnext",onClick:u[1]||(u[1]=d=>r(1))},"›")])):t.createCommentVNode("",!0),e.imgList.length>1||e.imgList[a.value].alt?(t.openBlock(),t.createElementBlock("div",{key:1,class:"zan-layer-imgbar",style:t.normalizeStyle({opacity:m.value?1:0})},[i.value?(t.openBlock(),t.createElementBlock("div",Ie,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.imgList,(d,c)=>(t.openBlock(),t.createElementBlock("div",{class:"thumb-box",key:"thumb-box"+c,onClick:p=>a.value=c},[t.createElementVNode("img",{src:d.thumb},null,8,Oe)],8,Fe))),128)),t.createElementVNode("div",{class:"thumb-box-border",style:t.normalizeStyle({left:`calc(calc( calc(100% - ${100*e.imgList.length}px) / 2) + ${a.value*100}px)`})},null,4)])):(t.openBlock(),t.createElementBlock("span",Me,[e.imgList[a.value].alt?(t.openBlock(),t.createElementBlock("span",He,t.toDisplayString(e.imgList[a.value].alt),1)):t.createCommentVNode("",!0),e.imgList.length>1?(t.openBlock(),t.createElementBlock("em",De,t.toDisplayString(a.value+1)+" / "+t.toDisplayString(e.imgList.length),1)):t.createCommentVNode("",!0)]))],4)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]))}}),Ae={class:"title"},Pe={key:0,class:"content"},_e=["innerHTML"],je=t.defineComponent({name:"Notifiy",__name:"Notifiy",props:{title:{},content:{},isHtmlFragment:{type:Boolean,default:!1},icon:{},iconClass:{}},emits:["close"],setup(e,{emit:l}){const o=e,n=l,a=t.shallowRef(null),r=()=>{n("close")};function m(i,s){let u=i.className,d=u!=""?" ":"",c=u+d+s;i.className=c}return t.onMounted(()=>{t.nextTick(()=>{setTimeout(()=>{var i,s,u,d;(s=(i=a.value)==null?void 0:i.parentElement)!=null&&s.parentElement&&m((d=(u=a.value)==null?void 0:u.parentElement)==null?void 0:d.parentElement,"zan-layer-notifiy-transition")},300)})}),(i,s)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-notifiy-wrapper",ref_key:"notifyRef",ref:a},[t.createElementVNode("h2",Ae,[e.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(e.iconClass)},null,2)):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString(e.title),1)]),!e.isHtmlFragment&&e.content?(t.openBlock(),t.createElementBlock("div",Pe,[t.createVNode(_,{render:()=>t.unref(M)(o.content)},null,8,["render"])])):e.isHtmlFragment&&e.content?(t.openBlock(),t.createElementBlock("div",{key:1,class:"content",innerHTML:e.content},null,8,_e)):t.createCommentVNode("",!0),t.createElementVNode("i",{class:"zan-icon-close",onClick:r},[...s[0]||(s[0]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16"},[t.createElementVNode("path",{d:"M810.666667 273.493333L750.506667 213.333333 512 451.84 273.493333 213.333333 213.333333 273.493333 451.84 512 213.333333 750.506667 273.493333 810.666667 512 572.16 750.506667 810.666667 810.666667 750.506667 572.16 512z",fill:"currentColor"})],-1)])])],512))}}),Re=["maxlength","placeholder"],We=["type","placeholder"],Xe=t.defineComponent({name:"Prompt",__name:"Prompt",props:{promptValue:{},formType:{default:"text"},maxLength:{},placeholder:{default:""}},emits:["update:promptValue"],setup(e,{emit:l}){const o=e,n=t.ref(o.promptValue),a=t.computed(()=>{switch(typeof o.formType){case"string":return o.formType==="textarea";case"number":return o.formType===2;default:return!1}}),r=t.computed(()=>o.formType==1||o.formType=="password");return(m,i)=>a.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:0,onInput:i[0]||(i[0]=s=>m.$emit("update:promptValue",n.value)),"onUpdate:modelValue":i[1]||(i[1]=s=>n.value=s),maxlength:o.maxLength,placeholder:o.placeholder,class:"zan-textarea"},null,40,Re)),[[t.vModelText,n.value]]):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,onInput:i[2]||(i[2]=s=>m.$emit("update:promptValue",n.value)),"onUpdate:modelValue":i[3]||(i[3]=s=>n.value=s),type:r.value?"password":"text",placeholder:o.placeholder,class:"zan-input"},null,40,We)),[[t.vModelDynamic,n.value]])}});function Ye(e){for(;e&&e.parentNode;)if(e=e.parentNode,e&&getComputedStyle(e).position==="relative")return e;return null}const j=e=>{document.querySelectorAll(".zan-layer iframe").forEach(o=>{o.style.pointerEvents=e})},Qe=function(e,l,o,n,a){let r,m,i=0,s=0,u=!0;e!=null&&e.addEventListener("mousedown",function(d){if((d.composedPath&&d.composedPath()||d.path)[0].className==="zan-layer-title"&&d.button==0&&e!=null){j("none");const p=getComputedStyle(e);r=d.pageX-e.offsetLeft+parseInt(p["margin-left"]),m=d.pageY-e.offsetTop+parseInt(p["margin-right"]),i=d.clientX,s=d.clientY,document.body.style.userSelect="none",document.body.style.cursor="move";const z=function(k){if(e!=null){(k.clientX-i!=0||k.clientY-s!=0)&&u&&(u=!1,a());let y=k.pageX-r,h=k.pageY-m;const b=document.documentElement.clientWidth,C=document.documentElement.clientHeight;if(!l){let E=b-e.offsetWidth,S=C-e.offsetHeight;if(e.style.position==="absolute"){const V=Ye(e);V!=null&&(E=V.clientWidth-e.offsetWidth,S=V.clientHeight-e.offsetHeight)}y<0?y=0:y>E&&(y=E),h<0?h=0:h>S&&(h=S)}e.style.top=h+"px",e.style.left=y+"px",o(e.style.left,e.style.top)}return!1},N=function(){u=!0,document.body.style.userSelect="",document.body.style.cursor="",n(),j("auto"),document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",z,{passive:!1}),document.addEventListener("mouseup",N)}return!1})},Ge=function(e,l,o,n){let a=0,r=0,m=!0;e!=null&&e.addEventListener("mousedown",function(i){if((i.composedPath&&i.composedPath()||i.path)[0].className==="zan-layer-resize"&&i.button==0&&e!=null){j("none");const u=e.getBoundingClientRect(),d=u.left,c=u.top;a=i.clientX,r=i.clientY,document.body.style.userSelect="none",document.body.style.cursor="se-resize";const p=function(N){var k;if(window.getSelection!=null&&((k=window.getSelection())==null||k.removeAllRanges()),e!=null){const y=N.clientX,h=N.clientY;(y-a!=0||h-r!=0)&&m&&(m=!1,n());let b=y-d,C=h-c;b<260&&(b=260),C<115&&(C=115),e.style.width=b+"px",e.style.height=C+"px",l(e.style.width,e.style.height)}return!1};document.addEventListener("mousemove",p,{passive:!1});const z=function(){m=!0,document.body.style.userSelect="",document.body.style.cursor="",o(),j("auto"),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",z)};document.addEventListener("mouseup",z)}return!1})},Ze=Symbol("zIndex");let Ue=99999;function oe(){return++Ue}const qe=["id"],Ke={key:1,class:"slot-fragment"},Je=["innerHTML"],et=["onClick"],tt={key:2,class:"zan-layer-resize"},R=t.defineComponent({name:"ZanLayer",__name:"ZanLayer",props:{modelValue:{type:Boolean,default:!1},type:{default:1},title:{type:[String,Object,Symbol,Function,Boolean],default:"标题"},footer:{type:[String,Object,Symbol,Function,Boolean]},titleStyle:{type:[String,Boolean,null,Object,Array],default:""},footerStyle:{type:[String,Boolean,null,Object,Array]},content:{},isHtmlFragment:{type:Boolean,default:!1},offset:{default:()=>"auto"},area:{default:()=>"auto"},move:{type:Boolean,default:!0},maxmin:{type:Boolean,default:!1},resize:{type:Boolean,default:!1},shade:{type:Boolean,default:!0},shadeClose:{type:Boolean,default:!0},shadeStyle:{type:[Boolean,null,String,Object,Array]},shadeOpacity:{default:"0.1"},layerClasses:{},zIndex:{},closeBtn:{type:[Boolean,String],default:"1"},btn:{},btnAlign:{default:"r"},anim:{default:0},isOutAnim:{type:Boolean,default:!0},icon:{},imgList:{default:()=>[]},startIndex:{default:0},animDuration:{default:"0.3s"},moveOut:{type:Boolean,default:!1},teleport:{default:"body"},teleportDisabled:{type:Boolean,default:!1},lastPosition:{type:Boolean,default:!0},time:{default:0},load:{default:0},yesText:{default:"确定"},formType:{default:"text"},value:{default:""},maxLength:{},placeholder:{default:"请输入内容"},isMessage:{type:Boolean,default:!1},id:{},isFunction:{type:Boolean,default:!1},appContext:{},success:{type:Function,default:()=>{}},end:{type:Function,default:()=>{}},yes:{},beforeClose:{type:Function,default:()=>!0},close:{type:Function,default:()=>{}},min:{type:Function,default:()=>{}},full:{type:Function,default:()=>{}},revert:{type:Function,default:()=>{}},moveStart:{type:Function,default:()=>{}},moving:{type:Function,default:()=>{}},moveEnd:{type:Function,default:()=>{}},resizeStart:{type:Function,default:()=>{}},resizing:{type:Function,default:()=>{}},resizeEnd:{type:Function,default:()=>{}},internalDestroy:{}},emits:["close","update:modelValue"],setup(e,{expose:l,emit:o}){const n=e,a=o,r=t.useSlots(),m=t.ref(!1),i=t.ref(!1),s=t.ref(n.id||q()),u=t.ref(null),d=t.ref(),c=xe(n.type),p=t.ref(he(n.type,n.area,n.offset)),z=t.ref(X(n.offset,p.value,c)),N=t.ref(99999),k=t.ref(!1),y=t.ref(p.value[0]),h=t.ref(p.value[1]),b=t.ref(z.value[0]),C=t.ref(z.value[1]),E=t.ref(""),S=t.ref(""),V=t.ref(""),v=t.ref(""),A=t.ref(n.value);t.watch(()=>n.value,()=>{A.value=n.value});const ae=()=>{N.value=n.zIndex??oe()};t.watch(()=>n.zIndex,()=>{ae()},{immediate:!0});const ie=function(){t.nextTick(async()=>{c==4&&(p.value=K(n.offset,n.area)),c==5&&(p.value=await le(n.imgList[n.startIndex].src));let f=p.value;(f[0]==null||f[1]==null)&&(f=te(u.value)),c==6&&(z.value=ke(n.offset,f,s.value)),P(),ue(),dt()})},rt=function(){i.value&&de(),m.value&&re(),E.value="",S.value="",V.value="",v.value=""},se=()=>{V.value=b.value,v.value=C.value,E.value=y.value,S.value=h.value,y.value=J().w,h.value=J().h,b.value=ee().t,C.value=ee().l},re=()=>{m.value?(F(),y.value=E.value,h.value=S.value,n.revert(s.value)):(O(),se(),n.full(s.value)),m.value=!m.value},ce=()=>{let U=10+190*H(s.value,!0);const Vt=document.documentElement.clientWidth;U+180>Vt&&(U=10),E.value=y.value,S.value=h.value,V.value=b.value,v.value=C.value,h.value="51px",y.value="180px",b.value="calc(100% - 51px)",C.value=U+"px"},de=async()=>{i.value?(F(),H(s.value,!1),y.value=E.value,h.value=S.value,n.revert(s.value)):(O(),ce(),n.min(s.value)),i.value=!i.value};t.watch(()=>n.modelValue,()=>{k.value=n.modelValue,k.value?(ie(),ae()):rt()},{deep:!0,immediate:!0}),t.watch(()=>k.value,()=>{k.value&&(n.isFunction&&ie(),t.nextTick(()=>{n.success(s.value)}))},{immediate:!0,flush:"post"}),t.watch(()=>k.value,()=>{k.value||n.end(s.value)});const ct=t.computed(()=>[{"zan-layer-dialog":c===0||c===7,"zan-layer-page":c===1,"zan-layer-iframe":c===2,"zan-layer-loading":c===3,"zan-layer-drawer":c===4,"zan-layer-photos":c===5,"zan-layer-notifiy":c===6,"zan-layer-msg":n.isMessage,"zan-layer-hui":n.isMessage&&!n.icon},n.layerClasses]),dt=function(){n.move&&c!=4&&t.nextTick(()=>{u.value&&(Qe(u.value,n.moveOut,(f,g)=>{C.value=f,b.value=g,i.value||(v.value=f,V.value=g),n.moving(s.value,{top:g,left:f})},()=>{const f={left:C.value,top:b.value,isMin:i.value,isMax:m.value},[g,B]=n.moveEnd(s.value,f)||[];B&&g&&(C.value=g,b.value=B)},()=>{n.moveStart(s.value)}),Ge(u.value,(f,g)=>{h.value=g,y.value=f,S.value=g,E.value=f,n.resizing(s.value,{width:f,height:g})},()=>{const f={width:y.value,height:h.value},[g,B]=n.resizeEnd(s.value,f)||[];g&&B&&(y.value=g,h.value=B)},()=>{n.resizeStart(s.value)}))})},mt=t.computed(()=>({position:n.teleportDisabled||n.teleport!="body"?"absolute":"fixed",top:b.value,left:C.value,height:h.value,width:y.value,animationDuration:n.animDuration,zIndex:N.value})),ut=t.computed(()=>[c===3?`zan-layer-loading${n.load}`:"",n.icon?"zan-layer-padding":""]),W=()=>{if(typeof n.beforeClose=="function"){const f=n.beforeClose(s.value);(f===void 0||f!=null&&f===!0)&&(n.close(s.value),a("close"),a("update:modelValue",!1),n.internalDestroy&&n.internalDestroy(),i.value&&H(s.value,!i.value))}},ft=(...f)=>{typeof n.yes=="function"?n.yes(...f):W()},pt=()=>{n.shadeClose&&W()},me=t.computed(()=>["zan-icon",`zan-icon-ico${n.icon}`]),yt=t.computed(()=>c===4?ne(n.offset):c===6?be(n.offset):`zan-layer-anim-0${n.anim}`),ht=t.computed(()=>c===4?ne(n.offset,!0):n.isOutAnim?"zan-layer-anim-close":""),gt=()=>{k.value=!0},xt=()=>{k.value=!1,c===6&&Be(s.value)},kt=t.computed(()=>k.value&&n.shade&&!i.value),Bt=t.computed(()=>n.resize&&!m.value&&!i.value),bt=t.computed(()=>n.title&&c!=3&&c!=5&&c!=6),Ct=function(f){t.nextTick(async()=>{p.value=await le(n.imgList[f].src),z.value=X(n.offset,p.value,c),y.value=p.value[0],h.value=p.value[1],b.value=z.value[0],C.value=z.value[1],E.value=p.value[0],S.value=p.value[1]})},zt=function(){n.zIndex||(N.value=oe())};t.onMounted(()=>{F()}),t.onUnmounted(()=>{O()}),t.watch(()=>n.modelValue,()=>{n.modelValue?F():O()});let I;const F=function(){t.nextTick(()=>{d.value&&!I&&c!=6&&(I=new ResizeObserver(f=>{u.value&&(z.value=X(n.offset,te(u.value),c),P(!0))}),I.observe(d.value))})},O=function(){I&&d.value&&(I.unobserve(d.value),I=void 0)},P=function(f=!1){b.value=f&&n.lastPosition&&V.value||z.value[0],C.value=f&&n.lastPosition&&v.value||z.value[1]},ue=function(){y.value=p.value[0],h.value=p.value[1],E.value=p.value[0],S.value=p.value[1]},Et=function(){F(),H(s.value,!1),i.value=!1,m.value=!1,V.value="",v.value="",P(),ue(),n.modelValue||a("update:modelValue",!0)},St=async function(){i.value&&(G(),P(!0)),m.value||(await t.nextTick(),O(),se(),m.value=!0)},wt=async function(){m.value&&(G(),P(!0)),i.value||(await t.nextTick(),O(),ce(),i.value=!0)},G=()=>{F(),H(s.value,!1),i.value=!1,m.value=!1,y.value=E.value,h.value=S.value};return l({reset:Et,open:gt,close:xt,full:St,min:wt,revert:G}),(f,g)=>(t.openBlock(),t.createBlock(t.Teleport,{to:e.teleport,disabled:e.teleportDisabled},[t.createVNode(fe,{index:N.value,"shade-style":e.shadeStyle,visible:kt.value,opacity:e.shadeOpacity,teleport:e.teleport,teleportDisabled:e.teleportDisabled,onShadeClick:pt},null,8,["index","shade-style","visible","opacity","teleport","teleportDisabled"]),t.createVNode(t.Transition,{"enter-active-class":yt.value,"leave-active-class":ht.value},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"layerRef",ref:u,class:t.normalizeClass(["zan-layer zan-layer-border",[ct.value,{"zan-layer-min":i.value}]]),id:s.value,style:t.normalizeStyle(mt.value)},[bt.value?(t.openBlock(),t.createBlock(Ce,{key:0,title:e.title,titleStyle:e.titleStyle,move:e.move,onMousedown:zt},{default:t.withCtx(()=>[t.renderSlot(f.$slots,"title")]),_:3},8,["title","titleStyle","move"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"contentRef",ref:d,class:t.normalizeClass(["zan-layer-content",ut.value]),style:t.normalizeStyle(i.value===!0?"display:none":"")},[t.unref(c)===0||t.unref(c)===1||t.unref(c)===4?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(me.value)},null,2)):t.createCommentVNode("",!0),t.unref(r).default?(t.openBlock(),t.createElementBlock("div",Ke,[t.renderSlot(f.$slots,"default")])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.isHtmlFragment?(t.openBlock(),t.createElementBlock("div",{key:0,class:"html-fragment",innerHTML:t.unref(M)(n.content)},null,8,Je)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[n.content?(t.openBlock(),t.createBlock(_,{key:0,render:()=>t.unref(M)(n.content)},null,8,["render"])):t.createCommentVNode("",!0)],64))],64))],64)):t.createCommentVNode("",!0),t.unref(c)===7?(t.openBlock(),t.createBlock(Xe,{key:1,"prompt-value":A.value,"onUpdate:promptValue":g[0]||(g[0]=B=>A.value=B),formType:n.formType,maxLength:n.maxLength,placeholder:n.placeholder},null,8,["prompt-value","formType","maxLength","placeholder"])):t.createCommentVNode("",!0),t.unref(c)===2?(t.openBlock(),t.createBlock(ye,{key:2,src:n.content},null,8,["src"])):t.createCommentVNode("",!0),t.unref(c)===5?(t.openBlock(),t.createBlock(Te,{key:3,imgList:n.imgList,startIndex:n.startIndex,onResetCalculationPohtosArea:Ct},null,8,["imgList","startIndex"])):t.createCommentVNode("",!0),t.unref(c)===6?(t.openBlock(),t.createBlock(je,{key:4,onClose:W,title:n.title,content:n.content,isHtmlFragment:n.isHtmlFragment,icon:n.icon,iconClass:me.value},null,8,["title","content","isHtmlFragment","icon","iconClass"])):t.createCommentVNode("",!0)],6),t.unref(c)!=3&&t.unref(c)!=5&&t.unref(c)!=6?(t.openBlock(),t.createBlock(Ne,{key:1,maxmin:e.maxmin,max:m.value,min:i.value,closeBtn:e.closeBtn,onOnMin:de,onOnMax:re,onOnClose:W},null,8,["maxmin","max","min","closeBtn"])):t.createCommentVNode("",!0),t.createElementVNode("div",{style:t.normalizeStyle(i.value===!0?"display:none":"")},[t.unref(r).footer||n.footer?(t.openBlock(),t.createBlock(ze,{key:0,footer:n.footer,footerStyle:n.footerStyle},{default:t.withCtx(()=>[t.renderSlot(f.$slots,"footer")]),_:3},8,["footer","footerStyle"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[(e.btn&&e.btn.length>0||t.unref(c)===0||t.unref(c)===7)&&!e.isMessage?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["zan-layer-btn",[`zan-layer-btn-${e.btnAlign}`]])},[e.btn&&e.btn.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(e.btn,(B,Z)=>(t.openBlock(),t.createElementBlock("a",{key:Z,style:t.normalizeStyle(B.style),class:t.normalizeClass([B.class,`zan-layer-btn${Z}`,{"zan-layer-btn-disabled":B.disabled}]),onClick:Nt=>!B.disabled&&(t.unref(c)===7?B.callback(s.value,A.value):B.callback(s.value))},t.toDisplayString(B.text),15,et))),128)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.unref(c)===0||t.unref(c)===7?(t.openBlock(),t.createElementBlock("a",{key:0,class:"zan-layer-btn0",onClick:g[1]||(g[1]=B=>ft(s.value,A.value))},t.toDisplayString(e.yesText),1)):t.createCommentVNode("",!0)],64))],2)):t.createCommentVNode("",!0)],64))],4),Bt.value?(t.openBlock(),t.createElementBlock("span",tt)):t.createCommentVNode("",!0)],14,qe)):t.createCommentVNode("",!0)]),_:3},8,["enter-active-class","leave-active-class"])],8,["to","disabled"]))}}),L=[],nt=e=>{L.push(e)},Q=e=>{L.forEach((l,o)=>{l.modalContainer.id===e&&L.splice(o,1)})},lt=()=>{L.splice(0,L.length)},D=e=>{let l=!1;return L.forEach((o,n)=>{o.modalContainer.id==e&&(l=!0)}),l},T=e=>{let l=null;return L.forEach((o,n)=>{o.modalContainer.id===e&&(l=o)}),l},ot=(e,l)=>(e&&(l=Object.assign(l,e)),l),at=e=>{const l=document.createElement("div");return l.id=e.id,document.body.appendChild(l),l},it=e=>typeof e=="function"?t.isVNode(e())?{default:()=>e()}:void 0:t.isVNode(e)?{default:()=>e}:void 0,x={_context:null,open:e=>{const l={};return x.create(e,l)},drawer:e=>{const l={type:"drawer"};return x.create(e,l)},msg:(e,l={},o)=>{const n={type:0,title:!1,content:e,shadeClose:!1,closeBtn:!1,isMessage:!0,shade:!1,btn:void 0,time:2e3};return x.create(l,n,o)},load:(e=0,l={})=>{const o={type:3,load:e,anim:5,isOutAnim:!1,shadeClose:!1,shade:!0,shadeOpacity:"0.3"};return x.create(l,o)},confirm:(e,l={})=>{const o={type:0,content:e,shadeClose:!1};return x.create(l,o)},notify:(e,l)=>{e.type=6;const o={offset:"rt",time:3e3,area:"auto",shade:!1};return x.create(e,o,l)},photos:e=>{typeof e=="string"&&(e={imgList:[{src:e}]});const l={type:5,anim:2,startIndex:0,isOutAnim:!0,shadeClose:!0,shadeOpacity:"0.2"};return x.create(e,l)},prompt:e=>{e.type=7;const l={type:"prompt",shadeClose:!1,shadeOpacity:"0.2"};return x.create(e,l)},create:(e,l,o)=>{var i,s;let n;const a=ot(e,l);a.hasOwnProperty("id")?x.close(a.id):a.id=q();const r=at(a),m=t.h(R,{...a,isFunction:!0,internalDestroy(){var u,d;n&&clearTimeout(n),(d=(u=m.component)==null?void 0:u.exposed)==null||d.close(),setTimeout(()=>{t.render(null,r),document.body.contains(r)&&document.body.removeChild(r)},500),Q(r.id)}},it(a.content));return m.appContext=a.appContext||x._context,t.render(m,r),(s=(i=m.component)==null?void 0:i.exposed)==null||s.open(),l&&l.time!=null&&l.time!=0&&(n=setTimeout(()=>{var u,d;(d=(u=m.component)==null?void 0:u.exposed)==null||d.close(),o&&o(r.id),setTimeout(()=>{t.render(null,r),document.body.contains(r)&&document.body.removeChild(r)},500),Q(r.id)},l.time)),nt({modalContainer:r,modalInstance:m}),r.id},close:e=>{var l,o;if(e!=null&&D(e)){const n=T(e);(o=(l=n.modalInstance.component)==null?void 0:l.exposed)==null||o.close(),setTimeout(()=>{t.render(null,n.modalContainer),document.body.contains(n.modalContainer)&&document.body.removeChild(n.modalContainer)},500)}Q(e)},closeAll:()=>{L.forEach(e=>{var l,o;(o=(l=e.modalInstance.component)==null?void 0:l.exposed)==null||o.close(),setTimeout(()=>{t.render(null,e.modalContainer),document.body.contains(e.modalContainer)&&document.body.removeChild(e.modalContainer)},500)}),lt()},reset:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.reset())},min:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.min())},full:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.full())},revert:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.revert())}},st={install:(e,l)=>{x._context=e._context,e.component(R.name,R),e.config.globalProperties.$layer=x,l&&typeof l.zIndex=="number"&&e.provide(Ze,t.ref(l.zIndex))}};w.ZanLayer=R,w.default=st,w.layer=x,w.zanLayer=x,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(w,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(w=typeof globalThis<"u"?globalThis:w||self,t(w.ZanLayer={},w.Vue))})(this,function(w,t){"use strict";const fe=t.defineComponent({name:"Shade",__name:"Shade",props:{visible:{type:[Boolean,String]},opacity:{},index:{type:[Number,Function]},teleport:{},teleportDisabled:{type:Boolean},shadeStyle:{type:[Boolean,null,String,Object,Array]}},emits:["shadeClick"],setup(e,{emit:l}){const o=e,n=l,a=t.computed(()=>[{opacity:o.opacity,position:o.teleportDisabled||o.teleport!="body"?"absolute":"fixed",zIndex:o.index},o.shadeStyle]),r=()=>{n("shadeClick")};return(m,i)=>e.visible?(t.openBlock(),t.createElementBlock("div",{key:0,class:"zan-layer-shade",style:t.normalizeStyle(a.value),onClick:r},null,4)):t.createCommentVNode("",!0)}}),pe=["src"],ye=t.defineComponent({name:"Iframe",__name:"Iframe",props:{src:{}},setup(e){const l=e,o=t.computed(()=>l.src);return(n,a)=>(t.openBlock(),t.createElementBlock("iframe",{scrolling:"auto",class:"zan-layer-iframe",allowtransparency:"true",frameborder:"0",src:o.value},null,8,pe))}}),_=t.defineComponent({name:"ZanRender",props:{render:{type:Function,required:!0}},setup(e){return()=>e.render()}}),M=function(e){return typeof e=="function"?e():typeof e=="string"?t.h("span",e):e};function q(){const e=[],l="0123456789abcdef";for(let n=0;n<36;n++)e[n]=l.substr(Math.floor(Math.random()*16),1);return e[14]="4",e[19]=l.substr(e[19]&3|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("").replaceAll("-","")}function he(e,l,o){return e!="drawer"&&e!=4?ge(l):K(o,l)}function ge(e){return e===void 0||e==="auto"?[]:typeof e=="string"?[e]:e[1]&&e[1]==="auto"?e[0]&&e[0]==="auto"?[]:[e[0]]:e[0]&&e[0]==="auto"?e[1]&&e[1]!="auto"?[void 0,e[1]]:[]:[...e]}function K(e,l="30%"){return l instanceof Array?l:(l==="auto"&&(l="30%"),e==="l"||e==="r"||e==="lt"||e==="lb"||e==="rt"||e==="rb"?[l,"100%"]:e==="t"||e==="b"||e==="tr"||e==="tl"||e==="br"||e==="bl"?["100%",l]:[l,"100%"])}function X(e="auto",l,o){const n=["t","r","b","l","lt","tl","lb","bl","rt","tr","rb","br"],a=[];return e==="auto"&&o==4&&(e="r"),typeof e=="string"?n.indexOf(e)>-1?(e==="t"&&(a[0]="0px",a[1]="calc(50% - "+l[0]+"/2)"),e==="l"&&(a[0]="calc(50% - "+l[1]+"/2)",a[1]="0px"),e==="b"&&(a[0]="calc(100% - "+l[1]+")",a[1]="calc(50% - "+l[0]+"/2)"),e==="r"&&(a[0]="calc(50% - "+l[1]+"/2)",a[1]="calc(100% - "+l[0]+")"),(e==="lt"||e==="tl")&&(a[0]="0px",a[1]="0px"),(e==="lb"||e==="bl")&&(a[0]="calc(100% - "+l[1]+")",a[1]="0px"),(e==="rt"||e==="tr")&&(a[0]="0px",a[1]="calc(100% - "+l[0]+")"),(e==="rb"||e==="br")&&(a[0]="calc(100% - "+l[1]+")",a[1]="calc(100% - "+l[0]+")")):e=="auto"?(a[0]="calc(50% - "+l[1]+"/2)",a[1]="calc(50% - "+l[0]+"/2)"):(a[0]=e,a[1]="calc(50% - "+l[0]+"/2)"):e&&e[0]!==void 0&&e[1]!==void 0?(a[0]=e[0],a[1]=e[1]):(a[0]="calc(50% - "+l[1]+"/2)",a[1]="calc(50% - "+l[0]+"/2)"),a}function xe(e){return e==="dialog"||e==0?0:e==="page"||e==1?1:e==="iframe"||e==2?2:e==="loading"||e==3?3:e==="drawer"||e==4?4:e==="photos"||e==5?5:e==="notify"||e==6?6:e==="prompt"||e==7?7:0}function J(){return{w:"100%",h:"100%"}}function ee(){return{t:"0px",l:"0px"}}function te(e){var n,a;const l=(n=getComputedStyle(e,null))==null?void 0:n.width,o=(a=getComputedStyle(e,null))==null?void 0:a.height;return[l,o]}const v=[];function H(e,l){let o=0;if(l){const n=v.findIndex(a=>a===void 0);n===-1?(v.push(e),o=v.length-1):(v[n]=e,o=n)}else delete v[v.findIndex(n=>n==e)],o=-1;return o}function ne(e,l=!1){const o=["rl"],n="zan-layer-drawer-anim zan-layer-anim";return e==="l"||e==="lt"||e==="lb"?o[0]="lr":e==="r"||e==="rt"||e==="rb"?o[0]="rl":e==="t"||e==="tr"||e==="tl"?o[0]="tb":(e==="b"||e==="br"||e==="bl")&&(o[0]="bt"),l?`${n}-${o[0]}-close`:`${n}-${o[0]}`}async function le(e,l){const o=new Image;return o.src=e,new Promise((a,r)=>{if(o.complete){a(n(o));return}const m=x.load(2,{shadeOpacity:"0"});o.onload=()=>{x.close(m),a(n(o))},o.onerror=()=>{x.close(m),x.msg("图片加载失败"),r(!1)}});function n(a){const r=[a.width,a.height],m=[window.innerWidth-250,window.innerHeight-250];if(r[0]>m[0]||r[1]>m[1]){const i=[r[0]/m[0],r[1]/m[1]];i[0]>i[1]?(r[0]=r[0]/i[0],r[1]=r[1]/i[0]):i[0]<i[1]&&(r[0]=r[0]/i[1],r[1]=r[1]/i[1])}return[r[0]+"px",r[1]+"px"]}}function Y(e,l){const o=document.getElementsByClassName(e);for(let n=0;n<o.length;n++){const a=o[n];if(a.id===l)return a}}function ke(e,l,o){const n=["lt","lb","rt","rb"];let a="0",r="0",i=15;window.NotifiyQueen=window.NotifiyQueen||[];const s=window.NotifiyQueen;(typeof e!="string"||n.indexOf(e)===-1)&&(e="rt");const u=s.filter(c=>{if(c.offset===e)return c});let d=u.length>0?u[u.length-1]:null;if(d)if(d=Y("zan-layer",d.id),e==="rt"||e==="lt")i+=d.offsetHeight+parseFloat(d.style.top);else{const c=parseFloat(d.style.top.split(" - ")[1]);i+=d.offsetHeight+c}else(e==="rb"||e==="lb")&&(i+=parseFloat(l[1]));return e==="rt"?(a=i+"px",r="calc(100% - "+(parseFloat(l[0])+15)+"px)"):e==="rb"?(a="calc(100% - "+i+"px)",r="calc(100% - "+(parseFloat(l[0])+15)+"px)"):e==="lt"?(a=i+"px",r="15px"):e==="lb"&&(a="calc(100% - "+i+"px)",r="15px"),s.push({id:o,offset:e}),[a,r]}function be(e){const l=Y("zan-layer",e);if(!l)return;const o=15,n=l.offsetHeight;window.NotifiyQueen=window.NotifiyQueen||[];const a=window.NotifiyQueen,r=a.findIndex(d=>d.id===e),m=a[r].offset,i=a.filter(d=>{if(d.offset===m)return d}),s=i.findIndex(d=>d.id===e);i.slice(s+1).forEach(d=>{const c=Y("zan-layer",d.id);if(m==="rt"||m==="lt")c.style.top=parseFloat(c.style.top)-o-n+"px";else{const p=parseFloat(c.style.top.split(" - ")[1])-o-n;c.style.top="calc(100% - "+p+"px)"}}),a.splice(r,1)}function Be(e){const l="zan-layer-drawer-anim zan-layer-anim";let o="";return e==="lt"||e==="lb"?o="lr":o="rl",`${l}-${o}`}const Ce=t.defineComponent({name:"Header",__name:"Header",props:{title:{type:[String,Object,Symbol,Function,Boolean]},titleStyle:{type:[String,Boolean,null,Object,Array]},move:{type:Boolean}},setup(e){const l=e,o=t.computed(()=>[l.move?"cursor: move":"",l.titleStyle]);return(n,a)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-title",style:t.normalizeStyle(o.value)},[t.renderSlot(n.$slots,"default",{},()=>[t.createVNode(_,{render:()=>t.unref(M)(e.title)},null,8,["render"])])],4))}}),ze=t.defineComponent({name:"Footer",__name:"Footer",props:{footer:{type:[String,Object,Symbol,Function,Boolean]},footerStyle:{type:[String,Boolean,null,Object,Array]}},setup(e){return(l,o)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-footer",style:t.normalizeStyle(e.footerStyle)},[t.renderSlot(l.$slots,"default",{},()=>[t.createVNode(_,{render:()=>t.unref(M)(e.footer)},null,8,["render"])])],4))}}),Ee={class:"zan-layer-setwin"},Se={class:"zan-tooltip"},we={class:"zan-tooltip"},Ne=((e,l)=>{const o=e.__vccOpts||e;for(const[n,a]of l)o[n]=a;return o})(t.defineComponent({name:"HeaderBtn",__name:"HeaderBtn",props:{maxmin:{type:Boolean},min:{type:Boolean},max:{type:Boolean},closeBtn:{type:[String,Boolean],default:"1"}},emits:["onMin","onMax","onClose"],setup(e,{emit:l}){const o=e,n=l,a=()=>{n("onMin")},r=()=>{n("onMax")},m=()=>{n("onClose")};return(i,s)=>(t.openBlock(),t.createElementBlock("span",Ee,[o.maxmin&&!o.max?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(["zan-icon-btn",o.min?"zan-icon-full":"zan-icon-min"]),onClick:t.withModifiers(a,["stop"])},[t.createElementVNode("span",Se,t.toDisplayString(o.min?"还原":"最小化"),1)],2)):t.createCommentVNode("",!0),o.maxmin&&!o.min?(t.openBlock(),t.createElementBlock("i",{key:1,class:t.normalizeClass(["zan-icon-btn",o.max?"zan-icon-restore":"zan-icon-max"]),onClick:t.withModifiers(r,["stop"])},[t.createElementVNode("span",we,t.toDisplayString(o.max?"还原":"最大化"),1)],2)):t.createCommentVNode("",!0),o.closeBtn?(t.openBlock(),t.createElementBlock("i",{key:2,class:t.normalizeClass(["zan-icon-btn zan-icon-close-btn",`zan-layer-close${e.closeBtn}`]),onClick:t.withModifiers(m,["stop"])},[...s[0]||(s[0]=[t.createElementVNode("span",{class:"zan-tooltip"},"关闭",-1)])],2)):t.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-8d683fcb"]]),Ve={class:"zan-layer-phimg"},Le=["src"],ve={key:0,class:"zan-layer-imgsee"},$e={key:0,class:"zan-layer-imguide"},Ie={key:0,class:"thumb-row"},Fe=["onClick"],Oe=["src"],Me={key:1,class:"zan-layer-imgtit"},He={key:0},De={key:1},Te=t.defineComponent({name:"Photos",__name:"Photos",props:{imgList:{},startIndex:{default:0}},emits:["resetCalculationPohtosArea"],setup(e,{emit:l}){const o=l,n=e,a=t.ref(n.startIndex);t.watch(a,()=>{o("resetCalculationPohtosArea",a.value)});const r=s=>{let d=a.value+s;d<0&&(d=n.imgList.length-1),d>=n.imgList.length&&(d=0),a.value=d},m=t.ref(!1);t.onMounted(()=>{t.nextTick(()=>{setTimeout(()=>{m.value=!0},400)})});const i=t.computed(()=>{let s=!1;return n.imgList.forEach(u=>{u.thumb&&(s=!0)}),s});return(s,u)=>(t.openBlock(),t.createElementBlock("div",Ve,[t.createElementVNode("img",{src:e.imgList[a.value].src},null,8,Le),e.imgList.length>0?(t.openBlock(),t.createElementBlock("div",ve,[e.imgList.length>1?(t.openBlock(),t.createElementBlock("span",$e,[t.createElementVNode("a",{href:"javascript:;",class:"zan-layer-iconext zan-layer-imgprev",onClick:u[0]||(u[0]=d=>r(-1))},"‹"),t.createElementVNode("a",{href:"javascript:;",class:"zan-layer-iconext zan-layer-imgnext",onClick:u[1]||(u[1]=d=>r(1))},"›")])):t.createCommentVNode("",!0),e.imgList.length>1||e.imgList[a.value].alt?(t.openBlock(),t.createElementBlock("div",{key:1,class:"zan-layer-imgbar",style:t.normalizeStyle({opacity:m.value?1:0})},[i.value?(t.openBlock(),t.createElementBlock("div",Ie,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.imgList,(d,c)=>(t.openBlock(),t.createElementBlock("div",{class:"thumb-box",key:"thumb-box"+c,onClick:p=>a.value=c},[t.createElementVNode("img",{src:d.thumb},null,8,Oe)],8,Fe))),128)),t.createElementVNode("div",{class:"thumb-box-border",style:t.normalizeStyle({left:`calc(calc( calc(100% - ${100*e.imgList.length}px) / 2) + ${a.value*100}px)`})},null,4)])):(t.openBlock(),t.createElementBlock("span",Me,[e.imgList[a.value].alt?(t.openBlock(),t.createElementBlock("span",He,t.toDisplayString(e.imgList[a.value].alt),1)):t.createCommentVNode("",!0),e.imgList.length>1?(t.openBlock(),t.createElementBlock("em",De,t.toDisplayString(a.value+1)+" / "+t.toDisplayString(e.imgList.length),1)):t.createCommentVNode("",!0)]))],4)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]))}}),Ae={class:"title"},Pe={key:0,class:"content"},_e=["innerHTML"],je=t.defineComponent({name:"Notifiy",__name:"Notifiy",props:{title:{},content:{},isHtmlFragment:{type:Boolean,default:!1},icon:{},iconClass:{}},emits:["close"],setup(e,{emit:l}){const o=e,n=l,a=t.shallowRef(null),r=()=>{n("close")};function m(i,s){let u=i.className,d=u!=""?" ":"",c=u+d+s;i.className=c}return t.onMounted(()=>{t.nextTick(()=>{setTimeout(()=>{var i,s,u,d;(s=(i=a.value)==null?void 0:i.parentElement)!=null&&s.parentElement&&m((d=(u=a.value)==null?void 0:u.parentElement)==null?void 0:d.parentElement,"zan-layer-notifiy-transition")},300)})}),(i,s)=>(t.openBlock(),t.createElementBlock("div",{class:"zan-layer-notifiy-wrapper",ref_key:"notifyRef",ref:a},[t.createElementVNode("h2",Ae,[e.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(e.iconClass)},null,2)):t.createCommentVNode("",!0),t.createElementVNode("span",null,t.toDisplayString(e.title),1)]),!e.isHtmlFragment&&e.content?(t.openBlock(),t.createElementBlock("div",Pe,[t.createVNode(_,{render:()=>t.unref(M)(o.content)},null,8,["render"])])):e.isHtmlFragment&&e.content?(t.openBlock(),t.createElementBlock("div",{key:1,class:"content",innerHTML:e.content},null,8,_e)):t.createCommentVNode("",!0),t.createElementVNode("i",{class:"zan-icon-close",onClick:r},[...s[0]||(s[0]=[t.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16"},[t.createElementVNode("path",{d:"M810.666667 273.493333L750.506667 213.333333 512 451.84 273.493333 213.333333 213.333333 273.493333 451.84 512 213.333333 750.506667 273.493333 810.666667 512 572.16 750.506667 810.666667 810.666667 750.506667 572.16 512z",fill:"currentColor"})],-1)])])],512))}}),Re=["maxlength","placeholder"],We=["type","placeholder"],Xe=t.defineComponent({name:"Prompt",__name:"Prompt",props:{promptValue:{},formType:{default:"text"},maxLength:{},placeholder:{default:""}},emits:["update:promptValue"],setup(e,{emit:l}){const o=e,n=t.ref(o.promptValue),a=t.computed(()=>{switch(typeof o.formType){case"string":return o.formType==="textarea";case"number":return o.formType===2;default:return!1}}),r=t.computed(()=>o.formType==1||o.formType=="password");return(m,i)=>a.value?t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{key:0,onInput:i[0]||(i[0]=s=>m.$emit("update:promptValue",n.value)),"onUpdate:modelValue":i[1]||(i[1]=s=>n.value=s),maxlength:o.maxLength,placeholder:o.placeholder,class:"zan-textarea"},null,40,Re)),[[t.vModelText,n.value]]):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:1,onInput:i[2]||(i[2]=s=>m.$emit("update:promptValue",n.value)),"onUpdate:modelValue":i[3]||(i[3]=s=>n.value=s),type:r.value?"password":"text",placeholder:o.placeholder,class:"zan-input"},null,40,We)),[[t.vModelDynamic,n.value]])}});function Ye(e){for(;e&&e.parentNode;)if(e=e.parentNode,e&&getComputedStyle(e).position==="relative")return e;return null}const j=e=>{document.querySelectorAll(".zan-layer iframe").forEach(o=>{o.style.pointerEvents=e})},Qe=function(e,l,o,n,a){let r,m,i=0,s=0,u=!0;e!=null&&e.addEventListener("mousedown",function(d){if((d.composedPath&&d.composedPath()||d.path)[0].className==="zan-layer-title"&&d.button==0&&e!=null){j("none");const p=getComputedStyle(e);r=d.pageX-e.offsetLeft+parseInt(p["margin-left"]),m=d.pageY-e.offsetTop+parseInt(p["margin-right"]),i=d.clientX,s=d.clientY,document.body.style.userSelect="none",document.body.style.cursor="move";const z=function(k){if(e!=null){(k.clientX-i!=0||k.clientY-s!=0)&&u&&(u=!1,a());let y=k.pageX-r,h=k.pageY-m;const B=document.documentElement.clientWidth,C=document.documentElement.clientHeight;if(!l){let E=B-e.offsetWidth,S=C-e.offsetHeight;if(e.style.position==="absolute"){const V=Ye(e);V!=null&&(E=V.clientWidth-e.offsetWidth,S=V.clientHeight-e.offsetHeight)}y<0?y=0:y>E&&(y=E),h<0?h=0:h>S&&(h=S)}e.style.top=h+"px",e.style.left=y+"px",o(e.style.left,e.style.top)}return!1},N=function(){u=!0,document.body.style.userSelect="",document.body.style.cursor="",n(),j("auto"),document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",z,{passive:!1}),document.addEventListener("mouseup",N)}return!1})},Ge=function(e,l,o,n){let a=0,r=0,m=!0;e!=null&&e.addEventListener("mousedown",function(i){if((i.composedPath&&i.composedPath()||i.path)[0].className==="zan-layer-resize"&&i.button==0&&e!=null){j("none");const u=e.getBoundingClientRect(),d=u.left,c=u.top;a=i.clientX,r=i.clientY,document.body.style.userSelect="none",document.body.style.cursor="se-resize";const p=function(N){var k;if(window.getSelection!=null&&((k=window.getSelection())==null||k.removeAllRanges()),e!=null){const y=N.clientX,h=N.clientY;(y-a!=0||h-r!=0)&&m&&(m=!1,n());let B=y-d,C=h-c;B<260&&(B=260),C<115&&(C=115),e.style.width=B+"px",e.style.height=C+"px",l(e.style.width,e.style.height)}return!1};document.addEventListener("mousemove",p,{passive:!1});const z=function(){m=!0,document.body.style.userSelect="",document.body.style.cursor="",o(),j("auto"),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",z)};document.addEventListener("mouseup",z)}return!1})},Ze=Symbol("zIndex");let Ue=99999;function oe(){return++Ue}const qe=["id"],Ke={key:1,class:"slot-fragment"},Je=["innerHTML"],et=["onClick"],tt={key:2,class:"zan-layer-resize"},R=t.defineComponent({name:"ZanLayer",__name:"ZanLayer",props:{modelValue:{type:Boolean,default:!1},type:{default:1},title:{type:[String,Object,Symbol,Function,Boolean],default:"标题"},footer:{type:[String,Object,Symbol,Function,Boolean]},titleStyle:{type:[String,Boolean,null,Object,Array],default:""},footerStyle:{type:[String,Boolean,null,Object,Array]},content:{},isHtmlFragment:{type:Boolean,default:!1},offset:{default:()=>"auto"},area:{default:()=>"auto"},move:{type:Boolean,default:!0},maxmin:{type:Boolean,default:!1},resize:{type:Boolean,default:!1},shade:{type:Boolean,default:!0},shadeClose:{type:Boolean,default:!0},shadeStyle:{type:[Boolean,null,String,Object,Array]},shadeOpacity:{default:"0.1"},layerClasses:{},zIndex:{},closeBtn:{type:[Boolean,String],default:"1"},btn:{},btnAlign:{default:"r"},anim:{default:0},isOutAnim:{type:Boolean,default:!0},icon:{},imgList:{default:()=>[]},startIndex:{default:0},animDuration:{default:"0.3s"},moveOut:{type:Boolean,default:!1},teleport:{default:"body"},teleportDisabled:{type:Boolean,default:!1},lastPosition:{type:Boolean,default:!0},time:{default:0},load:{default:0},yesText:{default:"确定"},formType:{default:"text"},value:{default:""},maxLength:{},placeholder:{default:"请输入内容"},isMessage:{type:Boolean,default:!1},id:{},isFunction:{type:Boolean,default:!1},appContext:{},success:{type:Function,default:()=>{}},end:{type:Function,default:()=>{}},yes:{},beforeClose:{type:Function,default:()=>!0},close:{type:Function,default:()=>{}},min:{type:Function,default:()=>{}},full:{type:Function,default:()=>{}},revert:{type:Function,default:()=>{}},moveStart:{type:Function,default:()=>{}},moving:{type:Function,default:()=>{}},moveEnd:{type:Function,default:()=>{}},resizeStart:{type:Function,default:()=>{}},resizing:{type:Function,default:()=>{}},resizeEnd:{type:Function,default:()=>{}},internalDestroy:{}},emits:["close","update:modelValue"],setup(e,{expose:l,emit:o}){const n=e,a=o,r=t.useSlots(),m=t.ref(!1),i=t.ref(!1),s=t.ref(n.id||q()),u=t.ref(null),d=t.ref(),c=xe(n.type),p=t.ref(he(n.type,n.area,n.offset)),z=t.ref(X(n.offset,p.value,c)),N=t.ref(99999),k=t.ref(!1),y=t.ref(p.value[0]),h=t.ref(p.value[1]),B=t.ref(z.value[0]),C=t.ref(z.value[1]),E=t.ref(""),S=t.ref(""),V=t.ref(""),$=t.ref(""),A=t.ref(n.value);t.watch(()=>n.value,()=>{A.value=n.value});const ae=()=>{N.value=n.zIndex??oe()};t.watch(()=>n.zIndex,()=>{ae()},{immediate:!0});const ie=function(){t.nextTick(async()=>{c==4&&(p.value=K(n.offset,n.area)),c==5&&(p.value=await le(n.imgList[n.startIndex].src));let f=p.value;(f[0]==null||f[1]==null)&&(f=te(u.value)),c==6&&(z.value=ke(n.offset,f,s.value)),P(),ue(),dt()})},rt=function(){i.value&&de(),m.value&&re(),E.value="",S.value="",V.value="",$.value=""},se=()=>{V.value=B.value,$.value=C.value,E.value=y.value,S.value=h.value,y.value=J().w,h.value=J().h,B.value=ee().t,C.value=ee().l},re=()=>{m.value?(F(),y.value=E.value,h.value=S.value,n.revert(s.value)):(O(),se(),n.full(s.value)),m.value=!m.value},ce=()=>{let U=10+190*H(s.value,!0);const Vt=document.documentElement.clientWidth;U+180>Vt&&(U=10),E.value=y.value,S.value=h.value,V.value=B.value,$.value=C.value,h.value="51px",y.value="180px",B.value="calc(100% - 51px)",C.value=U+"px"},de=async()=>{i.value?(F(),H(s.value,!1),y.value=E.value,h.value=S.value,n.revert(s.value)):(O(),ce(),n.min(s.value)),i.value=!i.value};t.watch(()=>n.modelValue,()=>{k.value=n.modelValue,k.value?(ie(),ae()):rt()},{deep:!0,immediate:!0}),t.watch(()=>k.value,()=>{k.value&&(n.isFunction&&ie(),t.nextTick(()=>{n.success(s.value)}))},{immediate:!0,flush:"post"}),t.watch(()=>k.value,()=>{k.value||n.end(s.value)});const ct=t.computed(()=>[{"zan-layer-dialog":c===0||c===7,"zan-layer-page":c===1,"zan-layer-iframe":c===2,"zan-layer-loading":c===3,"zan-layer-drawer":c===4,"zan-layer-photos":c===5,"zan-layer-notifiy":c===6,"zan-layer-msg":n.isMessage,"zan-layer-hui":n.isMessage&&!n.icon},n.layerClasses]),dt=function(){n.move&&c!=4&&t.nextTick(()=>{u.value&&(Qe(u.value,n.moveOut,(f,g)=>{C.value=f,B.value=g,i.value||($.value=f,V.value=g),n.moving(s.value,{top:g,left:f})},()=>{const f={left:C.value,top:B.value,isMin:i.value,isMax:m.value},[g,b]=n.moveEnd(s.value,f)||[];b&&g&&(C.value=g,B.value=b)},()=>{n.moveStart(s.value)}),Ge(u.value,(f,g)=>{h.value=g,y.value=f,S.value=g,E.value=f,n.resizing(s.value,{width:f,height:g})},()=>{const f={width:y.value,height:h.value},[g,b]=n.resizeEnd(s.value,f)||[];g&&b&&(y.value=g,h.value=b)},()=>{n.resizeStart(s.value)}))})},mt=t.computed(()=>({position:n.teleportDisabled||n.teleport!="body"?"absolute":"fixed",top:B.value,left:C.value,height:h.value,width:y.value,animationDuration:n.animDuration,zIndex:N.value})),ut=t.computed(()=>[c===3?`zan-layer-loading${n.load}`:"",n.icon?"zan-layer-padding":""]),W=()=>{if(typeof n.beforeClose=="function"){const f=n.beforeClose(s.value);(f===void 0||f!=null&&f===!0)&&(n.close(s.value),a("close"),a("update:modelValue",!1),n.internalDestroy&&n.internalDestroy(),i.value&&H(s.value,!i.value))}},ft=(...f)=>{typeof n.yes=="function"?n.yes(...f):W()},pt=()=>{n.shadeClose&&W()},me=t.computed(()=>["zan-icon",`zan-icon-ico${n.icon}`]),yt=t.computed(()=>c===4?ne(n.offset):c===6?Be(n.offset):`zan-layer-anim-0${n.anim}`),ht=t.computed(()=>c===4?ne(n.offset,!0):n.isOutAnim?"zan-layer-anim-close":""),gt=()=>{k.value=!0},xt=()=>{k.value=!1,c===6&&be(s.value)},kt=t.computed(()=>k.value&&n.shade&&!i.value),bt=t.computed(()=>n.resize&&!m.value&&!i.value),Bt=t.computed(()=>n.title&&c!=3&&c!=5&&c!=6),Ct=function(f){t.nextTick(async()=>{p.value=await le(n.imgList[f].src),z.value=X(n.offset,p.value,c),y.value=p.value[0],h.value=p.value[1],B.value=z.value[0],C.value=z.value[1],E.value=p.value[0],S.value=p.value[1]})},zt=function(){n.zIndex||(N.value=oe())};t.onMounted(()=>{F()}),t.onUnmounted(()=>{O()}),t.watch(()=>n.modelValue,()=>{n.modelValue?F():O()});let I;const F=function(){t.nextTick(()=>{d.value&&!I&&c!=6&&(I=new ResizeObserver(f=>{u.value&&(z.value=X(n.offset,te(u.value),c),P(!0))}),I.observe(d.value))})},O=function(){I&&d.value&&(I.unobserve(d.value),I=void 0)},P=function(f=!1){B.value=f&&n.lastPosition&&V.value||z.value[0],C.value=f&&n.lastPosition&&$.value||z.value[1]},ue=function(){y.value=p.value[0],h.value=p.value[1],E.value=p.value[0],S.value=p.value[1]},Et=function(){F(),H(s.value,!1),i.value=!1,m.value=!1,V.value="",$.value="",P(),ue(),n.modelValue||a("update:modelValue",!0)},St=async function(){i.value&&(G(),P(!0)),m.value||(await t.nextTick(),O(),se(),m.value=!0)},wt=async function(){m.value&&(G(),P(!0)),i.value||(await t.nextTick(),O(),ce(),i.value=!0)},G=()=>{F(),H(s.value,!1),i.value=!1,m.value=!1,y.value=E.value,h.value=S.value};return l({reset:Et,open:gt,close:xt,full:St,min:wt,revert:G}),(f,g)=>(t.openBlock(),t.createBlock(t.Teleport,{to:e.teleport,disabled:e.teleportDisabled},[t.createVNode(fe,{index:N.value,"shade-style":e.shadeStyle,visible:kt.value,opacity:e.shadeOpacity,teleport:e.teleport,teleportDisabled:e.teleportDisabled,onShadeClick:pt},null,8,["index","shade-style","visible","opacity","teleport","teleportDisabled"]),t.createVNode(t.Transition,{"enter-active-class":yt.value,"leave-active-class":ht.value},{default:t.withCtx(()=>[k.value?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"layerRef",ref:u,class:t.normalizeClass(["zan-layer zan-layer-border",[ct.value,{"zan-layer-min":i.value}]]),id:s.value,style:t.normalizeStyle(mt.value)},[Bt.value?(t.openBlock(),t.createBlock(Ce,{key:0,title:e.title,titleStyle:e.titleStyle,move:e.move,onMousedown:zt},{default:t.withCtx(()=>[t.renderSlot(f.$slots,"title")]),_:3},8,["title","titleStyle","move"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"contentRef",ref:d,class:t.normalizeClass(["zan-layer-content",ut.value]),style:t.normalizeStyle(i.value===!0?"display:none":"")},[t.unref(c)===0||t.unref(c)===1||t.unref(c)===4?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(me.value)},null,2)):t.createCommentVNode("",!0),t.unref(r).default?(t.openBlock(),t.createElementBlock("div",Ke,[t.renderSlot(f.$slots,"default")])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[e.isHtmlFragment?(t.openBlock(),t.createElementBlock("div",{key:0,class:"html-fragment",innerHTML:t.unref(M)(n.content)},null,8,Je)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[n.content?(t.openBlock(),t.createBlock(_,{key:0,render:()=>t.unref(M)(n.content)},null,8,["render"])):t.createCommentVNode("",!0)],64))],64))],64)):t.createCommentVNode("",!0),t.unref(c)===7?(t.openBlock(),t.createBlock(Xe,{key:1,"prompt-value":A.value,"onUpdate:promptValue":g[0]||(g[0]=b=>A.value=b),formType:n.formType,maxLength:n.maxLength,placeholder:n.placeholder},null,8,["prompt-value","formType","maxLength","placeholder"])):t.createCommentVNode("",!0),t.unref(c)===2?(t.openBlock(),t.createBlock(ye,{key:2,src:n.content},null,8,["src"])):t.createCommentVNode("",!0),t.unref(c)===5?(t.openBlock(),t.createBlock(Te,{key:3,imgList:n.imgList,startIndex:n.startIndex,onResetCalculationPohtosArea:Ct},null,8,["imgList","startIndex"])):t.createCommentVNode("",!0),t.unref(c)===6?(t.openBlock(),t.createBlock(je,{key:4,onClose:W,title:n.title,content:n.content,isHtmlFragment:n.isHtmlFragment,icon:n.icon,iconClass:me.value},null,8,["title","content","isHtmlFragment","icon","iconClass"])):t.createCommentVNode("",!0)],6),t.unref(c)!=3&&t.unref(c)!=5&&t.unref(c)!=6?(t.openBlock(),t.createBlock(Ne,{key:1,maxmin:e.maxmin,max:m.value,min:i.value,closeBtn:e.closeBtn,onOnMin:de,onOnMax:re,onOnClose:W},null,8,["maxmin","max","min","closeBtn"])):t.createCommentVNode("",!0),t.createElementVNode("div",{style:t.normalizeStyle(i.value===!0?"display:none":"")},[t.unref(r).footer||n.footer?(t.openBlock(),t.createBlock(ze,{key:0,footer:n.footer,footerStyle:n.footerStyle},{default:t.withCtx(()=>[t.renderSlot(f.$slots,"footer")]),_:3},8,["footer","footerStyle"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[(e.btn&&e.btn.length>0||t.unref(c)===0||t.unref(c)===7)&&!e.isMessage?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["zan-layer-btn",[`zan-layer-btn-${e.btnAlign}`]])},[e.btn&&e.btn.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(e.btn,(b,Z)=>(t.openBlock(),t.createElementBlock("a",{key:Z,style:t.normalizeStyle(b.style),class:t.normalizeClass([b.class,`zan-layer-btn${Z}`,{"zan-layer-btn-disabled":b.disabled}]),onClick:Nt=>!b.disabled&&(t.unref(c)===7?b.callback(s.value,A.value):b.callback(s.value))},t.toDisplayString(b.text),15,et))),128)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.unref(c)===0||t.unref(c)===7?(t.openBlock(),t.createElementBlock("a",{key:0,class:"zan-layer-btn0",onClick:g[1]||(g[1]=b=>ft(s.value,A.value))},t.toDisplayString(e.yesText),1)):t.createCommentVNode("",!0)],64))],2)):t.createCommentVNode("",!0)],64))],4),bt.value?(t.openBlock(),t.createElementBlock("span",tt)):t.createCommentVNode("",!0)],14,qe)):t.createCommentVNode("",!0)]),_:3},8,["enter-active-class","leave-active-class"])],8,["to","disabled"]))}}),L=[],nt=e=>{L.push(e)},Q=e=>{L.forEach((l,o)=>{l.modalContainer.id===e&&L.splice(o,1)})},lt=()=>{L.splice(0,L.length)},D=e=>{let l=!1;return L.forEach((o,n)=>{o.modalContainer.id==e&&(l=!0)}),l},T=e=>{let l=null;return L.forEach((o,n)=>{o.modalContainer.id===e&&(l=o)}),l},ot=(e,l)=>(e&&(l=Object.assign(l,e)),l),at=e=>{const l=document.createElement("div");return l.id=e.id,document.body.appendChild(l),l},it=e=>typeof e=="function"?t.isVNode(e())?{default:()=>e()}:void 0:t.isVNode(e)?{default:()=>e}:void 0,x={_context:null,open:e=>{const l={};return x.create(e,l)},drawer:e=>{const l={type:"drawer"};return x.create(e,l)},msg:(e,l={},o)=>{const n={type:0,title:!1,content:e,shadeClose:!1,closeBtn:!1,isMessage:!0,shade:!1,btn:void 0,time:2e3};return x.create(l,n,o)},load:(e=0,l={})=>{const o={type:3,load:e,anim:5,isOutAnim:!1,shadeClose:!1,shade:!0,shadeOpacity:"0.3"};return x.create(l,o)},confirm:(e,l={})=>{const o={type:0,content:e,shadeClose:!1};return x.create(l,o)},notify:(e,l)=>{e.type=6;const o={offset:"rt",time:3e3,area:"auto",shade:!1};return x.create(e,o,l)},photos:e=>{typeof e=="string"&&(e={imgList:[{src:e}]});const l={type:5,anim:2,startIndex:0,isOutAnim:!0,shadeClose:!0,shadeOpacity:"0.2"};return x.create(e,l)},prompt:e=>{e.type=7;const l={type:"prompt",shadeClose:!1,shadeOpacity:"0.2"};return x.create(e,l)},create:(e,l,o)=>{var i,s;let n;const a=ot(e,l);a.hasOwnProperty("id")?x.close(a.id):a.id=q();const r=at(a),m=t.h(R,{...a,isFunction:!0,internalDestroy(){var u,d;n&&clearTimeout(n),(d=(u=m.component)==null?void 0:u.exposed)==null||d.close(),setTimeout(()=>{t.render(null,r),document.body.contains(r)&&document.body.removeChild(r)},500),Q(r.id)}},it(a.content));return m.appContext=a.appContext||x._context,t.render(m,r),(s=(i=m.component)==null?void 0:i.exposed)==null||s.open(),l&&l.time!=null&&l.time!=0&&(n=setTimeout(()=>{var u,d;(d=(u=m.component)==null?void 0:u.exposed)==null||d.close(),o&&o(r.id),setTimeout(()=>{t.render(null,r),document.body.contains(r)&&document.body.removeChild(r)},500),Q(r.id)},l.time)),nt({modalContainer:r,modalInstance:m}),r.id},close:e=>{var l,o;if(e!=null&&D(e)){const n=T(e);(o=(l=n.modalInstance.component)==null?void 0:l.exposed)==null||o.close(),setTimeout(()=>{t.render(null,n.modalContainer),document.body.contains(n.modalContainer)&&document.body.removeChild(n.modalContainer)},500)}Q(e)},closeAll:()=>{L.forEach(e=>{var l,o;(o=(l=e.modalInstance.component)==null?void 0:l.exposed)==null||o.close(),setTimeout(()=>{t.render(null,e.modalContainer),document.body.contains(e.modalContainer)&&document.body.removeChild(e.modalContainer)},500)}),lt()},reset:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.reset())},min:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.min())},full:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.full())},revert:e=>{var l,o;e!=null&&D(e)&&((o=(l=T(e).modalInstance.component)==null?void 0:l.exposed)==null||o.revert())}},st={install:(e,l)=>{x._context=e._context,e.component(R.name,R),e.config.globalProperties.$layer=x,l&&typeof l.zIndex=="number"&&e.provide(Ze,t.ref(l.zIndex))}};w.ZanLayer=R,w.default=st,w.layer=x,w.zanLayer=x,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
type __VLS_Props = {
|
|
2
|
-
render: () => any;
|
|
3
|
-
};
|
|
4
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
1
|
declare const _default: typeof __VLS_export;
|
|
6
2
|
export default _default;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
render: {
|
|
5
|
+
type: FunctionConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
render: {
|
|
10
|
+
type: FunctionConstructor;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -34,12 +34,12 @@ declare const __VLS_base: import("vue").DefineComponent<LayerProps, {
|
|
|
34
34
|
close: Function;
|
|
35
35
|
load: number;
|
|
36
36
|
resize: boolean;
|
|
37
|
+
type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | "dialog" | "page" | "iframe" | "loading" | "drawer" | "photos" | "notify" | "prompt";
|
|
37
38
|
shadeOpacity: string;
|
|
38
39
|
titleStyle: string | false | import("vue").CSSProperties | StyleValue[] | null;
|
|
39
40
|
maxmin: boolean;
|
|
40
41
|
min: Function;
|
|
41
42
|
closeBtn: boolean | string;
|
|
42
|
-
type: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | "dialog" | "page" | "iframe" | "loading" | "drawer" | "photos" | "notify" | "prompt";
|
|
43
43
|
imgList: ImgListType[];
|
|
44
44
|
startIndex: number;
|
|
45
45
|
isHtmlFragment: boolean;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function calculateDrawerArea(offset: any, drawerArea?: string[] |
|
|
|
6
6
|
/**
|
|
7
7
|
* 计算 offset 属性
|
|
8
8
|
*/
|
|
9
|
-
export declare function calculateOffset(offset: string[] | string, area: string[], type: number): string[];
|
|
9
|
+
export declare function calculateOffset(offset: string[] | string | undefined, area: string[], type: number): string[];
|
|
10
10
|
/**
|
|
11
11
|
* 转换 number 类型
|
|
12
12
|
*/
|