el-loading.94ab9da2.js 4.4 KB

1
  1. import{s as A,a5 as O,b_ as z,bf as S,f as H,bw as M,av as R,aQ as m,w as q,a6 as F,j as G,a7 as Q,aG as Z,bH as x,ap as D,k as B,aM as V,bE as g,bF as _,b6 as I,aj as K,b$ as U,__tla as Y}from"./entry.b543c057.js";let E,J=Promise.all([(()=>{try{return Y}catch{}})()]).then(async()=>{function P(n){let e;const o=A(!1),t=O({...n,originalPosition:"",originalOverflow:"",visible:!1});function i(s){t.text=s}function l(){const s=t.parent,a=d.ns;if(!s.vLoadingAddClassList){let r=s.getAttribute("loading-number");r=Number.parseInt(r)-1,r?s.setAttribute("loading-number",r.toString()):(x(s,a.bm("parent","relative")),s.removeAttribute("loading-number")),x(s,a.bm("parent","hidden"))}u(),c.unmount()}function u(){var s,a;(a=(s=d.$el)==null?void 0:s.parentNode)==null||a.removeChild(d.$el)}function v(){var s;n.beforeClose&&!n.beforeClose()||(o.value=!0,clearTimeout(e),e=window.setTimeout(b,400),t.visible=!1,(s=n.closed)==null||s.call(n))}function b(){if(!o.value)return;const s=t.parent;o.value=!1,s.vLoadingAddClassList=void 0,l()}const c=z(H({name:"ElLoading",setup(s,{expose:a}){const{ns:r}=M("loading"),T=R();return a({ns:r,zIndex:T}),()=>{const $=t.spinner||t.svg,j=m("svg",{class:"circular",viewBox:t.svgViewBox?t.svgViewBox:"0 0 50 50",...$?{innerHTML:$}:{}},[m("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none"})]),N=t.text?m("p",{class:r.b("text")},[t.text]):void 0;return m(Z,{name:r.b("fade"),onAfterLeave:b},{default:q(()=>[F(G("div",{style:{backgroundColor:t.background||""},class:[r.b("mask"),t.customClass,t.fullscreen?"is-fullscreen":""]},[m("div",{class:r.b("spinner")},[j,N])]),[[Q,t.visible]])])})}}})),d=c.mount(document.createElement("div"));return{...S(t),setText:i,removeElLoadingChild:u,close:v,handleAfterLeave:b,vm:d,get $el(){return d.$el}}}let f,w,C,h,y,p,k,L;w=function(n={}){if(!D)return;const e=C(n);if(e.fullscreen&&f)return f;const o=P({...e,closed:()=>{var i;(i=e.closed)==null||i.call(e),e.fullscreen&&(f=void 0)}});h(e,e.parent,o),y(e,e.parent,o),e.parent.vLoadingAddClassList=()=>y(e,e.parent,o);let t=e.parent.getAttribute("loading-number");return t?t=`${Number.parseInt(t)+1}`:t="1",e.parent.setAttribute("loading-number",t),e.parent.appendChild(o.$el),B(()=>o.visible.value=e.visible),e.fullscreen&&(f=o),o},C=n=>{var e,o,t,i;let l;return V(n.target)?l=(e=document.querySelector(n.target))!=null?e:document.body:l=n.target||document.body,{parent:l===document.body||n.body?document.body:l,background:n.background||"",svg:n.svg||"",svgViewBox:n.svgViewBox||"",spinner:n.spinner||!1,text:n.text||"",fullscreen:l===document.body&&((o=n.fullscreen)!=null?o:!0),lock:(t=n.lock)!=null?t:!1,customClass:n.customClass||"",visible:(i=n.visible)!=null?i:!0,target:l}},h=async(n,e,o)=>{const{nextZIndex:t}=o.vm.zIndex,i={};if(n.fullscreen)o.originalPosition.value=g(document.body,"position"),o.originalOverflow.value=g(document.body,"overflow"),i.zIndex=t();else if(n.parent===document.body){o.originalPosition.value=g(document.body,"position"),await B();for(const l of["top","left"]){const u=l==="top"?"scrollTop":"scrollLeft";i[l]=`${n.target.getBoundingClientRect()[l]+document.body[u]+document.documentElement[u]-Number.parseInt(g(document.body,`margin-${l}`),10)}px`}for(const l of["height","width"])i[l]=`${n.target.getBoundingClientRect()[l]}px`}else o.originalPosition.value=g(e,"position");for(const[l,u]of Object.entries(i))o.$el.style[l]=u},y=(n,e,o)=>{const t=o.vm.ns;["absolute","fixed","sticky"].includes(o.originalPosition.value)?x(e,t.bm("parent","relative")):_(e,t.bm("parent","relative")),n.fullscreen&&n.lock?_(e,t.bm("parent","hidden")):x(e,t.bm("parent","hidden"))},p=Symbol("ElLoading"),k=(n,e)=>{var o,t,i,l;const u=e.instance,v=a=>I(e.value)?e.value[a]:void 0,b=a=>{const r=V(a)&&(u==null?void 0:u[a])||a;return r&&A(r)},c=a=>b(v(a)||n.getAttribute(`element-loading-${U(a)}`)),d=(o=v("fullscreen"))!=null?o:e.modifiers.fullscreen,s={text:c("text"),svg:c("svg"),svgViewBox:c("svgViewBox"),spinner:c("spinner"),background:c("background"),customClass:c("customClass"),fullscreen:d,target:(t=v("target"))!=null?t:d?void 0:n,body:(i=v("body"))!=null?i:e.modifiers.body,lock:(l=v("lock"))!=null?l:e.modifiers.lock};n[p]={options:s,instance:w(s)}},L=(n,e)=>{for(const o of Object.keys(e))K(e[o])&&(e[o].value=n[o])},E={mounted(n,e){e.value&&k(n,e)},updated(n,e){const o=n[p];e.oldValue!==e.value&&(e.value&&!e.oldValue?k(n,e):e.value&&e.oldValue?I(e.value)&&L(e.value,o.options):o==null||o.instance.close())},unmounted(n){var e;(e=n[p])==null||e.instance.close()}}});export{J as __tla,E as v};