|
| 1 | +import { PropType } from "vue"; |
| 2 | +export interface ChunkOptions { |
| 3 | + headers: { |
| 4 | + [key: string]: any; |
| 5 | + }; |
| 6 | + action: string; |
| 7 | + minSize: number; |
| 8 | + maxActive: number; |
| 9 | + maxRetries: number; |
| 10 | + handler: any; |
| 11 | +} |
| 12 | +export interface Data { |
| 13 | + active: boolean; |
| 14 | + dropActive: boolean; |
| 15 | + files: VueUploadItem[]; |
| 16 | + maps: { |
| 17 | + [key: string]: VueUploadItem; |
| 18 | + }; |
| 19 | + destroy: boolean; |
| 20 | + uploading: number; |
| 21 | + features: Features; |
| 22 | + dropElement: null | HTMLElement; |
| 23 | +} |
| 24 | +export interface Features { |
| 25 | + html5: boolean; |
| 26 | + directory: boolean; |
| 27 | + drop: boolean; |
| 28 | +} |
| 29 | +export interface VueUploadItem { |
| 30 | + id: string; |
| 31 | + readonly fileObject?: boolean; |
| 32 | + name?: string; |
| 33 | + size?: number; |
| 34 | + type?: string; |
| 35 | + active?: boolean; |
| 36 | + error?: Error | string; |
| 37 | + success?: boolean; |
| 38 | + postAction?: string; |
| 39 | + putAction?: string; |
| 40 | + timeout?: number; |
| 41 | + data?: { |
| 42 | + [key: string]: any; |
| 43 | + }; |
| 44 | + headers?: { |
| 45 | + [key: string]: any; |
| 46 | + }; |
| 47 | + response?: { |
| 48 | + [key: string]: any; |
| 49 | + }; |
| 50 | + progress?: string; |
| 51 | + speed?: 0; |
| 52 | + file?: Blob; |
| 53 | + xhr?: XMLHttpRequest; |
| 54 | + el?: HTMLInputElement; |
| 55 | + iframe?: HTMLElement; |
| 56 | + [key: string]: any; |
| 57 | +} |
| 58 | +export interface FileSystemEntry { |
| 59 | + isDirectory: boolean; |
| 60 | + isFile: boolean; |
| 61 | + name: string; |
| 62 | + fullPath: string; |
| 63 | + filesystem: string; |
| 64 | +} |
| 65 | +export interface FileSystemDirectoryReader { |
| 66 | + readEntries: (successCallback: (result: Array<FileSystemDirectoryEntry | FileSystemFileEntry>) => void, errorCallback?: (error: DOMError) => void) => void; |
| 67 | +} |
| 68 | +export interface FileSystemFlags { |
| 69 | + create?: boolean; |
| 70 | + exclusive?: boolean; |
| 71 | +} |
| 72 | +export interface FileSystemDirectoryEntry extends FileSystemEntry { |
| 73 | + isDirectory: true; |
| 74 | + isFile: false; |
| 75 | + createReader: () => FileSystemDirectoryReader; |
| 76 | + getFile: (path?: string, options?: FileSystemFlags, successCallback?: (result: FileSystemFileEntry) => void, errorCallback?: (error: DOMError) => void) => void; |
| 77 | + getDirectory: (path?: string, options?: FileSystemFlags, successCallback?: (result: FileSystemDirectoryEntry) => void, errorCallback?: (error: DOMError) => void) => void; |
| 78 | +} |
| 79 | +export interface FileSystemFileEntry extends FileSystemEntry { |
| 80 | + isDirectory: false; |
| 81 | + isFile: true; |
| 82 | + file: (cb: (file: File) => void) => void; |
| 83 | +} |
| 84 | +declare const _default: import("vue").DefineComponent<{ |
| 85 | + inputId: { |
| 86 | + type: StringConstructor; |
| 87 | + }; |
| 88 | + name: { |
| 89 | + type: StringConstructor; |
| 90 | + default: string; |
| 91 | + }; |
| 92 | + accept: { |
| 93 | + type: StringConstructor; |
| 94 | + }; |
| 95 | + capture: {}; |
| 96 | + disabled: { |
| 97 | + default: boolean; |
| 98 | + }; |
| 99 | + multiple: { |
| 100 | + type: BooleanConstructor; |
| 101 | + default: boolean; |
| 102 | + }; |
| 103 | + maximum: { |
| 104 | + type: NumberConstructor; |
| 105 | + }; |
| 106 | + addIndex: { |
| 107 | + type: (BooleanConstructor | NumberConstructor)[]; |
| 108 | + }; |
| 109 | + directory: { |
| 110 | + type: BooleanConstructor; |
| 111 | + }; |
| 112 | + createDirectory: { |
| 113 | + type: BooleanConstructor; |
| 114 | + default: boolean; |
| 115 | + }; |
| 116 | + postAction: { |
| 117 | + type: StringConstructor; |
| 118 | + }; |
| 119 | + putAction: { |
| 120 | + type: StringConstructor; |
| 121 | + }; |
| 122 | + customAction: { |
| 123 | + type: PropType<(file: VueUploadItem, self: any) => Promise<VueUploadItem>>; |
| 124 | + }; |
| 125 | + headers: { |
| 126 | + type: PropType<{ |
| 127 | + [key: string]: any; |
| 128 | + }>; |
| 129 | + default: () => {}; |
| 130 | + }; |
| 131 | + data: { |
| 132 | + type: PropType<{ |
| 133 | + [key: string]: any; |
| 134 | + }>; |
| 135 | + default: () => {}; |
| 136 | + }; |
| 137 | + timeout: { |
| 138 | + type: NumberConstructor; |
| 139 | + default: number; |
| 140 | + }; |
| 141 | + drop: { |
| 142 | + default: boolean; |
| 143 | + }; |
| 144 | + dropDirectory: { |
| 145 | + type: BooleanConstructor; |
| 146 | + default: boolean; |
| 147 | + }; |
| 148 | + size: { |
| 149 | + type: NumberConstructor; |
| 150 | + default: number; |
| 151 | + }; |
| 152 | + extensions: { |
| 153 | + type: PropType<string | RegExp | string[]>; |
| 154 | + default: () => never[]; |
| 155 | + }; |
| 156 | + modelValue: { |
| 157 | + type: PropType<VueUploadItem[]>; |
| 158 | + default: () => never[]; |
| 159 | + }; |
| 160 | + thread: { |
| 161 | + type: NumberConstructor; |
| 162 | + default: number; |
| 163 | + }; |
| 164 | + chunkEnabled: { |
| 165 | + type: BooleanConstructor; |
| 166 | + default: boolean; |
| 167 | + }; |
| 168 | + chunk: { |
| 169 | + type: PropType<{ |
| 170 | + headers?: { |
| 171 | + [key: string]: any; |
| 172 | + } | undefined; |
| 173 | + action?: string | undefined; |
| 174 | + minSize?: number | undefined; |
| 175 | + maxActive?: number | undefined; |
| 176 | + maxRetries?: number | undefined; |
| 177 | + handler?: any; |
| 178 | + }>; |
| 179 | + default: () => ChunkOptions; |
| 180 | + }; |
| 181 | +}, unknown, Data, { |
| 182 | + /** |
| 183 | + * uploading 正在上传的线程 |
| 184 | + * @return {[type]} [description] |
| 185 | + */ |
| 186 | + /** |
| 187 | + * uploaded 文件列表是否全部已上传 |
| 188 | + * @return {[type]} [description] |
| 189 | + */ |
| 190 | + uploaded(): boolean; |
| 191 | + chunkOptions(): ChunkOptions; |
| 192 | + className(): Array<string | undefined>; |
| 193 | + forId(): string; |
| 194 | + iMaximum(): number; |
| 195 | + iExtensions(): RegExp | undefined; |
| 196 | +}, { |
| 197 | + newId(): string; |
| 198 | + clear(): true; |
| 199 | + get(id: string | VueUploadItem): VueUploadItem | false; |
| 200 | + add(_files: VueUploadItem | Blob | Array<VueUploadItem | Blob>, index?: number | boolean | undefined): VueUploadItem | VueUploadItem[] | undefined; |
| 201 | + addInputFile(el: HTMLInputElement): Promise<VueUploadItem[]>; |
| 202 | + addDataTransfer(dataTransfer: DataTransfer): Promise<VueUploadItem[] | undefined>; |
| 203 | + getFileSystemEntry(entry: Array<File | FileSystemFileEntry | FileSystemDirectoryEntry> | File | FileSystemFileEntry | FileSystemDirectoryEntry, path?: string): Promise<VueUploadItem[]>; |
| 204 | + replace(id1: VueUploadItem | string, id2: VueUploadItem | string): boolean; |
| 205 | + remove(id: VueUploadItem | string): VueUploadItem | false; |
| 206 | + update(id: VueUploadItem | string, data: { |
| 207 | + [key: string]: any; |
| 208 | + }): VueUploadItem | false; |
| 209 | + emitFilter(newFile: VueUploadItem | undefined, oldFile: VueUploadItem | undefined): boolean; |
| 210 | + emitFile(newFile: VueUploadItem | undefined, oldFile: VueUploadItem | undefined): void; |
| 211 | + emitInput(): void; |
| 212 | + upload(id: VueUploadItem | string): Promise<VueUploadItem>; |
| 213 | + /** |
| 214 | + * Whether this file should be uploaded using chunk upload or not |
| 215 | + * |
| 216 | + * @param Object file |
| 217 | + */ |
| 218 | + shouldUseChunkUpload(file: VueUploadItem): boolean | 0 | undefined; |
| 219 | + /** |
| 220 | + * Upload a file using Chunk method |
| 221 | + * |
| 222 | + * @param File file |
| 223 | + */ |
| 224 | + uploadChunk(file: VueUploadItem): Promise<VueUploadItem>; |
| 225 | + uploadPut(file: VueUploadItem): Promise<VueUploadItem>; |
| 226 | + uploadHtml5(file: VueUploadItem): Promise<VueUploadItem>; |
| 227 | + uploadXhr(xhr: XMLHttpRequest, ufile: VueUploadItem | undefined | false, body: FormData | Blob): Promise<VueUploadItem>; |
| 228 | + uploadHtml4(ufile: VueUploadItem | undefined | false): Promise<VueUploadItem>; |
| 229 | + watchActive(active: boolean): void; |
| 230 | + watchDrop(newDrop: boolean | string | HTMLElement | null, oldDrop?: boolean | string | HTMLElement | undefined): void; |
| 231 | + onDragenter(e: DragEvent): void; |
| 232 | + onDragleave(e: DragEvent): void; |
| 233 | + onDragover(e: DragEvent): void; |
| 234 | + onDocumentDrop(): void; |
| 235 | + onDrop(e: DragEvent): void; |
| 236 | + inputOnChange(e: Event): Promise<any>; |
| 237 | +}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "input-filter" | "input-file")[], "update:modelValue" | "input-filter" | "input-file", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{ |
| 238 | + name: string; |
| 239 | + disabled: boolean; |
| 240 | + multiple: boolean; |
| 241 | + directory: boolean; |
| 242 | + createDirectory: boolean; |
| 243 | + headers: { |
| 244 | + [key: string]: any; |
| 245 | + }; |
| 246 | + data: { |
| 247 | + [key: string]: any; |
| 248 | + }; |
| 249 | + timeout: number; |
| 250 | + drop: boolean; |
| 251 | + dropDirectory: boolean; |
| 252 | + size: number; |
| 253 | + extensions: string | RegExp | string[]; |
| 254 | + modelValue: VueUploadItem[]; |
| 255 | + thread: number; |
| 256 | + chunkEnabled: boolean; |
| 257 | + chunk: { |
| 258 | + headers?: { |
| 259 | + [key: string]: any; |
| 260 | + } | undefined; |
| 261 | + action?: string | undefined; |
| 262 | + minSize?: number | undefined; |
| 263 | + maxActive?: number | undefined; |
| 264 | + maxRetries?: number | undefined; |
| 265 | + handler?: any; |
| 266 | + }; |
| 267 | +} & { |
| 268 | + inputId?: string | undefined; |
| 269 | + accept?: string | undefined; |
| 270 | + capture?: unknown; |
| 271 | + maximum?: number | undefined; |
| 272 | + addIndex?: number | boolean | undefined; |
| 273 | + postAction?: string | undefined; |
| 274 | + putAction?: string | undefined; |
| 275 | + customAction?: ((file: VueUploadItem, self: any) => Promise<VueUploadItem>) | undefined; |
| 276 | +}>, { |
| 277 | + name: string; |
| 278 | + disabled: boolean; |
| 279 | + multiple: boolean; |
| 280 | + directory: boolean; |
| 281 | + createDirectory: boolean; |
| 282 | + headers: { |
| 283 | + [key: string]: any; |
| 284 | + }; |
| 285 | + data: { |
| 286 | + [key: string]: any; |
| 287 | + }; |
| 288 | + timeout: number; |
| 289 | + drop: boolean; |
| 290 | + dropDirectory: boolean; |
| 291 | + size: number; |
| 292 | + extensions: string | RegExp | string[]; |
| 293 | + modelValue: VueUploadItem[]; |
| 294 | + thread: number; |
| 295 | + chunkEnabled: boolean; |
| 296 | + chunk: { |
| 297 | + headers?: { |
| 298 | + [key: string]: any; |
| 299 | + } | undefined; |
| 300 | + action?: string | undefined; |
| 301 | + minSize?: number | undefined; |
| 302 | + maxActive?: number | undefined; |
| 303 | + maxRetries?: number | undefined; |
| 304 | + handler?: any; |
| 305 | + }; |
| 306 | +}>; |
| 307 | +export default _default; |
0 commit comments