|
3 | 3 | // Definitions: https://github.com/vueComponent/ant-design-vue/types
|
4 | 4 |
|
5 | 5 | import { AntdComponent } from '../component';
|
6 |
| -import { VNode } from 'vue'; |
| 6 | +import { VNodeChild } from 'vue'; |
7 | 7 | import { Pagination } from '../pagination';
|
8 | 8 | import { ListItem } from './list-item';
|
9 | 9 |
|
10 | 10 | export declare type ColumnCount = '' | 1 | 2 | 3 | 4 | 6 | 8 | 12 | 24;
|
11 | 11 |
|
12 | 12 | export declare class PaginationConfig extends Pagination {
|
13 |
| - position: 'top' | 'bottom' | 'both'; |
| 13 | + position?: 'top' | 'bottom' | 'both'; |
| 14 | +} |
| 15 | + |
| 16 | +export interface Item { |
| 17 | + item?: any; |
| 18 | + index?: number; |
14 | 19 | }
|
15 | 20 |
|
16 | 21 | export class List extends AntdComponent {
|
17 | 22 | static Item: typeof ListItem;
|
18 | 23 |
|
19 |
| - /** |
20 |
| - * Toggles rendering of the border around the list |
21 |
| - * @default false |
22 |
| - * @type boolean |
23 |
| - */ |
24 |
| - bordered: boolean; |
25 |
| - |
26 |
| - /** |
27 |
| - * List footer renderer |
28 |
| - * @type any (string | slot) |
29 |
| - */ |
30 |
| - footer: any; |
31 |
| - |
32 |
| - /** |
33 |
| - * The grid type of list. You can set grid to something like {gutter: 16, column: 4} |
34 |
| - * @type object |
35 |
| - */ |
36 |
| - grid: { |
37 |
| - gutter: number; |
38 |
| - column: ColumnCount; |
39 |
| - xs: ColumnCount; |
40 |
| - sm: ColumnCount; |
41 |
| - md: ColumnCount; |
42 |
| - lg: ColumnCount; |
43 |
| - xl: ColumnCount; |
44 |
| - xxl: ColumnCount; |
| 24 | + $props: { |
| 25 | + /** |
| 26 | + * Toggles rendering of the border around the list |
| 27 | + * @default false |
| 28 | + * @type boolean |
| 29 | + */ |
| 30 | + bordered?: boolean; |
| 31 | + |
| 32 | + /** |
| 33 | + * List footer renderer |
| 34 | + * @type any (string | slot) |
| 35 | + */ |
| 36 | + footer?: VNodeChild | JSX.Element; |
| 37 | + |
| 38 | + /** |
| 39 | + * The grid type of list. You can set grid to something like {gutter: 16, column: 4} |
| 40 | + * @type object |
| 41 | + */ |
| 42 | + grid?: { |
| 43 | + gutter?: number; |
| 44 | + column?: ColumnCount; |
| 45 | + xs?: ColumnCount; |
| 46 | + sm?: ColumnCount; |
| 47 | + md?: ColumnCount; |
| 48 | + lg?: ColumnCount; |
| 49 | + xl?: ColumnCount; |
| 50 | + xxl?: ColumnCount; |
| 51 | + }; |
| 52 | + |
| 53 | + /** |
| 54 | + * List header renderer |
| 55 | + * @type any (string | slot) |
| 56 | + */ |
| 57 | + header?: VNodeChild | JSX.Element; |
| 58 | + |
| 59 | + /** |
| 60 | + * The layout of list, default is horizontal, |
| 61 | + * If a vertical list is desired, set the itemLayout property to vertical |
| 62 | + * |
| 63 | + * @type string |
| 64 | + */ |
| 65 | + itemLayout?: string | 'horizontal' | 'vertical'; |
| 66 | + |
| 67 | + /** |
| 68 | + * Shows a loading indicator while the contents of the list are being fetched |
| 69 | + * @default false |
| 70 | + * @type boolean | object |
| 71 | + */ |
| 72 | + loading?: boolean | object; |
| 73 | + |
| 74 | + /** |
| 75 | + * Shows a load more content |
| 76 | + * @type any (string | slot) |
| 77 | + */ |
| 78 | + loadMore?: VNodeChild | JSX.Element; |
| 79 | + |
| 80 | + /** |
| 81 | + * i18n text including empty text |
| 82 | + * @default emptyText: 'No Data' |
| 83 | + * @type object |
| 84 | + */ |
| 85 | + locale?: object; |
| 86 | + |
| 87 | + /** |
| 88 | + * Pagination config, hide it by setting it to false |
| 89 | + * @default false |
| 90 | + * @type boolean | object |
| 91 | + */ |
| 92 | + pagination?: boolean | PaginationConfig; |
| 93 | + |
| 94 | + /** |
| 95 | + * Toggles rendering of the split under the list item |
| 96 | + * @default true |
| 97 | + * @type boolean |
| 98 | + */ |
| 99 | + split?: boolean; |
| 100 | + |
| 101 | + /** |
| 102 | + * dataSource array for list |
| 103 | + */ |
| 104 | + dataSource?: any[]; |
| 105 | + |
| 106 | + /** |
| 107 | + * Custom item renderer, slot="renderItem" and slot-scope="{ item, index }" |
| 108 | + * @default null |
| 109 | + * @type Function() |
| 110 | + */ |
| 111 | + renderItem?: (item?: Item) => VNodeChild | JSX.Element; |
| 112 | + |
| 113 | + /** |
| 114 | + * Specify the key that will be used for uniquely identify each element |
| 115 | + * @default null |
| 116 | + * @type Function |
| 117 | + */ |
| 118 | + rowKey?: (item: any) => string | number; |
45 | 119 | };
|
46 |
| - |
47 |
| - /** |
48 |
| - * List header renderer |
49 |
| - * @type any (string | slot) |
50 |
| - */ |
51 |
| - header: any; |
52 |
| - |
53 |
| - /** |
54 |
| - * The layout of list, default is horizontal, If a vertical list is desired, set the itemLayout property to vertical |
55 |
| - * @type string |
56 |
| - */ |
57 |
| - itemLayout: string; |
58 |
| - |
59 |
| - /** |
60 |
| - * Shows a loading indicator while the contents of the list are being fetched |
61 |
| - * @default false |
62 |
| - * @type boolean | object |
63 |
| - */ |
64 |
| - loading: boolean | object; |
65 |
| - |
66 |
| - /** |
67 |
| - * Shows a load more content |
68 |
| - * @type any (string | slot) |
69 |
| - */ |
70 |
| - loadMore: any; |
71 |
| - |
72 |
| - /** |
73 |
| - * i18n text including empty text |
74 |
| - * @default emptyText: 'No Data' |
75 |
| - * @type object |
76 |
| - */ |
77 |
| - locale: object; |
78 |
| - |
79 |
| - /** |
80 |
| - * Pagination config, hide it by setting it to false |
81 |
| - * @default false |
82 |
| - * @type boolean | object |
83 |
| - */ |
84 |
| - pagination: boolean | PaginationConfig; |
85 |
| - |
86 |
| - /** |
87 |
| - * Toggles rendering of the split under the list item |
88 |
| - * @default true |
89 |
| - * @type boolean |
90 |
| - */ |
91 |
| - split: boolean; |
92 |
| - |
93 |
| - /** |
94 |
| - * Custom item renderer, slot="renderItem" and slot-scope="item, index" |
95 |
| - * @default null |
96 |
| - * @type Function |
97 |
| - */ |
98 |
| - renderItem: (item: any, index: number) => VNode; |
99 |
| - |
100 |
| - /** |
101 |
| - * Specify the key that will be used for uniquely identify each element |
102 |
| - * @default null |
103 |
| - * @type Function |
104 |
| - */ |
105 |
| - rowKey: (item: any) => string | number; |
106 | 120 | }
|
0 commit comments