UNPKG

2.22 kBTypeScriptView Raw
1import * as React from 'react';
2import type { RowProps } from '../grid';
3import type { PaginationConfig } from '../pagination';
4import type { SpinProps } from '../spin';
5import Item from './Item';
6export type { ListItemMetaProps, ListItemProps } from './Item';
7export type { ListConsumerProps } from './context';
8export type ColumnCount = number;
9export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
10export interface ListGridType {
11 gutter?: RowProps['gutter'];
12 column?: ColumnCount;
13 xs?: ColumnCount;
14 sm?: ColumnCount;
15 md?: ColumnCount;
16 lg?: ColumnCount;
17 xl?: ColumnCount;
18 xxl?: ColumnCount;
19}
20export type ListSize = 'small' | 'default' | 'large';
21export type ListItemLayout = 'horizontal' | 'vertical';
22export interface ListProps<T> {
23 bordered?: boolean;
24 className?: string;
25 rootClassName?: string;
26 style?: React.CSSProperties;
27 children?: React.ReactNode;
28 dataSource?: T[];
29 extra?: React.ReactNode;
30 grid?: ListGridType;
31 id?: string;
32 itemLayout?: ListItemLayout;
33 loading?: boolean | SpinProps;
34 loadMore?: React.ReactNode;
35 pagination?: PaginationConfig | false;
36 prefixCls?: string;
37 rowKey?: ((item: T) => React.Key) | keyof T;
38 renderItem?: (item: T, index: number) => React.ReactNode;
39 size?: ListSize;
40 split?: boolean;
41 header?: React.ReactNode;
42 footer?: React.ReactNode;
43 locale?: ListLocale;
44}
45export interface ListLocale {
46 emptyText: React.ReactNode;
47}
48declare function InternalList<T>({ pagination, prefixCls: customizePrefixCls, bordered, split, className, rootClassName, style, children, itemLayout, loadMore, grid, dataSource, size: customizeSize, header, footer, loading, rowKey, renderItem, locale, ...rest }: ListProps<T>, ref: React.ForwardedRef<HTMLDivElement>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
49declare const ListWithForwardRef: (<T>(props: ListProps<T> & {
50 ref?: React.ForwardedRef<HTMLDivElement>;
51}) => ReturnType<typeof InternalList>) & Pick<React.FC, "displayName">;
52type CompoundedComponent = typeof ListWithForwardRef & {
53 Item: typeof Item;
54};
55declare const List: CompoundedComponent;
56export default List;