2016-09-21 11:54:53 +08:00
|
|
|
import React from 'react';
|
2016-08-01 16:35:01 +08:00
|
|
|
|
2016-09-13 15:31:29 +08:00
|
|
|
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'
|
2016-08-01 16:35:01 +08:00
|
|
|
|
|
|
|
export interface HttpRequestHeader {
|
|
|
|
[key: string]: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface File {
|
|
|
|
uid: number;
|
|
|
|
size: number;
|
|
|
|
name: string;
|
|
|
|
lastModifiedDate?: Date;
|
|
|
|
url?: string;
|
|
|
|
status?: UploadFileStatus;
|
|
|
|
percent?: number;
|
|
|
|
thumbUrl?: string;
|
|
|
|
originFileObj?: File;
|
2017-02-15 20:58:40 +08:00
|
|
|
response?: string;
|
|
|
|
error?: any;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|
|
|
|
|
2016-09-13 15:31:29 +08:00
|
|
|
export interface UploadChangeParam {
|
2016-08-01 16:35:01 +08:00
|
|
|
file: File;
|
|
|
|
fileList: Array<File>;
|
|
|
|
event?: { percent: number };
|
|
|
|
}
|
|
|
|
|
2017-01-10 20:15:02 +08:00
|
|
|
export interface ShowUploadListInterface {
|
|
|
|
showRemoveIcon?: boolean;
|
|
|
|
showPreviewIcon?: boolean;
|
|
|
|
}
|
|
|
|
|
2016-08-01 16:35:01 +08:00
|
|
|
export interface UploadProps {
|
|
|
|
type?: 'drag' | 'select';
|
|
|
|
name?: string;
|
|
|
|
defaultFileList?: Array<File>;
|
|
|
|
fileList?: Array<File>;
|
|
|
|
action: string;
|
2016-10-18 11:55:00 +08:00
|
|
|
data?: Object | ((file: File) => any);
|
2016-08-01 16:35:01 +08:00
|
|
|
headers?: HttpRequestHeader;
|
2017-01-10 20:15:02 +08:00
|
|
|
showUploadList?: boolean | ShowUploadListInterface;
|
2016-08-01 16:35:01 +08:00
|
|
|
multiple?: boolean;
|
|
|
|
accept?: string;
|
2017-02-24 16:06:57 +08:00
|
|
|
beforeUpload?: (file: File, FileList: File[]) => boolean | PromiseLike<any>;
|
2016-08-01 16:35:01 +08:00
|
|
|
onChange?: (info: UploadChangeParam) => void;
|
|
|
|
listType?: 'text' | 'picture' | 'picture-card';
|
|
|
|
className?: string;
|
|
|
|
onPreview?: (file: File) => void;
|
2017-01-10 20:15:02 +08:00
|
|
|
onRemove?: (file: File) => void | boolean;
|
2016-08-01 16:35:01 +08:00
|
|
|
supportServerRender?: boolean;
|
|
|
|
style?: React.CSSProperties;
|
2016-08-16 18:07:37 +08:00
|
|
|
disabled?: boolean;
|
2016-09-14 16:18:33 +08:00
|
|
|
prefixCls?: string;
|
2017-02-24 16:06:57 +08:00
|
|
|
customRequest?: (option: any) => void;
|
|
|
|
withCredentials?: boolean;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface UploadListProps {
|
|
|
|
listType?: 'text' | 'picture' | 'picture-card';
|
|
|
|
onPreview?: (file: File) => void;
|
2017-01-10 20:15:02 +08:00
|
|
|
onRemove?: (file: File) => void | boolean;
|
2016-08-01 16:35:01 +08:00
|
|
|
items?: Array<File>;
|
|
|
|
progressAttr?: Object;
|
2016-09-14 16:18:33 +08:00
|
|
|
prefixCls?: string;
|
2017-01-10 20:15:02 +08:00
|
|
|
showRemoveIcon?: boolean;
|
|
|
|
showPreviewIcon?: boolean;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|