@aplus-frontend/ui 7.10.3 → 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-download/ap-download.vue.d.ts +2 -1
- package/es/src/business/ap-download/ap-download.vue.mjs +10 -10
- package/es/src/business/ap-image/ApImage.vue2.mjs +49 -46
- package/es/src/business/ap-image/hooks/useOss.d.ts +1 -1
- package/es/src/business/ap-image/hooks/useOss.mjs +30 -28
- package/es/src/business/ap-image/interface.d.ts +1 -1
- 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 +10 -1
- 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/config-provider/constants.d.ts +2 -2
- 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-download/ap-download.vue.d.ts +2 -1
- package/lib/src/business/ap-download/ap-download.vue.js +1 -1
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
- package/lib/src/business/ap-image/hooks/useOss.d.ts +1 -1
- package/lib/src/business/ap-image/hooks/useOss.js +1 -1
- package/lib/src/business/ap-image/interface.d.ts +1 -1
- 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 +10 -1
- 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/config-provider/constants.d.ts +2 -2
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,228 +1,231 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { DeleteOutlined as
|
|
3
|
-
import { message as
|
|
1
|
+
import { defineComponent as re, inject as o, ref as h, watch as ce, computed as ie, createElementBlock as S, openBlock as k, normalizeClass as ue, unref as a, createElementVNode as r, createCommentVNode as E, toDisplayString as x, normalizeStyle as pe, createBlock as de, withModifiers as ve, createVNode as fe } from "vue";
|
|
2
|
+
import { DeleteOutlined as me } from "@ant-design/icons-vue";
|
|
3
|
+
import { message as p, Progress as ge } from "@aplus-frontend/antdv";
|
|
4
4
|
import "../../../config-provider/index.mjs";
|
|
5
|
-
import { useToken as
|
|
6
|
-
import
|
|
7
|
-
import { useOss as
|
|
8
|
-
import
|
|
9
|
-
import { fileMatchesAccept as
|
|
10
|
-
import { getName as
|
|
11
|
-
import { useLocale as
|
|
12
|
-
import { useNamespace as
|
|
13
|
-
const Fe = ["accept"],
|
|
5
|
+
import { useToken as he } from "../../../config-provider/hooks/use-token.mjs";
|
|
6
|
+
import j from "../assets/single-file-icon.png.mjs";
|
|
7
|
+
import { useOss as ke, getOssInstance as _e } from "../hooks/useOss.mjs";
|
|
8
|
+
import ye from "../style/index.mjs";
|
|
9
|
+
import { fileMatchesAccept as we, getAcceptText as Ue } from "../utils/accept.mjs";
|
|
10
|
+
import { getName as De, getReturnData as G } from "../utils/returnData.mjs";
|
|
11
|
+
import { useLocale as Ce } from "../../../config-provider/hooks/use-locale.mjs";
|
|
12
|
+
import { useNamespace as be } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
const Fe = ["accept"], Ne = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "state-un"
|
|
16
|
-
},
|
|
16
|
+
}, Se = ["src"], Ee = { class: "state-un-title" }, xe = { class: "state-un-subtitle" }, ze = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "state-ing"
|
|
19
|
-
},
|
|
19
|
+
}, Ae = { class: "left" }, Re = ["src"], Be = { class: "center" }, Me = { class: "center-progress" }, Ke = /* @__PURE__ */ re({
|
|
20
20
|
__name: "SingleFile",
|
|
21
|
-
setup(
|
|
22
|
-
const { t: s } =
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
setup(Pe, { expose: W }) {
|
|
22
|
+
const { t: s } = Ce(), { b: z } = be("ap-upload-single-file"), H = ye("ap-upload"), { put: J } = ke(), K = o("dirName"), Q = o("baseDirName"), _ = o("accept") || "*", y = o("maxSize") ?? 500, X = o("title") || s("ap.apUpload.clickOrDragUpload"), w = o("subTitle"), { token: A } = he(), c = o("value"), U = o("needName"), d = o("uploadingCount"), R = o("beforeUpload"), B = o("customRequest"), M = o("getOssAccess"), Y = o("maxSizeErrorMsg"), Z = o("acceptErrorMsg"), P = o("onRemove"), D = o("showUploadErrorMsg"), T = o("bucket"), n = h(null);
|
|
23
|
+
let O;
|
|
24
|
+
ce(
|
|
25
|
+
() => c?.value,
|
|
25
26
|
function(e) {
|
|
26
|
-
|
|
27
|
+
n.value === null && e && L(e);
|
|
27
28
|
},
|
|
28
29
|
{ immediate: !0 }
|
|
29
30
|
);
|
|
30
|
-
function
|
|
31
|
+
function L(e) {
|
|
31
32
|
e ? setTimeout(() => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
}) : (
|
|
33
|
+
const t = De(U, e);
|
|
34
|
+
l.value = 3, n.value = new File([e], t, {}), c.value = e;
|
|
35
|
+
}) : (l.value = 1, n.value = null, c.value = void 0);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
|
|
37
|
+
W({ setValue: L });
|
|
38
|
+
const l = h(1), f = h(0), m = h(null), V = ie(() => n.value && c?.value);
|
|
39
|
+
function ee() {
|
|
40
|
+
l.value === 1 && m.value?.click();
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function I(e) {
|
|
42
43
|
e.preventDefault(), e.stopPropagation();
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function te(e) {
|
|
45
46
|
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
46
47
|
}
|
|
47
48
|
function ae(e) {
|
|
48
|
-
|
|
49
|
+
$(e);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
51
|
+
function oe(e) {
|
|
52
|
+
if (e.preventDefault(), e.stopPropagation(), l.value !== 1)
|
|
52
53
|
return;
|
|
53
|
-
var
|
|
54
|
-
function
|
|
55
|
-
|
|
54
|
+
var t = e.dataTransfer, u = [], i = 0, q = t.files.length;
|
|
55
|
+
function v() {
|
|
56
|
+
i === q - 1 && ae(u), i++;
|
|
56
57
|
}
|
|
57
|
-
if (
|
|
58
|
-
for (var
|
|
59
|
-
var
|
|
60
|
-
if (
|
|
61
|
-
var
|
|
62
|
-
|
|
58
|
+
if (t.items !== void 0)
|
|
59
|
+
for (var C = 0; C < t.items.length; C++) {
|
|
60
|
+
var b = t.items[C];
|
|
61
|
+
if (b.kind === "file" && b.webkitGetAsEntry().isFile) {
|
|
62
|
+
var se = b.getAsFile();
|
|
63
|
+
u.push(se), v();
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
else
|
|
66
|
-
for (let
|
|
67
|
-
var
|
|
68
|
-
if (
|
|
69
|
-
|
|
67
|
+
for (let N = 0; N < q; N++) {
|
|
68
|
+
var g = t.files[N];
|
|
69
|
+
if (g.type)
|
|
70
|
+
u.push(g), v();
|
|
70
71
|
else
|
|
71
72
|
try {
|
|
72
73
|
var F = new FileReader();
|
|
73
|
-
F.readAsDataURL(
|
|
74
|
+
F.readAsDataURL(g.slice(0, 3)), F.addEventListener(
|
|
74
75
|
"load",
|
|
75
76
|
function() {
|
|
76
|
-
|
|
77
|
+
u.push(g), v();
|
|
77
78
|
},
|
|
78
79
|
!1
|
|
79
80
|
), F.addEventListener(
|
|
80
81
|
"error",
|
|
81
82
|
function() {
|
|
82
|
-
|
|
83
|
+
p.warning(s("ap.apUpload.foldersNotSupported")), v();
|
|
83
84
|
},
|
|
84
85
|
!1
|
|
85
86
|
);
|
|
86
87
|
} catch {
|
|
87
|
-
|
|
88
|
+
p.warning(s("ap.apUpload.foldersNotSupported")), v();
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
async function
|
|
92
|
-
const
|
|
93
|
-
await
|
|
92
|
+
async function ne(e) {
|
|
93
|
+
const t = e.target;
|
|
94
|
+
await $(t?.files), m.value && (m.value.value = "");
|
|
94
95
|
}
|
|
95
|
-
async function
|
|
96
|
+
async function $(e) {
|
|
96
97
|
if (e?.length) {
|
|
97
|
-
if (e[0].size >
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
maxSize:
|
|
98
|
+
if (e[0].size > y * 1024 * 1024) {
|
|
99
|
+
p.warning(
|
|
100
|
+
Y || s("ap.apUpload.maxUploadFileSize", {
|
|
101
|
+
maxSize: y
|
|
101
102
|
})
|
|
102
103
|
);
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
|
-
if (!
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
if (!we(e[0], _)) {
|
|
107
|
+
p.warning(
|
|
108
|
+
Z || s("ap.apUpload.fileFormatNotSupported")
|
|
108
109
|
);
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
if (typeof R == "function" && await R(e[0]) === !1)
|
|
112
113
|
return;
|
|
113
|
-
if (
|
|
114
|
+
if (n.value = e[0], l.value = 2, f.value = 0, d.value++, typeof B == "function") {
|
|
114
115
|
B({
|
|
115
|
-
onProgress: (
|
|
116
|
-
|
|
116
|
+
onProgress: (t) => {
|
|
117
|
+
f.value = t;
|
|
117
118
|
},
|
|
118
|
-
onError: (
|
|
119
|
-
|
|
119
|
+
onError: (t) => {
|
|
120
|
+
D && p.warning(t || s("ap.apUpload.networkAnomaly")), l.value = 1, n.value = null, d.value--;
|
|
120
121
|
},
|
|
121
|
-
onSuccess: (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
),
|
|
122
|
+
onSuccess: (t) => {
|
|
123
|
+
c.value = G(
|
|
124
|
+
U,
|
|
125
|
+
t,
|
|
126
|
+
n.value.name
|
|
127
|
+
), l.value = 3, d.value--;
|
|
127
128
|
},
|
|
128
129
|
file: e[0]
|
|
129
130
|
});
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
132
133
|
try {
|
|
133
|
-
await
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
const t = await (T ? M(T) : M()), u = await _e(async () => t);
|
|
135
|
+
O = u, J({
|
|
136
|
+
file: n.value,
|
|
137
|
+
dirName: K,
|
|
138
|
+
oss: u,
|
|
139
|
+
successCallBack(i) {
|
|
140
|
+
c.value = G(
|
|
141
|
+
U,
|
|
142
|
+
i,
|
|
143
|
+
n.value.name
|
|
144
|
+
), l.value = 3, d.value--;
|
|
143
145
|
},
|
|
144
|
-
errorCallBack(
|
|
145
|
-
|
|
146
|
+
errorCallBack(i) {
|
|
147
|
+
D && p.warning(i || s("ap.apUpload.networkAnomaly")), l.value = 1, n.value = null, d.value--;
|
|
146
148
|
},
|
|
147
|
-
progressCallBack(
|
|
148
|
-
|
|
149
|
+
progressCallBack(i) {
|
|
150
|
+
f.value = i;
|
|
149
151
|
},
|
|
150
|
-
baseDirName:
|
|
152
|
+
baseDirName: Q,
|
|
153
|
+
bucket: t?.bucket
|
|
151
154
|
});
|
|
152
|
-
} catch (
|
|
153
|
-
|
|
154
|
-
typeof
|
|
155
|
-
),
|
|
155
|
+
} catch (t) {
|
|
156
|
+
D && p.warning(
|
|
157
|
+
typeof t?.message == "string" ? t.message : s("ap.apUpload.networkAnomaly")
|
|
158
|
+
), l.value = 1, n.value = null, d.value--;
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
162
|
function le() {
|
|
160
|
-
|
|
163
|
+
P && P?.(n.value), n.value && !c?.value && O?.pauseUpload?.(), l.value = 1, n.value = null, c.value = void 0;
|
|
161
164
|
}
|
|
162
|
-
return (e,
|
|
163
|
-
class:
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
[
|
|
165
|
+
return (e, t) => (k(), S("div", {
|
|
166
|
+
class: ue({
|
|
167
|
+
[a(z)()]: !0,
|
|
168
|
+
[a(z)("un")]: l.value === 1,
|
|
169
|
+
[a(H) ?? ""]: !0
|
|
167
170
|
}),
|
|
168
|
-
onClick:
|
|
169
|
-
onDragenter:
|
|
170
|
-
onDragover:
|
|
171
|
-
onDragleave:
|
|
172
|
-
onDrop:
|
|
171
|
+
onClick: ee,
|
|
172
|
+
onDragenter: I,
|
|
173
|
+
onDragover: te,
|
|
174
|
+
onDragleave: I,
|
|
175
|
+
onDrop: oe
|
|
173
176
|
}, [
|
|
174
177
|
r("input", {
|
|
175
178
|
ref_key: "fileRef",
|
|
176
|
-
ref:
|
|
179
|
+
ref: m,
|
|
177
180
|
style: { display: "none" },
|
|
178
181
|
type: "file",
|
|
179
|
-
accept:
|
|
180
|
-
onChange:
|
|
182
|
+
accept: a(_),
|
|
183
|
+
onChange: ne
|
|
181
184
|
}, null, 40, Fe),
|
|
182
|
-
|
|
185
|
+
l.value === 1 ? (k(), S("div", Ne, [
|
|
183
186
|
r("img", {
|
|
184
187
|
class: "state-un-icon",
|
|
185
|
-
src:
|
|
186
|
-
}, null, 8,
|
|
187
|
-
r("div", Ee,
|
|
188
|
-
r("div",
|
|
189
|
-
|
|
190
|
-
)},${
|
|
191
|
-
maxSize:
|
|
188
|
+
src: a(j)
|
|
189
|
+
}, null, 8, Se),
|
|
190
|
+
r("div", Ee, x(a(X)), 1),
|
|
191
|
+
r("div", xe, x(typeof a(w) == "string" && a(w).length > 0 ? a(w) : `${a(s)("ap.apUpload.supportExtension")}:${a(Ue)(
|
|
192
|
+
a(_)
|
|
193
|
+
)},${a(s)("ap.apUpload.maxWarnUploadFileSize", {
|
|
194
|
+
maxSize: a(y)
|
|
192
195
|
})}`), 1)
|
|
193
196
|
])) : E("", !0),
|
|
194
|
-
[2, 3].includes(
|
|
195
|
-
r("div",
|
|
196
|
-
r("img", { src:
|
|
197
|
+
[2, 3].includes(l.value) ? (k(), S("div", ze, [
|
|
198
|
+
r("div", Ae, [
|
|
199
|
+
r("img", { src: a(j) }, null, 8, Re)
|
|
197
200
|
]),
|
|
198
|
-
r("div",
|
|
201
|
+
r("div", Be, [
|
|
199
202
|
r("div", {
|
|
200
203
|
class: "center-title",
|
|
201
|
-
style:
|
|
202
|
-
color:
|
|
204
|
+
style: pe({
|
|
205
|
+
color: V.value ? "#0070FF" : "#182948"
|
|
203
206
|
})
|
|
204
|
-
},
|
|
205
|
-
r("div",
|
|
206
|
-
|
|
207
|
+
}, x(n.value?.name), 5),
|
|
208
|
+
r("div", Me, [
|
|
209
|
+
V.value ? E("", !0) : (k(), de(a(ge), {
|
|
207
210
|
key: 0,
|
|
208
|
-
percent:
|
|
211
|
+
percent: f.value,
|
|
209
212
|
size: 4,
|
|
210
213
|
"show-info": !1,
|
|
211
|
-
"trail-color":
|
|
212
|
-
"stroke-color":
|
|
214
|
+
"trail-color": a(A).borderColorBase,
|
|
215
|
+
"stroke-color": a(A).colorPrimary
|
|
213
216
|
}, null, 8, ["percent", "trail-color", "stroke-color"]))
|
|
214
217
|
])
|
|
215
218
|
]),
|
|
216
219
|
r("div", {
|
|
217
220
|
class: "right",
|
|
218
|
-
onClick:
|
|
221
|
+
onClick: ve(le, ["stop"])
|
|
219
222
|
}, [
|
|
220
|
-
|
|
223
|
+
fe(a(me))
|
|
221
224
|
])
|
|
222
225
|
])) : E("", !0)
|
|
223
226
|
], 34));
|
|
224
227
|
}
|
|
225
228
|
});
|
|
226
229
|
export {
|
|
227
|
-
|
|
230
|
+
Ke as default
|
|
228
231
|
};
|
|
@@ -4,7 +4,7 @@ import { Translator } from '../../../config-provider';
|
|
|
4
4
|
export type { Oss } from '@aplus-frontend/oss';
|
|
5
5
|
export type GetOssAccess = () => Promise<accessCreate>;
|
|
6
6
|
export declare function injectLocaleToOss(tValue: Translator, langValue: Ref<string>): void;
|
|
7
|
-
declare function put({ file, dirName, oss, successCallBack, errorCallBack, progressCallBack, baseDirName }: {
|
|
7
|
+
declare function put({ file, dirName, oss, successCallBack, errorCallBack, progressCallBack, baseDirName, bucket }: {
|
|
8
8
|
file: File;
|
|
9
9
|
dirName: string;
|
|
10
10
|
oss: Oss;
|
|
@@ -12,6 +12,7 @@ declare function put({ file, dirName, oss, successCallBack, errorCallBack, progr
|
|
|
12
12
|
errorCallBack: (msg: string) => void;
|
|
13
13
|
progressCallBack: (p: number) => void;
|
|
14
14
|
baseDirName?: string;
|
|
15
|
+
bucket?: string;
|
|
15
16
|
}): Promise<void>;
|
|
16
17
|
export declare function useOss(): {
|
|
17
18
|
client: Oss;
|
|
@@ -1,82 +1,83 @@
|
|
|
1
|
-
import { client as
|
|
2
|
-
let n,
|
|
3
|
-
function
|
|
4
|
-
n =
|
|
1
|
+
import { client as l, createOssInstance as d } from "@aplus-frontend/oss";
|
|
2
|
+
let n, p;
|
|
3
|
+
function F(s, e) {
|
|
4
|
+
n = s, p = e;
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const O = {
|
|
7
7
|
"zh-cn": "zh_CN",
|
|
8
8
|
en: "en_US"
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function c() {
|
|
11
|
+
return O[p.value] ?? "zh_CN";
|
|
12
12
|
}
|
|
13
|
-
async function
|
|
14
|
-
file:
|
|
15
|
-
dirName:
|
|
16
|
-
oss:
|
|
17
|
-
successCallBack:
|
|
18
|
-
errorCallBack:
|
|
19
|
-
progressCallBack:
|
|
20
|
-
baseDirName:
|
|
13
|
+
async function U({
|
|
14
|
+
file: s,
|
|
15
|
+
dirName: e,
|
|
16
|
+
oss: o,
|
|
17
|
+
successCallBack: u,
|
|
18
|
+
errorCallBack: r,
|
|
19
|
+
progressCallBack: f,
|
|
20
|
+
baseDirName: m = "Frontend-Upload",
|
|
21
|
+
bucket: i
|
|
21
22
|
}) {
|
|
22
|
-
if (!
|
|
23
|
-
|
|
23
|
+
if (!e) {
|
|
24
|
+
r("required dirName");
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
try {
|
|
27
|
-
const a = await
|
|
28
|
-
fileName:
|
|
29
|
-
dirName:
|
|
30
|
-
data:
|
|
31
|
-
progressCallBack: (
|
|
32
|
-
|
|
28
|
+
const a = await o.put({
|
|
29
|
+
fileName: s.name,
|
|
30
|
+
dirName: e,
|
|
31
|
+
data: s,
|
|
32
|
+
progressCallBack: (t) => {
|
|
33
|
+
f(t);
|
|
33
34
|
},
|
|
34
|
-
baseDirName:
|
|
35
|
+
baseDirName: m
|
|
35
36
|
});
|
|
36
37
|
if (a.status === 204)
|
|
37
38
|
return;
|
|
38
39
|
if (a.status === 200) {
|
|
39
|
-
const { saveUrl:
|
|
40
|
-
|
|
40
|
+
const { saveUrl: t, previewUrl: w } = a, g = i && t ? `${i}:${t}` : t;
|
|
41
|
+
u(g, w);
|
|
41
42
|
} else
|
|
42
|
-
|
|
43
|
+
r(a?.message || n("ap.apUpload.networkAnomaly"));
|
|
43
44
|
} catch (a) {
|
|
44
|
-
|
|
45
|
+
r(a);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
return { client:
|
|
48
|
+
function y() {
|
|
49
|
+
return { client: l, put: U };
|
|
49
50
|
}
|
|
50
|
-
async function
|
|
51
|
-
if (!
|
|
51
|
+
async function T(s) {
|
|
52
|
+
if (!s)
|
|
52
53
|
throw new Error(`${n("ap.apUpload.pleasePass")}getOssAccess`);
|
|
53
|
-
return await
|
|
54
|
-
getOssAccess:
|
|
55
|
-
locale:
|
|
56
|
-
onFailure: (
|
|
54
|
+
return await l.initOssClient({
|
|
55
|
+
getOssAccess: s,
|
|
56
|
+
locale: c(),
|
|
57
|
+
onFailure: (e) => {
|
|
57
58
|
throw new Error(
|
|
58
|
-
typeof
|
|
59
|
+
typeof e?.message == "string" ? e.message : n("ap.apUpload.FailedToObtainOssTemporaryPermissions")
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
|
-
}),
|
|
62
|
+
}), y();
|
|
62
63
|
}
|
|
63
|
-
async function
|
|
64
|
-
if (!
|
|
64
|
+
async function v(s) {
|
|
65
|
+
if (!s)
|
|
65
66
|
throw new Error(`${n("ap.apUpload.pleasePass")}getOssAccess`);
|
|
66
|
-
const
|
|
67
|
-
return await
|
|
68
|
-
getOssAccess:
|
|
69
|
-
locale:
|
|
70
|
-
onFailure: (
|
|
67
|
+
const e = d();
|
|
68
|
+
return await e.initOssClient({
|
|
69
|
+
getOssAccess: s,
|
|
70
|
+
locale: c(),
|
|
71
|
+
onFailure: (o) => {
|
|
71
72
|
throw new Error(
|
|
72
|
-
typeof
|
|
73
|
+
typeof o?.message == "string" ? o.message : n("ap.apUpload.FailedToObtainOssTemporaryPermissions")
|
|
73
74
|
);
|
|
74
75
|
}
|
|
75
|
-
}),
|
|
76
|
+
}), e;
|
|
76
77
|
}
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
v as getOssInstance,
|
|
80
|
+
F as injectLocaleToOss,
|
|
81
|
+
y as useOss,
|
|
82
|
+
T as useOssInit
|
|
82
83
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as M, computed as
|
|
2
|
-
import { Form as Q, UploadDragger as W, TypographyParagraph as
|
|
1
|
+
import { defineComponent as M, computed as b, createBlock as y, openBlock as u, unref as e, mergeProps as G, withCtx as i, renderSlot as H, normalizeProps as J, guardReactiveProps as K, createElementVNode as s, normalizeClass as l, createElementBlock as v, createVNode as n, createTextVNode as m, toDisplayString as p, resolveDynamicComponent as F, h as N, Fragment as L } from "vue";
|
|
2
|
+
import { Form as Q, UploadDragger as W, TypographyParagraph as C, Progress as X, Tooltip as P } from "@aplus-frontend/antdv";
|
|
3
3
|
import { FormItemInputContext as Y } from "@aplus-frontend/antdv/es/form/FormItemContext";
|
|
4
4
|
import { omit as Z } from "lodash-unified";
|
|
5
5
|
import { useToken as ee } from "../../../config-provider/hooks/use-token.mjs";
|
|
@@ -26,19 +26,20 @@ const Se = /* @__PURE__ */ M({
|
|
|
26
26
|
customRequest: {},
|
|
27
27
|
maxSizeErrorMsg: {},
|
|
28
28
|
acceptErrorMsg: {},
|
|
29
|
+
bucket: {},
|
|
29
30
|
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
30
31
|
subTitle: { type: [Object, String, Number, Boolean, null, Array] }
|
|
31
32
|
},
|
|
32
33
|
emits: ["update:fileList"],
|
|
33
34
|
setup(w, { emit: A }) {
|
|
34
|
-
const T = Y.useInject(), $ =
|
|
35
|
+
const T = Y.useInject(), $ = b(() => T.status), d = w, q = A, B = Q.useInjectFormItemContext(), r = b({
|
|
35
36
|
get() {
|
|
36
37
|
return d.fileList || [];
|
|
37
38
|
},
|
|
38
39
|
set(c) {
|
|
39
40
|
q("update:fileList", c), B?.onFieldChange();
|
|
40
41
|
}
|
|
41
|
-
}), o =
|
|
42
|
+
}), o = b(() => r.value?.[0]), O = ne("apUpload"), { t: U, lang: j } = ae(), {
|
|
42
43
|
title: z,
|
|
43
44
|
subTitle: R,
|
|
44
45
|
beforeUpload: E,
|
|
@@ -60,7 +61,7 @@ const Se = /* @__PURE__ */ M({
|
|
|
60
61
|
"subTitle"
|
|
61
62
|
]);
|
|
62
63
|
}
|
|
63
|
-
return (c, a) => (u(),
|
|
64
|
+
return (c, a) => (u(), y(e(W), G({
|
|
64
65
|
...c.$attrs,
|
|
65
66
|
..._(d)
|
|
66
67
|
}, {
|
|
@@ -93,7 +94,7 @@ const Se = /* @__PURE__ */ M({
|
|
|
93
94
|
s("div", {
|
|
94
95
|
class: l([e(t)("content-file-name"), e(t)("content-ing-name")])
|
|
95
96
|
}, [
|
|
96
|
-
n(e(
|
|
97
|
+
n(e(C), {
|
|
97
98
|
ellipsis: { rows: 2 },
|
|
98
99
|
tooltip: o.value.error
|
|
99
100
|
}, {
|
|
@@ -133,7 +134,7 @@ const Se = /* @__PURE__ */ M({
|
|
|
133
134
|
m(p(o.value?.error || "--"), 1)
|
|
134
135
|
]),
|
|
135
136
|
default: i(() => [
|
|
136
|
-
n(e(
|
|
137
|
+
n(e(C), {
|
|
137
138
|
ellipsis: { rows: 2 },
|
|
138
139
|
tooltip: o.value.error
|
|
139
140
|
}, {
|
|
@@ -169,7 +170,7 @@ const Se = /* @__PURE__ */ M({
|
|
|
169
170
|
m(p(o.value?.name || "--"), 1)
|
|
170
171
|
]),
|
|
171
172
|
default: i(() => [
|
|
172
|
-
n(e(
|
|
173
|
+
n(e(C), {
|
|
173
174
|
ellipsis: { rows: 2 },
|
|
174
175
|
tooltip: o.value.error
|
|
175
176
|
}, {
|
|
@@ -200,12 +201,12 @@ const Se = /* @__PURE__ */ M({
|
|
|
200
201
|
s("div", {
|
|
201
202
|
class: l([e(t)("content-empty-title")])
|
|
202
203
|
}, [
|
|
203
|
-
(u(),
|
|
204
|
+
(u(), y(F(N(L, [e(z)]))))
|
|
204
205
|
], 2),
|
|
205
206
|
s("div", {
|
|
206
207
|
class: l([e(t)("content-empty-sub-title")])
|
|
207
208
|
}, [
|
|
208
|
-
(u(),
|
|
209
|
+
(u(), y(F(N(L, [e(R)]))))
|
|
209
210
|
], 2)
|
|
210
211
|
], 2))
|
|
211
212
|
], 2)
|
|
@@ -5,4 +5,9 @@ import { ApUploadGetOssAccess } from '../interface';
|
|
|
5
5
|
export type { Oss } from '@aplus-frontend/oss';
|
|
6
6
|
export type GetOssAccess = () => Promise<accessCreate>;
|
|
7
7
|
export declare function injectHookOss(tValue: Translator, langValue: Ref<string>, getOssAccessValue?: ApUploadGetOssAccess): void;
|
|
8
|
-
export declare function getOssInstance(
|
|
8
|
+
export declare function getOssInstance({ bucket }?: {
|
|
9
|
+
bucket?: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
oss: Oss;
|
|
12
|
+
bucket: string;
|
|
13
|
+
}>;
|