ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
163 lines (162 loc) • 7.44 kB
TypeScript
import type { IEventListener } from 'ag-stack';
import type { NamedBean } from '../context/bean';
import { BeanStub } from '../context/beanStub';
import type { BeanCollection } from '../context/context';
import type { AgColumn } from '../entities/agColumn';
import type { RowNode } from '../entities/rowNode';
import type { RenderedRowEvent } from '../interfaces/iCallbackParams';
import type { RefreshCellsParams, RefreshRowsParams } from '../interfaces/iCellsParams';
import type { IRowNode } from '../interfaces/iRowNode';
import type { RowPosition } from '../interfaces/iRowPosition';
import type { CellCtrl } from './cell/cellCtrl';
import { RowCtrl } from './row/rowCtrl';
interface RowIdsByPinned {
top: Set<string | undefined>;
bottom: Set<string | undefined>;
normal: Set<string | undefined>;
}
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export declare class RowRenderer extends BeanStub implements NamedBean {
beanName: "rowRenderer";
private pageBounds;
private colModel;
private pinnedRowModel?;
private rowModel;
private focusSvc;
private rowContainerHeight;
private ctrlsSvc;
private editSvc?;
private visibleCols;
wireBeans(beans: BeanCollection): void;
private gridBodyCtrl;
/** The columns the cell listeners are on, copied as `colsList` can be reordered in place. */
private listenedCols;
firstRenderedRow: number;
lastRenderedRow: number;
private rowCtrlsByRowIndex;
private zombieRowCtrls;
private cachedRowCtrls;
allRowCtrls: RowCtrl[];
topRowCtrls: RowCtrl[];
bottomRowCtrls: RowCtrl[];
private pinningLeft;
private pinningRight;
firstVisibleVPixel: number;
lastVisibleVPixel: number;
private drawState;
private printLayout;
private embedFullWidthRows;
private stickyRowFeature?;
private dataFirstRenderedFired;
postConstruct(): void;
private initialise;
private initialiseCache;
private getKeepDetailRowsCount;
getStickyTopRowCtrls(): RowCtrl[];
getStickyBottomRowCtrls(): RowCtrl[];
private updateAllRowCtrls;
/**
* Notifies all row and cell controls of any change in focused cell.
* @param event cell focused event
*/
private updateCellFocus;
/**
* Called when a new cell is focused in the grid
* - if the focused cell isn't rendered; renders it on its row, or re-draws rows if the row isn't rendered either
* - subsequently updates all cell and row controls with the new focused cell
* @param event cell focused event
*/
private onCellFocusChanged;
private onSuppressCellFocusChanged;
private registerCellEventListeners;
private readonly setupRangeSelectionListeners;
private removeGridColumnListeners;
private refreshListenersToColumnsForCellComps;
private readonly onColDefChanged;
/** Called by the visible columns once every left and width is set; a cell writes only what moved, so a span rewritten later costs one write. */
refreshCellPositions(): void;
/** Called by the visible columns with the columns that left or reached a pinned edge, null where none did. */
refreshPinnedEdgeCells(prevLastLeft: AgColumn | null, newLastLeft: AgColumn | null, prevFirstRight: AgColumn | null, newFirstRight: AgColumn | null): void;
private onDomLayoutChanged;
datasourceChanged(): void;
private onPageLoaded;
/**
* @param column AgColumn
* @returns An array with HTMLElement for every cell of the column passed as param.
* If the cell is spanning across multiple columns, it only returns the html element
* if the column passed is the first column of the span (used for auto width calculation).
*/
getAllCellsNotSpanningForColumn(column: AgColumn): HTMLElement[];
private refreshPinnedRowComps;
/** Gives each pinned node its `RowCtrl`, the same one when recycling, and destroys the others in `rowCtrls`. */
private refreshPinnedRows;
private onPinnedRowDataChanged;
private onPinnedRowsChanged;
redrawRow(rowNode: RowNode, suppressEvent?: boolean): void;
redrawRows(rowNodes?: IRowNode[]): void;
private redrawAfterModelUpdate;
private scrollToTopIfNewData;
private updateContainerHeights;
private getLockOnRefresh;
/** Called in `finally`: a draw that has not set `ROWS_DRAWN` by then was ended by a throw. */
private releaseLockOnRefresh;
private showDrawnRows;
isRefreshInProgress(): boolean;
private restoreFocusedCell;
private findPositionToFocus;
getAllRowCtrls(): RowCtrl[];
addRenderedRowListener(eventName: RenderedRowEvent, rowIndex: number, callback: IEventListener<RenderedRowEvent>): void;
refreshCells({ rowNodes, columns, force, suppressFlash }?: RefreshCellsParams): void;
refreshRows(params?: RefreshRowsParams): void;
/** O(1) lookup of a RowCtrl by its RowNode (O(k) for sticky rows, where k is the sticky row count). */
getRowCtrlByNode(node: IRowNode): RowCtrl | undefined;
/** The ctrl at the node's own index, ignoring any sticky copy of the same node. */
private getIndexedRowCtrlByNode;
private getStickyRowCtrlByNode;
/** Refreshes the rendered row for the given node if it is currently in the viewport. Null-safe: no-op when node is null or undefined. */
refreshRowByNode(node: IRowNode | null | undefined): void;
/**
* @param rowNodes if provided, returns the RowCtrls for the provided rowNodes. otherwise returns all RowCtrls.
*/
getRowCtrls(rowNodes?: IRowNode[] | null): RowCtrl[];
getCellCtrls(rowNodes?: IRowNode[] | null, columns?: (string | AgColumn)[]): CellCtrl[];
destroy(): void;
private removeAllRowComps;
private getRowsToRecycle;
private removeRowCtrls;
private onBodyScroll;
redraw(params?: {
afterScroll?: boolean;
force?: boolean;
}): void;
private removeRowCompsNotToDraw;
private calculateIndexesToDraw;
private recycleRows;
private dispatchDisplayedRowsChanged;
private onDisplayedColumnsChanged;
private redrawFullWidthEmbeddedRows;
getFullWidthRowCtrls(rowNodes?: IRowNode[]): RowCtrl[];
private createOrUpdateRowCtrl;
private destroyRowCtrls;
private getRowBuffer;
private getRowBufferInPixels;
private workOutFirstAndLastRowsToRender;
/**
* This event will only be fired once, and is queued until after the browser next renders.
* This allows us to fire an event during the start of the render cycle, when we first see data being rendered
* but not execute the event until all of the data has finished being rendered to the dom.
*/
dispatchFirstDataRenderedEvent(): void;
private ensureAllRowsInRangeHaveHeightsCalculated;
private doNotUnVirtualiseRow;
private isRowPresent;
private createRowCon;
getRenderedNodes(): RowNode<any>[];
/** The column starting the cell that covers `column` in `rowNode`'s row, rendered or not. */
getSpanningCol(column: AgColumn, rowNode: RowNode): AgColumn;
getRowByPosition(rowPosition: RowPosition): RowCtrl | null;
isRangeInRenderedViewport(startIndex: number, endIndex: number): boolean;
}
export declare function mapRowNodes(rowNodes?: IRowNode[] | null): RowIdsByPinned | undefined;
export declare function isRowInMap(rowNode: RowNode, rowIdsMap: RowIdsByPinned): boolean;
export {};