167 lines
5.5 KiB
JavaScript
167 lines
5.5 KiB
JavaScript
"use strict";
|
|
var common_vendor = require("../../../../common/vendor.js");
|
|
var uni_modules_wotDesignUni_components_wdPopup_types = require("./types.js");
|
|
require("../common/props.js");
|
|
if (!Math) {
|
|
(wdOverlay + wdIcon + wdTransition + wdRootPortal)();
|
|
}
|
|
const wdIcon = () => "../wd-icon/wd-icon.js";
|
|
const wdOverlay = () => "../wd-overlay/wd-overlay.js";
|
|
const wdTransition = () => "../wd-transition/wd-transition.js";
|
|
const wdRootPortal = () => "../wd-root-portal/wd-root-portal.js";
|
|
const __default__ = {
|
|
name: "wd-popup",
|
|
options: {
|
|
virtualHost: true,
|
|
addGlobalClass: true,
|
|
styleIsolation: "shared"
|
|
}
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
...__default__,
|
|
props: uni_modules_wotDesignUni_components_wdPopup_types.popupProps,
|
|
emits: [
|
|
"update:modelValue",
|
|
"before-enter",
|
|
"enter",
|
|
"before-leave",
|
|
"leave",
|
|
"after-leave",
|
|
"after-enter",
|
|
"click-modal",
|
|
"close"
|
|
],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const transitionName = common_vendor.computed$1(() => {
|
|
if (props.transition) {
|
|
return props.transition;
|
|
}
|
|
if (props.position === "center") {
|
|
return ["zoom-in", "fade"];
|
|
}
|
|
if (props.position === "left") {
|
|
return "slide-left";
|
|
}
|
|
if (props.position === "right") {
|
|
return "slide-right";
|
|
}
|
|
if (props.position === "bottom") {
|
|
return "slide-up";
|
|
}
|
|
if (props.position === "top") {
|
|
return "slide-down";
|
|
}
|
|
return "slide-up";
|
|
});
|
|
const safeBottom = common_vendor.ref(0);
|
|
const style = common_vendor.computed$1(() => {
|
|
return `z-index:${props.zIndex}; padding-bottom: ${safeBottom.value}px;${props.customStyle}`;
|
|
});
|
|
const rootClass = common_vendor.computed$1(() => {
|
|
return `wd-popup wd-popup--${props.position} ${!props.transition && props.position === "center" ? "is-deep" : ""} ${props.customClass || ""}`;
|
|
});
|
|
common_vendor.onBeforeMount(() => {
|
|
if (props.safeAreaInsetBottom) {
|
|
const { safeArea, screenHeight, safeAreaInsets } = common_vendor.index.getSystemInfoSync();
|
|
if (safeArea) {
|
|
safeBottom.value = screenHeight - (safeArea.bottom || 0);
|
|
} else {
|
|
safeBottom.value = 0;
|
|
}
|
|
}
|
|
});
|
|
function handleClickModal() {
|
|
emit("click-modal");
|
|
if (props.closeOnClickModal) {
|
|
close();
|
|
}
|
|
}
|
|
function close() {
|
|
emit("close");
|
|
emit("update:modelValue", false);
|
|
}
|
|
function noop() {
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: _ctx.rootPortal
|
|
}, _ctx.rootPortal ? common_vendor.e({
|
|
b: _ctx.modal
|
|
}, _ctx.modal ? {
|
|
c: common_vendor.o(handleClickModal),
|
|
d: common_vendor.o(noop),
|
|
e: common_vendor.p({
|
|
show: _ctx.modelValue,
|
|
["z-index"]: _ctx.zIndex,
|
|
["lock-scroll"]: _ctx.lockScroll,
|
|
duration: _ctx.duration,
|
|
["custom-style"]: _ctx.modalStyle
|
|
})
|
|
} : {}, {
|
|
f: _ctx.closable
|
|
}, _ctx.closable ? {
|
|
g: common_vendor.o(close),
|
|
h: common_vendor.p({
|
|
["custom-class"]: "wd-popup__close",
|
|
name: "add"
|
|
})
|
|
} : {}, {
|
|
i: common_vendor.o(($event) => emit("before-enter")),
|
|
j: common_vendor.o(($event) => emit("enter")),
|
|
k: common_vendor.o(($event) => emit("after-enter")),
|
|
l: common_vendor.o(($event) => emit("before-leave")),
|
|
m: common_vendor.o(($event) => emit("leave")),
|
|
n: common_vendor.o(($event) => emit("after-leave")),
|
|
o: common_vendor.p({
|
|
["lazy-render"]: _ctx.lazyRender,
|
|
["custom-class"]: common_vendor.unref(rootClass),
|
|
["custom-style"]: common_vendor.unref(style),
|
|
duration: _ctx.duration,
|
|
show: _ctx.modelValue,
|
|
name: common_vendor.unref(transitionName),
|
|
destroy: _ctx.hideWhenClose
|
|
})
|
|
}) : common_vendor.e({
|
|
p: _ctx.modal
|
|
}, _ctx.modal ? {
|
|
q: common_vendor.o(handleClickModal),
|
|
r: common_vendor.o(noop),
|
|
s: common_vendor.p({
|
|
show: _ctx.modelValue,
|
|
["z-index"]: _ctx.zIndex,
|
|
["lock-scroll"]: _ctx.lockScroll,
|
|
duration: _ctx.duration,
|
|
["custom-style"]: _ctx.modalStyle
|
|
})
|
|
} : {}, {
|
|
t: _ctx.closable
|
|
}, _ctx.closable ? {
|
|
v: common_vendor.o(close),
|
|
w: common_vendor.p({
|
|
["custom-class"]: "wd-popup__close",
|
|
name: "add"
|
|
})
|
|
} : {}, {
|
|
x: common_vendor.o(($event) => emit("before-enter")),
|
|
y: common_vendor.o(($event) => emit("enter")),
|
|
z: common_vendor.o(($event) => emit("after-enter")),
|
|
A: common_vendor.o(($event) => emit("before-leave")),
|
|
B: common_vendor.o(($event) => emit("leave")),
|
|
C: common_vendor.o(($event) => emit("after-leave")),
|
|
D: common_vendor.p({
|
|
["lazy-render"]: _ctx.lazyRender,
|
|
["custom-class"]: common_vendor.unref(rootClass),
|
|
["custom-style"]: common_vendor.unref(style),
|
|
duration: _ctx.duration,
|
|
show: _ctx.modelValue,
|
|
name: common_vendor.unref(transitionName),
|
|
destroy: _ctx.hideWhenClose
|
|
})
|
|
}));
|
|
};
|
|
}
|
|
});
|
|
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1bee1693"], ["__file", "D:/\u7F51\u6291\u4E91Time/\u79C1\u6D3B/2000\u7B97\u5366/src/uni_modules/wot-design-uni/components/wd-popup/wd-popup.vue"]]);
|
|
wx.createComponent(Component);
|