Skip to content

Commit e2e0eb3

Browse files
author
binhaoCen
authored
chore: update type upload (#2743)
1 parent 9eebd8d commit e2e0eb3

File tree

1 file changed

+137
-127
lines changed

1 file changed

+137
-127
lines changed

types/upload.d.ts

Lines changed: 137 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -55,132 +55,142 @@ type TransformFileHandler = (
5555

5656
export declare class Upload extends AntdComponent {
5757
static Dragger: typeof Upload;
58+
$props: {
59+
/**
60+
* File types that can be accepted.
61+
* @type string
62+
*/
63+
accept?: string;
64+
65+
/**
66+
* Uploading URL
67+
* @type string | Function
68+
*/
69+
action?: string | Function;
70+
71+
/**
72+
* support upload whole directory
73+
* @type boolean
74+
* @see https://caniuse.com/#feat=input-file-directory
75+
*/
76+
directory?: boolean;
77+
78+
/**
79+
* Hook function which will be executed before uploading.
80+
* Uploading will be stopped with false or a rejected Promise returned.
81+
* Warning:this function is not supported in IE9.
82+
* @type Function
83+
*/
84+
beforeUpload?: (file: any, fileList: UploadFile[]) => boolean | Promise<boolean>;
85+
86+
/**
87+
* override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest
88+
* @type Function
89+
*/
90+
customRequest?: Function;
91+
92+
/**
93+
* Uploading params or function which can return uploading params.
94+
* @type object | Function
95+
*/
96+
data?: object | Function;
97+
/**
98+
* http method of upload request
99+
*/
100+
method?: 'POST' | 'PUT' | 'post' | 'put';
101+
102+
/**
103+
* Default list of files that have been uploaded.
104+
* @type UploadFile[]
105+
*/
106+
defaultFileList?: UploadFile[];
107+
108+
/**
109+
* disable upload button
110+
* @default false
111+
* @type boolean
112+
*/
113+
disabled?: boolean;
114+
115+
/**
116+
* List of files that have been uploaded (controlled)
117+
* @type UploadFile[]
118+
*/
119+
fileList?: UploadFile[];
120+
121+
/**
122+
* Set request headers, valid above IE10.
123+
* @type object
124+
*/
125+
headers?: object;
126+
127+
/**
128+
* Built-in stylesheets, support for three types: text, picture or picture-card
129+
* @default 'text'
130+
* @type string
131+
*/
132+
listType?: 'text' | 'picture' | 'picture-card';
133+
134+
/**
135+
* Whether to support selected multiple file. IE10+ supported.
136+
* You can select multiple files with CTRL holding down while multiple is set to be true
137+
* @default false
138+
* @type boolean
139+
*/
140+
multiple?: boolean;
141+
142+
/**
143+
* The name of uploading file
144+
* @default 'file'
145+
* @type string
146+
*/
147+
name?: string;
148+
149+
/**
150+
* Whether to show default upload list, could be an object to specify showPreviewIcon and showRemoveIcon individually
151+
* @default true
152+
* @type boolean | ShowUploadList
153+
*/
154+
showUploadList?: boolean | ShowUploadList;
155+
156+
/**
157+
* Need to be turned on while the server side is rendering.
158+
* @default false
159+
* @type boolean
160+
*/
161+
supportServerRender?: boolean;
162+
163+
/**
164+
* ajax upload with cookie sent
165+
* @default false
166+
* @type boolean
167+
*/
168+
withCredentials?: boolean;
169+
170+
/**
171+
* click open file dialog
172+
* @default true
173+
* @type boolean
174+
*/
175+
openFileDialogOnClick?: boolean;
176+
177+
/**
178+
* A callback function, will be executed when removing file button is clicked,
179+
* remove event will be prevented when return value is false or a Promise which resolve(false) or reject.
180+
* @type Function
181+
*/
182+
remove?: (file: any) => boolean | Promise<boolean>;
183+
184+
locale?: UploadLocale;
185+
id?: string;
186+
/**
187+
* Customize preview file logic (1.5.0)
188+
*/
189+
previewFile?: PreviewFileHandler;
190+
/**
191+
* Customize transform file before request (1.5.0)
192+
*/
193+
transformFile?: TransformFileHandler;
194+
}
58195

59-
/**
60-
* File types that can be accepted.
61-
* @type string
62-
*/
63-
accept: string;
64-
65-
/**
66-
* Uploading URL
67-
* @type string | Function
68-
*/
69-
action: string | Function;
70-
71-
/**
72-
* support upload whole directory
73-
* @type boolean
74-
* @see https://caniuse.com/#feat=input-file-directory
75-
*/
76-
directory: boolean;
77-
78-
/**
79-
* Hook function which will be executed before uploading.
80-
* Uploading will be stopped with false or a rejected Promise returned.
81-
* Warning:this function is not supported in IE9.
82-
* @type Function
83-
*/
84-
beforeUpload: (file: any, fileList: any) => boolean | Promise<boolean>;
85-
86-
/**
87-
* override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest
88-
* @type Function
89-
*/
90-
customRequest: Function;
91-
92-
/**
93-
* Uploading params or function which can return uploading params.
94-
* @type object | Function
95-
*/
96-
data: object | Function;
97-
98-
method?: 'POST' | 'PUT' | 'post' | 'put';
99-
100-
/**
101-
* Default list of files that have been uploaded.
102-
* @type UploadFile[]
103-
*/
104-
defaultFileList: UploadFile[];
105-
106-
/**
107-
* disable upload button
108-
* @default false
109-
* @type boolean
110-
*/
111-
disabled: boolean;
112-
113-
/**
114-
* List of files that have been uploaded (controlled)
115-
* @type UploadFile[]
116-
*/
117-
fileList: UploadFile[];
118-
119-
/**
120-
* Set request headers, valid above IE10.
121-
* @type object
122-
*/
123-
headers: object;
124-
125-
/**
126-
* Built-in stylesheets, support for three types: text, picture or picture-card
127-
* @default 'text'
128-
* @type string
129-
*/
130-
listType: 'text' | 'picture' | 'picture-card';
131-
132-
/**
133-
* Whether to support selected multiple file. IE10+ supported.
134-
* You can select multiple files with CTRL holding down while multiple is set to be true
135-
* @default false
136-
* @type boolean
137-
*/
138-
multiple: boolean;
139-
140-
/**
141-
* The name of uploading file
142-
* @default 'file'
143-
* @type string
144-
*/
145-
name: string;
146-
147-
/**
148-
* Whether to show default upload list, could be an object to specify showPreviewIcon and showRemoveIcon individually
149-
* @default true
150-
* @type boolean | ShowUploadList
151-
*/
152-
showUploadList: boolean | ShowUploadList;
153-
154-
/**
155-
* Need to be turned on while the server side is rendering.
156-
* @default false
157-
* @type boolean
158-
*/
159-
supportServerRender: boolean;
160-
161-
/**
162-
* ajax upload with cookie sent
163-
* @default false
164-
* @type boolean
165-
*/
166-
withCredentials: boolean;
167-
168-
/**
169-
* click open file dialog
170-
* @default true
171-
* @type boolean
172-
*/
173-
openFileDialogOnClick: boolean;
174-
175-
/**
176-
* A callback function, will be executed when removing file button is clicked,
177-
* remove event will be prevented when return value is false or a Promise which resolve(false) or reject.
178-
* @type Function
179-
*/
180-
remove: (file: any) => boolean | Promise<boolean>;
181-
182-
locale?: UploadLocale;
183-
id?: string;
184-
previewFile?: PreviewFileHandler;
185-
transformFile?: TransformFileHandler;
186196
}

0 commit comments

Comments
 (0)