import { default as GridModel } from './gridModel'; /** Windowing parameters for the virtualized body. Rows are sliced by the adapter from these. */ export interface ViewportWindow { /** Index of the first row to render. */ startIndex: number; /** Number of rows to render starting at `startIndex`. */ take: number; /** Pixel offset to translate the rendered slice down to its scroll position. */ translateY: number; /** Total scrollable height of all rows. */ totalHeight: number; /** Fixed viewport height, or undefined when rendering all rows. */ viewHeight: number | undefined; } /** * Headless virtualization: given a scrollTop, computes which rows are visible and how * to position them. Pure math — `scrollTop` is owned by the adapter (so scrolling does * not notify the store / re-render the whole grid). */ export default class ViewportModel { readonly grid: GridModel; static readonly DEFAULT_VISIBLE_ROWS_COUNT = 10; static readonly ROWS_TO_PRELOAD = 20; constructor(grid: GridModel); get showAll(): boolean; get hasDetailRows(): boolean; get isEmpty(): boolean; /** Number of rows the viewport shows at once (all rows when `visibleRowsCount === 'all'`). */ get visibleRowsCount(): number; get viewHeight(): number | undefined; get totalHeight(): number; /** Height to reserve for the empty/no-data state. */ get emptyHeight(): number; /** Binary search for the first row whose offset is <= scrollTop (variable-height rows). */ private findStartIndex; window(scrollTop: number): ViewportWindow; }