index-ee1a65fd.js 5.3 KB

1
  1. var te=Object.defineProperty,oe=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var ae=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var j=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))ae.call(t,n)&&j(e,n,t[n]);if(V)for(var n of V(t))re.call(t,n)&&j(e,n,t[n]);return e},q=(e,t)=>oe(e,ne(t));var K=(e,t,n)=>new Promise((F,u)=>{var $=r=>{try{i(n.next(r))}catch(H){u(H)}},p=r=>{try{i(n.throw(r))}catch(H){u(H)}},i=r=>r.done?F(r.value):Promise.resolve(r.value).then($,p);i((n=n.apply(e,t)).next())});import{d as U,c as Y,G as se,j as J,o as E,m as D,af as I,ad as v,s as T,ah as O,aa as ie,ab as N,bX as ce,r as k,a3 as Q,f as C,bY as ge,bZ as le,b_ as ue,bR as fe,b$ as de,p as d,a9 as pe,e as b,bK as X,k as Z,q as G,b0 as he,D as me,y as z,C as He,aq as be,F as Ce,v as Fe,w as $e,z as ye,t as L,bP as x}from"./index-610a1d46.js";import{u as ve}from"./useWindowSizeFn-1829b247.js";import{a as Pe}from"./useContentViewHeight-20fe3432.js";const _e=U({name:"PageFooter",inheritAttrs:!1,setup(){const{prefixCls:e}=Y("page-footer"),{getCalcContentWidth:t}=se();return{prefixCls:e,getCalcContentWidth:t}}});function Se(e,t,n,F,u,$){return E(),D("div",{class:T(e.prefixCls),style:O({width:e.getCalcContentWidth})},[I("div",{class:T(`${e.prefixCls}__left`)},[v(e.$slots,"left",{},void 0,!0)],2),v(e.$slots,"default",{},void 0,!0),I("div",{class:T(`${e.prefixCls}__right`)},[v(e.$slots,"right",{},void 0,!0)],2)],6)}const ee=J(_e,[["render",Se],["__scopeId","data-v-36e857bf"]]);function Re(e){let t;ie(()=>{e(),N(()=>{t=!0})}),ce(()=>{t&&e()})}function we(e,t,n,F,u=0,$=k(0)){const p=k(null),{footerHeightRef:i}=Pe();let r={useLayoutFooter:!0};const H=a=>{r=a};function A(){N(()=>{w()})}function P(a,_="all"){var l,m,S,y;function h(o){return Number(o.replace(/[^\d]/g,""))}let g=0;const f="0px";if(a){const o=getComputedStyle(a),c=h((l=o==null?void 0:o.marginTop)!=null?l:f),s=h((m=o==null?void 0:o.marginBottom)!=null?m:f),B=h((S=o==null?void 0:o.paddingTop)!=null?S:f),M=h((y=o==null?void 0:o.paddingBottom)!=null?y:f);_==="all"?(g+=c,g+=s,g+=B,g+=M):_==="top"?(g+=c,g+=B):(g+=s,g+=M)}return g}function R(a){return a==null?null:a instanceof HTMLDivElement?a:a.$el}function w(){return K(this,null,function*(){var y;if(!e.value)return;yield N();const a=R(C(t));if(!a)return;const{bottomIncludeBody:_}=ge(a);let h=0;n.forEach(o=>{var c,s;h+=(s=(c=R(C(o)))==null?void 0:c.offsetHeight)!=null?s:0});let g=(y=P(a))!=null?y:0;F.forEach(o=>{g+=P(R(C(o)))});let f=0;function l(o,c){if(o&&c){const s=o.parentElement;s&&(ue(c)?s.classList.contains(c)?f+=P(s,"bottom"):(f+=P(s,"bottom"),l(s,c)):fe(c)&&c>0&&(f+=P(s,"bottom"),l(s,--c)))}}le(u)?l(a,C(u)):l(a,u);let m=_-C(i)-C($)-h-g-f;const S=()=>{var o;(o=r.elements)==null||o.forEach(c=>{var s,B;m+=(B=(s=R(C(c)))==null?void 0:s.offsetHeight)!=null?B:0})};r.useLayoutFooter&&C(i)>0,S(),p.value=m})}return Re(()=>{N(()=>{w()})}),ve(()=>{w()},50,{immediate:!0}),Q(()=>[i.value],()=>{w()},{flush:"post",immediate:!0}),{redoHeight:A,setCompensation:H,contentHeight:p}}const ke=U({name:"PageWrapper",components:{PageFooter:ee,PageHeader:de},inheritAttrs:!1,props:{title:d.string,dense:d.bool,ghost:d.bool,content:d.string,contentStyle:{type:Object},contentBackground:d.bool,contentFullHeight:d.bool,contentClass:d.string,fixedHeight:d.bool,upwardSpace:d.oneOfType([d.number,d.string]).def(0)},setup(e,{slots:t,attrs:n}){const F=k(null),u=k(null),$=k(null),p=k(null),{prefixCls:i}=Y("page-wrapper");pe(Te,b(()=>e.fixedHeight));const r=b(()=>e.contentFullHeight),H=b(()=>e.upwardSpace),{redoHeight:A,setCompensation:P,contentHeight:R}=we(r,F,[u,p],[$],H);P({useLayoutFooter:!0,elements:[p]});const w=b(()=>{var l;return[i,{[`${i}--dense`]:e.dense},(l=n.class)!=null?l:{}]}),a=b(()=>e.content||(t==null?void 0:t.headerContent)||e.title||h.value.length),_=b(()=>(t==null?void 0:t.leftFooter)||(t==null?void 0:t.rightFooter)),h=b(()=>Object.keys(X(t,"default","leftFooter","rightFooter","headerContent"))),g=b(()=>{const{contentFullHeight:l,contentStyle:m,fixedHeight:S}=e;if(!l)return W({},m);const y=`${C(R)}px`;return W(q(W({},m),{minHeight:y}),S?{height:y}:{})}),f=b(()=>{const{contentBackground:l,contentClass:m}=e;return[`${i}-content`,m,{[`${i}-content-bg`]:l}]});return Q(()=>[_.value],()=>{A()},{flush:"post",immediate:!0}),{getContentStyle:g,wrapperRef:F,headerRef:u,contentRef:$,footerRef:p,getClass:w,getHeaderSlots:h,prefixCls:i,getShowHeader:a,getShowFooter:_,omit:X,getContentClass:f}}});function Be(e,t,n,F,u,$){const p=Z("PageHeader"),i=Z("PageFooter");return E(),D("div",{class:T(e.getClass),ref:"wrapperRef"},[e.getShowHeader?(E(),G(p,ye({key:0,ghost:e.ghost,title:e.title},e.omit(e.$attrs,"class"),{ref:"headerRef"}),he({default:z(()=>[e.content?(E(),D(Ce,{key:0},[Fe($e(e.content),1)],64)):v(e.$slots,"headerContent",{key:1})]),_:2},[me(e.getHeaderSlots,r=>({name:r,fn:z(H=>[v(e.$slots,r,He(be(H||{})))])}))]),1040,["ghost","title"])):L("",!0),I("div",{class:T(["overflow-hidden",e.getContentClass]),style:O(e.getContentStyle),ref:"contentRef"},[v(e.$slots,"default")],6),e.getShowFooter?(E(),G(i,{key:1,ref:"footerRef"},{left:z(()=>[v(e.$slots,"leftFooter")]),right:z(()=>[v(e.$slots,"rightFooter")]),_:3},512)):L("",!0)],2)}const Ee=J(ke,[["render",Be]]);x(ee);const De=x(Ee),Te="PageWrapperFixedHeight";export{De as P,Te as a,Re as o};