Files
qhmes/web-dist/js/BasicModal-xH56XuRZ.js
2026-06-16 18:19:57 +08:00

2 lines
8.8 KiB
Java

var oe=Object.defineProperty,ae=Object.defineProperties;var ie=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var q=(e,n,i)=>n in e?oe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i,C=(e,n)=>{for(var i in n||(n={}))se.call(n,i)&&q(e,i,n[i]);if(X)for(var i of X(n))re.call(n,i)&&q(e,i,n[i]);return e},D=(e,n)=>ae(e,ie(n));var I=(e,n,i)=>new Promise((g,l)=>{var p=r=>{try{u(i.next(r))}catch(d){l(d)}},c=r=>{try{u(i.throw(r))}catch(d){l(d)}},u=r=>r.done?g(r.value):Promise.resolve(r.value).then(p,c);u((i=i.apply(e,n)).next())});import{b as ue,M as ce,c as de,d as fe,e as ge}from"./ModalHeader-Sr8KwhJJ.js";import{useWindowSizeFn as me}from"./useWindowSizeFn-C-0M9_Ul.js";import{S as he}from"./index-ByCwbQDV.js";import{G as pe,H as He,gB as ve,au as _,bo as be,b2 as z,c as Ce,gC as Me}from"./index-X7Y8jykP.js";import{e as x,h as N,w as A,o as Se,d as Fe,u as o,n as P,r as H,c as S,y as ee,z as G,A as h,O as ye,X as Pe,C as $e,L as B,T as ke,K as y,ag as we,g as Re,I as J,D as Q,B as L,f as M,M as Y,N as Z}from"./vue-vendor-DNhG1Cve.js";import{useAppInject as Be}from"./useAppInject-DPZGPcR3.js";import{O as Ne}from"./index-CuWaQdlK.js";import{A as Oe}from"./index-DO7ZhK45.js";const te=Symbol();function We(e){return pe(e,te)}function _e(){return He(te)}const Te={loading:{type:Boolean},useWrapper:{type:Boolean,default:!0},modalHeaderHeight:{type:Number,default:57},modalFooterHeight:{type:Number,default:74},minHeight:{type:Number,default:null},maxHeight:{type:Number,default:null},height:{type:Number},footerOffset:{type:Number,default:0},visible:{type:Boolean},fullScreen:{type:Boolean},loadingTip:{type:String}},Ee=x({name:"ModalWrapper",components:{ScrollContainer:he},inheritAttrs:!1,props:Te,emits:["height-change","ext-height"],setup(e,{emit:n}){const i=H(null),g=H(null),l=H(0),p=H(0);let c=0;me(f.bind(null,!1));let u,r={};N(()=>e.visible,()=>{e.visible&&!u&&!(e.maxHeight||e.height)?(r={},u=ve(g,()=>{f({source:"muob",callBack:a=>{const s=r[a];s?(r[a]=++r[a],s>10&&(u.stop(),r={},u=null)):(r={},r[a]=1)}})},{attributes:!0,subtree:!0})):u&&(u.stop(),u=null)},{immediate:!0}),We({redoModalHeight:f});const d=S(()=>{if(e.fullScreen)return{height:`${o(l)}px`};if(e.height!=null){let s=e.height;return e.minHeight===null?{height:`${s}px`}:{height:`${e.minHeight>s?e.minHeight:s}px`}}else return{minHeight:`${e.minHeight===null?200:e.minHeight}px`,maxHeight:`${e.maxHeight?e.maxHeight:o(l)}px`}});A(()=>{e.useWrapper&&f()}),N(()=>e.fullScreen,a=>{f(),a?p.value=l.value:l.value=p.value}),Se(()=>{const{modalHeaderHeight:a,modalFooterHeight:s}=e;n("ext-height",a+s)}),Fe(()=>{});function v(){return I(this,null,function*(){P(()=>{var s;const a=o(i);a&&((s=a==null?void 0:a.scrollTo)==null||s.call(a,0))})})}function f(a){return I(this,null,function*(){var W,T;const s=a||{},b=s.source,O=s.callBack;if(!e.visible)return;const m=o(i);if(!m)return;const F=(T=(W=m.$el.parentElement)==null?void 0:W.parentElement)==null?void 0:T.parentElement;if(F){yield P();try{const $=F.parentElement&&F.parentElement.parentElement;if(!$)return;const V=getComputedStyle($).top,E=Number.parseInt(V);let k=window.innerHeight-E*2+(e.footerOffset||0)-e.modalFooterHeight-e.modalHeaderHeight;E<40&&(k-=26),yield P();const j=o(g);if(!j)return;yield P(),c=j.scrollHeight,e.fullScreen?l.value=window.innerHeight-e.modalFooterHeight-e.modalHeaderHeight-28:l.value=e.height?e.height:c>k?k:c,b=="muob"&&O(l.value),n("height-change",o(l))}catch($){}}})}return{wrapperRef:i,spinRef:g,spinStyle:d,scrollTop:v,setModalHeight:f}}}),je=["loading-tip"];function De(e,n,i,g,l,p){const c=y("ScrollContainer"),u=Pe("loading");return G(),ee(c,{ref:"wrapperRef"},{default:h(()=>[ye((G(),$e("div",{ref:"spinRef",style:ke(e.spinStyle),"loading-tip":e.loadingTip},[B(e.$slots,"default")],12,je)),[[u,e.loading]])]),_:3},512)}const Ie=_(Ee,[["render",De]]);function Ae(e){const n=H(!1),i=S(()=>{const l=o(e.wrapClassName)||"";return o(n)?`fullscreen-modal ${l} `:o(l)});function g(l){l&&l.stopPropagation(),n.value=!o(n)}return{getWrapClassName:i,handleFullScreen:g,fullScreenRef:n}}const Ve=x({name:"BasicModal",components:{Modal:ge,ModalWrapper:Ie,ModalClose:fe,ModalFooter:de,ModalHeader:ce},inheritAttrs:!1,props:ue,emits:["visible-change","open-change","height-change","cancel","ok","register","update:visible","update:open","fullScreen","comment-open"],setup(e,{emit:n,attrs:i,slots:g}){const l=H(!1),p=H(null),c=H(null),{prefixCls:u}=be("basic-modal"),r=H(0),d={setModalProps:V,emitVisible:void 0,redoModalHeight:()=>{P(()=>{o(c)&&o(c).setModalHeight()})}},v=Re();v&&n("register",d,v.uid);const{getIsMobile:f}=Be(),a=S(()=>{const t=C(C({},e),o(p));return f.value&&(t.canFullscreen=!1,t.defaultFullscreen=!0),t}),s=S(()=>!o(a).title&&!g.title),{handleFullScreen:b,getWrapClassName:O,fullScreenRef:m}=Ae({wrapClassName:we(a.value,"wrapClassName")}),F=S(()=>{const t=D(C({},o(a)),{visible:o(l),okButtonProps:void 0,cancelButtonProps:void 0,title:void 0});return D(C({},t),{wrapClassName:o(O)})}),W=S(()=>{const t=D(C(C({},i),o(a)),{open:o(l),wrapClassName:o(O)});return o(m)?z(t,["height","title","visible"]):z(t,["title","visible"])}),T=S(()=>{if(!o(m))return o(F).height});A(()=>{m.value=!!e.defaultFullscreen,f.value&&(m.value=!0)}),A(()=>{l.value=!!e.visible}),A(()=>{l.value=!!e.open}),N(()=>o(l),t=>{var R;n("visible-change",t),n("open-change",t),n("update:visible",t),n("update:open",t),v&&((R=d.emitVisible)==null||R.call(d,t,v.uid)),P(()=>{e.scrollTop&&t&&o(c)&&o(c).scrollTop()})},{immediate:!1});function $(t){return I(this,null,function*(){var R,U;if(t==null||t.stopPropagation(),!((U=(R=t.target)==null?void 0:R.classList)!=null&&U.contains(u+"-close--custom"))){if(e.closeFunc&&Ce(e.closeFunc)){const le=yield e.closeFunc();l.value=!le;return}l.value=!1,n("cancel",t)}})}function V(t){p.value=Me(o(p)||{},t),Reflect.has(t,"visible")&&(l.value=!!t.visible),Reflect.has(t,"open")&&(l.value=!!t.open),Reflect.has(t,"defaultFullscreen")&&(m.value=!!t.defaultFullscreen,f.value&&(m.value=!0))}function E(t){n("ok",t)}function k(t){n("height-change",t)}function j(t){r.value=t}function ne(t){e.canFullscreen&&(t.stopPropagation(),b(t))}const w=H(0);N(()=>e.enableComment,t=>{K(t)},{immediate:!0});function K(t){t===!0?w.value=6:w.value=0,n("comment-open",w.value===0,w.value)}return N(m,t=>{n("fullScreen",t)}),{handleCancel:$,getBindValue:W,getProps:F,handleFullScreen:b,fullScreenRef:m,getMergeProps:a,handleOk:E,visibleRef:l,omit:z,modalWrapperRef:c,handleExtHeight:j,handleHeightChange:k,handleTitleDbClick:ne,getWrapperHeight:T,commentSpan:w,handleComment:K,isNoTitle:s}}});function ze(e,n,i,g,l,p){const c=y("ModalClose"),u=y("ModalHeader"),r=y("ModalFooter"),d=y("ModalWrapper"),v=Oe,f=Ne,a=y("Modal");return G(),ee(a,L(e.getBindValue,{onCancel:e.handleCancel}),J({default:h(()=>[M(f,{class:"jeecg-modal-wrapper"},{default:h(()=>[M(v,{span:24-e.commentSpan,class:"jeecg-modal-content"},{default:h(()=>[M(d,L({useWrapper:e.getProps.useWrapper,footerOffset:e.wrapperFooterOffset,fullScreen:e.fullScreenRef,ref:"modalWrapperRef",loading:e.getProps.loading,"loading-tip":e.getProps.loadingTip,minHeight:e.getProps.minHeight,maxHeight:e.getProps.maxHeight,height:e.getWrapperHeight,visible:e.visibleRef,modalHeaderHeight:e.getProps.modalHeaderHeight,modalFooterHeight:e.footer!==void 0&&!e.footer?0:e.getProps.modalFooterHeight},e.omit(e.getProps.wrapperProps,"visible","height","modalFooterHeight"),{onExtHeight:e.handleExtHeight,onHeightChange:e.handleHeightChange}),{default:h(()=>[B(e.$slots,"default")]),_:3},16,["useWrapper","footerOffset","fullScreen","loading","loading-tip","minHeight","maxHeight","height","visible","modalHeaderHeight","modalFooterHeight","onExtHeight","onHeightChange"])]),_:3},8,["span"]),M(v,{span:e.commentSpan,class:"jeecg-comment-outer"},{default:h(()=>[B(e.$slots,"comment")]),_:3},8,["span"])]),_:3})]),_:2},[e.$slots.closeIcon?void 0:{name:"closeIcon",fn:h(()=>[M(c,{canFullscreen:e.getProps.canFullscreen,fullScreen:e.fullScreenRef,commentSpan:e.commentSpan,enableComment:e.getProps.enableComment,onComment:e.handleComment,onCancel:e.handleCancel,onFullscreen:e.handleFullScreen},null,8,["canFullscreen","fullScreen","commentSpan","enableComment","onComment","onCancel","onFullscreen"])]),key:"0"},e.isNoTitle?void 0:{name:"title",fn:h(()=>[M(u,{helpMessage:e.getProps.helpMessage,title:e.getMergeProps.title,onDblclick:e.handleTitleDbClick},null,8,["helpMessage","title","onDblclick"])]),key:"1"},e.$slots.footer?void 0:{name:"footer",fn:h(()=>[M(r,L(e.getBindValue,{onOk:e.handleOk,onCancel:e.handleCancel}),J({_:2},[Q(Object.keys(e.$slots),s=>({name:s,fn:h(b=>[B(e.$slots,s,Y(Z(b||{})))])}))]),1040,["onOk","onCancel"])]),key:"2"},Q(Object.keys(e.omit(e.$slots,"default")),s=>({name:s,fn:h(b=>[B(e.$slots,s,Y(Z(b||{})))])}))]),1040,["onCancel"])}const Le=_(Ve,[["render",ze]]),xe=Object.freeze(Object.defineProperty({__proto__:null,default:Le},Symbol.toStringTag,{value:"Module"}));export{xe as B,Le as M,_e as u};