@progress/kendo-angular-treelist
Version:
Kendo UI TreeList for Angular - Display hierarchical data in an Angular tree grid view that supports sorting, filtering, paging, and much more.
31 lines (30 loc) • 968 B
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
/**
* @hidden
*/
export class RowHeightService {
total;
rowHeight;
constructor(total = 0, rowHeight) {
this.total = total;
this.rowHeight = rowHeight;
this.rowHeight = rowHeight || 0;
}
index(position) {
if (position < 0) {
return undefined;
}
return Math.min(Math.floor(position / this.rowHeight), this.total - 1);
}
offset(rowIndex) {
if (0 <= rowIndex && rowIndex < this.total) {
return rowIndex * this.rowHeight;
}
}
totalHeight() {
return this.total * this.rowHeight;
}
}