UNPKG

2.13 kBTypeScriptView Raw
1import * as React from 'react';
2import type { InnerProps } from './Filler';
3import type { ScrollBarDirectionType } from './ScrollBar';
4import type { RenderFunc, ExtraRenderInfo } from './interface';
5import type { ScrollPos, ScrollTarget } from './hooks/useScrollTo';
6export interface ScrollInfo {
7 x: number;
8 y: number;
9}
10export type ScrollConfig = ScrollTarget | ScrollPos;
11export type ScrollTo = (arg: number | ScrollConfig) => void;
12export type ListRef = {
13 scrollTo: ScrollTo;
14 getScrollInfo: () => ScrollInfo;
15};
16export interface ListProps<T> extends Omit<React.HTMLAttributes<any>, 'children'> {
17 prefixCls?: string;
18 children: RenderFunc<T>;
19 data: T[];
20 height?: number;
21 itemHeight?: number;
22 /** If not match virtual scroll condition, Set List still use height of container. */
23 fullHeight?: boolean;
24 itemKey: React.Key | ((item: T) => React.Key);
25 component?: string | React.FC<any> | React.ComponentClass<any>;
26 /** Set `false` will always use real scroll instead of virtual one */
27 virtual?: boolean;
28 direction?: ScrollBarDirectionType;
29 /**
30 * By default `scrollWidth` is same as container.
31 * When set this, it will show the horizontal scrollbar and
32 * `scrollWidth` will be used as the real width instead of container width.
33 */
34 scrollWidth?: number;
35 onScroll?: React.UIEventHandler<HTMLElement>;
36 /**
37 * Given the virtual offset value.
38 * It's the logic offset from start position.
39 */
40 onVirtualScroll?: (info: ScrollInfo) => void;
41 /** Trigger when render list item changed */
42 onVisibleChange?: (visibleList: T[], fullList: T[]) => void;
43 /** Inject to inner container props. Only use when you need pass aria related data */
44 innerProps?: InnerProps;
45 /** Render extra content into Filler */
46 extraRender?: (info: ExtraRenderInfo) => React.ReactNode;
47}
48export declare function RawList<T>(props: ListProps<T>, ref: React.Ref<ListRef>): React.JSX.Element;
49declare const _default: <Item = any>(props: ListProps<Item> & {
50 ref?: React.Ref<ListRef>;
51}) => React.ReactElement;
52export default _default;