/** * This object contains the cache of the various row heights that are present inside * the data table. Its based on Fenwick tree data structure that helps with * querying sums that have time complexity of log n. * * Fenwick Tree Credits: http://petr-mitrichev.blogspot.com/2013/05/fenwick-tree-range-updates.html * https://github.com/mikolalysenko/fenwick-tree * */ export declare class RowHeightCache { /** * Tree Array stores the cumulative information of the row heights to perform efficient * range queries and updates. Currently the tree is initialized to the base row * height instead of the detail row height. */ private treeArray; /** * Clear the Tree array. */ clearCache(): void; /** * Given the ScrollY position i.e. sum, provide the rowIndex * that is present in the current view port. * * @param sum - The scrollY position. * @return - Index representing the first row visible in the viewport */ private calcRowIndex(sum); /** * Given the ScrollY position i.e. sum, provide the rowIndex * that is present in the current view port. Below handles edge cases. * * @param scrollY - The scrollY position. * @return - Index representing the first row visible in the viewport */ getRowIndex(scrollY: number): number; /** * Initialize the Fenwick tree with row Heights. * * @param rows The array of rows which contain the expanded status. * @param rowHeight The row height. * @param detailRowHeight The detail row height. * @param externalVirtual indicates if the cache is virtual (use rowCount for size rather than rows.length for cache size). * @param rowCount The total number of rows for externalVirtual cache. */ initCache({rows, rowHeight, detailRowHeight, externalVirtual, rowCount}: { rows: any[]; rowHeight: number | ((row: any) => number); detailRowHeight: number | ((row: any, index: number) => number); externalVirtual: boolean; rowCount: number; }): void; /** * Range Sum query from 1 to the rowIndex * * @param atIndex The row index until which the total height needs to be obtained. * @return The total height from row 1 to the rowIndex. */ query(atIndex: number): number; /** * When a row is expanded or rowHeight is changed, update the height. This can * be utilized in future when Angular Data table supports dynamic row heights. * * * @param atRowIndex Update the data at this index row in the grid. * @param byRowHeight Update by the rowHeight provided. */ update(atRowIndex: number, byRowHeight: number): void; }