import{ag as e,r as t,k as a,c as o,b as l,d as s,e as n,f as r,w as d,x as u,j as i,g as c,M as p,z as m,_ as y,ah as g,ai as f,p as v}from"./index-DVkgSHpn.js";import{_ as b,b as h}from"./el-layout._U-vZTft.js";const k=b({__name:"el-popup",props:{direction:{type:String,default:"center"},size:{type:[String,Number],default:"auto"},borderRadius:[String,Number],padding:{type:[String,Number],default:32},showCloseBtn:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#fff"},modal:{type:Boolean,default:!0},modalBackground:{type:String,default:"rgba(0, 0, 0, 0.4)"},closeOnClickModal:{type:Boolean,default:!0},zIndex:{type:Number,default:1e6}},emits:["open","opened","opened","close","closed"],setup(b,{expose:k,emit:x}){const B=b;e((()=>{document.getElementsByTagName("body")[0].style.overflow="visible"}));let _=1;const w=x,T=t(!1),C=t(!1),z=t(0);let N=null;const{statusBarHeight:S}=a(),$=e=>g(e)?e.map($).join(" "):f(e)?`${e}rpx`:e,j=o((()=>{switch(B.direction){case"top":case"bottom":return $(B.size);case"left":case"right":return"100%"}})),I=o((()=>{switch(B.direction){case"top":case"bottom":return"100%";case"left":case"right":case"center":return $(B.size)}})),E=o((()=>{if(["left","right","top"].includes(B.direction)){let e=0;e+=S||0,e+=44;let[t]=$(B.padding).split(" ");return"0rpx"==t&&(t="0px"),`calc(${e}px + ${t})`}return 1})),M=()=>{if(C.value){(()=>{C.value=!1,w("close"),document.getElementsByTagName("body")[0].style.overflow="visible",clearTimeout(N),N=setTimeout((()=>{T.value=!1,w("closed")}),300)})()}},R=()=>{if(!B.closeOnClickModal)return!1;M()};return k({open:()=>{z.value=B.zIndex+_++,T.value||(T.value=!0,w("open"),document.getElementsByTagName("body")[0].style.overflow="hidden",clearTimeout(N),N=setTimeout((()=>{C.value=!0,N=setTimeout((()=>{w("opened")}),350)}),50))},close:M}),(e,t)=>{const a=v,o=l(s("uni-icons"),h);return T.value?(n(),r(a,{key:0,class:m(["el-popup-wrapper",`${b.direction}`,"is-"+(C.value?"open":"close")]),style:u({zIndex:z.value}),onTouchmove:t[0]||(t[0]=y((()=>{}),["stop","prevent"]))},{default:d((()=>[b.modal?(n(),r(a,{key:0,class:"modal",style:u({background:b.modalBackground}),onClick:R},null,8,["style"])):i("",!0),c(a,{class:"el-popup",style:u({height:j.value,width:I.value,backgroundColor:b.backgroundColor,borderRadius:$(b.borderRadius)})},{default:d((()=>[c(a,{class:"container",style:u({padding:$(b.padding),paddingTop:E.value})},{default:d((()=>[p(e.$slots,"default",{},void 0,!0)])),_:3},8,["style"]),C.value&&b.showCloseBtn?(n(),r(a,{key:0,class:"close",onClick:M},{default:d((()=>[c(o,{type:"closeempty",size:"20",color:"#888"})])),_:1})):i("",!0)])),_:3},8,["style"])])),_:3},8,["class","style"])):i("",!0)}}},[["__scopeId","data-v-a55fe05d"]]);export{k as _};
//# sourceMappingURL=el-popup.CUfoW56r.js.map
