@cldemo/ui-kit 1.1.3 → 1.1.4
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/buildLibs/all/index.cjs +8 -8
- package/buildLibs/all/index.js +12157 -12048
- package/buildLibs/common/globalConfig.cjs +1 -1
- package/buildLibs/common/globalConfig.js +29 -15
- package/buildLibs/common/i18n/en.cjs +1 -1
- package/buildLibs/common/i18n/en.js +3 -1
- package/buildLibs/common/i18n/zh_CN.cjs +1 -1
- package/buildLibs/common/i18n/zh_CN.js +3 -1
- package/buildLibs/common/index.cjs +1 -1
- package/buildLibs/common/index.js +26 -24
- package/buildLibs/mobile/index.cjs +5 -5
- package/buildLibs/mobile/index.js +5902 -5852
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-CKoVf-v1.js → Index.vue_vue_type_script_setup_true_lang-88gNFuK4.js} +2 -2
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-BQXxDHbe.js +254 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-D0g1xGPL.js → Index.vue_vue_type_script_setup_true_lang-BR0S3Sfl.js} +3 -3
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-RRUPY9bd.js → Index.vue_vue_type_script_setup_true_lang-BrfAVhNV.js} +153 -145
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-DdLVG0R0.js → Index.vue_vue_type_script_setup_true_lang-Bw_jRoEX.js} +67 -59
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-C6Zd584S.js +2536 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-BOcOO9-n.js → Index.vue_vue_type_script_setup_true_lang-CD66oCaI.js} +386 -375
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-CEBiLDTm.js +310 -0
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-C0DgaU5I.js → Index.vue_vue_type_script_setup_true_lang-CRlBvcCg.js} +53 -47
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-DqZBB8fM.js → Index.vue_vue_type_script_setup_true_lang-CdYh3Pzs.js} +1 -1
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-XiSSYx4X.js → Index.vue_vue_type_script_setup_true_lang-D7YeNBdk.js} +120 -113
- package/buildLibs/{utils/Shared/Index.vue_vue_type_script_setup_true_lang-DKMVQrVU.js → modules/shared/Index.vue_vue_type_script_setup_true_lang-D9sq4n9i.js} +66 -60
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-CRKrLCa6.js → Index.vue_vue_type_script_setup_true_lang-DFeBj9IN.js} +209 -201
- package/buildLibs/modules/shared/{Index.vue_vue_type_script_setup_true_lang-D7bJ5UAn.js → Index.vue_vue_type_script_setup_true_lang-DY3tZQZe.js} +63 -55
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-D_73B6av.js +1533 -0
- package/buildLibs/modules/shared/{Validate.vue_vue_type_script_setup_true_lang-3s_3ut9M.js → Validate.vue_vue_type_script_setup_true_lang-hn1Tat7L.js} +102 -92
- package/buildLibs/types/All/index.d.ts +1 -1
- package/buildLibs/types/Common/globalConfig.d.ts +29 -0
- package/buildLibs/types/Common/globalTypes.d.ts +11 -0
- package/buildLibs/types/Common/i18n/en.d.ts +2 -0
- package/buildLibs/types/Common/i18n/zh_CN.d.ts +2 -0
- package/buildLibs/types/Common/index.d.ts +1 -1
- package/buildLibs/types/Element/CheckBox/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/Input/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputNumber/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputNumberStepper/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/InputTextarea/Index.vue.d.ts +9 -0
- package/buildLibs/types/Element/Radio/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/DateTime/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/FileUpload/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/Select/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectCascade/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectMove/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectTag/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/SelectTree/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/Tree/Index.vue.d.ts +9 -0
- package/buildLibs/types/Web/componentsInstalls.d.ts +90 -0
- package/buildLibs/utils/Element/ClCheckbox.cjs +1 -1
- package/buildLibs/utils/Element/ClCheckbox.js +1 -1
- package/buildLibs/utils/Element/ClInput.cjs +1 -1
- package/buildLibs/utils/Element/ClInput.js +1 -1
- package/buildLibs/utils/Element/ClInputCaptcha.cjs +1 -1
- package/buildLibs/utils/Element/ClInputCaptcha.js +1 -1
- package/buildLibs/utils/Element/ClInputNumber.cjs +1 -1
- package/buildLibs/utils/Element/ClInputNumber.js +1 -1
- package/buildLibs/utils/Element/ClInputNumberStepper.cjs +1 -1
- package/buildLibs/utils/Element/ClInputNumberStepper.js +1 -1
- package/buildLibs/utils/Element/ClInputPassword.cjs +1 -1
- package/buildLibs/utils/Element/ClInputPassword.js +1 -1
- package/buildLibs/utils/Element/ClInputSearch.cjs +1 -1
- package/buildLibs/utils/Element/ClInputSearch.js +1 -1
- package/buildLibs/utils/Element/ClInputTextarea.cjs +1 -1
- package/buildLibs/utils/Element/ClInputTextarea.js +1 -1
- package/buildLibs/utils/Element/ClRadio.cjs +1 -1
- package/buildLibs/utils/Element/ClRadio.js +1 -1
- package/buildLibs/utils/Element/__provide__/Validate.cjs +1 -1
- package/buildLibs/utils/Element/__provide__/Validate.js +13 -3
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-C1OgPpoJ.js → Index.vue_vue_type_script_setup_true_lang-0S6ab-Lp.js} +120 -113
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-neC9NxKi.js → Index.vue_vue_type_script_setup_true_lang-2Fe9SkjL.js} +209 -201
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-2THK822S.js +254 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-BO4cal3i.js → Index.vue_vue_type_script_setup_true_lang-2dwwjiTV.js} +386 -375
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-5itnjwU_.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-ChnRq_PS.js → Index.vue_vue_type_script_setup_true_lang-B0MJO0JM.js} +2 -2
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BIO6Me43.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BN9ybiKv.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BpG7AHvM.js +1 -0
- package/buildLibs/{modules/shared/Index.vue_vue_type_script_setup_true_lang-CAe8mhTl.js → utils/Shared/Index.vue_vue_type_script_setup_true_lang-CATwJnes.js} +66 -60
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CW4fM0by.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-DxYJbPyJ.js → Index.vue_vue_type_script_setup_true_lang-C_exHzjc.js} +3 -3
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CsCn637u.js +2 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-D_XMW7K4.js → Index.vue_vue_type_script_setup_true_lang-D4a5Iaue.js} +153 -145
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DXPZYc0c.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DY4m6Xyj.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DZCt32jb.js +1533 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DZF2gj7X.js +2536 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-De1eNjwC.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-C6Evk0-z.js → Index.vue_vue_type_script_setup_true_lang-DtAy8lm9.js} +53 -47
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DvN-fBNd.js +1 -0
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DwBf338f.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Cg_benGj.js → Index.vue_vue_type_script_setup_true_lang-F9tBnc_7.js} +63 -55
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-HfnOtuMz.js +310 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Dwkuei2j.js → Index.vue_vue_type_script_setup_true_lang-VjIva6RM.js} +1 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-j7gxlOeM.js +1 -0
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-CgdGs-U2.js → Index.vue_vue_type_script_setup_true_lang-lKDQFZtY.js} +67 -59
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-Dzm58mMQ.js → Index.vue_vue_type_script_setup_true_lang-nAMiORzN.js} +1 -1
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-CizRrQsH.js → Index.vue_vue_type_script_setup_true_lang-oovIcT38.js} +1 -1
- package/buildLibs/utils/Shared/{Index.vue_vue_type_script_setup_true_lang-BIFHYrzc.js → Index.vue_vue_type_script_setup_true_lang-qqnmaRnk.js} +1 -1
- package/buildLibs/utils/Web/ClColorPicker.cjs +1 -1
- package/buildLibs/utils/Web/ClColorPicker.js +1 -1
- package/buildLibs/utils/Web/ClCropperPreview.cjs +1 -1
- package/buildLibs/utils/Web/ClCropperPreview.js +1 -1
- package/buildLibs/utils/Web/ClDateTime.cjs +1 -1
- package/buildLibs/utils/Web/ClDateTime.js +1 -1
- package/buildLibs/utils/Web/ClFileUpload.cjs +1 -1
- package/buildLibs/utils/Web/ClFileUpload.js +1 -1
- package/buildLibs/utils/Web/ClInputTag.cjs +1 -1
- package/buildLibs/utils/Web/ClInputTag.js +1 -1
- package/buildLibs/utils/Web/ClPaginate.cjs +1 -1
- package/buildLibs/utils/Web/ClPaginate.js +1 -1
- package/buildLibs/utils/Web/ClSelect.cjs +1 -1
- package/buildLibs/utils/Web/ClSelect.js +1 -1
- package/buildLibs/utils/Web/ClSelectCascade.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectCascade.js +1 -1
- package/buildLibs/utils/Web/ClSelectMove.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectMove.js +655 -647
- package/buildLibs/utils/Web/ClSelectTag.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectTag.js +1 -1
- package/buildLibs/utils/Web/ClSelectTree.cjs +1 -1
- package/buildLibs/utils/Web/ClSelectTree.js +71 -63
- package/buildLibs/utils/Web/ClTable.cjs +1 -1
- package/buildLibs/utils/Web/ClTable.js +1 -1
- package/buildLibs/utils/Web/ClTree.cjs +1 -1
- package/buildLibs/utils/Web/ClTree.js +1 -1
- package/buildLibs/utils/Web/ClXEditable.cjs +1 -1
- package/buildLibs/utils/Web/ClXEditable.js +10 -10
- package/buildLibs/web/index.cjs +7 -7
- package/buildLibs/web/index.js +10792 -10685
- package/docs/components/Element/Checkbox.md +2 -1
- package/docs/components/Element/Form.md +15 -0
- package/docs/components/Element/Input.md +2 -1
- package/docs/components/Element/InputNumber.md +2 -1
- package/docs/components/Element/InputNumberStepper.md +2 -1
- package/docs/components/Element/InputTextarea.md +2 -1
- package/docs/components/Element/Radio.md +2 -1
- package/docs/components/Web/DateTime.md +2 -1
- package/docs/components/Web/FileUpload.md +2 -1
- package/docs/components/Web/Select.md +2 -1
- package/docs/components/Web/SelectCascade.md +1 -0
- package/docs/components/Web/SelectMove.md +2 -1
- package/docs/components/Web/SelectTag.md +1 -0
- package/docs/components/Web/SelectTree.md +2 -1
- package/docs/components/Web/Tree.md +2 -1
- package/package.json +1 -1
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-CiNidFJt.js +0 -246
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-DC6727pS.js +0 -2528
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-EXqjkKwS.js +0 -302
- package/buildLibs/modules/shared/Index.vue_vue_type_script_setup_true_lang-Hg16dgRQ.js +0 -1527
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-5aX79Fcf.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BRvOcf4B.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-Ba8Z8fOP.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-BjNP5odR.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CQ3RGLek.js +0 -302
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CY5fRV6o.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CYN4r-Mx.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-C_7ArHlU.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CuJjJvft.js +0 -2
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-CwjigRBx.js +0 -2528
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-D6cmq0Tf.js +0 -1527
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-Dbf-3Nik.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-DgD_gHit.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-FowII7_3.js +0 -1
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-c7oxeU_j.js +0 -246
- package/buildLibs/utils/Shared/Index.vue_vue_type_script_setup_true_lang-vLqCsSbV.js +0 -1
|
@@ -0,0 +1,1533 @@
|
|
|
1
|
+
import { reactive as ke, defineComponent as We, inject as Be, useTemplateRef as Se, computed as K, onMounted as Pe, nextTick as xe, watch as Fe, onBeforeUnmount as $e, openBlock as r, createElementBlock as m, normalizeClass as ve, createElementVNode as G, withModifiers as oe, unref as Z, createVNode as J, renderSlot as Ee, toDisplayString as Ue, Fragment as P, ref as ze, renderList as Le, createBlock as Ie, Transition as qe, withCtx as He, createCommentVNode as Ae, useAttrs as Je, provide as Ge } from "vue";
|
|
2
|
+
import e from "@cldemo/ui-kit/common/base";
|
|
3
|
+
import { getPlaintextOutText as Xe } from "@cldemo/ui-kit/common/globalConfig";
|
|
4
|
+
import Te from "@cldemo/ui-kit/common/Element";
|
|
5
|
+
import Ne from "@cldemo/ui-kit/common/log";
|
|
6
|
+
import { _ as Ke } from "./Index.vue_vue_type_script_setup_true_lang-zf_B20Aj.js";
|
|
7
|
+
import { _ as X } from "./Index.vue_vue_type_script_setup_true_lang-CIA-Kc0M.js";
|
|
8
|
+
import { a as je } from "./language-CZZEj4e3.js";
|
|
9
|
+
import { _ as Ze } from "./Index.vue_vue_type_script_setup_true_lang-6Rsz2dYw.js";
|
|
10
|
+
/* empty css */
|
|
11
|
+
const N = {
|
|
12
|
+
format: {
|
|
13
|
+
img: ["jpg", "jpe", "jpeg", "png", "gif", "bmp", "ico"],
|
|
14
|
+
video: [
|
|
15
|
+
"mp4",
|
|
16
|
+
"rmvb",
|
|
17
|
+
"3gp",
|
|
18
|
+
"avi",
|
|
19
|
+
"asf",
|
|
20
|
+
"asf",
|
|
21
|
+
"dv",
|
|
22
|
+
"mov",
|
|
23
|
+
"mpg4",
|
|
24
|
+
"mpeg",
|
|
25
|
+
"mpg",
|
|
26
|
+
"wm",
|
|
27
|
+
"wmx",
|
|
28
|
+
"flv",
|
|
29
|
+
"mkv",
|
|
30
|
+
"mp4a",
|
|
31
|
+
"rm",
|
|
32
|
+
"wmv",
|
|
33
|
+
"swf",
|
|
34
|
+
"swfl"
|
|
35
|
+
],
|
|
36
|
+
audio: ["mp3", "ogg", "wav", "wma", "mid", "ra", "ram"],
|
|
37
|
+
zip: ["rar", "zip"],
|
|
38
|
+
excel: ["xls", "xlsx", "csv"],
|
|
39
|
+
pdf: ["pdf"],
|
|
40
|
+
txt: ["txt"],
|
|
41
|
+
doc: ["doc", "docx"]
|
|
42
|
+
},
|
|
43
|
+
icon: {
|
|
44
|
+
img: "image",
|
|
45
|
+
video: "video",
|
|
46
|
+
audio: "music",
|
|
47
|
+
txt: "text",
|
|
48
|
+
zip: "zip",
|
|
49
|
+
excel: "excel",
|
|
50
|
+
pdf: "pdf",
|
|
51
|
+
doc: "word",
|
|
52
|
+
default: "file"
|
|
53
|
+
},
|
|
54
|
+
suffix: {
|
|
55
|
+
jpg: ["jpg", "jpe", "jpeg"],
|
|
56
|
+
jpe: ["jpg", "jpe", "jpeg"],
|
|
57
|
+
jpeg: ["jpg", "jpe", "jpeg"],
|
|
58
|
+
png: ["png"],
|
|
59
|
+
gif: ["gif"],
|
|
60
|
+
bmp: ["bmp"],
|
|
61
|
+
ico: ["ico"],
|
|
62
|
+
mp4: ["mp4"],
|
|
63
|
+
rmvb: ["rmvb"],
|
|
64
|
+
"3gp": ["3gp"],
|
|
65
|
+
avi: ["avi"],
|
|
66
|
+
asf: ["asf"],
|
|
67
|
+
dv: ["dv"],
|
|
68
|
+
mov: ["mov"],
|
|
69
|
+
mpg4: ["mpg4"],
|
|
70
|
+
mpeg: ["mpeg"],
|
|
71
|
+
mpg: ["mpg"],
|
|
72
|
+
wm: ["wm"],
|
|
73
|
+
wmx: ["wmx"],
|
|
74
|
+
flv: ["flv"],
|
|
75
|
+
mkv: ["mkv"],
|
|
76
|
+
mp4a: ["mp4a"],
|
|
77
|
+
rm: ["rm"],
|
|
78
|
+
wmv: ["wmv"],
|
|
79
|
+
swf: ["swf"],
|
|
80
|
+
swfl: ["swfl"],
|
|
81
|
+
mp3: ["mp3"],
|
|
82
|
+
ogg: ["ogg"],
|
|
83
|
+
wav: ["wav"],
|
|
84
|
+
wma: ["wma"],
|
|
85
|
+
mid: ["mid"],
|
|
86
|
+
ra: ["ra"],
|
|
87
|
+
ram: ["ram"],
|
|
88
|
+
rar: ["rar"],
|
|
89
|
+
zip: ["zip"],
|
|
90
|
+
txt: ["txt"],
|
|
91
|
+
xls: ["xls", "xlsx", "csv"],
|
|
92
|
+
xlsx: ["xls", "xlsx", "csv"],
|
|
93
|
+
csv: ["xls", "xlsx", "csv"],
|
|
94
|
+
pdf: ["pdf"],
|
|
95
|
+
doc: ["doc", "docx"]
|
|
96
|
+
},
|
|
97
|
+
mime: {
|
|
98
|
+
jpg: ["image/jpg", "image/jpeg", "image/pjpeg"],
|
|
99
|
+
jpe: ["image/jpg", "image/jpeg", "image/pjpeg"],
|
|
100
|
+
jpeg: ["image/jpg", "image/jpeg", "image/pjpeg"],
|
|
101
|
+
png: ["image/png", "image/x-png"],
|
|
102
|
+
gif: ["image/gif"],
|
|
103
|
+
bmp: ["image/bmp"],
|
|
104
|
+
ico: ["ico"],
|
|
105
|
+
mp4: ["video/mp4"],
|
|
106
|
+
rmvb: ["audio/x-pn-realaudio"],
|
|
107
|
+
"3gp": ["video/3gpp"],
|
|
108
|
+
avi: ["video/x-msvideo"],
|
|
109
|
+
asf: ["video/x-ms-asf"],
|
|
110
|
+
dv: ["video/x-dv"],
|
|
111
|
+
mov: ["video/quicktime"],
|
|
112
|
+
mpg4: ["video/mp4"],
|
|
113
|
+
mpeg: ["video/mpeg"],
|
|
114
|
+
mpg: ["video/mpeg"],
|
|
115
|
+
wm: ["video/x-ms-wmv"],
|
|
116
|
+
wmx: ["video/x-ms-wmx"],
|
|
117
|
+
flv: ["video/x-flv"],
|
|
118
|
+
mkv: ["video/x-matroska"],
|
|
119
|
+
mp4a: ["audio/mp4"],
|
|
120
|
+
rm: ["audio/x-pn-realaudio"],
|
|
121
|
+
wmv: ["audio/x-ms-wmv"],
|
|
122
|
+
swf: ["application/x-shockwave-flash"],
|
|
123
|
+
swfl: ["application/x-shockwave-flash"],
|
|
124
|
+
mp3: ["audio/mpeg"],
|
|
125
|
+
ogg: ["audio/ogg"],
|
|
126
|
+
wav: ["audio/wav"],
|
|
127
|
+
wma: ["audio/x-ms-wma"],
|
|
128
|
+
mid: ["audio/midi"],
|
|
129
|
+
ra: ["audio/x-pn-realaudio"],
|
|
130
|
+
ram: ["audio/x-pn-realaudio"],
|
|
131
|
+
rar: ["application/x-rar-compressed"],
|
|
132
|
+
zip: ["application/zip", "application/x-zip-compressed"],
|
|
133
|
+
txt: ["text/plain"],
|
|
134
|
+
xls: ["application/vnd.ms-excel", "application/wps-office.xls"],
|
|
135
|
+
xlsx: [
|
|
136
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
137
|
+
"application/wps-office.xlsx"
|
|
138
|
+
],
|
|
139
|
+
csv: ["text/csv"],
|
|
140
|
+
pdf: ["application/pdf"],
|
|
141
|
+
doc: ["application/msword"],
|
|
142
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"]
|
|
143
|
+
},
|
|
144
|
+
getFormatGroup: (i) => {
|
|
145
|
+
let g = [];
|
|
146
|
+
return e.isNonEmptyString(i) && (i.split(",").forEach((t) => {
|
|
147
|
+
for (const [y, O] of Object.entries(N.format))
|
|
148
|
+
e.isExistValue(O, t.toLocaleLowerCase()) && g.push(y);
|
|
149
|
+
}), g = e.getArrUnique(g)), g;
|
|
150
|
+
},
|
|
151
|
+
getIcon: (i) => {
|
|
152
|
+
let g = "";
|
|
153
|
+
return e.isEmpty(i) ? g = N.icon.default : g = e.isExistJsonKey(N.icon, i) ? N.icon[i] : N.icon.default, g;
|
|
154
|
+
},
|
|
155
|
+
getSuffix: (i) => {
|
|
156
|
+
let g = [];
|
|
157
|
+
return e.isEmpty(i) || (i.forEach((h) => {
|
|
158
|
+
const t = N.suffix[h.toLocaleLowerCase()];
|
|
159
|
+
e.isUndefined(t) || (g = g.concat(t));
|
|
160
|
+
}), e.isEmpty(g) && (g = i)), g = e.getArrUnique(g), g;
|
|
161
|
+
},
|
|
162
|
+
getRegexBySuffix: (i) => {
|
|
163
|
+
if (e.isEmpty(i))
|
|
164
|
+
return null;
|
|
165
|
+
const g = `\\.(?:${i.join("|")})$`;
|
|
166
|
+
return new RegExp(g, "i");
|
|
167
|
+
},
|
|
168
|
+
getMime: (i) => {
|
|
169
|
+
let g = [];
|
|
170
|
+
return e.isEmpty(i) || i.forEach((h) => {
|
|
171
|
+
const t = N.mime[h];
|
|
172
|
+
e.isUndefined(t) || (g = g.concat(t));
|
|
173
|
+
}), g = e.getArrUnique(g), g;
|
|
174
|
+
},
|
|
175
|
+
getRegexByMime: (i) => {
|
|
176
|
+
if (e.isEmpty(i))
|
|
177
|
+
return null;
|
|
178
|
+
const g = `^(?:${i.join("|").replace(/\//g, "\\/")})$`;
|
|
179
|
+
return new RegExp(g, "i");
|
|
180
|
+
},
|
|
181
|
+
getImageThumbnail: (i, g, h) => {
|
|
182
|
+
let t = null;
|
|
183
|
+
try {
|
|
184
|
+
const y = document.createElement("canvas");
|
|
185
|
+
y.width = g, y.height = h, y.getContext("2d").drawImage(i, 0, 0, i.width, i.height, 0, 0, g, h), t = y.toDataURL("image/gif");
|
|
186
|
+
} catch {
|
|
187
|
+
t = null;
|
|
188
|
+
}
|
|
189
|
+
return t;
|
|
190
|
+
}
|
|
191
|
+
}, _e = (i, g) => {
|
|
192
|
+
let h = i;
|
|
193
|
+
const t = ke({
|
|
194
|
+
mime: [],
|
|
195
|
+
suffix: [],
|
|
196
|
+
isCheckImgWH: !1
|
|
197
|
+
});
|
|
198
|
+
let y = null;
|
|
199
|
+
const O = (c) => {
|
|
200
|
+
h = e.getJsonMerge(h, c), D();
|
|
201
|
+
}, M = (c) => {
|
|
202
|
+
const f = h.checkMsg;
|
|
203
|
+
return e.isString(f) && !e.isEmpty(f) ? f : e.isObject(f) && !e.isEmpty(f[c]) ? f[c] : g.value[c];
|
|
204
|
+
}, D = () => {
|
|
205
|
+
const c = e.isNonEmptyString(h.checkFormat) ? N.getSuffix(h.checkFormat.split(",")) : [], f = N.getMime(c), w = !e.isEmpty(h.checkWidth) && !e.isEmpty(h.checkHeight);
|
|
206
|
+
t.mime = f, t.suffix = c, t.isCheckImgWH = w;
|
|
207
|
+
}, j = (c) => {
|
|
208
|
+
const f = N.getIcon(c);
|
|
209
|
+
return {
|
|
210
|
+
type: c,
|
|
211
|
+
icon: f,
|
|
212
|
+
isImage: c === "img",
|
|
213
|
+
isVideo: c === "video",
|
|
214
|
+
isAudio: c === "audio",
|
|
215
|
+
isTxt: c === "txt",
|
|
216
|
+
isZip: c === "zip"
|
|
217
|
+
};
|
|
218
|
+
}, R = (c, f) => {
|
|
219
|
+
if (e.isUndefined(y)) {
|
|
220
|
+
y = {};
|
|
221
|
+
for (const [a, o] of Object.entries(N.format)) {
|
|
222
|
+
const F = N.getSuffix(o), k = N.getMime(F), U = N.getRegexBySuffix(F), I = N.getRegexByMime(k);
|
|
223
|
+
y[a] = { suffix: F, mime: k, regSuffix: U, regMime: I };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
let w = "";
|
|
227
|
+
return Object.keys(y).forEach((a) => {
|
|
228
|
+
if (w.length === 0) {
|
|
229
|
+
const o = y[a];
|
|
230
|
+
(o.regSuffix && o.regSuffix.test(c) || f && o.regMime && o.regMime.test(f)) && (w = a);
|
|
231
|
+
}
|
|
232
|
+
}), j(w);
|
|
233
|
+
}, te = (c) => {
|
|
234
|
+
const f = N.getFormatGroup(
|
|
235
|
+
e.isEmpty(c) ? h.checkFormat : c
|
|
236
|
+
), w = f.length === 1 ? f[0] : "";
|
|
237
|
+
return j(w);
|
|
238
|
+
}, Q = (c) => {
|
|
239
|
+
if (!e.isString(c))
|
|
240
|
+
return R("");
|
|
241
|
+
if (c.startsWith("data:") || c.startsWith("blob:")) {
|
|
242
|
+
const w = c.match(/^[a-z]+:([a-zA-Z0-9.+-]+\/[a-zA-Z0-9.+-]+)/);
|
|
243
|
+
return R("", w ? w[1] : "");
|
|
244
|
+
}
|
|
245
|
+
const f = c.substring(c.lastIndexOf("/") + 1).split("?")[0].split("#")[0];
|
|
246
|
+
return R(f);
|
|
247
|
+
}, Y = (c, f, w, a, o) => {
|
|
248
|
+
const F = e.isFinite(w) && w > 0 ? w : 0, k = e.isFinite(a) && a > 0 ? a : 0;
|
|
249
|
+
let U = o;
|
|
250
|
+
(U === "height" || U === "contain") && k === 0 && (U = "width");
|
|
251
|
+
let I = 1;
|
|
252
|
+
switch (U) {
|
|
253
|
+
case "height":
|
|
254
|
+
I = k > 0 ? k / f : 1;
|
|
255
|
+
break;
|
|
256
|
+
case "contain":
|
|
257
|
+
I = Math.min(F > 0 ? F / c : 1, k > 0 ? k / f : 1);
|
|
258
|
+
break;
|
|
259
|
+
case "width":
|
|
260
|
+
default:
|
|
261
|
+
I = F > 0 ? F / c : 1;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
return I > 1 && (I = 1), { tw: Math.round(c * I), th: Math.round(f * I) };
|
|
265
|
+
}, ce = (c, f, w, a) => new Promise((o, F) => {
|
|
266
|
+
const k = document.createElement("img");
|
|
267
|
+
k.onload = (U) => {
|
|
268
|
+
const I = U.target.width, V = U.target.height, { tw: ee, th: $ } = Y(I, V, f, w, a), H = U.target.src;
|
|
269
|
+
o({ src: H, w: I, h: V, tw: ee, th: $, isImage: !0 });
|
|
270
|
+
}, k.onerror = () => {
|
|
271
|
+
F(new Error("fail: temp create image"));
|
|
272
|
+
}, k.src = c;
|
|
273
|
+
}), me = (c, f) => {
|
|
274
|
+
const w = e.isEmpty(h.checkWidth) ? 0 : parseInt(h.checkWidth, 10), a = e.isEmpty(h.checkHeight) ? 0 : parseInt(h.checkHeight, 10);
|
|
275
|
+
if (!e.isFinite(w) || !e.isFinite(a) || w === 0 || a === 0)
|
|
276
|
+
return !0;
|
|
277
|
+
let o = !0;
|
|
278
|
+
switch (h.checkWHType) {
|
|
279
|
+
case "greater":
|
|
280
|
+
o = c >= w && f >= a;
|
|
281
|
+
break;
|
|
282
|
+
case "less":
|
|
283
|
+
o = c <= w && f <= a;
|
|
284
|
+
break;
|
|
285
|
+
case "equal":
|
|
286
|
+
o = c === w && f === a;
|
|
287
|
+
break;
|
|
288
|
+
default:
|
|
289
|
+
o = !0;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
return o;
|
|
293
|
+
}, ue = (c, f) => new Promise((w, a) => {
|
|
294
|
+
if (c instanceof File) {
|
|
295
|
+
const o = new FileReader();
|
|
296
|
+
o.onload = (F) => {
|
|
297
|
+
ce(F.target.result, f.maxWidth, f.maxHeight, f.imgFit).then((k) => {
|
|
298
|
+
(t.isCheckImgWH ? me(k.w, k.h) : !0) ? w(k) : a(new Error(M("checkImageWHLabel")));
|
|
299
|
+
}).catch((k) => {
|
|
300
|
+
a(k);
|
|
301
|
+
});
|
|
302
|
+
}, o.onerror = () => {
|
|
303
|
+
a(new Error("fail: new FileReader image onload()"));
|
|
304
|
+
}, o.readAsDataURL(c);
|
|
305
|
+
} else
|
|
306
|
+
a(new Error("fail: file is not a File instance"));
|
|
307
|
+
}), ae = async (c, f) => {
|
|
308
|
+
let w = [];
|
|
309
|
+
const a = [], o = [], F = N.getRegexBySuffix(t.suffix), k = N.getRegexByMime(t.mime), U = ($) => {
|
|
310
|
+
const H = e.isEmpty($) ? NaN : parseInt($, 10);
|
|
311
|
+
return e.isFinite(H) ? H * 1024 : null;
|
|
312
|
+
}, I = U(h.checkMinSize), V = U(h.checkMaxSize), ee = c.length;
|
|
313
|
+
for (let $ = 0; $ < ee; $ += 1) {
|
|
314
|
+
const H = [], _ = c[$], L = { suffix: !1, mime: !1, size: !1 }, d = _.name;
|
|
315
|
+
F && !F.test(d) && (L.suffix = !0);
|
|
316
|
+
const b = _.type;
|
|
317
|
+
!e.isEmpty(b) && k && !k.test(b) && (L.mime = !0), I && _.size < I && (L.size = !0), V && _.size > V && (L.size = !0), (L.suffix || L.mime) && H.push(M("checkSuffixMimeLabel")), L.size && H.push(M("checkSizeLabel"));
|
|
318
|
+
const S = R(d, b);
|
|
319
|
+
let p = null;
|
|
320
|
+
S.isImage && (p = await ue(_, f).catch((C) => {
|
|
321
|
+
H.push(C.message);
|
|
322
|
+
})), e.isUndefined(p) && (p = {}), p = e.getJsonMerge(p, S), p.fileName = d, p.file = _, H.length === 0 ? (a.push(_), o.push(p)) : ee === 1 ? w = H.map((C) => `${M("uploadFile")} ${C}`) : w.push(`${d}:${H.join(",")}`);
|
|
323
|
+
}
|
|
324
|
+
return new Promise(($) => {
|
|
325
|
+
setTimeout(() => {
|
|
326
|
+
$({ errorMsg: w, passFiles: a, passFilesInfo: o, original: c });
|
|
327
|
+
}, 200);
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
return D(), {
|
|
331
|
+
optBase: t,
|
|
332
|
+
getTypeByFormat: te,
|
|
333
|
+
getTypeByUrl: Q,
|
|
334
|
+
createTempImg: ce,
|
|
335
|
+
checkFile: ae,
|
|
336
|
+
setBaseOptions: O
|
|
337
|
+
};
|
|
338
|
+
}, De = () => ({
|
|
339
|
+
setFileInfo: (g, h) => {
|
|
340
|
+
const t = h && h.fileUrl ? h.fileUrl : "";
|
|
341
|
+
if (!e.isString(t))
|
|
342
|
+
return { name: "", url: "", imgSrc: "", imgWidth: 0, imgHeight: 0 };
|
|
343
|
+
const y = e.isEmpty(t);
|
|
344
|
+
let O = "";
|
|
345
|
+
y || t.startsWith("blob:") ? O = g.fileName : O = t.substr(t.lastIndexOf("/") + 1);
|
|
346
|
+
let M = "", D = 0, j = 0;
|
|
347
|
+
return g.isImage && (M = y ? g.src : t, D = g.tw || 0, j = g.th || 0), { name: O, url: t, imgSrc: M, imgWidth: D, imgHeight: j };
|
|
348
|
+
}
|
|
349
|
+
}), Ve = () => {
|
|
350
|
+
const i = (h, t) => {
|
|
351
|
+
window.open(h);
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
downloadHref: i,
|
|
355
|
+
downloadBlob: (h) => {
|
|
356
|
+
if (!e.isEmpty(h)) {
|
|
357
|
+
const t = h.lastIndexOf("/"), y = h.substring(t + 1), O = h.replace(/\\/g, "/"), M = new XMLHttpRequest();
|
|
358
|
+
M.open("GET", O, !0), M.responseType = "blob", M.onload = () => {
|
|
359
|
+
if (M.status === 200) {
|
|
360
|
+
const D = window.URL || window.webkitURL || window, j = new Blob([M.response]), R = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
|
|
361
|
+
R.href = D.createObjectURL(j), R.download = y, R.click(), setTimeout(() => URL.revokeObjectURL(R.href), 1e3);
|
|
362
|
+
} else
|
|
363
|
+
i(h);
|
|
364
|
+
}, M.onerror = () => {
|
|
365
|
+
i(h);
|
|
366
|
+
}, M.send();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}, Qe = ["name", "accept"], Ye = ["name"], et = { class: "fileUpload-label" }, tt = {
|
|
371
|
+
key: 0,
|
|
372
|
+
class: "fileUpload-img"
|
|
373
|
+
}, it = { class: "fileUpload-img-container" }, nt = ["src", "width", "height"], lt = {
|
|
374
|
+
key: 0,
|
|
375
|
+
class: "file-complete-img-msg"
|
|
376
|
+
}, ot = ["title"], at = ["title"], st = {
|
|
377
|
+
key: 1,
|
|
378
|
+
class: "fileUpload-video"
|
|
379
|
+
}, ct = ["src"], rt = ["title"], mt = {
|
|
380
|
+
key: 2,
|
|
381
|
+
class: "fileUpload-file"
|
|
382
|
+
}, ut = ["title"], dt = {
|
|
383
|
+
key: 0,
|
|
384
|
+
class: "fileUpload-load"
|
|
385
|
+
}, pt = /* @__PURE__ */ We({
|
|
386
|
+
name: "ClFileUploadDefault",
|
|
387
|
+
__name: "Default",
|
|
388
|
+
props: {
|
|
389
|
+
name: String,
|
|
390
|
+
// desc: 文件上传 input 的 name
|
|
391
|
+
value: [String, Array, Object],
|
|
392
|
+
// desc: 文件值(回显 URL 或本地 File 对象;多选回传可为数组)
|
|
393
|
+
className: String,
|
|
394
|
+
// desc: 自定义CSS类名
|
|
395
|
+
disabled: {
|
|
396
|
+
type: Boolean,
|
|
397
|
+
default: !1
|
|
398
|
+
// desc: 是否禁用
|
|
399
|
+
},
|
|
400
|
+
defaultHoverTitle: String,
|
|
401
|
+
// desc: 默认悬停标题
|
|
402
|
+
defaultIcon: String,
|
|
403
|
+
// desc: 自定义初始显示图标(空态上传区),未设置时按 checkFormat 自动转换
|
|
404
|
+
checkFormat: String,
|
|
405
|
+
// desc: 允许的文件格式(逗号分隔扩展名)
|
|
406
|
+
checkMinSize: [String, Number],
|
|
407
|
+
// desc: 允许的最小文件大小
|
|
408
|
+
checkMaxSize: [String, Number],
|
|
409
|
+
// desc: 允许的最大文件大小
|
|
410
|
+
checkWidth: [String, Number],
|
|
411
|
+
// desc: 图片校验宽度
|
|
412
|
+
checkHeight: [String, Number],
|
|
413
|
+
// desc: 图片校验高度
|
|
414
|
+
checkWHType: {
|
|
415
|
+
type: String,
|
|
416
|
+
default: "equal",
|
|
417
|
+
// desc: 宽高比判定 | enum: equal, greater, less
|
|
418
|
+
validator: (i) => ["equal", "greater", "less"].includes(i)
|
|
419
|
+
},
|
|
420
|
+
imgFit: {
|
|
421
|
+
type: String,
|
|
422
|
+
default: "width",
|
|
423
|
+
// desc: 上传后图片显示尺寸的等比缩放方式(只缩不放) | enum: width, height, contain
|
|
424
|
+
validator: (i) => ["width", "height", "contain"].includes(i)
|
|
425
|
+
},
|
|
426
|
+
isServerCallback: Boolean,
|
|
427
|
+
// desc: 是否服务端回调
|
|
428
|
+
isShowPreview: {
|
|
429
|
+
type: Boolean,
|
|
430
|
+
default: !0
|
|
431
|
+
// desc: 是否显示预览
|
|
432
|
+
},
|
|
433
|
+
isShowDownload: {
|
|
434
|
+
type: Boolean,
|
|
435
|
+
default: !0
|
|
436
|
+
// desc: 是否显示下载
|
|
437
|
+
},
|
|
438
|
+
isShowCompleteMsg: {
|
|
439
|
+
type: Boolean,
|
|
440
|
+
default: !0
|
|
441
|
+
// desc: 是否显示上传完成后的底部信息条(黑色透明区域)
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
emits: ["onChange", "onError", "onRemove", "onPreview", "onSaveFile"],
|
|
445
|
+
setup(i, { expose: g, emit: h }) {
|
|
446
|
+
const t = i, y = h, { optPageLanguage: O, getPageLanguage: M } = je();
|
|
447
|
+
M("fileUpload");
|
|
448
|
+
const D = Be("$FileuploadTop", null);
|
|
449
|
+
D || Ne.warn("FileUpload", "Default 主题缺少 $FileuploadTop 注入,使用空校验配置");
|
|
450
|
+
const { setFileInfo: j } = De(), R = () => e.getJsonMerge(D?.getFileCheckInfo() ?? {}, {
|
|
451
|
+
checkFormat: t.checkFormat,
|
|
452
|
+
checkWidth: t.checkWidth,
|
|
453
|
+
checkHeight: t.checkHeight,
|
|
454
|
+
checkWHType: t.checkWHType,
|
|
455
|
+
checkMinSize: t.checkMinSize,
|
|
456
|
+
checkMaxSize: t.checkMaxSize
|
|
457
|
+
}), { optBase: te, getTypeByFormat: Q, getTypeByUrl: Y, createTempImg: ce, checkFile: me, setBaseOptions: ue } = _e(R(), O), { downloadBlob: ae, downloadHref: c } = Ve(), f = Se("refElTopParent"), w = () => {
|
|
458
|
+
const n = f.value;
|
|
459
|
+
if (!n)
|
|
460
|
+
return { maxWidth: 0, maxHeight: 0 };
|
|
461
|
+
const v = 4, W = n.clientWidth > 0 ? Math.max(n.clientWidth - v, 0) : 0;
|
|
462
|
+
let A = 0;
|
|
463
|
+
if (t.imgFit === "height" || t.imgFit === "contain") {
|
|
464
|
+
const q = n.parentElement;
|
|
465
|
+
q && q.clientHeight > 0 && (A = getComputedStyle(q).height === "auto" ? 0 : Math.max(q.clientHeight - v, 0));
|
|
466
|
+
}
|
|
467
|
+
return { maxWidth: W, maxHeight: A };
|
|
468
|
+
}, a = ke({
|
|
469
|
+
isImage: !1,
|
|
470
|
+
isVideo: !1,
|
|
471
|
+
icon: "",
|
|
472
|
+
completeMsgTxt: "",
|
|
473
|
+
isInitFileInput: !0,
|
|
474
|
+
runOperateType: "init"
|
|
475
|
+
}), o = ke({
|
|
476
|
+
name: "",
|
|
477
|
+
url: "",
|
|
478
|
+
imgSrc: "",
|
|
479
|
+
imgWidth: 0,
|
|
480
|
+
imgHeight: 0
|
|
481
|
+
}), F = {
|
|
482
|
+
file: null
|
|
483
|
+
};
|
|
484
|
+
let k = 0, U = null;
|
|
485
|
+
const I = `fileUpload_${e.getRandom(8)}`, V = K(() => {
|
|
486
|
+
let n = t.name;
|
|
487
|
+
return e.isEmpty(n) && (n = `fileUpload_${e.getRandom(8)}`), n;
|
|
488
|
+
}), ee = K(() => {
|
|
489
|
+
let n = {
|
|
490
|
+
"fileUpload-default": !0
|
|
491
|
+
};
|
|
492
|
+
return n = e.getJsonMerge(n, Te.getClassNameJson(t.className)), n;
|
|
493
|
+
}), $ = K(() => ({
|
|
494
|
+
"fileUpload-wait": !0,
|
|
495
|
+
"fileUpload-disabled": t.disabled
|
|
496
|
+
})), H = K(() => ({
|
|
497
|
+
"fileUpload-complete": !0,
|
|
498
|
+
"fileUpload-disabled": t.disabled
|
|
499
|
+
})), _ = (n) => {
|
|
500
|
+
y("onChange", n);
|
|
501
|
+
}, L = (n) => {
|
|
502
|
+
y("onError", n);
|
|
503
|
+
}, d = () => {
|
|
504
|
+
y("onRemove");
|
|
505
|
+
}, b = (n, v) => {
|
|
506
|
+
y("onPreview", n, v);
|
|
507
|
+
}, S = (n, v) => {
|
|
508
|
+
y("onSaveFile", n, v);
|
|
509
|
+
}, p = (n) => {
|
|
510
|
+
a.isImage = n.isImage, a.isVideo = n.isVideo, a.icon = n.icon;
|
|
511
|
+
}, C = () => {
|
|
512
|
+
const n = Q();
|
|
513
|
+
e.isNonEmptyString(t.defaultIcon) && (n.icon = t.defaultIcon), p(n);
|
|
514
|
+
}, E = (n) => {
|
|
515
|
+
n !== "load" && (a.isInitFileInput = !0);
|
|
516
|
+
let v = "";
|
|
517
|
+
switch (n) {
|
|
518
|
+
case "remove":
|
|
519
|
+
case "clean": {
|
|
520
|
+
v = "init", C();
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
case "fail": {
|
|
524
|
+
let W = !0;
|
|
525
|
+
a.isImage ? (!e.isEmpty(o.url) || !e.isEmpty(o.imgSrc)) && (W = !1) : e.isEmpty(o.url) || (W = !1), v = W ? "init" : "complete";
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
default:
|
|
529
|
+
v = n;
|
|
530
|
+
}
|
|
531
|
+
a.runOperateType = v;
|
|
532
|
+
}, z = (n) => {
|
|
533
|
+
const v = o;
|
|
534
|
+
for (const [W, A] of Object.entries(n))
|
|
535
|
+
e.isUndefined(v[W]) || (v[W] = A);
|
|
536
|
+
F.file = n.file ?? F.file;
|
|
537
|
+
}, ie = (n, v) => {
|
|
538
|
+
pe(), p(n);
|
|
539
|
+
const W = j(n, v);
|
|
540
|
+
z(W), E("complete");
|
|
541
|
+
}, re = () => {
|
|
542
|
+
let n = null;
|
|
543
|
+
return e.isString(o.url) && o.url.startsWith("blob:") ? n = F.file : e.isEmpty(o.url) ? a.isImage && !e.isEmpty(o.imgSrc) ? n = o.imgSrc : n = F.file : n = o.url, e.isUndefined(n) && (n = ""), n;
|
|
544
|
+
}, ye = (n) => {
|
|
545
|
+
if (n.length > 0 && a.runOperateType !== "load") {
|
|
546
|
+
a.isInitFileInput = !1, E("load"), k += 1;
|
|
547
|
+
const v = {
|
|
548
|
+
...w(),
|
|
549
|
+
imgFit: t.imgFit
|
|
550
|
+
};
|
|
551
|
+
me(n, v).then((W) => {
|
|
552
|
+
if (a.runOperateType === "load")
|
|
553
|
+
if (W.passFiles.length > 0) {
|
|
554
|
+
const A = W.passFiles[0], q = W.passFilesInfo[0];
|
|
555
|
+
if (q.isImage)
|
|
556
|
+
t.isServerCallback ? (S(A, q), we()) : (ie(q, {}), F.file = A, _(q.src));
|
|
557
|
+
else if (t.isServerCallback)
|
|
558
|
+
S(A, q), we();
|
|
559
|
+
else {
|
|
560
|
+
const he = {};
|
|
561
|
+
if (q.isVideo) {
|
|
562
|
+
const be = URL.createObjectURL(A);
|
|
563
|
+
he.fileUrl = be;
|
|
564
|
+
}
|
|
565
|
+
ie(q, he), F.file = A, _(A);
|
|
566
|
+
}
|
|
567
|
+
} else
|
|
568
|
+
E("fail"), W.errorMsg.length > 0 && L(W.errorMsg);
|
|
569
|
+
}).catch(() => {
|
|
570
|
+
a.runOperateType === "load" && (E("fail"), L(["文件校验失败,请重试"]));
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}, de = (n) => {
|
|
574
|
+
if (!e.isNonEmptyString(n)) {
|
|
575
|
+
(e.isString(n) || e.isUndefined(n)) && Me();
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const v = ++k, W = Y(n);
|
|
579
|
+
if (a.isImage && W.isImage) {
|
|
580
|
+
const { maxWidth: A, maxHeight: q } = w();
|
|
581
|
+
ce(n, A, q, t.imgFit).then((he) => {
|
|
582
|
+
if (v !== k)
|
|
583
|
+
return;
|
|
584
|
+
const be = e.getJsonMerge(he, W);
|
|
585
|
+
ie(be, { fileUrl: n });
|
|
586
|
+
}).catch(() => {
|
|
587
|
+
v === k && (E("fail"), L(["图片加载失败,请检查图片地址"]));
|
|
588
|
+
});
|
|
589
|
+
} else
|
|
590
|
+
ie(W, { fileUrl: n });
|
|
591
|
+
}, pe = () => {
|
|
592
|
+
e.isString(o.url) && o.url.startsWith("blob:") && URL.revokeObjectURL(o.url);
|
|
593
|
+
}, se = () => {
|
|
594
|
+
U && (clearTimeout(U), U = null);
|
|
595
|
+
}, we = () => {
|
|
596
|
+
se(), U = setTimeout(() => {
|
|
597
|
+
a.runOperateType === "load" && (E("fail"), L(["服务端保存超时,请重试"]));
|
|
598
|
+
}, 6e4);
|
|
599
|
+
}, Me = () => {
|
|
600
|
+
k += 1, F.file = null, z({ name: "", url: "", imgSrc: "", imgWidth: 0, imgHeight: 0 }), E("init");
|
|
601
|
+
}, fe = () => {
|
|
602
|
+
if (e.isEmpty(t.value)) {
|
|
603
|
+
C();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
p(Y(t.value));
|
|
607
|
+
}, Ce = () => {
|
|
608
|
+
let n = t.defaultHoverTitle;
|
|
609
|
+
a.isImage && te.isCheckImgWH && e.isEmpty(n) && (n = `${t.checkWidth}x${t.checkHeight}`), a.completeMsgTxt = n;
|
|
610
|
+
}, Oe = () => {
|
|
611
|
+
fe(), Ce(), de(t.value);
|
|
612
|
+
};
|
|
613
|
+
Pe(() => {
|
|
614
|
+
xe(() => {
|
|
615
|
+
Oe();
|
|
616
|
+
});
|
|
617
|
+
}), Fe(
|
|
618
|
+
() => t.value,
|
|
619
|
+
(n, v) => {
|
|
620
|
+
if (n !== v) {
|
|
621
|
+
const W = re();
|
|
622
|
+
n !== W && (se(), fe(), de(n));
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
), Fe(
|
|
626
|
+
[
|
|
627
|
+
() => t.checkFormat,
|
|
628
|
+
() => t.checkWidth,
|
|
629
|
+
() => t.checkHeight,
|
|
630
|
+
() => t.checkWHType,
|
|
631
|
+
() => t.checkMinSize,
|
|
632
|
+
() => t.checkMaxSize
|
|
633
|
+
],
|
|
634
|
+
() => {
|
|
635
|
+
if (se(), ue(R()), fe(), Ce(), a.runOperateType === "load")
|
|
636
|
+
return;
|
|
637
|
+
const n = re();
|
|
638
|
+
t.value === n && de(t.value);
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
const Re = (n) => {
|
|
642
|
+
n.preventDefault(), n.stopPropagation(), !t.disabled && n.dataTransfer && ye(n.dataTransfer.files);
|
|
643
|
+
}, l = (n) => {
|
|
644
|
+
t.disabled || ye(n.currentTarget.files);
|
|
645
|
+
}, s = () => {
|
|
646
|
+
se(), k += 1, pe(), F.file = null, z({ name: "", url: "", imgSrc: "", imgWidth: 0, imgHeight: 0 }), E("remove");
|
|
647
|
+
const n = document.getElementById(I);
|
|
648
|
+
n && (n.value = ""), d();
|
|
649
|
+
}, u = (n) => {
|
|
650
|
+
const v = e.isEmpty(o.url) ? o.imgSrc : o.url;
|
|
651
|
+
b(v, "image"), n.preventDefault(), n.stopPropagation();
|
|
652
|
+
}, T = (n) => {
|
|
653
|
+
e.isEmpty(o.url) || b(o.url, "video"), n.preventDefault(), n.stopPropagation();
|
|
654
|
+
}, x = (n) => {
|
|
655
|
+
e.isEmpty(o.url) ? c(o.imgSrc, o.name) : ae(o.url), n.preventDefault(), n.stopPropagation();
|
|
656
|
+
}, B = (n) => {
|
|
657
|
+
if (e.isString(o.url) && o.url.startsWith("blob:")) {
|
|
658
|
+
const v = document.createElement("a");
|
|
659
|
+
v.href = o.url, v.download = o.name, v.click();
|
|
660
|
+
} else
|
|
661
|
+
ae(o.url);
|
|
662
|
+
n.preventDefault(), n.stopPropagation();
|
|
663
|
+
};
|
|
664
|
+
return g({
|
|
665
|
+
saveServerCallback: (n) => {
|
|
666
|
+
if (se(), a.runOperateType !== "load")
|
|
667
|
+
return;
|
|
668
|
+
if (!n || !n.res || !e.isBoolean(n.res.success)) {
|
|
669
|
+
E("fail"), L(["文件保存失败,请重试"]);
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
if (!n.res.success) {
|
|
673
|
+
E("fail"), L(["文件保存失败,请重试"]);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
if (!n.req) {
|
|
677
|
+
E("fail"), L(["文件保存失败,请重试"]);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
let v = "";
|
|
681
|
+
if (e.isString(n.res.fileUrl) ? v = n.res.fileUrl : e.isArray(n.res.fileUrl) && n.res.fileUrl.length > 0 && e.isString(n.res.fileUrl[0]) && (v = n.res.fileUrl[0]), e.isEmpty(v)) {
|
|
682
|
+
F.file = null, z({ name: "", url: "", imgSrc: "", imgWidth: 0, imgHeight: 0 }), E("init");
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
ie(n.req, { fileUrl: v }), _(v);
|
|
686
|
+
},
|
|
687
|
+
getValue: () => re(),
|
|
688
|
+
cleanReduction: () => {
|
|
689
|
+
se(), k += 1, pe(), F.file = null, z({ name: "", url: "", imgSrc: "", imgWidth: 0, imgHeight: 0 }), E("clean");
|
|
690
|
+
}
|
|
691
|
+
}), $e(() => {
|
|
692
|
+
se(), pe();
|
|
693
|
+
}), (n, v) => (r(), m("div", {
|
|
694
|
+
class: ve(ee.value),
|
|
695
|
+
ref_key: "refElTopParent",
|
|
696
|
+
ref: f
|
|
697
|
+
}, [
|
|
698
|
+
G("div", {
|
|
699
|
+
class: "fileUpload-default-container",
|
|
700
|
+
onDrop: Re,
|
|
701
|
+
onDragover: v[0] || (v[0] = oe(() => {
|
|
702
|
+
}, ["prevent"]))
|
|
703
|
+
}, [
|
|
704
|
+
G("label", { for: I }, [
|
|
705
|
+
a.isInitFileInput && !i.disabled ? (r(), m("input", {
|
|
706
|
+
key: 0,
|
|
707
|
+
type: "file",
|
|
708
|
+
id: I,
|
|
709
|
+
name: V.value,
|
|
710
|
+
onChange: l,
|
|
711
|
+
accept: Z(te).mime.join(",")
|
|
712
|
+
}, null, 40, Qe)) : (r(), m("input", {
|
|
713
|
+
key: 1,
|
|
714
|
+
id: I,
|
|
715
|
+
name: V.value,
|
|
716
|
+
style: { display: "none !important" }
|
|
717
|
+
}, null, 8, Ye)),
|
|
718
|
+
a.runOperateType === "init" ? (r(), m("span", {
|
|
719
|
+
key: 2,
|
|
720
|
+
class: ve($.value)
|
|
721
|
+
}, [
|
|
722
|
+
J(X, {
|
|
723
|
+
name: a.icon,
|
|
724
|
+
class: "fileUpload-icon"
|
|
725
|
+
}, null, 8, ["name"]),
|
|
726
|
+
G("span", et, [
|
|
727
|
+
Ee(n.$slots, "label")
|
|
728
|
+
])
|
|
729
|
+
], 2)) : a.runOperateType === "complete" ? (r(), m("span", {
|
|
730
|
+
key: 3,
|
|
731
|
+
class: ve(H.value)
|
|
732
|
+
}, [
|
|
733
|
+
a.isImage ? (r(), m("span", tt, [
|
|
734
|
+
G("span", it, [
|
|
735
|
+
G("img", {
|
|
736
|
+
src: o.imgSrc,
|
|
737
|
+
width: o.imgWidth,
|
|
738
|
+
height: o.imgHeight
|
|
739
|
+
}, null, 8, nt)
|
|
740
|
+
]),
|
|
741
|
+
i.isShowCompleteMsg ? (r(), m("span", lt, Ue(a.completeMsgTxt), 1)) : (r(), m(P, { key: 1 }, [], 64)),
|
|
742
|
+
i.isShowPreview && !i.disabled ? (r(), m("i", {
|
|
743
|
+
key: 2,
|
|
744
|
+
class: "preview-icon",
|
|
745
|
+
title: Z(O).common.preview,
|
|
746
|
+
onClick: oe(u, ["stop"])
|
|
747
|
+
}, [
|
|
748
|
+
J(X, { name: "search-plus" })
|
|
749
|
+
], 8, ot)) : (r(), m(P, { key: 3 }, [], 64)),
|
|
750
|
+
i.isShowDownload && !i.disabled ? (r(), m("i", {
|
|
751
|
+
key: 4,
|
|
752
|
+
class: "download-icon",
|
|
753
|
+
title: Z(O).common.download,
|
|
754
|
+
onClick: oe(x, ["stop"])
|
|
755
|
+
}, [
|
|
756
|
+
J(X, { name: "download" })
|
|
757
|
+
], 8, at)) : (r(), m(P, { key: 5 }, [], 64))
|
|
758
|
+
])) : a.isVideo ? (r(), m("span", st, [
|
|
759
|
+
G("video", {
|
|
760
|
+
src: o.url
|
|
761
|
+
}, null, 8, ct),
|
|
762
|
+
i.isShowPreview && !i.disabled ? (r(), m("span", {
|
|
763
|
+
key: 0,
|
|
764
|
+
class: "preview-icon",
|
|
765
|
+
onClick: oe(T, ["stop"])
|
|
766
|
+
}, [
|
|
767
|
+
J(X, { name: "play" })
|
|
768
|
+
])) : (r(), m(P, { key: 1 }, [], 64)),
|
|
769
|
+
i.isShowDownload && !i.disabled ? (r(), m("i", {
|
|
770
|
+
key: 2,
|
|
771
|
+
class: "download-icon",
|
|
772
|
+
title: Z(O).common.download,
|
|
773
|
+
onClick: oe(B, ["stop"])
|
|
774
|
+
}, [
|
|
775
|
+
J(X, { name: "download" })
|
|
776
|
+
], 8, rt)) : (r(), m(P, { key: 3 }, [], 64))
|
|
777
|
+
])) : (r(), m("span", mt, [
|
|
778
|
+
J(X, {
|
|
779
|
+
name: a.icon,
|
|
780
|
+
class: "fileUpload-icon"
|
|
781
|
+
}, null, 8, ["name"]),
|
|
782
|
+
G("span", null, Ue(o.name), 1)
|
|
783
|
+
])),
|
|
784
|
+
i.disabled ? (r(), m(P, { key: 4 }, [], 64)) : (r(), m("a", {
|
|
785
|
+
key: 3,
|
|
786
|
+
class: "file-complete-remove",
|
|
787
|
+
href: "javascript:",
|
|
788
|
+
title: Z(O).common.delete,
|
|
789
|
+
onClick: oe(s, ["stop"])
|
|
790
|
+
}, [
|
|
791
|
+
J(X, { name: "close" })
|
|
792
|
+
], 8, ut))
|
|
793
|
+
], 2)) : (r(), m(P, { key: 4 }, [], 64))
|
|
794
|
+
])
|
|
795
|
+
], 32),
|
|
796
|
+
a.runOperateType === "load" ? (r(), m("div", dt, [
|
|
797
|
+
J(Ke, {
|
|
798
|
+
theme: "circleBubble",
|
|
799
|
+
size: "large"
|
|
800
|
+
})
|
|
801
|
+
])) : (r(), m(P, { key: 1 }, [], 64))
|
|
802
|
+
], 2));
|
|
803
|
+
}
|
|
804
|
+
}), gt = ["id", "name", "multiple", "accept"], ft = ["id", "name", "disabled", "accept"], ht = ["for"], vt = {
|
|
805
|
+
key: 0,
|
|
806
|
+
class: "fileUpload-list"
|
|
807
|
+
}, kt = {
|
|
808
|
+
key: 0,
|
|
809
|
+
class: "fileUpload-item-icon fileUpload-item-img"
|
|
810
|
+
}, St = ["src"], yt = ["title", "onClick"], wt = {
|
|
811
|
+
key: 1,
|
|
812
|
+
class: "fileUpload-item-icon fileUpload-item-video"
|
|
813
|
+
}, bt = ["src"], xt = ["onClick"], Ft = { class: "fileUpload-item-name" }, Et = { class: "fileUpload-item-operate" }, Ut = ["title", "onClick"], It = ["title", "onClick"], Tt = /* @__PURE__ */ We({
|
|
814
|
+
name: "ClFileUploadButton",
|
|
815
|
+
__name: "Button",
|
|
816
|
+
props: {
|
|
817
|
+
name: String,
|
|
818
|
+
// desc: 文件上传 input 的 name
|
|
819
|
+
value: [String, Array, Object],
|
|
820
|
+
// desc: 文件值(回显 URL 或本地 File 对象;多选回传可为数组)
|
|
821
|
+
className: String,
|
|
822
|
+
// desc: 自定义CSS类名
|
|
823
|
+
disabled: {
|
|
824
|
+
type: Boolean,
|
|
825
|
+
default: !1
|
|
826
|
+
// desc: 是否禁用
|
|
827
|
+
},
|
|
828
|
+
isMultiple: Boolean,
|
|
829
|
+
// desc: 是否多选
|
|
830
|
+
buttonClass: String,
|
|
831
|
+
// desc: 按钮自定义CSS类名
|
|
832
|
+
buttonLabel: String,
|
|
833
|
+
// desc: 按钮文案
|
|
834
|
+
buttonIcon: {
|
|
835
|
+
type: String,
|
|
836
|
+
default: ""
|
|
837
|
+
// desc: 按钮图标(内置图标名,透传 cl-icon-font 的 name,自动加 clIcon- 前缀)
|
|
838
|
+
},
|
|
839
|
+
buttonColor: {
|
|
840
|
+
type: String,
|
|
841
|
+
default: "default"
|
|
842
|
+
// desc: 按钮颜色 | enum: default, primary, success, info, warning, danger (可自定义)
|
|
843
|
+
},
|
|
844
|
+
checkFormat: String,
|
|
845
|
+
// desc: 允许的文件格式(逗号分隔扩展名)
|
|
846
|
+
checkMinSize: [String, Number],
|
|
847
|
+
// desc: 允许的最小文件大小
|
|
848
|
+
checkMaxSize: [String, Number],
|
|
849
|
+
// desc: 允许的最大文件大小
|
|
850
|
+
checkWidth: [String, Number],
|
|
851
|
+
// desc: 图片校验宽度
|
|
852
|
+
checkHeight: [String, Number],
|
|
853
|
+
// desc: 图片校验高度
|
|
854
|
+
checkWHType: {
|
|
855
|
+
type: String,
|
|
856
|
+
default: "equal",
|
|
857
|
+
// desc: 宽高比判定 | enum: equal, greater, less
|
|
858
|
+
validator: (i) => ["equal", "greater", "less"].includes(i)
|
|
859
|
+
},
|
|
860
|
+
isServerCallback: Boolean,
|
|
861
|
+
// desc: 是否服务端回调
|
|
862
|
+
isShowUploadResult: {
|
|
863
|
+
type: Boolean,
|
|
864
|
+
default: !0
|
|
865
|
+
// desc: 是否显示上传结果
|
|
866
|
+
},
|
|
867
|
+
isShowUploadIng: {
|
|
868
|
+
type: Boolean,
|
|
869
|
+
default: !0
|
|
870
|
+
// desc: 是否显示上传中状态
|
|
871
|
+
},
|
|
872
|
+
isShowPreview: {
|
|
873
|
+
type: Boolean,
|
|
874
|
+
default: !0
|
|
875
|
+
// desc: 是否显示预览
|
|
876
|
+
},
|
|
877
|
+
isShowDownload: {
|
|
878
|
+
type: Boolean,
|
|
879
|
+
default: !0
|
|
880
|
+
// desc: 是否显示下载
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
emits: ["onChange", "onError", "onRemove", "onPreview", "onSaveFile"],
|
|
884
|
+
setup(i, { expose: g, emit: h }) {
|
|
885
|
+
const t = i, y = h, O = `fileupload-${e.getRandom(5)}`, { optPageLanguage: M, getPageLanguage: D } = je();
|
|
886
|
+
D("fileUpload");
|
|
887
|
+
const j = Be("$FileuploadTop", null);
|
|
888
|
+
j || Ne.warn("FileUpload", "Button 主题缺少 $FileuploadTop 注入,使用空校验配置");
|
|
889
|
+
const R = () => e.getJsonMerge(j?.getFileCheckInfo() ?? {}, {
|
|
890
|
+
checkFormat: t.checkFormat,
|
|
891
|
+
checkWidth: t.checkWidth,
|
|
892
|
+
checkHeight: t.checkHeight,
|
|
893
|
+
checkWHType: t.checkWHType,
|
|
894
|
+
checkMinSize: t.checkMinSize,
|
|
895
|
+
checkMaxSize: t.checkMaxSize
|
|
896
|
+
}), { setFileInfo: te } = De(), { optBase: Q, getTypeByUrl: Y, checkFile: ce, setBaseOptions: me } = _e(
|
|
897
|
+
R(),
|
|
898
|
+
M
|
|
899
|
+
), { downloadBlob: ue, downloadHref: ae } = Ve(), c = Se("refElButton"), f = Se("refElLabel"), w = e.getRandom(8), a = ke({
|
|
900
|
+
elFileId: `btnFile${w}`,
|
|
901
|
+
isInitFileInput: !0
|
|
902
|
+
}), o = ze([]), F = ze([]);
|
|
903
|
+
let k = null, U = null, I = null;
|
|
904
|
+
const V = K(() => {
|
|
905
|
+
let l = t.name;
|
|
906
|
+
return e.isEmpty(l) && (l = `fileUpload_${e.getRandom(8)}`), l;
|
|
907
|
+
}), ee = K(() => {
|
|
908
|
+
let l = {
|
|
909
|
+
"fileUpload-button": !0
|
|
910
|
+
};
|
|
911
|
+
return l = e.getJsonMerge(l, Te.getClassNameJson(t.className)), l;
|
|
912
|
+
}), $ = (l, s) => {
|
|
913
|
+
y("onChange", l, s);
|
|
914
|
+
}, H = (l) => {
|
|
915
|
+
y("onError", l);
|
|
916
|
+
}, _ = () => {
|
|
917
|
+
y("onRemove");
|
|
918
|
+
}, L = (l, s, u) => {
|
|
919
|
+
y("onPreview", l, s, u);
|
|
920
|
+
}, d = (l, s) => {
|
|
921
|
+
y("onSaveFile", l, s);
|
|
922
|
+
}, b = () => {
|
|
923
|
+
S(), k = setTimeout(() => {
|
|
924
|
+
k = null, a.isInitFileInput || (C("fail"), H(["服务端保存超时,请重试"]));
|
|
925
|
+
}, 6e4);
|
|
926
|
+
}, S = () => {
|
|
927
|
+
k && (clearTimeout(k), k = null);
|
|
928
|
+
}, p = () => {
|
|
929
|
+
o.value.forEach((l) => {
|
|
930
|
+
e.isString(l.url) && l.url.startsWith("blob:") && URL.revokeObjectURL(l.url);
|
|
931
|
+
});
|
|
932
|
+
}, C = (l) => {
|
|
933
|
+
switch (l) {
|
|
934
|
+
case "load":
|
|
935
|
+
t.isShowUploadIng && c.value?.loadStart();
|
|
936
|
+
break;
|
|
937
|
+
case "fail":
|
|
938
|
+
case "complete":
|
|
939
|
+
t.isShowUploadIng && c.value?.loadStop();
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
a.isInitFileInput = l !== "load";
|
|
943
|
+
}, E = (l, s) => {
|
|
944
|
+
t.isMultiple || (p(), o.value = []);
|
|
945
|
+
const u = [], T = [];
|
|
946
|
+
o.value.forEach((x) => {
|
|
947
|
+
u.push(x), T.push(x.rId);
|
|
948
|
+
});
|
|
949
|
+
for (let x = 0; x < l.length; x++) {
|
|
950
|
+
let B = s.length > x ? { fileUrl: s[x] } : {};
|
|
951
|
+
e.isEmpty(B.fileUrl) && l[x].isVideo && l[x].file && (B = { fileUrl: URL.createObjectURL(l[x].file) });
|
|
952
|
+
let ne = te(l[x], B);
|
|
953
|
+
ne.rId = e.getRandom(9), ne = e.getJsonMerge(l[x], ne), u.push(ne), T.push(ne.rId);
|
|
954
|
+
}
|
|
955
|
+
o.value = u, C("complete"), xe(() => {
|
|
956
|
+
F.value = T;
|
|
957
|
+
});
|
|
958
|
+
}, z = () => {
|
|
959
|
+
const l = [];
|
|
960
|
+
return o.value.forEach((s) => {
|
|
961
|
+
let u = null;
|
|
962
|
+
e.isString(s.url) && s.url.startsWith("blob:") ? u = s.file : e.isEmpty(s.url) ? s.isImage && !e.isEmpty(s.imgSrc) ? u = s.imgSrc : u = s.file : u = s.url, e.isUndefined(u) || l.push(u);
|
|
963
|
+
}), l.length === 0 ? "" : t.isMultiple ? l : l[0];
|
|
964
|
+
}, ie = (l) => {
|
|
965
|
+
if (e.isArray(l)) {
|
|
966
|
+
p(), o.value = [];
|
|
967
|
+
const T = [], x = [];
|
|
968
|
+
l.forEach((B) => {
|
|
969
|
+
if (e.isNonEmptyString(B)) {
|
|
970
|
+
const ne = Y(B);
|
|
971
|
+
T.push(ne), x.push(B);
|
|
972
|
+
}
|
|
973
|
+
}), E(T, x);
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
if (!e.isNonEmptyString(l)) {
|
|
977
|
+
e.isString(l) && re();
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
p(), o.value = [];
|
|
981
|
+
const s = [], u = [];
|
|
982
|
+
l.split(",").filter((T) => e.isNonEmptyString(T)).forEach((T) => {
|
|
983
|
+
const x = Y(T);
|
|
984
|
+
s.push(x), u.push(T);
|
|
985
|
+
}), E(s, u);
|
|
986
|
+
}, re = () => {
|
|
987
|
+
p(), C("init"), o.value = [];
|
|
988
|
+
}, ye = () => {
|
|
989
|
+
ie(t.value);
|
|
990
|
+
};
|
|
991
|
+
Pe(() => {
|
|
992
|
+
xe(() => {
|
|
993
|
+
ye();
|
|
994
|
+
});
|
|
995
|
+
}), $e(() => {
|
|
996
|
+
S(), U && (clearTimeout(U), U = null), p();
|
|
997
|
+
}), Fe(
|
|
998
|
+
() => t.value,
|
|
999
|
+
(l, s) => {
|
|
1000
|
+
if (l !== s) {
|
|
1001
|
+
const u = z();
|
|
1002
|
+
l !== u && (S(), ie(l));
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
), Fe(
|
|
1006
|
+
[
|
|
1007
|
+
() => t.checkFormat,
|
|
1008
|
+
() => t.checkWidth,
|
|
1009
|
+
() => t.checkHeight,
|
|
1010
|
+
() => t.checkWHType,
|
|
1011
|
+
() => t.checkMinSize,
|
|
1012
|
+
() => t.checkMaxSize
|
|
1013
|
+
],
|
|
1014
|
+
() => {
|
|
1015
|
+
a.isInitFileInput && S(), me(R());
|
|
1016
|
+
}
|
|
1017
|
+
);
|
|
1018
|
+
const de = (l) => {
|
|
1019
|
+
t.disabled || a.isInitFileInput && l.currentTarget.files.length > 0 && (C("load"), ce(l.currentTarget.files, {}).then((s) => {
|
|
1020
|
+
if (!a.isInitFileInput) {
|
|
1021
|
+
if (s.passFiles.length > 0)
|
|
1022
|
+
if (t.isServerCallback) {
|
|
1023
|
+
const u = t.isMultiple ? s.passFiles : s.passFiles[0], T = t.isMultiple ? s.passFilesInfo : s.passFilesInfo[0];
|
|
1024
|
+
d(u, T), b();
|
|
1025
|
+
} else t.isMultiple ? (E(s.passFilesInfo, []), $(s.passFiles, s.passFilesInfo)) : (E(s.passFilesInfo, []), $(s.passFiles[0], s.passFilesInfo[0]));
|
|
1026
|
+
else s.errorMsg.length === 0 && (C("fail"), H(["文件校验失败,请重试"]));
|
|
1027
|
+
s.errorMsg.length > 0 && (H(s.errorMsg), s.passFiles.length === 0 && C("fail"));
|
|
1028
|
+
}
|
|
1029
|
+
}).catch(() => {
|
|
1030
|
+
a.isInitFileInput || (C("fail"), H(["文件校验失败,请重试"]));
|
|
1031
|
+
}));
|
|
1032
|
+
}, pe = (l, s) => {
|
|
1033
|
+
const u = e.isEmpty(l.url) ? l.src : l.url;
|
|
1034
|
+
L(u, "image", s);
|
|
1035
|
+
}, se = (l, s) => {
|
|
1036
|
+
e.isEmpty(l.url) || L(l.url, "video", s);
|
|
1037
|
+
}, we = (l) => {
|
|
1038
|
+
if (I === l)
|
|
1039
|
+
return;
|
|
1040
|
+
I = l, S(), a.isInitFileInput || C("complete");
|
|
1041
|
+
const s = o.value.find((B) => B.rId === l);
|
|
1042
|
+
s && e.isString(s.url) && s.url.startsWith("blob:") && URL.revokeObjectURL(s.url);
|
|
1043
|
+
const u = [], T = [];
|
|
1044
|
+
o.value.forEach((B) => {
|
|
1045
|
+
B.rId !== l && (u.push(B), T.push(B.rId));
|
|
1046
|
+
}), F.value = T;
|
|
1047
|
+
const x = document.getElementById(a.elFileId);
|
|
1048
|
+
x && (x.value = ""), xe(() => {
|
|
1049
|
+
u.length > 0 ? (o.value = u, I = null, _()) : U = setTimeout(() => {
|
|
1050
|
+
U = null, o.value = o.value.filter(
|
|
1051
|
+
(B) => B.rId !== l
|
|
1052
|
+
), I = null, _();
|
|
1053
|
+
}, 500);
|
|
1054
|
+
});
|
|
1055
|
+
}, Me = (l) => {
|
|
1056
|
+
if (l.isImage && e.isEmpty(l.url))
|
|
1057
|
+
ae(l.imgSrc, l.name);
|
|
1058
|
+
else if (e.isString(l.url) && l.url.startsWith("blob:")) {
|
|
1059
|
+
const s = document.createElement("a");
|
|
1060
|
+
s.href = l.url, s.download = l.name, s.click();
|
|
1061
|
+
} else if (e.isEmpty(l.url) && l.file) {
|
|
1062
|
+
const s = URL.createObjectURL(l.file), u = document.createElement("a");
|
|
1063
|
+
u.href = s, u.download = l.name, u.click(), setTimeout(() => {
|
|
1064
|
+
URL.revokeObjectURL(s);
|
|
1065
|
+
}, 1e3);
|
|
1066
|
+
} else
|
|
1067
|
+
ue(l.url);
|
|
1068
|
+
}, fe = () => {
|
|
1069
|
+
f.value?.click();
|
|
1070
|
+
};
|
|
1071
|
+
return g({
|
|
1072
|
+
saveServerCallback: (l) => {
|
|
1073
|
+
if (S(), !a.isInitFileInput) {
|
|
1074
|
+
if (e.isUndefined(l) || e.isUndefined(l.res) || !e.isBoolean(l.res.success) || e.isUndefined(l.req)) {
|
|
1075
|
+
C("fail"), H(["文件保存失败,请重试"]);
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
if (l.res.success) {
|
|
1079
|
+
let s = [];
|
|
1080
|
+
const u = [];
|
|
1081
|
+
if (e.isNonEmptyString(l.res.fileUrl) ? (s.push(l.res.fileUrl), u.push(0)) : e.isArray(l.res.fileUrl) && l.res.fileUrl.forEach((ge, le) => {
|
|
1082
|
+
e.isNonEmptyString(ge) && (s.push(ge), u.push(le));
|
|
1083
|
+
}), s.length === 0) {
|
|
1084
|
+
C("complete");
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
const T = t.isMultiple ? l.req : [l.req];
|
|
1088
|
+
let x = [], B = [];
|
|
1089
|
+
if (!t.isMultiple)
|
|
1090
|
+
x = s, B = T;
|
|
1091
|
+
else {
|
|
1092
|
+
const ge = o.value.map((le) => le.url).filter((le) => e.isNonEmptyString(le));
|
|
1093
|
+
s.forEach((le, n) => {
|
|
1094
|
+
const v = u[n];
|
|
1095
|
+
ge.indexOf(le) > -1 || e.isUndefined(T[v]) || (ge.push(le), x.push(le), B.push(T[v]));
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
if (x.length === 0) {
|
|
1099
|
+
C("complete");
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
E(B, x);
|
|
1103
|
+
const ne = t.isMultiple ? x : x[0];
|
|
1104
|
+
$(ne);
|
|
1105
|
+
} else
|
|
1106
|
+
C("fail"), H(["文件保存失败,请重试"]);
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
getValue: () => z(),
|
|
1110
|
+
cleanReduction: () => {
|
|
1111
|
+
S(), re();
|
|
1112
|
+
}
|
|
1113
|
+
}), (l, s) => (r(), m(P, null, [
|
|
1114
|
+
G("div", {
|
|
1115
|
+
class: ve(ee.value)
|
|
1116
|
+
}, [
|
|
1117
|
+
a.isInitFileInput && !i.disabled ? (r(), m("input", {
|
|
1118
|
+
key: 0,
|
|
1119
|
+
type: "file",
|
|
1120
|
+
id: a.elFileId,
|
|
1121
|
+
name: V.value,
|
|
1122
|
+
multiple: i.isMultiple,
|
|
1123
|
+
accept: Z(Q).mime.join(","),
|
|
1124
|
+
onChange: de
|
|
1125
|
+
}, null, 40, gt)) : (r(), m("input", {
|
|
1126
|
+
key: 1,
|
|
1127
|
+
id: a.elFileId,
|
|
1128
|
+
name: V.value,
|
|
1129
|
+
disabled: i.disabled,
|
|
1130
|
+
accept: Z(Q).mime.join(","),
|
|
1131
|
+
style: { display: "none !important" },
|
|
1132
|
+
onChange: de
|
|
1133
|
+
}, null, 40, ft)),
|
|
1134
|
+
G("label", {
|
|
1135
|
+
ref_key: "refElLabel",
|
|
1136
|
+
ref: f,
|
|
1137
|
+
for: a.elFileId
|
|
1138
|
+
}, [
|
|
1139
|
+
J(Ze, {
|
|
1140
|
+
ref_key: "refElButton",
|
|
1141
|
+
ref: c,
|
|
1142
|
+
className: i.buttonClass,
|
|
1143
|
+
isShowBackDrop: !0,
|
|
1144
|
+
disabled: i.disabled,
|
|
1145
|
+
label: i.buttonLabel || Z(M).common.upload,
|
|
1146
|
+
iconName: i.buttonIcon,
|
|
1147
|
+
color: i.buttonColor,
|
|
1148
|
+
onOnClick: fe
|
|
1149
|
+
}, null, 8, ["className", "disabled", "label", "iconName", "color"])
|
|
1150
|
+
], 8, ht)
|
|
1151
|
+
], 2),
|
|
1152
|
+
Ee(l.$slots, "label"),
|
|
1153
|
+
o.value.length > 0 && i.isShowUploadResult ? (r(), m("ul", vt, [
|
|
1154
|
+
(r(!0), m(P, null, Le(o.value, (u, T) => (r(), Ie(qe, {
|
|
1155
|
+
key: `${u.rId}-${T}`,
|
|
1156
|
+
name: "fileUploadButton",
|
|
1157
|
+
"enter-active-class": "fileupload-anim-in",
|
|
1158
|
+
"leave-active-class": "fileupload-anim-out"
|
|
1159
|
+
}, {
|
|
1160
|
+
default: He(() => [
|
|
1161
|
+
F.value.indexOf(u.rId) > -1 ? (r(), m("li", {
|
|
1162
|
+
key: `${O}-${u.rId}-${T}`,
|
|
1163
|
+
class: "fileUpload-item"
|
|
1164
|
+
}, [
|
|
1165
|
+
u.isImage ? (r(), m("span", kt, [
|
|
1166
|
+
G("img", {
|
|
1167
|
+
src: u.imgSrc
|
|
1168
|
+
}, null, 8, St),
|
|
1169
|
+
i.isShowPreview ? (r(), m("i", {
|
|
1170
|
+
key: 0,
|
|
1171
|
+
class: "preview-icon",
|
|
1172
|
+
title: Z(M).common.preview,
|
|
1173
|
+
onClick: oe((x) => pe(u, T), ["stop"])
|
|
1174
|
+
}, [
|
|
1175
|
+
J(X, { name: "search-plus" })
|
|
1176
|
+
], 8, yt)) : (r(), m(P, { key: 1 }, [], 64))
|
|
1177
|
+
])) : u.isVideo ? (r(), m("span", wt, [
|
|
1178
|
+
G("video", {
|
|
1179
|
+
src: u.url
|
|
1180
|
+
}, null, 8, bt),
|
|
1181
|
+
i.isShowPreview ? (r(), m("span", {
|
|
1182
|
+
key: 0,
|
|
1183
|
+
class: "preview-icon",
|
|
1184
|
+
onClick: oe((x) => se(u, T), ["stop"])
|
|
1185
|
+
}, [
|
|
1186
|
+
J(X, { name: "play" })
|
|
1187
|
+
], 8, xt)) : (r(), m(P, { key: 1 }, [], 64))
|
|
1188
|
+
])) : (r(), Ie(X, {
|
|
1189
|
+
key: 2,
|
|
1190
|
+
name: u.icon,
|
|
1191
|
+
class: "fileUpload-item-icon"
|
|
1192
|
+
}, null, 8, ["name"])),
|
|
1193
|
+
G("span", Ft, Ue(u.name), 1),
|
|
1194
|
+
G("span", Et, [
|
|
1195
|
+
i.isShowDownload ? (r(), m("i", {
|
|
1196
|
+
key: 0,
|
|
1197
|
+
class: "download-icon",
|
|
1198
|
+
title: Z(M).common.download,
|
|
1199
|
+
onClick: oe((x) => Me(u), ["stop"])
|
|
1200
|
+
}, [
|
|
1201
|
+
J(X, { name: "download" })
|
|
1202
|
+
], 8, Ut)) : (r(), m(P, { key: 1 }, [], 64)),
|
|
1203
|
+
i.disabled ? (r(), m(P, { key: 3 }, [], 64)) : (r(), m("a", {
|
|
1204
|
+
key: 2,
|
|
1205
|
+
class: "file-complete-remove",
|
|
1206
|
+
href: "javascript:",
|
|
1207
|
+
title: Z(M).common.delete,
|
|
1208
|
+
onClick: oe((x) => we(u.rId), ["stop"])
|
|
1209
|
+
}, [
|
|
1210
|
+
J(X, { name: "close" })
|
|
1211
|
+
], 8, It))
|
|
1212
|
+
])
|
|
1213
|
+
])) : Ae("", !0)
|
|
1214
|
+
]),
|
|
1215
|
+
_: 2
|
|
1216
|
+
}, 1024))), 128))
|
|
1217
|
+
])) : (r(), m(P, { key: 1 }, [], 64))
|
|
1218
|
+
], 64));
|
|
1219
|
+
}
|
|
1220
|
+
}), Mt = ["id"], Ct = {
|
|
1221
|
+
key: 0,
|
|
1222
|
+
class: "cl-plaintext-value"
|
|
1223
|
+
}, Ht = ["src", "alt"], Wt = ["src"], Bt = { key: 0 }, Vt = /* @__PURE__ */ We({
|
|
1224
|
+
name: "ClFileUpload",
|
|
1225
|
+
__name: "Index",
|
|
1226
|
+
props: {
|
|
1227
|
+
id: String,
|
|
1228
|
+
// desc: 组件唯一标识
|
|
1229
|
+
name: String,
|
|
1230
|
+
// desc: 文件上传 input 的 name
|
|
1231
|
+
value: [String, Array, Object],
|
|
1232
|
+
// desc: 文件值(回显 URL 或本地 File 对象;多选回传可为数组)
|
|
1233
|
+
className: String,
|
|
1234
|
+
// desc: 自定义CSS类名
|
|
1235
|
+
disabled: {
|
|
1236
|
+
type: Boolean,
|
|
1237
|
+
default: !1
|
|
1238
|
+
// desc: 是否禁用
|
|
1239
|
+
},
|
|
1240
|
+
theme: {
|
|
1241
|
+
type: String,
|
|
1242
|
+
default: "default",
|
|
1243
|
+
// desc: 主题 | enum: default, button
|
|
1244
|
+
validator: (i) => ["default", "button"].includes(i)
|
|
1245
|
+
},
|
|
1246
|
+
isMultiple: {
|
|
1247
|
+
type: Boolean,
|
|
1248
|
+
default: !1
|
|
1249
|
+
// desc: 是否多选(仅针对 theme:button)
|
|
1250
|
+
},
|
|
1251
|
+
defaultHoverTitle: String,
|
|
1252
|
+
// desc: 默认悬停标题
|
|
1253
|
+
defaultIcon: String,
|
|
1254
|
+
// desc: 自定义初始显示图标(theme:default 空态上传区),未设置时按 checkFormat 自动转换
|
|
1255
|
+
isShowCompleteMsg: {
|
|
1256
|
+
type: Boolean,
|
|
1257
|
+
default: !0
|
|
1258
|
+
// desc: 是否显示上传完成后的底部信息条(仅针对 theme:default 图片黑色透明区域)
|
|
1259
|
+
},
|
|
1260
|
+
buttonClass: String,
|
|
1261
|
+
// desc: 按钮模式自定义CSS类名
|
|
1262
|
+
buttonLabel: String,
|
|
1263
|
+
// desc: 按钮模式按钮文案
|
|
1264
|
+
buttonIcon: String,
|
|
1265
|
+
// desc: 按钮模式按钮图标(内置图标名,透传 cl-icon-font 的 name)
|
|
1266
|
+
buttonColor: String,
|
|
1267
|
+
// desc: 按钮模式按钮颜色
|
|
1268
|
+
checkFormat: String,
|
|
1269
|
+
// desc: 允许的文件格式(逗号分隔扩展名)
|
|
1270
|
+
checkMinSize: [String, Number],
|
|
1271
|
+
// desc: 允许的最小文件大小
|
|
1272
|
+
checkMaxSize: [String, Number],
|
|
1273
|
+
// desc: 允许的最大文件大小
|
|
1274
|
+
checkWidth: [String, Number],
|
|
1275
|
+
// desc: 图片校验宽度
|
|
1276
|
+
checkHeight: [String, Number],
|
|
1277
|
+
// desc: 图片校验高度
|
|
1278
|
+
checkWHType: {
|
|
1279
|
+
type: String,
|
|
1280
|
+
default: "equal"
|
|
1281
|
+
// desc: 宽高比判定 | enum: equal, greater, less
|
|
1282
|
+
},
|
|
1283
|
+
imgFit: {
|
|
1284
|
+
type: String,
|
|
1285
|
+
default: "width"
|
|
1286
|
+
// desc: 上传后图片显示尺寸的等比缩放方式(只缩不放) | enum: width, height, contain
|
|
1287
|
+
},
|
|
1288
|
+
isShowPreview: {
|
|
1289
|
+
type: Boolean,
|
|
1290
|
+
default: !0
|
|
1291
|
+
// desc: 是否显示预览
|
|
1292
|
+
},
|
|
1293
|
+
isShowDownload: {
|
|
1294
|
+
type: Boolean,
|
|
1295
|
+
default: !0
|
|
1296
|
+
// desc: 是否显示下载
|
|
1297
|
+
},
|
|
1298
|
+
isShowUploadResult: {
|
|
1299
|
+
type: Boolean,
|
|
1300
|
+
default: !0
|
|
1301
|
+
// desc: 是否显示上传结果(仅针对 theme:button)
|
|
1302
|
+
},
|
|
1303
|
+
isShowUploadIng: {
|
|
1304
|
+
type: Boolean,
|
|
1305
|
+
default: !0
|
|
1306
|
+
// desc: 是否显示上传中状态
|
|
1307
|
+
},
|
|
1308
|
+
serverFileCallback: Function,
|
|
1309
|
+
// desc: 服务端文件保存回调
|
|
1310
|
+
isPlaintext: {
|
|
1311
|
+
type: Boolean,
|
|
1312
|
+
default: !1
|
|
1313
|
+
// desc: 是否纯文本只读模式,图片渲染为 img、视频渲染为 video、其他渲染为文件名
|
|
1314
|
+
},
|
|
1315
|
+
plaintextEmptyText: {
|
|
1316
|
+
type: String,
|
|
1317
|
+
default: void 0
|
|
1318
|
+
// desc: 纯文本只读模式下值为空时的显示文本(默认 "-",显式传空串则显示空白;未显式传时依次读取组件配置段与 plaintextGlobal 段)
|
|
1319
|
+
},
|
|
1320
|
+
plaintextSeparator: {
|
|
1321
|
+
type: String,
|
|
1322
|
+
default: ","
|
|
1323
|
+
// desc: 纯文本模式下非媒体文件名之间的分隔符
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
emits: ["update:value", "update:modelValue", "onChange", "onRemove", "onError"],
|
|
1327
|
+
setup(i, { expose: g, emit: h }) {
|
|
1328
|
+
const t = i, y = h, O = Be("$ClGlobals", null), M = Je(), D = t.id, j = Se("refElFileDefault"), R = Se("refElFileButton");
|
|
1329
|
+
let te = 0, Q = 0;
|
|
1330
|
+
const Y = K(() => e.isFunction(t.serverFileCallback)), ce = ["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"], me = ["mp4", "webm", "ogg", "ogv", "mov", "avi", "mkv"], ue = (d) => {
|
|
1331
|
+
const b = d.split("?")[0].split("#")[0], S = b.split("/"), p = S.length > 0 ? S[S.length - 1] : b;
|
|
1332
|
+
return e.isEmpty(p) ? d : decodeURIComponent(p);
|
|
1333
|
+
}, ae = K(() => {
|
|
1334
|
+
const d = t.value, b = Array.isArray(d) ? d : e.isEmpty(d) ? [] : [d], S = [];
|
|
1335
|
+
return b.forEach((p) => {
|
|
1336
|
+
if (e.isString(p)) {
|
|
1337
|
+
e.isNonEmptyString(p) && S.push({ url: p, name: ue(p), type: "file" });
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
p && e.isNonEmptyString(p.name) && S.push({ url: "", name: p.name, type: "file" });
|
|
1341
|
+
}), S.map((p) => {
|
|
1342
|
+
if (e.isEmpty(p.url))
|
|
1343
|
+
return p;
|
|
1344
|
+
const C = p.name.lastIndexOf("."), E = C > -1 ? p.name.slice(C + 1).toLowerCase() : "";
|
|
1345
|
+
let z = "file";
|
|
1346
|
+
return ce.indexOf(E) > -1 ? z = "image" : me.indexOf(E) > -1 && (z = "video"), { ...p, type: z };
|
|
1347
|
+
});
|
|
1348
|
+
}), c = K(
|
|
1349
|
+
() => ae.value.filter((d) => d.type !== "file")
|
|
1350
|
+
), f = K(() => {
|
|
1351
|
+
const d = e.isString(t.plaintextSeparator) ? t.plaintextSeparator : ",";
|
|
1352
|
+
return ae.value.filter((b) => b.type === "file").map((b) => b.name).join(d);
|
|
1353
|
+
}), w = K(() => c.value.length > 0 ? f.value : Xe("fileUpload", t.plaintextEmptyText, f.value)), a = K(() => {
|
|
1354
|
+
let d = {
|
|
1355
|
+
"panel-file-upload": !0
|
|
1356
|
+
};
|
|
1357
|
+
return d = e.getJsonMerge(d, Te.getClassNameJson(t.className)), d;
|
|
1358
|
+
}), o = (d, b, S) => {
|
|
1359
|
+
y("update:value", d), y("update:modelValue", d), y("onChange", b, S);
|
|
1360
|
+
}, F = () => {
|
|
1361
|
+
y("onRemove");
|
|
1362
|
+
}, k = () => {
|
|
1363
|
+
let d = null;
|
|
1364
|
+
switch (t.theme) {
|
|
1365
|
+
case "default":
|
|
1366
|
+
d = j.value?.getValue();
|
|
1367
|
+
break;
|
|
1368
|
+
case "button":
|
|
1369
|
+
d = R.value?.getValue();
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
return d;
|
|
1373
|
+
}, U = (d, b) => {
|
|
1374
|
+
switch (d) {
|
|
1375
|
+
case "default":
|
|
1376
|
+
j.value?.saveServerCallback(b);
|
|
1377
|
+
break;
|
|
1378
|
+
case "button":
|
|
1379
|
+
R.value?.saveServerCallback(b);
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
}, I = (d, b) => {
|
|
1383
|
+
const S = k(), p = Y.value ? S : d;
|
|
1384
|
+
o(S, p, b);
|
|
1385
|
+
}, V = (d) => {
|
|
1386
|
+
e.isArray(d) && y("onError", d);
|
|
1387
|
+
}, ee = () => {
|
|
1388
|
+
Q += 1, F();
|
|
1389
|
+
const d = k();
|
|
1390
|
+
o(d, d);
|
|
1391
|
+
}, $ = async (d, b, S) => {
|
|
1392
|
+
const p = O?.preview;
|
|
1393
|
+
p && await p.show({
|
|
1394
|
+
type: b,
|
|
1395
|
+
src: d,
|
|
1396
|
+
showIndex: S ?? 0
|
|
1397
|
+
// Preview 消费端读取的字段是 showIndex(不是 showInx),字段名必须对齐
|
|
1398
|
+
});
|
|
1399
|
+
}, H = async (d, b) => {
|
|
1400
|
+
const S = t.theme, p = ++te, C = Q;
|
|
1401
|
+
let E = !0;
|
|
1402
|
+
if (t.serverFileCallback)
|
|
1403
|
+
try {
|
|
1404
|
+
const ie = !t.isMultiple && e.isObject(b) && e.isBoolean(b.isImage) ? b.isImage : !1, re = Te.getElementData(M);
|
|
1405
|
+
E = await t.serverFileCallback(d, ie, re);
|
|
1406
|
+
} catch {
|
|
1407
|
+
p === te && Q === C && t.theme === S && U(S, { req: b, res: { success: !1 } });
|
|
1408
|
+
return;
|
|
1409
|
+
}
|
|
1410
|
+
let z = {};
|
|
1411
|
+
if (e.isBoolean(E) ? z.success = E : e.isUndefined(E) ? z.success = !0 : e.isString(E) || e.isArray(E) ? (z.success = !0, z.fileUrl = E) : e.isObject(E) ? z = E : z.success = !1, t.theme !== S) {
|
|
1412
|
+
y("onError", ["保存期间主题已切换,本次保存结果未写入"]);
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
p !== te || Q !== C || U(S, { req: b, res: z });
|
|
1416
|
+
};
|
|
1417
|
+
return Ge(
|
|
1418
|
+
"$FileuploadTop",
|
|
1419
|
+
ke({
|
|
1420
|
+
getFileCheckInfo: () => ({
|
|
1421
|
+
checkFormat: t.checkFormat,
|
|
1422
|
+
checkWidth: t.checkWidth,
|
|
1423
|
+
checkHeight: t.checkHeight,
|
|
1424
|
+
checkWHType: t.checkWHType,
|
|
1425
|
+
checkMinSize: t.checkMinSize,
|
|
1426
|
+
checkMaxSize: t.checkMaxSize
|
|
1427
|
+
})
|
|
1428
|
+
})
|
|
1429
|
+
), g({
|
|
1430
|
+
getValue: () => k(),
|
|
1431
|
+
cleanReduction: () => {
|
|
1432
|
+
switch (t.theme) {
|
|
1433
|
+
case "default":
|
|
1434
|
+
j.value?.cleanReduction();
|
|
1435
|
+
break;
|
|
1436
|
+
case "button":
|
|
1437
|
+
R.value?.cleanReduction();
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
o("", "");
|
|
1441
|
+
}
|
|
1442
|
+
}), (d, b) => (r(), m("div", {
|
|
1443
|
+
class: ve(a.value),
|
|
1444
|
+
id: Z(D)
|
|
1445
|
+
}, [
|
|
1446
|
+
i.isPlaintext ? (r(), m("div", Ct, [
|
|
1447
|
+
(r(!0), m(P, null, Le(c.value, (S, p) => (r(), m(P, {
|
|
1448
|
+
key: `plain-${p}`
|
|
1449
|
+
}, [
|
|
1450
|
+
S.type === "image" ? (r(), m("img", {
|
|
1451
|
+
key: 0,
|
|
1452
|
+
src: S.url,
|
|
1453
|
+
alt: S.name,
|
|
1454
|
+
class: "cl-plaintext-media"
|
|
1455
|
+
}, null, 8, Ht)) : (r(), m("video", {
|
|
1456
|
+
key: 1,
|
|
1457
|
+
src: S.url,
|
|
1458
|
+
controls: "",
|
|
1459
|
+
class: "cl-plaintext-media"
|
|
1460
|
+
}, null, 8, Wt))
|
|
1461
|
+
], 64))), 128)),
|
|
1462
|
+
w.value ? (r(), m("span", Bt, Ue(w.value), 1)) : (r(), m(P, { key: 1 }, [], 64))
|
|
1463
|
+
])) : (r(), m(P, { key: 1 }, [], 64)),
|
|
1464
|
+
!i.isPlaintext && i.theme === "button" ? (r(), Ie(Tt, {
|
|
1465
|
+
key: 2,
|
|
1466
|
+
ref_key: "refElFileButton",
|
|
1467
|
+
ref: R,
|
|
1468
|
+
value: i.value,
|
|
1469
|
+
name: i.name,
|
|
1470
|
+
disabled: i.disabled,
|
|
1471
|
+
isMultiple: i.isMultiple,
|
|
1472
|
+
buttonClass: i.buttonClass,
|
|
1473
|
+
buttonLabel: i.buttonLabel,
|
|
1474
|
+
buttonIcon: i.buttonIcon,
|
|
1475
|
+
buttonColor: i.buttonColor,
|
|
1476
|
+
checkFormat: i.checkFormat,
|
|
1477
|
+
checkMinSize: i.checkMinSize,
|
|
1478
|
+
checkMaxSize: i.checkMaxSize,
|
|
1479
|
+
checkWidth: i.checkWidth,
|
|
1480
|
+
checkHeight: i.checkHeight,
|
|
1481
|
+
checkWHType: i.checkWHType,
|
|
1482
|
+
isServerCallback: Y.value,
|
|
1483
|
+
isShowUploadResult: i.isShowUploadResult,
|
|
1484
|
+
isShowUploadIng: i.isShowUploadIng,
|
|
1485
|
+
isShowPreview: i.isShowPreview,
|
|
1486
|
+
isShowDownload: i.isShowDownload,
|
|
1487
|
+
onOnChange: I,
|
|
1488
|
+
onOnError: V,
|
|
1489
|
+
onOnRemove: ee,
|
|
1490
|
+
onOnPreview: $,
|
|
1491
|
+
onOnSaveFile: H
|
|
1492
|
+
}, {
|
|
1493
|
+
label: He(() => [
|
|
1494
|
+
Ee(d.$slots, "label")
|
|
1495
|
+
]),
|
|
1496
|
+
_: 3
|
|
1497
|
+
}, 8, ["value", "name", "disabled", "isMultiple", "buttonClass", "buttonLabel", "buttonIcon", "buttonColor", "checkFormat", "checkMinSize", "checkMaxSize", "checkWidth", "checkHeight", "checkWHType", "isServerCallback", "isShowUploadResult", "isShowUploadIng", "isShowPreview", "isShowDownload"])) : !i.isPlaintext && i.theme === "default" ? (r(), Ie(pt, {
|
|
1498
|
+
key: 3,
|
|
1499
|
+
ref_key: "refElFileDefault",
|
|
1500
|
+
ref: j,
|
|
1501
|
+
value: i.value,
|
|
1502
|
+
name: i.name,
|
|
1503
|
+
disabled: i.disabled,
|
|
1504
|
+
defaultHoverTitle: i.defaultHoverTitle,
|
|
1505
|
+
defaultIcon: i.defaultIcon,
|
|
1506
|
+
isShowCompleteMsg: i.isShowCompleteMsg,
|
|
1507
|
+
checkFormat: i.checkFormat,
|
|
1508
|
+
checkMinSize: i.checkMinSize,
|
|
1509
|
+
checkMaxSize: i.checkMaxSize,
|
|
1510
|
+
checkWidth: i.checkWidth,
|
|
1511
|
+
checkHeight: i.checkHeight,
|
|
1512
|
+
checkWHType: i.checkWHType,
|
|
1513
|
+
imgFit: i.imgFit,
|
|
1514
|
+
isServerCallback: Y.value,
|
|
1515
|
+
isShowPreview: i.isShowPreview,
|
|
1516
|
+
isShowDownload: i.isShowDownload,
|
|
1517
|
+
onOnChange: I,
|
|
1518
|
+
onOnError: V,
|
|
1519
|
+
onOnRemove: ee,
|
|
1520
|
+
onOnPreview: $,
|
|
1521
|
+
onOnSaveFile: H
|
|
1522
|
+
}, {
|
|
1523
|
+
label: He(() => [
|
|
1524
|
+
Ee(d.$slots, "label")
|
|
1525
|
+
]),
|
|
1526
|
+
_: 3
|
|
1527
|
+
}, 8, ["value", "name", "disabled", "defaultHoverTitle", "defaultIcon", "isShowCompleteMsg", "checkFormat", "checkMinSize", "checkMaxSize", "checkWidth", "checkHeight", "checkWHType", "imgFit", "isServerCallback", "isShowPreview", "isShowDownload"])) : (r(), m(P, { key: 4 }, [], 64))
|
|
1528
|
+
], 10, Mt));
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
export {
|
|
1532
|
+
Vt as _
|
|
1533
|
+
};
|