@aplus-frontend/ui 0.2.21 → 0.2.23
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/es/index.mjs +95 -93
- package/es/src/ap-drawer/index.d.ts +8 -0
- package/es/src/ap-drawer/index.mjs +10 -0
- package/es/src/ap-drawer/interface.d.ts +16 -0
- package/es/src/ap-drawer/interface.mjs +1 -0
- package/es/src/ap-drawer/style/css.d.ts +1 -0
- package/es/src/ap-drawer/style/css.js +1 -0
- package/es/src/ap-drawer/style/index.d.ts +1 -0
- package/es/src/ap-drawer/style/index.js +1 -0
- package/es/src/ap-drawer/utils/createDrawer.d.ts +2 -0
- package/es/src/ap-drawer/utils/createDrawer.mjs +82 -0
- package/es/src/ap-drawer/utils/index.d.ts +1 -0
- package/es/src/ap-drawer/utils/index.mjs +4 -0
- package/es/src/ap-modal/interface.d.ts +4 -0
- package/es/src/ap-modal/utils/createModal.mjs +54 -38
- package/es/src/ap-table/ap-table.vue2.mjs +1 -1
- package/es/src/ap-upload/apUploadTypes.d.ts +1 -1
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +30 -30
- package/es/src/ap-upload/components/Picture.vue2.mjs +33 -33
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +40 -40
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +1 -1
- package/es/src/business/batch-input-group/popover-input/index.vue2.mjs +1 -1
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +206 -204
- package/es/src/path-map.mjs +1 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-drawer/index.d.ts +8 -0
- package/lib/src/ap-drawer/index.js +1 -0
- package/lib/src/ap-drawer/interface.d.ts +16 -0
- package/lib/src/ap-drawer/interface.js +1 -0
- package/lib/src/ap-drawer/style/css.d.ts +1 -0
- package/lib/src/ap-drawer/style/css.js +1 -0
- package/lib/src/ap-drawer/style/index.d.ts +1 -0
- package/lib/src/ap-drawer/style/index.js +1 -0
- package/lib/src/ap-drawer/utils/createDrawer.d.ts +2 -0
- package/lib/src/ap-drawer/utils/createDrawer.js +1 -0
- package/lib/src/ap-drawer/utils/index.d.ts +1 -0
- package/lib/src/ap-drawer/utils/index.js +1 -0
- package/lib/src/ap-modal/interface.d.ts +4 -0
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-upload/apUploadTypes.d.ts +1 -1
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/batch-input-group/popover-input/index.vue2.js +1 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as W, inject as
|
|
1
|
+
import { defineComponent as W, inject as s, ref as G, watch as H, nextTick as J, openBlock as x, createElementBlock as C, normalizeClass as K, unref as n, createVNode as k, withCtx as T, createElementVNode as b, createTextVNode as Q, toDisplayString as S, withModifiers as X, createBlock as Y, resolveDynamicComponent as Z, createCommentVNode as ee } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getPath as te, getName as oe, getReturnData as
|
|
4
|
-
import { useOss as
|
|
3
|
+
import { getPath as te, getName as oe, getReturnData as L } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as ae, getOssInstance as se } from "../hooks/useOss.mjs";
|
|
5
5
|
import { message as m, Upload as ne, Button as re } from "@aplus-frontend/antdv";
|
|
6
6
|
import { UploadOutlined as ie } from "@ant-design/icons-vue";
|
|
7
7
|
import { fileMatchesAccept as le, getAcceptText as ue } from "../utils/accept.mjs";
|
|
@@ -9,10 +9,10 @@ import { useLocale as ce } from "../../config-provider/hooks/use-locale.mjs";
|
|
|
9
9
|
import { useNamespace as pe } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
10
|
const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 }, _e = /* @__PURE__ */ W({
|
|
11
11
|
__name: "MultipleFile",
|
|
12
|
-
setup(ge, { expose:
|
|
13
|
-
const { t: r } = ce(), { b:
|
|
12
|
+
setup(ge, { expose: M }) {
|
|
13
|
+
const { t: r } = ce(), { b: U } = pe("ap-upload-multiple-file"), { put: z } = ae(), R = s("theme"), B = s("dirName"), h = s("accept") || "*", E = s("maxSize") ?? 500, I = s("title") || r("ap.apUpload.uploadFile"), f = s("subTitle"), i = s("maxCount") ?? 10, d = s("uploadingCount"), _ = s("beforeUpload"), A = s("customRequest"), P = s("getOssAccess"), O = s("maxSizeErrorMsg"), q = s("maxCountErrorMsg"), D = s("acceptErrorMsg"), a = s("value"), c = [], g = s("needName"), l = G(null);
|
|
14
14
|
H(
|
|
15
|
-
() =>
|
|
15
|
+
() => a == null ? void 0 : a.value,
|
|
16
16
|
function(e) {
|
|
17
17
|
var t, o;
|
|
18
18
|
!((o = (t = l == null ? void 0 : l.value) == null ? void 0 : t.fileList) != null && o.length) && e && F(e);
|
|
@@ -21,7 +21,7 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
21
21
|
);
|
|
22
22
|
function F(e) {
|
|
23
23
|
if (!e) {
|
|
24
|
-
p = [], l.value.fileList = [],
|
|
24
|
+
p = [], l.value.fileList = [], a.value = void 0, c.splice(0, c.length);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
J(() => {
|
|
@@ -46,10 +46,10 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
46
46
|
uid: o.uid,
|
|
47
47
|
path: o.response
|
|
48
48
|
});
|
|
49
|
-
}), l.value.fileList = t,
|
|
49
|
+
}), l.value.fileList = t, a.value = e;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
M({ setValue: F });
|
|
53
53
|
let p = [], N;
|
|
54
54
|
function v(e) {
|
|
55
55
|
setTimeout(() => {
|
|
@@ -59,7 +59,7 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
59
59
|
t >= 0 && l.value.fileList.splice(t, 1);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
function $(e) {
|
|
62
|
+
async function $(e) {
|
|
63
63
|
if (i && i > 1 && p.length >= i)
|
|
64
64
|
return clearTimeout(N), N = setTimeout(() => {
|
|
65
65
|
m.warning(
|
|
@@ -69,13 +69,13 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
69
69
|
);
|
|
70
70
|
}), v(e), !1;
|
|
71
71
|
if (typeof _ == "function") {
|
|
72
|
-
if (_(e) === !1)
|
|
72
|
+
if (await _(e) === !1)
|
|
73
73
|
return v(e), !1;
|
|
74
74
|
} else {
|
|
75
|
-
if (e.size >
|
|
75
|
+
if (e.size > E * 1024 * 1024)
|
|
76
76
|
return m.warning(
|
|
77
77
|
O || r("ap.apUpload.maxUploadFileSize", {
|
|
78
|
-
maxSize:
|
|
78
|
+
maxSize: E
|
|
79
79
|
})
|
|
80
80
|
), v(e), !1;
|
|
81
81
|
if (!le(e, h))
|
|
@@ -83,7 +83,7 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
83
83
|
D || r("ap.apUpload.fileFormatNotSupported")
|
|
84
84
|
), v(e), !1;
|
|
85
85
|
}
|
|
86
|
-
i && i === 1 && (p = [],
|
|
86
|
+
i && i === 1 && (p = [], a.value = void 0), p.push(e);
|
|
87
87
|
}
|
|
88
88
|
async function j(e) {
|
|
89
89
|
if (d.value++, typeof A == "function") {
|
|
@@ -106,9 +106,9 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
106
106
|
onSuccess: (t) => {
|
|
107
107
|
setTimeout(() => {
|
|
108
108
|
e.onSuccess(t);
|
|
109
|
-
}),
|
|
110
|
-
...
|
|
111
|
-
|
|
109
|
+
}), a.value = [
|
|
110
|
+
...a.value || [],
|
|
111
|
+
L(g, t, e.file.name)
|
|
112
112
|
], c.push({
|
|
113
113
|
uid: e.file.uid,
|
|
114
114
|
path: t
|
|
@@ -119,15 +119,15 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
try {
|
|
122
|
-
const t = await
|
|
122
|
+
const t = await se(P);
|
|
123
123
|
e.file.oss = t, z({
|
|
124
124
|
file: e.file,
|
|
125
|
-
dirName:
|
|
125
|
+
dirName: B,
|
|
126
126
|
oss: t,
|
|
127
127
|
successCallBack(o) {
|
|
128
|
-
e.onSuccess(o),
|
|
129
|
-
...
|
|
130
|
-
|
|
128
|
+
e.onSuccess(o), a.value = [
|
|
129
|
+
...a.value || [],
|
|
130
|
+
L(g, o, e.file.name)
|
|
131
131
|
], c.push({
|
|
132
132
|
uid: e.file.uid,
|
|
133
133
|
path: o
|
|
@@ -157,9 +157,9 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
157
157
|
function V(e) {
|
|
158
158
|
var o;
|
|
159
159
|
if (e.response) {
|
|
160
|
-
if (Array.isArray(
|
|
160
|
+
if (Array.isArray(a.value)) {
|
|
161
161
|
const u = c.findIndex((y) => y.uid === e.uid);
|
|
162
|
-
u >= 0 && (
|
|
162
|
+
u >= 0 && (a == null || a.value.splice(u, 1), c.splice(u, 1)), a.value.length === 0 && (a.value = void 0);
|
|
163
163
|
}
|
|
164
164
|
} else
|
|
165
165
|
(o = e == null ? void 0 : e.oss) == null || o.pauseUpload();
|
|
@@ -170,8 +170,8 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
170
170
|
}
|
|
171
171
|
return (e, t) => (x(), C("div", {
|
|
172
172
|
class: K({
|
|
173
|
-
[n(
|
|
174
|
-
[n(
|
|
173
|
+
[n(U)()]: !0,
|
|
174
|
+
[n(U)("admin")]: n(R) === "admin"
|
|
175
175
|
})
|
|
176
176
|
}, [
|
|
177
177
|
k(n(ne), {
|
|
@@ -190,20 +190,20 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
190
190
|
onRemove: V
|
|
191
191
|
}, {
|
|
192
192
|
default: T(() => [
|
|
193
|
-
|
|
193
|
+
b("div", me, [
|
|
194
194
|
k(n(re), { class: "file-btn" }, {
|
|
195
195
|
default: T(() => [
|
|
196
196
|
k(n(ie)),
|
|
197
|
-
Q(" " +
|
|
197
|
+
Q(" " + S(n(I)), 1)
|
|
198
198
|
]),
|
|
199
199
|
_: 1
|
|
200
200
|
}),
|
|
201
|
-
|
|
201
|
+
b("div", {
|
|
202
202
|
class: "sub-title",
|
|
203
203
|
onClick: t[0] || (t[0] = X(() => {
|
|
204
204
|
}, ["stop"]))
|
|
205
205
|
}, [
|
|
206
|
-
typeof n(f) == "string" ? (x(), C("div", de,
|
|
206
|
+
typeof n(f) == "string" ? (x(), C("div", de, S(n(f) || `${n(r)("ap.apUpload.supportExtension")}:${n(ue)(n(h))}`), 1)) : n(f) ? (x(), C("div", fe, [
|
|
207
207
|
(x(), Y(Z(n(f))))
|
|
208
208
|
])) : ee("", !0)
|
|
209
209
|
])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as X, inject as c, ref as
|
|
1
|
+
import { defineComponent as X, inject as c, ref as R, watch as Y, nextTick as Z, openBlock as g, createElementBlock as h, normalizeClass as F, unref as i, createElementVNode as d, renderSlot as ee, Fragment as te, renderList as ne, withDirectives as ae, createVNode as C, createCommentVNode as I, vShow as se, toDisplayString as U } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getPath as oe, getName as ie, getReturnData as
|
|
3
|
+
import { getPath as oe, getName as ie, getReturnData as M } from "../utils/returnData.mjs";
|
|
4
4
|
import { CloseOutlined as re, PlusOutlined as ce } from "@ant-design/icons-vue";
|
|
5
5
|
import { useOss as ue, getOssInstance as $ } from "../hooks/useOss.mjs";
|
|
6
6
|
import { fileMatchesAccept as le, getAcceptText as pe } from "../utils/accept.mjs";
|
|
@@ -8,24 +8,24 @@ import { message as m, Progress as de } from "@aplus-frontend/antdv";
|
|
|
8
8
|
import { omit as me } from "lodash-unified";
|
|
9
9
|
import { useLocale as fe } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
10
|
import { useNamespace as ge } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture-item-box" },
|
|
11
|
+
const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture-item-box" }, ye = ["src"], _e = { class: "picture-item-shadow" }, we = ["onClick"], Ce = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "picture-item-uploading"
|
|
14
|
-
},
|
|
14
|
+
}, Ue = { class: "picture-title" }, ke = { key: 0 }, Se = { key: 1 }, De = /* @__PURE__ */ X({
|
|
15
15
|
__name: "Picture",
|
|
16
16
|
setup(Ee, { expose: T }) {
|
|
17
|
-
const { t: u } = fe(), { b:
|
|
18
|
-
let s =
|
|
17
|
+
const { t: u } = fe(), { b: k } = ge("ap-upload-picture"), { put: D } = ue(), O = c("theme"), B = c("dirName"), _ = c("accept") || "image/*", w = c("maxSize") ?? 5, S = c("title"), l = c("maxCount") ?? 10, v = c("uploadingCount"), E = c("beforeUpload"), b = c("customRequest"), z = c("getOssAccess"), L = c("maxSizeErrorMsg"), q = c("maxCountErrorMsg"), V = c("acceptErrorMsg"), x = R(null), r = c("value"), y = c("needName");
|
|
18
|
+
let s = R([]);
|
|
19
19
|
const f = [];
|
|
20
20
|
Y(
|
|
21
21
|
() => r == null ? void 0 : r.value,
|
|
22
22
|
async function(e) {
|
|
23
23
|
var a;
|
|
24
|
-
!((a = s == null ? void 0 : s.value) != null && a.length) && e &&
|
|
24
|
+
!((a = s == null ? void 0 : s.value) != null && a.length) && e && A(e);
|
|
25
25
|
},
|
|
26
26
|
{ immediate: !0 }
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function A(e) {
|
|
29
29
|
if (!e) {
|
|
30
30
|
r.value = void 0, f.splice(0, f.length), s.value = [];
|
|
31
31
|
return;
|
|
@@ -33,7 +33,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
33
33
|
Z(async () => {
|
|
34
34
|
const a = [];
|
|
35
35
|
for (let t of e) {
|
|
36
|
-
const n = oe(
|
|
36
|
+
const n = oe(y, t), o = ie(y, t), p = await $(z), Q = await p.getSignatureUrl(n), W = {
|
|
37
37
|
...typeof t == "string" ? {} : t,
|
|
38
38
|
...new File([t], o, {}),
|
|
39
39
|
uid: `${(/* @__PURE__ */ new Date()).getTime()}-${Math.random()}`,
|
|
@@ -60,7 +60,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
60
60
|
}), r.value = e;
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
T({ setValue:
|
|
63
|
+
T({ setValue: A });
|
|
64
64
|
function j() {
|
|
65
65
|
var e;
|
|
66
66
|
(e = x.value) == null || e.click();
|
|
@@ -75,23 +75,23 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
75
75
|
J(e[a]);
|
|
76
76
|
x.value && (x.value.value = "");
|
|
77
77
|
}
|
|
78
|
-
let
|
|
79
|
-
function J(e) {
|
|
78
|
+
let N;
|
|
79
|
+
async function J(e) {
|
|
80
80
|
if (l && l > 1 && s.value.length >= l)
|
|
81
|
-
return clearTimeout(
|
|
81
|
+
return clearTimeout(N), N = setTimeout(() => {
|
|
82
82
|
m.warning(
|
|
83
83
|
q || u("ap.apUpload.maxUploadPicture", { maxCount: l })
|
|
84
84
|
);
|
|
85
85
|
}), !1;
|
|
86
86
|
if (typeof E == "function") {
|
|
87
|
-
if (E(e) === !1)
|
|
87
|
+
if (await E(e) === !1)
|
|
88
88
|
return !1;
|
|
89
89
|
} else {
|
|
90
90
|
if (e.size > w * 1024 * 1024)
|
|
91
91
|
return m.warning(
|
|
92
92
|
L || u("ap.apUpload.maxUploadFileSize", { maxSize: w })
|
|
93
93
|
), !1;
|
|
94
|
-
if (!/image\/\w+/.test(e.type) || !le(e,
|
|
94
|
+
if (!/image\/\w+/.test(e.type) || !le(e, _))
|
|
95
95
|
return m.warning(
|
|
96
96
|
V || u("ap.apUpload.pictureFormatNotSupported")
|
|
97
97
|
), !1;
|
|
@@ -111,8 +111,8 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
async function K(e, a) {
|
|
114
|
-
if (v.value++, typeof
|
|
115
|
-
|
|
114
|
+
if (v.value++, typeof b == "function") {
|
|
115
|
+
b({
|
|
116
116
|
onProgress: (t) => {
|
|
117
117
|
const n = s.value.find((o) => o.uid === e.uid);
|
|
118
118
|
n && (n.percent = t);
|
|
@@ -128,7 +128,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
128
128
|
const n = s.value.find((o) => o.uid === e.uid);
|
|
129
129
|
n && (n.status = "success", n.path = t), r.value = [
|
|
130
130
|
...r.value || [],
|
|
131
|
-
|
|
131
|
+
M(y, t, a.name)
|
|
132
132
|
], f.push({
|
|
133
133
|
uid: e.uid,
|
|
134
134
|
path: t
|
|
@@ -139,7 +139,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
try {
|
|
142
|
-
const t = await $(
|
|
142
|
+
const t = await $(z);
|
|
143
143
|
e.oss = t, s.value.push(e), D({
|
|
144
144
|
file: a,
|
|
145
145
|
dirName: B,
|
|
@@ -148,7 +148,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
148
148
|
const o = s.value.find((p) => p.uid === e.uid);
|
|
149
149
|
o && (o.status = "success", o.path = n), r.value = [
|
|
150
150
|
...r.value || [],
|
|
151
|
-
|
|
151
|
+
M(y, n, a.name)
|
|
152
152
|
], f.push({
|
|
153
153
|
uid: e.uid,
|
|
154
154
|
path: n
|
|
@@ -174,7 +174,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
174
174
|
n > -1 && s.value.splice(n, 1), v.value--;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function P(e) {
|
|
178
178
|
var t;
|
|
179
179
|
if (e.path && r) {
|
|
180
180
|
if (Array.isArray(r.value)) {
|
|
@@ -192,8 +192,8 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
192
192
|
}
|
|
193
193
|
return (e, a) => (g(), h("div", {
|
|
194
194
|
class: F({
|
|
195
|
-
[i(
|
|
196
|
-
[i(
|
|
195
|
+
[i(k)()]: !0,
|
|
196
|
+
[i(k)("admin")]: i(O) === "admin"
|
|
197
197
|
})
|
|
198
198
|
}, [
|
|
199
199
|
d("input", {
|
|
@@ -201,7 +201,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
201
201
|
type: "file",
|
|
202
202
|
ref_key: "fileRef",
|
|
203
203
|
ref: x,
|
|
204
|
-
accept: i(
|
|
204
|
+
accept: i(_),
|
|
205
205
|
onChange: G
|
|
206
206
|
}, null, 40, he),
|
|
207
207
|
d("div", ve, [
|
|
@@ -215,7 +215,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
}),
|
|
218
|
-
remove:
|
|
218
|
+
remove: P
|
|
219
219
|
}, () => [
|
|
220
220
|
(g(!0), h(te, null, ne(i(s), (t) => (g(), h("div", {
|
|
221
221
|
key: t.uid,
|
|
@@ -225,11 +225,11 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
225
225
|
d("img", {
|
|
226
226
|
src: t.thumbUrl,
|
|
227
227
|
alt: ""
|
|
228
|
-
}, null, 8,
|
|
229
|
-
ae(d("div",
|
|
228
|
+
}, null, 8, ye),
|
|
229
|
+
ae(d("div", _e, [
|
|
230
230
|
d("div", {
|
|
231
231
|
class: "picture-item-close",
|
|
232
|
-
onClick: (n) =>
|
|
232
|
+
onClick: (n) => P(t)
|
|
233
233
|
}, [
|
|
234
234
|
C(i(re))
|
|
235
235
|
], 8, we),
|
|
@@ -241,7 +241,7 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
241
241
|
size: 4,
|
|
242
242
|
showInfo: !1
|
|
243
243
|
}, null, 8, ["percent"])
|
|
244
|
-
])) :
|
|
244
|
+
])) : I("", !0)
|
|
245
245
|
], 512), [
|
|
246
246
|
[se, t.status === "uploading"]
|
|
247
247
|
])
|
|
@@ -254,11 +254,11 @@ const he = ["accept"], ve = { class: "picture-context" }, xe = { class: "picture
|
|
|
254
254
|
onClick: j
|
|
255
255
|
}, [
|
|
256
256
|
C(i(ce)),
|
|
257
|
-
d("div", null,
|
|
258
|
-
])) :
|
|
257
|
+
d("div", null, U(i(u)("ap.apUpload.update")), 1)
|
|
258
|
+
])) : I("", !0)
|
|
259
259
|
]),
|
|
260
|
-
d("div",
|
|
261
|
-
i(S) ? (g(), h("div",
|
|
260
|
+
d("div", Ue, [
|
|
261
|
+
i(S) ? (g(), h("div", ke, U(i(S)), 1)) : (g(), h("div", Se, U(`${i(u)("ap.apUpload.supportExtension")}:${i(pe)(i(_))},${i(u)(
|
|
262
262
|
"ap.apUpload.maxUploadPictureSize",
|
|
263
263
|
{ maxSize: i(w) }
|
|
264
264
|
)}`), 1))
|
|
@@ -8,54 +8,54 @@ import { DeleteOutlined as he } from "@ant-design/icons-vue";
|
|
|
8
8
|
import q from "../assets/single-file-icon.png.mjs";
|
|
9
9
|
import { useLocale as _e } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
10
|
import { useNamespace as ke } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
-
const ye = ["accept"],
|
|
11
|
+
const ye = ["accept"], we = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "state-un"
|
|
14
|
-
},
|
|
14
|
+
}, De = ["src"], Ce = { class: "state-un-title" }, Ue = { class: "state-un-subtitle" }, Fe = {
|
|
15
15
|
key: 1,
|
|
16
16
|
class: "state-ing"
|
|
17
17
|
}, Ee = { class: "left" }, Se = ["src"], Ne = { class: "center" }, xe = { class: "center-progress" }, $e = /* @__PURE__ */ ne({
|
|
18
18
|
__name: "SingleFile",
|
|
19
19
|
setup(ze, { expose: j }) {
|
|
20
|
-
const { t: r } = _e(), { b: k } = ke("ap-upload-single-file"), { put: G, client:
|
|
20
|
+
const { t: r } = _e(), { b: k } = ke("ap-upload-single-file"), { put: G, client: b } = ve(), y = s("theme"), W = s("dirName"), w = s("accept") || "*", D = s("maxSize") ?? 500, H = s("title") || r("ap.apUpload.clickOrDragUpload"), C = s("subTitle"), n = s("value"), U = s("needName"), p = s("uploadingCount"), B = s("beforeUpload"), R = s("customRequest"), J = s("getOssAccess"), K = s("maxSizeErrorMsg"), Q = s("acceptErrorMsg"), o = h(null);
|
|
21
21
|
oe(
|
|
22
22
|
() => n == null ? void 0 : n.value,
|
|
23
23
|
function(e) {
|
|
24
|
-
o.value === null && e &&
|
|
24
|
+
o.value === null && e && M(e);
|
|
25
25
|
},
|
|
26
26
|
{ immediate: !0 }
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function M(e) {
|
|
29
29
|
e ? setTimeout(() => {
|
|
30
|
-
const t = pe(
|
|
30
|
+
const t = pe(U, e);
|
|
31
31
|
l.value = 3, o.value = new File([e], t, {}), n.value = e;
|
|
32
32
|
}) : (l.value = 1, o.value = null, n.value = void 0);
|
|
33
33
|
}
|
|
34
|
-
j({ setValue:
|
|
35
|
-
const l = h(1), f = h(0), m = h(null),
|
|
34
|
+
j({ setValue: M });
|
|
35
|
+
const l = h(1), f = h(0), m = h(null), O = le(() => o.value && (n == null ? void 0 : n.value));
|
|
36
36
|
function X() {
|
|
37
37
|
var e;
|
|
38
38
|
l.value === 1 && ((e = m.value) == null || e.click());
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function P(e) {
|
|
41
41
|
e.preventDefault(), e.stopPropagation();
|
|
42
42
|
}
|
|
43
43
|
function Y(e) {
|
|
44
44
|
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
45
45
|
}
|
|
46
46
|
function Z(e) {
|
|
47
|
-
|
|
47
|
+
T(e);
|
|
48
48
|
}
|
|
49
49
|
function V(e) {
|
|
50
50
|
if (e.preventDefault(), e.stopPropagation(), l.value !== 1)
|
|
51
51
|
return;
|
|
52
|
-
var t = e.dataTransfer, c = [],
|
|
52
|
+
var t = e.dataTransfer, c = [], L = 0, I = t.files.length;
|
|
53
53
|
function v() {
|
|
54
|
-
|
|
54
|
+
L === I - 1 && Z(c), L++;
|
|
55
55
|
}
|
|
56
56
|
if (t.items !== void 0)
|
|
57
|
-
for (var
|
|
58
|
-
var E = t.items[
|
|
57
|
+
for (var F = 0; F < t.items.length; F++) {
|
|
58
|
+
var E = t.items[F];
|
|
59
59
|
if (E.kind === "file" && E.webkitGetAsEntry().isFile) {
|
|
60
60
|
var ae = E.getAsFile();
|
|
61
61
|
c.push(ae), v();
|
|
@@ -87,33 +87,33 @@ const ye = ["accept"], De = {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
function ee(e) {
|
|
90
|
+
async function ee(e) {
|
|
91
91
|
const t = e.target;
|
|
92
|
-
|
|
92
|
+
await T(t == null ? void 0 : t.files), m.value && (m.value.value = "");
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
94
|
+
async function T(e) {
|
|
95
95
|
if (e != null && e.length) {
|
|
96
|
-
if (typeof
|
|
97
|
-
if (
|
|
96
|
+
if (typeof B == "function") {
|
|
97
|
+
if (await B(e[0]) === !1)
|
|
98
98
|
return;
|
|
99
99
|
} else {
|
|
100
|
-
if (e[0].size >
|
|
100
|
+
if (e[0].size > D * 1024 * 1024) {
|
|
101
101
|
u.warning(
|
|
102
102
|
K || r("ap.apUpload.maxUploadFileSize", {
|
|
103
|
-
maxSize:
|
|
103
|
+
maxSize: D
|
|
104
104
|
})
|
|
105
105
|
);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
if (!fe(e[0],
|
|
108
|
+
if (!fe(e[0], w)) {
|
|
109
109
|
u.warning(
|
|
110
110
|
Q || r("ap.apUpload.fileFormatNotSupported")
|
|
111
111
|
);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
if (o.value = e[0], l.value = 2, f.value = 0, p.value++, typeof
|
|
116
|
-
|
|
115
|
+
if (o.value = e[0], l.value = 2, f.value = 0, p.value++, typeof R == "function") {
|
|
116
|
+
R({
|
|
117
117
|
onProgress: (t) => {
|
|
118
118
|
f.value = t;
|
|
119
119
|
},
|
|
@@ -122,7 +122,7 @@ const ye = ["accept"], De = {
|
|
|
122
122
|
},
|
|
123
123
|
onSuccess: (t) => {
|
|
124
124
|
n.value = $(
|
|
125
|
-
|
|
125
|
+
U,
|
|
126
126
|
t,
|
|
127
127
|
o.value.name
|
|
128
128
|
), l.value = 3, p.value--;
|
|
@@ -135,10 +135,10 @@ const ye = ["accept"], De = {
|
|
|
135
135
|
await de(J), G({
|
|
136
136
|
file: o.value,
|
|
137
137
|
dirName: W,
|
|
138
|
-
oss:
|
|
138
|
+
oss: b,
|
|
139
139
|
successCallBack(t) {
|
|
140
140
|
n.value = $(
|
|
141
|
-
|
|
141
|
+
U,
|
|
142
142
|
t,
|
|
143
143
|
o.value.name
|
|
144
144
|
), l.value = 3, p.value--;
|
|
@@ -158,7 +158,7 @@ const ye = ["accept"], De = {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
function te() {
|
|
161
|
-
o.value && !(n != null && n.value) &&
|
|
161
|
+
o.value && !(n != null && n.value) && b.pauseUpload(), l.value = 1, o.value = null, n.value = void 0;
|
|
162
162
|
}
|
|
163
163
|
return (e, t) => {
|
|
164
164
|
var c;
|
|
@@ -169,9 +169,9 @@ const ye = ["accept"], De = {
|
|
|
169
169
|
[a(k)("un")]: l.value === 1
|
|
170
170
|
}),
|
|
171
171
|
onClick: X,
|
|
172
|
-
onDragenter:
|
|
172
|
+
onDragenter: P,
|
|
173
173
|
onDragover: Y,
|
|
174
|
-
onDragleave:
|
|
174
|
+
onDragleave: P,
|
|
175
175
|
onDrop: V
|
|
176
176
|
}, [
|
|
177
177
|
i("input", {
|
|
@@ -179,22 +179,22 @@ const ye = ["accept"], De = {
|
|
|
179
179
|
type: "file",
|
|
180
180
|
ref_key: "fileRef",
|
|
181
181
|
ref: m,
|
|
182
|
-
accept: a(
|
|
182
|
+
accept: a(w),
|
|
183
183
|
onChange: ee
|
|
184
184
|
}, null, 40, ye),
|
|
185
|
-
l.value === 1 ? (_(), x("div",
|
|
185
|
+
l.value === 1 ? (_(), x("div", we, [
|
|
186
186
|
i("img", {
|
|
187
187
|
class: "state-un-icon",
|
|
188
188
|
src: a(q)
|
|
189
|
-
}, null, 8,
|
|
190
|
-
i("div",
|
|
191
|
-
i("div",
|
|
192
|
-
a(
|
|
189
|
+
}, null, 8, De),
|
|
190
|
+
i("div", Ce, z(a(H)), 1),
|
|
191
|
+
i("div", Ue, z(typeof a(C) == "string" && a(C).length > 0 ? a(C) : `${a(r)("ap.apUpload.supportExtension")}:${a(me)(
|
|
192
|
+
a(w)
|
|
193
193
|
)},${a(r)("ap.apUpload.maxWarnUploadFileSize", {
|
|
194
|
-
maxSize: a(
|
|
194
|
+
maxSize: a(D)
|
|
195
195
|
})}`), 1)
|
|
196
196
|
])) : A("", !0),
|
|
197
|
-
[2, 3].includes(l.value) ? (_(), x("div",
|
|
197
|
+
[2, 3].includes(l.value) ? (_(), x("div", Fe, [
|
|
198
198
|
i("div", Ee, [
|
|
199
199
|
i("img", { src: a(q) }, null, 8, Se)
|
|
200
200
|
]),
|
|
@@ -202,11 +202,11 @@ const ye = ["accept"], De = {
|
|
|
202
202
|
i("div", {
|
|
203
203
|
class: "center-title",
|
|
204
204
|
style: re({
|
|
205
|
-
color:
|
|
205
|
+
color: O.value ? "#0070FF" : "#182948"
|
|
206
206
|
})
|
|
207
207
|
}, z((c = o.value) == null ? void 0 : c.name), 5),
|
|
208
208
|
i("div", xe, [
|
|
209
|
-
|
|
209
|
+
O.value ? A("", !0) : (_(), ie(a(ge), {
|
|
210
210
|
key: 0,
|
|
211
211
|
percent: f.value,
|
|
212
212
|
size: 4,
|
|
@@ -27,7 +27,7 @@ const X = ["onClick"], de = /* @__PURE__ */ T({
|
|
|
27
27
|
const { b: $, e: i, em: C } = K("ap-appendix"), { t: y } = Q(), e = O, x = w("apUpload"), k = w(
|
|
28
28
|
"downloadCenterTriggerConfig"
|
|
29
29
|
), f = d(
|
|
30
|
-
() => J(e == null ? void 0 : e.needName, e == null ? void 0 : e.fileList)
|
|
30
|
+
() => J(e == null ? void 0 : e.needName, (e == null ? void 0 : e.fileList) ?? [])
|
|
31
31
|
), B = d(
|
|
32
32
|
() => {
|
|
33
33
|
var l;
|
package/es/src/index.d.ts
CHANGED