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