ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
264 lines (263 loc) • 13.2 kB
TypeScript
import type { CompBeanOwner } from '../../components/emptyBean';
import { BeanStub } from '../../context/beanStub';
import type { BeanCollection } from '../../context/context';
import type { AgColumn, ColumnLane } from '../../entities/agColumn';
import type { RowStyle } from '../../entities/gridOptions';
import type { RowNode } from '../../entities/rowNode';
import type { AgEventType } from '../../eventTypes';
import type { CellFocusedEvent, RowEvent } from '../../events';
import type { PinnedSectionWidths } from '../../headerRendering/headerUtils';
import type { BrandedType } from '../../interfaces/brandedType';
import type { RenderedRowEvent } from '../../interfaces/iCallbackParams';
import type { RefreshRowsParams } from '../../interfaces/iCellsParams';
import type { ColumnPinnedType } from '../../interfaces/iColumn';
import type { HorizontalSection, HorizontalSectionMap } from '../../interfaces/iGridSection';
import type { RowPosition } from '../../interfaces/iRowPosition';
import type { UserCompDetails } from '../../interfaces/iUserCompDetails';
import { CellCtrl } from '../cell/cellCtrl';
import type { ICellRenderer, ICellRendererParams } from '../cellRenderers/iCellRenderer';
import type { FullWidthTarget } from './iRowModeFeature';
import type { RowComp } from './rowComp';
type RowType = 'Normal' | 'FullWidth' | 'FullWidthLoading' | 'FullWidthGroup' | 'FullWidthDetail';
export type RowCtrlInstanceId = BrandedType<string, 'RowCtrlInstanceId'>;
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export interface IRowComp {
setDomOrder(domOrder: boolean): void;
toggleCss(cssClassName: string, on: boolean): void;
/** Called after a layout; a list is never mutated once given, so an unchanged lane is the same list. */
setCellCtrls(left: CellCtrl[], center: CellCtrl[], right: CellCtrl[], useFlushSync: boolean, colsVersion: number): void;
getPinnedLeftRowElement(): HTMLElement | undefined;
getScrollingRowElement(): HTMLElement | undefined;
getPinnedRightRowElement(): HTMLElement | undefined;
refreshPinnedSections(): void;
showFullWidth(compDetails: UserCompDetails): void;
showEmbeddedFullWidth?(compDetails: HorizontalSectionMap<UserCompDetails>): void;
/** `undefined` or one entry per renderer slot, empty where a slot has none; the caller skips both. */
getFullWidthCellRenderers(): (ICellRenderer | null | undefined)[] | undefined;
getFullWidthCellRendererParams(): ICellRendererParams | undefined;
getFullWidthCellRendererParamsForPinned?(pinned: ColumnPinnedType): ICellRendererParams | undefined;
setTop(top: string): void;
setTransform(transform: string): void;
setRowIndex(rowIndex: string): void;
setRowId(rowId: string): void;
setRowBusinessKey(businessKey: string): void;
setUserStyles(styles: RowStyle | undefined): void;
refreshFullWidth(getUpdatedParams: () => ICellRendererParams): boolean;
refreshEmbeddedFullWidth?(getUpdatedParams: (pinned: ColumnPinnedType) => ICellRendererParams): boolean;
}
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export interface RowGui {
rowComp: IRowComp;
element: HTMLElement;
/** React's bean for the mounted comp, else the row ctrl itself. */
compBean: BeanStub<any>;
}
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export type PinnedCellGroupWidths = PinnedSectionWidths;
export interface MappedPinnedCellGroupWidths extends PinnedCellGroupWidths {
renderLeft: boolean;
renderRight: boolean;
}
type RowCtrlEvent = RenderedRowEvent;
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export declare class RowCtrl extends BeanStub<RowCtrlEvent> implements CompBeanOwner {
readonly rowNode: RowNode;
readonly useAnimationFrameForCreate: boolean;
readonly printLayout: boolean;
readonly instanceId: RowCtrlInstanceId;
/** Scratch for the React list diff, trusted only where the list diffed holds this at that index. */
diffIndex: number;
/** The vanilla row comp drawing this; a ctrl is drawn by one container's list for its whole life, so the field
* is that container's. */
drawnRowComp: RowComp | undefined;
private readonly rowType;
private rowGui;
compBean: BeanStub<any> | undefined;
private readonly rowModeFeature;
private mappedPinnedWidths;
/** A spanned row's cell height belongs to the rows it covers, so auto height reaches it via the span. */
readonly spannedRow: boolean;
private firstRowOnPage;
private lastRowOnPage;
private active;
private rowFocused;
private slideInAnimation;
private fadeInAnimation;
/** Bound to the element of the comp it was made for, so it goes with that comp. */
private rowDragComp;
private paginationPage;
private lastMouseDownOnDragger;
private rowLevel;
rowStyles: RowStyle;
private readonly useTopPositioning;
rowId: string | null;
ariaRowIndex: number | null;
/** sanitised */
businessKey: string | null;
private businessKeyForNodeFunc;
isEmbeddedFullWidth: boolean;
embeddedSectionHasContent: HorizontalSectionMap<boolean>;
constructor(rowNode: RowNode, beans: BeanCollection, animateIn: boolean, useAnimationFrameForCreate: boolean, printLayout: boolean);
private isClientSideLoadingRow;
private createRowModeFeature;
private initRowBusinessKey;
private updateRowBusinessKey;
setComp(rowComp: IRowComp, element: HTMLElement, compBean: BeanStub<any> | undefined): void;
unsetComp(): void;
isCacheable(): boolean;
setCached(cached: boolean): void;
private initialiseRowComp;
private setRowCompRowBusinessKey;
private setRowCompRowId;
private executeSlideAndFadeAnimations;
private addRowDraggerToRow;
private destroyRowDragComp;
getModeCellRenderers(): (ICellRenderer<any> | null | undefined)[] | undefined;
private executeProcessRowPostCreateFunc;
/**
* Overridden by SpannedRowCtrl
*/
getNewCellCtrl(col: AgColumn): CellCtrl | undefined;
/**
* Overridden by SpannedRowCtrl, if span context changes cell needs rebuilt
*/
isCorrectCtrlForSpan(cell: CellCtrl): boolean;
/** Print layout has no pinned lanes, so everything scrolls. */
laneFor(column: AgColumn): ColumnLane;
setEmbeddedSectionHasContent(section: HorizontalSection, hasContent: boolean): void;
refreshPinnedCellGroupWidths(): void;
/** The same object while the widths are unchanged, so a comp skips an unchanged refresh by identity. */
getMappedPinnedCellGroupWidths(): MappedPinnedCellGroupWidths;
getPinnedCellGroupWidths(): PinnedCellGroupWidths;
/** A lane's cells for React's first render, so a row added in bulk shows no empty frame; `undefined` when the
* row lays its cells out on an animation frame, is not a normal row, or was destroyed. */
getInitialCellCtrls(lane: ColumnLane): CellCtrl[] | undefined;
getDomOrder(): boolean;
private listenOnDomOrder;
private setAnimateFlags;
isFullWidth(): boolean;
/** Called after refreshing cells or retaining a full width renderer. */
onRowRefreshed(): void;
getCurrentRowComp(): IRowComp | undefined;
getCurrentRowElement(): HTMLElement | undefined;
redrawThisRow(): void;
getRowType(): RowType;
/**
* A loading row holds a placeholder rather than real cell content, so the anchor stands in as the
* cell child that `role="row"` requires — the renderer is replaceable and cannot be relied on for it.
*/
getFullWidthAnchorRole(): 'gridcell' | 'presentation';
shouldCreateCellSections(): boolean;
getNotesFeature(): import("../../main-umd-noStyles").INotesFeature | undefined;
private addListeners;
/** Should only ever be triggered on source rows (i.e. not on pinned siblings) */
private onRowPinned;
private onRowNodeDataChanged;
refreshRow(params?: RefreshRowsParams & {
newData?: boolean;
}): void;
refreshSpans(): void;
/** The row's drawn colSpans by `colSpanIndex`, 0 where not read yet, filled by whoever walks the row;
* absent while no column spans or for a row drawing no cells. */
getColSpans(): number[] | undefined;
private postProcessCss;
private onRowNodeHighlightChanged;
private postProcessRowDragging;
private onDisplayedColumnsChanged;
private onVirtualColumnsChanged;
getRowPosition(): RowPosition;
onKeyboardNavigate(keyboardEvent: KeyboardEvent): void;
onTabKeyDown(keyboardEvent: KeyboardEvent): void;
getRowContentElement(): HTMLElement | null;
getNavigationColumn(): AgColumn;
getRowYPosition(): number;
onSuppressCellFocusChanged(suppressCellFocus: boolean): void;
onRowFocused(event?: CellFocusedEvent): void;
renderFocusedCell(): void;
recreateCell(cellCtrl: CellCtrl): void;
onMouseEvent(eventName: string, mouseEvent: MouseEvent): void;
createRowEvent<T extends AgEventType>(type: T, domEvent?: Event): RowEvent<T>;
private createRowEventWithSource;
private onRowDblClick;
findInfoForEvent(event?: Event): {
column: AgColumn;
pinned: ColumnPinnedType;
} | undefined;
getTargets(): FullWidthTarget[];
getTarget(element?: EventTarget | null): FullWidthTarget | undefined;
private onRowMouseDown;
isSuppressMouseEvent(mouseEvent: MouseEvent): boolean;
onRowClick(mouseEvent: MouseEvent): void;
setupDetailRowAutoHeight(eDetailGui: HTMLElement): void;
refreshAriaLevel(): void;
private onUiLevelChanged;
private isFirstRowOnPage;
private isLastRowOnPage;
protected refreshFirstAndLastRowStyles(): void;
getAllCellCtrls(): CellCtrl[];
private postProcessClassesFromGridOptions;
private postProcessRowClassRules;
private setStylesFromGridOptions;
protected getInitialRowClasses(): string[];
private processStylesFromGridOptions;
private onRowSelected;
announceDescription(cellCtrl?: CellCtrl): void;
private announceNoteDescription;
protected addHoverFunctionality(eGui: RowGui): void;
resetHoveredStatus(el?: HTMLElement): void;
getGui(): RowGui | undefined;
private roundRowTopToBounds;
isRowRendered(): boolean;
protected onRowHeightChanged(): void;
destroyFirstPass(suppressAnimation?: boolean): void;
destroySecondPass(): void;
private setFocusedClasses;
private onCellFocusChanged;
private updateRowFocused;
private onPinnedRowsChanged;
private onPaginationChanged;
private onTopChanged;
private onPaginationPixelOffsetChanged;
private onStickyBottomOffsetChanged;
/**
* Applies pagination offset, eg if on second page, and page height is 500px, then removes
* 500px from the top position, so a row with rowTop 600px is displayed at location 100px.
* reverse will take the offset away rather than add.
*/
private applyPaginationOffset;
setRowTop(pixels: number): void;
/**
* Applies pagination offset and pixel scaling to produce final top position.
* Rows are positioned relative to their container, not the section.
*/
private calculateRowTopPx;
/**
* The top needs to be set into the DOM element when the element is created, not updated afterwards.
* otherwise the transition would not work, as it would be transitioning from zero (the unset value).
* for example, suppose a row that is outside the viewport, then user does a filter to remove other rows
* and this row now appears in the viewport, and the row moves up (ie it was under the viewport and not rendered,
* but now is in the viewport) then a new RowComp is created, however it should have it's position initialised
* to below the viewport, so the row will appear to animate up. if we didn't set the initial position at creation
* time, the row would animate down (ie from position zero).
*/
getInitialRowTop(): string | undefined;
getInitialTransform(): string | undefined;
private getInitialRowTopShared;
private getCalculatedRowTop;
private setRowTopStyle;
/** The column's own cell, else the drawn cell spanning it; a span search runs a pending layout first. */
getCellCtrl(column: AgColumn): CellCtrl | undefined;
/** The cell drawn for the column itself, never one spanning it. */
getOwnCellCtrl(column: AgColumn): CellCtrl | undefined;
protected onRowIndexChanged(): void;
/**
* The 1-based, header- and pinned-lane-aware aria-rowindex for this row, derived on demand from the
* row node and beans. Independent of comp mount, so a cell can read it before the row's comp is set up
* (React mounts a child cell's effect before its parent row's).
*/
getAriaRowIndex(): number | null;
private updateRowIndexes;
}
/** Needs no RowCtrl, so a row that is not rendered gets the type it would render with. */
export declare const getRowTypeForNode: (beans: BeanCollection, rowNode: RowNode) => RowType;
export {};