Skip to content

Commit fd1554e

Browse files
authored
fix: update transfer, tree types (#2696)
* fix: update transfer, tree types * fix: update typo CSSProperties
1 parent 54d2418 commit fd1554e

File tree

4 files changed

+492
-344
lines changed

4 files changed

+492
-344
lines changed

types/transfer.d.ts

Lines changed: 136 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

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

78
export interface TransferItem {
89
key: string;
@@ -11,99 +12,141 @@ export interface TransferItem {
1112
disabled?: boolean;
1213
}
1314

15+
export declare type Direction = 'left' | 'right';
16+
1417
export declare class Transfer extends AntdComponent {
15-
/**
16-
* Used for setting the source data. The elements that are part of this array will be present the left column.
17-
* Except the elements whose keys are included in targetKeys prop.
18-
* @default []
19-
* @type TransferItem[]
20-
*/
21-
dataSource: TransferItem[];
22-
23-
/**
24-
* Whether disabled transfer
25-
* @default false
26-
* @type boolean
27-
*/
28-
disabled: boolean;
29-
30-
/**
31-
* A function to determine whether an item should show in search result list
32-
* @type Function
33-
*/
34-
filterOption: (inputValue: any, option: any) => boolean;
35-
36-
/**
37-
* customize the progress dot by setting a scoped slot
38-
* @type any (slot="footer" slot-scope="props")
39-
*/
40-
footer: any;
41-
42-
/**
43-
* property of vc-lazy-load for lazy rendering items. Turn off it by set to false.
44-
* @default { height: 32, offset: 32 }
45-
* @type object | boolean
46-
*/
47-
lazy: object | boolean;
48-
49-
/**
50-
* A custom CSS style used for rendering the transfer columns.
51-
* @type object
52-
*/
53-
listStyle: object;
54-
55-
/**
56-
* i18n text including filter, empty text, item unit, etc
57-
* @default { itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' }
58-
* @type object
59-
*/
60-
locale: {
61-
itemUnit: string;
62-
itemsUnit: string;
63-
notFoundContent: string;
64-
searchPlaceholder: string;
65-
};
18+
$props: {
19+
/**
20+
* Used for setting the source data. The elements that are part of this array will be present the left column.
21+
* Except the elements whose keys are included in targetKeys prop.
22+
* @default []
23+
* @type TransferItem[]
24+
*/
25+
dataSource?: TransferItem[];
26+
27+
/**
28+
* Whether disabled transfer
29+
* @default false
30+
* @type boolean
31+
*/
32+
disabled?: boolean;
33+
34+
/**
35+
* A function to determine whether an item should show in search result list
36+
* @type Function
37+
*/
38+
filterOption?: (inputValue?: any, option?: any) => boolean;
39+
40+
/**
41+
* customize the progress dot by setting a scoped slot
42+
* @type any (slot="footer" slot-scope="props")
43+
*/
44+
footer?: VNodeChild | JSX.Element;
45+
46+
/**
47+
* property of vc-lazy-load for lazy rendering items. Turn off it by set to false.
48+
* @default { height: 32, offset: 32 }
49+
* @type object | boolean
50+
*/
51+
lazy?: object | boolean;
52+
53+
/**
54+
* A custom CSS style used for rendering the transfer columns.
55+
* @type object
56+
*/
57+
listStyle?: CSSProperties;
58+
59+
/**
60+
* i18n text including filter, empty text, item unit, etc
61+
* @default { itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' }
62+
* @type object
63+
*/
64+
locale?: {
65+
itemUnit?: string;
66+
itemsUnit?: string;
67+
notFoundContent?: string;
68+
searchPlaceholder?: string;
69+
};
70+
71+
/**
72+
* A set of operations that are sorted from top to bottom.
73+
* @default ['>', '<']
74+
* @type string[]
75+
*/
76+
operations?: string[];
77+
78+
/**
79+
* The function to generate the item shown on a column.
80+
* Based on an record (element of the dataSource array),
81+
* this function should return a element which is generated from that record.
82+
* Also, it can return a plain object with value and label, label is a element and value is for title
83+
* @type Function
84+
*/
85+
render?: (record: TransferItem) => void;
6686

67-
/**
68-
* A set of operations that are sorted from top to bottom.
69-
* @default ['>', '<']
70-
* @type string[]
71-
*/
72-
operations: string[];
73-
74-
/**
75-
* The function to generate the item shown on a column.
76-
* Based on an record (element of the dataSource array),
77-
* this function should return a element which is generated from that record.
78-
* Also, it can return a plain object with value and label, label is a element and value is for title
79-
* @type Function
80-
*/
81-
render: (record: TransferItem) => void;
82-
83-
/**
84-
* A set of keys of selected items.
85-
* @default []
86-
* @type string[]
87-
*/
88-
selectedKeys: string[];
89-
90-
/**
91-
* If included, a search box is shown on each column.
92-
* @default false
93-
* @type boolean
94-
*/
95-
showSearch: boolean;
96-
97-
/**
98-
* A set of keys of elements that are listed on the right column.
99-
* @default []
100-
* @type string[]
101-
*/
102-
targetKeys: string[];
103-
104-
/**
105-
* A set of titles that are sorted from left to right.
106-
* @type string[]
107-
*/
108-
titles: string[];
87+
/**
88+
* A set of keys of selected items.
89+
* @default []
90+
* @type string[]
91+
*/
92+
selectedKeys?: string[];
93+
94+
/**
95+
* If included, a search box is shown on each column.
96+
* @default false
97+
* @type boolean
98+
*/
99+
showSearch?: boolean;
100+
101+
/**
102+
* Show select all checkbox on the header
103+
*
104+
* @version 1.5.0
105+
*/
106+
showSelectAll?: boolean;
107+
108+
/**
109+
* A set of keys of elements that are listed on the right column.
110+
* @default []
111+
* @type string[]
112+
*/
113+
targetKeys?: string[];
114+
115+
/**
116+
* A set of titles that are sorted from left to right.
117+
* @type string[]
118+
*/
119+
titles?: string[];
120+
121+
/**
122+
* A callback function that is executed when the transfer between columns is complete.
123+
*
124+
* @param targetKeys
125+
* @param direction
126+
* @param moveKeys
127+
*/
128+
onChange?: (targetKeys: any[], direction: Direction, moveKeys: any[]) => void;
129+
130+
/**
131+
* A callback function which is executed when scroll options list
132+
*
133+
* @param direction
134+
* @param e
135+
*/
136+
onScroll?: (direction: Direction, e: Event) => void;
137+
138+
/**
139+
* A callback function which is executed when search field are changed
140+
* @param direction
141+
* @param value
142+
*/
143+
onSearch?: (direction: Direction, value: string) => void;
144+
145+
/**
146+
* A callback function which is executed when selected items are changed.
147+
* @param sourceSelectedKeys
148+
* @param targetSelectedKeys
149+
*/
150+
onSelectChange?: (sourceSelectedKeys: any[], targetSelectedKeys: any[]) => void;
151+
};
109152
}

0 commit comments

Comments
 (0)