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.

2 lines
2.4 KiB

var H=(e,c,o)=>new Promise((d,a)=>{var u=i=>{try{s(o.next(i))}catch(n){a(n)}},r=i=>{try{s(o.throw(i))}catch(n){a(n)}},s=i=>i.done?d(i.value):Promise.resolve(i.value).then(u,r);s((o=o.apply(e,c)).next())});import{d as w,bQ as _,r as h,at as x,dz as C,f as $,u as f,G as B,O as E,P as M,a3 as T,J as g,aT as N,aU as R,ds as F,o as b,a as W,w as k,s as O,g as z,a9 as D,aV as U}from"./index-f4658ae7.js";import{createModalContext as A}from"./useModalContext-bf554b39.js";const G={loading:{type:Boolean},useWrapper:{type:Boolean,default:!0},modalHeaderHeight:{type:Number,default:57},modalFooterHeight:{type:Number,default:74},minHeight:{type:Number,default:200},height:{type:Number},footerOffset:{type:Number,default:0},visible:{type:Boolean},fullScreen:{type:Boolean},loadingTip:{type:String}},I=w({name:"ModalWrapper",components:{ScrollContainer:_},inheritAttrs:!1,props:G,emits:["height-change","ext-height"],setup(e,{emit:c}){const o=h(null),d=h(null),a=h(0),u=h(0);let r=0;x(n.bind(null,!1)),C(d,()=>{n()},{attributes:!0,subtree:!0}),A({redoModalHeight:n});const s=$(()=>({minHeight:`${e.minHeight}px`,[e.fullScreen?"height":"maxHeight"]:`${f(a)}px`}));B(()=>{e.useWrapper&&n()}),E(()=>e.fullScreen,t=>{n(),t?u.value=a.value:a.value=u.value}),M(()=>{const{modalHeaderHeight:t,modalFooterHeight:l}=e;c("ext-height",t+l)}),T(()=>{});function i(){return H(this,null,function*(){g(()=>{var l;const t=f(o);t&&((l=t==null?void 0:t.scrollTo)==null||l.call(t,0))})})}function n(){return H(this,null,function*(){if(!e.visible)return;const t=f(o);if(!t)return;const l=t.$el.parentElement;if(l){l.style.padding="0",yield g();try{const m=l.parentElement&&l.parentElement.parentElement;if(!m)return;const S=getComputedStyle(m).top,y=Number.parseInt(S);let p=window.innerHeight-y*2+(e.footerOffset||0)-e.modalFooterHeight-e.modalHeaderHeight;y<40&&(p-=26),yield g();const v=f(d);if(!v)return;yield g(),r=v.scrollHeight,e.fullScreen?a.value=window.innerHeight-e.modalFooterHeight-e.modalHeaderHeight-28:a.value=e.height?e.height:r>p?p:r,c("height-change",f(a))}catch(m){}}})}return{wrapperRef:o,spinRef:d,spinStyle:s,scrollTop:i,setModalHeight:n}}}),J=["loading-tip"];function P(e,c,o,d,a,u){const r=R("ScrollContainer"),s=F("loading");return b(),W(r,{ref:"wrapperRef"},{default:k(()=>[O((b(),z("div",{ref:"spinRef",style:D(e.spinStyle),"loading-tip":e.loadingTip},[U(e.$slots,"default")],12,J)),[[s,e.loading]])]),_:3},512)}const q=N(I,[["render",P]]);export{q as default};