1 | /**
|
2 | * This object contains the cache of the various row heights that are present inside
|
3 | * the data table. Its based on Fenwick tree data structure that helps with
|
4 | * querying sums that have time complexity of log n.
|
5 | *
|
6 | * Fenwick Tree Credits: http://petr-mitrichev.blogspot.com/2013/05/fenwick-tree-range-updates.html
|
7 | * https://github.com/mikolalysenko/fenwick-tree
|
8 | *
|
9 | */
|
10 | export declare class RowHeightCache {
|
11 | /**
|
12 | * Tree Array stores the cumulative information of the row heights to perform efficient
|
13 | * range queries and updates. Currently the tree is initialized to the base row
|
14 | * height instead of the detail row height.
|
15 | */
|
16 | private treeArray;
|
17 | /**
|
18 | * Clear the Tree array.
|
19 | */
|
20 | clearCache(): void;
|
21 | /**
|
22 | * Initialize the Fenwick tree with row Heights.
|
23 | *
|
24 | * @param rows The array of rows which contain the expanded status.
|
25 | * @param rowHeight The row height.
|
26 | * @param detailRowHeight The detail row height.
|
27 | */
|
28 | initCache(details: any): void;
|
29 | /**
|
30 | * Given the ScrollY position i.e. sum, provide the rowIndex
|
31 | * that is present in the current view port. Below handles edge cases.
|
32 | */
|
33 | getRowIndex(scrollY: number): number;
|
34 | /**
|
35 | * When a row is expanded or rowHeight is changed, update the height. This can
|
36 | * be utilized in future when Angular Data table supports dynamic row heights.
|
37 | */
|
38 | update(atRowIndex: number, byRowHeight: number): void;
|
39 | /**
|
40 | * Range Sum query from 1 to the rowIndex
|
41 | */
|
42 | query(atIndex: number): number;
|
43 | /**
|
44 | * Find the total height between 2 row indexes
|
45 | */
|
46 | queryBetween(atIndexA: number, atIndexB: number): number;
|
47 | /**
|
48 | * Given the ScrollY position i.e. sum, provide the rowIndex
|
49 | * that is present in the current view port.
|
50 | */
|
51 | private calcRowIndex;
|
52 | }
|