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
1.8 KiB
2 lines
1.8 KiB
var Z=(F,R,g)=>new Promise((k,m)=>{var M=a=>{try{c(g.next(a))}catch(h){m(h)}},E=a=>{try{c(g.throw(a))}catch(h){m(h)}},c=a=>a.done?k(a.value):Promise.resolve(a.value).then(M,E);c((g=g.apply(F,R)).next())});import{onMountedOrActivated as D}from"./onMountedOrActivated-fbe7044d.js";import{r as z,J as N,at as I,O as J,b6 as V,u,av as W,b7 as X,ak as _,aZ as $}from"./index-f4658ae7.js";function y(F,R,g,k,m=0,M=z(0)){const E=z(null),{footerHeightRef:c}=V();let a={useLayoutFooter:!0};const h=o=>{a=o};function A(){N(()=>{B()})}function p(o,x="all"){var s,l,H,b;function r(t){return Number(t.replace(/[^\d]/g,""))}let i=0;const f="0px";if(o){const t=getComputedStyle(o),n=r((s=t==null?void 0:t.marginTop)!=null?s:f),e=r((l=t==null?void 0:t.marginBottom)!=null?l:f),d=r((H=t==null?void 0:t.paddingTop)!=null?H:f),P=r((b=t==null?void 0:t.paddingBottom)!=null?b:f);x==="all"?(i+=n,i+=e,i+=d,i+=P):x==="top"?(i+=n,i+=d):(i+=e,i+=P)}return i}function T(o){return o==null?null:o instanceof HTMLDivElement?o:o.$el}function B(){return Z(this,null,function*(){var b;if(!F.value)return;yield N();const o=T(u(R));if(!o)return;const{bottomIncludeBody:x}=W(o);let r=0;g.forEach(t=>{var n,e;r+=(e=(n=T(u(t)))==null?void 0:n.offsetHeight)!=null?e:0});let i=(b=p(o))!=null?b:0;k.forEach(t=>{i+=p(T(u(t)))});let f=0;function s(t,n){if(t&&n){const e=t.parentElement;e&&(_(n)?e.classList.contains(n)?f+=p(e,"bottom"):(f+=p(e,"bottom"),s(e,n)):$(n)&&n>0&&(f+=p(e,"bottom"),s(e,--n)))}}X(m)?s(o,u(m)):s(o,m);let l=x-u(c)-u(M)-r-i-f;const H=()=>{var t;(t=a.elements)==null||t.forEach(n=>{var e,d;l+=(d=(e=T(u(n)))==null?void 0:e.offsetHeight)!=null?d:0})};a.useLayoutFooter&&u(c)>0,H(),E.value=l})}return D(()=>{N(()=>{B()})}),I(()=>{B()},50,{immediate:!0}),J(()=>[c.value],()=>{B()},{flush:"post",immediate:!0}),{redoHeight:A,setCompensation:h,contentHeight:E}}export{y as useContentHeight};
|