init
This commit is contained in:
89
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.js
vendored
Normal file
89
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.js
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
|
||||
const popup = require("../../../../popup.js");
|
||||
const uni_modules_nutuiUni_components_popup_usePopup = require("./use-popup.js");
|
||||
if (!Math) {
|
||||
(NutOverlay + NutIcon + NutTransition)();
|
||||
}
|
||||
const NutIcon = () => "../icon/icon.js";
|
||||
const NutOverlay = () => "../overlay/overlay.js";
|
||||
const NutTransition = () => "../transition/transition.js";
|
||||
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-popup`;
|
||||
const __default__ = common_vendor.defineComponent({
|
||||
name: componentName,
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
});
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: popup.popupProps,
|
||||
emits: popup.popupEmits,
|
||||
setup(__props, { emit: __emit }) {
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const {
|
||||
classes,
|
||||
popStyle,
|
||||
innerIndex,
|
||||
showSlot,
|
||||
transitionName,
|
||||
onClick,
|
||||
onClickCloseIcon,
|
||||
onClickOverlay,
|
||||
onOpened,
|
||||
onClosed
|
||||
} = uni_modules_nutuiUni_components_popup_usePopup.usePopup(props, emit);
|
||||
const innerDuration = common_vendor.computed(() => {
|
||||
return Number(props.duration);
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: props.overlay
|
||||
}, props.overlay ? {
|
||||
b: common_vendor.o(common_vendor.unref(onClickOverlay)),
|
||||
c: common_vendor.p({
|
||||
["overlay-class"]: props.overlayClass,
|
||||
["overlay-style"]: props.overlayStyle,
|
||||
visible: props.visible,
|
||||
["z-index"]: common_vendor.unref(innerIndex),
|
||||
duration: innerDuration.value,
|
||||
["lock-scroll"]: props.lockScroll,
|
||||
["close-on-click-overlay"]: props.closeOnClickOverlay,
|
||||
["destroy-on-close"]: props.destroyOnClose
|
||||
})
|
||||
} : {}, {
|
||||
d: common_vendor.unref(showSlot)
|
||||
}, common_vendor.unref(showSlot) ? {} : {}, {
|
||||
e: props.closeable
|
||||
}, props.closeable ? {
|
||||
f: common_vendor.p({
|
||||
name: "close",
|
||||
height: "12px"
|
||||
}),
|
||||
g: common_vendor.n(`nut-popup__close-icon--${props.closeIconPosition}`),
|
||||
h: common_vendor.o(
|
||||
//@ts-ignore
|
||||
(...args) => common_vendor.unref(onClickCloseIcon) && common_vendor.unref(onClickCloseIcon)(...args)
|
||||
)
|
||||
} : {}, {
|
||||
i: common_vendor.o(common_vendor.unref(onOpened)),
|
||||
j: common_vendor.o(common_vendor.unref(onClosed)),
|
||||
k: common_vendor.o(common_vendor.unref(onClick)),
|
||||
l: common_vendor.p({
|
||||
["custom-class"]: common_vendor.unref(classes),
|
||||
["custom-style"]: common_vendor.unref(popStyle),
|
||||
name: common_vendor.unref(transitionName),
|
||||
show: props.visible,
|
||||
duration: innerDuration.value,
|
||||
["destroy-on-close"]: props.destroyOnClose
|
||||
})
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createComponent(_sfc_main);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/popup/popup.js.map
|
||||
8
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.json
vendored
Normal file
8
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"nut-icon": "../icon/icon",
|
||||
"nut-overlay": "../overlay/overlay",
|
||||
"nut-transition": "../transition/transition"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<nut-overlay wx:if="{{a}}" bindclick="{{b}}" u-i="fc390718-0" bind:__l="__l" u-p="{{c}}"/><nut-transition wx:if="{{l}}" u-s="{{['d']}}" bindafterEnter="{{i}}" bindafterLeave="{{j}}" bindclick="{{k}}" u-i="fc390718-1" bind:__l="__l" u-p="{{l}}"><slot wx:if="{{d}}"/><view wx:if="{{e}}" class="{{['nut-popup__close-icon', g]}}" bindtap="{{h}}"><block wx:if="{{$slots.closeIcon}}"><slot name="closeIcon"></slot></block><block wx:else><nut-icon wx:if="{{f}}" u-i="fc390718-2,fc390718-1" bind:__l="__l" u-p="{{f}}"/></block></view></nut-transition>
|
||||
170
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.wxss
vendored
Normal file
170
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/popup.wxss
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.nut-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: var(--nut-overlay-bg-color, rgba(0, 0, 0, 0.7));
|
||||
}
|
||||
.nut-overflow-hidden {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.nut-theme-dark .nut-popup {
|
||||
background: var(--nut-dark-background2, #1b1b1b);
|
||||
}
|
||||
.nut-theme-dark .nut-popup__close-icon {
|
||||
color: var(--nut-dark-color, var(--nut-white, #fff));
|
||||
}
|
||||
.nut-popup-slide-center-enter-active, .nut-popup-slide-center-leave-active {
|
||||
transition-timing-function: ease;
|
||||
transition-property: opacity;
|
||||
}
|
||||
.nut-popup-slide-center-enter-from, .nut-popup-slide-center-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
.nut-popup-slide-top-enter-from, .nut-popup-slide-top-leave-active {
|
||||
transform: translate(0, -100%);
|
||||
}
|
||||
.nut-popup-slide-right-enter-from, .nut-popup-slide-right-leave-active {
|
||||
transform: translate(100%, 0);
|
||||
}
|
||||
.nut-popup-slide-bottom-enter-from, .nut-popup-slide-bottom-leave-active {
|
||||
transform: translate(0, 100%);
|
||||
}
|
||||
.nut-popup-slide-left-enter-from, .nut-popup-slide-left-leave-active {
|
||||
transform: translate(-100%, 0);
|
||||
}
|
||||
.nut-popup--center {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.nut-popup--center.round {
|
||||
border-radius: var(--nut-popup-border-radius, 20px);
|
||||
}
|
||||
.nut-popup--bottom {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.nut-popup--bottom.round {
|
||||
border-radius: var(--nut-popup-border-radius, 20px) var(--nut-popup-border-radius, 20px) 0 0;
|
||||
}
|
||||
.nut-popup--bottom--safebottom {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
.nut-popup--right {
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
.nut-popup--right.round {
|
||||
border-radius: var(--nut-popup-border-radius, 20px) 0 0 var(--nut-popup-border-radius, 20px);
|
||||
}
|
||||
.nut-popup--left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.nut-popup--left.round {
|
||||
border-radius: 0 var(--nut-popup-border-radius, 20px) var(--nut-popup-border-radius, 20px) 0;
|
||||
}
|
||||
.nut-popup--top {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.nut-popup--top.round {
|
||||
border-radius: 0 0 var(--nut-popup-border-radius, 20px) var(--nut-popup-border-radius, 20px);
|
||||
}
|
||||
.nut-popup--top--safetop {
|
||||
padding-top: var(--status-bar-height);
|
||||
padding-top: constant(safe-area-inset-top);
|
||||
padding-top: env(safe-area-inset-top);
|
||||
}
|
||||
.nut-popup {
|
||||
position: fixed;
|
||||
max-height: 100%;
|
||||
overflow-y: auto;
|
||||
background-color: var(--nut-white, #fff);
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.nut-popup__close-icon {
|
||||
position: absolute !important;
|
||||
z-index: 1;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
font-size: 18px;
|
||||
line-height: 30px;
|
||||
color: #969799;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.nut-popup__close-icon:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
.nut-popup__close-icon--top-left {
|
||||
top: var(--nut-popup-close-icon-margin, 16px);
|
||||
left: var(--nut-popup-close-icon-margin, 16px);
|
||||
}
|
||||
.nut-popup__close-icon--top-right {
|
||||
top: var(--nut-popup-close-icon-margin, 16px);
|
||||
right: var(--nut-popup-close-icon-margin, 16px);
|
||||
}
|
||||
.nut-popup__close-icon--bottom-left {
|
||||
bottom: var(--nut-popup-close-icon-margin, 16px);
|
||||
left: var(--nut-popup-close-icon-margin, 16px);
|
||||
}
|
||||
.nut-popup__close-icon--bottom-right {
|
||||
right: var(--nut-popup-close-icon-margin, 16px);
|
||||
bottom: var(--nut-popup-close-icon-margin, 16px);
|
||||
}
|
||||
99
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/use-popup.js
vendored
Normal file
99
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/popup/use-popup.js
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_nutuiUni_components__constants_event = require("../_constants/event.js");
|
||||
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
|
||||
const uni_modules_nutuiUni_components__constants_types = require("../_constants/types.js");
|
||||
const uni_modules_nutuiUni_components__hooks_useGlobalZIndex = require("../_hooks/useGlobalZIndex.js");
|
||||
require("../_utils/env.js");
|
||||
const uni_modules_nutuiUni_components__utils_style = require("../_utils/style.js");
|
||||
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-popup`;
|
||||
function usePopup(props, emit) {
|
||||
const state = common_vendor.reactive({
|
||||
innerVisible: false,
|
||||
innerIndex: props.zIndex,
|
||||
showSlot: true
|
||||
});
|
||||
const classes = common_vendor.computed(() => {
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainClass(props, componentName, {
|
||||
round: props.round,
|
||||
[`nut-popup--${props.position}`]: true,
|
||||
[`nut-popup--${props.position}--safebottom`]: props.position === "bottom" && props.safeAreaInsetBottom,
|
||||
[`nut-popup--${props.position}--safetop`]: props.position === "top" && props.safeAreaInsetTop,
|
||||
[props.popClass]: true
|
||||
});
|
||||
});
|
||||
const popStyle = common_vendor.computed(() => {
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainStyle(props, {
|
||||
zIndex: state.innerIndex,
|
||||
transitionDuration: `${props.duration}ms`
|
||||
});
|
||||
});
|
||||
const transitionName = common_vendor.computed(() => {
|
||||
return props.transition ? props.transition : `${uni_modules_nutuiUni_components__constants_types.animationName[props.position]}`;
|
||||
});
|
||||
const open = () => {
|
||||
if (state.innerVisible)
|
||||
return;
|
||||
state.innerIndex = props.zIndex !== void 0 ? props.zIndex : uni_modules_nutuiUni_components__hooks_useGlobalZIndex.useGlobalZIndex();
|
||||
state.innerVisible = true;
|
||||
emit(uni_modules_nutuiUni_components__constants_event.UPDATE_VISIBLE_EVENT, true);
|
||||
state.showSlot = true;
|
||||
emit(uni_modules_nutuiUni_components__constants_event.OPEN_EVENT);
|
||||
};
|
||||
const close = () => {
|
||||
if (!state.innerVisible)
|
||||
return;
|
||||
state.innerVisible = false;
|
||||
emit(uni_modules_nutuiUni_components__constants_event.UPDATE_VISIBLE_EVENT, false);
|
||||
emit(uni_modules_nutuiUni_components__constants_event.CLOSE_EVENT);
|
||||
};
|
||||
const onClick = (e) => {
|
||||
emit("click-pop", e);
|
||||
};
|
||||
const onClickCloseIcon = (e) => {
|
||||
e.stopPropagation();
|
||||
emit("click-close-icon");
|
||||
close();
|
||||
};
|
||||
const onClickOverlay = () => {
|
||||
emit("click-overlay");
|
||||
if (props.closeOnClickOverlay)
|
||||
close();
|
||||
};
|
||||
const onOpened = () => {
|
||||
emit(uni_modules_nutuiUni_components__constants_event.OPENED_EVENT);
|
||||
emit("opend");
|
||||
};
|
||||
const onClosed = () => {
|
||||
emit(uni_modules_nutuiUni_components__constants_event.CLOSED_EVENT);
|
||||
state.showSlot = !props.destroyOnClose;
|
||||
};
|
||||
const applyVisible = (visible) => {
|
||||
if (visible && !state.innerVisible) {
|
||||
open();
|
||||
}
|
||||
if (!visible && state.innerVisible) {
|
||||
state.innerVisible = false;
|
||||
emit(uni_modules_nutuiUni_components__constants_event.CLOSE_EVENT);
|
||||
}
|
||||
};
|
||||
common_vendor.watch(() => props.visible, (value) => {
|
||||
applyVisible(value);
|
||||
});
|
||||
common_vendor.onMounted(() => {
|
||||
applyVisible(props.visible);
|
||||
});
|
||||
return {
|
||||
...common_vendor.toRefs(state),
|
||||
popStyle,
|
||||
transitionName,
|
||||
classes,
|
||||
onClick,
|
||||
onClickCloseIcon,
|
||||
onClickOverlay,
|
||||
onOpened,
|
||||
onClosed
|
||||
};
|
||||
}
|
||||
exports.usePopup = usePopup;
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/popup/use-popup.js.map
|
||||
Reference in New Issue
Block a user