@progress/kendo-react-treelist
Version:
React TreeList enables the display of self-referencing tabular data. KendoReact TreeList package
9 lines (8 loc) • 1.39 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(n){return n!==void 0&&(typeof n=="number"||/px$/i.test(String(n)))}function u(n,o,a){const r=Array.from(n.tHead&&n.tHead.rows||[]),i=[o];let h;const l=a||(t=>window.getComputedStyle(t).height||void 0);r.forEach(t=>{const e=l(t);i.push(g(e)?parseFloat(String(e)):t.offsetHeight)});for(let t=0;t<r.length;t++)h=i.slice(0,t+1).reduce((e,s)=>e+s),Array.from(r[t].cells).forEach(e=>e.style.top=h+"px")}const c=1e6;function d(n){const{rows:o,tableViewPortHeight:a,scrollTop:r}=n;if(o.length===0)return[];const i=o[0].height,h=Math.min(Math.round(r/i),o.length),l=Math.round(a/i),t=Math.max(0,h-l),e=Math.min(o.length,h+2*l),s=o.slice(t,e),f=s[s.length-1];return t>0&&s.unshift({dataItem:{},level:[c],offsetTop:0,height:s[0].offsetTop,levelCount:0}),e<o.length-1&&s.push({dataItem:{},level:[c,c],offsetTop:f.offsetTop+f.height,height:(o.length-e)*i,levelCount:0}),s}exports.setHeaderRowsTop=u;exports.tableRowsVirtualization=d;