UNPKG

tdesign-react

Version:
29 lines (28 loc) 865 B
import type { ScrollToElementParams, TScroll } from '../common'; export type UseVirtualScrollParams = { enable?: boolean; data: { [key: string]: any; }[]; scroll: TScroll & { fixedRows?: Array<number>; }; }; export type RowMountedParams = { ref: HTMLElement; data: { [key: string]: any; __VIRTUAL_SCROLL_INDEX?: number; }; }; declare const useVirtualScroll: (container: React.MutableRefObject<HTMLElement>, params: UseVirtualScrollParams) => { visibleData: any[]; translateY: number; scrollHeight: number; isVirtualScroll: boolean; handleScroll: () => void; handleRowMounted: (rowData: RowMountedParams) => void; scrollToElement: (p: ScrollToElementParams) => void; }; export type VirtualScrollConfig = ReturnType<typeof useVirtualScroll>; export default useVirtualScroll;