UNPKG

2.73 kBTypeScriptView Raw
1// Type definitions for ag-grid v18.1.2
2// Project: http://www.ag-grid.com/
3// Definitions by: Niall Crosby <https://github.com/ag-grid/>
4import { RowNode } from "../entities/rowNode";
5export interface RowBounds {
6 rowTop: number;
7 rowHeight: number;
8}
9export interface IRowModel {
10 /** Returns the rowNode at the given index. */
11 getRow(index: number): RowNode;
12 /** Returns the rowNode for given id. */
13 getRowNode(id: string): RowNode;
14 /** Returns the first and last rows to render. */
15 getPageFirstRow(): number;
16 getPageLastRow(): number;
17 /** This is legacy, not used by ag-Grid, but keeping for backward compatibility */
18 getRowCount(): number;
19 /** Returns the row index at the given pixel */
20 getRowIndexAtPixel(pixel: number): number;
21 /** Returns total height of all the rows - used to size the height of the grid div that contains the rows */
22 getCurrentPageHeight(): number;
23 /** Returns true if the provided rowNode is in the list of rows to render */
24 isRowPresent(rowNode: RowNode): boolean;
25 /** Returns row top and bottom for a given row */
26 getRowBounds(index: number): RowBounds;
27 /** Returns true if this model has no rows, regardless of model filter. EG if rows present, but filtered
28 * out, this still returns false. If it returns true, then the grid shows the 'no rows' overlay - but we
29 * don't show that overlay if the rows are just filtered out. */
30 isEmpty(): boolean;
31 /** Returns true if no rows (either no rows at all, or the rows are filtered out). This is what the grid
32 * uses to know if there are rows to render or not. */
33 isRowsToRender(): boolean;
34 /** Returns all rows in range that should be selected. If there is a gap in range (non ClientSideRowModel) then
35 * then no rows should be returned */
36 getNodesInRangeForSelection(first: RowNode, last: RowNode): RowNode[];
37 /** Iterate through each node. What this does depends on the model type. For clientSide, goes through
38 * all nodes. For pagination, goes through current page. For virtualPage, goes through what's loaded in memory. */
39 forEachNode(callback: (rowNode: RowNode) => void): void;
40 /** The base class returns the type. We use this instead of 'instanceof' as the client might provide
41 * their own implementation of the models in the future. */
42 getType(): string;
43 /**
44 * It tells us if this row model knows about the last row that it can produce. This is used by the
45 * PaginationPanel, if last row is not found, then the 'last' button is disabled and the last page is
46 * not shown. This is always true for ClientSideRowModel. It toggles for InfiniteRowModel.
47 */
48 isLastRowFound(): boolean;
49}