ideaz-element
Version:
<p align="center"> <a href="" target="_blank" rel="noopener noreferrer"> <img src="./docs/public/logo.svg" alt="Ideaz Element" width="180" style="width: 180px;" /> </a> </p>
3 lines (2 loc) • 1.92 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../utils/index.cjs");const _=require("../utils/is.cjs");function i(e,t){return!e||[...e.classList].includes(t)?e:i(e.parentNode,t)}function v(e){return i(e,"el-table").getBoundingClientRect().width}function B(e,t){var b;let l=t.value.top||0;const h=t.value.zIndex||0;l=Number.parseFloat(l);let a=e.querySelector(".el-table__header");a=i(a,"el-table__header-wrapper");const s=e.querySelector(".el-scrollbar")||e.querySelector(".el-table__body"),m=e.querySelector(".el-table__body-wrapper"),o=a.cloneNode(!0);o.classList.add("el-table_header-copy"),o.style.display="none",o.style.position="fixed",o.style.zIndex=h||1994,o.style.top=`${l}px`,o.style.backgroundColor="#fff",_.isObject((b=t.value)==null?void 0:b.style)&&Object.keys(t.value.style).forEach(r=>{o.style[r]=t.value.style[r]}),a.parentNode.insertBefore(o,m);const d=v(a),y=t.value.parent==="document"?document:document.querySelector(t.value.parent||"body");if(!(!y||t.value.disabled===!0)){y.addEventListener("scroll",()=>{const r=a.clientHeight,f=a.getBoundingClientRect().top,c=s.getBoundingClientRect().top,n=s.getBoundingClientRect().bottom;f<=l&&(o.style.display="block",o.style.width=`${s.offsetWidth<d?s.offsetWidth:d}px`),(c-r>l||n-r/2<=l)&&(o.style.display="none")});try{const r=e.querySelector(".el-table__body-wrapper .el-scrollbar .el-scrollbar__bar.is-horizontal .el-scrollbar__thumb");r&&new MutationObserver(c=>{for(const n of c)if(n.type==="attributes"&&n.attributeName==="style"){const p=r.style.transform;p&&(o.querySelector(".el-table__header").style.marginLeft=`-${p.replace(/[a-z()]/gi,"")}`)}}).observe(r,{attributes:!0})}catch{}}}let u=null;const S={mounted(e,t){if(!t.value)return;const l=Number.parseInt(`${Math.random()*10}`);u=setTimeout(()=>{B(e,t)},1e3+l)},unmounted(){u&&clearTimeout(u)}};exports.sticky=S;
//# sourceMappingURL=sticky.cjs.map