@king-one/antdv 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/es/components/index.mjs +22 -18
- package/dist/es/components/plus-upload/apis/plus-upload.api.mjs +21 -0
- package/dist/es/components/plus-upload/hook/useExtractPlusUpload.mjs +55 -0
- package/dist/es/components/plus-upload/hook/usePlusUpload.mjs +23 -0
- package/dist/es/components/plus-upload/images/pdf-icon.png.mjs +4 -0
- package/dist/es/components/plus-upload/images/word-icon.png.mjs +4 -0
- package/dist/es/components/plus-upload/images/xls-icon.png.mjs +4 -0
- package/dist/es/components/plus-upload/index.mjs +9 -0
- package/dist/es/components/plus-upload/src/plus-upload.vue.mjs +4 -0
- package/dist/es/components/plus-upload/src/plus-upload.vue2.mjs +165 -0
- package/dist/es/components/plus-upload/src/types.mjs +25 -0
- package/dist/es/components/plus-upload/style/index.mjs +2 -0
- package/dist/es/components/pro-overlay/index.mjs +9 -0
- package/dist/es/components/pro-overlay/src/pro-overlay.vue.mjs +4 -0
- package/dist/es/components/pro-overlay/src/pro-overlay.vue2.mjs +34 -0
- package/dist/es/components/pro-overlay/style/index.mjs +2 -0
- package/dist/es/components/pro-upload/src/gd-upload.mjs +48 -43
- package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +1 -1
- package/dist/es/index.mjs +24 -20
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/components/plus-upload/apis/plus-upload.api.js +1 -0
- package/dist/lib/components/plus-upload/hook/useExtractPlusUpload.js +1 -0
- package/dist/lib/components/plus-upload/hook/usePlusUpload.js +1 -0
- package/dist/lib/components/plus-upload/images/pdf-icon.png.js +1 -0
- package/dist/lib/components/plus-upload/images/word-icon.png.js +1 -0
- package/dist/lib/components/plus-upload/images/xls-icon.png.js +1 -0
- package/dist/lib/components/plus-upload/index.js +1 -0
- package/dist/lib/components/plus-upload/src/plus-upload.vue.js +1 -0
- package/dist/lib/components/plus-upload/src/plus-upload.vue2.js +1 -0
- package/dist/lib/components/plus-upload/src/types.js +1 -0
- package/dist/lib/components/plus-upload/style/index.js +1 -0
- package/dist/lib/components/pro-overlay/index.js +1 -0
- package/dist/lib/components/pro-overlay/src/pro-overlay.vue.js +1 -0
- package/dist/lib/components/pro-overlay/src/pro-overlay.vue2.js +1 -0
- package/dist/lib/components/pro-overlay/style/index.js +1 -0
- package/dist/lib/components/pro-upload/src/gd-upload.js +1 -1
- package/dist/lib/components/pro-upload/src/hooks/useUpload.js +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/theme-chalk/fonts/iconfont.ttf +0 -0
- package/dist/theme-chalk/fonts/iconfont.woff +0 -0
- package/dist/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/dist/theme-chalk/fonts//345/275/222/346/241/243.zip +0 -0
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/plus-upload.css +1 -0
- package/dist/theme-chalk/pro-overlay.css +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/plus-upload/apis/plus-upload.api.d.ts +14 -0
- package/dist/types/components/plus-upload/hook/useExtractPlusUpload.d.ts +7 -0
- package/dist/types/components/plus-upload/hook/usePlusUpload.d.ts +6 -0
- package/dist/types/components/plus-upload/index.d.ts +169 -0
- package/dist/types/components/plus-upload/src/plus-upload.vue.d.ts +87 -0
- package/dist/types/components/plus-upload/src/types.d.ts +44 -0
- package/dist/types/components/pro-overlay/index.d.ts +21 -0
- package/dist/types/components/pro-overlay/src/pro-overlay.vue.d.ts +19 -0
- package/dist/types/components/pro-upload/src/hooks/useUpload.d.ts +1 -1
- package/dist/types/components/pro-upload/src/types.d.ts +4 -0
- package/global.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,31 +4,35 @@ import { KProModal as x } from "./pro-modal/index.mjs";
|
|
|
4
4
|
import { KProTitle as l } from "./pro-title/index.mjs";
|
|
5
5
|
import { KScrollBar as i } from "./scroll-bar/index.mjs";
|
|
6
6
|
import { KCoverScrollBar as n } from "./cover-scroll-bar/index.mjs";
|
|
7
|
-
import { KScaleVirtualList as
|
|
8
|
-
import { KProTag as
|
|
9
|
-
import { KProPicker as
|
|
10
|
-
import { KProArea as
|
|
11
|
-
import { KProSignature as
|
|
12
|
-
import { KProTable as
|
|
13
|
-
import { KIcon as
|
|
14
|
-
import { KProUpload as
|
|
15
|
-
import { KProContractView as
|
|
7
|
+
import { KScaleVirtualList as S } from "./scale-virtual-list/index.mjs";
|
|
8
|
+
import { KProTag as d } from "./pro-tag/index.mjs";
|
|
9
|
+
import { KProPicker as C } from "./pro-picker/index.mjs";
|
|
10
|
+
import { KProArea as v } from "./pro-area/index.mjs";
|
|
11
|
+
import { KProSignature as F } from "./pro-signature/index.mjs";
|
|
12
|
+
import { KProTable as U } from "./pro-table/index.mjs";
|
|
13
|
+
import { KIcon as b } from "./icon/index.mjs";
|
|
14
|
+
import { KProUpload as w } from "./pro-upload/index.mjs";
|
|
15
|
+
import { KProContractView as A } from "./pro-contract-view/index.mjs";
|
|
16
16
|
import "./pro-loading/index.mjs";
|
|
17
|
+
import { KPlusUpload as M } from "./plus-upload/index.mjs";
|
|
18
|
+
import { KProOverlay as h } from "./pro-overlay/index.mjs";
|
|
17
19
|
export {
|
|
18
20
|
K as KCollapseTranstion,
|
|
19
21
|
n as KCoverScrollBar,
|
|
20
22
|
t as KForm,
|
|
21
23
|
m as KFormItem,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
b as KIcon,
|
|
25
|
+
M as KPlusUpload,
|
|
26
|
+
v as KProArea,
|
|
27
|
+
A as KProContractView,
|
|
25
28
|
x as KProModal,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
h as KProOverlay,
|
|
30
|
+
C as KProPicker,
|
|
31
|
+
F as KProSignature,
|
|
32
|
+
U as KProTable,
|
|
33
|
+
d as KProTag,
|
|
30
34
|
l as KProTitle,
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
w as KProUpload,
|
|
36
|
+
S as KScaleVirtualList,
|
|
33
37
|
i as KScrollBar
|
|
34
38
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const o = {
|
|
2
|
+
// 获取文件上传的地址
|
|
3
|
+
getUploadUrl: (l) => globalThis.$http.get("/file/aio/upload/url", l),
|
|
4
|
+
// 文件上传
|
|
5
|
+
uploadFileApi: (l, t) => globalThis.$http.post(l, t, {
|
|
6
|
+
headers: {
|
|
7
|
+
"Content-Type": "multipart/form-data"
|
|
8
|
+
}
|
|
9
|
+
}),
|
|
10
|
+
// 删除文件
|
|
11
|
+
deleteFileApi: (l) => globalThis.$http.delete("/file/aio", l),
|
|
12
|
+
// 获取文件下载地址
|
|
13
|
+
getDownloadUrlApi: (l) => globalThis.$http.post("/file/aio/download/url", l),
|
|
14
|
+
// 下载文件
|
|
15
|
+
downloadFileApi: (l, t) => globalThis.$http.get(l, t),
|
|
16
|
+
// 获取文件详情
|
|
17
|
+
getFileDetailApi: (l) => globalThis.$http.post("/aio/batch/info", l)
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
o as plusUploadApis
|
|
21
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import s from "../images/pdf-icon.png.mjs";
|
|
2
|
+
import n from "../images/xls-icon.png.mjs";
|
|
3
|
+
import c from "../images/word-icon.png.mjs";
|
|
4
|
+
function f() {
|
|
5
|
+
const r = {
|
|
6
|
+
docx: [
|
|
7
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
8
|
+
"application/msword"
|
|
9
|
+
],
|
|
10
|
+
doc: [
|
|
11
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
12
|
+
"application/msword"
|
|
13
|
+
],
|
|
14
|
+
xls: [
|
|
15
|
+
"application/vnd.ms-excel",
|
|
16
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
17
|
+
],
|
|
18
|
+
xlsx: [
|
|
19
|
+
"application/vnd.ms-excel",
|
|
20
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
21
|
+
],
|
|
22
|
+
jpg: ["image/jpg"],
|
|
23
|
+
pdf: ["application/pdf"],
|
|
24
|
+
png: ["image/png"],
|
|
25
|
+
jpeg: ["image/jpeg"],
|
|
26
|
+
gif: ["image/gif"]
|
|
27
|
+
}, t = (e) => {
|
|
28
|
+
const o = e.split(".");
|
|
29
|
+
return o[o.length - 1];
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
getFileType: t,
|
|
33
|
+
getFileUrl: (e, o) => {
|
|
34
|
+
switch (t(e)) {
|
|
35
|
+
case "doc":
|
|
36
|
+
return c;
|
|
37
|
+
case "docx":
|
|
38
|
+
return c;
|
|
39
|
+
case "xls":
|
|
40
|
+
return n;
|
|
41
|
+
case "xlsx":
|
|
42
|
+
return n;
|
|
43
|
+
case "pdf":
|
|
44
|
+
return s;
|
|
45
|
+
default:
|
|
46
|
+
return o;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
hasPrivew: (e) => !(e === "doc" || e === "docx" || e === "xls" || e === "xlsx" || e === "pdf"),
|
|
50
|
+
AcceptValidates: r
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
f as useExtractPlusUpload
|
|
55
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { plusUploadApis as t } from "../apis/plus-upload.api.mjs";
|
|
2
|
+
function u() {
|
|
3
|
+
const r = async (a) => await t.getDownloadUrlApi(a);
|
|
4
|
+
return {
|
|
5
|
+
uploadFile: async (a, o) => {
|
|
6
|
+
const n = (await t.getUploadUrl({
|
|
7
|
+
params: { business: a }
|
|
8
|
+
})).data, i = new FormData();
|
|
9
|
+
i.append("file", o);
|
|
10
|
+
const { data: e } = await t.uploadFileApi(n, i), { data: s } = await r([e.id]);
|
|
11
|
+
return {
|
|
12
|
+
id: e.id,
|
|
13
|
+
url: s[e.id],
|
|
14
|
+
name: e.originName
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
getImgUrl: r,
|
|
18
|
+
removeFile: async (a) => (await t.deleteFileApi({ params: { fileId: a } }), !0)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
u as usePlusUpload
|
|
23
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const A = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAAXNSR0IArs4c6QAAAZJQTFRFAAAA/4CA5k1N6FFR7VJS7VFR50xM7VFR7lBQ7E9P7U9P40RE7k9P7lFR7FBQ3D093T097VBQ7lFR7VBQ7VFR7VBQ5ERE7VBQ1DAw1jMz2DU13j093z4+3z8/40ND5ERE50hI6ElJ605O7U9P7VBQ7VFR7VNT7VRU7lVV7lZW7ldX7lhY7lpa7ltb7l5e72Bg72Ji72Nj72Vl8Glp8Gtr8G5u8HFx8XJy8XNz8XR08XZ28Xd38Xl58Xt78n5+8n9/8oGB8oSE84aG84iI84mJ84qK84uL846O9JCQ9JKS9JWV9JeX9JiY9Zyc9aGh9aKi9qWl9qam9qen9qmp9qur962t97Gx97S0+La2+Li4+Lu7+Ly8+L29+cDA+cPD+cXF+cfH+cjI+cnJ+szM+tDQ+tHR+tLS+9TU+9XV+9fX+9nZ+9zc+93d/N3d/N7e/N/f/OHh/OLi/OPj/OTk/OXl/Obm/enp/erq/ezs/e/v/vHx/vX1/vb2/vf3/vj4/vn5/vr6//r6//z8//39//7+////fqc24AAAABh0Uk5TAAIKFjg5QEhJUWRlZ3h5pqaqscjk5f7+s+mK+gAAAeRJREFUWMPt2ElTE0Ech2HCIovsoMSdpRNAIBgVQRGVRVkUFMQ9CCoQjBu4E4ziOO/39qZoQqan+18Uh3mPc3guPVXd9SsoCNr3FRWXlnl1QJ8rb2hS3h2u1eQK65RWp8J6Yqhe6YJ6YqXSB3XE0CE/oIZYonyB3mKFT9BTrPILeonVvsFwjTSYXzQB84pGYD7RDMwjGoK7i6bgrqI+2BzWEvXBtqNaoj6oWo7oiD5A1XryxLGdHT9oCWZVHYB7Dg7OjEYkwXEXHkmCn/iCExMEf3EDLgmCX7mc4aoguMKcS58gOEsaugTBc8B70f8wBQ9FweswLgoOwVpEEkwAtwTBrgzw7awcOIGThHfdYuAqCz0fYa1TCByAfnV+C15M3U2srr+8F7MEl0gqpYb502bMCuxzGVFnpp4DkHk2+8Rl0gp8ijP/hu3lmQtD68BW2mXQAozfd+Hn4nCnUkpFp5Pb4DyIGIPxxw68vtnz90v7wMVu41OO3vkBfD4tdev1puA7XJO6RqNvydxOkxC7l6/AwiapDjEw7gKvegVfDmMbH+bbg9dXAAag4YiRoyqrmSVHFVZDUI5Kck1VjeZeY8hqTMuu0m7uy6o+ZDdI/l9doeVk+k9NDeXWo+6OSouLgiF8//cbrfdfjbEnmicAAAAASUVORK5CYII=";
|
|
2
|
+
export {
|
|
3
|
+
A as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const A = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAAXNSR0IArs4c6QAAAUFQTFRFAAAAgID/TZnmRpfcSZbbSJjbSJPXSpjYSZbZSJfZSpbZSZLUSJfaSJfZSpjZS4nRSpjaSZfaSZbZSZfZSZfZSZfZSo/USZLWSZbYSZbZSZfZSorQSorRSovRSo7TSo7USo/TSpLWSpfZSpjZS4DLS4LMS4PNTZnaT5raU53bVJ3bVZ7cVp7cWaDcW6HdXKLdXqPdZqffaKngaangaqrgcq7hcq/idbDigLbkgrjlibvmibvni73njL3njL7njr7nj7/okMDokcDoksHpl8PpmMTpmsXqncfqosrrosrso8rspsztrM/trdDurtHus9TvttXwudfwxN3zxN7zyeDzyeD0zuP10OT10eT12en32+r32+v43Ov43ez45/H65/L67PT77vb87/X88Pb88ff88/j89/v9+fz+/P3+/v7/////pdH5rwAAABd0Uk5TAAIKFjg5QEhJUWRlZ3h5pqqxyOTl/v6Y+Q+ZAAACNElEQVRYw+3YWVMTQRiFYcIiggRZxOW4kyg7hMUEFAVlh1E2BUJYogGSvP//B3gxCUYTk57uG6rIuepvqvLUdE+6u+praKjnxqepufVurdwx59p6+lQ7D+8bco1dMsqrqJkY6pYpaCZ2yBw0EUMPgoAGYosCgbXF9oBgTTEcFKwldgYGa4gWYHXRBqwqWoHVRDuwimgJ/l80B19EjURz8FHUSDQHH781Es1BvX5jIgYA9eTl82eleXrPESxLZx2sg7cUHEun08nKv06m0+mx4G94DMxU8maAY4sprwObhXH/l6Wlz/2FYhNYtwCngJPCOAGQKBQnwJTNRzkDYv5wB2DHH8eAM6uv/A1YkSQNXAJcDkiSVoCvVmACOJIkzQHAnCTpqGT2wcBIBnKjkrTng3uSNJqDTMTuj70LzEsazsLFBWSHJc0Du5Y7ZRbYl7QIbG8Di5L2gVlLcPAKrgb9VYvH/RUtPrPby/7bTOThXDqH/MT1W9uB/nqtAVvSFrB2va524EgOMpFTYFKaBE4jGciN2B9fh8AnICVJKeAjcOhwHi4DSWBVklYLxbIDGANykB+XpPE85P7sb7sTOwXAgV8cQHH61uAGAAt+sQDAhhM4DZAd8ouhLMC02yX1E/heLH4AvxxvvQ+e570rFnHP897XL/o6eLvBsAsYdmqzVEi7UyOoQloqtap67b3ekFMzrTwdbu2+snSH3BqS/6ar0bFl+lf6etqcm7olaW1uqjfCb35+A7DU9hhMVFm4AAAAAElFTkSuQmCC";
|
|
2
|
+
export {
|
|
3
|
+
A as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const A = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAAXNSR0IArs4c6QAAANVQTFRFAAAAgP+ATcyAUcWATcSATMV9SL98TsOATcR+T8N+T8SASbt3T8R+T8N/TsR+RLJyRLRyTsWATsR/TsSATsSATsR/SLp3TsSAPahpP6trP6xsRLRyRbRzRbVzR7l3R7p2SLl3Sr56TcJ+TsN+TsR/T8SAUcWBUcWCUsWCU8aDX8qLYsuOas2TbM6VcM+YcdCZc9CadtGcd9Kdmd21nN63n9+6oeC7xezVxuzWye3Yyu3Yyu3ZzO7aze7b3vTn5/fu6Pfu6vjw8/v29fz39vz49/z5////oSQCEgAAABh0Uk5TAAIKFjg5QEhJUWRlZ3h5pqaqscjk5f7+s+mK+gAAAZdJREFUWMPt2NlSwjAUBmDKIoKAsih1Fw20KLK54m7FvP8jyWKnTZfknBwuYKb/XXvxTTM5aTt/KpVk7ZPJ5rdV2YJzhXqTqXOwB+TSVQbKmQkTjRqDgjCxxOAgRDT2MSBAzDEUqBaLSFAplrGgSqygQXN31aBc1AGlohYoE/VAiagJxotw8MIEiXCwZYJEOHh1BBLhIGsdQkQEyC7PT4/9OdkhgqFUEjABNwnsPHbFG/aDRQE7T/xNEO0X/mzpgzOPC+LM45EiEOz9cEG0X+fX01v9JQ8FcfF8fDqibIpflHiIsfFEmYeZQ1dsyzzUYLvivcTDnRRPjPWQR88V70arOsvDwDxSQet6Kb53VwNak88blYgBrQnnShEBzj3OP9pyEQ4uvd+xuzMxIhj0PLkIBf2eVASCoicToS9YR/D+Raenv+SBI3gL0elTNmXwPQ6cwq8+bWzs0Icr+RVJwI0CyxSwTKpZIlIkFUERyUVVVQ19r2GQyrRwSrS6L5SaQSskg6mmiZWpkGa9QC51fclnM0kRvv75A85oP1/N37GpAAAAAElFTkSuQmCC";
|
|
2
|
+
export {
|
|
3
|
+
A as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { defineComponent as R, ref as y, computed as U, useModel as j, createElementBlock as P, openBlock as r, normalizeClass as o, unref as t, createVNode as p, renderSlot as A, createElementVNode as V, withCtx as d, createCommentVNode as h, createBlock as m, mergeModels as K } from "vue";
|
|
2
|
+
import { message as L, Upload as G, Spin as O, Image as T, ImagePreviewGroup as D } from "ant-design-vue";
|
|
3
|
+
import { useNamespace as H } from "../../../hooks/use-namespace/index.mjs";
|
|
4
|
+
import "../../index.mjs";
|
|
5
|
+
import { useExtractPlusUpload as J } from "../hook/useExtractPlusUpload.mjs";
|
|
6
|
+
import { usePlusUpload as Q } from "../hook/usePlusUpload.mjs";
|
|
7
|
+
import { PlusUpLoadProps as W } from "./types.mjs";
|
|
8
|
+
import { KIcon as w } from "../../icon/index.mjs";
|
|
9
|
+
import { KProOverlay as X } from "../../pro-overlay/index.mjs";
|
|
10
|
+
const Y = { key: 0 }, ce = /* @__PURE__ */ R({
|
|
11
|
+
__name: "plus-upload",
|
|
12
|
+
props: /* @__PURE__ */ K(W, {
|
|
13
|
+
fileList: {
|
|
14
|
+
type: Array,
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
fileListModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:fileList"],
|
|
20
|
+
setup(g) {
|
|
21
|
+
const s = g, { uploadFile: z, removeFile: E } = Q(), b = y(), v = y(!1), { b: I, e: n, em: Z } = H("plus-upload"), { getFileUrl: N, AcceptValidates: S, hasPrivew: _ } = J(), $ = U(
|
|
22
|
+
() => s.acceptType ? s.acceptType.map((e) => `.${e}`).join(",") : "*"
|
|
23
|
+
), i = j(g, "fileList"), q = async (e, a) => {
|
|
24
|
+
if (s.beforeUpload) {
|
|
25
|
+
const u = s.beforeUpload(e, a);
|
|
26
|
+
if (u instanceof Promise) {
|
|
27
|
+
if (await u === !1)
|
|
28
|
+
return !1;
|
|
29
|
+
} else if (!u)
|
|
30
|
+
return !1;
|
|
31
|
+
}
|
|
32
|
+
let l = [];
|
|
33
|
+
s.acceptType && s.acceptType.forEach((u) => {
|
|
34
|
+
const C = S[u];
|
|
35
|
+
l = [...l, ...C];
|
|
36
|
+
});
|
|
37
|
+
const { type: c, size: M } = e;
|
|
38
|
+
return !l.includes(c) && l.length > 0 ? (L.warning("上传格式错误"), !1) : s.maxSize && s.maxSize < M ? (L.warning("文件过大,请选择其他文件上传"), !1) : !0;
|
|
39
|
+
}, f = y(!1), x = async (e) => {
|
|
40
|
+
var a;
|
|
41
|
+
f.value = !0;
|
|
42
|
+
try {
|
|
43
|
+
const l = await z(s.business, e.file);
|
|
44
|
+
(a = i.value) == null || a.push(l), f.value = !1;
|
|
45
|
+
} catch {
|
|
46
|
+
f.value = !1;
|
|
47
|
+
}
|
|
48
|
+
}, k = U(() => i.value && i.value.length > 0 ? i.value.map((e) => {
|
|
49
|
+
const { id: a, name: l, url: c } = e;
|
|
50
|
+
return {
|
|
51
|
+
uid: a,
|
|
52
|
+
name: l,
|
|
53
|
+
url: N(l, c)
|
|
54
|
+
};
|
|
55
|
+
}) : []);
|
|
56
|
+
function B(e) {
|
|
57
|
+
b.value = e.url, v.value = !0;
|
|
58
|
+
}
|
|
59
|
+
async function F(e) {
|
|
60
|
+
await E(e.uid);
|
|
61
|
+
const a = i.value.findIndex((l) => l.id === e.uid);
|
|
62
|
+
i.value.splice(a, 1);
|
|
63
|
+
}
|
|
64
|
+
return (e, a) => (r(), P(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
class: o(t(I)())
|
|
68
|
+
},
|
|
69
|
+
[
|
|
70
|
+
p(t(G), {
|
|
71
|
+
"file-list": k.value,
|
|
72
|
+
accept: $.value,
|
|
73
|
+
"list-type": "picture-card",
|
|
74
|
+
"before-upload": q,
|
|
75
|
+
"custom-request": x
|
|
76
|
+
}, {
|
|
77
|
+
itemRender: d(({ file: l }) => [
|
|
78
|
+
V(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
class: o(t(n)("file-item"))
|
|
82
|
+
},
|
|
83
|
+
[
|
|
84
|
+
p(
|
|
85
|
+
t(X),
|
|
86
|
+
null,
|
|
87
|
+
{
|
|
88
|
+
action: d(() => [
|
|
89
|
+
t(_)(l.fileType) ? (r(), m(t(w), {
|
|
90
|
+
key: 0,
|
|
91
|
+
name: "eye",
|
|
92
|
+
class: o(t(n)("icon-eye")),
|
|
93
|
+
onClick: (c) => B(l)
|
|
94
|
+
}, null, 8, ["class", "onClick"])) : h("v-if", !0),
|
|
95
|
+
e.disabled ? h("v-if", !0) : (r(), m(t(w), {
|
|
96
|
+
key: 1,
|
|
97
|
+
name: "delete",
|
|
98
|
+
class: o(t(n)("icon-delete")),
|
|
99
|
+
onClick: (c) => F(l)
|
|
100
|
+
}, null, 8, ["class", "onClick"]))
|
|
101
|
+
]),
|
|
102
|
+
default: d(() => [
|
|
103
|
+
p(t(T), {
|
|
104
|
+
class: "object-contain",
|
|
105
|
+
width: 84,
|
|
106
|
+
height: 84,
|
|
107
|
+
preview: !1,
|
|
108
|
+
src: l.url
|
|
109
|
+
}, null, 8, ["src"])
|
|
110
|
+
]),
|
|
111
|
+
_: 2
|
|
112
|
+
/* DYNAMIC */
|
|
113
|
+
},
|
|
114
|
+
1024
|
|
115
|
+
/* DYNAMIC_SLOTS */
|
|
116
|
+
)
|
|
117
|
+
],
|
|
118
|
+
2
|
|
119
|
+
/* CLASS */
|
|
120
|
+
)
|
|
121
|
+
]),
|
|
122
|
+
default: d(() => [
|
|
123
|
+
(!e.limit || k.value.length < e.limit) && !e.disabled ? (r(), P("div", Y, [
|
|
124
|
+
f.value ? (r(), m(t(O), { key: 0 })) : (r(), m(t(w), {
|
|
125
|
+
key: 1,
|
|
126
|
+
name: "plus",
|
|
127
|
+
class: o(t(n)("icon-plus"))
|
|
128
|
+
}, null, 8, ["class"]))
|
|
129
|
+
])) : h("v-if", !0)
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
/* STABLE */
|
|
133
|
+
}, 8, ["file-list", "accept"]),
|
|
134
|
+
A(e.$slots, "tips"),
|
|
135
|
+
V(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
class: o(t(n)("preview"))
|
|
139
|
+
},
|
|
140
|
+
[
|
|
141
|
+
p(t(D), {
|
|
142
|
+
preview: {
|
|
143
|
+
visible: v.value,
|
|
144
|
+
onVisibleChange: (l) => v.value = l
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
default: d(() => [
|
|
148
|
+
p(t(T), { src: b.value }, null, 8, ["src"])
|
|
149
|
+
]),
|
|
150
|
+
_: 1
|
|
151
|
+
/* STABLE */
|
|
152
|
+
}, 8, ["preview"])
|
|
153
|
+
],
|
|
154
|
+
2
|
|
155
|
+
/* CLASS */
|
|
156
|
+
)
|
|
157
|
+
],
|
|
158
|
+
2
|
|
159
|
+
/* CLASS */
|
|
160
|
+
));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export {
|
|
164
|
+
ce as default
|
|
165
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { definePropType as r } from "../../utils/install.mjs";
|
|
2
|
+
const d = {
|
|
3
|
+
beforeUpload: {
|
|
4
|
+
type: r(Function)
|
|
5
|
+
},
|
|
6
|
+
business: {
|
|
7
|
+
type: r(String),
|
|
8
|
+
required: !0
|
|
9
|
+
},
|
|
10
|
+
limit: {
|
|
11
|
+
type: r(Number)
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
type: r(Boolean)
|
|
15
|
+
},
|
|
16
|
+
maxSize: {
|
|
17
|
+
type: r(Number)
|
|
18
|
+
},
|
|
19
|
+
acceptType: {
|
|
20
|
+
type: r(Array)
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
d as PlusUpLoadProps
|
|
25
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent as s, computed as l, createElementBlock as c, openBlock as m, normalizeClass as o, renderSlot as r, createElementVNode as p, unref as u } from "vue";
|
|
2
|
+
import { useNamespace as d } from "../../../hooks/use-namespace/index.mjs";
|
|
3
|
+
const y = /* @__PURE__ */ s({
|
|
4
|
+
name: "ProOverlay",
|
|
5
|
+
__name: "pro-overlay",
|
|
6
|
+
setup(i) {
|
|
7
|
+
const { b: t, e: n } = d("pro-overlay"), a = l(() => [t()]);
|
|
8
|
+
return (e, f) => (m(), c(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
class: o(a.value)
|
|
12
|
+
},
|
|
13
|
+
[
|
|
14
|
+
r(e.$slots, "default"),
|
|
15
|
+
p(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
class: o(u(n)("content"))
|
|
19
|
+
},
|
|
20
|
+
[
|
|
21
|
+
r(e.$slots, "action")
|
|
22
|
+
],
|
|
23
|
+
2
|
|
24
|
+
/* CLASS */
|
|
25
|
+
)
|
|
26
|
+
],
|
|
27
|
+
2
|
|
28
|
+
/* CLASS */
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
y as default
|
|
34
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineComponent as W, ref as g, computed as z, watch as H, onMounted as I, createVNode as d, Fragment as h } from "vue";
|
|
2
|
-
import { message as
|
|
2
|
+
import { message as x, Upload as R, Spin as D } from "ant-design-vue";
|
|
3
3
|
import { useNamespace as S } from "../../../hooks/use-namespace/index.mjs";
|
|
4
4
|
import { KIcon as $ } from "../../icon/index.mjs";
|
|
5
5
|
import { UploadComponentProps as j } from "./props.mjs";
|
|
6
|
-
import { getFileExtension as m, getUploadIcon as
|
|
6
|
+
import { getFileExtension as m, getUploadIcon as y, getBase64 as q } from "./utils/index.mjs";
|
|
7
7
|
import "./hooks/index.mjs";
|
|
8
8
|
import T from "./file-list.mjs";
|
|
9
|
-
import { useUpload as
|
|
10
|
-
const
|
|
9
|
+
import { useUpload as E } from "./hooks/useUpload.mjs";
|
|
10
|
+
const Q = /* @__PURE__ */ W({
|
|
11
11
|
name: "GdUpload",
|
|
12
12
|
props: j,
|
|
13
13
|
emits: {
|
|
@@ -19,20 +19,20 @@ const O = /* @__PURE__ */ W({
|
|
|
19
19
|
},
|
|
20
20
|
setup(e, {
|
|
21
21
|
emit: u,
|
|
22
|
-
expose:
|
|
22
|
+
expose: G
|
|
23
23
|
}) {
|
|
24
24
|
const {
|
|
25
|
-
b
|
|
25
|
+
b: v
|
|
26
26
|
} = S("pro-upload"), l = g([]), r = g(!1), {
|
|
27
|
-
uploadFile:
|
|
28
|
-
getFileDetails:
|
|
29
|
-
getImgUrl:
|
|
30
|
-
} =
|
|
27
|
+
uploadFile: b,
|
|
28
|
+
getFileDetails: U,
|
|
29
|
+
getImgUrl: N
|
|
30
|
+
} = E(e.http), w = z(() => {
|
|
31
31
|
if (e.disabled || l.value.length === e.maxCount) return !0;
|
|
32
|
-
}),
|
|
32
|
+
}), L = async (t, i) => {
|
|
33
33
|
var s;
|
|
34
34
|
if (e.beforeUpload) {
|
|
35
|
-
const f = e.beforeUpload(
|
|
35
|
+
const f = e.beforeUpload(t, i);
|
|
36
36
|
if (f instanceof Promise) {
|
|
37
37
|
if (await f === !1) return !1;
|
|
38
38
|
} else if (!f) return !1;
|
|
@@ -40,28 +40,28 @@ const O = /* @__PURE__ */ W({
|
|
|
40
40
|
const {
|
|
41
41
|
name: n,
|
|
42
42
|
size: a
|
|
43
|
-
} =
|
|
44
|
-
return e.accept && e.accept.length > 0 && !e.accept.includes(c) ? (
|
|
45
|
-
}, F = async (
|
|
43
|
+
} = t, c = m(n), o = a / 1024 / 1024;
|
|
44
|
+
return e.accept && e.accept.length > 0 && !e.accept.includes(c) ? (x.warning(`只能上传${(s = e.accept) == null ? void 0 : s.join(".")}后缀的文件!`), !1) : o > e.maxSize ? (x.warning(`上传的文件不能大于${e.maxSize}M!`), !1) : !0;
|
|
45
|
+
}, F = async (t) => {
|
|
46
46
|
try {
|
|
47
47
|
const {
|
|
48
|
-
file:
|
|
49
|
-
} =
|
|
48
|
+
file: i
|
|
49
|
+
} = t;
|
|
50
50
|
r.value = !0;
|
|
51
|
-
const n = await
|
|
51
|
+
const n = await b({
|
|
52
52
|
business: e.business,
|
|
53
|
-
file:
|
|
53
|
+
file: i
|
|
54
54
|
});
|
|
55
55
|
if (r.value = !1, !n) return;
|
|
56
|
-
const a = m(n.originName), c =
|
|
56
|
+
const a = m(n.originName), c = y(a);
|
|
57
57
|
if (c === "img") {
|
|
58
|
-
const s = await q(
|
|
58
|
+
const s = await q(i);
|
|
59
59
|
l.value.push({
|
|
60
60
|
icon: s,
|
|
61
61
|
id: n.id,
|
|
62
62
|
type: c,
|
|
63
63
|
spining: !1,
|
|
64
|
-
fileName:
|
|
64
|
+
fileName: t.file.name
|
|
65
65
|
});
|
|
66
66
|
} else
|
|
67
67
|
l.value.push({
|
|
@@ -69,7 +69,7 @@ const O = /* @__PURE__ */ W({
|
|
|
69
69
|
id: n.id,
|
|
70
70
|
type: c,
|
|
71
71
|
spining: !1,
|
|
72
|
-
fileName:
|
|
72
|
+
fileName: t.file.name
|
|
73
73
|
});
|
|
74
74
|
const o = l.value.map((s) => ({
|
|
75
75
|
fileName: s.fileName,
|
|
@@ -77,17 +77,17 @@ const O = /* @__PURE__ */ W({
|
|
|
77
77
|
id: s.id
|
|
78
78
|
}));
|
|
79
79
|
u("update:fileList", o), u("upload-success", o);
|
|
80
|
-
} catch (
|
|
81
|
-
r.value = !1, u("upload-error",
|
|
80
|
+
} catch (i) {
|
|
81
|
+
r.value = !1, u("upload-error", i);
|
|
82
82
|
}
|
|
83
|
-
}, p = async (
|
|
84
|
-
const
|
|
85
|
-
if ((
|
|
86
|
-
const n = await
|
|
83
|
+
}, p = async (t) => {
|
|
84
|
+
const i = t == null ? void 0 : t.map((a) => a.id);
|
|
85
|
+
if ((i == null ? void 0 : i.length) === 0) return;
|
|
86
|
+
const n = await U(i);
|
|
87
87
|
for (const a of n.data) {
|
|
88
|
-
const c = m(a.originName), o =
|
|
88
|
+
const c = m(a.originName), o = y(c);
|
|
89
89
|
if (o === "img") {
|
|
90
|
-
const s = await
|
|
90
|
+
const s = await N([a.id]);
|
|
91
91
|
l.value.push({
|
|
92
92
|
id: a.id,
|
|
93
93
|
icon: s[a.id],
|
|
@@ -105,23 +105,28 @@ const O = /* @__PURE__ */ W({
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
|
|
109
|
-
const
|
|
108
|
+
H(() => l.value, (t) => {
|
|
109
|
+
const i = t.map((n) => ({
|
|
110
110
|
fileName: n.fileName,
|
|
111
111
|
type: n.type,
|
|
112
112
|
id: n.id
|
|
113
113
|
}));
|
|
114
|
-
u("update:fileList",
|
|
114
|
+
u("update:fileList", i), u("change", i);
|
|
115
115
|
}, {
|
|
116
116
|
deep: !0
|
|
117
117
|
}), I(async () => {
|
|
118
118
|
p(e.fileList);
|
|
119
|
-
})
|
|
120
|
-
|
|
119
|
+
});
|
|
120
|
+
const C = (t) => {
|
|
121
|
+
l.value = t;
|
|
122
|
+
};
|
|
123
|
+
return defineExpose({
|
|
124
|
+
updateFileList: p,
|
|
125
|
+
setFileList: C
|
|
121
126
|
}), () => {
|
|
122
|
-
var
|
|
127
|
+
var t;
|
|
123
128
|
return d("div", {
|
|
124
|
-
class:
|
|
129
|
+
class: v(),
|
|
125
130
|
style: {
|
|
126
131
|
display: "flex",
|
|
127
132
|
flexWrap: "wrap",
|
|
@@ -132,12 +137,12 @@ const O = /* @__PURE__ */ W({
|
|
|
132
137
|
itemWidth: e.itemWidth,
|
|
133
138
|
itemHeight: e.itemHeight,
|
|
134
139
|
list: l.value,
|
|
135
|
-
"onUpdate:list": (
|
|
140
|
+
"onUpdate:list": (i) => l.value = i
|
|
136
141
|
}, null, 8, ["http", "itemWidth", "itemHeight", "list", "onUpdate:list"]), l.value.length < (e.maxCount ?? 20) ? d(R, {
|
|
137
|
-
accept: (
|
|
138
|
-
disabled:
|
|
142
|
+
accept: (t = e.accept) == null ? void 0 : t.join(","),
|
|
143
|
+
disabled: w.value,
|
|
139
144
|
customRequest: F,
|
|
140
|
-
beforeUpload:
|
|
145
|
+
beforeUpload: L,
|
|
141
146
|
style: {
|
|
142
147
|
marginTop: "5px"
|
|
143
148
|
}
|
|
@@ -171,5 +176,5 @@ const O = /* @__PURE__ */ W({
|
|
|
171
176
|
}
|
|
172
177
|
});
|
|
173
178
|
export {
|
|
174
|
-
|
|
179
|
+
Q as default
|
|
175
180
|
};
|