import{aj as t,a2 as e,ak as i,al as s,o as a,j as n,w as o,a0 as r,m as l,y as u,z as d,B as c,G as h,H as m}from"./index-90c12cc1.js";import{_ as v}from"./_plugin-vue_export-helper.1b428a4d.js";const y={props:{show:{type:Boolean,default:t.transition.show},mode:{type:String,default:t.transition.mode},duration:{type:[String,Number],default:t.transition.duration},timingFunction:{type:String,default:t.transition.timingFunction}}},p=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 f=v({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,...uni.$u.addStyle(e),...t}}},mixins:[i,s,{methods:{clickHandler(){this.$emit("click")},async vueEnter(){const t=p(this.mode);this.status="enter",this.$emit("beforeEnter"),this.inited=!0,this.display=!0,this.classes=t.enter,await e(),await uni.$u.sleep(20),this.$emit("enter"),this.transitionEnded=!1,this.$emit("afterEnter"),this.classes=t["enter-to"]},async vueLeave(){if(!this.display)return;const t=p(this.mode);this.status="leave",this.$emit("beforeLeave"),this.classes=t.leave,await e(),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))}}},y],watch:{show:{handler(t){t?this.vueEnter():this.vueLeave()},immediate:!0}}},[["render",function(t,e,i,s,h,m){const v=c;return h.inited?(a(),n(v,{key:0,class:l(["u-transition",h.classes]),ref:"u-transition",onClick:t.clickHandler,style:u([m.mergeStyle]),onTouchmove:t.noop},{default:o((()=>[r(t.$slots,"default",{},void 0,!0)])),_:3},8,["onClick","class","style","onTouchmove"])):d("",!0)}],["__scopeId","data-v-d4c36fbb"]]);const $=v({name:"u-overlay",mixins:[i,s,{props:{show:{type:Boolean,default:t.overlay.show},zIndex:{type:[String,Number],default:t.overlay.zIndex},duration:{type:[String,Number],default:t.overlay.duration},opacity:{type:[String,Number],default:t.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 uni.$u.deepMerge(t,uni.$u.addStyle(this.customStyle))}},emits:["click"],methods:{clickHandler(){this.$emit("click")}}},[["render",function(t,e,i,s,l,u){const d=h(m("u-transition"),f);return a(),n(d,{show:t.show,"custom-class":"u-overlay",duration:t.duration,"custom-style":u.overlayStyle,onClick:u.clickHandler},{default:o((()=>[r(t.$slots,"default",{},void 0,!0)])),_:3},8,["show","duration","custom-style","onClick"])}],["__scopeId","data-v-32fcf5a7"]]);export{$ as _,f as a};
