UNPKG

@progress/kendo-react-treelist

Version:

React TreeList enables the display of self-referencing tabular data. KendoReact TreeList package

46 lines (45 loc) 1.58 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ function g(o) { return o !== void 0 && (typeof o == "number" || /px$/i.test(String(o))); } function u(o, e, l) { const r = Array.from(o.tHead && o.tHead.rows || []), h = [e], c = l || ((t) => window.getComputedStyle(t).height || void 0); r.forEach((t) => { const s = c(t); h.push(g(s) ? parseFloat(String(s)) : t.offsetHeight); }); for (let t = 0; t < r.length; t++) { const s = h.slice(0, t + 1).reduce((i, n) => i + n, 0); Array.from(r[t].cells).forEach((i) => i.style.top = s + "px"); } } const a = 1e6; function p(o) { const { rows: e, tableViewPortHeight: l, scrollTop: r } = o; if (e.length === 0) return []; const h = e[0].height, c = Math.min(Math.round(r / h), e.length), t = Math.round(l / h), s = Math.max(0, c - t), i = Math.min(e.length, c + 2 * t), n = e.slice(s, i), f = n[n.length - 1]; return s > 0 && n.unshift({ dataItem: {}, level: [a], offsetTop: 0, height: n[0].offsetTop, levelCount: 0 }), i < e.length - 1 && n.push({ dataItem: {}, level: [a, a], offsetTop: f.offsetTop + f.height, height: (e.length - i) * h, levelCount: 0 }), n; } export { u as setHeaderRowsTop, p as tableRowsVirtualization };