@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
46 lines (45 loc) • 1.26 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
*-------------------------------------------------------------------------------------------
*/
class g {
constructor(t = 0, s) {
this.total = t, this.offsets = [], this.heights = [];
let e = 0;
for (let h = 0; h < t; h++)
this.offsets.push(e), e += s, this.heights.push(s);
}
height(t) {
return this.heights[t];
}
index(t) {
for (let s = 0; s < this.offsets.length; s++) {
if (t === this.offsets[s])
return s;
if (t < this.offsets[s])
return s - 1;
}
return this.total - 1;
}
offset(t) {
return this.offsets[t];
}
totalHeight() {
const t = this.offsets[this.offsets.length - 1], s = this.heights[this.heights.length - 1];
return t + s;
}
update(t, s) {
let e = this.offsets[t];
for (let h = t; h < this.heights.length; h++) {
this.offsets[h] = e;
const i = s[h - t] || this.heights[h];
e += i, this.heights[h] = i;
}
}
}
export {
g as RowHeightService
};