UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

130 lines (129 loc) 3.4 kB
export interface UploaderOptions { concurrency?: number; allowedContentTypes?: string[]; maxUploads?: number; maxFileSize?: number; uploadedCount?: number; } export declare enum UploadStatus { Queue = 0, Uploading = 1, Done = 2, Cancelled = 3, Remove = 4, Error = 5 } export interface UploadProgress { status: UploadStatus; data?: { percentage: number; speed?: number; speedHuman?: string; startTime?: number | null; endTime?: number | null; eta?: number | null; etaHuman?: string | null; }; } export interface FUploadFileExtend { id: string; name: string; disabled?: boolean; checked?: boolean; size?: number | undefined; createTime?: string | undefined; type?: string; extend?: any | null; extendHeaders?: { [key: string]: string; } | null; [key: string]: any; } export interface UploadFile { id: string; fileIndex: number; lastModifiedDate: Date | string; name: string; size: number; type: string; form?: FormData; progress?: UploadProgress; response?: any; responseStatus?: number; nativeFile?: File; responseHeaders?: { [key: string]: string; }; } export type UploadType = 'addedToQueue' | 'allAddedToQueue' | 'uploading' | 'done' | 'start' | 'cancelled' | 'removed' | 'allRemoved' | 'rejected' | 'error'; export interface UploadOutput { type: UploadType; file?: UploadFile; nativeFile?: File; message?: string; files?: UploadFile[] | FUploadFileExtend[]; checked?: boolean; } export interface UploadConfig { url?: string; method?: string; id?: string; fieldName?: string; fileIndex?: number; file?: UploadFile | FUploadFileExtend; data?: { [key: string]: any; }; headers?: { [key: string]: string; } | null; includeWebKitFormBoundary?: boolean; withCredentials?: boolean; timeout?: number; } export interface UploadInput extends UploadConfig { type: 'upload' | 'uploadAll' | 'cancel' | 'cancelAll' | 'remove' | 'removeAll' | 'config' | 'hide'; /** 分块上传时,每块大小默认为 1M */ chunkSize?: number; } export declare abstract class UploadServerAPI { /** * 上传配置 */ uploadConfig: UploadConfig; /** * 删除配置 */ removeConfig: UploadConfig; constructor(uploadConfig?: UploadConfig, removeConfig?: UploadConfig); abstract upload(files: UploadFile[], event: UploadInput, extendConfig: any, eventEmit: (any: any) => void): Promise<UploadOutput>; abstract remove(files: FUploadFileExtend[], event: UploadInput, extendConfig: any, eventEmit: (any: any) => void): Promise<UploadOutput>; } /** * 上传预览显示列 */ export interface FUploadPreviewColumn { field: string; width: number; title: string; checkbox?: boolean; formatter?: (value: any, state: string, info: UploadOutput | any, columnInfo: FUploadPreviewColumn) => any; } /** * 注入附件服务器端的服务 */ export type IUploadServer = () => UploadServerAPI; /** * 提示服务 */ export type NotifyServiceAPI = { show: (par: any) => any; }; /** * -------------------------- * 默认服务里使用 * -------------------------- */ export interface BlobFile extends Blob { name: string; }