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