@aplus-frontend/ui 7.10.4 → 7.10.6
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/src/ap-field/interface.d.ts +1 -1
- package/es/src/ap-field/slider/index.vue.d.ts +196 -412
- package/es/src/ap-field/slider/index.vue.mjs +50 -39
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +68 -67
- package/es/src/business/ap-attachment/ApAttachment.d.ts +2 -8
- package/es/src/business/ap-attachment/ApAttachment.mjs +46 -40
- package/es/src/business/ap-attachment/constans.d.ts +1 -4
- package/es/src/business/ap-attachment/constans.mjs +3 -6
- package/es/src/business/ap-attachment/index.d.ts +3 -12
- package/es/src/business/ap-ladder/components/RenderValue.mjs +25 -22
- package/es/src/business/ap-ladder/utils.d.ts +1 -0
- package/es/src/business/ap-ladder/utils.mjs +10 -9
- package/es/src/business/ap-title/ApTitle.vue.d.ts +1 -1
- package/es/src/business/ap-title/index.d.ts +3 -3
- package/es/src/business/ap-title/interface.d.ts +1 -1
- package/es/src/business/ap-upload/apUpload.vue.d.ts +9 -0
- package/es/src/business/ap-upload/apUpload.vue.mjs +22 -18
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +128 -123
- package/es/src/business/ap-upload/components/Picture.vue2.mjs +150 -147
- package/es/src/business/ap-upload/components/SingleFile.vue2.mjs +130 -127
- package/es/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/es/src/business/ap-upload/hooks/useOss.mjs +52 -51
- package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.mjs +11 -10
- package/es/src/business/ap-upload-file/hook/useOss.d.ts +6 -1
- package/es/src/business/ap-upload-file/hook/useOss.mjs +19 -16
- package/es/src/business/ap-upload-file/interface.d.ts +3 -1
- package/es/src/business/ap-upload-file/utils/upload.mjs +22 -20
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-field/interface.d.ts +1 -1
- package/lib/src/ap-field/slider/index.vue.d.ts +196 -412
- package/lib/src/ap-field/slider/index.vue.js +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.d.ts +2 -8
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/constans.d.ts +1 -4
- package/lib/src/business/ap-attachment/constans.js +1 -1
- package/lib/src/business/ap-attachment/index.d.ts +3 -12
- package/lib/src/business/ap-ladder/components/RenderValue.js +1 -1
- package/lib/src/business/ap-ladder/utils.d.ts +1 -0
- package/lib/src/business/ap-ladder/utils.js +1 -1
- package/lib/src/business/ap-title/ApTitle.vue.d.ts +1 -1
- package/lib/src/business/ap-title/index.d.ts +3 -3
- package/lib/src/business/ap-title/interface.d.ts +1 -1
- package/lib/src/business/ap-upload/apUpload.vue.d.ts +9 -0
- package/lib/src/business/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/business/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/hooks/useOss.d.ts +2 -1
- package/lib/src/business/ap-upload/hooks/useOss.js +1 -1
- package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.js +1 -1
- package/lib/src/business/ap-upload-file/hook/useOss.d.ts +6 -1
- package/lib/src/business/ap-upload-file/hook/useOss.js +1 -1
- package/lib/src/business/ap-upload-file/interface.d.ts +3 -1
- package/lib/src/business/ap-upload-file/utils/upload.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { UploadOutlined as
|
|
3
|
-
import { message as
|
|
1
|
+
import { defineComponent as Y, inject as a, ref as Z, watch as ee, nextTick as oe, createElementBlock as b, openBlock as x, normalizeClass as te, unref as n, createVNode as y, withCtx as U, createElementVNode as S, createTextVNode as ae, toDisplayString as L, withModifiers as se, createCommentVNode as ne, createBlock as re, resolveDynamicComponent as le } from "vue";
|
|
2
|
+
import { UploadOutlined as ie, VerticalAlignBottomOutlined as ce } from "@ant-design/icons-vue";
|
|
3
|
+
import { message as p, Upload as ue, Button as pe } from "@aplus-frontend/antdv";
|
|
4
4
|
import "../../../config-provider/index.mjs";
|
|
5
|
-
import { useOss as
|
|
6
|
-
import
|
|
7
|
-
import { fileMatchesAccept as
|
|
8
|
-
import { getPath as
|
|
9
|
-
import { useGlobalConfig as
|
|
10
|
-
import { useLocale as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
const
|
|
5
|
+
import { useOss as de, getOssInstance as z } from "../hooks/useOss.mjs";
|
|
6
|
+
import me from "../style/index.mjs";
|
|
7
|
+
import { fileMatchesAccept as fe, getAcceptText as ge } from "../utils/accept.mjs";
|
|
8
|
+
import { getPath as he, getName as ve, getReturnData as B } from "../utils/returnData.mjs";
|
|
9
|
+
import { useGlobalConfig as we } from "../../../config-provider/hooks/use-global-config.mjs";
|
|
10
|
+
import { useLocale as xe } from "../../../config-provider/hooks/use-locale.mjs";
|
|
11
|
+
import { useNamespace as ye } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
const ke = { class: "multiple-file-context" }, Ce = { key: 0 }, be = { key: 1 }, ze = /* @__PURE__ */ Y({
|
|
13
13
|
__name: "MultipleFile",
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
14
|
+
setup(Ue, { expose: D }) {
|
|
15
|
+
const N = we(
|
|
16
16
|
"downloadCenterTriggerConfig"
|
|
17
|
-
), { t:
|
|
18
|
-
|
|
19
|
-
() =>
|
|
17
|
+
), { t: l } = xe(), { b: O } = ye("ap-upload-multiple-file"), P = me("ap-upload"), { put: V } = de(), q = a("dirName"), j = a("baseDirName"), k = a("accept") || "*", E = a("maxSize") ?? 500, $ = a("title") || l("ap.apUpload.uploadFile"), f = a("subTitle"), i = a("maxCount") ?? 10, d = a("uploadingCount"), _ = a("beforeUpload"), F = a("customRequest"), g = a("getOssAccess"), G = a("maxSizeErrorMsg"), W = a("maxCountErrorMsg"), H = a("acceptErrorMsg"), T = a("onRemove"), C = a("showUploadErrorMsg"), A = a("bucket"), r = a("value"), c = [], h = a("needName"), m = Z(null);
|
|
18
|
+
ee(
|
|
19
|
+
() => r?.value,
|
|
20
20
|
function(e) {
|
|
21
|
-
!
|
|
21
|
+
!m?.value?.fileList?.length && e && R(e);
|
|
22
22
|
},
|
|
23
23
|
{ immediate: !0 }
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function R(e) {
|
|
26
26
|
if (!e) {
|
|
27
|
-
u = [],
|
|
27
|
+
u = [], m.value.fileList = [], r.value = void 0, c.splice(0, c.length);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
oe(() => {
|
|
31
31
|
const o = e.map((t) => {
|
|
32
|
-
const
|
|
32
|
+
const s = he(h, t), M = ve(h, t), w = new File(
|
|
33
33
|
[t],
|
|
34
|
-
|
|
34
|
+
M,
|
|
35
35
|
{}
|
|
36
36
|
);
|
|
37
|
-
return
|
|
37
|
+
return w.response = s, w.uid = s, w.status = "done", w;
|
|
38
38
|
});
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
maxCount:
|
|
39
|
+
if (i && o.length > i) {
|
|
40
|
+
p.warning(
|
|
41
|
+
l("ap.apUpload.fileInitializationException", {
|
|
42
|
+
maxCount: i
|
|
43
43
|
})
|
|
44
44
|
);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
o.forEach((t) => {
|
|
48
|
-
u.push(t),
|
|
48
|
+
u.push(t), c.push({
|
|
49
49
|
uid: t.uid,
|
|
50
50
|
path: t.response
|
|
51
51
|
});
|
|
52
|
-
}),
|
|
52
|
+
}), m.value.fileList = o, r.value = e;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
let u = [],
|
|
57
|
-
function
|
|
55
|
+
D({ setValue: R });
|
|
56
|
+
let u = [], I;
|
|
57
|
+
function v(e) {
|
|
58
58
|
setTimeout(() => {
|
|
59
|
-
const o =
|
|
59
|
+
const o = m.value.fileList.findIndex(
|
|
60
60
|
(t) => t.uid === e.uid
|
|
61
61
|
);
|
|
62
|
-
o >= 0 &&
|
|
62
|
+
o >= 0 && m.value.fileList.splice(o, 1);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
async function
|
|
66
|
-
if (
|
|
67
|
-
return clearTimeout(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
maxCount:
|
|
65
|
+
async function J(e) {
|
|
66
|
+
if (i && i > 1 && u.length >= i)
|
|
67
|
+
return clearTimeout(I), I = setTimeout(() => {
|
|
68
|
+
p.warning(
|
|
69
|
+
W || l("ap.apUpload.maxUploadFiles", {
|
|
70
|
+
maxCount: i
|
|
71
71
|
})
|
|
72
72
|
);
|
|
73
|
-
}),
|
|
74
|
-
if (e.size >
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
maxSize:
|
|
73
|
+
}), v(e), !1;
|
|
74
|
+
if (e.size > E * 1024 * 1024)
|
|
75
|
+
return p.warning(
|
|
76
|
+
G || l("ap.apUpload.maxUploadFileSize", {
|
|
77
|
+
maxSize: E
|
|
78
78
|
})
|
|
79
|
-
),
|
|
80
|
-
if (!
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
),
|
|
84
|
-
if (typeof
|
|
85
|
-
return
|
|
86
|
-
|
|
79
|
+
), v(e), !1;
|
|
80
|
+
if (!fe(e, k))
|
|
81
|
+
return p.warning(
|
|
82
|
+
H || l("ap.apUpload.fileFormatNotSupported")
|
|
83
|
+
), v(e), !1;
|
|
84
|
+
if (typeof _ == "function" && await _(e) === !1)
|
|
85
|
+
return v(e), !1;
|
|
86
|
+
i && i === 1 && (u = [], r.value = void 0), u.push(e);
|
|
87
87
|
}
|
|
88
|
-
async function
|
|
89
|
-
if (
|
|
90
|
-
|
|
88
|
+
async function K(e) {
|
|
89
|
+
if (d.value++, typeof F == "function") {
|
|
90
|
+
F({
|
|
91
91
|
onProgress: (o) => {
|
|
92
92
|
setTimeout(() => {
|
|
93
93
|
e.onProgress({
|
|
@@ -96,70 +96,71 @@ const ye = { class: "multiple-file-context" }, Ce = { key: 0 }, Ue = { key: 1 },
|
|
|
96
96
|
});
|
|
97
97
|
},
|
|
98
98
|
onError: (o) => {
|
|
99
|
-
C &&
|
|
99
|
+
C && p.warning(o || l("ap.apUpload.networkAnomaly")), setTimeout(() => {
|
|
100
100
|
e.onError({
|
|
101
101
|
name: o,
|
|
102
102
|
message: o
|
|
103
103
|
});
|
|
104
|
-
}),
|
|
104
|
+
}), d.value--;
|
|
105
105
|
},
|
|
106
106
|
onSuccess: (o) => {
|
|
107
107
|
setTimeout(() => {
|
|
108
108
|
e.onSuccess(o);
|
|
109
|
-
}),
|
|
110
|
-
...
|
|
111
|
-
|
|
112
|
-
],
|
|
109
|
+
}), r.value = [
|
|
110
|
+
...r.value || [],
|
|
111
|
+
B(h, o, e.file.name)
|
|
112
|
+
], c.push({
|
|
113
113
|
uid: e.file.uid,
|
|
114
114
|
path: o
|
|
115
|
-
}),
|
|
115
|
+
}), d.value--;
|
|
116
116
|
},
|
|
117
117
|
file: e.file
|
|
118
118
|
});
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
try {
|
|
122
|
-
const o = await
|
|
123
|
-
e.file.oss =
|
|
122
|
+
const o = await (A ? g(A) : g()), t = await z(async () => o);
|
|
123
|
+
e.file.oss = t, V({
|
|
124
124
|
file: e.file,
|
|
125
|
-
dirName:
|
|
126
|
-
oss:
|
|
127
|
-
successCallBack(
|
|
128
|
-
e.onSuccess(
|
|
129
|
-
...
|
|
130
|
-
|
|
131
|
-
],
|
|
125
|
+
dirName: q,
|
|
126
|
+
oss: t,
|
|
127
|
+
successCallBack(s) {
|
|
128
|
+
e.onSuccess(s), r.value = [
|
|
129
|
+
...r.value || [],
|
|
130
|
+
B(h, s, e.file.name)
|
|
131
|
+
], c.push({
|
|
132
132
|
uid: e.file.uid,
|
|
133
|
-
path:
|
|
134
|
-
}),
|
|
133
|
+
path: s
|
|
134
|
+
}), d.value--;
|
|
135
135
|
},
|
|
136
|
-
errorCallBack(
|
|
137
|
-
C &&
|
|
138
|
-
name:
|
|
139
|
-
message:
|
|
140
|
-
}),
|
|
136
|
+
errorCallBack(s) {
|
|
137
|
+
C && p.warning(s || l("ap.apUpload.networkAnomaly")), e.onError({
|
|
138
|
+
name: s,
|
|
139
|
+
message: s
|
|
140
|
+
}), d.value--;
|
|
141
141
|
},
|
|
142
|
-
progressCallBack(
|
|
142
|
+
progressCallBack(s) {
|
|
143
143
|
e.onProgress({
|
|
144
|
-
percent:
|
|
144
|
+
percent: s
|
|
145
145
|
});
|
|
146
146
|
},
|
|
147
|
-
baseDirName:
|
|
147
|
+
baseDirName: j,
|
|
148
|
+
bucket: o?.bucket
|
|
148
149
|
});
|
|
149
150
|
} catch (o) {
|
|
150
|
-
C &&
|
|
151
|
-
typeof o?.message == "string" ? o.message :
|
|
151
|
+
C && p.warning(
|
|
152
|
+
typeof o?.message == "string" ? o.message : l("ap.apUpload.networkAnomaly")
|
|
152
153
|
), e.onError({
|
|
153
|
-
name: o?.message ||
|
|
154
|
-
message: o?.message ||
|
|
155
|
-
}),
|
|
154
|
+
name: o?.message || l("ap.apUpload.networkAnomaly"),
|
|
155
|
+
message: o?.message || l("ap.apUpload.networkAnomaly")
|
|
156
|
+
}), d.value--;
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function Q(e) {
|
|
159
160
|
if (T && T?.(e), e.response) {
|
|
160
|
-
if (Array.isArray(
|
|
161
|
-
const t =
|
|
162
|
-
t >= 0 && (
|
|
161
|
+
if (Array.isArray(r.value)) {
|
|
162
|
+
const t = c.findIndex((s) => s.uid === e.uid);
|
|
163
|
+
t >= 0 && (r?.value.splice(t, 1), c.splice(t, 1)), r.value.length === 0 && (r.value = void 0);
|
|
163
164
|
}
|
|
164
165
|
} else
|
|
165
166
|
e?.oss?.pauseUpload();
|
|
@@ -168,64 +169,68 @@ const ye = { class: "multiple-file-context" }, Ce = { key: 0 }, Ue = { key: 1 },
|
|
|
168
169
|
);
|
|
169
170
|
return u.splice(o, 1), Promise.resolve(!0);
|
|
170
171
|
}
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
172
|
+
const X = async (e) => {
|
|
173
|
+
if (N.value?.trigger) {
|
|
173
174
|
let o = [e].map((t) => ({
|
|
174
175
|
objectName: t.response,
|
|
175
176
|
fileName: t.name
|
|
176
177
|
}));
|
|
177
|
-
|
|
178
|
-
} else
|
|
179
|
-
|
|
178
|
+
N.value?.trigger?.(o);
|
|
179
|
+
} else {
|
|
180
|
+
const o = e.response?.match(/^([^:]+):(.*)$/), t = o?.[1], s = o?.[2] ?? e.response;
|
|
181
|
+
(await z(
|
|
182
|
+
() => t ? g?.(t) : g?.()
|
|
183
|
+
)).downloadFile([
|
|
180
184
|
{
|
|
181
|
-
path:
|
|
185
|
+
path: s,
|
|
182
186
|
fileName: e.name
|
|
183
187
|
}
|
|
184
188
|
]);
|
|
189
|
+
}
|
|
185
190
|
};
|
|
186
|
-
return (e, o) => (
|
|
187
|
-
class:
|
|
188
|
-
[
|
|
189
|
-
[
|
|
191
|
+
return (e, o) => (x(), b("div", {
|
|
192
|
+
class: te({
|
|
193
|
+
[n(O)()]: !0,
|
|
194
|
+
[n(P) ?? ""]: !0
|
|
190
195
|
})
|
|
191
196
|
}, [
|
|
192
|
-
|
|
197
|
+
y(n(ue), {
|
|
193
198
|
ref_key: "uploadRef",
|
|
194
|
-
ref:
|
|
195
|
-
accept:
|
|
199
|
+
ref: m,
|
|
200
|
+
accept: n(k),
|
|
196
201
|
multiple: "",
|
|
197
|
-
"max-count":
|
|
202
|
+
"max-count": n(i),
|
|
198
203
|
progress: {
|
|
199
204
|
strokeWidth: 3,
|
|
200
205
|
showInfo: !1,
|
|
201
206
|
strokeColor: "#0070FF"
|
|
202
207
|
},
|
|
203
|
-
"before-upload":
|
|
204
|
-
"custom-request":
|
|
208
|
+
"before-upload": J,
|
|
209
|
+
"custom-request": K,
|
|
205
210
|
"show-upload-list": { showDownloadIcon: !0, showRemoveIcon: !0 },
|
|
206
|
-
onRemove:
|
|
207
|
-
onDownload:
|
|
211
|
+
onRemove: Q,
|
|
212
|
+
onDownload: X
|
|
208
213
|
}, {
|
|
209
|
-
downloadIcon:
|
|
210
|
-
|
|
214
|
+
downloadIcon: U(() => [
|
|
215
|
+
y(n(ce))
|
|
211
216
|
]),
|
|
212
|
-
default:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
default: U(() => [
|
|
218
|
+
S("div", ke, [
|
|
219
|
+
y(n(pe), { class: "file-btn" }, {
|
|
220
|
+
default: U(() => [
|
|
221
|
+
y(n(ie)),
|
|
222
|
+
ae(" " + L(n($)), 1)
|
|
218
223
|
]),
|
|
219
224
|
_: 1
|
|
220
225
|
}),
|
|
221
|
-
|
|
226
|
+
S("div", {
|
|
222
227
|
class: "sub-title",
|
|
223
|
-
onClick: o[0] || (o[0] =
|
|
228
|
+
onClick: o[0] || (o[0] = se(() => {
|
|
224
229
|
}, ["stop"]))
|
|
225
230
|
}, [
|
|
226
|
-
typeof
|
|
227
|
-
(
|
|
228
|
-
])) :
|
|
231
|
+
typeof n(f) == "string" ? (x(), b("div", Ce, L(n(f) || `${n(l)("ap.apUpload.supportExtension")}:${n(ge)(n(k))}`), 1)) : n(f) ? (x(), b("div", be, [
|
|
232
|
+
(x(), re(le(n(f))))
|
|
233
|
+
])) : ne("", !0)
|
|
229
234
|
])
|
|
230
235
|
])
|
|
231
236
|
]),
|
|
@@ -235,5 +240,5 @@ const ye = { class: "multiple-file-context" }, Ce = { key: 0 }, Ue = { key: 1 },
|
|
|
235
240
|
}
|
|
236
241
|
});
|
|
237
242
|
export {
|
|
238
|
-
|
|
243
|
+
ze as default
|
|
239
244
|
};
|