import { Alignment, CellSizeGetter, VisibleCellRange } from '../types'; interface CellSizeAndPositionManagerParams { cellCount: number; cellSizeGetter: CellSizeGetter; estimatedCellSize: number; } interface ConfigureParams { cellCount: number; estimatedCellSize: number; cellSizeGetter: CellSizeGetter; } interface GetUpdatedOffsetForIndex { align: Alignment; containerSize: number; currentOffset: number; targetIndex: number; } interface GetVisibleCellRangeParams { containerSize: number; offset: number; } export interface SizeAndPositionData { offset: number; size: number; } /** * Just-in-time calculates and caches size and position information for a collection of cells. */ export default class CellSizeAndPositionManager { _layoutVector: any; _lastMeasuredIndex: number; _cellCount: number; _cellSizeGetter: CellSizeGetter; _estimatedCellSize: number; constructor({ cellCount, cellSizeGetter, estimatedCellSize }: CellSizeAndPositionManagerParams); areOffsetsAdjusted(): boolean; configure({ cellCount, estimatedCellSize, cellSizeGetter }: ConfigureParams): void; getCellCount(): number; getEstimatedCellSize(): number; getLastMeasuredIndex(): number; getOffsetAdjustment(): number; /** * This method returns the size and position for the cell at the specified index. * It just-in-time calculates (or used cached values) for cells leading up to the index. */ getSizeAndPositionOfCell(index: number): SizeAndPositionData; getSizeAndPositionOfLastMeasuredCell(): SizeAndPositionData; /** * Total size of all cells being measured. * This value will be completely estimated initially. * As cells are measured, the estimate will be updated. */ getTotalSize(): number; /** * Determines a new offset that ensures a certain cell is visible, given the current offset. * If the cell is already visible then the current offset will be returned. * If the current offset is too great or small, it will be adjusted just enough to ensure the specified index is visible. * * @param align Desired alignment within container; one of "auto" (default), "start", or "end" * @param containerSize Size (width or height) of the container viewport * @param currentOffset Container's current (x or y) offset * @param totalSize Total size (width or height) of all cells * @return Offset to use to ensure the specified cell is visible */ getUpdatedOffsetForIndex({ align, containerSize, currentOffset, targetIndex }: GetUpdatedOffsetForIndex): number; getVisibleCellRange(params: GetVisibleCellRangeParams): VisibleCellRange; /** * Clear all cached values for cells after the specified index. * This method should be called for any cell that has changed its size. * It will not immediately perform any calculations; they'll be performed the next time getSizeAndPositionOfCell() is called. */ resetCell(index: number): void; /** * Searches for the cell (index) nearest the specified offset. * * If no exact match is found the next lowest cell index will be returned. * This allows partially visible cells (with offsets just before/above the fold) to be visible. */ _findNearestCell(offset: number): number; } export {}; //# sourceMappingURL=CellSizeAndPositionManager.d.ts.map