ant-design/components/upload/interface.tsx
偏右 aa89addcc2 Improve upload list (#4516)
* support prevent removing when return value is false, close #4456

* Add showRemoveIcon & showPreviewIcon into showUploadList

close #4384 & #4351

* fix typo
2017-01-10 20:15:02 +08:00

65 lines
1.6 KiB
TypeScript
Executable File

import React from 'react';
export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'
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;
}
export interface UploadChangeParam {
file: File;
fileList: Array<File>;
event?: { percent: number };
}
export interface ShowUploadListInterface {
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
}
export interface UploadProps {
type?: 'drag' | 'select';
name?: string;
defaultFileList?: Array<File>;
fileList?: Array<File>;
action: string;
data?: Object | ((file: File) => any);
headers?: HttpRequestHeader;
showUploadList?: boolean | ShowUploadListInterface;
multiple?: boolean;
accept?: string;
beforeUpload?: (file: File) => boolean | PromiseLike<any>;
onChange?: (info: UploadChangeParam) => void;
listType?: 'text' | 'picture' | 'picture-card';
className?: string;
onPreview?: (file: File) => void;
onRemove?: (file: File) => void | boolean;
supportServerRender?: boolean;
style?: React.CSSProperties;
disabled?: boolean;
prefixCls?: string;
}
export interface UploadListProps {
listType?: 'text' | 'picture' | 'picture-card';
onPreview?: (file: File) => void;
onRemove?: (file: File) => void | boolean;
items?: Array<File>;
progressAttr?: Object;
prefixCls?: string;
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
}