kouxiangtang 0.1.31 → 0.1.33

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.
Files changed (56) hide show
  1. package/dist/{AttachmentUploader-kjI75NG4.js → AttachmentUploader-B7kkPU2C.js} +2 -2
  2. package/dist/{AttachmentUploader-kjI75NG4.js.map → AttachmentUploader-B7kkPU2C.js.map} +1 -1
  3. package/dist/{ImageUploader-CDBMZ9Q4.js → ImageUploader-ByDQtIvq.js} +2 -2
  4. package/dist/{ImageUploader-CDBMZ9Q4.js.map → ImageUploader-ByDQtIvq.js.map} +1 -1
  5. package/dist/{ImagesUploader-DR1NdrIX.js → ImagesUploader-D6-3HM_D.js} +2 -2
  6. package/dist/{ImagesUploader-DR1NdrIX.js.map → ImagesUploader-D6-3HM_D.js.map} +1 -1
  7. package/dist/{RichTextEditor-M8WpX6JI.js → RichTextEditor-BL6xqftk.js} +2 -2
  8. package/dist/{RichTextEditor-M8WpX6JI.js.map → RichTextEditor-BL6xqftk.js.map} +1 -1
  9. package/dist/{config-z9izRzg4.js → config-8QYaFvNM.js} +2 -2
  10. package/dist/{config-z9izRzg4.js.map → config-8QYaFvNM.js.map} +1 -1
  11. package/dist/{config-h20uQgYE.js → config-BRlZRcCp.js} +3 -3
  12. package/dist/{config-h20uQgYE.js.map → config-BRlZRcCp.js.map} +1 -1
  13. package/dist/{config-Csw0On0x.js → config-BeR4PpdP.js} +2 -2
  14. package/dist/{config-Csw0On0x.js.map → config-BeR4PpdP.js.map} +1 -1
  15. package/dist/{config-Ob9gEzh5.js → config-BnpixRqt.js} +3 -3
  16. package/dist/{config-Ob9gEzh5.js.map → config-BnpixRqt.js.map} +1 -1
  17. package/dist/{config-czbw2bDq.js → config-Bu0VHLBr.js} +2 -2
  18. package/dist/{config-czbw2bDq.js.map → config-Bu0VHLBr.js.map} +1 -1
  19. package/dist/{config-LPjXlVUG.js → config-CGN5-J3g.js} +2 -2
  20. package/dist/{config-LPjXlVUG.js.map → config-CGN5-J3g.js.map} +1 -1
  21. package/dist/{config-C_d1djj4.js → config-CVpuFBZU.js} +2 -2
  22. package/dist/{config-C_d1djj4.js.map → config-CVpuFBZU.js.map} +1 -1
  23. package/dist/{config-DbXMEYLj.js → config-CkOTyA6M.js} +2 -2
  24. package/dist/{config-DbXMEYLj.js.map → config-CkOTyA6M.js.map} +1 -1
  25. package/dist/{config-CqR0uCa_.js → config-CoRLR8yc.js} +2 -2
  26. package/dist/{config-CqR0uCa_.js.map → config-CoRLR8yc.js.map} +1 -1
  27. package/dist/{config-CVao0Cla.js → config-Cy9I3Yww.js} +2 -2
  28. package/dist/{config-CVao0Cla.js.map → config-Cy9I3Yww.js.map} +1 -1
  29. package/dist/{config-D_FDegBc.js → config-CyTeIX36.js} +2 -2
  30. package/dist/{config-D_FDegBc.js.map → config-CyTeIX36.js.map} +1 -1
  31. package/dist/{config-HKkdk6wZ.js → config-DNjYwWf2.js} +2 -2
  32. package/dist/{config-HKkdk6wZ.js.map → config-DNjYwWf2.js.map} +1 -1
  33. package/dist/{config-2BP5-eb_.js → config-Dd3jwmiE.js} +3 -3
  34. package/dist/{config-2BP5-eb_.js.map → config-Dd3jwmiE.js.map} +1 -1
  35. package/dist/{config-CVslr70e.js → config-DhFx4vma.js} +2 -2
  36. package/dist/{config-CVslr70e.js.map → config-DhFx4vma.js.map} +1 -1
  37. package/dist/{config-d7n2dlpo.js → config-DvLe94XY.js} +2 -2
  38. package/dist/{config-d7n2dlpo.js.map → config-DvLe94XY.js.map} +1 -1
  39. package/dist/{config-jR1X5xVh.js → config-HHs-1vYi.js} +2 -2
  40. package/dist/{config-jR1X5xVh.js.map → config-HHs-1vYi.js.map} +1 -1
  41. package/dist/{config-BQByyFaI.js → config-QcC384MA.js} +2 -2
  42. package/dist/{config-BQByyFaI.js.map → config-QcC384MA.js.map} +1 -1
  43. package/dist/{config-BAjlIeLU.js → config-R1n9p5mL.js} +2 -2
  44. package/dist/{config-BAjlIeLU.js.map → config-R1n9p5mL.js.map} +1 -1
  45. package/dist/{config-Dq4y7P21.js → config-aPvPNn1F.js} +2 -2
  46. package/dist/{config-Dq4y7P21.js.map → config-aPvPNn1F.js.map} +1 -1
  47. package/dist/{config-CQA1bx3f.js → config-lUL3nYIJ.js} +2 -2
  48. package/dist/{config-CQA1bx3f.js.map → config-lUL3nYIJ.js.map} +1 -1
  49. package/dist/{index-DXK7K7iB.js → index-Bq_Z8Hm7.js} +2060 -2020
  50. package/dist/index-Bq_Z8Hm7.js.map +1 -0
  51. package/dist/kouxiangtang.js +18 -16
  52. package/dist/kouxiangtang.umd.cjs +9 -9
  53. package/dist/kouxiangtang.umd.cjs.map +1 -1
  54. package/dist/style.css +1 -1
  55. package/package.json +1 -1
  56. package/dist/index-DXK7K7iB.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { computed as F, ref as y, openBlock as p, createElementBlock as k, Fragment as E, createVNode as r, unref as n, normalizeClass as M, withModifiers as R, withCtx as i, createBlock as f, createTextVNode as j, createElementVNode as U, renderList as L, toDisplayString as O, createCommentVNode as S } from "vue";
