Skip to content

Commit 54d2418

Browse files
authored
chore: update table, list types (#2694)
* fix: table typo * fix: list typo * fix: update table, list return JSX.Element typo * fix: xxxRender merge params * fix: change table event return type `void`
1 parent 17456b6 commit 54d2418

File tree

6 files changed

+539
-493
lines changed

6 files changed

+539
-493
lines changed

types/list/list-item.d.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44

55
import { AntdComponent } from '../component';
66
import { Meta } from '../meta';
7+
import { VNodeChild } from 'vue';
78

89
export declare class ListItem extends AntdComponent {
910
static Meta: typeof Meta;
1011

11-
/**
12-
* The actions content of list item. If itemLayout is vertical, shows the content on bottom,
13-
* otherwise shows content on the far right.
14-
* @type any (VNode[] | slot)
15-
*/
16-
actions: any;
12+
$props: {
13+
/**
14+
* The actions content of list item. If itemLayout is vertical, shows the content on bottom,
15+
* otherwise shows content on the far right.
16+
* @type any (VNode[] | slot)
17+
*/
18+
actions?: VNodeChild | JSX.Element;
1719

18-
/**
19-
* The extra content of list item. If itemLayout is vertical, shows the content on right,
20-
* otherwise shows content on the far right.
21-
* @type any (string | slot)
22-
*/
23-
extra: any;
20+
/**
21+
* The extra content of list item. If itemLayout is vertical, shows the content on right,
22+
* otherwise shows content on the far right.
23+
* @type any (string | slot)
24+
*/
25+
extra?: VNodeChild | JSX.Element;
26+
};
2427
}

types/list/list.d.ts

Lines changed: 102 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,104 +3,118 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

55
import { AntdComponent } from '../component';
6-
import { VNode } from 'vue';
6+
import { VNodeChild } from 'vue';
77
import { Pagination } from '../pagination';
88
import { ListItem } from './list-item';
99

1010
export declare type ColumnCount = '' | 1 | 2 | 3 | 4 | 6 | 8 | 12 | 24;
1111

1212
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;
1419
}
1520

1621
export class List extends AntdComponent {
1722
static Item: typeof ListItem;
1823

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;
45119
};
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;
106120
}

types/meta.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from './component';
5+
import { VNodeChild } from 'vue';
66

77
export declare class Meta {
88
$props: {
99
/**
1010
* The avatar of list item
1111
* @type any (slot)
1212
*/
13-
avatar: any;
13+
avatar?: VNodeChild;
1414

1515
/**
1616
* The description of list item
1717
* @type any (string | slot)
1818
*/
19-
description: any;
19+
description?: string | VNodeChild;
2020

2121
/**
2222
* The title of list item
2323
* @type any (string | slot)
2424
*/
25-
title: any;
25+
title?: string | VNodeChild;
2626
};
2727
}

types/table/column-group.d.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

55
import { AntdComponent } from '../component';
6+
import { VNodeChild } from 'vue';
67

78
export declare class ColumnGroup extends AntdComponent {
8-
/**
9-
* Title of the column group
10-
* @type any
11-
*/
12-
title: any;
9+
$props: {
10+
/**
11+
* Title of the column group
12+
* @type any
13+
*/
14+
title?: VNodeChild | JSX.Element;
1315

14-
/**
15-
* When using columns, you can use this property to configure the properties that support the slot,
16-
* such as slots: { title: 'XXX'}
17-
* @type object
18-
*/
19-
slots: object;
16+
/**
17+
* When using columns, you can use this property to configure the properties that support the slot,
18+
* such as slots: { title: 'XXX'}
19+
* @type object
20+
*/
21+
slots?: object;
22+
};
2023
}

0 commit comments

Comments
 (0)