UNPKG

@etsoo/react

Version:

TypeScript ReactJs UI Independent Framework

67 lines (66 loc) 1.74 kB
import { DataTypes } from "@etsoo/shared"; import React from "react"; import { Align, ListChildComponentProps, ListProps } from "react-window"; import { GridLoader } from "./GridLoader"; import { GridMethodRef } from "./GridMethodRef"; /** * Scroller vertical list props */ export type ScrollerListProps<T extends object> = GridLoader<T> & Omit<ListProps<T>, "outerRef" | "height" | "width" | "children" | "itemCount"> & { /** * Methods ref */ mRef?: React.Ref<ScrollerListForwardRef<T>>; /** * Outer div ref */ oRef?: React.Ref<HTMLDivElement>; /** * Height of the list */ height?: number; /** * Width of the list */ width?: number | string; /** * Id field */ idField?: DataTypes.Keys<T>; /** * Item renderer */ itemRenderer: (props: ListChildComponentProps<T>) => React.ReactElement; /** * Item size, a function indicates its a variable size list */ itemSize: ((index: number) => number) | number; }; /** * Scroller list ref */ export interface ScrollerListRef { /** * Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop). */ scrollTo(scrollOffset: number): void; /** * Scroll to the specified item. */ scrollToItem(index: number, align?: Align): void; } /** * Scroller list forward ref */ export interface ScrollerListForwardRef<T> extends GridMethodRef<T> { /** * Refresh latest page data */ refresh(): void; } /** * Scroller vertical list * @param props Props * @returns Component */ export declare const ScrollerList: <T extends object>(props: ScrollerListProps<T>) => import("react/jsx-runtime").JSX.Element;