hightable
Version:
A dynamic windowed scrolling table component for react
29 lines (28 loc) • 1.31 kB
TypeScript
export interface ScrollContextType {
/** Total scrollable height, in pixels */
canvasHeight?: number;
/** Offset of the top of the visible slice from the top of the canvas, in pixels */
sliceTop?: number;
/** Index of the first row visible in the viewport (inclusive). Indexes refer to the virtual table domain. */
visibleRowsStart?: number;
/** Index of the last row visible in the viewport (exclusive). */
visibleRowsEnd?: number;
/** Index of the first row rendered in the DOM as a table row (inclusive). */
renderedRowsStart?: number;
/** Index of the last row rendered in the DOM as a table row (exclusive). */
renderedRowsEnd?: number;
/**
* Function to set the scrollTo function
*
* @param scrollTo The scrollTo function of the viewport element (on component mount), or undefined (on unmount)
*/
setScrollTo?: (scrollTo: HTMLElement['scrollTo'] | undefined) => void;
/**
* Function to call when the current scroll top position changes (on scroll)
*
* @param scrollTop The new scroll top position in pixels
*/
setScrollTop?: (scrollTop: number) => void;
}
export declare const defaultScrollContext: ScrollContextType;
export declare const ScrollContext: import("react").Context<ScrollContextType>;