UNPKG

tdesign-vue

Version:
184 lines (183 loc) 9.11 kB
import { SetupContext } from '@vue/composition-api'; import { TdUploadProps, UploadFile, UploadRemoveContext } from '../type'; export declare type ValidateParams = Parameters<TdUploadProps['onValidate']>[0]; export default function useUpload(props: TdUploadProps, context: SetupContext): { t: <T>(pattern: T, ...args: any[]) => any; localeConfig: import("@vue/composition-api").ComputedRef<({} & import("../..").UploadConfig) | ({} & { readonly sizeLimitMessage: "文件大小不能超过 {sizeLimit}"; readonly cancelUploadText: "取消上传"; readonly triggerUploadText: { readonly fileInput: "选择文件"; readonly image: "点击上传图片"; readonly normal: "点击上传"; readonly reupload: "重新选择"; readonly continueUpload: "继续选择"; readonly delete: "删除"; readonly uploading: "上传中"; }; readonly dragger: { readonly dragDropText: "释放鼠标"; readonly draggingText: "拖拽到此区域"; readonly clickAndDragText: "点击上方“选择文件”或将文件拖拽到此区域"; }; readonly file: { readonly fileNameText: "文件名"; readonly fileSizeText: "文件大小"; readonly fileStatusText: "状态"; readonly fileOperationText: "操作"; readonly fileOperationDateText: "上传日期"; }; readonly progress: { readonly uploadingText: "上传中"; readonly waitingText: "待上传"; readonly failText: "上传失败"; readonly successText: "上传成功"; }; } & import("../..").UploadConfig)>; classPrefix: import("@vue/composition-api").Ref<string>; triggerUploadText: import("@vue/composition-api").ComputedRef<any>; toUploadFiles: import("@vue/composition-api").Ref<{ [x: string]: any; lastModified?: number; name?: string; percent?: number; raw?: { readonly lastModified: number; readonly name: string; readonly webkitRelativePath: string; readonly size: number; readonly type: string; arrayBuffer: () => Promise<ArrayBuffer>; slice: (start?: number, end?: number, contentType?: string) => Blob; stream: () => ReadableStream<Uint8Array>; text: () => Promise<string>; }; response?: { [x: string]: any; }; size?: number; status?: "progress" | "waiting" | "success" | "fail"; type?: string; uploadTime?: string; url?: string; }[]>; uploadValue: import("@vue/composition-api").Ref<UploadFile[]>; displayFiles: import("@vue/composition-api").ComputedRef<import("../../_common/js/upload/types").UploadFile[]>; sizeOverLimitMessage: import("@vue/composition-api").Ref<string>; uploading: import("@vue/composition-api").Ref<boolean>; tipsClasses: string; errorClasses: string[]; placeholderClass: string; inputRef: import("@vue/composition-api").Ref<HTMLInputElement>; innerDisabled: import("@vue/composition-api").ComputedRef<boolean>; xhrReq: import("@vue/composition-api").Ref<{ files: { [x: string]: any; lastModified?: number; name?: string; percent?: number; raw?: { readonly lastModified: number; readonly name: string; readonly webkitRelativePath: string; readonly size: number; readonly type: string; arrayBuffer: () => Promise<ArrayBuffer>; slice: (start?: number, end?: number, contentType?: string) => Blob; stream: () => ReadableStream<Uint8Array>; text: () => Promise<string>; }; response?: { [x: string]: any; }; size?: number; status?: "progress" | "waiting" | "success" | "fail"; type?: string; uploadTime?: string; url?: string; }[]; xhrReq: { onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; responseType: XMLHttpRequestResponseType; readonly responseURL: string; readonly responseXML: Document; readonly status: number; readonly statusText: string; timeout: number; readonly upload: { addEventListener: { <K extends keyof XMLHttpRequestEventTargetEventMap>(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; }; removeEventListener: { <K_1 extends keyof XMLHttpRequestEventTargetEventMap>(type: K_1, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K_1]) => any, options?: boolean | EventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; }; onabort: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onerror: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onload: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onloadend: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onloadstart: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onprogress: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; ontimeout: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; dispatchEvent: (event: Event) => boolean; }; withCredentials: boolean; abort: () => void; getAllResponseHeaders: () => string; getResponseHeader: (name: string) => string; open: { (method: string, url: string | URL): void; (method: string, url: string | URL, async: boolean, username?: string, password?: string): void; }; overrideMimeType: (mime: string) => void; send: (body?: Document | XMLHttpRequestBodyInit) => void; setRequestHeader: (name: string, value: string) => void; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; addEventListener: { <K_2 extends keyof XMLHttpRequestEventMap>(type: K_2, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K_2]) => any, options?: boolean | AddEventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; }; removeEventListener: { <K_3 extends keyof XMLHttpRequestEventMap>(type: K_3, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K_3]) => any, options?: boolean | EventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; }; onabort: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onerror: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onload: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onloadend: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onloadstart: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; onprogress: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; ontimeout: (this: XMLHttpRequest, ev: ProgressEvent<EventTarget>) => any; dispatchEvent: (event: Event) => boolean; }; }[]>; uploadFiles: (toFiles?: UploadFile[]) => void; uploadFilePercent: (params: { file: UploadFile; percent: number; }) => void; onFileChange: (files: File[]) => void; onNormalFileChange: (e: InputEvent) => void; onDragFileChange: (files: File[]) => void; onInnerRemove: (p: UploadRemoveContext) => void; triggerUpload: (e?: MouseEvent) => void; cancelUpload: (context?: { file?: UploadFile; e?: MouseEvent; }) => void; onInnerPreview: (p: { file: UploadFile; index: number; e: MouseEvent; }) => void; innerCancelUpload: () => void; onPasteFileChange: (e: ClipboardEvent) => void; };