"use strict";const e=require("vue"),l=require("./base-iCmnU-fv.js"),C={class:"modal-content"},N={class:"modal-backdrop fade show"},_=e.defineComponent({name:"ClModalTransition",__name:"BaseTransition",props:{className:{},isBackClick:{type:Boolean},width:{},classTransitionEnter:{},classTransitionLeave:{}},emits:["onClickBack"],setup(n,{expose:d,emit:m}){const a=n,u=m,o=e.ref(null),f=e.ref(null),s=e.reactive({isShow:!1,isAlignTop:!1,isAlignLeft:!1}),p=e.computed(()=>{const t={"panel-modal":!0};return l.CommonBase.isEmpty(a.className)||a.className?.split(" ").forEach(i=>{l.CommonBase.isEmpty(i)||(t[i]=!0)}),t}),h=e.computed(()=>({modal:!0,fade:!0,show:s.isShow})),v=e.computed(()=>{const t={};return s.isAlignTop&&(t["align-items"]="flex-start"),s.isAlignLeft&&(t["justify-content"]="flex-start"),t}),w=e.computed(()=>{const t={};return l.CommonBase.isEmpty(a.width)||(t.width=a.width),t}),y=()=>{u("onClickBack")},c=()=>{s.isShow=!1,document.body.className=document.body.className.replace(" modal-open","")},r=()=>{o.value&&(s.isAlignTop=o.value.clientHeight>window.innerHeight)},k=()=>{o.value&&(s.isAlignLeft=o.value.clientWidth>window.innerWidth)};e.onMounted(()=>{e.nextTick(()=>{r(),k()})}),e.watch(()=>s.isShow,t=>{t?(document.body.className.includes("modal-open")||(document.body.className+=" modal-open"),e.nextTick(()=>{r()})):(document.body.className=document.body.className.replace(" modal-open",""),s.isAlignTop=!1)});const g=t=>{a.isBackClick&&t.currentTarget===t.target&&(c(),y())},E=()=>{},T=()=>{};return d({show:()=>{s.isShow=!0},hide:()=>{c()}}),(t,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(p.value)},[e.createVNode(e.Transition,{"enter-active-class":n.classTransitionEnter,"leave-active-class":n.classTransitionLeave,onEnter:E,onAfterLeave:T},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(h.value),tabindex:"-1"},[e.createElementVNode("div",{ref_key:"refElWrapper",ref:f,class:"modal-wrapper",style:e.normalizeStyle(v.value),onClick:g},[e.createElementVNode("div",{class:"modal-dialog",style:e.normalizeStyle(w.value),ref_key:"refElDialog",ref:o},[e.createElementVNode("div",C,[e.renderSlot(t.$slots,"default")])],4)],4)],2),[[e.vShow,s.isShow]])]),_:3},8,["enter-active-class","leave-active-class"]),e.createVNode(e.Transition,{name:"overlay-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",N,null,512),[[e.vShow,s.isShow]])]),_:1})],2))}});exports._sfc_main=_;
//# sourceMappingURL=BaseTransition.vue_vue_type_script_setup_true_lang-DEXehdBc.js.map
