vue-popup-plus 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -0
- package/dist/vue-popup-plus.d.ts +313 -22
- package/dist/vue-popup-plus.js +643 -265
- package/dist/vue-popup-plus.umd.cjs +2 -2
- package/package.json +3 -3
package/dist/vue-popup-plus.js
CHANGED
|
@@ -1,235 +1,259 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".popup-mask[data-v-
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
function Q(o = 0) {
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".vue-popup-plus-animation{animation-timing-function:linear;animation-duration:var(--v6e614cc2)}.popup-frame[data-v-5a4614b0]{display:flex;flex-direction:column;position:fixed;inset:0;pointer-events:none}.popup-mask[data-v-c4c8c95e]{position:fixed;inset:0;background-color:var(--popup-color-mask)}.popup-mask.is-blur[data-v-c4c8c95e]{-webkit-backdrop-filter:blur(15px) saturate(180%);backdrop-filter:blur(15px) saturate(180%)}.popup-view[data-v-bbc1055f]{position:relative;pointer-events:auto}.vue-popup-plus-animation-enter-fade{animation-name:vue-popup-plus-animation-enter-fade}.vue-popup-plus-animation-leave-fade{animation-name:vue-popup-plus-animation-leave-fade}.vue-popup-plus-animation-enter-scale-enlarge{animation-name:vue-popup-plus-animation-enter-scale-enlarge}.vue-popup-plus-animation-leave-scale-enlarge{animation-name:vue-popup-plus-animation-leave-scale-enlarge}.vue-popup-plus-animation-enter-scale-reduce{animation-name:vue-popup-plus-animation-enter-scale-reduce}.vue-popup-plus-animation-leave-scale-reduce{animation-name:vue-popup-plus-animation-leave-scale-reduce}.vue-popup-plus-animation-enter-fly-top{animation-name:vue-popup-plus-animation-enter-fly-top}.vue-popup-plus-animation-leave-fly-top{animation-name:vue-popup-plus-animation-leave-fly-top}.vue-popup-plus-animation-enter-fly-left{animation-name:vue-popup-plus-animation-enter-fly-left}.vue-popup-plus-animation-leave-fly-left{animation-name:vue-popup-plus-animation-leave-fly-left}.vue-popup-plus-animation-enter-fly-right{animation-name:vue-popup-plus-animation-enter-fly-right}.vue-popup-plus-animation-leave-fly-right{animation-name:vue-popup-plus-animation-leave-fly-right}.vue-popup-plus-animation-enter-fly-bottom{animation-name:vue-popup-plus-animation-enter-fly-bottom}.vue-popup-plus-animation-leave-fly-bottom{animation-name:vue-popup-plus-animation-leave-fly-bottom}@-moz-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-webkit-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-o-keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@keyframes vue-popup-plus-animation-enter-fade{0%{opacity:0}to{opacity:1}}@-moz-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-webkit-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-o-keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@keyframes vue-popup-plus-animation-leave-fade{0%{opacity:1}to{opacity:0}}@-moz-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-enlarge{0%{transform:scale(0)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-o-keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes vue-popup-plus-animation-leave-scale-enlarge{0%{transform:scale(1)}to{transform:scale(0)}}@-moz-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-webkit-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-o-keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@keyframes vue-popup-plus-animation-enter-scale-reduce{0%{transform:scale(5)}to{transform:scale(1)}}@-moz-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-webkit-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-o-keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@keyframes vue-popup-plus-animation-leave-scale-reduce{0%{transform:scale(1)}to{transform:scale(5)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-top{0%{transform:translateY(-100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@keyframes vue-popup-plus-animation-leave-fly-top{0%{transform:translateY(0)}to{transform:translateY(-100vh)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-left{0%{transform:translate(-100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@keyframes vue-popup-plus-animation-leave-fly-left{0%{transform:translate(0)}to{transform:translate(-100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes vue-popup-plus-animation-enter-fly-right{0%{transform:translate(100vw)}to{transform:translate(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-o-keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@keyframes vue-popup-plus-animation-leave-fly-right{0%{transform:translate(0)}to{transform:translate(100vw)}}@-moz-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-webkit-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-o-keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@keyframes vue-popup-plus-animation-enter-fly-bottom{0%{transform:translateY(100vh)}to{transform:translateY(0)}}@-moz-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-webkit-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@-o-keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}@keyframes vue-popup-plus-animation-leave-fly-bottom{0%{transform:translateY(0)}to{transform:translateY(100vh)}}:root{--popup-color-mask: rgba(0,0,0,.45);--popup-color-mask-dark-lite: rgba(0,0,0,.45);--popup-color-mask-dark: rgba(0,0,0,.45);--popup-color-mask-dark-most: rgba(0,0,0,.45);--popup-color-mask-light-lite: rgba(26,26,26,.45);--popup-color-mask-light: rgba(64,64,64,.45);--popup-color-mask-light-most: rgba(153,153,153,.45)}.dark{--popup-color-mask: rgba(75,75,75,.45);--popup-color-mask-dark-lite: rgba(68,68,68,.45);--popup-color-mask-dark: rgba(56,56,56,.45);--popup-color-mask-dark-most: rgba(30,30,30,.45);--popup-color-mask-light-lite: rgba(93,93,93,.45);--popup-color-mask-light: rgba(120,120,120,.45);--popup-color-mask-light-most: rgba(183,183,183,.45)}")),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as C, useCssVars as Z, computed as p, inject as w, ref as $, onMounted as Y, createBlock as T, openBlock as h, Transition as ee, withCtx as S, renderSlot as W, createCommentVNode as H, unref as P, normalizeStyle as V, createElementBlock as N, normalizeClass as te, defineAsyncComponent as ne, provide as M, onUpdated as oe, nextTick as se, resolveDynamicComponent as re, mergeProps as ae, Teleport as ie, createElementVNode as ue, createVNode as E, createApp as ce, render as U, toRefs as le, reactive as q, onBeforeMount as pe, onBeforeUnmount as de, Fragment as z, renderList as me, markRaw as he } from "vue";
|
|
3
|
+
function fe(n) {
|
|
4
|
+
const e = Object.prototype.toString.call(n).match(/\s+(\w+)/);
|
|
5
|
+
return e ? e[1] : "Null";
|
|
6
|
+
}
|
|
7
|
+
function ge(n = 0) {
|
|
10
8
|
return new Promise((e) => {
|
|
11
|
-
window.setTimeout(e,
|
|
9
|
+
window.setTimeout(e, n);
|
|
12
10
|
});
|
|
13
11
|
}
|
|
14
|
-
const
|
|
12
|
+
const R = "vue-popup-plus", A = {
|
|
13
|
+
INSTANCE_ID: Symbol(`${R}-instance-id`),
|
|
14
|
+
COMPUTED_VIEW_STYLE: Symbol(`${R}-computed-view-style`)
|
|
15
|
+
}, I = {
|
|
16
|
+
CORE: Symbol(`${R}-core`),
|
|
17
|
+
INSTANCE_STORE: Symbol(`${R}-instance-store`)
|
|
18
|
+
}, ve = "http://vue-popup-plus.styzy.cn", B = /* @__PURE__ */ C({
|
|
19
|
+
name: "PopupAnimation",
|
|
20
|
+
__name: "PopupAnimation",
|
|
21
|
+
props: {
|
|
22
|
+
type: {},
|
|
23
|
+
duration: {}
|
|
24
|
+
},
|
|
25
|
+
setup(n) {
|
|
26
|
+
Z((u) => ({
|
|
27
|
+
v6e614cc2: r.value
|
|
28
|
+
}));
|
|
29
|
+
const e = w(I.INSTANCE_STORE), o = $(!1), t = p(
|
|
30
|
+
() => `vue-popup-plus-animation vue-popup-plus-animation-enter-${n.type}`
|
|
31
|
+
), s = p(
|
|
32
|
+
() => `vue-popup-plus-animation vue-popup-plus-animation-leave-${n.type}`
|
|
33
|
+
), r = p(() => `${n.duration}ms`);
|
|
34
|
+
return Y(() => {
|
|
35
|
+
o.value = !0;
|
|
36
|
+
}), (u, m) => (h(), T(ee, {
|
|
37
|
+
"enter-active-class": t.value,
|
|
38
|
+
"leave-active-class": s.value
|
|
39
|
+
}, {
|
|
40
|
+
default: S(() => [
|
|
41
|
+
o.value && !P(e).isBeforeUnmount.value ? W(u.$slots, "default", {
|
|
42
|
+
key: 0,
|
|
43
|
+
style: V({ animationDuration: `${n.duration}ms` })
|
|
44
|
+
}) : H("", !0)
|
|
45
|
+
]),
|
|
46
|
+
_: 3
|
|
47
|
+
}, 8, ["enter-active-class", "leave-active-class"]));
|
|
48
|
+
}
|
|
49
|
+
}), ye = /* @__PURE__ */ C({
|
|
50
|
+
name: "PopupFrame",
|
|
51
|
+
__name: "PopupFrame",
|
|
52
|
+
props: {
|
|
53
|
+
placement: {},
|
|
54
|
+
zIndex: {}
|
|
55
|
+
},
|
|
56
|
+
setup(n) {
|
|
57
|
+
const e = p(() => ({
|
|
58
|
+
alignItems: n.placement.includes("left") ? "flex-start" : n.placement.includes("right") ? "flex-end" : "center",
|
|
59
|
+
justifyContent: n.placement.includes("top") ? "flex-start" : n.placement.includes("bottom") ? "flex-end" : "center",
|
|
60
|
+
zIndex: n.zIndex
|
|
61
|
+
}));
|
|
62
|
+
return (o, t) => (h(), N("div", {
|
|
63
|
+
class: "popup-frame",
|
|
64
|
+
style: V(e.value)
|
|
65
|
+
}, [
|
|
66
|
+
W(o.$slots, "default", {}, void 0, !0)
|
|
67
|
+
], 4));
|
|
68
|
+
}
|
|
69
|
+
}), F = (n, e) => {
|
|
70
|
+
const o = n.__vccOpts || n;
|
|
71
|
+
for (const [t, s] of e)
|
|
72
|
+
o[t] = s;
|
|
73
|
+
return o;
|
|
74
|
+
}, _e = /* @__PURE__ */ F(ye, [["__scopeId", "data-v-5a4614b0"]]), we = /* @__PURE__ */ C({
|
|
15
75
|
name: "PopupMask",
|
|
16
76
|
__name: "PopupMask",
|
|
17
|
-
setup(
|
|
18
|
-
const e =
|
|
77
|
+
setup(n) {
|
|
78
|
+
const e = w(A.INSTANCE_ID), o = w(I.INSTANCE_STORE);
|
|
19
79
|
function t() {
|
|
20
|
-
|
|
80
|
+
o.maskClickClose && Ue().destroy(e);
|
|
21
81
|
}
|
|
22
|
-
return (
|
|
23
|
-
class:
|
|
24
|
-
style:
|
|
82
|
+
return (s, r) => (h(), N("div", {
|
|
83
|
+
class: te(["popup-mask", { "is-blur": P(o).maskBlur.value }]),
|
|
84
|
+
style: V({ zIndex: P(o).zIndex.value }),
|
|
25
85
|
onClick: t
|
|
26
86
|
}, null, 6));
|
|
27
87
|
}
|
|
28
|
-
}),
|
|
29
|
-
const n = o.__vccOpts || o;
|
|
30
|
-
for (const [t, i] of e)
|
|
31
|
-
n[t] = i;
|
|
32
|
-
return n;
|
|
33
|
-
}, ee = /* @__PURE__ */ M(Z, [["__scopeId", "data-v-53a2b502"]]), te = /* @__PURE__ */ P({
|
|
88
|
+
}), Pe = /* @__PURE__ */ F(we, [["__scopeId", "data-v-c4c8c95e"]]), Ce = /* @__PURE__ */ C({
|
|
34
89
|
name: "PopupView",
|
|
35
90
|
__name: "PopupView",
|
|
36
|
-
setup(
|
|
37
|
-
const e =
|
|
38
|
-
|
|
39
|
-
(
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
t.
|
|
45
|
-
|
|
46
|
-
) : Math.max(
|
|
47
|
-
t.viewTranslateY.value,
|
|
48
|
-
|
|
49
|
-
)),
|
|
50
|
-
width:
|
|
51
|
-
maxWidth:
|
|
52
|
-
minWidth:
|
|
53
|
-
height:
|
|
54
|
-
maxHeight:
|
|
55
|
-
minHeight:
|
|
56
|
-
transform: `translate(${
|
|
57
|
-
})),
|
|
58
|
-
width:
|
|
91
|
+
setup(n) {
|
|
92
|
+
const e = $(), o = w(A.INSTANCE_ID), t = w(I.INSTANCE_STORE), s = $(0), r = $(0), u = p(() => typeof t.component == "function" ? ne(t.component) : t.component), m = p(() => {
|
|
93
|
+
const c = Math.ceil(window.innerWidth - s.value);
|
|
94
|
+
return t.placement.value.includes("left") ? [0, c] : t.placement.value.includes("right") ? [-c, 0] : [-(c / 2), c / 2];
|
|
95
|
+
}), f = p(() => {
|
|
96
|
+
const c = Math.ceil(window.innerHeight - r.value);
|
|
97
|
+
return t.placement.value.includes("top") ? [0, c] : t.placement.value.includes("bottom") ? [-c, 0] : [-(c / 2), c / 2];
|
|
98
|
+
}), g = p(() => t.viewTranslateOverflow.value ? t.viewTranslateX.value : Math.max(
|
|
99
|
+
Math.min(t.viewTranslateX.value, m.value[1]),
|
|
100
|
+
m.value[0]
|
|
101
|
+
)), x = p(() => t.viewTranslateOverflow.value ? t.viewTranslateY.value : Math.max(
|
|
102
|
+
Math.min(t.viewTranslateY.value, f.value[1]),
|
|
103
|
+
f.value[0]
|
|
104
|
+
)), K = p(() => ({
|
|
105
|
+
width: y(t.width.value),
|
|
106
|
+
maxWidth: y(t.maxWidth.value),
|
|
107
|
+
minWidth: y(t.minWidth.value),
|
|
108
|
+
height: y(t.height.value),
|
|
109
|
+
maxHeight: y(t.maxHeight.value),
|
|
110
|
+
minHeight: y(t.minHeight.value),
|
|
111
|
+
transform: `translate(${g.value}px, ${x.value}px)`
|
|
112
|
+
})), Q = p(() => ({
|
|
113
|
+
width: s.value,
|
|
59
114
|
height: r.value,
|
|
60
115
|
zIndex: t.zIndex.value,
|
|
61
|
-
translateX:
|
|
62
|
-
translateY:
|
|
116
|
+
translateX: g.value,
|
|
117
|
+
translateY: x.value
|
|
63
118
|
}));
|
|
64
|
-
|
|
65
|
-
window.setTimeout(
|
|
66
|
-
}),
|
|
67
|
-
|
|
119
|
+
M(A.COMPUTED_VIEW_STYLE, Q), Y(() => {
|
|
120
|
+
window.setTimeout(L, t.animationDuration.value);
|
|
121
|
+
}), oe(() => {
|
|
122
|
+
L();
|
|
68
123
|
});
|
|
69
|
-
async function
|
|
70
|
-
await
|
|
71
|
-
const
|
|
72
|
-
|
|
124
|
+
async function L() {
|
|
125
|
+
await se();
|
|
126
|
+
const c = e.value?.getBoundingClientRect();
|
|
127
|
+
c && (s.value = c.width, r.value = c.height);
|
|
73
128
|
}
|
|
74
|
-
function c
|
|
75
|
-
return typeof
|
|
129
|
+
function y(c) {
|
|
130
|
+
return typeof c == "number" ? `${c}px` : c;
|
|
76
131
|
}
|
|
77
|
-
return (
|
|
78
|
-
class: "popup-view
|
|
79
|
-
style:
|
|
132
|
+
return (c, ze) => (h(), N("div", {
|
|
133
|
+
class: "popup-view",
|
|
134
|
+
style: V(K.value),
|
|
135
|
+
ref_key: "popupViewRef",
|
|
136
|
+
ref: e
|
|
80
137
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
ref_key: "popupViewRef",
|
|
85
|
-
ref: e
|
|
86
|
-
}, [
|
|
87
|
-
(d(), A(L(u.value), F({
|
|
88
|
-
key: `${p(n).name}-component`
|
|
89
|
-
}, p(t).componentProps), null, 16))
|
|
90
|
-
], 4)
|
|
138
|
+
(h(), T(re(u.value), ae({
|
|
139
|
+
key: `${P(o).name}-component`
|
|
140
|
+
}, P(t).componentProps), null, 16))
|
|
91
141
|
], 4));
|
|
92
142
|
}
|
|
93
|
-
}),
|
|
94
|
-
name: "
|
|
95
|
-
__name: "
|
|
96
|
-
props: {
|
|
97
|
-
type: {},
|
|
98
|
-
duration: {}
|
|
99
|
-
},
|
|
100
|
-
setup(o) {
|
|
101
|
-
z((u) => ({
|
|
102
|
-
v9a56ef92: r.value
|
|
103
|
-
}));
|
|
104
|
-
const e = v(E.INSTANCE_STORE), n = h(!1), t = a(
|
|
105
|
-
() => `vue-popup-plus-animation vue-popup-plus-animation-enter-${o.type}`
|
|
106
|
-
), i = a(
|
|
107
|
-
() => `vue-popup-plus-animation vue-popup-plus-animation-leave-${o.type}`
|
|
108
|
-
), r = a(() => `${o.duration}ms`);
|
|
109
|
-
return b(() => {
|
|
110
|
-
n.value = !0;
|
|
111
|
-
}), (u, m) => (d(), A(X, {
|
|
112
|
-
"enter-active-class": t.value,
|
|
113
|
-
"leave-active-class": i.value
|
|
114
|
-
}, {
|
|
115
|
-
default: S(() => [
|
|
116
|
-
n.value && !p(e).isBeforeUnmount.value ? j(u.$slots, "default", {
|
|
117
|
-
key: 0,
|
|
118
|
-
style: g({ animationDuration: `${o.duration}ms` })
|
|
119
|
-
}) : D("", !0)
|
|
120
|
-
]),
|
|
121
|
-
_: 3
|
|
122
|
-
}, 8, ["enter-active-class", "leave-active-class"]));
|
|
123
|
-
}
|
|
124
|
-
}), T = /* @__PURE__ */ P({
|
|
125
|
-
name: "Popup",
|
|
126
|
-
__name: "Popup",
|
|
143
|
+
}), Ie = /* @__PURE__ */ F(Ce, [["__scopeId", "data-v-bbc1055f"]]), xe = { class: "popup-instance" }, O = /* @__PURE__ */ C({
|
|
144
|
+
name: "PopupInstance",
|
|
145
|
+
__name: "PopupInstance",
|
|
127
146
|
props: {
|
|
128
147
|
store: {}
|
|
129
148
|
},
|
|
130
|
-
setup(
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
type:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
149
|
+
setup(n) {
|
|
150
|
+
return M(A.INSTANCE_ID, n.store.id), M(I.INSTANCE_STORE, n.store), (e, o) => (h(), T(ie, {
|
|
151
|
+
to: n.store.appendTo
|
|
152
|
+
}, [
|
|
153
|
+
ue("div", xe, [
|
|
154
|
+
n.store.mask ? (h(), T(B, {
|
|
155
|
+
key: 0,
|
|
156
|
+
duration: n.store.animationDuration.value,
|
|
157
|
+
type: n.store.maskAnimation.value
|
|
158
|
+
}, {
|
|
159
|
+
default: S(() => [
|
|
160
|
+
E(Pe)
|
|
161
|
+
]),
|
|
162
|
+
_: 1
|
|
163
|
+
}, 8, ["duration", "type"])) : H("", !0),
|
|
164
|
+
E(_e, {
|
|
165
|
+
placement: n.store.placement.value,
|
|
166
|
+
zIndex: n.store.zIndex.value
|
|
167
|
+
}, {
|
|
168
|
+
default: S(() => [
|
|
169
|
+
E(B, {
|
|
170
|
+
duration: n.store.animationDuration.value,
|
|
171
|
+
type: n.store.viewAnimation.value
|
|
172
|
+
}, {
|
|
173
|
+
default: S(() => [
|
|
174
|
+
E(Ie)
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}, 8, ["duration", "type"])
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
}, 8, ["placement", "zIndex"])
|
|
181
|
+
])
|
|
182
|
+
], 8, ["to"]));
|
|
183
|
+
}
|
|
184
|
+
}), Ee = (n, {
|
|
154
185
|
component: e,
|
|
155
|
-
componentProps:
|
|
186
|
+
componentProps: o,
|
|
156
187
|
onMounted: t,
|
|
157
|
-
onUnmounted:
|
|
188
|
+
onUnmounted: s,
|
|
158
189
|
appendTo: r,
|
|
159
190
|
mask: u,
|
|
160
191
|
maskClickClose: m,
|
|
161
|
-
disableScroll:
|
|
162
|
-
...
|
|
192
|
+
disableScroll: f,
|
|
193
|
+
...g
|
|
163
194
|
}) => ({
|
|
164
|
-
id:
|
|
165
|
-
parentElement:
|
|
195
|
+
id: n,
|
|
196
|
+
parentElement: $e(r),
|
|
166
197
|
appendTo: r,
|
|
167
198
|
mask: u,
|
|
168
199
|
maskClickClose: m,
|
|
169
|
-
disableScroll:
|
|
200
|
+
disableScroll: f,
|
|
170
201
|
component: e,
|
|
171
|
-
componentProps:
|
|
202
|
+
componentProps: o,
|
|
172
203
|
onMounted: t,
|
|
173
|
-
onUnmounted:
|
|
174
|
-
isBeforeUnmount:
|
|
175
|
-
...q(
|
|
204
|
+
onUnmounted: s,
|
|
205
|
+
isBeforeUnmount: $(!1),
|
|
206
|
+
...le(q(g))
|
|
176
207
|
});
|
|
177
|
-
function
|
|
178
|
-
return typeof
|
|
208
|
+
function $e(n) {
|
|
209
|
+
return typeof n == "string" && (n = document.querySelector(n) || document.body), n;
|
|
179
210
|
}
|
|
180
|
-
class
|
|
181
|
-
|
|
211
|
+
class Te {
|
|
212
|
+
_seed;
|
|
182
213
|
get seed() {
|
|
183
|
-
return this
|
|
214
|
+
return this._seed;
|
|
184
215
|
}
|
|
185
216
|
get name() {
|
|
186
217
|
return `vue-popup-plus-instance-${this.seed}`;
|
|
187
218
|
}
|
|
188
219
|
constructor(e) {
|
|
189
|
-
this
|
|
220
|
+
this._seed = e;
|
|
190
221
|
}
|
|
191
222
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
#i;
|
|
195
|
-
#e;
|
|
223
|
+
var j = /* @__PURE__ */ ((n) => (n.ROOT_COMPONENT = "RootComponent", n.APP = "App", n.VNODE = "VNode", n))(j || {});
|
|
224
|
+
class Ne {
|
|
196
225
|
#n;
|
|
197
|
-
|
|
226
|
+
_id;
|
|
227
|
+
_store;
|
|
228
|
+
renderType;
|
|
229
|
+
#e;
|
|
198
230
|
#o;
|
|
231
|
+
#t;
|
|
199
232
|
get id() {
|
|
200
|
-
return this
|
|
233
|
+
return this._id;
|
|
201
234
|
}
|
|
202
235
|
get store() {
|
|
203
|
-
return this
|
|
204
|
-
}
|
|
205
|
-
get renderType() {
|
|
206
|
-
return this.#t.config.debugMode ? "app" : "vnode";
|
|
236
|
+
return this._store;
|
|
207
237
|
}
|
|
208
|
-
constructor(e,
|
|
209
|
-
this.#
|
|
238
|
+
constructor(e, o) {
|
|
239
|
+
this.#n = e, this._id = new Te(e.seed), this._store = Ee(this._id, o), this.renderType = e.isRootComponentRegistered ? "RootComponent" : e.config.debugMode ? "App" : "VNode";
|
|
210
240
|
}
|
|
211
241
|
mount() {
|
|
212
|
-
return this.#
|
|
242
|
+
return this.renderType === "App" ? (this.#t = document.createElement("div"), this.#e = ce(O, { store: this._store }), this.#e._context.components = this.#n.app._context.components, this.#e._context.provides = this.#n.app._context.provides, this.#e._context.config = this.#n.app._context.config, this.#e._context.directives = this.#n.app._context.directives, this.#e._context.mixins = this.#n.app._context.mixins, this.#e.mount(this.#t), this._store.parentElement.appendChild(this.#t)) : this.renderType === "VNode" && (this.#t = document.createElement("div"), this.#o = E(O, {
|
|
243
|
+
store: this._store
|
|
244
|
+
}), this.#o.appContext = this.#n.app._context, this.#o.appContext.components.Popup = O, U(this.#o, this.#t), this._store.parentElement.appendChild(this.#t)), this.#n.addInstance(this), this._store.onMounted(), this.id;
|
|
213
245
|
}
|
|
214
246
|
async unmount(e) {
|
|
215
|
-
this
|
|
247
|
+
this._store.isBeforeUnmount.value = !0, await ge(this._store.animationDuration.value), this.renderType === "App" ? (this.#e.unmount(), this._store.parentElement.removeChild(this.#t)) : this.renderType === "VNode" && (U(null, this.#t), this._store.parentElement.removeChild(this.#t)), this.#n.removeInstance(this), this._store.onUnmounted(e);
|
|
216
248
|
}
|
|
217
249
|
update(e) {
|
|
218
|
-
for (const
|
|
219
|
-
const t =
|
|
220
|
-
this
|
|
250
|
+
for (const o in e) {
|
|
251
|
+
const t = o, s = e[t] === void 0 ? this._store[t].value : e[t];
|
|
252
|
+
this._store[t].value = s;
|
|
221
253
|
}
|
|
222
254
|
}
|
|
223
255
|
}
|
|
224
|
-
class
|
|
225
|
-
constructor(e) {
|
|
226
|
-
super(e);
|
|
227
|
-
}
|
|
228
|
-
toString() {
|
|
229
|
-
return `vue-popup-plus error: ${this.message}`;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
class ae {
|
|
256
|
+
class Se {
|
|
233
257
|
get NONE() {
|
|
234
258
|
return "none";
|
|
235
259
|
}
|
|
@@ -257,54 +281,205 @@ class ae {
|
|
|
257
281
|
constructor() {
|
|
258
282
|
}
|
|
259
283
|
}
|
|
260
|
-
const
|
|
261
|
-
|
|
284
|
+
const _ = new Se(), Oe = "1.5.0", b = Oe, a = {
|
|
285
|
+
/**
|
|
286
|
+
* 成功日志
|
|
287
|
+
*/
|
|
288
|
+
Success: "success",
|
|
289
|
+
/**
|
|
290
|
+
* 信息日志
|
|
291
|
+
*/
|
|
292
|
+
Info: "info",
|
|
293
|
+
/**
|
|
294
|
+
* 警告日志
|
|
295
|
+
*/
|
|
296
|
+
Warning: "warning",
|
|
297
|
+
/**
|
|
298
|
+
* 错误日志
|
|
299
|
+
*/
|
|
300
|
+
Error: "error"
|
|
301
|
+
}, i = {
|
|
302
|
+
/**
|
|
303
|
+
* 默认类型
|
|
304
|
+
*/
|
|
305
|
+
Default: "default",
|
|
306
|
+
/**
|
|
307
|
+
* 数据类型
|
|
308
|
+
*/
|
|
309
|
+
Data: "data"
|
|
310
|
+
};
|
|
311
|
+
class d {
|
|
312
|
+
namespace = "VuePopupPlus";
|
|
313
|
+
type;
|
|
314
|
+
caller;
|
|
315
|
+
message;
|
|
316
|
+
group;
|
|
317
|
+
get hasCaller() {
|
|
318
|
+
return !!this.caller;
|
|
319
|
+
}
|
|
320
|
+
get hasGroup() {
|
|
321
|
+
return !!this.group.length;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* 创建日志实例
|
|
325
|
+
*
|
|
326
|
+
* @param type 日志类型
|
|
327
|
+
* @param name 日志名称
|
|
328
|
+
* @param message 日志消息
|
|
329
|
+
* @param group 日志组
|
|
330
|
+
* @returns 日志实例
|
|
331
|
+
*/
|
|
332
|
+
constructor({
|
|
333
|
+
type: e = a.Info,
|
|
334
|
+
caller: o = "",
|
|
335
|
+
message: t = "",
|
|
336
|
+
group: s = []
|
|
337
|
+
} = {}) {
|
|
338
|
+
this.type = e, this.caller = o, this.message = t, this.group = s, this.group.unshift({
|
|
339
|
+
type: i.Default,
|
|
340
|
+
message: `核心版本: ${b}`
|
|
341
|
+
}), this.hasCaller && this.group.unshift({
|
|
342
|
+
type: i.Default,
|
|
343
|
+
message: `调用者: ${this.caller}`
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const l = (n) => {
|
|
348
|
+
const e = J();
|
|
349
|
+
e?.config.debugMode && e.config.logHandler(n);
|
|
350
|
+
}, X = (n) => {
|
|
351
|
+
const e = k({
|
|
352
|
+
printer: console.groupCollapsed,
|
|
353
|
+
type: n.type,
|
|
354
|
+
hasPrefix: !0
|
|
355
|
+
}), o = k({
|
|
356
|
+
printer: console.log,
|
|
357
|
+
type: n.type,
|
|
358
|
+
isGroupContent: !0
|
|
359
|
+
}), t = k({
|
|
360
|
+
printer: De(n.type),
|
|
361
|
+
type: n.type,
|
|
362
|
+
hasPrefix: !0
|
|
363
|
+
}), s = `${n.namespace} ${n.type.toUpperCase()}`, r = n.message;
|
|
364
|
+
n.hasGroup ? (e(s, r), n.group?.forEach((u, m) => {
|
|
365
|
+
m === 0 && n.hasCaller ? o(u.message, "") : u.type === void 0 || u.type === i.Default ? o(u.message) : u.type === i.Data && (o(
|
|
366
|
+
`${u.dataName} : ${u.dataType ?? "any"} ( ${fe(u.dataValue)} )`
|
|
367
|
+
), console.dir(u.dataValue));
|
|
368
|
+
}), console.groupEnd()) : t(s, r);
|
|
369
|
+
};
|
|
370
|
+
function De(n) {
|
|
371
|
+
switch (n) {
|
|
372
|
+
case a.Success:
|
|
373
|
+
return console.log;
|
|
374
|
+
case a.Info:
|
|
375
|
+
default:
|
|
376
|
+
return console.log;
|
|
377
|
+
case a.Warning:
|
|
378
|
+
return console.warn;
|
|
379
|
+
case a.Error:
|
|
380
|
+
return console.error;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const Re = {
|
|
384
|
+
[a.Success]: "#4caf50",
|
|
385
|
+
[a.Info]: "#3499fe",
|
|
386
|
+
[a.Warning]: "#e6a23c",
|
|
387
|
+
[a.Error]: "#f56c6c"
|
|
388
|
+
}, k = function({
|
|
389
|
+
printer: n,
|
|
390
|
+
type: e,
|
|
391
|
+
hasPrefix: o = !1,
|
|
392
|
+
isGroupContent: t = !1
|
|
393
|
+
}) {
|
|
394
|
+
const s = Re[e], r = `color: #FFFFFF;background-color: ${s};padding: 4px 8px;margin-right: 6px;border-radius: 4px;font-weight: 700;`, u = `background-color: ${s}22;padding: 4px 8px;border-radius: 4px;font-weight: 400;`, m = `color: ${s};background-color: ${s}22;padding: 4px 8px;border-radius: 4px;font-weight: 400;`;
|
|
395
|
+
return o ? (f, g, x = "") => {
|
|
396
|
+
n(
|
|
397
|
+
`%c${f}%c${g}`,
|
|
398
|
+
r,
|
|
399
|
+
(t ? m : u) + x
|
|
400
|
+
);
|
|
401
|
+
} : (f, g = "") => {
|
|
402
|
+
n(
|
|
403
|
+
`%c${f}`,
|
|
404
|
+
(t ? m : u) + g
|
|
405
|
+
);
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
class v extends Error {
|
|
409
|
+
/**
|
|
410
|
+
* 弹出层错误类
|
|
411
|
+
*
|
|
412
|
+
* - 建议从 {@link ILog} 日志实例创建错误
|
|
413
|
+
* @param {ErrorOption} options 错误参数
|
|
414
|
+
* @example
|
|
415
|
+
* new PopupError(new Log({
|
|
416
|
+
* type: LogType.Error,
|
|
417
|
+
* caller: 'controller.render()',
|
|
418
|
+
* message: '弹出层渲染失败',
|
|
419
|
+
* }))
|
|
420
|
+
*/
|
|
421
|
+
constructor({ namespace: e, caller: o, message: t }) {
|
|
422
|
+
super(), this.message = `[${e} error] ${o}: ${t}`;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const Ye = (n) => n, Ae = (n) => new Proxy(
|
|
426
|
+
n,
|
|
262
427
|
{
|
|
263
|
-
set(e,
|
|
264
|
-
|
|
428
|
+
set(e, o, t) {
|
|
429
|
+
const s = new d({
|
|
430
|
+
caller: "definePlugin()",
|
|
431
|
+
message: `${o} 是只读属性,不能被覆盖`
|
|
432
|
+
});
|
|
433
|
+
throw l(s), new v(s);
|
|
265
434
|
},
|
|
266
|
-
get(e,
|
|
267
|
-
return
|
|
435
|
+
get(e, o) {
|
|
436
|
+
return o === "customProperties" ? be(n) : o === "customAnimations" ? Ve() : n[o];
|
|
268
437
|
}
|
|
269
438
|
}
|
|
270
439
|
);
|
|
271
|
-
function
|
|
440
|
+
function be(n) {
|
|
272
441
|
return new Proxy(
|
|
273
442
|
{},
|
|
274
443
|
{
|
|
275
|
-
set: (e,
|
|
276
|
-
if (
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
444
|
+
set: (e, o, t) => {
|
|
445
|
+
if (o in n) {
|
|
446
|
+
const s = new d({
|
|
447
|
+
caller: "definePlugin()",
|
|
448
|
+
message: `定义插件扩展属性 ${o} 时失败,${o} 是只读属性,不能被覆盖`
|
|
449
|
+
});
|
|
450
|
+
throw l(s), new v(s);
|
|
451
|
+
}
|
|
452
|
+
return n.__proto__[o] = t, !0;
|
|
281
453
|
},
|
|
282
|
-
get: (e,
|
|
283
|
-
if (
|
|
284
|
-
return
|
|
454
|
+
get: (e, o) => {
|
|
455
|
+
if (o in n)
|
|
456
|
+
return n.__proto__[o];
|
|
285
457
|
}
|
|
286
458
|
}
|
|
287
459
|
);
|
|
288
460
|
}
|
|
289
|
-
function
|
|
461
|
+
function Ve(n) {
|
|
290
462
|
return new Proxy(
|
|
291
463
|
{},
|
|
292
464
|
{
|
|
293
|
-
set: (e,
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
465
|
+
set: (e, o, t) => {
|
|
466
|
+
if (o in _) {
|
|
467
|
+
const s = new d({
|
|
468
|
+
caller: "definePlugin()",
|
|
469
|
+
message: `定义插件扩展动画类型 ${o} 时失败,${o} 是只读属性,不能被覆盖`
|
|
470
|
+
});
|
|
471
|
+
throw l(s), new v(s);
|
|
472
|
+
}
|
|
473
|
+
return _.__proto__[o] = t, !0;
|
|
299
474
|
},
|
|
300
|
-
get: (e,
|
|
301
|
-
if (
|
|
302
|
-
return
|
|
475
|
+
get: (e, o) => {
|
|
476
|
+
if (o in _)
|
|
477
|
+
return _.__proto__[o];
|
|
303
478
|
}
|
|
304
479
|
}
|
|
305
480
|
);
|
|
306
481
|
}
|
|
307
|
-
const
|
|
482
|
+
const ke = {
|
|
308
483
|
appendTo: document.body,
|
|
309
484
|
mask: !0,
|
|
310
485
|
maskClickClose: !1,
|
|
@@ -320,92 +495,285 @@ const pe = "1.4.0", de = {
|
|
|
320
495
|
height: "auto",
|
|
321
496
|
maxHeight: "auto",
|
|
322
497
|
minHeight: "auto",
|
|
498
|
+
placement: "center",
|
|
323
499
|
viewTranslateX: 0,
|
|
324
500
|
viewTranslateY: 0,
|
|
325
501
|
viewTranslateOverflow: !1,
|
|
326
|
-
viewAnimation:
|
|
327
|
-
maskAnimation:
|
|
502
|
+
viewAnimation: _.FADE,
|
|
503
|
+
maskAnimation: _.FADE,
|
|
328
504
|
maskBlur: !0,
|
|
329
505
|
animationDuration: 100
|
|
330
506
|
};
|
|
331
|
-
class
|
|
507
|
+
class Me {
|
|
332
508
|
_core;
|
|
509
|
+
get isInstalled() {
|
|
510
|
+
return !!this._core.app;
|
|
511
|
+
}
|
|
333
512
|
get version() {
|
|
334
|
-
return
|
|
513
|
+
return b;
|
|
335
514
|
}
|
|
336
515
|
constructor(e) {
|
|
337
516
|
this._core = e;
|
|
338
517
|
}
|
|
339
518
|
install(e) {
|
|
340
|
-
e.config.globalProperties[this._core.config.prototypeName] = this, this._core.app = e;
|
|
341
|
-
}
|
|
342
|
-
use(e,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
519
|
+
e.config.globalProperties[this._core.config.prototypeName] = this, this._core.app = e, e.provide(I.CORE, this._core);
|
|
520
|
+
}
|
|
521
|
+
use(e, o) {
|
|
522
|
+
const t = new d({
|
|
523
|
+
type: a.Success,
|
|
524
|
+
caller: "popup.use()",
|
|
525
|
+
group: [
|
|
526
|
+
{
|
|
527
|
+
type: i.Default,
|
|
528
|
+
message: `插件名称: ${e.name}`
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
type: i.Default,
|
|
532
|
+
message: `插件作者: ${e.author ?? "未知(可能存在安全风险)"}`
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: i.Default,
|
|
536
|
+
message: `插件要求最低核心版本: ${e.requiredCoreVersion?.min ?? "-"}`
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
type: i.Default,
|
|
540
|
+
message: `插件要求最高核心版本: ${e.requiredCoreVersion?.max ?? "-"}`
|
|
541
|
+
}
|
|
542
|
+
]
|
|
543
|
+
});
|
|
544
|
+
if (!this._core.addPlugin(e)) {
|
|
545
|
+
t.type = a.Error, t.message = `注册插件 ${e.name} 失败,已存在同名插件 ${e.name}`, l(t);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
const s = e.requiredCoreVersion?.min || e.requiredCoreVersion?.max;
|
|
549
|
+
if (s)
|
|
550
|
+
if (We(e))
|
|
551
|
+
t.group.push({
|
|
552
|
+
type: i.Default,
|
|
553
|
+
message: "插件版本校验: 通过"
|
|
554
|
+
});
|
|
555
|
+
else {
|
|
556
|
+
t.type = a.Error, t.message = `注册插件 ${e.name} 失败,未通过核心版本校验`, t.group.push({
|
|
557
|
+
type: i.Default,
|
|
558
|
+
message: "插件版本校验: 未通过"
|
|
559
|
+
}), l(t);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
else
|
|
563
|
+
t.group.push({
|
|
564
|
+
type: i.Default,
|
|
565
|
+
message: "插件版本校验: 未校验(可能存在兼容性问题)"
|
|
566
|
+
});
|
|
567
|
+
t.group.push({
|
|
568
|
+
type: i.Data,
|
|
569
|
+
dataName: "插件注册选项",
|
|
570
|
+
dataValue: o,
|
|
571
|
+
dataType: "PluginOption"
|
|
572
|
+
}), e.install(Ae(this), this._core.config, o);
|
|
573
|
+
const r = e.author !== void 0;
|
|
574
|
+
!s || !r ? (t.type = a.Warning, t.message = `注册插件 ${e.name} 成功,但可能存在风险`) : (t.type = a.Success, t.message = `注册插件 ${e.name} 成功`), l(t);
|
|
575
|
+
}
|
|
576
|
+
render({ zIndex: e, ...o }) {
|
|
577
|
+
const t = new d({
|
|
578
|
+
type: a.Info,
|
|
579
|
+
caller: "popup.render()"
|
|
580
|
+
});
|
|
581
|
+
if (!this.isInstalled)
|
|
582
|
+
throw t.type = a.Error, t.message = "渲染弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
|
|
350
583
|
e = e ?? this._core.config.zIndex++;
|
|
351
|
-
const
|
|
352
|
-
...
|
|
353
|
-
...
|
|
584
|
+
const s = {
|
|
585
|
+
...ke,
|
|
586
|
+
...o,
|
|
354
587
|
zIndex: e
|
|
588
|
+
}, r = new Ne(this._core, s);
|
|
589
|
+
return r.mount(), r.renderType !== j.ROOT_COMPONENT && l(
|
|
590
|
+
new d({
|
|
591
|
+
type: a.Warning,
|
|
592
|
+
caller: "popup.render()",
|
|
593
|
+
message: `渲染弹出层 ${r.id.name} 未使用 PopupRoot 根组件渲染,无法同步应用上下文`,
|
|
594
|
+
group: [
|
|
595
|
+
{
|
|
596
|
+
type: i.Default,
|
|
597
|
+
message: "修复建议:使用 PopupRoot 根组件包裹 App 组件以同步应用上下文"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
type: i.Default,
|
|
601
|
+
message: `帮助文档:${ve}/guide/initialization.html#同步应用上下文`
|
|
602
|
+
}
|
|
603
|
+
]
|
|
604
|
+
})
|
|
605
|
+
), t.message = `渲染弹出层 ${r.id.name} 成功`, t.group.push({
|
|
606
|
+
type: i.Default,
|
|
607
|
+
message: `渲染方式:${r.renderType}`
|
|
608
|
+
}), t.group.push({
|
|
609
|
+
type: i.Data,
|
|
610
|
+
dataName: "instanceId",
|
|
611
|
+
dataValue: r.id,
|
|
612
|
+
dataType: "InstanceId"
|
|
613
|
+
}), t.group.push({
|
|
614
|
+
type: i.Data,
|
|
615
|
+
dataName: "options",
|
|
616
|
+
dataValue: arguments[0],
|
|
617
|
+
dataType: "RenderOption"
|
|
618
|
+
}), t.group.push({
|
|
619
|
+
type: i.Data,
|
|
620
|
+
dataName: "mergedOptions",
|
|
621
|
+
dataValue: s,
|
|
622
|
+
dataType: "RenderOption"
|
|
623
|
+
}), l(t), r.id;
|
|
624
|
+
}
|
|
625
|
+
update(e, o) {
|
|
626
|
+
const t = new d({
|
|
627
|
+
type: a.Info,
|
|
628
|
+
caller: "popup.update()"
|
|
355
629
|
});
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
630
|
+
if (!this.isInstalled)
|
|
631
|
+
throw t.type = a.Error, t.message = "更新弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
|
|
632
|
+
const s = this._core.getInstance(e);
|
|
633
|
+
s && (s.update(o), t.message = `更新弹出层 ${s.id.name} 成功`, t.group.push({
|
|
634
|
+
type: i.Data,
|
|
635
|
+
dataName: "instanceId",
|
|
636
|
+
dataValue: s.id,
|
|
637
|
+
dataType: "InstanceId"
|
|
638
|
+
}), t.group.push({
|
|
639
|
+
type: i.Data,
|
|
640
|
+
dataName: "options",
|
|
641
|
+
dataValue: o,
|
|
642
|
+
dataType: "UpdateOption"
|
|
643
|
+
}), l(t));
|
|
644
|
+
}
|
|
645
|
+
async destroy(e, o) {
|
|
646
|
+
const t = new d({
|
|
647
|
+
type: a.Info,
|
|
648
|
+
caller: "popup.destroy()"
|
|
649
|
+
});
|
|
650
|
+
if (!this.isInstalled)
|
|
651
|
+
throw t.type = a.Error, t.message = "销毁弹出层失败,请先调用 app.use() 注册插件", l(t), new v(t);
|
|
652
|
+
const s = this._core.getInstance(e);
|
|
653
|
+
if (!s) {
|
|
654
|
+
t.type = a.Warning, t.message = `销毁弹出层 ${e.name} 失败,弹出层不存在`, l(t);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
await s.unmount(o), t.message = `销毁弹出层 ${s.id.name} 成功`, t.group.push({
|
|
658
|
+
type: i.Data,
|
|
659
|
+
dataName: "instanceId",
|
|
660
|
+
dataValue: s.id,
|
|
661
|
+
dataType: "InstanceId"
|
|
662
|
+
}), t.group.push({
|
|
663
|
+
type: i.Data,
|
|
664
|
+
dataName: "payload",
|
|
665
|
+
dataValue: o,
|
|
666
|
+
dataType: "any"
|
|
667
|
+
}), l(t);
|
|
365
668
|
}
|
|
366
669
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return
|
|
670
|
+
function We(n) {
|
|
671
|
+
const { requiredCoreVersion: e } = n, { min: o, max: t } = e ?? {};
|
|
672
|
+
return !(o && b < o || t && b > t);
|
|
673
|
+
}
|
|
674
|
+
const D = "PopupRoot", He = /* @__PURE__ */ C({
|
|
675
|
+
PopupRootComponentName: D,
|
|
676
|
+
__name: "PopupRoot",
|
|
677
|
+
setup(n) {
|
|
678
|
+
const e = w(I.CORE);
|
|
679
|
+
if (!e) {
|
|
680
|
+
const t = new d({
|
|
681
|
+
type: a.Error,
|
|
682
|
+
caller: "PopupRoot",
|
|
683
|
+
message: "根组件初始化失败,请先调用 createPopup() 方法"
|
|
684
|
+
});
|
|
685
|
+
throw l(t), new v(t);
|
|
686
|
+
}
|
|
687
|
+
const o = e?.instances || {};
|
|
688
|
+
return pe(() => {
|
|
689
|
+
e?.registerRootComponent();
|
|
690
|
+
}), de(() => {
|
|
691
|
+
e?.unregisterRootComponent();
|
|
692
|
+
}), (t, s) => (h(), N(z, null, [
|
|
693
|
+
W(t.$slots, "default"),
|
|
694
|
+
(h(!0), N(z, null, me(P(o), (r) => (h(), T(O, {
|
|
695
|
+
key: r.id.name,
|
|
696
|
+
store: r.store
|
|
697
|
+
}, null, 8, ["store"]))), 128))
|
|
698
|
+
], 64));
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
let G = null;
|
|
702
|
+
function Fe(n) {
|
|
703
|
+
return new Le(n);
|
|
370
704
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
705
|
+
function J() {
|
|
706
|
+
return G;
|
|
373
707
|
}
|
|
374
|
-
class
|
|
708
|
+
class Le {
|
|
375
709
|
app;
|
|
376
|
-
#
|
|
377
|
-
#
|
|
378
|
-
#
|
|
379
|
-
#
|
|
710
|
+
#n = 1;
|
|
711
|
+
#e = q({});
|
|
712
|
+
#o;
|
|
713
|
+
#t;
|
|
380
714
|
#r = {};
|
|
381
|
-
#
|
|
715
|
+
#a = "";
|
|
716
|
+
#s = 0;
|
|
382
717
|
get seed() {
|
|
383
|
-
return this.#
|
|
718
|
+
return this.#n++;
|
|
384
719
|
}
|
|
385
720
|
get config() {
|
|
386
|
-
return this.#
|
|
721
|
+
return this.#t;
|
|
387
722
|
}
|
|
388
723
|
get controller() {
|
|
724
|
+
return this.#o;
|
|
725
|
+
}
|
|
726
|
+
get instances() {
|
|
389
727
|
return this.#e;
|
|
390
728
|
}
|
|
729
|
+
get isRootComponentRegistered() {
|
|
730
|
+
return this.#s > 0;
|
|
731
|
+
}
|
|
391
732
|
constructor({
|
|
392
733
|
zIndex: e = 1e3,
|
|
393
|
-
prototypeName:
|
|
734
|
+
prototypeName: o = "$popup",
|
|
394
735
|
autoDisableScroll: t = !0,
|
|
395
|
-
|
|
736
|
+
logHandler: s = X,
|
|
737
|
+
debugMode: r = !1
|
|
396
738
|
} = {}) {
|
|
397
|
-
this.#
|
|
739
|
+
this.#t = {
|
|
740
|
+
zIndex: e,
|
|
741
|
+
prototypeName: o,
|
|
742
|
+
autoDisableScroll: t,
|
|
743
|
+
logHandler: s,
|
|
744
|
+
debugMode: r
|
|
745
|
+
}, this.#o = new Me(this), G = this;
|
|
746
|
+
}
|
|
747
|
+
registerRootComponent() {
|
|
748
|
+
if (this.#s > 0) {
|
|
749
|
+
const e = new d({
|
|
750
|
+
caller: "core",
|
|
751
|
+
type: a.Warning,
|
|
752
|
+
message: `检测到同时存在 ${this.#s + 1} 个 ${D} 根组件实例`,
|
|
753
|
+
group: [
|
|
754
|
+
{
|
|
755
|
+
type: i.Default,
|
|
756
|
+
message: `修改建议:${D} 根组件同一时刻应当只存在一个实例,请移除多余的 ${D} 根组件`
|
|
757
|
+
}
|
|
758
|
+
]
|
|
759
|
+
});
|
|
760
|
+
l(e);
|
|
761
|
+
}
|
|
762
|
+
this.#s++;
|
|
763
|
+
}
|
|
764
|
+
unregisterRootComponent() {
|
|
765
|
+
this.#s--;
|
|
398
766
|
}
|
|
399
767
|
addInstance(e) {
|
|
400
|
-
this.#
|
|
768
|
+
this.#e[e.id.name] = he(e), this.config.autoDisableScroll && e.store.disableScroll && this.#i();
|
|
401
769
|
}
|
|
402
770
|
getInstance(e) {
|
|
403
|
-
return this.#
|
|
771
|
+
return this.#e[e.name];
|
|
404
772
|
}
|
|
405
773
|
removeInstance(e) {
|
|
406
|
-
delete this.#
|
|
407
|
-
(
|
|
408
|
-
).length === 0 && this.#
|
|
774
|
+
delete this.#e[e.id.name], Object.values(this.#e).filter(
|
|
775
|
+
(o) => o.store.disableScroll
|
|
776
|
+
).length === 0 && this.#u();
|
|
409
777
|
}
|
|
410
778
|
addPlugin(e) {
|
|
411
779
|
return this.getPlugin(e.name) ? !1 : (this.#r[e.name] = e, !0);
|
|
@@ -416,29 +784,39 @@ class fe {
|
|
|
416
784
|
removePlugin(e) {
|
|
417
785
|
delete this.#r[e];
|
|
418
786
|
}
|
|
419
|
-
#
|
|
420
|
-
document.body.style.overflow !== "hidden" && (this.#
|
|
787
|
+
#i() {
|
|
788
|
+
document.body.style.overflow !== "hidden" && (this.#a = document.body.style.overflow, document.body.style.overflow = "hidden");
|
|
421
789
|
}
|
|
422
|
-
#
|
|
423
|
-
this.config.autoDisableScroll && (document.body.style.overflow = this.#
|
|
790
|
+
#u() {
|
|
791
|
+
this.config.autoDisableScroll && (document.body.style.overflow = this.#a);
|
|
424
792
|
}
|
|
425
793
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
794
|
+
function qe(n) {
|
|
795
|
+
return Fe(n).controller;
|
|
428
796
|
}
|
|
429
|
-
function
|
|
430
|
-
const
|
|
431
|
-
if (!
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
797
|
+
function Ue() {
|
|
798
|
+
const n = J();
|
|
799
|
+
if (!n) {
|
|
800
|
+
const e = new d({
|
|
801
|
+
type: a.Error,
|
|
802
|
+
caller: "usePopup()",
|
|
803
|
+
message: "调用 usePopup() 前请先调用 createPopup() 创建弹出层控制器实例"
|
|
804
|
+
});
|
|
805
|
+
throw X(e), new v(e);
|
|
806
|
+
}
|
|
807
|
+
return n.controller;
|
|
436
808
|
}
|
|
437
809
|
export {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
810
|
+
d as Log,
|
|
811
|
+
i as LogGroupItemType,
|
|
812
|
+
a as LogType,
|
|
813
|
+
_ as POPUP_ANIMATIONS,
|
|
814
|
+
A as POPUP_COMPONENT_INJECTS,
|
|
815
|
+
v as PopupError,
|
|
816
|
+
He as PopupRoot,
|
|
817
|
+
qe as createPopup,
|
|
818
|
+
Ye as definePlugin,
|
|
819
|
+
l as printLog,
|
|
820
|
+
Ue as usePopup,
|
|
821
|
+
b as version
|
|
444
822
|
};
|