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