import type { CSSProperties, ComponentInternalInstance, Ref } from 'vue'; export type Instance = ComponentInternalInstance; export type Alignment = 'auto' | 'smart' | 'center' | 'start' | 'end'; export type ItemSize = (idx: number) => number; export type Direction = 'ltr' | 'rtl'; export type LayoutDirection = 'horizontal' | 'vertical'; export type RTLOffsetType = 'negative' | 'positive-descending' | 'positive-ascending'; export type ItemProps = { data: T; style: CSSProperties; scrolling?: boolean; index: number; }; export type ListItem = { offset: number; size: number; }; export type ListCache = { items: Record; estimatedItemSize: number; lastVisitedIndex: number; clearCacheAfterIndex: (idx: number, forceUpdate?: boolean) => void; }; export type GridCache = { column: Record; row: Record; estimatedColumnWidth: number; estimatedRowHeight: number; lastVisitedColumnIndex: number; lastVisitedRowIndex: number; }; export type ScrollDir = 'forwards' | 'backwards'; export type ListItemSizer> = (props: T, index: number, cache: ReturnType

) => number; export type GetEstimatedTotalSize> = (props: T, cache: ReturnType

) => number; export type GetOffset> = (props: T, idx: number, alignment: Alignment, offset: number, cache: ReturnType

) => number; export type GetStartIndexForOffset> = (props: T, offset: number, cache: ReturnType

) => number; export type GetStopIndexForStartIndex> = (props: T, startIndex: number, scrollOffset: number, cache: ReturnType

) => number; export type PropValidator = (props: T) => void; export type InitCacheFunc = (props: T, cache: Instance) => P; export type InitListCacheFunc = InitCacheFunc; export type InitGridCacheFunc = InitCacheFunc; export type ListConstructorProps = InitListCacheFunc> = { name?: string; getItemOffset: ListItemSizer; getEstimatedTotalSize: GetEstimatedTotalSize; getItemSize: ListItemSizer; getOffset: GetOffset; getStartIndexForOffset: GetStartIndexForOffset; getStopIndexForStartIndex: GetStopIndexForStartIndex; initCache: P; clearCache: boolean; validateProps: PropValidator; }; export type ExposesStates = { isScrolling: boolean; updateRequested: boolean; }; export type SharedExposes = { windowRef: Ref; innerRef: Ref; getItemStyleCache: (_: any, __: any, ___: any) => CSSProperties; }; export type ListExposes = { scrollTo: (offset: number) => void; scrollToItem: (idx: number, alignment?: Alignment) => void; states: { scrollDir: Direction; scrollOffset: number; } & ExposesStates; } & SharedExposes; export type GridExposes = { states: { scrollLeft: number; scrollTop: number; xAxisScrollDir: Direction; yAxisScrollDir: Direction; } & ExposesStates; scrollTo: (props: { scrollLeft: number; scrollTop: number; }) => void; scrollToItem: (columnIndex?: number, rowIndex?: number, alignment?: Alignment) => void; } & SharedExposes; export type ScrollbarExpose = { onMouseUp: () => void; }; export type GetGridOffset> = (props: T, index: number, alignment: Alignment, offset: number, cache: ReturnType

, scrollbarWidth: number) => number; export type GetPosition> = (props: T, index: number, cache: ReturnType

) => [number, number]; export type GridConstructorProps = InitGridCacheFunc> = { name?: string; getColumnOffset: GetGridOffset; getColumnPosition: GetPosition; getColumnStartIndexForOffset: GetStartIndexForOffset; getColumnStopIndexForStartIndex: GetStopIndexForStartIndex; getEstimatedTotalHeight: GetEstimatedTotalSize; getEstimatedTotalWidth: GetEstimatedTotalSize; getRowOffset: GetGridOffset; getRowPosition: GetPosition; getRowStartIndexForOffset: GetStartIndexForOffset; getRowStopIndexForStartIndex: GetStopIndexForStartIndex; initCache: P; injectToInstance?: (instance: Instance, cache: Ref>) => void; clearCache: boolean; validateProps: PropValidator; }; /** * Instance methods and emits */ export type GridDefaultSlotParams = { columnIndex: number; rowIndex: number; data: any; key: number | string; isScrolling?: boolean; style: CSSProperties; }; export type GridItemRenderedEvtParams = { columnCacheStart: number; columnCacheEnd: number; rowCacheStart: number; rowCacheEnd: number; columnVisibleStart: number; columnVisibleEnd: number; rowVisibleStart: number; rowVisibleEnd: number; }; export type GridScrollOptions = { scrollLeft?: number; scrollTop?: number; }; export type GridItemKeyGetter = (args: { columnIndex: number; data: T; rowIndex: number; }) => string | number;