1 | import { ElementUIComponent } from './component'
|
2 |
|
3 | export type ListType = 'text' | 'picture' | 'picture-card'
|
4 | export type FileUploadStatus = 'ready' | 'uploading' | 'success' | 'fail'
|
5 |
|
6 | export interface FileListItem {
|
7 | name: string,
|
8 | url: string,
|
9 | status?: FileUploadStatus
|
10 | }
|
11 |
|
12 | export interface ElUploadInternalRawFile extends File {
|
13 | uid: number
|
14 | }
|
15 |
|
16 | export interface ElUploadInternalFileDetail {
|
17 | status: FileUploadStatus,
|
18 | name: string,
|
19 | size: number,
|
20 | percentage: number,
|
21 | uid: number,
|
22 | raw: ElUploadInternalRawFile,
|
23 | url?: string
|
24 | }
|
25 |
|
26 | export interface ElUploadProgressEvent extends ProgressEvent {
|
27 | percent: number
|
28 | }
|
29 |
|
30 | export interface HttpRequestOptions {
|
31 | headers: object,
|
32 | withCredentials: boolean,
|
33 | file: File,
|
34 | data: object,
|
35 | filename: string,
|
36 | action: string,
|
37 | onProgress: (e: ElUploadProgressEvent) => void,
|
38 | onSuccess: (response: any) => void,
|
39 | onError: (err: ErrorEvent) => void
|
40 | }
|
41 |
|
42 |
|
43 | export declare class ElUpload extends ElementUIComponent {
|
44 |
|
45 | action: string
|
46 |
|
47 |
|
48 | headers: object
|
49 |
|
50 |
|
51 | multiple: boolean
|
52 |
|
53 |
|
54 | data: object
|
55 |
|
56 |
|
57 | name: string
|
58 |
|
59 |
|
60 | withCredentials: boolean
|
61 |
|
62 |
|
63 | showFileList: boolean
|
64 |
|
65 |
|
66 | drag: boolean
|
67 |
|
68 |
|
69 | accept: string
|
70 |
|
71 |
|
72 | onPreview: (file: ElUploadInternalFileDetail) => void
|
73 |
|
74 |
|
75 | onRemove: (file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
76 |
|
77 |
|
78 | onSuccess: (response: any, file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
79 |
|
80 |
|
81 | onError: (err: ErrorEvent, file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
82 |
|
83 |
|
84 | onProgress: (event: ElUploadProgressEvent, file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
85 |
|
86 |
|
87 | onChange: (file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
88 |
|
89 |
|
90 | beforeUpload: (file: ElUploadInternalRawFile) => boolean | Promise<File | Blob | boolean>
|
91 |
|
92 |
|
93 | thumbnailMode: boolean
|
94 |
|
95 |
|
96 | fileList: FileListItem[]
|
97 |
|
98 |
|
99 | listType: ListType
|
100 |
|
101 |
|
102 | autoUpload: boolean
|
103 |
|
104 |
|
105 | httpRequest: (options: HttpRequestOptions) => void
|
106 |
|
107 |
|
108 | disabled: boolean
|
109 |
|
110 |
|
111 | limit: number
|
112 |
|
113 |
|
114 | onExceed: (file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
|
115 |
|
116 |
|
117 | clearFiles (): void;
|
118 |
|
119 |
|
120 | abort (file: ElUploadInternalFileDetail): void
|
121 |
|
122 |
|
123 | submit ():void;
|
124 | }
|