ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
82 lines (81 loc) • 4.46 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 { RowNode } from '../entities/rowNode';
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?;
/** True iff any centre col has `flex > 0` — lets the flex pass be skipped when nothing flexes. */
private flexActive;
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[];
/** 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;
/** `bodyWidth` changed in the last `updateBodyWidths()` — drives the RTL virtual-col calc. */
isBodyWidthDirty: boolean;
/** Prev refresh's pinned-edge cols — drive an O(1) role-swap in `setFirstRightAndLastLeftPinned`. */
private prevLastLeftPinned;
private prevFirstRightPinned;
wireBeans(beans: BeanCollection): void;
/** `skipTreeBuild=true` reuses the trees; valid only when liveCols are unchanged (group toggle, width autosize). */
refresh(source: ColumnEventType, skipTreeBuild: boolean): void;
/** `widths` reuses totals already computed on the hot `refresh` path; omit to re-sum. */
updateBodyWidths(widths?: SectionWidths): void;
/** 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(source: ColumnEventType): SectionWidths;
private setLeftValuesOfGroups;
private setFirstRightAndLastLeftPinned;
private buildTrees;
/** Single pass over `colsList`: filter to displayable cols and bucket by pin. The selection col is held
* back until a non-service col proves it isn't the only displayed col — a lone checkbox adds nothing. */
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 updateBodyWidths} needn't re-sum. */
private joinCols;
/** Lays one section's cols into `all`: stamps `allColsIndex` + section-relative `left`, folding in
* `autoHeightCols`/`flexActive`/`headerGroupRowCount`. A method not a closure, so it allocates nothing. */
private layoutSection;
getLeftColsForRow(rowNode: RowNode): AgColumn[];
getRightColsForRow(rowNode: RowNode): AgColumn[];
/** `filterCallback` is only set for the centre (virtualised) area. A col-spanned run is kept if
* ANY spanned col passes the filter. */
getColsForRow(rowNode: RowNode, displayedColumns: AgColumn[], filterCallback?: (column: AgColumn) => boolean, emptySpaceBeforeColumn?: (column: AgColumn) => boolean): AgColumn[];
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 {};