@das-fed/ui 6.4.0-dev.82 → 6.4.0-dev.83
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/package.json +5 -5
- package/packages/components/image-upload/index.js +98 -98
- package/packages/components/image-upload/index.js.gz +0 -0
- package/packages/components/image-viewer/index.js +33 -33
- package/packages/components/image-viewer/index.js.gz +0 -0
- package/packages/components/image-viewer/style.css +1 -1
- package/packages/components/image-viewer/style.css.gz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/ui",
|
|
3
|
-
"version": "6.4.0-dev.
|
|
3
|
+
"version": "6.4.0-dev.83",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@antv/x6-plugin-snapline": "^2.1.7",
|
|
27
27
|
"@antv/x6-plugin-transform": "^2.1.8",
|
|
28
28
|
"@antv/x6-vue-shape": "^2.1.2",
|
|
29
|
-
"@das-fed/cli": "6.4.0-dev.
|
|
29
|
+
"@das-fed/cli": "6.4.0-dev.83",
|
|
30
30
|
"@element-plus/icons-vue": "^2.3.1",
|
|
31
31
|
"@types/lodash": "^4.14.194",
|
|
32
32
|
"@types/lodash-es": "^4.17.9",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"vue-tsc": "^2.0.29"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@das-fed/ui": "6.4.0-dev.
|
|
60
|
-
"@das-fed/utils": "6.4.0-dev.
|
|
61
|
-
"@das-fed/web": "6.4.0-dev.
|
|
59
|
+
"@das-fed/ui": "6.4.0-dev.83",
|
|
60
|
+
"@das-fed/utils": "6.4.0-dev.83",
|
|
61
|
+
"@das-fed/web": "6.4.0-dev.83",
|
|
62
62
|
"@wangeditor/editor": "^5.1.23",
|
|
63
63
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
|
64
64
|
"@wangeditor/plugin-upload-attachment": "^1.1.0",
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import '@das-fed/ui/packages/components/image-upload/style.css';
|
|
2
|
-
import { withInstall as
|
|
3
|
-
import { i18n as
|
|
4
|
-
import { getVar as
|
|
5
|
-
import { computed as
|
|
6
|
-
import { UploadDragger as
|
|
2
|
+
import { withInstall as D } from "@das-fed/utils/with-install/index";
|
|
3
|
+
import { i18n as S, t as k, setI18nRule as $ } from "@das-fed/web/packages/i18n/index";
|
|
4
|
+
import { getVar as b, setThemeRule as E } from "@das-fed/web/packages/theme/index";
|
|
5
|
+
import { computed as A, defineComponent as R, openBlock as F, createElementBlock as W, createCommentVNode as I, withDirectives as w, createVNode as m, unref as a, normalizeClass as K, withCtx as g, createElementVNode as h, toDisplayString as z, vShow as N, createTextVNode as P } from "vue";
|
|
6
|
+
import { UploadDragger as H, Upload as O } from "ant-design-vue";
|
|
7
7
|
import "ant-design-vue/es/upload/style/css";
|
|
8
|
-
import { DasSpin as
|
|
9
|
-
import { DasButton as
|
|
10
|
-
import { DasIconAddto as
|
|
11
|
-
import { DasIconWarning as
|
|
12
|
-
import { DasMessage as
|
|
13
|
-
import { useModelValue as
|
|
8
|
+
import { DasSpin as q } from "@das-fed/ui/packages/components/spin/index";
|
|
9
|
+
import { DasButton as G } from "@das-fed/ui/packages/components/button/index";
|
|
10
|
+
import { DasIconAddto as J } from "@das-fed/ui/packages/icons/addto/index";
|
|
11
|
+
import { DasIconWarning as L } from "@das-fed/ui/packages/icons/warning/index";
|
|
12
|
+
import { DasMessage as T } from "@das-fed/ui/packages/components/message/index";
|
|
13
|
+
import { useModelValue as Q } from "@das-fed/utils/vue";
|
|
14
14
|
import "@das-fed/ui/packages/global/theme";
|
|
15
|
-
const
|
|
15
|
+
const X = () => ({ size2B: (t) => {
|
|
16
16
|
isNaN(Number(t)) ? t = t.toString() : t = t + "M";
|
|
17
|
-
const
|
|
18
|
-
M:
|
|
19
|
-
K:
|
|
17
|
+
const i = Number(t.slice(0, -1)), n = t[t.length - 1].toUpperCase(), s = 1024, f = {
|
|
18
|
+
M: s * s,
|
|
19
|
+
K: s,
|
|
20
20
|
B: 1
|
|
21
21
|
};
|
|
22
|
-
return { finalSize:
|
|
23
|
-
} }),
|
|
24
|
-
const
|
|
25
|
-
var
|
|
26
|
-
let e = o.accept ? (
|
|
27
|
-
return e.includes("image/jpg") && !e.includes("image/jpeg") && e.push("image/jpeg"), e.includes(".jpg") && !e.includes(".jpeg") && e.push(".jpeg"), o.acceptVideo && e
|
|
28
|
-
}),
|
|
29
|
-
return { isAccept:
|
|
30
|
-
var
|
|
22
|
+
return { finalSize: i * f[n], sizeText: t };
|
|
23
|
+
} }), Y = (o, t) => {
|
|
24
|
+
const i = Q(o, "status"), { size2B: n } = X(), s = [".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv", ".mpeg", ".webm"], f = [".mp3", ".wav", ".aac", ".flac", ".ogg", ".alff", ".wma", ".m4a"], r = A(() => {
|
|
25
|
+
var d;
|
|
26
|
+
let e = o.accept ? (d = o.accept) == null ? void 0 : d.split(",") : [];
|
|
27
|
+
return e.includes("image/jpg") && !e.includes("image/jpeg") && e.push("image/jpeg"), e.includes(".jpg") && !e.includes(".jpeg") && e.push(".jpeg"), o.acceptVideo && (e = [...e, ...s]), o.acceptAudio && (e = [...e, ...f]), e.join(",");
|
|
28
|
+
}), C = A(() => i.value === "uploading"), y = A(() => i.value === "error");
|
|
29
|
+
return { isAccept: r, uploadStatus: i, loading: C, errored: y, beforeupload: (e) => {
|
|
30
|
+
var x;
|
|
31
31
|
if (o.maxSize) {
|
|
32
|
-
const { finalSize:
|
|
33
|
-
if (e.size >
|
|
34
|
-
const v =
|
|
32
|
+
const { finalSize: c, sizeText: u } = n(o.maxSize);
|
|
33
|
+
if (e.size > c) {
|
|
34
|
+
const v = S(
|
|
35
35
|
"das-ui-import-upload-key3",
|
|
36
|
-
|
|
37
|
-
((
|
|
36
|
+
u,
|
|
37
|
+
((x = r.value) == null ? void 0 : x.toUpperCase().replaceAll(".", "").replaceAll(",", "、")) ?? ""
|
|
38
38
|
).value, p = o.errorMessage || v;
|
|
39
|
-
return
|
|
39
|
+
return T.warning(p), t("update:status", "normal"), i.value = "normal", !1;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const d = () => (i.value = "uploading", t("update:status", "uploading"), t("image-upload", e), !1);
|
|
43
43
|
if (o.customCheck) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return new Promise(async (
|
|
44
|
+
const c = o.customCheck(e);
|
|
45
|
+
if (c instanceof Promise)
|
|
46
|
+
return new Promise(async (u, v) => {
|
|
47
47
|
let p;
|
|
48
48
|
try {
|
|
49
|
-
p = await
|
|
49
|
+
p = await c.then();
|
|
50
50
|
} catch {
|
|
51
51
|
p = !1;
|
|
52
52
|
}
|
|
53
|
-
p ?
|
|
53
|
+
p ? d() : v(!1);
|
|
54
54
|
});
|
|
55
|
-
if (!
|
|
56
|
-
return t("update:status", "normal"),
|
|
57
|
-
} else if (
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
if (!p && !
|
|
61
|
-
const
|
|
62
|
-
return
|
|
55
|
+
if (!c)
|
|
56
|
+
return t("update:status", "normal"), i.value = "normal", !1;
|
|
57
|
+
} else if (r.value) {
|
|
58
|
+
const c = r.value.split(",").filter((l) => l.trim().startsWith(".")).map((l) => l.trim()), u = r.value.split(",").filter((l) => !l.trim().startsWith(".")).map((l) => l.trim()), v = e.name.match(/\.(.+)$/), p = c.includes(v[0]);
|
|
59
|
+
let U = u.includes("image/*") && e.type.split("/")[0].trim() === "image", V = u.includes("video/*") && e.type.split("/")[0].trim() === "video", B = u.includes("audio/*") && e.type.split("/")[0].trim() === "audio", M = u.includes(e.type) || U || V || B;
|
|
60
|
+
if (!p && !M) {
|
|
61
|
+
const l = o.acceptAudio || o.acceptVideo ? "das-ui-import-upload-key2" : "das-ui-import-upload-key1", j = o.errorMessage || S(l, r.value.toUpperCase().replaceAll(".", "").replaceAll(",", "、")).value;
|
|
62
|
+
return T.warning(j), !1;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return d();
|
|
66
66
|
} };
|
|
67
|
-
},
|
|
67
|
+
}, Z = { class: "das-ui-image-upload" }, ee = { class: "das-ui-image-upload-dragger-context" }, ae = { class: "text" }, oe = { class: "das-ui-image-upload-error-container" }, te = { class: "tips-container" }, ie = { class: "text" }, se = /* @__PURE__ */ R({
|
|
68
68
|
__name: "Index",
|
|
69
69
|
props: {
|
|
70
70
|
maxCount: { default: 1 },
|
|
@@ -80,34 +80,34 @@ const L = () => ({ size2B: (t) => {
|
|
|
80
80
|
},
|
|
81
81
|
emits: ["update:status", "image-upload"],
|
|
82
82
|
setup(o, { emit: t }) {
|
|
83
|
-
const
|
|
84
|
-
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class:
|
|
83
|
+
const i = o, n = t, { isAccept: s, uploadStatus: f, loading: r, errored: C, beforeupload: y } = Y(i, n);
|
|
84
|
+
return (_, e) => (F(), W("div", Z, [
|
|
85
|
+
I(" 图片上传组件 "),
|
|
86
|
+
w(m(a(q), {
|
|
87
|
+
class: K([{ "loading-border": a(r) }]),
|
|
88
88
|
type: "component",
|
|
89
|
-
spinning: a(
|
|
89
|
+
spinning: a(r)
|
|
90
90
|
}, {
|
|
91
91
|
default: g(() => [
|
|
92
|
-
m(a(
|
|
92
|
+
m(a(H), {
|
|
93
93
|
class: "das-ui-image-upload-dragger",
|
|
94
|
-
accept: a(
|
|
95
|
-
"max-count":
|
|
96
|
-
"before-upload": a(
|
|
94
|
+
accept: a(s),
|
|
95
|
+
"max-count": _.maxCount,
|
|
96
|
+
"before-upload": a(y)
|
|
97
97
|
}, {
|
|
98
|
-
itemRender: g(({ file:
|
|
98
|
+
itemRender: g(({ file: d, actions: x }) => e[0] || (e[0] = [])),
|
|
99
99
|
default: g(() => [
|
|
100
|
-
|
|
100
|
+
w(h(
|
|
101
101
|
"div",
|
|
102
|
-
|
|
102
|
+
ee,
|
|
103
103
|
[
|
|
104
|
-
m(a(
|
|
105
|
-
iconColor: a(
|
|
104
|
+
m(a(J), {
|
|
105
|
+
iconColor: a(b)("--das-ui-color-secondary")
|
|
106
106
|
}, null, 8, ["iconColor"]),
|
|
107
|
-
|
|
107
|
+
h(
|
|
108
108
|
"div",
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
ae,
|
|
110
|
+
z(_.message || a(k)("das-image-upload-text")),
|
|
111
111
|
1
|
|
112
112
|
/* TEXT */
|
|
113
113
|
)
|
|
@@ -115,7 +115,7 @@ const L = () => ({ size2B: (t) => {
|
|
|
115
115
|
512
|
|
116
116
|
/* NEED_PATCH */
|
|
117
117
|
), [
|
|
118
|
-
[
|
|
118
|
+
[N, a(f) === "normal"]
|
|
119
119
|
])
|
|
120
120
|
]),
|
|
121
121
|
_: 1
|
|
@@ -125,40 +125,40 @@ const L = () => ({ size2B: (t) => {
|
|
|
125
125
|
_: 1
|
|
126
126
|
/* STABLE */
|
|
127
127
|
}, 8, ["class", "spinning"]), [
|
|
128
|
-
[
|
|
128
|
+
[N, !a(C)]
|
|
129
129
|
]),
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
I(" 错误状态 "),
|
|
131
|
+
w(h(
|
|
132
132
|
"div",
|
|
133
|
-
|
|
133
|
+
oe,
|
|
134
134
|
[
|
|
135
|
-
|
|
136
|
-
m(a(
|
|
137
|
-
iconColor: a(
|
|
135
|
+
h("div", te, [
|
|
136
|
+
m(a(L), {
|
|
137
|
+
iconColor: a(b)("--das-ui-color-danger"),
|
|
138
138
|
size: "small"
|
|
139
139
|
}, null, 8, ["iconColor"]),
|
|
140
|
-
|
|
140
|
+
h(
|
|
141
141
|
"div",
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
ie,
|
|
143
|
+
z(a(k)("das-image-upload-fail")),
|
|
144
144
|
1
|
|
145
145
|
/* TEXT */
|
|
146
146
|
)
|
|
147
147
|
]),
|
|
148
|
-
m(a(
|
|
149
|
-
accept: a(
|
|
150
|
-
"before-upload": a(
|
|
151
|
-
"max-count":
|
|
148
|
+
m(a(O), {
|
|
149
|
+
accept: a(s),
|
|
150
|
+
"before-upload": a(y),
|
|
151
|
+
"max-count": _.maxCount
|
|
152
152
|
}, {
|
|
153
|
-
itemRender: g(({ file:
|
|
153
|
+
itemRender: g(({ file: d, actions: x }) => e[1] || (e[1] = [])),
|
|
154
154
|
default: g(() => [
|
|
155
|
-
m(a(
|
|
155
|
+
m(a(G), {
|
|
156
156
|
"btn-type": "primary-text",
|
|
157
157
|
block: ""
|
|
158
158
|
}, {
|
|
159
159
|
default: g(() => [
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
P(
|
|
161
|
+
z(a(k)("das-image-upload-reupload")),
|
|
162
162
|
1
|
|
163
163
|
/* TEXT */
|
|
164
164
|
)
|
|
@@ -174,16 +174,16 @@ const L = () => ({ size2B: (t) => {
|
|
|
174
174
|
512
|
|
175
175
|
/* NEED_PATCH */
|
|
176
176
|
), [
|
|
177
|
-
[
|
|
177
|
+
[N, a(C)]
|
|
178
178
|
])
|
|
179
179
|
]));
|
|
180
180
|
}
|
|
181
|
-
}),
|
|
182
|
-
const
|
|
183
|
-
for (const [
|
|
184
|
-
|
|
185
|
-
return
|
|
186
|
-
},
|
|
181
|
+
}), re = (o, t) => {
|
|
182
|
+
const i = o.__vccOpts || o;
|
|
183
|
+
for (const [n, s] of t)
|
|
184
|
+
i[n] = s;
|
|
185
|
+
return i;
|
|
186
|
+
}, le = /* @__PURE__ */ re(se, [["__scopeId", "data-v-5821ad3e"]]), ne = {
|
|
187
187
|
"das-ui-import-upload-key1": {
|
|
188
188
|
"zh-CN": "上传的图片格式只能是$0",
|
|
189
189
|
en: "The uploaded picture format can only be $0",
|
|
@@ -202,16 +202,16 @@ const L = () => ({ size2B: (t) => {
|
|
|
202
202
|
"das-image-upload-text": { "zh-CN": "上传图片", en: "Upload Image", _appCode: "framework" },
|
|
203
203
|
"das-image-upload-reupload": { "zh-CN": "重新上传", en: "Re-upload", _appCode: "framework" },
|
|
204
204
|
"das-image-upload-fail": { "zh-CN": "上传失败", en: "Uploaded Failed", _appCode: "framework" }
|
|
205
|
-
},
|
|
205
|
+
}, de = {
|
|
206
206
|
"--das-ui-image-upload-bgcolor": { light: "#FAFAFA" },
|
|
207
207
|
"--das-ui-image-upload-border-color": { light: "#E5E5E5" },
|
|
208
|
-
"--das-ui-image-upload-bgcolor-hover": { light:
|
|
208
|
+
"--das-ui-image-upload-bgcolor-hover": { light: b("--das-ui-color-primary-level1") },
|
|
209
209
|
"--das-ui-image-upload-border-color-hover": { light: "#5582F3" },
|
|
210
|
-
"--das-ui-image-upload-border-color-error": { light:
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
|
|
210
|
+
"--das-ui-image-upload-border-color-error": { light: b("--das-ui-color-danger-level2") }
|
|
211
|
+
}, ke = D(le);
|
|
212
|
+
$(ne);
|
|
213
|
+
E(de);
|
|
214
214
|
export {
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
ke as DasImageUpload,
|
|
216
|
+
ke as default
|
|
217
217
|
};
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@das-fed/ui/packages/components/image-viewer/style.css';
|
|
2
2
|
import { withInstall as De } from "@das-fed/utils/with-install/index";
|
|
3
3
|
import { setThemeRule as Ue } from "@das-fed/web/packages/theme/index";
|
|
4
|
-
import { ref as ae, computed as
|
|
4
|
+
import { ref as ae, computed as R, watch as be, createApp as Pe, defineComponent as Je, openBlock as g, createElementBlock as I, Fragment as x, createCommentVNode as r, createElementVNode as N, normalizeStyle as $, withDirectives as B, createVNode as z, unref as e, normalizeClass as _, withCtx as q, createBlock as y, vShow as k, isRef as se, createTextVNode as re, toDisplayString as le, renderList as ue } from "vue";
|
|
5
5
|
import { ElImageViewer as Ve, ElImage as de } from "element-plus";
|
|
6
6
|
import { Upload as ce } from "ant-design-vue";
|
|
7
7
|
import { vDasTooltip as me } from "@das-fed/ui/packages/components/text-tooltip/index";
|
|
@@ -30,9 +30,9 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
30
30
|
let i = document.createElement("canvas");
|
|
31
31
|
const u = i.getContext("2d");
|
|
32
32
|
i.width = n.width, i.height = n.height, u.drawImage(n, 0, 0, n.width, n.height), i.toBlob((A) => {
|
|
33
|
-
let v = URL.createObjectURL(A), d = document.createElement("a"),
|
|
33
|
+
let v = URL.createObjectURL(A), d = document.createElement("a"), D = new MouseEvent("click");
|
|
34
34
|
const E = t.substring(t.lastIndexOf(".")).toLowerCase();
|
|
35
|
-
d.download = o || `default${E}`, d.href = v, d.dispatchEvent(
|
|
35
|
+
d.download = o || `default${E}`, d.href = v, d.dispatchEvent(D), URL.revokeObjectURL(v);
|
|
36
36
|
});
|
|
37
37
|
}, n.src = t + "?v=" + Date.now();
|
|
38
38
|
}, Me = (t, o) => {
|
|
@@ -52,11 +52,11 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
52
52
|
const { baseUrl: o, serviceName: n, pathPrefix: i, bucketName: u, minioTokenApi: A, autoContentType: v } = t, d = async () => {
|
|
53
53
|
const [w, l] = await Ke({ baseUrl: o, minioTokenApi: A })().run();
|
|
54
54
|
return w ? { stauts: !1 } : { status: !0, data: l };
|
|
55
|
-
}, { generateUniqueName:
|
|
55
|
+
}, { generateUniqueName: D } = Ne();
|
|
56
56
|
return { upload: async (w, l = {}) => {
|
|
57
57
|
const h = await d();
|
|
58
58
|
if (!h.status) return;
|
|
59
|
-
const U = w.name, C = h.data, T = i || Fe(), L = U.substring(U.lastIndexOf(".")).toLowerCase(), K = t.randomName ? `${
|
|
59
|
+
const U = w.name, C = h.data, T = i || Fe(), L = U.substring(U.lastIndexOf(".")).toLowerCase(), K = t.randomName ? `${D("")}${L}` : U, O = n ? `${T}/${n}/${K}` : `${T}/${K}`, F = {
|
|
60
60
|
accessKeyId: C.accessKeyId,
|
|
61
61
|
secretAccessKey: C.secretAccessKey,
|
|
62
62
|
sessionToken: C.sessionToken,
|
|
@@ -93,23 +93,23 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
93
93
|
}
|
|
94
94
|
return n;
|
|
95
95
|
}, Ze = (t, o) => {
|
|
96
|
-
const n = oe(), i = we(t, "modelValue"), u = we(t, "status"), { upload: A } = je(t), { size2B: v } = He(), { handlerImageSrc: d } = ze(t),
|
|
96
|
+
const n = oe(), i = we(t, "modelValue"), u = we(t, "status"), { upload: A } = je(t), { size2B: v } = He(), { handlerImageSrc: d } = ze(t), D = ae(""), E = ae([]), w = [".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv", ".mpeg", ".webm"], l = [".mp3", ".wav", ".aac", ".flac", ".ogg", ".alff", ".wma", ".m4a"], h = R(() => t.baseUrl ? t.baseUrl : process.env.NODE_ENV === "production" ? "" : n.baseURL || ""), U = (a) => {
|
|
97
97
|
if (a) {
|
|
98
98
|
const c = a.substring(a.lastIndexOf(".")).toLowerCase();
|
|
99
99
|
if (w.includes(c)) return "isVideo";
|
|
100
100
|
if (l.includes(c)) return "isAudio";
|
|
101
101
|
}
|
|
102
102
|
return "isImg";
|
|
103
|
-
}, C =
|
|
103
|
+
}, C = R(() => {
|
|
104
104
|
var c;
|
|
105
105
|
let a = t.accept ? (c = t.accept) == null ? void 0 : c.split(",") : [];
|
|
106
106
|
return a.includes("image/jpg") && !a.includes("image/jpeg") && a.push("image/jpeg"), a.includes(".jpg") && !a.includes(".jpeg") && a.push(".jpeg"), t.acceptVideo && (a = [...a, ...w]), t.acceptAudio && (a = [...a, ...l]), a.join(",");
|
|
107
|
-
}), T =
|
|
107
|
+
}), T = R(() => u.value === "uploading"), L = ae(0), K = (a) => T.value ? L.value === a : !1, O = R(() => i.value ? [d(h.value, i.value)] : []), F = R(() => i.value ? i.value.map((a) => [d(h.value, a)]) : []), j = R(() => t.status !== "info" && (t.needDeleteBtn || t.needChangeBtn) || t.needDownloadBtn), H = R(() => t.status !== "info" && t.needDeleteBtn || t.needDownloadBtn), G = R(() => {
|
|
108
108
|
const a = [], c = t.previewBtnConfig;
|
|
109
109
|
if (typeof c == "boolean")
|
|
110
110
|
return c ? ["zoom_in", "zoom_out", "turn_left", "turn_right", "full_screen"] : [];
|
|
111
|
-
for (const
|
|
112
|
-
c[
|
|
111
|
+
for (const Q in c)
|
|
112
|
+
c[Q] && a.push(Q);
|
|
113
113
|
return a;
|
|
114
114
|
}), J = () => {
|
|
115
115
|
setTimeout(() => {
|
|
@@ -121,48 +121,48 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
121
121
|
}, X = (a, c = 0) => {
|
|
122
122
|
var Y;
|
|
123
123
|
o("downloadImage", a);
|
|
124
|
-
let
|
|
125
|
-
t.limitNum === 1 ?
|
|
124
|
+
let Q = "";
|
|
125
|
+
t.limitNum === 1 ? Q = t.imageName || D.value : Q = ((Y = t.imageName) == null ? void 0 : Y[c]) || E.value[c], U(a) === "isImg" ? Le(d(h.value, a), Q) : Me(d(h.value, a), Q);
|
|
126
126
|
}, W = async (a, c) => {
|
|
127
127
|
var Y;
|
|
128
128
|
if (t.maxSize) {
|
|
129
|
-
const { finalSize: b, sizeText:
|
|
129
|
+
const { finalSize: b, sizeText: S } = v(t.maxSize);
|
|
130
130
|
if (a.size > b) {
|
|
131
131
|
const Z = he(
|
|
132
132
|
"das-ui-import-upload-key3",
|
|
133
|
-
|
|
133
|
+
S,
|
|
134
134
|
((Y = C.value) == null ? void 0 : Y.toUpperCase().replaceAll(".", "").replaceAll(",", "、")) ?? ""
|
|
135
135
|
).value, M = t.errorMessage || Z;
|
|
136
136
|
return Ee.warning(M), !1;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
const
|
|
139
|
+
const Q = async (b) => {
|
|
140
140
|
L.value = b, o("update:status", "uploading"), o("image-upload", a);
|
|
141
|
-
const
|
|
142
|
-
return
|
|
141
|
+
const S = await A(a);
|
|
142
|
+
return S === "error" ? (o("update:status", "error"), !1) : (o("upload-success", a, i.value), t.limitNum === 1 ? i.value = S : i.value[b] = S, o("update:modelValue", i.value), o("update:status", "normal"), !1);
|
|
143
143
|
};
|
|
144
144
|
if (t.customCheck) {
|
|
145
145
|
const b = t.customCheck(a);
|
|
146
146
|
if (b instanceof Promise)
|
|
147
|
-
return new Promise(async (
|
|
147
|
+
return new Promise(async (S, Z) => {
|
|
148
148
|
let M;
|
|
149
149
|
try {
|
|
150
150
|
M = await b.then();
|
|
151
151
|
} catch {
|
|
152
152
|
M = !1;
|
|
153
153
|
}
|
|
154
|
-
M ?
|
|
154
|
+
M ? Q(c) : Z(!1);
|
|
155
155
|
});
|
|
156
156
|
if (!b) return !1;
|
|
157
157
|
} else if (C.value) {
|
|
158
|
-
const b = C.value.split(",").filter((P) => P.trim().startsWith(".")).map((P) => P.trim()),
|
|
159
|
-
let ye =
|
|
158
|
+
const b = C.value.split(",").filter((P) => P.trim().startsWith(".")).map((P) => P.trim()), S = C.value.split(",").filter((P) => !P.trim().startsWith(".")).map((P) => P.trim()), Z = a.name.match(/\.(.+)$/), M = b.includes(Z[0]);
|
|
159
|
+
let ye = S.includes("image/*") && a.type.split("/")[0].trim() === "image", ke = S.includes("video/*") && a.type.split("/")[0].trim() === "video", Qe = S.includes("audio/*") && a.type.split("/")[0].trim() === "audio", Se = S.includes(a.type) || ye || ke || Qe;
|
|
160
160
|
if (!M && !Se) {
|
|
161
161
|
const P = t.acceptAudio || t.acceptVideo ? "das-ui-import-upload-key2" : "das-ui-import-upload-key1", Re = t.errorMessage || he(P, C.value.toUpperCase().replaceAll(".", "").replaceAll(",", "、")).value;
|
|
162
162
|
return Ee.warning(Re), !1;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
return
|
|
165
|
+
return Q(c);
|
|
166
166
|
}, s = async (a) => {
|
|
167
167
|
t.limitNum !== 1 && (L.value = i.length), o("update:status", "uploading"), o("image-upload", a);
|
|
168
168
|
const c = await A(a);
|
|
@@ -182,7 +182,7 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
182
182
|
};
|
|
183
183
|
return be(i, async () => {
|
|
184
184
|
const a = t.limitNum ?? 1;
|
|
185
|
-
a === 1 && i.value ?
|
|
185
|
+
a === 1 && i.value ? D.value = await qe(i.value) : a > 1 && i.value.length > 0 && (E.value = await Ye(i.value));
|
|
186
186
|
}, {
|
|
187
187
|
deep: !0,
|
|
188
188
|
immediate: !0
|
|
@@ -196,7 +196,7 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
196
196
|
previewBtns: G,
|
|
197
197
|
operateShow: j,
|
|
198
198
|
operateShow_Multi: H,
|
|
199
|
-
singlePreviewName:
|
|
199
|
+
singlePreviewName: D,
|
|
200
200
|
multiPreviewName: E,
|
|
201
201
|
getFileType: U,
|
|
202
202
|
delImg: V,
|
|
@@ -238,7 +238,7 @@ const ie = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAA
|
|
|
238
238
|
te.addEventFromMicroApp();
|
|
239
239
|
const Xe = (t) => {
|
|
240
240
|
const { handleImageClickProxy: o, previewBtns: n } = t;
|
|
241
|
-
return { needPreviewImage:
|
|
241
|
+
return { needPreviewImage: R(() => !t.needPreview || te.isMicroApp() ? !1 : t.needPreview), handleImageClick: (A) => {
|
|
242
242
|
if (!te.isMicroApp()) return o();
|
|
243
243
|
let v = [];
|
|
244
244
|
Array.isArray(A) && v.push(...A), typeof A == "string" && v.push(A), te.sendMessageToMainApp(Be, {
|
|
@@ -295,7 +295,7 @@ const Xe = (t) => {
|
|
|
295
295
|
},
|
|
296
296
|
emits: ["update:modelValue", "update:status", "downloadImage", "image-upload", "upload-success", "deleteImage"],
|
|
297
297
|
setup(t, { emit: o }) {
|
|
298
|
-
const n = t, i = o, u =
|
|
298
|
+
const n = t, i = o, u = R(() => {
|
|
299
299
|
const p = [
|
|
300
300
|
n.needDownloadBtn,
|
|
301
301
|
n.limitNum === 1 && l.value !== "info" && n.needChangeBtn,
|
|
@@ -305,11 +305,11 @@ const Xe = (t) => {
|
|
|
305
305
|
return p === 2 && (f = "space-around"), p === 3 && (f = "space-between"), {
|
|
306
306
|
"justify-content": f
|
|
307
307
|
};
|
|
308
|
-
}), A =
|
|
308
|
+
}), A = R(() => n.mode === "view" ? !1 : d.value ? l.value === "error" : l.value !== "info"), v = (s) => {
|
|
309
309
|
s.stopPropagation();
|
|
310
310
|
}, {
|
|
311
311
|
url: d,
|
|
312
|
-
isAccept:
|
|
312
|
+
isAccept: D,
|
|
313
313
|
singlePreviewList: E,
|
|
314
314
|
multiPreviewList: w,
|
|
315
315
|
uploadStatus: l,
|
|
@@ -409,7 +409,7 @@ const Xe = (t) => {
|
|
|
409
409
|
e(l) !== "info" && s.needChangeBtn ? (g(), y(e(ce), {
|
|
410
410
|
key: 1,
|
|
411
411
|
"before-upload": (f) => e(F)(f, 0),
|
|
412
|
-
accept: e(
|
|
412
|
+
accept: e(D)
|
|
413
413
|
}, {
|
|
414
414
|
itemRender: q(({ file: f, actions: m }) => p[5] || (p[5] = [])),
|
|
415
415
|
default: q(() => [
|
|
@@ -564,9 +564,9 @@ const Xe = (t) => {
|
|
|
564
564
|
e(l) !== "info" && s.needChangeBtn ? (g(), y(e(ce), {
|
|
565
565
|
key: 1,
|
|
566
566
|
"before-upload": (c) => e(F)(c, m),
|
|
567
|
-
accept: e(
|
|
567
|
+
accept: e(D)
|
|
568
568
|
}, {
|
|
569
|
-
itemRender: q(({ file: c, actions:
|
|
569
|
+
itemRender: q(({ file: c, actions: Q }) => p[6] || (p[6] = [])),
|
|
570
570
|
default: q(() => [
|
|
571
571
|
z(e(fe), {
|
|
572
572
|
class: "operate-btn m-t-6",
|
|
@@ -642,7 +642,7 @@ const Xe = (t) => {
|
|
|
642
642
|
status: e(l),
|
|
643
643
|
"onUpdate:status": p[4] || (p[4] = (f) => se(l) ? l.value = f : null),
|
|
644
644
|
"max-size": s.maxSize,
|
|
645
|
-
accept:
|
|
645
|
+
accept: s.accept,
|
|
646
646
|
acceptVideo: s.acceptVideo,
|
|
647
647
|
acceptAudio: s.acceptAudio,
|
|
648
648
|
message: s.message,
|
|
@@ -681,7 +681,7 @@ const Xe = (t) => {
|
|
|
681
681
|
for (const [i, u] of o)
|
|
682
682
|
n[i] = u;
|
|
683
683
|
return n;
|
|
684
|
-
}, rt = /* @__PURE__ */ st(nt, [["__scopeId", "data-v-
|
|
684
|
+
}, rt = /* @__PURE__ */ st(nt, [["__scopeId", "data-v-a6b067e7"]]), lt = {
|
|
685
685
|
"--das-ui-image-viewer-bg-color": { light: "rgba(0, 0, 0, 0.5)" },
|
|
686
686
|
"--das-ui-image-viewer-btn-hover": { light: "#87A9FF" },
|
|
687
687
|
"--das-ui-image-viewer-btn-active": { light: "#276FF5" }
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.das-ui-image-viewer[data-v-
|
|
1
|
+
.das-ui-image-viewer[data-v-a6b067e7]{width:100px;height:100px;box-sizing:border-box;background-color:#e2e7ef;position:relative;border-radius:2px}.das-ui-image-viewer .loading-border[data-v-a6b067e7]{border:1px dashed var(--das-ui-image-upload-border-color)}.das-ui-image-viewer .image-context[data-v-a6b067e7]{width:100%;height:100%}.das-ui-image-viewer .operate-container[data-v-a6b067e7]{visibility:hidden;position:absolute;bottom:0;height:28px;width:100%;background-color:var(--das-ui-image-viewer-bg-color);display:flex;justify-content:center;align-items:center;padding:0 8px}.das-ui-image-viewer .operate-container[data-v-a6b067e7] .m-l-20{margin-left:20px}.das-ui-image-viewer .operate-container[data-v-a6b067e7] .m-t-6{margin-top:6px}.das-ui-image-viewer .operate-container[data-v-a6b067e7] .operate-btn{cursor:pointer}.das-ui-image-viewer .operate-container[data-v-a6b067e7] .operate-btn:hover{fill:var(--das-ui-image-viewer-btn-hover)}.das-ui-image-viewer .operate-container[data-v-a6b067e7] .operate-btn.active,.das-ui-image-viewer .operate-container[data-v-a6b067e7] .operate-btn.visited{fill:var(--das-ui-image-viewer-btn-active)}.das-ui-image-viewer:hover .operate-container[data-v-a6b067e7]{visibility:visible}.image-name[data-v-a6b067e7]{font-size:12px;color:var(--das-ui-color-normal);letter-spacing:0;line-height:18px;font-weight:400;margin-top:4px;width:100px}.das-ui-image-viewer-groups[data-v-a6b067e7]{display:flex}.das-ui-image-viewer-groups .das-ui-image-viewer-container+.das-ui-image-viewer-container[data-v-a6b067e7]{margin-left:28px}.no-data-img[data-v-a6b067e7]{max-width:100%}.das-image-viewer-preview-btn-groups .el-image-viewer__actions,.das-image-viewer-preview-btn-groups .el-image-viewer__actions .el-image-viewer__actions__divider,.das-image-viewer-preview-btn-groups .el-image-viewer__actions .el-icon{display:none}.das-image-viewer-preview-btn-groups.zoom_in,.das-image-viewer-preview-btn-groups.zoom_in .el-image-viewer__actions{display:block}.das-image-viewer-preview-btn-groups.zoom_in .el-image-viewer__actions .el-icon:nth-child(2){display:block}.das-image-viewer-preview-btn-groups.zoom_out,.das-image-viewer-preview-btn-groups.zoom_out .el-image-viewer__actions{display:block}.das-image-viewer-preview-btn-groups.zoom_out .el-image-viewer__actions .el-icon:nth-child(1){display:block}.das-image-viewer-preview-btn-groups.turn_left,.das-image-viewer-preview-btn-groups.turn_left .el-image-viewer__actions{display:block}.das-image-viewer-preview-btn-groups.turn_left .el-image-viewer__actions .el-icon:nth-child(6){display:block}.das-image-viewer-preview-btn-groups.turn_right,.das-image-viewer-preview-btn-groups.turn_right .el-image-viewer__actions{display:block}.das-image-viewer-preview-btn-groups.turn_right .el-image-viewer__actions .el-icon:nth-child(7){display:block}.das-image-viewer-preview-btn-groups.full_screen,.das-image-viewer-preview-btn-groups.full_screen .el-image-viewer__actions{display:block}.das-image-viewer-preview-btn-groups.full_screen .el-image-viewer__actions .el-icon:nth-child(4){display:block}
|
|
Binary file
|