UNPKG

8.96 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 { AgEvent } from "../events";
5import { Column } from "./column";
6import { RowNodeCache, RowNodeCacheParams } from "../rowModels/cache/rowNodeCache";
7import { RowNodeBlock } from "../rowModels/cache/rowNodeBlock";
8import { IEventEmitter } from "../interfaces/iEventEmitter";
9import { DetailGridInfo } from "../gridApi";
10export interface SetSelectedParams {
11 newValue: boolean;
12 clearSelection?: boolean;
13 suppressFinishActions?: boolean;
14 rangeSelect?: boolean;
15 groupSelectsFiltered?: boolean;
16}
17export interface RowNodeEvent extends AgEvent {
18 node: RowNode;
19}
20export interface DataChangedEvent extends RowNodeEvent {
21 oldData: any;
22 newData: any;
23 update: boolean;
24}
25export interface CellChangedEvent extends RowNodeEvent {
26 column: Column;
27 newValue: any;
28}
29export declare class RowNode implements IEventEmitter {
30 static EVENT_ROW_SELECTED: string;
31 static EVENT_DATA_CHANGED: string;
32 static EVENT_CELL_CHANGED: string;
33 static EVENT_ALL_CHILDREN_COUNT_CHANGED: string;
34 static EVENT_MOUSE_ENTER: string;
35 static EVENT_MOUSE_LEAVE: string;
36 static EVENT_HEIGHT_CHANGED: string;
37 static EVENT_TOP_CHANGED: string;
38 static EVENT_FIRST_CHILD_CHANGED: string;
39 static EVENT_LAST_CHILD_CHANGED: string;
40 static EVENT_CHILD_INDEX_CHANGED: string;
41 static EVENT_ROW_INDEX_CHANGED: string;
42 static EVENT_EXPANDED_CHANGED: string;
43 static EVENT_SELECTABLE_CHANGED: string;
44 static EVENT_UI_LEVEL_CHANGED: string;
45 static EVENT_DRAGGING_CHANGED: string;
46 private mainEventService;
47 private gridOptionsWrapper;
48 private selectionController;
49 private columnController;
50 private valueService;
51 private rowModel;
52 private context;
53 private valueCache;
54 private columnApi;
55 private gridApi;
56 /** Unique ID for the node. Either provided by the grid, or user can set to match the primary
57 * key in the database (or whatever data source is used). */
58 id: string;
59 /** The group data */
60 groupData: any;
61 /** The aggregated data */
62 aggData: any;
63 /** The user provided data */
64 data: any;
65 /** The parent node to this node, or empty if top level */
66 parent: RowNode;
67 /** How many levels this node is from the top */
68 level: number;
69 /** How many levels this node is from the top in the UI (different to the level when removing parents)*/
70 uiLevel: number;
71 /** If doing in memory grouping, this is the index of the group column this cell is for.
72 * This will always be the same as the level, unless we are collapsing groups ie groupRemoveSingleChildren = true */
73 rowGroupIndex: number;
74 /** True if this node is a group node (ie has children) */
75 group: boolean;
76 /** True if this row is getting dragged */
77 dragging: boolean;
78 /** True if this row is a master row, part of master / detail (ie row can be expanded to show detail) */
79 master: boolean;
80 /** True if this row is a detail row, part of master / detail (ie child row of an expanded master row)*/
81 detail: boolean;
82 /** If this row is a master row that was expanded, this points to the associated detail row. */
83 detailNode: RowNode;
84 /** If master detail, this contains details about the detail grid */
85 detailGridInfo: DetailGridInfo;
86 /** Same as master, kept for legacy reasons */
87 canFlower: boolean;
88 /** Same as detail, kept for legacy reasons */
89 flower: boolean;
90 /** Same as detailNode, kept for legacy reasons */
91 childFlower: RowNode;
92 /** True if this node is a group and the group is the bottom level in the tree */
93 leafGroup: boolean;
94 /** True if this is the first child in this group */
95 firstChild: boolean;
96 /** True if this is the last child in this group */
97 lastChild: boolean;
98 /** The index of this node in the group */
99 childIndex: number;
100 /** The index of this node in the grid, only valid if node is displayed in the grid, otherwise it should be ignored as old index may be present */
101 rowIndex: number;
102 /** Either 'top' or 'bottom' if row pinned, otherwise undefined or null */
103 rowPinned: string;
104 /** If using quick filter, stores a string representation of the row for searching against */
105 quickFilterAggregateText: string;
106 /** Groups only - True if row is a footer. Footers have group = true and footer = true */
107 footer: boolean;
108 /** Groups only - The field we are grouping on eg Country*/
109 field: string;
110 /** Groups only - the row group column for this group */
111 rowGroupColumn: Column;
112 /** Groups only - The key for the group eg Ireland, UK, USA */
113 key: any;
114 /** Used by server side row model, true if this row node is a stub */
115 stub: boolean;
116 /** All user provided nodes */
117 allLeafChildren: RowNode[];
118 /** Groups only - Children of this group */
119 childrenAfterGroup: RowNode[];
120 /** Groups only - Filtered children of this group */
121 childrenAfterFilter: RowNode[];
122 /** Groups only - Sorted children of this group */
123 childrenAfterSort: RowNode[];
124 /** Groups only - Number of children and grand children */
125 allChildrenCount: number;
126 /** Children mapped by the pivot columns */
127 childrenMapped: {
128 [key: string]: any;
129 };
130 /** Server Side Row Model Only - the children are in an infinite cache */
131 childrenCache: RowNodeCache<RowNodeBlock, RowNodeCacheParams>;
132 /** Groups only - True if group is expanded, otherwise false */
133 expanded: boolean;
134 /** Groups only - If doing footers, reference to the footer node for this group */
135 sibling: RowNode;
136 /** The height, in pixels, of this row */
137 rowHeight: number;
138 /** The top pixel for this row */
139 rowTop: number;
140 /** The top pixel for this row last time, makes sense if data set was ordered or filtered,
141 * it is used so new rows can animate in from their old position. */
142 oldRowTop: number;
143 /** True if this node is a daemon. This means row is not part of the model. Can happen when then
144 * the row is selected and then the user sets a different ID onto the node. The nodes is then
145 * representing a different entity, so the selection controller, if the node is selected, takes
146 * a copy where daemon=true. */
147 daemon: boolean;
148 /** True by default - can be overridden via gridOptions.isRowSelectable(rowNode) */
149 selectable: boolean;
150 /** Used by the value service, stores values for a particular change detection turn. */
151 __cacheData: {
152 [colId: string]: any;
153 };
154 __cacheVersion: number;
155 private selected;
156 private eventService;
157 setData(data: any): void;
158 private updateDataOnDetailNode();
159 private createDataChangedEvent(newData, oldData, update);
160 private createLocalRowEvent(type);
161 updateData(data: any): void;
162 getRowIndexString(): string;
163 private createDaemonNode();
164 setDataAndId(data: any, id: string): void;
165 private checkRowSelectable();
166 setRowSelectable(newVal: boolean): void;
167 setId(id: string): void;
168 isPixelInRange(pixel: number): boolean;
169 clearRowTop(): void;
170 setFirstChild(firstChild: boolean): void;
171 setLastChild(lastChild: boolean): void;
172 setChildIndex(childIndex: number): void;
173 setRowTop(rowTop: number): void;
174 setDragging(dragging: boolean): void;
175 setAllChildrenCount(allChildrenCount: number): void;
176 setRowHeight(rowHeight: number): void;
177 setRowIndex(rowIndex: number): void;
178 setUiLevel(uiLevel: number): void;
179 setExpanded(expanded: boolean): void;
180 private createGlobalRowEvent(type);
181 private dispatchLocalEvent(event);
182 setDataValue(colKey: string | Column, newValue: any): void;
183 setGroupValue(colKey: string | Column, newValue: any): void;
184 setAggData(newAggData: any): void;
185 hasChildren(): boolean;
186 isEmptyFillerNode(): boolean;
187 private dispatchCellChangedEvent(column, newValue);
188 resetQuickFilterAggregateText(): void;
189 isExpandable(): boolean;
190 isSelected(): boolean;
191 depthFirstSearch(callback: (rowNode: RowNode) => void): void;
192 calculateSelectedFromChildren(): void;
193 setSelectedInitialValue(selected: boolean): void;
194 setSelected(newValue: boolean, clearSelection?: boolean, suppressFinishActions?: boolean): void;
195 isRowPinned(): boolean;
196 setSelectedParams(params: SetSelectedParams): number;
197 private doRowRangeSelection();
198 isParentOfNode(potentialParent: RowNode): boolean;
199 selectThisNode(newValue: boolean): boolean;
200 private selectChildNodes(newValue, groupSelectsFiltered);
201 addEventListener(eventType: string, listener: Function): void;
202 removeEventListener(eventType: string, listener: Function): void;
203 onMouseEnter(): void;
204 onMouseLeave(): void;
205 getFirstChildOfFirstChild(rowGroupColumn: Column): RowNode;
206}