@aplus-frontend/ui
Version:
2 lines (1 loc) • 1.04 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("../../config-provider/index.js");const p=require("@vueuse/core"),n=require("vue"),d=require("../../config-provider/hooks/use-global-config.js");function u(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function c(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+u(e.marginTop)+u(e.marginBottom)}const m=t=>{const e=n.ref(),{height:l}=p.useElementSize(e),s=d.useGlobalConfig("namespace"),i=n.ref();let o=!1;const g=n.computed(()=>{const r=e.value?.querySelector(`.${n.unref(s)}-ap-table-header-wrapper`)?.clientHeight||0,f=e.value?.querySelector(".ant-table-header")?.clientHeight||47,a=e.value?.querySelector(".ant-pagination"),h=a?c(a):n.unref(i);return a&&(o=!0),Math.ceil(n.unref(l)-f-r-(h||0)-(t?.offset||0))});return n.onUpdated(()=>{if(o)return;const r=e.value?.querySelector(".ant-pagination");if(!r){i.value=0;return}i.value=c(r),o=!0}),{contentRef:e,height:g}};exports.default=m;