UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

1 lines 4.14 kB
{"version":3,"file":"symbol.cjs","sources":["../../../components/upload/symbol.ts"],"sourcesContent":["import type { ComponentPublicInstance } from 'vue'\n\nexport type UploadListType = 'name' | 'detail' | 'thumbnail' | 'card'\nexport type UploadStatus = 'pending' | 'uploading' | 'fail' | 'success' | 'delete'\n\nexport type UploadSourceFile = File & { path?: string }\n\nexport type UploadHttpError = Error & {\n response: any,\n url: string,\n status: number,\n method: string,\n}\n\nexport const enum StatusType {\n PENDING = 'pending',\n UPLOADING = 'uploading',\n FAIL = 'fail',\n SUCCESS = 'success',\n DELETE = 'delete',\n}\n\nexport interface UploadFileState {\n id: string | number,\n name: string,\n size: number,\n type: string,\n base64: string | null,\n status: UploadStatus,\n percentage: number,\n source: UploadSourceFile | null,\n url: string | null,\n path: string,\n /**\n * @deprecated\n */\n xhr: XMLHttpRequest | null,\n response: any,\n error: UploadHttpError | null,\n abort: () => void,\n}\n\nexport type UploadFileOptions = Partial<Omit<UploadFileState, 'response' | 'error' | 'abort'>>\n\ntype MaybePromise<T> = T | Promise<T>\n\nexport type BeforeUpload = (\n file: UploadFileState,\n files: UploadFileState[],\n) => MaybePromise<boolean | Blob | UploadSourceFile | void>\nexport type BeforeSelect = (\n file: UploadFileState,\n files: UploadFileState[],\n) => MaybePromise<boolean | void>\nexport type RenderFn = (data: { file: UploadFileState }) => any\n\nexport interface UploadFetchOptions {\n url: string,\n file: UploadSourceFile,\n headers?: Record<string, string>,\n withCredentials?: boolean,\n data?: Record<string, string | Blob>,\n field?: string,\n pathField?: string,\n onProgress?: (percent: number) => void,\n onSuccess?: (response: any) => void,\n onError?: (error: UploadHttpError) => void,\n onAbort?: () => void,\n}\n\n/**\n * Should return an abort method.\n */\nexport type UploadFetchMethod = (options: UploadFetchOptions) => () => void\n\nexport interface DirectoryEntity {\n name: string,\n fullPath: string,\n isFile: boolean,\n isDirectory: boolean,\n file: (callback: (file: UploadSourceFile) => void) => void,\n\n createReader: () => DirectoryReader,\n}\n\nexport interface DirectoryReader {\n readEntries: (\n onSuccess: (entities: DirectoryEntity[]) => void,\n onError?: (errors: any) => void,\n ) => void,\n}\n\nexport interface UploadExposed extends ComponentPublicInstance {\n isDragOver: boolean,\n execute: () => Promise<false | any[]>,\n handleDelete: (file: UploadFileState) => void,\n focus: (options?: FocusOptions) => void,\n blur: () => void,\n}\n\nexport interface UploadListSlots {\n item?: (params: { file: UploadFileState, status: UploadStatus, percentage: number }) => any,\n icon?: (params: { file: UploadFileState, status: UploadStatus, percentage: number }) => any,\n suffix?: () => any,\n}\n\nexport interface UploadFileSlots {\n default?: (params: { file: UploadFileState, status: UploadStatus, percentage: number }) => any,\n icon?: (params: { file: UploadFileState, status: UploadStatus, percentage: number }) => any,\n}\n\nexport interface UploadSlots extends Omit<UploadListSlots, 'suffix'> {\n default?: (params: { isDragOver: boolean }) => any,\n tip?: () => any,\n cloud?: () => any,\n}\n\nexport const uploadListTypes = Object.freeze<UploadListType[]>([\n 'name',\n 'detail',\n 'thumbnail',\n 'card',\n])\n\n/**\n * @deprecated Use `UploadHttpError` to replace it\n */\nexport type HttpError = UploadHttpError\n/**\n * @deprecated Use `UploadSourceFile` to replace it\n */\nexport type SourceFile = UploadSourceFile\n/**\n * @deprecated Use `UploadFileState` to replace it\n */\nexport type FileState = UploadFileState\n/**\n * @deprecated Use `UploadFileOptions` to replace it\n */\nexport type FileOptions = UploadFileOptions\n"],"names":["StatusType","uploadListTypes"],"mappings":"gFAckB,IAAAA,GAAAA,IAChBA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SALOA,IAAAA,GAAA,CAAA,CAAA,EAuGL,MAAAC,EAAkB,OAAO,OAAyB,CAC7D,OACA,SACA,YACA,MACF,CAAC"}