|
| 1 | +// tslint:disable:prefer-method-signature |
| 2 | +import { Observable } from 'rxjs/Observable'; |
| 3 | +import { Subscription } from 'rxjs/Subscription'; |
| 4 | + |
| 5 | +// tslint:disable:no-any |
| 6 | +/** 状态 */ |
| 7 | +export type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed'; |
| 8 | + |
| 9 | +/** 上传方式 */ |
| 10 | +export type UploadType = 'select' | 'drag'; |
| 11 | + |
| 12 | +/** 上传列表的内建样式 */ |
| 13 | +export type UploadListType = 'text' | 'picture' | 'picture-card'; |
| 14 | + |
| 15 | +/** 文件对象 */ |
| 16 | +export interface UploadFile { |
| 17 | + uid: string; |
| 18 | + size: number; |
| 19 | + name: string; |
| 20 | + filename?: string; |
| 21 | + lastModified?: string; |
| 22 | + lastModifiedDate?: Date; |
| 23 | + url?: string; |
| 24 | + status?: UploadFileStatus; |
| 25 | + originFileObj?: File; |
| 26 | + percent?: number; |
| 27 | + thumbUrl?: string; |
| 28 | + response?: any; |
| 29 | + error?: any; |
| 30 | + linkProps?: any; |
| 31 | + type: string; |
| 32 | + [key: string]: any; |
| 33 | +} |
| 34 | + |
| 35 | +export interface UploadChangeParam { |
| 36 | + file: UploadFile; |
| 37 | + fileList: UploadFile[]; |
| 38 | + event?: { percent: number }; |
| 39 | +} |
| 40 | + |
| 41 | +export interface ShowUploadListInterface { |
| 42 | + showRemoveIcon?: boolean; |
| 43 | + showPreviewIcon?: boolean; |
| 44 | +} |
| 45 | + |
| 46 | +export interface ZipButtonOptions { |
| 47 | + disabled?: boolean; |
| 48 | + accept?: string; |
| 49 | + action?: string; |
| 50 | + beforeUpload?: (file: UploadFile, fileList: UploadFile[]) => boolean | Observable<any>; |
| 51 | + customRequest?: (item: any) => Subscription; |
| 52 | + data?: {} | ((file: UploadFile) => {}); |
| 53 | + headers?: {}; |
| 54 | + name?: string; |
| 55 | + multiple?: boolean; |
| 56 | + withCredentials?: boolean; |
| 57 | + filters?: UploadFilter[]; |
| 58 | + onStart?: (file: UploadFile) => void; |
| 59 | + onProgress?: (e: any, file: UploadFile) => void; |
| 60 | + onSuccess?: (ret: any, file: UploadFile, xhr: any) => void; |
| 61 | + onError?: (err: any, file: UploadFile) => void; |
| 62 | +} |
| 63 | + |
| 64 | +export interface UploadFilter { |
| 65 | + name: string; |
| 66 | + fn: (fileList: UploadFile[]) => UploadFile[]; |
| 67 | +} |
0 commit comments