You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
7.0 KiB

import{D as t,E as e,R as o,U as s,L as i,G as a,H as n,o as r,c as l,w as u,O as d,k as c,M as p,m,i as h,K as y,b as f,aH as v,J as b,d as g,al as k}from"./index-DkGewvWo.js";import{_ as S}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{r as _}from"./uni-app.es.Bo01BzMV.js";import{_ as w}from"./u-status-bar.DDNs5qwz.js";import{_ as I}from"./u-icon.x7ElsZU9.js";const $=t({props:{show:{type:Boolean,default:()=>e.transition.show},mode:{type:String,default:()=>e.transition.mode},duration:{type:[String,Number],default:()=>e.transition.duration},timingFunction:{type:String,default:()=>e.transition.timingFunction}}}),C=t=>({enter:`u-${t}-enter u-${t}-enter-active`,"enter-to":`u-${t}-enter-to u-${t}-enter-active`,leave:`u-${t}-leave u-${t}-leave-active`,"leave-to":`u-${t}-leave-to u-${t}-leave-active`});const x=S({name:"u-transition",data:()=>({inited:!1,viewStyle:{},status:"",transitionEnded:!1,display:!1,classes:""}),emits:["click","beforeEnter","enter","afterEnter","beforeLeave","leave","afterLeave"],computed:{mergeStyle(){const{viewStyle:t,customStyle:e}=this;return{transitionDuration:`${this.duration}ms`,transitionTimingFunction:this.timingFunction,...i(e),...t}}},mixins:[a,n,{methods:{clickHandler(){this.$emit("click")},async vueEnter(){const t=C(this.mode);this.status="enter",this.$emit("beforeEnter"),this.inited=!0,this.display=!0,this.classes=t.enter,await o(),await s(20),this.$emit("enter"),this.transitionEnded=!1,this.$emit("afterEnter"),this.classes=t["enter-to"]},async vueLeave(){if(!this.display)return;const t=C(this.mode);this.status="leave",this.$emit("beforeLeave"),this.classes=t.leave,await o(),this.transitionEnded=!1,this.$emit("leave"),setTimeout(this.onTransitionEnd,this.duration),this.classes=t["leave-to"]},onTransitionEnd(){this.transitionEnded||(this.transitionEnded=!0,this.$emit("leave"===this.status?"afterLeave":"afterEnter"),!this.show&&this.display&&(this.display=!1,this.inited=!1))}}},$],watch:{show:{handler(t){t?this.vueEnter():this.vueLeave()},immediate:!0}}},[["render",function(t,e,o,s,i,a){const n=h;return i.inited?(r(),l(n,{key:0,class:c(["u-transition",i.classes]),ref:"u-transition",onClick:t.clickHandler,style:p([a.mergeStyle]),onTouchmove:t.noop},{default:u((()=>[d(t.$slots,"default",{},void 0,!0)])),_:3},8,["onClick","class","style","onTouchmove"])):m("",!0)}],["__scopeId","data-v-dd73690f"]]);const E=S({name:"u-overlay",mixins:[a,n,t({props:{show:{type:Boolean,default:()=>e.overlay.show},zIndex:{type:[String,Number],default:()=>e.overlay.zIndex},duration:{type:[String,Number],default:()=>e.overlay.duration},opacity:{type:[String,Number],default:()=>e.overlay.opacity}}})],computed:{overlayStyle(){const t={position:"fixed",top:0,left:0,right:0,zIndex:this.zIndex,bottom:0,"background-color":`rgba(0, 0, 0, ${this.opacity})`};return y(t,i(this.customStyle))}},emits:["click"],methods:{clickHandler(){this.$emit("click")}}},[["render",function(t,e,o,s,i,a){const n=_(f("u-transition"),x);return r(),l(n,{show:t.show,"custom-class":"u-overlay",duration:t.duration,"custom-style":a.overlayStyle,onClick:a.clickHandler},{default:u((()=>[d(t.$slots,"default",{},void 0,!0)])),_:3},8,["show","duration","custom-style","onClick"])}],["__scopeId","data-v-ff00b8e0"]]);const z=S({name:"u-safe-bottom",mixins:[a,n,t({props:{}})],data:()=>({safeAreaBottomHeight:0,isNvue:!1}),computed:{style(){return y({},i(this.customStyle))}},mounted(){}},[["render",function(t,e,o,s,i,a){const n=h;return r(),l(n,{class:c(["u-safe-bottom",[!i.isNvue&&"u-safe-area-inset-bottom"]]),style:p([a.style])},null,8,["style","class"])}],["__scopeId","data-v-15f70745"]]);const B=S({name:"u-popup",mixins:[a,n,t({props:{show:{type:Boolean,default:()=>e.popup.show},overlay:{type:Boolean,default:()=>e.popup.overlay},mode:{type:String,default:()=>e.popup.mode},duration:{type:[String,Number],default:()=>e.popup.duration},closeable:{type:Boolean,default:()=>e.popup.closeable},overlayStyle:{type:[Object,String],default:()=>e.popup.overlayStyle},closeOnClickOverlay:{type:Boolean,default:()=>e.popup.closeOnClickOverlay},zIndex:{type:[String,Number],default:()=>e.popup.zIndex},safeAreaInsetBottom:{type:Boolean,default:()=>e.popup.safeAreaInsetBottom},safeAreaInsetTop:{type:Boolean,default:()=>e.popup.safeAreaInsetTop},closeIconPos:{type:String,default:()=>e.popup.closeIconPos},round:{type:[Boolean,String,Number],default:()=>e.popup.round},zoom:{type:Boolean,default:()=>e.popup.zoom},bgColor:{type:String,default:()=>e.popup.bgColor},overlayOpacity:{type:[Number,String],default:()=>e.popup.overlayOpacity}}})],data(){return{overlayDuration:this.duration+50}},watch:{show(t,e){}},computed:{transitionStyle(){const t={zIndex:this.zIndex,position:"fixed",display:"flex"};return t[this.mode]=0,"left"===this.mode||"right"===this.mode?y(t,{bottom:0,top:0}):"top"===this.mode||"bottom"===this.mode?y(t,{left:0,right:0}):"center"===this.mode?y(t,{alignItems:"center","justify-content":"center",top:0,left:0,right:0,bottom:0}):void 0},contentStyle(){const t={};if(v(),"center"!==this.mode&&(t.flex=1),this.bgColor&&(t.backgroundColor=this.bgColor),this.round){const e=b(this.round);"top"===this.mode?(t.borderBottomLeftRadius=e,t.borderBottomRightRadius=e):"bottom"===this.mode?(t.borderTopLeftRadius=e,t.borderTopRightRadius=e):"center"===this.mode&&(t.borderRadius=e)}return y(t,i(this.customStyle))},position(){return"center"===this.mode?this.zoom?"fade-zoom":"fade":"left"===this.mode?"slide-left":"right"===this.mode?"slide-right":"bottom"===this.mode?"slide-up":"top"===this.mode?"slide-down":void 0}},emits:["open","close","click"],methods:{overlayClick(){this.closeOnClickOverlay&&this.$emit("close")},close(t){this.$emit("close")},afterEnter(){this.$emit("open")},clickHandler(){"center"===this.mode&&this.overlayClick(),this.$emit("click")}}},[["render",function(t,e,o,s,i,a){const n=_(f("u-overlay"),E),y=_(f("u-status-bar"),w),v=_(f("u-icon"),I),b=h,S=_(f("u-safe-bottom"),z),$=_(f("u-transition"),x);return r(),l(b,{class:c(["u-popup",[t.customClass]])},{default:u((()=>[t.overlay?(r(),l(n,{key:0,show:t.show,onClick:a.overlayClick,zIndex:t.zIndex,duration:i.overlayDuration,customStyle:t.overlayStyle,opacity:t.overlayOpacity},null,8,["show","onClick","zIndex","duration","customStyle","opacity"])):m("",!0),g($,{show:t.show,customStyle:a.transitionStyle,mode:a.position,duration:t.duration,onAfterEnter:a.afterEnter,onClick:a.clickHandler},{default:u((()=>[g(b,{class:"u-popup__content",style:p([a.contentStyle]),onClick:k(t.noop,["stop"])},{default:u((()=>[t.safeAreaInsetTop?(r(),l(y,{key:0})):m("",!0),d(t.$slots,"default",{},void 0,!0),t.closeable?(r(),l(b,{key:1,onClick:k(a.close,["stop"]),class:c(["u-popup__content__close",["u-popup__content__close--"+t.closeIconPos]]),"hover-class":"u-popup__content__close--hover","hover-stay-time":"150"},{default:u((()=>[g(v,{name:"close",color:"#909399",size:"18",bold:""})])),_:1},8,["onClick","class"])):m("",!0),t.safeAreaInsetBottom?(r(),l(S,{key:2})):m("",!0)])),_:3},8,["style","onClick"])])),_:3},8,["show","customStyle","mode","duration","onAfterEnter","onClick"])])),_:3},8,["class"])}],["__scopeId","data-v-61453996"]]);export{B as _};