You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
12 KiB

1 month ago
  1. {"ast":null,"code":"import { ajaxUpload } from './ajax.mjs';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { mutable } from '../../../utils/typescript.mjs';\nimport { NOOP } from '@vue/shared';\nconst uploadListTypes = [\"text\", \"picture\", \"picture-card\"];\nlet fileId = 1;\nconst genFileId = () => Date.now() + fileId++;\nconst uploadBaseProps = buildProps({\n action: {\n type: String,\n default: \"#\"\n },\n headers: {\n type: definePropType(Object)\n },\n method: {\n type: String,\n default: \"post\"\n },\n data: {\n type: definePropType([Object, Function, Promise]),\n default: () => mutable({})\n },\n multiple: Boolean,\n name: {\n type: String,\n default: \"file\"\n },\n drag: Boolean,\n withCredentials: Boolean,\n showFileList: {\n type: Boolean,\n default: true\n },\n accept: {\n type: String,\n default: \"\"\n },\n fileList: {\n type: definePropType(Array),\n default: () => mutable([])\n },\n autoUpload: {\n type: Boolean,\n default: true\n },\n listType: {\n type: String,\n values: uploadListTypes,\n default: \"text\"\n },\n httpRequest: {\n type: definePropType(Function),\n default: ajaxUpload\n },\n disabled: Boolean,\n limit: Number\n});\nconst uploadProps = buildProps({\n ...uploadBaseProps,\n beforeUpload: {\n type: definePropType(Function),\n default: NOOP\n },\n beforeRemove: {\n type: definePropType(Function)\n },\n onRemove: {\n type: definePropType(Function),\n default: NOOP\n },\n onChange: {\n type: definePropType(Function),\n default: NOOP\n },\n onPreview: {\n type: definePropType(Function),\n default: NOOP\n },\n onSuccess: {\n type: definePropType(Function),\n default: NOOP\n },\n onProgress: {\n type: definePropType(Function),\n default: NOOP\n },\n onError: {\n type: definePropType(Function),\n default: NOOP\n },\n onExceed: {\n type: definePropType(Function),\n default: NOOP\n },\n crossorigin: {\n type: definePropType(String)\n }\n});\nexport { genFileId, uploadBaseProps, uploadListTypes, uploadProps };","map":{"version":3,"names":["uploadListTypes","fileId","genFileId","Date","now","uploadBaseProps","buildProps","action","type","String","default","headers","definePropType","Object","method","data","Function","Promise","mutable","multiple","Boolean","name","drag","withCredentials","showFileList","accept","fileList","Array","autoUpload","listType","values","httpRequest","ajaxUpload","disabled","limit","Number","uploadProps","beforeUpload","NOOP","beforeRemove","onRemove","onChange","onPreview","onSuccess","onProgress","onError","onExceed","crossorigin"],"sources":["../../../../../../packages/components/upload/src/upload.ts"],"sourcesContent":["import { NOOP, buildProps, definePropType, mutable } from '@element-plus/utils'\nimport { ajaxUpload } from './ajax'\nimport type { Awaitable, Mutable } from '@element-plus/utils'\n\nimport type { UploadAjaxError } from './ajax'\nimport type { ExtractPropTypes } from 'vue'\nimport type Upload from './upload.vue'\n\nexport const uploadListTypes = ['text', 'picture', 'picture-card'] as const\n\nlet fileId = 1\nexport const genFileId = () => Date.now() + fileId++\n\nexport type UploadStatus = 'ready' | 'uploading' | 'success' | 'fail'\nexport interface UploadProgressEvent extends ProgressEvent {\n percent: number\n}\n\nexport interface UploadRequestOptions {\n action: string\n method: string\n data: Record<string, string | Blob | [Blob, string]>\n filename: string\n file: UploadRawFile\n headers: Headers | Record<string, string | number | null | undefined>\n onError: (evt: UploadAjaxError) => void\n onProgress: (evt: UploadProgressEvent) => void\n onSuccess: (response: any) => void\n withCredentials: boolean\n}\nexport interface UploadFile {\n name: string\n percentage?: number\n status: UploadStatus\n size?: number\n response?: unknown\n uid: number\n url?: string\n raw?: UploadRawFile\n}\nexport type UploadUserFile = Omit<