rowNode.d.ts 9.8 KB

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