@aplus-frontend/ui 7.10.4 → 7.10.5
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-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-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,99 +1,101 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { CloseOutlined as
|
|
3
|
-
import { message as
|
|
4
|
-
import { omit as
|
|
1
|
+
import { defineComponent as se, inject as i, ref as D, watch as oe, nextTick as ne, createElementBlock as h, openBlock as v, normalizeClass as ie, unref as n, createElementVNode as m, renderSlot as ce, createCommentVNode as V, Fragment as re, renderList as ue, withDirectives as le, createVNode as b, vShow as pe, toDisplayString as E } from "vue";
|
|
2
|
+
import { CloseOutlined as de, PlusOutlined as me } from "@ant-design/icons-vue";
|
|
3
|
+
import { message as f, Progress as fe } from "@aplus-frontend/antdv";
|
|
4
|
+
import { omit as ge } from "lodash-unified";
|
|
5
5
|
import "../../../config-provider/index.mjs";
|
|
6
|
-
import { useOss as
|
|
7
|
-
import
|
|
8
|
-
import { fileMatchesAccept as
|
|
9
|
-
import { getPath as
|
|
10
|
-
import { useLocale as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
const
|
|
6
|
+
import { useOss as he, getOssInstance as T } from "../hooks/useOss.mjs";
|
|
7
|
+
import ve from "../style/index.mjs";
|
|
8
|
+
import { fileMatchesAccept as xe, getAcceptText as ye } from "../utils/accept.mjs";
|
|
9
|
+
import { getPath as we, getName as _e, getReturnData as L } from "../utils/returnData.mjs";
|
|
10
|
+
import { useLocale as ke } from "../../../config-provider/hooks/use-locale.mjs";
|
|
11
|
+
import { useNamespace as Ue } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
const Ce = ["accept"], be = { class: "picture-context" }, Ee = { class: "picture-item-box" }, Ne = ["src"], Se = { class: "picture-item-shadow" }, Re = ["onClick"], Me = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "picture-item-uploading"
|
|
15
|
-
},
|
|
15
|
+
}, ze = { class: "picture-title" }, Ae = { key: 0 }, Pe = { key: 1 }, Je = /* @__PURE__ */ se({
|
|
16
16
|
__name: "Picture",
|
|
17
|
-
setup(
|
|
18
|
-
const { t:
|
|
19
|
-
let
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
() =>
|
|
17
|
+
setup($e, { expose: O }) {
|
|
18
|
+
const { t: l } = ke(), { b: B } = Ue("ap-upload-picture"), q = ve("ap-upload"), { put: j } = he(), G = i("dirName"), H = i("baseDirName"), k = i("accept") || "image/*", U = i("maxSize") ?? 5, N = i("title"), p = i("maxCount") ?? 10, x = i("uploadingCount"), S = i("beforeUpload"), R = i("customRequest"), y = i("getOssAccess"), J = i("maxSizeErrorMsg"), K = i("maxCountErrorMsg"), Q = i("acceptErrorMsg"), w = D(null), r = i("value"), _ = i("needName"), M = i("onRemove"), C = i("showUploadErrorMsg"), z = i("bucket");
|
|
19
|
+
let o = D([]);
|
|
20
|
+
const g = [];
|
|
21
|
+
oe(
|
|
22
|
+
() => r?.value,
|
|
23
23
|
async function(t) {
|
|
24
|
-
!
|
|
24
|
+
!o?.value?.length && t && A(t);
|
|
25
25
|
},
|
|
26
26
|
{ immediate: !0 }
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function A(t) {
|
|
29
29
|
if (!t) {
|
|
30
|
-
|
|
30
|
+
r.value = void 0, g.splice(0, g.length), o.value = [];
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
const
|
|
33
|
+
ne(async () => {
|
|
34
|
+
const s = [];
|
|
35
35
|
for (let e of t) {
|
|
36
|
-
const a =
|
|
36
|
+
const a = we(_, e), c = _e(_, e), u = a?.match(/^([^:]+):(.*)$/), d = u?.[1], ee = u?.[2] ?? a, I = await T(
|
|
37
|
+
() => d ? y?.(d) : y?.()
|
|
38
|
+
), te = await I.getSignatureUrl(ee), ae = {
|
|
37
39
|
...typeof e == "string" ? {} : e,
|
|
38
|
-
...new File([e],
|
|
40
|
+
...new File([e], c, {}),
|
|
39
41
|
uid: `${(/* @__PURE__ */ new Date()).getTime()}-${Math.random()}`,
|
|
40
|
-
thumbUrl:
|
|
42
|
+
thumbUrl: te,
|
|
41
43
|
status: "success",
|
|
42
44
|
percent: 100,
|
|
43
45
|
path: a
|
|
44
46
|
};
|
|
45
|
-
|
|
47
|
+
s.push(ae), I.destroy();
|
|
46
48
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
maxCount:
|
|
49
|
+
if (p && s.length > p) {
|
|
50
|
+
f.warning(
|
|
51
|
+
l("ap.apUpload.fileInitializationException", {
|
|
52
|
+
maxCount: p
|
|
51
53
|
})
|
|
52
54
|
);
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
s.forEach((e) => {
|
|
58
|
+
o.value.push(e), g.push({
|
|
57
59
|
uid: e.uid,
|
|
58
60
|
path: e.path
|
|
59
61
|
});
|
|
60
|
-
}),
|
|
62
|
+
}), r.value = t;
|
|
61
63
|
});
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
65
|
+
O({ setValue: A });
|
|
66
|
+
function W() {
|
|
67
|
+
w.value?.click();
|
|
66
68
|
}
|
|
67
|
-
function
|
|
68
|
-
const
|
|
69
|
-
|
|
69
|
+
function X(t) {
|
|
70
|
+
const s = t.target;
|
|
71
|
+
Y(s?.files);
|
|
70
72
|
}
|
|
71
|
-
function
|
|
73
|
+
function Y(t) {
|
|
72
74
|
if (t?.length)
|
|
73
|
-
for (let
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
for (let s = 0; s < t.length; s++)
|
|
76
|
+
Z(t[s]);
|
|
77
|
+
w.value && (w.value.value = "");
|
|
76
78
|
}
|
|
77
|
-
let
|
|
78
|
-
async function
|
|
79
|
-
if (
|
|
80
|
-
return clearTimeout(
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
let P;
|
|
80
|
+
async function Z(t) {
|
|
81
|
+
if (p && p > 1 && o.value.length >= p)
|
|
82
|
+
return clearTimeout(P), P = setTimeout(() => {
|
|
83
|
+
f.warning(
|
|
84
|
+
K || l("ap.apUpload.maxUploadPicture", { maxCount: p })
|
|
83
85
|
);
|
|
84
86
|
}), !1;
|
|
85
|
-
if (t.size >
|
|
86
|
-
return
|
|
87
|
-
|
|
87
|
+
if (t.size > U * 1024 * 1024)
|
|
88
|
+
return f.warning(
|
|
89
|
+
J || l("ap.apUpload.maxUploadFileSize", { maxSize: U })
|
|
88
90
|
), !1;
|
|
89
|
-
if (!/image\/\w+/.test(t.type) || !
|
|
90
|
-
return
|
|
91
|
-
|
|
91
|
+
if (!/image\/\w+/.test(t.type) || !xe(t, k))
|
|
92
|
+
return f.warning(
|
|
93
|
+
Q || l("ap.apUpload.pictureFormatNotSupported")
|
|
92
94
|
), !1;
|
|
93
95
|
if (typeof S == "function" && await S(t) === !1)
|
|
94
96
|
return !1;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
+
const s = new FileReader();
|
|
98
|
+
s.readAsDataURL(t), s.onload = function() {
|
|
97
99
|
const e = {
|
|
98
100
|
...t,
|
|
99
101
|
uid: `${(/* @__PURE__ */ new Date()).getTime()}-${Math.random()}`,
|
|
@@ -101,168 +103,169 @@ const we = ["accept"], _e = { class: "picture-context" }, Ue = { class: "picture
|
|
|
101
103
|
status: "uploading",
|
|
102
104
|
percent: 0
|
|
103
105
|
};
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
|
|
106
|
+
F(e, t);
|
|
107
|
+
}, s.onerror = function() {
|
|
108
|
+
f.warning(l("ap.apUpload.imageParsingFailed"));
|
|
107
109
|
};
|
|
108
110
|
}
|
|
109
|
-
async function
|
|
110
|
-
if (
|
|
111
|
-
|
|
111
|
+
async function F(t, s) {
|
|
112
|
+
if (x.value++, typeof R == "function") {
|
|
113
|
+
R({
|
|
112
114
|
onProgress: (e) => {
|
|
113
|
-
const a =
|
|
115
|
+
const a = o.value.find((c) => c.uid === t.uid);
|
|
114
116
|
a && (a.percent = e);
|
|
115
117
|
},
|
|
116
118
|
onError: (e) => {
|
|
117
|
-
|
|
118
|
-
const a =
|
|
119
|
-
(
|
|
119
|
+
C && f.warning(e || l("ap.apUpload.networkAnomaly"));
|
|
120
|
+
const a = o.value.findIndex(
|
|
121
|
+
(c) => c.uid === t.uid
|
|
120
122
|
);
|
|
121
|
-
a > -1 &&
|
|
123
|
+
a > -1 && o.value.splice(a, 1), x.value--;
|
|
122
124
|
},
|
|
123
125
|
onSuccess: (e) => {
|
|
124
|
-
const a =
|
|
125
|
-
a && (a.status = "success", a.path = e),
|
|
126
|
-
...
|
|
127
|
-
|
|
128
|
-
],
|
|
126
|
+
const a = o.value.find((c) => c.uid === t.uid);
|
|
127
|
+
a && (a.status = "success", a.path = e), r.value = [
|
|
128
|
+
...r.value || [],
|
|
129
|
+
L(_, e, s.name)
|
|
130
|
+
], g.push({
|
|
129
131
|
uid: t.uid,
|
|
130
132
|
path: e
|
|
131
|
-
}),
|
|
133
|
+
}), x.value--;
|
|
132
134
|
},
|
|
133
|
-
file:
|
|
135
|
+
file: s
|
|
134
136
|
});
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
try {
|
|
138
|
-
const e = await
|
|
139
|
-
t.oss =
|
|
140
|
-
file:
|
|
141
|
-
dirName:
|
|
142
|
-
oss:
|
|
143
|
-
successCallBack(
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
...
|
|
147
|
-
|
|
148
|
-
],
|
|
140
|
+
const e = await (z ? y(z) : y()), a = await T(async () => e);
|
|
141
|
+
t.oss = a, o.value.push(t), j({
|
|
142
|
+
file: s,
|
|
143
|
+
dirName: G,
|
|
144
|
+
oss: a,
|
|
145
|
+
successCallBack(c) {
|
|
146
|
+
const u = o.value.find((d) => d.uid === t.uid);
|
|
147
|
+
u && (u.status = "success", u.path = c), r.value = [
|
|
148
|
+
...r.value || [],
|
|
149
|
+
L(_, c, s.name)
|
|
150
|
+
], g.push({
|
|
149
151
|
uid: t.uid,
|
|
150
|
-
path:
|
|
151
|
-
}),
|
|
152
|
+
path: c
|
|
153
|
+
}), x.value--;
|
|
152
154
|
},
|
|
153
|
-
errorCallBack(
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
(
|
|
155
|
+
errorCallBack(c) {
|
|
156
|
+
C && f.warning(c || l("ap.apUpload.networkAnomaly"));
|
|
157
|
+
const u = o.value.findIndex(
|
|
158
|
+
(d) => d.uid === t.uid
|
|
157
159
|
);
|
|
158
|
-
|
|
160
|
+
u > -1 && o.value.splice(u, 1), x.value--;
|
|
159
161
|
},
|
|
160
|
-
progressCallBack(
|
|
161
|
-
const
|
|
162
|
-
|
|
162
|
+
progressCallBack(c) {
|
|
163
|
+
const u = o.value.find((d) => d.uid === t.uid);
|
|
164
|
+
u && (u.percent = c);
|
|
163
165
|
},
|
|
164
|
-
baseDirName:
|
|
166
|
+
baseDirName: H,
|
|
167
|
+
bucket: e?.bucket
|
|
165
168
|
});
|
|
166
169
|
} catch (e) {
|
|
167
|
-
|
|
168
|
-
typeof e?.message == "string" ? e.message :
|
|
170
|
+
C && f.warning(
|
|
171
|
+
typeof e?.message == "string" ? e.message : l("ap.apUpload.networkAnomaly")
|
|
169
172
|
);
|
|
170
|
-
const a =
|
|
171
|
-
a > -1 &&
|
|
173
|
+
const a = o.value.findIndex((c) => c.uid === t.uid);
|
|
174
|
+
a > -1 && o.value.splice(a, 1), x.value--;
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
function
|
|
175
|
-
if (
|
|
176
|
-
if (Array.isArray(
|
|
177
|
-
const e =
|
|
177
|
+
function $(t) {
|
|
178
|
+
if (M && M?.(t), t.path && r) {
|
|
179
|
+
if (Array.isArray(r.value)) {
|
|
180
|
+
const e = g.findIndex(
|
|
178
181
|
(a) => a.uid === t.uid
|
|
179
182
|
);
|
|
180
183
|
if (e >= 0) {
|
|
181
|
-
const a =
|
|
182
|
-
a?.splice(e, 1),
|
|
184
|
+
const a = r?.value?.slice() ?? [];
|
|
185
|
+
a?.splice(e, 1), r.value = a, g.splice(e, 1);
|
|
183
186
|
}
|
|
184
|
-
|
|
187
|
+
r.value.length === 0 && (r.value = void 0);
|
|
185
188
|
}
|
|
186
189
|
} else
|
|
187
190
|
t?.oss?.pauseUpload();
|
|
188
|
-
const
|
|
191
|
+
const s = o.value.findIndex(
|
|
189
192
|
(e) => e.uid === t.uid
|
|
190
193
|
);
|
|
191
|
-
return
|
|
194
|
+
return o.value.splice(s, 1), Promise.resolve(!0);
|
|
192
195
|
}
|
|
193
|
-
return (t,
|
|
194
|
-
class:
|
|
195
|
-
[n(
|
|
196
|
-
[n(
|
|
196
|
+
return (t, s) => (v(), h("div", {
|
|
197
|
+
class: ie({
|
|
198
|
+
[n(B)()]: !0,
|
|
199
|
+
[n(q) ?? ""]: !0
|
|
197
200
|
})
|
|
198
201
|
}, [
|
|
199
|
-
|
|
202
|
+
m("input", {
|
|
200
203
|
ref_key: "fileRef",
|
|
201
|
-
ref:
|
|
204
|
+
ref: w,
|
|
202
205
|
style: { display: "none" },
|
|
203
206
|
type: "file",
|
|
204
|
-
accept: n(
|
|
205
|
-
onChange:
|
|
206
|
-
}, null, 40,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
fileList: n(
|
|
210
|
-
...n(
|
|
207
|
+
accept: n(k),
|
|
208
|
+
onChange: X
|
|
209
|
+
}, null, 40, Ce),
|
|
210
|
+
m("div", be, [
|
|
211
|
+
ce(t.$slots, "pictureContext", {
|
|
212
|
+
fileList: n(o).map((e) => ({
|
|
213
|
+
...n(ge)(e, "oss"),
|
|
211
214
|
oss: {
|
|
212
215
|
pauseUpload: e?.oss?.pauseUpload
|
|
213
216
|
}
|
|
214
217
|
})),
|
|
215
|
-
remove:
|
|
218
|
+
remove: $
|
|
216
219
|
}, () => [
|
|
217
|
-
(
|
|
220
|
+
(v(!0), h(re, null, ue(n(o), (e) => (v(), h("div", {
|
|
218
221
|
key: e.uid,
|
|
219
222
|
class: "picture-item"
|
|
220
223
|
}, [
|
|
221
|
-
|
|
222
|
-
|
|
224
|
+
m("div", Ee, [
|
|
225
|
+
m("img", {
|
|
223
226
|
src: e.thumbUrl,
|
|
224
227
|
alt: ""
|
|
225
|
-
}, null, 8,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
}, null, 8, Ne),
|
|
229
|
+
le(m("div", Se, [
|
|
230
|
+
m("div", {
|
|
228
231
|
class: "picture-item-close",
|
|
229
|
-
onClick: (a) =>
|
|
232
|
+
onClick: (a) => $(e)
|
|
230
233
|
}, [
|
|
231
|
-
|
|
232
|
-
], 8,
|
|
233
|
-
e.status === "uploading" ? (
|
|
234
|
-
|
|
234
|
+
b(n(de))
|
|
235
|
+
], 8, Re),
|
|
236
|
+
e.status === "uploading" ? (v(), h("div", Me, [
|
|
237
|
+
b(n(fe), {
|
|
235
238
|
percent: e.percent,
|
|
236
239
|
"stroke-color": "#ffffff",
|
|
237
240
|
"trail-color": "rgba(255, 255, 255, 0.3)",
|
|
238
241
|
size: 4,
|
|
239
242
|
"show-info": !1
|
|
240
243
|
}, null, 8, ["percent"])
|
|
241
|
-
])) :
|
|
244
|
+
])) : V("", !0)
|
|
242
245
|
], 512), [
|
|
243
|
-
[
|
|
246
|
+
[pe, e.status === "uploading"]
|
|
244
247
|
])
|
|
245
248
|
])
|
|
246
249
|
]))), 128))
|
|
247
250
|
]),
|
|
248
|
-
n(
|
|
251
|
+
n(p) === void 0 || n(o).length < n(p) ? (v(), h("div", {
|
|
249
252
|
key: 0,
|
|
250
253
|
class: "picture-upload",
|
|
251
|
-
onClick:
|
|
254
|
+
onClick: W
|
|
252
255
|
}, [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
])) :
|
|
256
|
+
b(n(me)),
|
|
257
|
+
m("div", null, E(n(l)("ap.apUpload.update")), 1)
|
|
258
|
+
])) : V("", !0)
|
|
256
259
|
]),
|
|
257
|
-
|
|
258
|
-
n(
|
|
260
|
+
m("div", ze, [
|
|
261
|
+
n(N) ? (v(), h("div", Ae, E(n(N)), 1)) : (v(), h("div", Pe, E(`${n(l)("ap.apUpload.supportExtension")}:${n(ye)(n(k))},${n(l)(
|
|
259
262
|
"ap.apUpload.maxUploadPictureSize",
|
|
260
|
-
{ maxSize: n(
|
|
263
|
+
{ maxSize: n(U) }
|
|
261
264
|
)}`), 1))
|
|
262
265
|
])
|
|
263
266
|
], 2));
|
|
264
267
|
}
|
|
265
268
|
});
|
|
266
269
|
export {
|
|
267
|
-
|
|
270
|
+
Je as default
|
|
268
271
|
};
|