Merge branch 'feat-vue3' of github.com:vueComponent/ant-design-vue into feat-vue3

pull/2750/head
undefined 2020-08-22 09:19:11 +08:00
commit 4636463fde
1 changed files with 119 additions and 109 deletions

228
types/upload.d.ts vendored
View File

@ -55,132 +55,142 @@ type TransformFileHandler = (
export declare class Upload extends AntdComponent { export declare class Upload extends AntdComponent {
static Dragger: typeof Upload; static Dragger: typeof Upload;
$props: {
/**
* File types that can be accepted.
* @type string
*/
accept?: string;
/** /**
* File types that can be accepted. * Uploading URL
* @type string * @type string | Function
*/ */
accept: string; action?: string | Function;
/** /**
* Uploading URL * support upload whole directory
* @type string | Function * @type boolean
*/ * @see https://caniuse.com/#feat=input-file-directory
action: string | Function; */
directory?: boolean;
/** /**
* support upload whole directory * Hook function which will be executed before uploading.
* @type boolean * Uploading will be stopped with false or a rejected Promise returned.
* @see https://caniuse.com/#feat=input-file-directory * Warningthis function is not supported in IE9.
*/ * @type Function
directory: boolean; */
beforeUpload?: (file: any, fileList: UploadFile[]) => boolean | Promise<boolean>;
/** /**
* Hook function which will be executed before uploading. * override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest
* Uploading will be stopped with false or a rejected Promise returned. * @type Function
* Warningthis function is not supported in IE9. */
* @type Function customRequest?: Function;
*/
beforeUpload: (file: any, fileList: any) => boolean | Promise<boolean>;
/** /**
* override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest * Uploading params or function which can return uploading params.
* @type Function * @type object | Function
*/ */
customRequest: Function; data?: object | Function;
/**
* http method of upload request
*/
method?: 'POST' | 'PUT' | 'post' | 'put';
/** /**
* Uploading params or function which can return uploading params. * Default list of files that have been uploaded.
* @type object | Function * @type UploadFile[]
*/ */
data: object | Function; defaultFileList?: UploadFile[];
method?: 'POST' | 'PUT' | 'post' | 'put'; /**
* disable upload button
* @default false
* @type boolean
*/
disabled?: boolean;
/** /**
* Default list of files that have been uploaded. * List of files that have been uploaded (controlled)
* @type UploadFile[] * @type UploadFile[]
*/ */
defaultFileList: UploadFile[]; fileList?: UploadFile[];
/** /**
* disable upload button * Set request headers, valid above IE10.
* @default false * @type object
* @type boolean */
*/ headers?: object;
disabled: boolean;
/** /**
* List of files that have been uploaded (controlled) * Built-in stylesheets, support for three types: text, picture or picture-card
* @type UploadFile[] * @default 'text'
*/ * @type string
fileList: UploadFile[]; */
listType?: 'text' | 'picture' | 'picture-card';
/** /**
* Set request headers, valid above IE10. * Whether to support selected multiple file. IE10+ supported.
* @type object * You can select multiple files with CTRL holding down while multiple is set to be true
*/ * @default false
headers: object; * @type boolean
*/
multiple?: boolean;
/** /**
* Built-in stylesheets, support for three types: text, picture or picture-card * The name of uploading file
* @default 'text' * @default 'file'
* @type string * @type string
*/ */
listType: 'text' | 'picture' | 'picture-card'; name?: string;
/** /**
* Whether to support selected multiple file. IE10+ supported. * Whether to show default upload list, could be an object to specify showPreviewIcon and showRemoveIcon individually
* You can select multiple files with CTRL holding down while multiple is set to be true * @default true
* @default false * @type boolean | ShowUploadList
* @type boolean */
*/ showUploadList?: boolean | ShowUploadList;
multiple: boolean;
/** /**
* The name of uploading file * Need to be turned on while the server side is rendering.
* @default 'file' * @default false
* @type string * @type boolean
*/ */
name: string; supportServerRender?: boolean;
/** /**
* Whether to show default upload list, could be an object to specify showPreviewIcon and showRemoveIcon individually * ajax upload with cookie sent
* @default true * @default false
* @type boolean | ShowUploadList * @type boolean
*/ */
showUploadList: boolean | ShowUploadList; withCredentials?: boolean;
/** /**
* Need to be turned on while the server side is rendering. * click open file dialog
* @default false * @default true
* @type boolean * @type boolean
*/ */
supportServerRender: boolean; openFileDialogOnClick?: boolean;
/** /**
* ajax upload with cookie sent * A callback function, will be executed when removing file button is clicked,
* @default false * remove event will be prevented when return value is false or a Promise which resolve(false) or reject.
* @type boolean * @type Function
*/ */
withCredentials: boolean; remove?: (file: any) => boolean | Promise<boolean>;
/** locale?: UploadLocale;
* click open file dialog id?: string;
* @default true /**
* @type boolean * Customize preview file logic (1.5.0)
*/ */
openFileDialogOnClick: boolean; previewFile?: PreviewFileHandler;
/**
* Customize transform file before request (1.5.0)
*/
transformFile?: TransformFileHandler;
}
/**
* A callback function, will be executed when removing file button is clicked,
* remove event will be prevented when return value is false or a Promise which resolve(false) or reject.
* @type Function
*/
remove: (file: any) => boolean | Promise<boolean>;
locale?: UploadLocale;
id?: string;
previewFile?: PreviewFileHandler;
transformFile?: TransformFileHandler;
} }