ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
102 lines (101 loc) • 5.55 kB
TypeScript
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 { AgColumnGroup } from '../entities/agColumnGroup';
import type { ColumnEventType } from '../events';
/** Per-section total pixel widths (left-pinned, centre body, right-pinned). */
type SectionWidths = {
left: number;
center: number;
right: number;
};
/** @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export declare class VisibleColsService extends BeanStub implements NamedBean {
beanName: "visibleCols";
private colModel;
private colGroupSvc;
private colViewport;
private ctrlsSvc;
private colFlex?;
private colFilter?;
private rowRenderer;
private rowAutoHeight?;
/** The `allColsIndex` of the last displayed centre col with `flex > 0`, -1 when none, counted per layout. */
lastFlexIndex: number;
treeLeft: (AgColumn | AgColumnGroup)[];
treeRight: (AgColumn | AgColumnGroup)[];
treeCenter: (AgColumn | AgColumnGroup)[];
leftCols: AgColumn[];
rightCols: AgColumn[];
centerCols: AgColumn[];
/** `leftCols + centerCols + rightCols` (RTL: right + center + left). */
allCols: AgColumn[];
/** `allCols` with `colDef.autoHeight`. Reused across refreshes to stay warm. */
readonly autoHeightCols: AgColumn[];
/** How many displayed columns have `colDef.colSpan`, sizing a row's colSpans cache; while not 0, rows can differ
* in the cells they draw. */
colSpanColCount: number;
/** `allCols` with a legacy `colDef.rowSpan`, whose cells re-read it as their row's data changes. */
readonly rowSpanCols: AgColumn[];
/** Number of header rows to render, accounting for group depth + padding rules. */
headerGroupRowCount: number;
/** Centre body width. Cached for body sizing and row insert/resize. */
bodyWidth: number;
leftWidth: number;
rightWidth: number;
totalWidth: number;
/** Bumped once per pass that restamps the column lefts, so anything derived from where the columns
* are can tell whether it is looking at the same layout without re-deriving it. */
layoutVersion: number;
/** A cell may have moved or resized with no section total changing since the cells were last placed. */
private cellsMoved;
/** The source of the first layout made inside a column update, whose layout events wait for its end. */
private pendingLayoutSource;
/** Bumped whenever `allCols` is replaced, so a cache keyed on the displayed columns need not hold the old list. */
displayedColsVersion: number;
/** The pinned-edge cols, so `setPinnedEdges` swaps the roles in O(1). */
private lastLeftPinnedCol;
private firstRightPinnedCol;
wireBeans(beans: BeanCollection): void;
/** `skipTreeBuild=true` reuses the trees; valid only when liveCols are unchanged (group toggle, width autosize).
* Returns the columns the flex pass sized, when one ran. */
refresh(source: ColumnEventType, skipTreeBuild: boolean): AgColumn[] | undefined;
/** Ends a resize, a fit or a flex pass; `widths` reuses totals already summed, else they are re-summed. */
updateBodyWidths(source: ColumnEventType, widths?: SectionWidths): void;
private layoutBodyWidths;
/** Body cells and header cells are sized and placed here, once every left and width is set, never by column events. */
private refreshCellPositions;
/** Each column and group reports how its layout changed since it last did, now that the layout is final: inside
* a column update, at its end, after its column events. */
private dispatchLayoutEvents;
/** Raises the layout events a column update deferred; called as it ends. */
raiseDeferredLayoutEvents(): void;
private raiseLayoutEvents;
/** Repositions each col's section-relative `left` without rebuilding the displayed set; returns
* per-section widths. Lighter sibling of `joinCols`, for resize / autosize / flex. */
setLeftValues(): SectionWidths;
private setLeftValuesOfGroups;
private setPinnedEdges;
private buildTrees;
/** Single pass over `colsList`: filter to displayable cols and bucket by pin, hiding a lone selection col. */
private partitionVisibleCols;
clear(): void;
private stampAriaColIndexes;
/** One pass over displayed cols: stamps `allColsIndex` (display order; RTL flips sections) and
* section-relative `left`, returning per-section widths so {@link layoutBodyWidths} needn't re-sum. */
private joinCols;
/** Lays one section's cols into `all`: stamps `allColsIndex` + section-relative `left`, folding in the
* per-column lists and `lastFlexIndex`/`headerGroupRowCount`. A method not a closure, so it allocates nothing. */
private layoutSection;
/** Restamps the lefts from 0, noting a moved one in `cellsMoved`; returns the section width. */
private setLeftsLeftToRight;
getColBefore(col: AgColumn): AgColumn | null;
getColAfter(col: AgColumn): AgColumn | null;
/** Prefer the recomputed width: the `leftWidth` cache can be stale mid column-move. */
getLeftStickyColumnContainerWidth(): number;
/** Prefer the recomputed width: the `rightWidth` cache can be stale mid column-move. */
getRightStickyColumnContainerWidth(): number;
isColAtEdge(col: AgColumn | AgColumnGroup, edge: 'first' | 'last'): boolean;
}
export {};