2
2
  import { ElUpload as q, ElIcon as v, ElButton as W, ElDialog as G, ElForm as H, ElFormItem as J, ElInput as K, ElMessage as u, ElLoading as w } from "element-plus";
3
- import { _ as Q, j as X, p as Y, d as Z, k as ee, h as te, m as ae } from "./index-DXK7K7iB.js";
3
+ import { _ as Q, j as X, p as Y, d as Z, k as ee, h as te, m as ae } from "./index-Bq_Z8Hm7.js";
4
4
  import "./el-progress-l0sNRNKZ.js";
5
5
  const se = ["src"], ne = { class: "file-type" }, le = {
6
6
  __name: "AttachmentUploader",
@@ -222,4 +222,4 @@ const se = ["src"], ne = { class: "file-type" }, le = {
222
222
  export {
223
223
  pe as default
224
224
  };
225
- //# sourceMappingURL=AttachmentUploader-kjI75NG4.js.map
225
+ //# sourceMappingURL=AttachmentUploader-B7kkPU2C.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentUploader-kjI75NG4.js","sources":["../src/framework/field/attachment/AttachmentUploader.vue"],"sourcesContent":["<script setup>\nimport {\n ElUpload,\n ElIcon,\n ElDialog,\n ElForm,\n ElFormItem,\n ElButton,\n ElInput,\n} from \"element-plus\";\nimport axios from \"axios\";\nimport http from \"../../utils/http\";\nimport { getConfig } from \"../../config-loader\";\nimport { ref, computed } from \"vue\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Document, Close } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\", \"on-remove\", \"on-change\"]);\nconst props = defineProps({\n pics: {\n type: Array,\n default() {\n return [];\n },\n },\n limit: { type: Number },\n props: {\n type: Object,\n default() {\n return {\n listType: \"picture-card\", //'text' | 'picture' | 'picture-card'\n limit: 5, //最多上传几个文件\n accept: \"image/*\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.pics.map((item) => {\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n if (typeof item.name !== undefined) {\n item.fileType = fileType;\n return item;\n }\n\n if (item.url) {\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType: fileType,\n };\n return namedItem;\n }\n\n return { ...item, name: item.id, fileType: fileType };\n });\n});\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst imageUrl = ref(props);\nconst uploadUrl = getConfig().fileUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst compressImg = (file) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n\n return new Promise(function (resolve, reject) {\n if (!file.type.startsWith(\"image/\")) {\n resolve(file);\n return false;\n }\n reader.onload = async (e) => {\n const img = new Image();\n img.src = e.target.result;\n img.onload = () => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n canvas.toBlob(\n (blob) => {\n const newFile = new File([blob], file.name, {\n type: file.type,\n lastModified: Date.now(),\n });\n resolve(newFile);\n },\n file.type,\n 0.5,\n );\n };\n };\n return false;\n });\n};\nconst handleRemoveSuccess = (uploadFile) => {\n if (uploadFile.status === \"success\") {\n if (props.props.deleteParams) {\n const paramsData = props.props.deleteParams?.data\n ? props.props.deleteParams?.data\n : {};\n http\n .remove(\n `${props.props.deleteParams.url}/${uploadFile.id}/attachment`,\n paramsData,\n paramsData,\n )\n .then(() => {\n emit(\"on-remove\", uploadFile);\n });\n } else {\n emit(\"on-remove\", uploadFile);\n }\n }\n};\nconst handleExceed = () => {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n};\nconst handlePictureCardPreview = (uploadFile) => {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n};\nconst handleBeforeUpload = (file) => {\n const fileName = file.name.substring(0, file.name.lastIndexOf(\".\"));\n const regex = /^[\\u4e00-\\u9fa5\\w-_]+$/;\n if (!regex.test(fileName)) {\n ElMessage({\n message: \"请勿输入特殊字符!\",\n type: \"warning\",\n });\n return false;\n }\n compressImg(file).then((newFile) => {\n if (newFile.size / 1024 / 1024 < 5) {\n uploadRequest(newFile);\n return false;\n } else {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n });\n};\n\nfunction handleFileNameChange(file, index) {\n if (!file.name) {\n ElMessage({\n message: \"附件名称不能为空!\",\n type: \"warning\",\n });\n return;\n }\n emit(\"on-change\", file);\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"file\", file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n emit(\"on-success\", res.data.data);\n resolve(res.data);\n return false;\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n :file-list=\"files\"\n :action=\"uploadUrl\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"handleRemoveSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :on-exceed=\"handleExceed\"\n :on-preview=\"handlePictureCardPreview\"\n :multiple=\"true\"\n :http-request=\"\n () => {\n return false;\n }\n \"\n :show-file-list=\"props.props.listType !== 'text'\"\n :class=\"[\n 'upload-main',\n { 'disable-upload': files.length >= props.props.limit },\n ]\"\n @click.prevent\n >\n <template v-if=\"props.props.listType !== 'text'\">\n <el-icon :disabled=\"true\">\n <Plus />\n </el-icon>\n </template>\n <template v-else>\n <el-button class=\"upload-button\" type=\"primary\"> 上传附件 </el-button>\n </template>\n </el-upload>\n <el-dialog v-model=\"dialogVisible\">\n <img w-full :src=\"dialogImageUrl\" alt=\"Preview Image\" />\n </el-dialog>\n <el-form v-if=\"props.props.listType == 'text'\">\n <el-form-item v-for=\"(file, index) in files\" :key=\"index\" class=\"file-list\">\n <el-icon color=\"#73767a\" :size=\"14\">\n <Document />\n </el-icon>\n <el-input\n v-model=\"file.name\"\n @change=\"handleFileNameChange(file, index)\"\n />\n <span class=\"file-type\">.{{ file.fileType }}</span>\n <el-icon color=\"#73767a\" :size=\"12\" @click=\"handleRemoveSuccess(file)\">\n <Close />\n </el-icon>\n </el-form-item>\n </el-form>\n</template>\n<style scoped lang=\"scss\">\n:deep(.el-upload-list) {\n .el-upload-list__item-actions span {\n margin-left: 20px;\n }\n}\n\n.disable-upload {\n :deep(.el-upload--picture-card) {\n display: none !important;\n }\n\n :deep(.el-upload--text) {\n display: none !important;\n }\n\n :deep(.el-upload--picture) {\n display: none !important;\n }\n}\n.upload-main {\n flex-basis: 100%;\n}\n.file-list {\n display: flex;\n align-items: center;\n margin-top: 10px;\n .file-type {\n height: 22px;\n line-height: 22px;\n margin-right: 5px;\n background: #eeeeee;\n border-radius: 4px;\n font-size: 12px;\n padding: 0 4px;\n }\n :deep(.el-form-item__content) {\n display: contents;\n }\n :deep(.el-input__wrapper) {\n margin: 0 5px;\n }\n :deep(.el-input__inner) {\n height: 20px;\n line-height: 20px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","files","computed","item","fileType","parts","dialogImageUrl","ref","dialogVisible","uploadUrl","getConfig","compressImg","file","reader","resolve","reject","e","img","canvas","ctx","blob","newFile","handleRemoveSuccess","uploadFile","paramsData","_a","_b","http","handleExceed","ElMessage","handlePictureCardPreview","handleBeforeUpload","fileName","uploadRequest","handleFileNameChange","index","ElLoading","formData","axios","res"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAOC,GACPC,IAAQC,GAoBRC,IAAQC,EAAS,MACdH,EAAM,KAAK,IAAI,CAACI,MAAS;AAC9B,YAAMC,IAAWD,EAAK,IAAI,UAAUA,EAAK,IAAI,YAAY,GAAG,IAAI,CAAC;AACjE,UAAI,OAAOA,EAAK,SAAS;AACvB,eAAAA,EAAK,WAAWC,GACTD;AAGT,UAAIA,EAAK,KAAK;AACZ,cAAME,IAAQF,EAAK,IAAI,MAAM,GAAG;AAMhC,eALkB;AAAA,UAChB,GAAGA;AAAA,UACH,MAAME,EAAMA,EAAM,SAAS,CAAC;AAAA,UAC5B,UAAUD;AAAA,QAClB;AAAA,MAEK;AAED,aAAO,EAAE,GAAGD,GAAM,MAAMA,EAAK,IAAI,UAAUC;IAC/C,CAAG,CACF,GACKE,IAAiBC,EAAI,EAAE,GACvBC,IAAgBD,EAAI,EAAK;AACd,IAAAA,EAAIR,CAAK;AAC1B,UAAMU,IAAYC,EAAW,EAAC;AACf,IACY,gBAAa,QAAQ,OAAO;AAEvD,UAAMC,IAAc,CAACC,MAAS;AAC5B,YAAMC,IAAS,IAAI;AACnB,aAAAA,EAAO,c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A,MAAM,MAAM;AACX,UAAAH,EAAU,UAAU,SACpBP,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDd,EAAO,eAAe;AAAA,QAC9B,CAAO;AAAA,MACP,CAAG;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AttachmentUploader-B7kkPU2C.js","sources":["../src/framework/field/attachment/AttachmentUploader.vue"],"sourcesContent":["<script setup>\nimport {\n ElUpload,\n ElIcon,\n ElDialog,\n ElForm,\n ElFormItem,\n ElButton,\n ElInput,\n} from \"element-plus\";\nimport axios from \"axios\";\nimport http from \"../../utils/http\";\nimport { getConfig } from \"../../config-loader\";\nimport { ref, computed } from \"vue\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Document, Close } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\", \"on-remove\", \"on-change\"]);\nconst props = defineProps({\n pics: {\n type: Array,\n default() {\n return [];\n },\n },\n limit: { type: Number },\n props: {\n type: Object,\n default() {\n return {\n listType: \"picture-card\", //'text' | 'picture' | 'picture-card'\n limit: 5, //最多上传几个文件\n accept: \"image/*\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.pics.map((item) => {\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n if (typeof item.name !== undefined) {\n item.fileType = fileType;\n return item;\n }\n\n if (item.url) {\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType: fileType,\n };\n return namedItem;\n }\n\n return { ...item, name: item.id, fileType: fileType };\n });\n});\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst imageUrl = ref(props);\nconst uploadUrl = getConfig().fileUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst compressImg = (file) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n\n return new Promise(function (resolve, reject) {\n if (!file.type.startsWith(\"image/\")) {\n resolve(file);\n return false;\n }\n reader.onload = async (e) => {\n const img = new Image();\n img.src = e.target.result;\n img.onload = () => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n canvas.toBlob(\n (blob) => {\n const newFile = new File([blob], file.name, {\n type: file.type,\n lastModified: Date.now(),\n });\n resolve(newFile);\n },\n file.type,\n 0.5,\n );\n };\n };\n return false;\n });\n};\nconst handleRemoveSuccess = (uploadFile) => {\n if (uploadFile.status === \"success\") {\n if (props.props.deleteParams) {\n const paramsData = props.props.deleteParams?.data\n ? props.props.deleteParams?.data\n : {};\n http\n .remove(\n `${props.props.deleteParams.url}/${uploadFile.id}/attachment`,\n paramsData,\n paramsData,\n )\n .then(() => {\n emit(\"on-remove\", uploadFile);\n });\n } else {\n emit(\"on-remove\", uploadFile);\n }\n }\n};\nconst handleExceed = () => {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n};\nconst handlePictureCardPreview = (uploadFile) => {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n};\nconst handleBeforeUpload = (file) => {\n const fileName = file.name.substring(0, file.name.lastIndexOf(\".\"));\n const regex = /^[\\u4e00-\\u9fa5\\w-_]+$/;\n if (!regex.test(fileName)) {\n ElMessage({\n message: \"请勿输入特殊字符!\",\n type: \"warning\",\n });\n return false;\n }\n compressImg(file).then((newFile) => {\n if (newFile.size / 1024 / 1024 < 5) {\n uploadRequest(newFile);\n return false;\n } else {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n });\n};\n\nfunction handleFileNameChange(file, index) {\n if (!file.name) {\n ElMessage({\n message: \"附件名称不能为空!\",\n type: \"warning\",\n });\n return;\n }\n emit(\"on-change\", file);\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"file\", file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n emit(\"on-success\", res.data.data);\n resolve(res.data);\n return false;\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n :file-list=\"files\"\n :action=\"uploadUrl\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"handleRemoveSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :on-exceed=\"handleExceed\"\n :on-preview=\"handlePictureCardPreview\"\n :multiple=\"true\"\n :http-request=\"\n () => {\n return false;\n }\n \"\n :show-file-list=\"props.props.listType !== 'text'\"\n :class=\"[\n 'upload-main',\n { 'disable-upload': files.length >= props.props.limit },\n ]\"\n @click.prevent\n >\n <template v-if=\"props.props.listType !== 'text'\">\n <el-icon :disabled=\"true\">\n <Plus />\n </el-icon>\n </template>\n <template v-else>\n <el-button class=\"upload-button\" type=\"primary\"> 上传附件 </el-button>\n </template>\n </el-upload>\n <el-dialog v-model=\"dialogVisible\">\n <img w-full :src=\"dialogImageUrl\" alt=\"Preview Image\" />\n </el-dialog>\n <el-form v-if=\"props.props.listType == 'text'\">\n <el-form-item v-for=\"(file, index) in files\" :key=\"index\" class=\"file-list\">\n <el-icon color=\"#73767a\" :size=\"14\">\n <Document />\n </el-icon>\n <el-input\n v-model=\"file.name\"\n @change=\"handleFileNameChange(file, index)\"\n />\n <span class=\"file-type\">.{{ file.fileType }}</span>\n <el-icon color=\"#73767a\" :size=\"12\" @click=\"handleRemoveSuccess(file)\">\n <Close />\n </el-icon>\n </el-form-item>\n </el-form>\n</template>\n<style scoped lang=\"scss\">\n:deep(.el-upload-list) {\n .el-upload-list__item-actions span {\n margin-left: 20px;\n }\n}\n\n.disable-upload {\n :deep(.el-upload--picture-card) {\n display: none !important;\n }\n\n :deep(.el-upload--text) {\n display: none !important;\n }\n\n :deep(.el-upload--picture) {\n display: none !important;\n }\n}\n.upload-main {\n flex-basis: 100%;\n}\n.file-list {\n display: flex;\n align-items: center;\n margin-top: 10px;\n .file-type {\n height: 22px;\n line-height: 22px;\n margin-right: 5px;\n background: #eeeeee;\n border-radius: 4px;\n font-size: 12px;\n padding: 0 4px;\n }\n :deep(.el-form-item__content) {\n display: contents;\n }\n :deep(.el-input__wrapper) {\n margin: 0 5px;\n }\n :deep(.el-input__inner) {\n height: 20px;\n line-height: 20px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","files","computed","item","fileType","parts","dialogImageUrl","ref","dialogVisible","uploadUrl","getConfig","compressImg","file","reader","resolve","reject","e","img","canvas","ctx","blob","newFile","handleRemoveSuccess","uploadFile","paramsData","_a","_b","http","handleExceed","ElMessage","handlePictureCardPreview","handleBeforeUpload","fileName","uploadRequest","handleFileNameChange","index","ElLoading","formData","axios","res"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAOC,GACPC,IAAQC,GAoBRC,IAAQC,EAAS,MACdH,EAAM,KAAK,IAAI,CAACI,MAAS;AAC9B,YAAMC,IAAWD,EAAK,IAAI,UAAUA,EAAK,IAAI,YAAY,GAAG,IAAI,CAAC;AACjE,UAAI,OAAOA,EAAK,SAAS;AACvB,eAAAA,EAAK,WAAWC,GACTD;AAGT,UAAIA,EAAK,KAAK;AACZ,cAAME,IAAQF,EAAK,IAAI,MAAM,GAAG;AAMhC,eALkB;AAAA,UAChB,GAAGA;AAAA,UACH,MAAME,EAAMA,EAAM,SAAS,CAAC;AAA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CAAE,GAC7D,IAAI,QAAQ,CAACtB,GAASC,MAAW;AACtC,cAAMsB,IAAW,IAAI;AACrB,QAAAA,EAAS,OAAO,QAAQzB,CAAI,GAC5B0B,GACG,KAAK7B,GAAW4B,GAAU,EAAE,EAC5B,KAAK,CAACE,OACLH,EAAU,UAAU,SACpBP,EAAU;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,QAChB,CAAS,GACDhC,EAAK,cAAc0C,EAAI,KAAK,IAAI,GAChCzB,EAAQyB,EAAI,IAAI,GACT,GACR,EACA,MAAM,MAAM;AACX,UAAAH,EAAU,UAAU,SACpBP,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDd,EAAO,eAAe;AAAA,QAC9B,CAAO;AAAA,MACP,CAAG;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { openBlock as o, createBlock as l, unref as e, createSlots as I, withCtx as s, renderSlot as E, createElementVNode as f, createVNode as c, withModifiers as S, createCommentVNode as b, toDisplayString as x } from "vue";
2
2
  import { ElUpload as B, ElImage as M, ElIcon as i, ElMessage as n, ElLoading as p } from "element-plus";
3
- import { _ as C, j as D, l as L, p as N, n as V, m as j } from "./index-DXK7K7iB.js";
3
+ import { _ as C, j as D, l as L, p as N, n as V, m as j } from "./index-Bq_Z8Hm7.js";
4
4
  import "./el-progress-l0sNRNKZ.js";
5
5
  const q = { class: "image-slot" }, z = { class: "el-upload__tip" }, $ = {
6
6
  __name: "ImageUploader",
@@ -112,4 +112,4 @@ const q = { class: "image-slot" }, z = { class: "el-upload__tip" }, $ = {
112
112
  export {
113
113
  R as default
114
114
  };
115
- //# sourceMappingURL=ImageUploader-CDBMZ9Q4.js.map
115
+ //# sourceMappingURL=ImageUploader-ByDQtIvq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUploader-CDBMZ9Q4.js","sources":["../src/framework/field/image/ImageUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElImage, ElIcon } from \"element-plus\";\nimport axios from \"axios\";\nimport { getConfig } from \"../../config-loader\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Delete, Loading } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\"]);\nconst props = defineProps({\n imageUrl: { type: String },\n props: {\n type: Object,\n default() {\n return {\n accept: \"image/*\",\n tip: \"\",\n };\n },\n },\n});\nconst uploadUrl = getConfig().imageUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst handleBeforeUpload = (uploadFile) => {\n const isLt2M = uploadFile.size / 1024 / 1024 < 5;\n if (!isLt2M) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n};\nconst handleSuccess = (response) => {\n emit(\"on-success\", response.data.imageUrl);\n};\n\nfunction deleteImageUrl() {\n emit(\"on-success\", \"\");\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"image\", file.file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n resolve(res.data);\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n class=\"image-uploader\"\n :action=\"uploadUrl\"\n name=\"image\"\n :show-file-list=\"false\"\n :accept=\"props.props.accept\"\n :on-success=\"handleSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :http-request=\"uploadRequest\"\n >\n <slot />\n <el-image\n v-if=\"props.imageUrl\"\n class=\"image\"\n :src=\"props.imageUrl\"\n fit=\"scale-down\"\n >\n <template #placeholder>\n <div class=\"image-slot\">\n <el-icon class=\"placeholder-icon\">\n <Loading />\n </el-icon>\n </div>\n </template>\n </el-image>\n <el-icon v-else class=\"uploader-icon\">\n <Plus />\n </el-icon>\n <el-icon\n v-if=\"props.imageUrl\"\n class=\"delete-icon\"\n @click.stop.prevent=\"deleteImageUrl\"\n >\n <Delete />\n </el-icon>\n <template v-if=\"props.props.tip\" #tip>\n <div class=\"el-upload__tip\">{{ props.props.tip }}</div>\n </template>\n </el-upload>\n</template>\n\n<style scoped lang=\"scss\">\n.image-uploader {\n :deep(.el-upload) {\n border: 1px dashed var(--el-border-color);\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n transition: var(--el-transition-duration-fast);\n\n &:hover {\n border-color: var(--el-color-primary);\n }\n }\n\n .image {\n width: 146px;\n height: 146px;\n\n .placeholder-icon {\n width: 146px;\n height: 146px;\n font-size: 30px;\n color: #a7a7a7;\n }\n }\n\n .uploader-icon {\n font-size: 28px;\n color: #8c939d;\n width: 146px;\n height: 146px;\n text-align: center;\n }\n\n .delete-icon {\n font-size: 20px;\n color: #b7b4b4;\n position: absolute;\n top: 10px;\n right: 10px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","uploadUrl","getConfig","handleBeforeUpload","uploadFile","ElMessage","handleSuccess","response","deleteImageUrl","uploadRequest","file","ElLoading","resolve","reject","formData","axios","res"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAOC,GACPC,IAAQC,GAYRC,IAAYC,EAAW,EAAC;AACf,IACY,gBAAa,QAAQ,OAAO;AAEvD,UAAMC,IAAqB,CAACC,MAAe;AAEzC,UAAI,EADWA,EAAW,OAAO,OAAO,OAAO;AAE7C,eAAAC,EAAU;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,QACZ,CAAK,GACM;AAAA,IAEX,GACMC,IAAgB,CAACC,MAAa;AAClC,MAAAV,EAAK,cAAcU,EAAS,KAAK,QAAQ;AAAA,IAC3C;AAEA,aAASC,IAAiB;AACxB,MAAAX,EAAK,cAAc,EAAE;AAAA,IACvB;AAEA,aAASY,EAAcC,GAAM;AAC3B,aAAAC,EAAU,QAAQ,EAAE,MAAM,WAAW,YAAY,kBAAiB,CAAE,GAC7D,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,cAAMC,IAAW,IAAI;AACrB,QAAAA,EAAS,OAAO,SAASJ,EAAK,IAAI,GAClCK,EACG,KAAKd,GAAWa,GAAU,EAAE,EAC5B,KAAK,CAACE,MAAQ;AACb,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDO,EAAQI,EAAI,IAAI;AAAA,QACxB,CAAO,EACA,MAAM,MAAM;AACX,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDQ,EAAO,eAAe;AAAA,QAC9B,CAAO;AAAA,MACP,CAAG;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ImageUploader-ByDQtIvq.js","sources":["../src/framework/field/image/ImageUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElImage, ElIcon } from \"element-plus\";\nimport axios from \"axios\";\nimport { getConfig } from \"../../config-loader\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Delete, Loading } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\"]);\nconst props = defineProps({\n imageUrl: { type: String },\n props: {\n type: Object,\n default() {\n return {\n accept: \"image/*\",\n tip: \"\",\n };\n },\n },\n});\nconst uploadUrl = getConfig().imageUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst handleBeforeUpload = (uploadFile) => {\n const isLt2M = uploadFile.size / 1024 / 1024 < 5;\n if (!isLt2M) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n};\nconst handleSuccess = (response) => {\n emit(\"on-success\", response.data.imageUrl);\n};\n\nfunction deleteImageUrl() {\n emit(\"on-success\", \"\");\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"image\", file.file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n resolve(res.data);\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n class=\"image-uploader\"\n :action=\"uploadUrl\"\n name=\"image\"\n :show-file-list=\"false\"\n :accept=\"props.props.accept\"\n :on-success=\"handleSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :http-request=\"uploadRequest\"\n >\n <slot />\n <el-image\n v-if=\"props.imageUrl\"\n class=\"image\"\n :src=\"props.imageUrl\"\n fit=\"scale-down\"\n >\n <template #placeholder>\n <div class=\"image-slot\">\n <el-icon class=\"placeholder-icon\">\n <Loading />\n </el-icon>\n </div>\n </template>\n </el-image>\n <el-icon v-else class=\"uploader-icon\">\n <Plus />\n </el-icon>\n <el-icon\n v-if=\"props.imageUrl\"\n class=\"delete-icon\"\n @click.stop.prevent=\"deleteImageUrl\"\n >\n <Delete />\n </el-icon>\n <template v-if=\"props.props.tip\" #tip>\n <div class=\"el-upload__tip\">{{ props.props.tip }}</div>\n </template>\n </el-upload>\n</template>\n\n<style scoped lang=\"scss\">\n.image-uploader {\n :deep(.el-upload) {\n border: 1px dashed var(--el-border-color);\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n transition: var(--el-transition-duration-fast);\n\n &:hover {\n border-color: var(--el-color-primary);\n }\n }\n\n .image {\n width: 146px;\n height: 146px;\n\n .placeholder-icon {\n width: 146px;\n height: 146px;\n font-size: 30px;\n color: #a7a7a7;\n }\n }\n\n .uploader-icon {\n font-size: 28px;\n color: #8c939d;\n width: 146px;\n height: 146px;\n text-align: center;\n }\n\n .delete-icon {\n font-size: 20px;\n color: #b7b4b4;\n position: absolute;\n top: 10px;\n right: 10px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","uploadUrl","getConfig","handleBeforeUpload","uploadFile","ElMessage","handleSuccess","response","deleteImageUrl","uploadRequest","file","ElLoading","resolve","reject","formData","axios","res"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAOC,GACPC,IAAQC,GAYRC,IAAYC,EAAW,EAAC;AACf,IACY,gBAAa,QAAQ,OAAO;AAEvD,UAAMC,IAAqB,CAACC,MAAe;AAEzC,UAAI,EADWA,EAAW,OAAO,OAAO,OAAO;AAE7C,eAAAC,EAAU;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,QACZ,CAAK,GACM;AAAA,IAEX,GACMC,IAAgB,CAACC,MAAa;AAClC,MAAAV,EAAK,cAAcU,EAAS,KAAK,QAAQ;AAAA,IAC3C;AAEA,aAASC,IAAiB;AACxB,MAAAX,EAAK,cAAc,EAAE;AAAA,IACvB;AAEA,aAASY,EAAcC,GAAM;AAC3B,aAAAC,EAAU,QAAQ,EAAE,MAAM,WAAW,YAAY,kBAAiB,CAAE,GAC7D,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,cAAMC,IAAW,IAAI;AACrB,QAAAA,EAAS,OAAO,SAASJ,EAAK,IAAI,GAClCK,EACG,KAAKd,GAAWa,GAAU,EAAE,EAC5B,KAAK,CAACE,MAAQ;AACb,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDO,EAAQI,EAAI,IAAI;AAAA,QACxB,CAAO,EACA,MAAM,MAAM;AACX,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDQ,EAAO,eAAe;AAAA,QAC9B,CAAO;AAAA,MACP,CAAG;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { ref as c, computed as I, openBlock as i, createElementBlock as E, createVNode as u, unref as o, normalizeClass as T, withModifiers as V, createSlots as P, withCtx as s, createBlock as f, createTextVNode as U, createElementVNode as g, toDisplayString as B } from "vue";
2
2
  import { ElUpload as D, ElIcon as z, ElButton as N, ElDialog as S, ElMessage as v } from "element-plus";
3
- import { _ as C, p as M, h as $ } from "./index-DXK7K7iB.js";
3
+ import { _ as C, p as M, h as $ } from "./index-Bq_Z8Hm7.js";
4
4
  import "./el-progress-l0sNRNKZ.js";
5
5
  const q = { class: "el-upload__tip" }, O = ["src"], R = {
6
6
  __name: "ImagesUploader",
@@ -138,4 +138,4 @@ const q = { class: "el-upload__tip" }, O = ["src"], R = {
138
138
  export {
139
139
  J as default
140
140
  };
141
- //# sourceMappingURL=ImagesUploader-DR1NdrIX.js.map
141
+ //# sourceMappingURL=ImagesUploader-D6-3HM_D.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImagesUploader-DR1NdrIX.js","sources":["../src/framework/field/images/ImagesUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElDialog, ElIcon, ElButton } from \"element-plus\";\nimport { computed, ref } from \"vue\";\nimport { ElMessage } from \"element-plus\";\nimport { Plus } from \"@element-plus/icons-vue\";\nimport http from \"../../utils/http\";\n\nconst emit = defineEmits([\"on-remove\", \"on-upload\"]);\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst props = defineProps({\n images: {\n type: Array,\n default() {\n return [];\n },\n },\n limit: { type: Number },\n props: {\n type: Object,\n default() {\n return {\n listType: \"picture-card\",\n limit: 5,\n accept: \"image/*\",\n tip: \"\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.images.map((item) => {\n if (!item?.url) {\n return { ...item, name: \"unknown\", fileType: \"unknown\" };\n }\n\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType,\n };\n return namedItem;\n });\n});\n\nfunction onRemove(uploadFile) {\n if (props.props.deleteParams) {\n const paramsData = props.props.deleteParams?.data\n ? props.props.deleteParams?.data\n : {};\n http\n .remove(\n `${props.props.deleteParams.url}/${uploadFile.id}/attachment`,\n paramsData,\n paramsData,\n )\n .then(() => {\n emit(\"on-remove\", uploadFile);\n });\n } else {\n emit(\"on-remove\", uploadFile);\n }\n}\n\nfunction onExceed() {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n}\n\nfunction onPreview(uploadFile) {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n}\n\nfunction beforeUpload(uploadFile) {\n const limitSize = 1024 * 1024 * 5;\n if (uploadFile.size > limitSize) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n\n return true;\n}\n\nfunction httpRequest(uploadFile) {\n const formData = new FormData();\n formData.append(\"file\", uploadFile.file);\n emit(\"on-upload\", formData);\n}\n</script>\n\n<template>\n <div>\n <el-upload\n :file-list=\"files\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"onRemove\"\n :on-exceed=\"onExceed\"\n :on-preview=\"onPreview\"\n :multiple=\"true\"\n :before-upload=\"beforeUpload\"\n :http-request=\"httpRequest\"\n :show-file-list=\"props.props.listType !== 'text'\"\n :class=\"[\n 'upload-main',\n { 'disable-upload': files.length >= props.props.limit },\n ]\"\n @click.prevent\n >\n <template v-if=\"props.props.listType !== 'text'\">\n <el-icon :disabled=\"true\">\n <Plus />\n </el-icon>\n </template>\n <template v-else>\n <el-button class=\"upload-button\" type=\"primary\"> 上传附件 </el-button>\n </template>\n <template v-if=\"props.props.tip\" #tip>\n <div class=\"el-upload__tip\">{{ props.props.tip }}</div>\n </template>\n </el-upload>\n <el-dialog v-model=\"dialogVisible\">\n <img w-full :src=\"dialogImageUrl\" alt=\"Preview Image\" />\n </el-dialog>\n </div>\n</template>\n<style scoped lang=\"scss\">\n:deep(.el-upload-list) {\n .el-upload-list__item-actions span {\n margin-left: 20px;\n }\n}\n\n.disable-upload {\n :deep(.el-upload--picture-card) {\n display: none !important;\n }\n\n :deep(.el-upload--text) {\n display: none !important;\n }\n\n :deep(.el-upload--picture) {\n display: none !important;\n }\n}\n.upload-main {\n flex-basis: 100%;\n}\n.file-list {\n display: flex;\n align-items: center;\n margin-top: 10px;\n .file-type {\n height: 22px;\n line-height: 22px;\n margin-right: 5px;\n background: #eeeeee;\n border-radius: 4px;\n font-size: 12px;\n padding: 0 4px;\n }\n :deep(.el-form-item__content) {\n display: contents;\n }\n :deep(.el-input__wrapper) {\n margin: 0 5px;\n }\n :deep(.el-input__inner) {\n height: 20px;\n line-height: 20px;\n }\n}\n</style>\n"],"names":["emit","__emit","dialogImageUrl","ref","dialogVisible","props","__props","files","computed","item","fileType","parts","onRemove","uploadFile","paramsData","_a","_b","http","onExceed","ElMessage","onPreview","beforeUpload","httpRequest","formData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAOC,GACPC,IAAiBC,EAAI,EAAE,GACvBC,IAAgBD,EAAI,EAAK,GACzBE,IAAQC,GAqBRC,IAAQC,EAAS,MACdH,EAAM,OAAO,IAAI,CAACI,MAAS;AAChC,UAAI,EAACA,KAAA,QAAAA,EAAM;AACT,eAAO,EAAE,GAAGA,GAAM,MAAM,WAA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;;;;;;;;;;"}
1
+ {"version":3,"file":"ImagesUploader-D6-3HM_D.js","sources":["../src/framework/field/images/ImagesUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElDialog, ElIcon, ElButton } from \"element-plus\";\nimport { computed, ref } from \"vue\";\nimport { ElMessage } from \"element-plus\";\nimport { Plus } from \"@element-plus/icons-vue\";\nimport http from \"../../utils/http\";\n\nconst emit = defineEmits([\"on-remove\", \"on-upload\"]);\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst props = defineProps({\n images: {\n type: Array,\n default() {\n return [];\n },\n },\n limit: { type: Number },\n props: {\n type: Object,\n default() {\n return {\n listType: \"picture-card\",\n limit: 5,\n accept: \"image/*\",\n tip: \"\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.images.map((item) => {\n if (!item?.url) {\n return { ...item, name: \"unknown\", fileType: \"unknown\" };\n }\n\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType,\n };\n return namedItem;\n });\n});\n\nfunction onRemove(uploadFile) {\n if (props.props.deleteParams) {\n const paramsData = props.props.deleteParams?.data\n ? props.props.deleteParams?.data\n : {};\n http\n .remove(\n `${props.props.deleteParams.url}/${uploadFile.id}/attachment`,\n paramsData,\n paramsData,\n )\n .then(() => {\n emit(\"on-remove\", uploadFile);\n });\n } else {\n emit(\"on-remove\", uploadFile);\n }\n}\n\nfunction onExceed() {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n}\n\nfunction onPreview(uploadFile) {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n}\n\nfunction beforeUpload(uploadFile) {\n const limitSize = 1024 * 1024 * 5;\n if (uploadFile.size > limitSize) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n\n return true;\n}\n\nfunction httpRequest(uploadFile) {\n const formData = new FormData();\n formData.append(\"file\", uploadFile.file);\n emit(\"on-upload\", formData);\n}\n</script>\n\n<template>\n <div>\n <el-upload\n :file-list=\"files\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"onRemove\"\n :on-exceed=\"onExceed\"\n :on-preview=\"onPreview\"\n :multiple=\"true\"\n :before-upload=\"beforeUpload\"\n :http-request=\"httpRequest\"\n :show-file-list=\"props.props.listType !== 'text'\"\n :class=\"[\n 'upload-main',\n { 'disable-upload': files.length >= props.props.limit },\n ]\"\n @click.prevent\n >\n <template v-if=\"props.props.listType !== 'text'\">\n <el-icon :disabled=\"true\">\n <Plus />\n </el-icon>\n </template>\n <template v-else>\n <el-button class=\"upload-button\" type=\"primary\"> 上传附件 </el-button>\n </template>\n <template v-if=\"props.props.tip\" #tip>\n <div class=\"el-upload__tip\">{{ props.props.tip }}</div>\n </template>\n </el-upload>\n <el-dialog v-model=\"dialogVisible\">\n <img w-full :src=\"dialogImageUrl\" alt=\"Preview Image\" />\n </el-dialog>\n </div>\n</template>\n<style scoped lang=\"scss\">\n:deep(.el-upload-list) {\n .el-upload-list__item-actions span {\n margin-left: 20px;\n }\n}\n\n.disable-upload {\n :deep(.el-upload--picture-card) {\n display: none !important;\n }\n\n :deep(.el-upload--text) {\n display: none !important;\n }\n\n :deep(.el-upload--picture) {\n display: none !important;\n }\n}\n.upload-main {\n flex-basis: 100%;\n}\n.file-list {\n display: flex;\n align-items: center;\n margin-top: 10px;\n .file-type {\n height: 22px;\n line-height: 22px;\n margin-right: 5px;\n background: #eeeeee;\n border-radius: 4px;\n font-size: 12px;\n padding: 0 4px;\n }\n :deep(.el-form-item__content) {\n display: contents;\n }\n :deep(.el-input__wrapper) {\n margin: 0 5px;\n }\n :deep(.el-input__inner) {\n height: 20px;\n line-height: 20px;\n }\n}\n</style>\n"],"names":["emit","__emit","dialogImageUrl","ref","dialogVisible","props","__props","files","computed","item","fileType","parts","onRemove","uploadFile","paramsData","_a","_b","http","onExceed","ElMessage","onPreview","beforeUpload","httpRequest","formData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAOC,GACPC,IAAiBC,EAAI,EAAE,GACvBC,IAAgBD,EAAI,EAAK,GACzBE,IAAQC,GAqBRC,IAAQC,EAAS,MACdH,EAAM,OAAO,IAAI,CAACI,MAAS;AAChC,UAAI,EAACA,KAAA,QAAAA,EAAM;AACT,eAAO,EAAE,GAAGA,GAAM,MAAM,WAAW,UAAU;AAG/C,YAAMC,IAAWD,EAAK,IAAI,UAAUA,EAAK,IAAI,YAAY,GAAG,IAAI,CAAC,GAC3DE,IAAQF,EAAK,IAAI,MAAM,GAAG;AAMhC,aALkB;AAAA,QAChB,GAAGA;AAAA,QACH,MAAME,EAAMA,EAAM,SAAS,CAAC;AAAA,QAC5B,UAAAD;AAAA,MACN;AAAA,IAEA,CAAG,CACF;AAED,aAASE,EAASC,GAAY;;AAC5B,UAAIR,EAAM,MAAM,cAAc;AAC5B,cAAMS,KAAaC,IAAAV,EAAM,MAAM,iBAAZ,QAAAU,EAA0B,QACzCC,IAAAX,EAAM,MAAM,iBAAZ,gBAAAW,EAA0B,OAC1B;AACJ,QAAAC,EACG;AAAA,UACC,GAAGZ,EAAM,MAAM,aAAa,GAAG,IAAIQ,EAAW,EAAE;AAAA,UAChDC;AAAA,UACAA;AAAA,QACD,EACA,KAAK,MAAM;AACV,UAAAd,EAAK,aAAaa,CAAU;AAAA,QACpC,CAAO;AAAA,MACP;AACI,QAAAb,EAAK,aAAaa,CAAU;AAAA,IAEhC;AAEA,aAASK,IAAW;AAClB,MAAAC,EAAU;AAAA,QACR,SAAS,UAAUd,EAAM,MAAM,KAAK;AAAA,QACpC,MAAM;AAAA,MACV,CAAG;AAAA,IACH;AAEA,aAASe,EAAUP,GAAY;AAC7B,MAAAX,EAAe,QAAQW,EAAW,KAClCT,EAAc,QAAQ;AAAA,IACxB;AAEA,aAASiB,EAAaR,GAAY;AAEhC,aAAIA,EAAW,OAAO,WACpBM,EAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,MACZ,CAAK,GACM,MAGF;AAAA,IACT;AAEA,aAASG,EAAYT,GAAY;AAC/B,YAAMU,IAAW,IAAI;AACrB,MAAAA,EAAS,OAAO,QAAQV,EAAW,IAAI,GACvCb,EAAK,aAAauB,CAAQ;AAAA,IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as rr, onMounted as ir, onBeforeUnmount as ar, ref as $n, watch as Pn, nextTick as Gn, h as or, computed as sr, openBlock as ur, createBlock as lr, unref as fr } from "vue";
2
2
  import * as rt from "quill";
3
3
  import Rn from "quill";
4
- import { o as W, r as cr, m as hr, j as dr } from "./index-DXK7K7iB.js";
4
+ import { o as W, r as cr, m as hr, j as dr } from "./index-Bq_Z8Hm7.js";
5
5
  import { ElMessage as Ln } from "element-plus";
6
6
  var ue = -1, re = 1, Z = 0;
7
7
  function at(r, a, n, u) {
@@ -1811,4 +1811,4 @@ const Wn = {
1811
1811
  export {
1812
1812
  Rr as default
1813
1813
  };
1814
- //# sourceMappingURL=RichTextEditor-M8WpX6JI.js.map
1814
+ //# sourceMappingURL=RichTextEditor-BL6xqftk.js.map