fast-element-plus 2.0.19 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -20
- package/CONTRIBUTING.md +3 -4
- package/README.md +80 -27
- package/README.zh.md +66 -27
- package/dist/component.d.ts +110 -110
- package/dist/components/avatar/src/avatar.d.ts +26 -26
- package/dist/components/avatar/src/avatar.mjs +10 -10
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +32 -27
- package/dist/components/button/src/button.mjs +57 -36
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.d.ts +8 -8
- package/dist/components/carNumber/src/carNumber.mjs +5 -5
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +6 -6
- package/dist/components/contextMenu/src/contextMenu.mjs +5 -5
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.type.d.ts +7 -7
- package/dist/components/dialog/src/dialog.d.ts +74 -74
- package/dist/components/dialog/src/dialog.mjs +31 -31
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +57 -57
- package/dist/components/drawer/src/drawer.mjs +24 -24
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +30 -30
- package/dist/components/form/src/form.mjs +16 -16
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +30 -30
- package/dist/components/form/src/formItem.mjs +13 -13
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/formItemTip/src/formItemTip.d.ts +9 -9
- package/dist/components/formItemTip/src/formItemTip.mjs +3 -3
- package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -1
- package/dist/components/icon/src/icon.d.ts +10 -10
- package/dist/components/icon/src/icon.mjs +4 -4
- package/dist/components/icon/src/icon.mjs.map +1 -1
- package/dist/components/iconSelector/src/iconSelector.d.ts +6 -6
- package/dist/components/iconSelector/src/iconSelector.mjs +4 -4
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +36 -36
- package/dist/components/image/src/image.mjs +11 -11
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +37 -37
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +16 -16
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +12 -12
- package/dist/components/layoutGrid/src/layoutGrid.mjs +6 -6
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGridItem.d.ts +18 -18
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +8 -8
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +88 -88
- package/dist/components/select/src/select.mjs +28 -28
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/select/src/selectOption.d.ts +13 -13
- package/dist/components/select/src/selectOption.mjs +6 -6
- package/dist/components/select/src/selectOption.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +78 -84
- package/dist/components/selectPage/src/selectPage.mjs +49 -35
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/index.mjs +2 -1
- package/dist/components/selectV2/index.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +160 -851
- package/dist/components/selectV2/src/selectV2.mjs +30 -338
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.mjs +3 -2
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/page.type.d.ts +1 -1
- package/dist/components/table/src/table.d.ts +211 -744
- package/dist/components/table/src/table.mjs +131 -327
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.state.d.ts +3 -3
- package/dist/components/table/src/table.type.d.ts +1 -9
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +102 -399
- package/dist/components/table/src/tableColumn.mjs +62 -213
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.d.ts +4 -4
- package/dist/components/table/src/tableColumnSettingDialog.mjs +3 -3
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tablePagination.d.ts +4 -4
- package/dist/components/table/src/tablePagination.mjs +3 -3
- package/dist/components/table/src/tablePagination.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +12 -12
- package/dist/components/table/src/tableSearchForm.mjs +6 -6
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.d.ts +4 -4
- package/dist/components/table/src/tableSearchFormItem.mjs +2 -2
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.d.ts +1 -0
- package/dist/components/table/src/useTable.mjs +109 -65
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.d.ts +4 -4
- package/dist/components/table/utils/table.mjs +6 -6
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +86 -86
- package/dist/components/tree/src/tree.mjs +46 -46
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +144 -150
- package/dist/components/treeSelect/src/treeSelect.mjs +55 -55
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +36 -36
- package/dist/components/upload/src/upload.mjs +17 -17
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +47 -47
- package/dist/components/uploadImage/src/uploadImage.mjs +23 -23
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +41 -41
- package/dist/components/uploadImages/src/uploadImages.mjs +21 -21
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-debounce/index.mjs +19 -11
- package/dist/directives/click-debounce/index.mjs.map +1 -1
- package/dist/directives/click-throttle/index.d.ts +4 -2
- package/dist/directives/click-throttle/index.mjs +21 -11
- package/dist/directives/click-throttle/index.mjs.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal/props.d.ts +685 -0
- package/dist/internal/props.mjs +683 -0
- package/dist/internal/props.mjs.map +1 -0
- package/dist/utils/loading-tasks.d.ts +5 -0
- package/dist/utils/loading-tasks.mjs +32 -0
- package/dist/utils/loading-tasks.mjs.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +5 -10
|
@@ -7,36 +7,36 @@ import { Fragment, computed, createTextVNode, createVNode, defineComponent, merg
|
|
|
7
7
|
import { UploadFilled } from "@element-plus/icons-vue";
|
|
8
8
|
import { ElIcon, ElUpload, uploadProps } from "element-plus";
|
|
9
9
|
//#region src/components/upload/src/upload.tsx
|
|
10
|
-
/** FaUpload 的运行时 Props
|
|
10
|
+
/** FaUpload 的运行时 Props 定义 */
|
|
11
11
|
const faUploadProps = {
|
|
12
12
|
...uploadProps,
|
|
13
|
-
/**
|
|
13
|
+
/** whether to activate drag and drop mode */
|
|
14
14
|
drag: {
|
|
15
15
|
type: Boolean,
|
|
16
16
|
default: true
|
|
17
17
|
},
|
|
18
|
-
/**
|
|
18
|
+
/** maximum number of uploads allowed */
|
|
19
19
|
limit: {
|
|
20
20
|
type: Number,
|
|
21
21
|
default: 1
|
|
22
22
|
},
|
|
23
|
-
/**
|
|
23
|
+
/** v-model 绑定值 */
|
|
24
24
|
modelValue: definePropType([String, Array]),
|
|
25
|
-
/**
|
|
25
|
+
/** 大小限制,单位kb */
|
|
26
26
|
maxSize: {
|
|
27
27
|
type: definePropType([String, Number]),
|
|
28
28
|
default: 5120
|
|
29
29
|
},
|
|
30
|
-
/**
|
|
30
|
+
/** 图片上传接口,优先级最高 */
|
|
31
31
|
uploadApi: { type: definePropType(Function) },
|
|
32
|
-
/**
|
|
32
|
+
/** 图片上传地址 */
|
|
33
33
|
uploadUrl: String
|
|
34
34
|
};
|
|
35
|
-
/** FaUpload 的运行时 Emits
|
|
35
|
+
/** FaUpload 的运行时 Emits 定义 */
|
|
36
36
|
const faUploadEmits = {
|
|
37
|
-
/**
|
|
37
|
+
/** v-model 回调 */
|
|
38
38
|
"update:modelValue": (value) => typeof value === "string" || Array.isArray(value) || value === null,
|
|
39
|
-
/**
|
|
39
|
+
/** v-model:fileList 回调 */
|
|
40
40
|
"update:fileList": (value) => Array.isArray(value)
|
|
41
41
|
};
|
|
42
42
|
var upload_default = defineComponent({
|
|
@@ -103,19 +103,19 @@ var upload_default = defineComponent({
|
|
|
103
103
|
}) ?? [] }
|
|
104
104
|
}), [[resolveDirective("loading"), loading.value]]));
|
|
105
105
|
return useExpose(expose, {
|
|
106
|
-
/**
|
|
106
|
+
/** 取消上传请求 */
|
|
107
107
|
abort: computed(() => uploadRef.value?.abort),
|
|
108
|
-
/**
|
|
108
|
+
/** 手动上传文件列表 */
|
|
109
109
|
submit: computed(() => uploadRef.value?.submit),
|
|
110
|
-
/**
|
|
110
|
+
/** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */
|
|
111
111
|
clearFiles: computed(() => uploadRef.value?.clearFiles),
|
|
112
|
-
/**
|
|
112
|
+
/** 手动选择文件 */
|
|
113
113
|
handleStart: computed(() => uploadRef.value?.handleStart),
|
|
114
|
-
/**
|
|
114
|
+
/** 手动移除文件。file 和 rawFile 已被合并。 */
|
|
115
115
|
handleRemove: computed(() => uploadRef.value?.handleRemove),
|
|
116
|
-
/**
|
|
116
|
+
/** 加载状态 */
|
|
117
117
|
loading,
|
|
118
|
-
/**
|
|
118
|
+
/** 文件集合 */
|
|
119
119
|
fileList
|
|
120
120
|
});
|
|
121
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/upload/src/upload.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, shallowRef } from \"vue\";\nimport { UploadFilled } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElUpload, uploadProps } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { useUpload } from \"./useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUpload 的运行时 Props
|
|
1
|
+
{"version":3,"file":"upload.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/upload/src/upload.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, shallowRef } from \"vue\";\nimport { UploadFilled } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElUpload, uploadProps } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport { useUpload } from \"./useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUpload 的运行时 Props 定义 */\nexport const faUploadProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...uploadProps,\n\t/** whether to activate drag and drop mode */\n\tdrag: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** maximum number of uploads allowed */\n\tlimit: {\n\t\ttype: Number,\n\t\tdefault: 1,\n\t},\n\t/** v-model 绑定值 */\n\tmodelValue: definePropType<string | string[] | null>([String, Array]),\n\t/** 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: definePropType<string | number>([String, Number]),\n\t\tdefault: 5120,\n\t},\n\t/** 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** 图片上传地址 */\n\tuploadUrl: String,\n};\n\n/** FaUpload 的运行时 Emits 定义 */\nexport const faUploadEmits = {\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: string | string[] | null) => typeof value === \"string\" || Array.isArray(value) || value === null,\n\t/** v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]) => Array.isArray(value),\n};\n\n/** FaUpload 的插槽参数 */\nexport interface FaUploadSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n\t/** 触发文件选择框的内容 */\n\ttrigger: never;\n\t/** 提示说明文字 */\n\ttip: never;\n\t/** 缩略图模板的内容 */\n\tfile: { file: UploadFile; index: number };\n}\n\nexport default defineComponent({\n\tname: \"FaUpload\",\n\tprops: faUploadProps,\n\temits: faUploadEmits,\n\tslots: makeSlots<FaUploadSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload(\"FaUpload\", \"文件\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要与 Element Plus 2.x 的运行时默认 action 比较。\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst uploadRef = shallowRef<UploadInstance | null>(null);\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要识别 Element Plus 2.x 注入的默认请求实现。\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) return false;\n\t\t\treturn props.beforeUpload(rawFile);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<ElUpload\n\t\t\t\t{...elUploadProps.value}\n\t\t\t\tref={uploadRef}\n\t\t\t\tclass={[\"fa-upload\", { \"fa-upload__trigger\": !!slots.trigger }]}\n\t\t\t\tvLoading={loading.value}\n\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\tdisabled={disabled.value}\n\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\tonError={handleOnError}\n\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\tonChange={handleOnChange}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\tslots.default ? (\n\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<ElIcon class=\"el-icon--upload\">\n\t\t\t\t\t\t\t\t\t<UploadFilled />\n\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t<div class=\"el-upload__text\">\n\t\t\t\t\t\t\t\t\t{props.drag ? \"Drop file here or \" : \"Select a file or \"}\n\t\t\t\t\t\t\t\t\t<em>click to upload</em>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t),\n\t\t\t\t\t...(slots.trigger && { trigger: () => slots.trigger?.() ?? [] }),\n\t\t\t\t\ttip: () =>\n\t\t\t\t\t\tslots.tip ? (\n\t\t\t\t\t\t\tslots.tip()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<div class=\"el-upload__tip\">files with a size less than {maxSizeMB.value.toString()}MB</div>\n\t\t\t\t\t\t\t\t{!props.showFileList && fileList.value.length > 0 && (\n\t\t\t\t\t\t\t\t\t<div class=\"el-upload__tip\">\n\t\t\t\t\t\t\t\t\t\t{fileList.value.map((item, index) => (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t{item.name}\n\t\t\t\t\t\t\t\t\t\t\t\t{fileList.value.length <= index && <br />}\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t),\n\t\t\t\t\t...(slots.file && {\n\t\t\t\t\t\tfile: ({ file, index }: { file: UploadFile; index: number }) => slots.file?.({ file, index }) ?? [],\n\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElUpload>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** 加载状态 */\n\t\t\tloading,\n\t\t\t/** 文件集合 */\n\t\t\tfileList,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAQA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,OAAO;EACN,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAAyC,CAAC,QAAQ,KAAK,CAAC;;CAEpE,SAAS;EACR,MAAM,eAAgC,CAAC,QAAQ,MAAM,CAAC;EACtD,SAAS;CACV;;CAEA,WAAW,EACV,MAAM,eAAwD,QAAQ,EACvE;;CAEA,WAAW;AACZ;;AAGA,MAAa,gBAAgB;;CAE5B,sBAAsB,UAAoC,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,KAAK,UAAU;;CAEzH,oBAAoB,UAA4B,MAAM,QAAQ,KAAK;AACpE;AAcA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,EACL,UACA,SACA,aACA,WACA,mBACA,iBACA,eACA,gBACA,gBACA,gBACA,mBACG,UAAU,YAAY,MAAM,OAAO,MAAM;GAC5C,IAAI,UAAU;IACb,OAAO,MAAM;GACd;GACA,IAAI,YAAY;IACf,OAAO,MAAM;GACd;GACA,IAAI,YAAY;IAEf,OAAO,MAAM,cAAc,MAAM,WAAW,YAAY,OAAO,UAAU,KAAA,IAAY,MAAM;GAC5F;EACD,CAAC;EAED,MAAM,YAAY,WAAkC,IAAI;EACxD,MAAM,WAAW,eAAe;GAC/B,OAAO,MAAM,aAAa,QAAQ,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,EAAA,SAAA,iBAAA,GAAA,CAE9C,SAAS,MAAM,KAAK,MAAM,UAAK,YAAA,UAAA,MAAA,CAE7B,KAAK,MACL,SAAS,MAAM,UAAU,SAAK,YAAA,MAAA,MAAA,IAAA,CAAU,CAAA,CAE1C,CAAC,CAAA,CAEH,CAAA;GAGJ,GAAI,MAAM,QAAQ,EACjB,OAAO,EAAE,MAAM,YAAiD,MAAM,OAAO;IAAE;IAAM;GAAM,CAAC,KAAK,CAAA,EAClG;EAAE,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GA/CO,QAAQ,KAAK,CAAA,CAAA,CAkDxB;EAED,OAAO,UAAU,QAAQ;;GAExB,OAAO,eAAe,UAAU,OAAO,KAAK;;GAE5C,QAAQ,eAAe,UAAU,OAAO,MAAM;;GAE9C,YAAY,eAAe,UAAU,OAAO,UAAU;;GAEtD,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,cAAc,eAAe,UAAU,OAAO,YAAY;;GAE1D;;GAEA;EACD,CAAC;CACF;AACD,CAAC"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import type { UploadFile, UploadUserFile } from "element-plus";
|
|
2
|
-
/** FaUploadImage 的运行时 Props
|
|
2
|
+
/** FaUploadImage 的运行时 Props 定义 */
|
|
3
3
|
export declare const faUploadImageProps: {
|
|
4
|
-
/**
|
|
4
|
+
/** accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */
|
|
5
5
|
accept: {
|
|
6
6
|
type: StringConstructor;
|
|
7
7
|
default: () => string;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
9
|
+
/** type of file list */
|
|
10
10
|
listType: {
|
|
11
11
|
type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
|
|
12
12
|
default: string;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
14
|
+
/** whether uploading multiple files is permitted */
|
|
15
15
|
multiple: {
|
|
16
16
|
type: BooleanConstructor;
|
|
17
17
|
default: boolean;
|
|
18
18
|
validator: (value: boolean) => boolean;
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/** whether to show the uploaded file list */
|
|
21
21
|
showFileList: {
|
|
22
22
|
type: BooleanConstructor;
|
|
23
23
|
default: boolean;
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
25
|
+
/** v-model 绑定值 */
|
|
26
26
|
modelValue: import("vue").PropType<string | null>;
|
|
27
|
-
/**
|
|
27
|
+
/** 大小限制,单位kb */
|
|
28
28
|
maxSize: {
|
|
29
29
|
type: (NumberConstructor | StringConstructor)[];
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
-
/**
|
|
32
|
+
/** 图片上传接口,优先级最高 */
|
|
33
33
|
uploadApi: {
|
|
34
34
|
type: import("vue").PropType<(formData: FormData) => Promise<string>>;
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
36
|
+
/** 图片上传地址 */
|
|
37
37
|
uploadUrl: StringConstructor;
|
|
38
|
-
/**
|
|
38
|
+
/** 宽度 */
|
|
39
39
|
width: {
|
|
40
40
|
type: (NumberConstructor | StringConstructor)[];
|
|
41
41
|
default: number;
|
|
42
42
|
};
|
|
43
|
-
/**
|
|
43
|
+
/** 高度 */
|
|
44
44
|
height: {
|
|
45
45
|
type: (NumberConstructor | StringConstructor)[];
|
|
46
46
|
default: number;
|
|
@@ -156,59 +156,59 @@ export declare const faUploadImageProps: {
|
|
|
156
156
|
limit: NumberConstructor;
|
|
157
157
|
directory: BooleanConstructor;
|
|
158
158
|
};
|
|
159
|
-
/** FaUploadImage 的运行时 Emits
|
|
159
|
+
/** FaUploadImage 的运行时 Emits 定义 */
|
|
160
160
|
export declare const faUploadImageEmits: {
|
|
161
|
-
/**
|
|
161
|
+
/** v-model 回调 */
|
|
162
162
|
"update:modelValue": (value: string | null) => boolean;
|
|
163
|
-
/**
|
|
163
|
+
/** v-model:fileList 回调 */
|
|
164
164
|
"update:fileList": (value: UploadUserFile[]) => boolean;
|
|
165
165
|
};
|
|
166
|
-
/** FaUploadImage
|
|
166
|
+
/** FaUploadImage 的插槽参数 */
|
|
167
167
|
export interface FaUploadImageSlots extends Record<string, unknown> {
|
|
168
|
-
/**
|
|
168
|
+
/** 默认内容插槽 */
|
|
169
169
|
default: never;
|
|
170
170
|
}
|
|
171
171
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
172
|
-
/**
|
|
172
|
+
/** accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */
|
|
173
173
|
accept: {
|
|
174
174
|
type: StringConstructor;
|
|
175
175
|
default: () => string;
|
|
176
176
|
};
|
|
177
|
-
/**
|
|
177
|
+
/** type of file list */
|
|
178
178
|
listType: {
|
|
179
179
|
type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
|
|
180
180
|
default: string;
|
|
181
181
|
};
|
|
182
|
-
/**
|
|
182
|
+
/** whether uploading multiple files is permitted */
|
|
183
183
|
multiple: {
|
|
184
184
|
type: BooleanConstructor;
|
|
185
185
|
default: boolean;
|
|
186
186
|
validator: (value: boolean) => boolean;
|
|
187
187
|
};
|
|
188
|
-
/**
|
|
188
|
+
/** whether to show the uploaded file list */
|
|
189
189
|
showFileList: {
|
|
190
190
|
type: BooleanConstructor;
|
|
191
191
|
default: boolean;
|
|
192
192
|
};
|
|
193
|
-
/**
|
|
193
|
+
/** v-model 绑定值 */
|
|
194
194
|
modelValue: import("vue").PropType<string | null>;
|
|
195
|
-
/**
|
|
195
|
+
/** 大小限制,单位kb */
|
|
196
196
|
maxSize: {
|
|
197
197
|
type: (NumberConstructor | StringConstructor)[];
|
|
198
198
|
default: number;
|
|
199
199
|
};
|
|
200
|
-
/**
|
|
200
|
+
/** 图片上传接口,优先级最高 */
|
|
201
201
|
uploadApi: {
|
|
202
202
|
type: import("vue").PropType<(formData: FormData) => Promise<string>>;
|
|
203
203
|
};
|
|
204
|
-
/**
|
|
204
|
+
/** 图片上传地址 */
|
|
205
205
|
uploadUrl: StringConstructor;
|
|
206
|
-
/**
|
|
206
|
+
/** 宽度 */
|
|
207
207
|
width: {
|
|
208
208
|
type: (NumberConstructor | StringConstructor)[];
|
|
209
209
|
default: number;
|
|
210
210
|
};
|
|
211
|
-
/**
|
|
211
|
+
/** 高度 */
|
|
212
212
|
height: {
|
|
213
213
|
type: (NumberConstructor | StringConstructor)[];
|
|
214
214
|
default: number;
|
|
@@ -324,70 +324,70 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
324
324
|
limit: NumberConstructor;
|
|
325
325
|
directory: BooleanConstructor;
|
|
326
326
|
}>, {
|
|
327
|
-
/**
|
|
327
|
+
/** 取消上传请求 */
|
|
328
328
|
abort: import("vue").ComputedRef<((file?: UploadFile) => void) | undefined>;
|
|
329
|
-
/**
|
|
329
|
+
/** 手动上传文件列表 */
|
|
330
330
|
submit: import("vue").ComputedRef<(() => void) | undefined>;
|
|
331
|
-
/**
|
|
331
|
+
/** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */
|
|
332
332
|
clearFiles: import("vue").ComputedRef<((states?: import("element-plus").UploadStatus[]) => void) | undefined>;
|
|
333
|
-
/**
|
|
333
|
+
/** 手动选择文件 */
|
|
334
334
|
handleStart: import("vue").ComputedRef<((rawFile: import("element-plus").UploadRawFile) => void) | undefined>;
|
|
335
|
-
/**
|
|
335
|
+
/** 手动移除文件。file 和 rawFile 已被合并。 */
|
|
336
336
|
handleRemove: import("vue").ComputedRef<((file: UploadFile | import("element-plus").UploadRawFile) => void) | undefined>;
|
|
337
|
-
/**
|
|
337
|
+
/** 加载状态 */
|
|
338
338
|
loading: import("vue").Ref<boolean, boolean>;
|
|
339
|
-
/**
|
|
339
|
+
/** 文件集合 */
|
|
340
340
|
fileList: import("vue").WritableComputedRef<UploadUserFile[], UploadUserFile[]>;
|
|
341
|
-
/**
|
|
341
|
+
/** 预览 */
|
|
342
342
|
preview: import("vue").ComputedRef<boolean>;
|
|
343
|
-
/**
|
|
343
|
+
/** 预览集合 */
|
|
344
344
|
previewList: import("vue").ComputedRef<string[]>;
|
|
345
345
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
346
|
-
/**
|
|
346
|
+
/** v-model 回调 */
|
|
347
347
|
"update:modelValue": (value: string | null) => boolean;
|
|
348
|
-
/**
|
|
348
|
+
/** v-model:fileList 回调 */
|
|
349
349
|
"update:fileList": (value: UploadUserFile[]) => boolean;
|
|
350
350
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
351
|
-
/**
|
|
351
|
+
/** accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */
|
|
352
352
|
accept: {
|
|
353
353
|
type: StringConstructor;
|
|
354
354
|
default: () => string;
|
|
355
355
|
};
|
|
356
|
-
/**
|
|
356
|
+
/** type of file list */
|
|
357
357
|
listType: {
|
|
358
358
|
type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
|
|
359
359
|
default: string;
|
|
360
360
|
};
|
|
361
|
-
/**
|
|
361
|
+
/** whether uploading multiple files is permitted */
|
|
362
362
|
multiple: {
|
|
363
363
|
type: BooleanConstructor;
|
|
364
364
|
default: boolean;
|
|
365
365
|
validator: (value: boolean) => boolean;
|
|
366
366
|
};
|
|
367
|
-
/**
|
|
367
|
+
/** whether to show the uploaded file list */
|
|
368
368
|
showFileList: {
|
|
369
369
|
type: BooleanConstructor;
|
|
370
370
|
default: boolean;
|
|
371
371
|
};
|
|
372
|
-
/**
|
|
372
|
+
/** v-model 绑定值 */
|
|
373
373
|
modelValue: import("vue").PropType<string | null>;
|
|
374
|
-
/**
|
|
374
|
+
/** 大小限制,单位kb */
|
|
375
375
|
maxSize: {
|
|
376
376
|
type: (NumberConstructor | StringConstructor)[];
|
|
377
377
|
default: number;
|
|
378
378
|
};
|
|
379
|
-
/**
|
|
379
|
+
/** 图片上传接口,优先级最高 */
|
|
380
380
|
uploadApi: {
|
|
381
381
|
type: import("vue").PropType<(formData: FormData) => Promise<string>>;
|
|
382
382
|
};
|
|
383
|
-
/**
|
|
383
|
+
/** 图片上传地址 */
|
|
384
384
|
uploadUrl: StringConstructor;
|
|
385
|
-
/**
|
|
385
|
+
/** 宽度 */
|
|
386
386
|
width: {
|
|
387
387
|
type: (NumberConstructor | StringConstructor)[];
|
|
388
388
|
default: number;
|
|
389
389
|
};
|
|
390
|
-
/**
|
|
390
|
+
/** 高度 */
|
|
391
391
|
height: {
|
|
392
392
|
type: (NumberConstructor | StringConstructor)[];
|
|
393
393
|
default: number;
|
|
@@ -11,20 +11,20 @@ import { Fragment, computed, createTextVNode, createVNode, defineComponent, merg
|
|
|
11
11
|
import { Delete, Edit, UploadFilled, ZoomIn } from "@element-plus/icons-vue";
|
|
12
12
|
import { ElIcon, ElImageViewer, ElUpload, uploadProps } from "element-plus";
|
|
13
13
|
//#region src/components/uploadImage/src/uploadImage.tsx
|
|
14
|
-
/** FaUploadImage 的运行时 Props
|
|
14
|
+
/** FaUploadImage 的运行时 Props 定义 */
|
|
15
15
|
const faUploadImageProps = {
|
|
16
16
|
...uploadProps,
|
|
17
|
-
/**
|
|
17
|
+
/** accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */
|
|
18
18
|
accept: {
|
|
19
19
|
type: String,
|
|
20
20
|
default: () => FaMimeType.Image
|
|
21
21
|
},
|
|
22
|
-
/**
|
|
22
|
+
/** type of file list */
|
|
23
23
|
listType: {
|
|
24
24
|
type: definePropType(String),
|
|
25
25
|
default: "picture"
|
|
26
26
|
},
|
|
27
|
-
/**
|
|
27
|
+
/** whether uploading multiple files is permitted */
|
|
28
28
|
multiple: {
|
|
29
29
|
type: Boolean,
|
|
30
30
|
default: false,
|
|
@@ -36,38 +36,38 @@ const faUploadImageProps = {
|
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
/**
|
|
39
|
+
/** whether to show the uploaded file list */
|
|
40
40
|
showFileList: {
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: false
|
|
43
43
|
},
|
|
44
|
-
/**
|
|
44
|
+
/** v-model 绑定值 */
|
|
45
45
|
modelValue: definePropType(String),
|
|
46
|
-
/**
|
|
46
|
+
/** 大小限制,单位kb */
|
|
47
47
|
maxSize: {
|
|
48
48
|
type: [String, Number],
|
|
49
49
|
default: 2048
|
|
50
50
|
},
|
|
51
|
-
/**
|
|
51
|
+
/** 图片上传接口,优先级最高 */
|
|
52
52
|
uploadApi: { type: definePropType(Function) },
|
|
53
|
-
/**
|
|
53
|
+
/** 图片上传地址 */
|
|
54
54
|
uploadUrl: String,
|
|
55
|
-
/**
|
|
55
|
+
/** 宽度 */
|
|
56
56
|
width: {
|
|
57
57
|
type: [String, Number],
|
|
58
58
|
default: 150
|
|
59
59
|
},
|
|
60
|
-
/**
|
|
60
|
+
/** 高度 */
|
|
61
61
|
height: {
|
|
62
62
|
type: [String, Number],
|
|
63
63
|
default: 150
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
/** FaUploadImage 的运行时 Emits
|
|
66
|
+
/** FaUploadImage 的运行时 Emits 定义 */
|
|
67
67
|
const faUploadImageEmits = {
|
|
68
|
-
/**
|
|
68
|
+
/** v-model 回调 */
|
|
69
69
|
"update:modelValue": (value) => typeof value === "string" || value === null,
|
|
70
|
-
/**
|
|
70
|
+
/** v-model:fileList 回调 */
|
|
71
71
|
"update:fileList": (value) => Array.isArray(value)
|
|
72
72
|
};
|
|
73
73
|
var uploadImage_default = defineComponent({
|
|
@@ -176,23 +176,23 @@ var uploadImage_default = defineComponent({
|
|
|
176
176
|
"urlList": state.previewList
|
|
177
177
|
}, null)]));
|
|
178
178
|
return useExpose(expose, {
|
|
179
|
-
/**
|
|
179
|
+
/** 取消上传请求 */
|
|
180
180
|
abort: computed(() => uploadRef.value?.abort),
|
|
181
|
-
/**
|
|
181
|
+
/** 手动上传文件列表 */
|
|
182
182
|
submit: computed(() => uploadRef.value?.submit),
|
|
183
|
-
/**
|
|
183
|
+
/** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */
|
|
184
184
|
clearFiles: computed(() => uploadRef.value?.clearFiles),
|
|
185
|
-
/**
|
|
185
|
+
/** 手动选择文件 */
|
|
186
186
|
handleStart: computed(() => uploadRef.value?.handleStart),
|
|
187
|
-
/**
|
|
187
|
+
/** 手动移除文件。file 和 rawFile 已被合并。 */
|
|
188
188
|
handleRemove: computed(() => uploadRef.value?.handleRemove),
|
|
189
|
-
/**
|
|
189
|
+
/** 加载状态 */
|
|
190
190
|
loading,
|
|
191
|
-
/**
|
|
191
|
+
/** 文件集合 */
|
|
192
192
|
fileList,
|
|
193
|
-
/**
|
|
193
|
+
/** 预览 */
|
|
194
194
|
preview: computed(() => state.preview),
|
|
195
|
-
/**
|
|
195
|
+
/** 预览集合 */
|
|
196
196
|
previewList: computed(() => state.previewList)
|
|
197
197
|
});
|
|
198
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadImage.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImage/src/uploadImage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, shallowRef, withModifiers } from \"vue\";\nimport { Delete, Edit, UploadFilled, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\nimport { addCssUnit, definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUploadImage 的运行时 Props 定义。 */\nexport const faUploadImageProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...uploadProps,\n\t/** @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: () => FaMimeType.Image,\n\t},\n\t/** @description type of file list */\n\tlistType: {\n\t\ttype: definePropType<NonNullable<UploadProps[\"listType\"]>>(String),\n\t\tdefault: \"picture\",\n\t},\n\t/** @description whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t\tvalidator: (value: boolean) => {\n\t\t\tif (value) {\n\t\t\t\tconsole.warn(\"[Fast:FaUploadImage]\", \"'multiple' 属性固定为 false,外部设置不会生效。\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t},\n\t/** @description whether to show the uploaded file list */\n\tshowFileList: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: definePropType<string | null>(String),\n\t/** @description 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** @description 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** @description 图片上传地址 */\n\tuploadUrl: String,\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n\t/** @description 高度 */\n\theight: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n};\n\n/** FaUploadImage 的运行时 Emits 定义。 */\nexport const faUploadImageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** @description v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]) => Array.isArray(value),\n};\n\n/** FaUploadImage 的插槽参数。 */\nexport interface FaUploadImageSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImage\",\n\tprops: faUploadImageProps,\n\temits: faUploadImageEmits,\n\tslots: makeSlots<FaUploadImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string>(\"FaUploadImage\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要与 Element Plus 2.x 的运行时默认 action 比较。\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst uploadRef = shallowRef<UploadInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-image__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要识别 Element Plus 2.x 注入的默认请求实现。\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = () => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = () => {\n\t\t\tconst fileUrl = fileList.value[0]?.url;\n\t\t\tif (!fileUrl) return;\n\t\t\tstate.previewList = [fileUrl];\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = () => {\n\t\t\tconst file = fileList.value[0];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn props.beforeUpload(rawFile);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-image\", state.uploadKey]}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\"--width\": addCssUnit(props.width),\n\t\t\t\t\t\t\"--height\": addCssUnit(props.height),\n\t\t\t\t\t}}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={false}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length > 0 ? (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={fileList.value[0]?.url} />\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"el-upload-list__item-actions\"\n\t\t\t\t\t\t\t\t\t\tonClick={withModifiers(() => {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}, [\"stop\"])}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handlePreview} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleRemove} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t) : slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"el-icon--upload\">\n\t\t\t\t\t\t\t\t\t\t<UploadFilled />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t<div class=\"el-upload__text\">\n\t\t\t\t\t\t\t\t\t\t{props.drag && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\tDrop file here <br />\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t<em>click to upload</em>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">file with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** @description 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** @description 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** @description 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** @description 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading,\n\t\t\t/** @description 文件集合 */\n\t\t\tfileList,\n\t\t\t/** @description 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** @description 预览集合 */\n\t\t\tpreviewList: computed(() => state.previewList),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qBAAqB;CAEjC,GAAG;;CAEH,QAAQ;EACP,MAAM;EACN,eAAe,WAAW;CAC3B;;CAEA,UAAU;EACT,MAAM,eAAqD,MAAM;EACjE,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;EACN,SAAS;EACT,YAAY,UAAmB;GAC9B,IAAI,OAAO;IACV,QAAQ,KAAK,wBAAwB,kCAAkC;IACvE,OAAO;GACR;GACA,OAAO;EACR;CACD;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAA8B,MAAM;;CAEhD,SAAS;EACR,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,WAAW,EACV,MAAM,eAAwD,QAAQ,EACvE;;CAEA,WAAW;;CAEX,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,QAAQ;EACP,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;AACD;;AAGA,MAAa,qBAAqB;;CAEjC,sBAAsB,UAAyB,OAAO,UAAU,YAAY,UAAU;;CAEtF,oBAAoB,UAA4B,MAAM,QAAQ,KAAK;AACpE;AAQA,IAAA,sBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAA8B;CACrC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,EACL,UACA,SACA,aACA,WACA,mBACA,iBACA,eACA,gBACA,gBACA,gBACA,mBACG,UAAkB,iBAAiB,MAAM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I,YAAA,UAAA,MAAA,CAAA,gBAAA,iBAAA,GAAA,YAAA,MAAA,MAAA,IAAA,CAAA,CAAA,GAIV,YAAA,MAAA,MAAA,CAAA,gBAAA,iBAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;GAKL,WAAK,YAAA,OAAA,EAAA,SAAA,iBAAA,GAAA;IAAA,gBAAA,6BAAA;IAA8D,UAAU,MAAM,SAAS;IAAC,gBAAA,IAAA;GAAA,CAAA;EAAS,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GA7D7F,QAAQ,KAAK,CAAA,CAAA,GAgEvB,MAAM,WAAO,YAAA,eAAA;GAAA,sBAAA;GAAA,oBAAA;GAAA,cAAA;GAAA,iBAKI,MAAM,UAAU;GAAM,WAC7B,MAAM;EAAW,GAAA,IAAA,CAE3B,CAAA,CAEF;EAED,OAAO,UAAU,QAAQ;;GAExB,OAAO,eAAe,UAAU,OAAO,KAAK;;GAE5C,QAAQ,eAAe,UAAU,OAAO,MAAM;;GAE9C,YAAY,eAAe,UAAU,OAAO,UAAU;;GAEtD,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,cAAc,eAAe,UAAU,OAAO,YAAY;;GAE1D;;GAEA;;GAEA,SAAS,eAAe,MAAM,OAAO;;GAErC,aAAa,eAAe,MAAM,WAAW;EAC9C,CAAC;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"uploadImage.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImage/src/uploadImage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, shallowRef, withModifiers } from \"vue\";\nimport { Delete, Edit, UploadFilled, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\nimport { addCssUnit, definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUploadImage 的运行时 Props 定义 */\nexport const faUploadImageProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...uploadProps,\n\t/** accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: () => FaMimeType.Image,\n\t},\n\t/** type of file list */\n\tlistType: {\n\t\ttype: definePropType<NonNullable<UploadProps[\"listType\"]>>(String),\n\t\tdefault: \"picture\",\n\t},\n\t/** whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t\tvalidator: (value: boolean) => {\n\t\t\tif (value) {\n\t\t\t\tconsole.warn(\"[Fast:FaUploadImage]\", \"'multiple' 属性固定为 false,外部设置不会生效。\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t},\n\t/** whether to show the uploaded file list */\n\tshowFileList: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/** v-model 绑定值 */\n\tmodelValue: definePropType<string | null>(String),\n\t/** 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** 图片上传地址 */\n\tuploadUrl: String,\n\t/** 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n\t/** 高度 */\n\theight: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n};\n\n/** FaUploadImage 的运行时 Emits 定义 */\nexport const faUploadImageEmits = {\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]) => Array.isArray(value),\n};\n\n/** FaUploadImage 的插槽参数 */\nexport interface FaUploadImageSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImage\",\n\tprops: faUploadImageProps,\n\temits: faUploadImageEmits,\n\tslots: makeSlots<FaUploadImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string>(\"FaUploadImage\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要与 Element Plus 2.x 的运行时默认 action 比较。\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst uploadRef = shallowRef<UploadInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-image__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要识别 Element Plus 2.x 注入的默认请求实现。\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = () => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = () => {\n\t\t\tconst fileUrl = fileList.value[0]?.url;\n\t\t\tif (!fileUrl) return;\n\t\t\tstate.previewList = [fileUrl];\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = () => {\n\t\t\tconst file = fileList.value[0];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn props.beforeUpload(rawFile);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-image\", state.uploadKey]}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\"--width\": addCssUnit(props.width),\n\t\t\t\t\t\t\"--height\": addCssUnit(props.height),\n\t\t\t\t\t}}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={false}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length > 0 ? (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={fileList.value[0]?.url} />\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"el-upload-list__item-actions\"\n\t\t\t\t\t\t\t\t\t\tonClick={withModifiers(() => {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}, [\"stop\"])}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handlePreview} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleRemove} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t) : slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"el-icon--upload\">\n\t\t\t\t\t\t\t\t\t\t<UploadFilled />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t<div class=\"el-upload__text\">\n\t\t\t\t\t\t\t\t\t\t{props.drag && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\tDrop file here <br />\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t<em>click to upload</em>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">file with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** 加载状态 */\n\t\t\tloading,\n\t\t\t/** 文件集合 */\n\t\t\tfileList,\n\t\t\t/** 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** 预览集合 */\n\t\t\tpreviewList: computed(() => state.previewList),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qBAAqB;CAEjC,GAAG;;CAEH,QAAQ;EACP,MAAM;EACN,eAAe,WAAW;CAC3B;;CAEA,UAAU;EACT,MAAM,eAAqD,MAAM;EACjE,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;EACN,SAAS;EACT,YAAY,UAAmB;GAC9B,IAAI,OAAO;IACV,QAAQ,KAAK,wBAAwB,kCAAkC;IACvE,OAAO;GACR;GACA,OAAO;EACR;CACD;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAA8B,MAAM;;CAEhD,SAAS;EACR,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,WAAW,EACV,MAAM,eAAwD,QAAQ,EACvE;;CAEA,WAAW;;CAEX,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,QAAQ;EACP,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;AACD;;AAGA,MAAa,qBAAqB;;CAEjC,sBAAsB,UAAyB,OAAO,UAAU,YAAY,UAAU;;CAEtF,oBAAoB,UAA4B,MAAM,QAAQ,KAAK;AACpE;AAQA,IAAA,sBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAA8B;CACrC,MAAM,OAAO,EAAE,OAA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