index.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import * as React from 'react';
  2. import type { RowProps } from '../grid';
  3. import type { PaginationConfig } from '../pagination';
  4. import type { SpinProps } from '../spin';
  5. import Item from './Item';
  6. export type { ListItemMetaProps, ListItemProps } from './Item';
  7. export type { ListConsumerProps } from './context';
  8. export type ColumnCount = number;
  9. export type ColumnType = 'gutter' | 'column' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
  10. export 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. }
  20. export type ListSize = 'small' | 'default' | 'large';
  21. export type ListItemLayout = 'horizontal' | 'vertical';
  22. export 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. }
  45. export interface ListLocale {
  46. emptyText: React.ReactNode;
  47. }
  48. declare function InternalList<T>(props: ListProps<T>, ref: React.ForwardedRef<HTMLDivElement>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
  49. declare const ListWithForwardRef: (<T>(props: ListProps<T> & {
  50. ref?: React.ForwardedRef<HTMLDivElement>;
  51. }) => ReturnType<typeof InternalList>) & Pick<React.FC, "displayName">;
  52. type CompoundedComponent = typeof ListWithForwardRef & {
  53. Item: typeof Item;
  54. };
  55. declare const List: CompoundedComponent;
  56. export default List;