@aplus-frontend/ui 0.2.11 → 0.2.13
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/index.mjs +41 -39
- package/es/src/ap-list/index.vue.d.ts +1 -0
- package/es/src/ap-list/index.vue.mjs +85 -79
- package/es/src/ap-list/interface.d.ts +7 -0
- package/es/src/ap-table/ap-table.vue2.mjs +64 -65
- package/es/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +20 -0
- package/es/src/ap-table/components/paragraph-ellipsis/index.vue.mjs +4 -0
- package/es/src/ap-table/components/paragraph-ellipsis/index.vue2.mjs +82 -0
- package/es/src/ap-table/hooks/use-table-column-state.mjs +84 -75
- package/es/src/business/ap-image/ApImage.vue.d.ts +39 -1
- package/es/src/business/ap-image/ApImage.vue2.mjs +89 -39
- package/es/src/business/ap-image/hooks/useOss.mjs +35 -26
- package/es/src/business/ap-image/index.d.ts +41 -1
- package/es/src/business/ap-image/interface.d.ts +1 -0
- package/es/src/business/ap-image/style/css.d.ts +0 -1
- package/es/src/business/ap-image/style/css.js +1 -1
- package/es/src/business/ap-image/style/index.d.ts +0 -1
- package/es/src/business/ap-image/style/index.js +1 -1
- package/es/src/business/ap-summary/ap-summary.vue2.mjs +30 -30
- package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.d.ts +50 -0
- package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.mjs +227 -0
- package/es/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue2.mjs +4 -0
- package/es/src/business/ap-upload-file/ap-upload-single/style/css.d.ts +0 -0
- package/es/src/business/ap-upload-file/ap-upload-single/style/css.js +1 -0
- package/es/src/business/ap-upload-file/ap-upload-single/style/index.d.ts +0 -0
- package/es/src/business/ap-upload-file/ap-upload-single/style/index.js +1 -0
- package/es/src/business/ap-upload-file/hook/useInjectContext.d.ts +4 -0
- package/es/src/business/ap-upload-file/hook/useInjectContext.mjs +9 -0
- package/es/src/business/ap-upload-file/hook/useOss.d.ts +8 -0
- package/es/src/business/ap-upload-file/hook/useOss.mjs +30 -0
- package/es/src/business/ap-upload-file/hook/useProps.d.ts +12 -0
- package/es/src/business/ap-upload-file/hook/useProps.mjs +28 -0
- package/es/src/business/ap-upload-file/icon/delete-icon.vue.d.ts +3 -0
- package/es/src/business/ap-upload-file/icon/delete-icon.vue.mjs +27 -0
- package/es/src/business/ap-upload-file/icon/file-icon.vue.d.ts +3 -0
- package/es/src/business/ap-upload-file/icon/file-icon.vue.mjs +18 -0
- package/es/src/business/ap-upload-file/index.d.ts +3 -0
- package/es/src/business/ap-upload-file/index.mjs +2 -0
- package/es/src/business/ap-upload-file/interface.d.ts +29 -0
- package/es/src/business/ap-upload-file/interface.mjs +1 -0
- package/es/src/business/ap-upload-file/utils/accept.d.ts +16 -0
- package/es/src/business/ap-upload-file/utils/accept.mjs +55 -0
- package/es/src/business/ap-upload-file/utils/fileList.d.ts +5 -0
- package/es/src/business/ap-upload-file/utils/fileList.mjs +16 -0
- package/es/src/business/ap-upload-file/utils/upload.d.ts +10 -0
- package/es/src/business/ap-upload-file/utils/upload.mjs +62 -0
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +43 -42
- package/es/src/config-provider/config-provider.d.ts +8 -0
- package/es/src/config-provider/css-var.d.ts +8 -0
- package/es/src/config-provider/css-var.mjs +25 -9
- package/es/src/config-provider/index.d.ts +48 -0
- package/es/src/index.mjs +33 -31
- package/es/src/locale/lang/en.mjs +4 -0
- package/es/src/locale/lang/zh-cn.mjs +4 -0
- package/es/src/path-map.mjs +2 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-list/index.vue.d.ts +1 -0
- package/lib/src/ap-list/index.vue.js +1 -1
- package/lib/src/ap-list/interface.d.ts +7 -0
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/components/paragraph-ellipsis/index.vue.d.ts +20 -0
- package/lib/src/ap-table/components/paragraph-ellipsis/index.vue.js +1 -0
- package/lib/src/ap-table/components/paragraph-ellipsis/index.vue2.js +1 -0
- package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
- package/lib/src/business/ap-image/ApImage.vue.d.ts +39 -1
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
- package/lib/src/business/ap-image/hooks/useOss.js +1 -1
- package/lib/src/business/ap-image/index.d.ts +41 -1
- package/lib/src/business/ap-image/interface.d.ts +1 -0
- package/lib/src/business/ap-image/style/css.d.ts +0 -1
- package/lib/src/business/ap-image/style/css.js +1 -1
- package/lib/src/business/ap-image/style/index.d.ts +0 -1
- package/lib/src/business/ap-image/style/index.js +1 -1
- package/lib/src/business/ap-summary/ap-summary.vue2.js +1 -1
- package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.d.ts +50 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue.js +1 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/ap-upload-single.vue2.js +1 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/style/css.d.ts +0 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/style/css.js +1 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/style/index.d.ts +0 -0
- package/lib/src/business/ap-upload-file/ap-upload-single/style/index.js +1 -0
- package/lib/src/business/ap-upload-file/hook/useInjectContext.d.ts +4 -0
- package/lib/src/business/ap-upload-file/hook/useInjectContext.js +1 -0
- package/lib/src/business/ap-upload-file/hook/useOss.d.ts +8 -0
- package/lib/src/business/ap-upload-file/hook/useOss.js +1 -0
- package/lib/src/business/ap-upload-file/hook/useProps.d.ts +12 -0
- package/lib/src/business/ap-upload-file/hook/useProps.js +1 -0
- package/lib/src/business/ap-upload-file/icon/delete-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-upload-file/icon/delete-icon.vue.js +1 -0
- package/lib/src/business/ap-upload-file/icon/file-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-upload-file/icon/file-icon.vue.js +1 -0
- package/lib/src/business/ap-upload-file/index.d.ts +3 -0
- package/lib/src/business/ap-upload-file/index.js +1 -0
- package/lib/src/business/ap-upload-file/interface.d.ts +29 -0
- package/lib/src/business/ap-upload-file/interface.js +1 -0
- package/lib/src/business/ap-upload-file/utils/accept.d.ts +16 -0
- package/lib/src/business/ap-upload-file/utils/accept.js +1 -0
- package/lib/src/business/ap-upload-file/utils/fileList.d.ts +5 -0
- package/lib/src/business/ap-upload-file/utils/fileList.js +1 -0
- package/lib/src/business/ap-upload-file/utils/upload.d.ts +10 -0
- package/lib/src/business/ap-upload-file/utils/upload.js +1 -0
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +8 -0
- package/lib/src/config-provider/css-var.d.ts +8 -0
- package/lib/src/config-provider/css-var.js +1 -1
- package/lib/src/config-provider/index.d.ts +48 -0
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { defineComponent as Q, computed as y, openBlock as c, createBlock as k, unref as e, mergeProps as W, withCtx as u, renderSlot as X, createElementVNode as s, normalizeClass as l, createElementBlock as g, createVNode as n, createTextVNode as p, toDisplayString as f, resolveDynamicComponent as S, h as $, Fragment as q } from "vue";
|
|
2
|
+
import { clearAllFile as I } from "../utils/fileList.mjs";
|
|
3
|
+
import C from "../icon/file-icon.vue.mjs";
|
|
4
|
+
import L from "../icon/delete-icon.vue.mjs";
|
|
5
|
+
import { Form as Y, UploadDragger as Z, TypographyParagraph as N, Progress as ee, Tooltip as B } from "@aplus-frontend/antdv";
|
|
6
|
+
import { FormItemInputContext as te } from "@aplus-frontend/antdv/es/form/FormItemContext";
|
|
7
|
+
import { useSingleProps as oe } from "../hook/useProps.mjs";
|
|
8
|
+
import { useInjectContext as le } from "../hook/useInjectContext.mjs";
|
|
9
|
+
import { omit as se } from "lodash-unified";
|
|
10
|
+
import "../../../config-provider/index.mjs";
|
|
11
|
+
import { useGlobalConfig as O } from "../../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import { useLocale as ne } from "../../../config-provider/hooks/use-locale.mjs";
|
|
13
|
+
import { useNamespace as ie } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
const ke = /* @__PURE__ */ Q({
|
|
15
|
+
__name: "ap-upload-single",
|
|
16
|
+
props: {
|
|
17
|
+
dirName: {},
|
|
18
|
+
getOssAccess: {},
|
|
19
|
+
fileList: {},
|
|
20
|
+
onChange: {},
|
|
21
|
+
maxSize: { default: 500 },
|
|
22
|
+
accept: { default: "*" },
|
|
23
|
+
beforeUpload: {},
|
|
24
|
+
customRequest: {},
|
|
25
|
+
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
26
|
+
subTitle: { type: [Object, String, Number, Boolean, null, Array] }
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:fileList"],
|
|
29
|
+
setup(R, { emit: T }) {
|
|
30
|
+
var D;
|
|
31
|
+
const j = te.useInject(), E = y(() => j.status), d = R, P = T, b = Y.useInjectFormItemContext(), m = y({
|
|
32
|
+
get() {
|
|
33
|
+
return d.fileList || [];
|
|
34
|
+
},
|
|
35
|
+
set(i) {
|
|
36
|
+
P("update:fileList", i), b == null || b.onFieldChange();
|
|
37
|
+
}
|
|
38
|
+
}), o = y(() => {
|
|
39
|
+
var i;
|
|
40
|
+
return (i = m.value) == null ? void 0 : i[0];
|
|
41
|
+
}), z = O("apUpload"), { t: V, lang: _ } = ne(), {
|
|
42
|
+
title: M,
|
|
43
|
+
subTitle: h,
|
|
44
|
+
beforeUpload: G,
|
|
45
|
+
customRequest: H
|
|
46
|
+
} = oe(d), J = H;
|
|
47
|
+
le(
|
|
48
|
+
V,
|
|
49
|
+
_,
|
|
50
|
+
(d == null ? void 0 : d.getOssAccess) ?? ((D = z.value) == null ? void 0 : D.getOssAccess)
|
|
51
|
+
);
|
|
52
|
+
const { b: U, e: t } = ie("ap-upload-single"), x = O("uiMode");
|
|
53
|
+
function K(i) {
|
|
54
|
+
return se(i, [
|
|
55
|
+
"dirName",
|
|
56
|
+
"needName",
|
|
57
|
+
"getOssAccess",
|
|
58
|
+
"fileList",
|
|
59
|
+
"title",
|
|
60
|
+
"subTitle"
|
|
61
|
+
]);
|
|
62
|
+
}
|
|
63
|
+
return (i, a) => (c(), k(e(Z), W({
|
|
64
|
+
maxCount: 1,
|
|
65
|
+
showUploadList: !1,
|
|
66
|
+
disabled: !!o.value && [void 0, "uploading", "error", "success", "done"].includes(o.value.status)
|
|
67
|
+
}, {
|
|
68
|
+
...i.$attrs,
|
|
69
|
+
...K(d)
|
|
70
|
+
}, {
|
|
71
|
+
"file-list": m.value,
|
|
72
|
+
"onUpdate:fileList": a[3] || (a[3] = (v) => m.value = v),
|
|
73
|
+
class: [e(U)(), `${e(U)()}-affix-wrapper-status-${E.value}`],
|
|
74
|
+
beforeUpload: e(G),
|
|
75
|
+
customRequest: e(J)
|
|
76
|
+
}), {
|
|
77
|
+
default: u(() => [
|
|
78
|
+
X(i.$slots, "default", {}, () => {
|
|
79
|
+
var v, F, w, A;
|
|
80
|
+
return [
|
|
81
|
+
s("div", {
|
|
82
|
+
class: l([e(t)("content")])
|
|
83
|
+
}, [
|
|
84
|
+
(v = o.value) != null && v.status && ["uploading"].includes(o.value.status) ? (c(), g("div", {
|
|
85
|
+
key: 0,
|
|
86
|
+
class: l([e(t)("content-file"), e(t)("content-ing")])
|
|
87
|
+
}, [
|
|
88
|
+
s("div", {
|
|
89
|
+
class: l([e(t)("content-file-icon")])
|
|
90
|
+
}, [
|
|
91
|
+
n(C)
|
|
92
|
+
], 2),
|
|
93
|
+
s("div", {
|
|
94
|
+
class: l([e(t)("content-file-name"), e(t)("content-ing-name")])
|
|
95
|
+
}, [
|
|
96
|
+
n(e(N), {
|
|
97
|
+
ellipsis: { rows: 2 },
|
|
98
|
+
tooltip: o.value.error
|
|
99
|
+
}, {
|
|
100
|
+
default: u(() => [
|
|
101
|
+
p(f(o.value.name), 1)
|
|
102
|
+
]),
|
|
103
|
+
_: 1
|
|
104
|
+
}, 8, ["tooltip"]),
|
|
105
|
+
n(e(ee), {
|
|
106
|
+
percent: o.value.percent || 0,
|
|
107
|
+
size: 4,
|
|
108
|
+
showInfo: !1,
|
|
109
|
+
trailColor: e(x) === "admin" ? "#D9D9D9" : "#DEE4ED",
|
|
110
|
+
strokeColor: e(x) === "admin" ? "#34B77C" : "#0070FF"
|
|
111
|
+
}, null, 8, ["percent", "trailColor", "strokeColor"])
|
|
112
|
+
], 2),
|
|
113
|
+
s("div", {
|
|
114
|
+
class: l([e(t)("content-file-delete")]),
|
|
115
|
+
onClick: a[0] || (a[0] = (r) => e(I)(m.value))
|
|
116
|
+
}, [
|
|
117
|
+
n(L)
|
|
118
|
+
], 2)
|
|
119
|
+
], 2)) : (F = o.value) != null && F.status && ["error"].includes(o.value.status) ? (c(), g("div", {
|
|
120
|
+
key: 1,
|
|
121
|
+
class: l([e(t)("content-file"), e(t)("content-error")])
|
|
122
|
+
}, [
|
|
123
|
+
s("div", {
|
|
124
|
+
class: l([e(t)("content-file-icon")])
|
|
125
|
+
}, [
|
|
126
|
+
n(C)
|
|
127
|
+
], 2),
|
|
128
|
+
s("div", {
|
|
129
|
+
class: l([e(t)("content-file-name"), e(t)("content-error-name")])
|
|
130
|
+
}, [
|
|
131
|
+
n(e(B), null, {
|
|
132
|
+
title: u(() => {
|
|
133
|
+
var r;
|
|
134
|
+
return [
|
|
135
|
+
p(f(((r = o.value) == null ? void 0 : r.error) || "--"), 1)
|
|
136
|
+
];
|
|
137
|
+
}),
|
|
138
|
+
default: u(() => [
|
|
139
|
+
n(e(N), {
|
|
140
|
+
ellipsis: { rows: 2 },
|
|
141
|
+
tooltip: o.value.error
|
|
142
|
+
}, {
|
|
143
|
+
default: u(() => [
|
|
144
|
+
p(f(o.value.name), 1)
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["tooltip"])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})
|
|
151
|
+
], 2),
|
|
152
|
+
s("div", {
|
|
153
|
+
class: l([e(t)("content-file-delete")]),
|
|
154
|
+
onClick: a[1] || (a[1] = (r) => e(I)(m.value))
|
|
155
|
+
}, [
|
|
156
|
+
n(L)
|
|
157
|
+
], 2)
|
|
158
|
+
], 2)) : o.value && ((w = o.value) == null ? void 0 : w.status) === void 0 || (A = o.value) != null && A.status && ["success", "done"].includes(o.value.status) ? (c(), g("div", {
|
|
159
|
+
key: 2,
|
|
160
|
+
class: l([e(t)("content-file"), e(t)("content-done")])
|
|
161
|
+
}, [
|
|
162
|
+
s("div", {
|
|
163
|
+
class: l([e(t)("content-file-icon")])
|
|
164
|
+
}, [
|
|
165
|
+
n(C)
|
|
166
|
+
], 2),
|
|
167
|
+
s("div", {
|
|
168
|
+
class: l([e(t)("content-file-name"), e(t)("content-done-name")])
|
|
169
|
+
}, [
|
|
170
|
+
n(e(B), null, {
|
|
171
|
+
title: u(() => {
|
|
172
|
+
var r;
|
|
173
|
+
return [
|
|
174
|
+
p(f(((r = o.value) == null ? void 0 : r.name) || "--"), 1)
|
|
175
|
+
];
|
|
176
|
+
}),
|
|
177
|
+
default: u(() => [
|
|
178
|
+
n(e(N), {
|
|
179
|
+
ellipsis: { rows: 2 },
|
|
180
|
+
tooltip: o.value.error
|
|
181
|
+
}, {
|
|
182
|
+
default: u(() => [
|
|
183
|
+
p(f(o.value.name), 1)
|
|
184
|
+
]),
|
|
185
|
+
_: 1
|
|
186
|
+
}, 8, ["tooltip"])
|
|
187
|
+
]),
|
|
188
|
+
_: 1
|
|
189
|
+
})
|
|
190
|
+
], 2),
|
|
191
|
+
s("div", {
|
|
192
|
+
class: l([e(t)("content-file-delete")]),
|
|
193
|
+
onClick: a[2] || (a[2] = (r) => e(I)(m.value))
|
|
194
|
+
}, [
|
|
195
|
+
n(L)
|
|
196
|
+
], 2)
|
|
197
|
+
], 2)) : (c(), g("div", {
|
|
198
|
+
key: 3,
|
|
199
|
+
class: l([e(t)("content-empty")])
|
|
200
|
+
}, [
|
|
201
|
+
s("div", {
|
|
202
|
+
class: l([e(t)("content-empty-icon")])
|
|
203
|
+
}, [
|
|
204
|
+
n(C)
|
|
205
|
+
], 2),
|
|
206
|
+
s("div", {
|
|
207
|
+
class: l([e(t)("content-empty-title")])
|
|
208
|
+
}, [
|
|
209
|
+
(c(), k(S($(q, [e(M)]))))
|
|
210
|
+
], 2),
|
|
211
|
+
s("div", {
|
|
212
|
+
class: l([e(t)("content-empty-sub-title")])
|
|
213
|
+
}, [
|
|
214
|
+
(c(), k(S($(q, [e(h)]))))
|
|
215
|
+
], 2)
|
|
216
|
+
], 2))
|
|
217
|
+
], 2)
|
|
218
|
+
];
|
|
219
|
+
})
|
|
220
|
+
]),
|
|
221
|
+
_: 3
|
|
222
|
+
}, 16, ["disabled", "file-list", "class", "beforeUpload", "customRequest"]));
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
export {
|
|
226
|
+
ke as default
|
|
227
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/dist/ap-upload-single/index.css';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/src/ap-upload-single/index.less';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { injectUtilUpload as e } from "../utils/upload.mjs";
|
|
2
|
+
import { injectUtilAccept as c } from "../utils/accept.mjs";
|
|
3
|
+
import { injectHookOss as n } from "./useOss.mjs";
|
|
4
|
+
function f(o, t, i) {
|
|
5
|
+
e(o), c(o), n(o, t, i);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
f as useInjectContext
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { accessCreate, Oss } from '@aplus-frontend/oss';
|
|
2
|
+
import { Translator } from '../../../config-provider';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
import { ApUploadGetOssAccess } from '../interface';
|
|
5
|
+
export type { Oss } from '@aplus-frontend/oss';
|
|
6
|
+
export type GetOssAccess = () => Promise<accessCreate>;
|
|
7
|
+
export declare function injectHookOss(tValue: Translator, langValue: Ref<string>, getOssAccessValue?: ApUploadGetOssAccess): void;
|
|
8
|
+
export declare function getOssInstance(): Promise< Oss>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createOssInstance as i } from "@aplus-frontend/oss";
|
|
2
|
+
let t, o, e;
|
|
3
|
+
function r(n, s, a) {
|
|
4
|
+
t = n, o = s, a && (e = a);
|
|
5
|
+
}
|
|
6
|
+
const c = {
|
|
7
|
+
"zh-cn": "zh_CN",
|
|
8
|
+
en: "en_US"
|
|
9
|
+
};
|
|
10
|
+
function l() {
|
|
11
|
+
return c[o.value] ?? "zh_CN";
|
|
12
|
+
}
|
|
13
|
+
async function g() {
|
|
14
|
+
if (!e)
|
|
15
|
+
throw new Error(`${t("ap.apUpload.pleasePass")}getOssAccess`);
|
|
16
|
+
const n = i();
|
|
17
|
+
return await n.initOssClient({
|
|
18
|
+
getOssAccess: e,
|
|
19
|
+
locale: l(),
|
|
20
|
+
onFailure: (s) => {
|
|
21
|
+
throw new Error(
|
|
22
|
+
typeof (s == null ? void 0 : s.message) == "string" ? s.message : t("ap.apUpload.FailedToObtainOssTemporaryPermissions")
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}), n;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
g as getOssInstance,
|
|
29
|
+
r as injectHookOss
|
|
30
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ApUploadCustomRequest, ApUploadFile, ApUploadSingleProps } from '../interface';
|
|
2
|
+
import { ComputedRef, VNodeArrayChildren, VNode, RendererNode, RendererElement } from 'vue';
|
|
3
|
+
export declare function useSingleProps(props: ApUploadSingleProps): {
|
|
4
|
+
title: ComputedRef<string | number | true | VNodeArrayChildren | VNode<RendererNode, RendererElement, {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}>>;
|
|
7
|
+
subTitle: ComputedRef<string | number | true | VNodeArrayChildren | VNode<RendererNode, RendererElement, {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}>>;
|
|
10
|
+
beforeUpload: (file: ApUploadFile, fileList: ApUploadFile[]) => boolean | Promise<boolean>;
|
|
11
|
+
customRequest: ApUploadCustomRequest;
|
|
12
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { computed as l } from "vue";
|
|
2
|
+
import { getAcceptText as d } from "../utils/accept.mjs";
|
|
3
|
+
import "../../../config-provider/index.mjs";
|
|
4
|
+
import { uploadBeforeUpload as f, uploadCustomRequest as U } from "../utils/upload.mjs";
|
|
5
|
+
import { useLocale as o } from "../../../config-provider/hooks/use-locale.mjs";
|
|
6
|
+
function z(e) {
|
|
7
|
+
const { t: c } = o(), m = l(
|
|
8
|
+
() => e.title || c("ap.apUpload.clickOrDragUpload")
|
|
9
|
+
), i = l(
|
|
10
|
+
() => e.subTitle || `${c("ap.apUpload.supportExtension")}:${d(e.accept)},${c(
|
|
11
|
+
"ap.apUpload.maxWarnUploadFileSize",
|
|
12
|
+
{
|
|
13
|
+
maxSize: e.maxSize
|
|
14
|
+
}
|
|
15
|
+
)}`
|
|
16
|
+
);
|
|
17
|
+
function n(t, a) {
|
|
18
|
+
var u;
|
|
19
|
+
return e != null && e.beforeUpload ? (u = e == null ? void 0 : e.beforeUpload) == null ? void 0 : u.call(e, t, a) : f(t, a, e);
|
|
20
|
+
}
|
|
21
|
+
return { title: m, subTitle: i, beforeUpload: n, customRequest: (t) => {
|
|
22
|
+
var a, u;
|
|
23
|
+
e != null && e.customRequest ? (a = e == null ? void 0 : e.customRequest) == null || a.call(e, t) : (u = U) == null || u(t, e);
|
|
24
|
+
} };
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
z as useSingleProps
|
|
28
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{}>>, {}, {}>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createElementVNode as e, openBlock as o, createElementBlock as t } from "vue";
|
|
2
|
+
import n from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
const l = {}, r = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
6
|
+
fill: "none",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
viewBox: "0 0 20 20"
|
|
9
|
+
}, L = /* @__PURE__ */ e("g", null, [
|
|
10
|
+
/* @__PURE__ */ e("g", null, [
|
|
11
|
+
/* @__PURE__ */ e("path", {
|
|
12
|
+
d: "M14.2913,4.375L16.875,4.375C17.2202,4.375,17.5,4.65482,17.5,5C17.5,5.34518,17.2202,5.625,16.875,5.625L15.9375,5.625L15.9375,15.625Q15.9375,16.401699999999998,15.3883,16.9508Q14.8392,17.5,14.0625,17.5L5.9375,17.5Q5.16085,17.5,4.61167,16.9508Q4.0625,16.401699999999998,4.0625,15.625L4.0625,5.625L3.125,5.625C2.7798220000000002,5.625,2.5,5.34518,2.5,5C2.5,4.65482,2.7798220000000002,4.375,3.125,4.375L5.70873,4.375C5.71225,4.3689,5.71588,4.3628599999999995,5.719609999999999,4.35687L6.71624,2.75811Q7.26675,1.875,8.307400000000001,1.875L11.6926,1.875Q12.7332,1.875,13.2838,2.75811L14.2802,4.3565000000000005C14.284,4.36261,14.2877,4.36878,14.2913,4.375ZM12.8187,4.375L12.22299,3.41937Q12.03948,3.125,11.6926,3.125L8.307400000000001,3.125Q7.96052,3.125,7.77702,3.41937L7.1813,4.375L12.8187,4.375ZM5.3125,5.625L14.6875,5.625L14.6875,15.625Q14.6875,15.8839,14.5044,16.0669Q14.3214,16.25,14.0625,16.25L5.9375,16.25Q5.6786200000000004,16.25,5.495559999999999,16.0669Q5.3125,15.8839,5.3125,15.625L5.3125,5.625ZM9.375,8.75C9.375,8.40482,9.65482,8.125,10,8.125C10.34518,8.125,10.625,8.40482,10.625,8.75L10.625,13.125C10.625,13.4702,10.34518,13.75,10,13.75C9.65482,13.75,9.375,13.4702,9.375,13.125L9.375,8.75Z",
|
|
13
|
+
"fill-rule": "evenodd",
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
"fill-opacity": "1"
|
|
16
|
+
})
|
|
17
|
+
])
|
|
18
|
+
], -1), c = [
|
|
19
|
+
L
|
|
20
|
+
];
|
|
21
|
+
function s(i, _) {
|
|
22
|
+
return o(), t("svg", r, c);
|
|
23
|
+
}
|
|
24
|
+
const f = /* @__PURE__ */ n(l, [["render", s]]);
|
|
25
|
+
export {
|
|
26
|
+
f as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{}>>, {}, {}>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createStaticVNode as t, openBlock as o, createElementBlock as i } from "vue";
|
|
2
|
+
import e from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
const s = {}, l = {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
6
|
+
fill: "none",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
viewBox: "0 0 56 56"
|
|
9
|
+
}, r = /* @__PURE__ */ t('<defs><clipPath id="master_svg0_693_19001"><rect x="0" y="0" width="56" height="56" rx="7"></rect></clipPath><linearGradient x1="0.5" y1="0" x2="0.5" y2="0.7987817525863647" id="master_svg1_693_19025"><stop offset="0%" stop-color="#AED1FF" stop-opacity="1"></stop><stop offset="100%" stop-color="#74B1FF" stop-opacity="1"></stop></linearGradient><linearGradient x1="0.5" y1="0" x2="0.5" y2="1" id="master_svg2_693_19014"><stop offset="0.7142857182770967%" stop-color="#DBEBFF" stop-opacity="1"></stop><stop offset="100%" stop-color="#98C5FF" stop-opacity="1"></stop></linearGradient></defs><g clip-path="url(#master_svg0_693_19001)"><g><g><path d="M49.4644,10.22729L35.1706,10.22729C34.2282,10.22729,33.316,9.89456,32.595,9.287759999999999L29.1746,6.4093C28.0931,5.499102,26.7249,5,25.3113,5L5.5,5C3.29086,5,1.5,6.79086,1.5,9L1.5,45L54.4995,45L54.5,15.2852C54.5,12.49165,52.2455,10.22729,49.4644,10.22729Z" fill="url(#master_svg1_693_19025)" fill-opacity="1"></path></g><g><path d="M10.5,13L45.5,13C46.6046,13,47.5,13.895431,47.5,15L47.5,35.9999L8.5,36L8.5,15C8.5,13.895431,9.395431,13,10.5,13" fill="#FFFFFF" fill-opacity="0.30000001192092896"></path></g><g><path d="M8.5,17L47.5,17C48.6046,17,49.5,17.895431,49.5,19L49.5,41.9998L6.5,42L6.5,19C6.5,17.895431,7.395431,17,8.5,17" fill="#F9FCFF" fill-opacity="1"></path></g><g><rect x="14.5" y="21" width="15" height="2" rx="1" fill="#8DBFFF" fill-opacity="0.30000001192092896"></rect></g><g><rect x="14.5" y="27" width="28" height="2" rx="1" fill="#8DBFFF" fill-opacity="0.6000000238418579"></rect></g><g><path d="M1.5,37L1.5,48C1.5,50.2091,3.29086,52,5.5,52L50.5,52C52.7091,52,54.5,50.2091,54.5,48L54.5,37C54.5,35.34315,53.1569,34,51.5,34L4.5,34C2.84315,34,1.5,35.34315,1.5,37Z" fill="url(#master_svg2_693_19014)" fill-opacity="1"></path></g></g></g>', 2), p = [
|
|
10
|
+
r
|
|
11
|
+
];
|
|
12
|
+
function a(c, _) {
|
|
13
|
+
return o(), i("svg", l, p);
|
|
14
|
+
}
|
|
15
|
+
const n = /* @__PURE__ */ e(s, [["render", a]]);
|
|
16
|
+
export {
|
|
17
|
+
n as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { accessCreate } from '@aplus-frontend/oss';
|
|
2
|
+
import { VNodeChild } from 'vue';
|
|
3
|
+
import { UploadFile, UploadChangeParam, UploadProps } from '@aplus-frontend/antdv';
|
|
4
|
+
export type ApUploadGetOssAccess = () => Promise<accessCreate>;
|
|
5
|
+
type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
|
|
6
|
+
export type ApUploadFile<T = any> = UploadFile<T> & {
|
|
7
|
+
ossDestroy?: () => any;
|
|
8
|
+
[key: string | number | symbol]: any;
|
|
9
|
+
};
|
|
10
|
+
export type ApUploadCustomRequest = (option: Omit<Parameters<Exclude<UploadProps['customRequest'], undefined>>[0], 'file'> & {
|
|
11
|
+
file?: ApUploadFile;
|
|
12
|
+
}, props?: {
|
|
13
|
+
dirName?: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
export type ApUploadBaseProps<T = any> = {
|
|
16
|
+
dirName: string;
|
|
17
|
+
getOssAccess?: ApUploadGetOssAccess;
|
|
18
|
+
fileList?: ApUploadFile<T>[];
|
|
19
|
+
onChange?: (info?: UploadChangeParam<ApUploadFile<T>>) => void;
|
|
20
|
+
maxSize?: number;
|
|
21
|
+
accept?: string;
|
|
22
|
+
beforeUpload?: (file: ApUploadFile<T>, fileList: ApUploadFile<T>[]) => boolean | Promise<boolean>;
|
|
23
|
+
customRequest?: ApUploadCustomRequest;
|
|
24
|
+
};
|
|
25
|
+
export type ApUploadSingleProps<T = any> = ApUploadBaseProps<T> & {
|
|
26
|
+
title?: VNodeChild;
|
|
27
|
+
subTitle?: VNodeChild;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Translator } from '../../../config-provider';
|
|
2
|
+
import { ApUploadFile } from '../interface';
|
|
3
|
+
export declare function injectUtilAccept(tValue: Translator): void;
|
|
4
|
+
/**
|
|
5
|
+
* 校验文件是否满足指定的格式
|
|
6
|
+
* @param file
|
|
7
|
+
* @param accept
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function fileMatchesAccept(file: ApUploadFile, accept: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 根据accept获取支持的后缀名
|
|
13
|
+
* @param accept
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAcceptText(accept: string): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import i from "mime";
|
|
2
|
+
let a;
|
|
3
|
+
function f(e) {
|
|
4
|
+
a = e;
|
|
5
|
+
}
|
|
6
|
+
function T(e, r) {
|
|
7
|
+
var p, o, c, u, l;
|
|
8
|
+
const t = r.split(",").map((n) => n.trim());
|
|
9
|
+
for (const n of t) {
|
|
10
|
+
if (n === "*")
|
|
11
|
+
return !0;
|
|
12
|
+
if (n.endsWith("/*")) {
|
|
13
|
+
const [s] = n.split("/"), [m] = ((p = e == null ? void 0 : e.type) == null ? void 0 : p.split("/")) || [];
|
|
14
|
+
if (s === m)
|
|
15
|
+
return !0;
|
|
16
|
+
} else if (/^\./.test(n)) {
|
|
17
|
+
if (e.type === i.getType(n))
|
|
18
|
+
return !0;
|
|
19
|
+
const s = (o = e.name) == null ? void 0 : o.lastIndexOf(".");
|
|
20
|
+
if (s > -1 && ((c = e.name) == null ? void 0 : c.slice(s)) === n)
|
|
21
|
+
return !0;
|
|
22
|
+
} else {
|
|
23
|
+
if (e.type === n)
|
|
24
|
+
return !0;
|
|
25
|
+
const s = (u = e.name) == null ? void 0 : u.lastIndexOf(".");
|
|
26
|
+
if (s > -1 && [...i.getAllExtensions(n) || []].map(
|
|
27
|
+
(d) => `.${d}`
|
|
28
|
+
).includes((l = e.name) == null ? void 0 : l.slice(s)))
|
|
29
|
+
return !0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return !1;
|
|
33
|
+
}
|
|
34
|
+
function x(e) {
|
|
35
|
+
const r = {
|
|
36
|
+
image: a("ap.apUpload.pictureType"),
|
|
37
|
+
video: a("ap.apUpload.videoType"),
|
|
38
|
+
audio: a("ap.apUpload.audioType"),
|
|
39
|
+
application: a("ap.apUpload.documentType"),
|
|
40
|
+
"*": a("ap.apUpload.allTypes")
|
|
41
|
+
};
|
|
42
|
+
return e.split(",").map((t) => t.trim()).map((t) => {
|
|
43
|
+
if (t === "*")
|
|
44
|
+
return r[t];
|
|
45
|
+
if (t.endsWith("/*")) {
|
|
46
|
+
const [p] = t.split("/");
|
|
47
|
+
return r[p] || p;
|
|
48
|
+
} else return /^\./.test(t) ? t : [...i.getAllExtensions(t) || []].map((p) => `.${p}`).join(",") || t;
|
|
49
|
+
}).join(",");
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
T as fileMatchesAccept,
|
|
53
|
+
x as getAcceptText,
|
|
54
|
+
f as injectUtilAccept
|
|
55
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function e(t, n, u) {
|
|
2
|
+
var c;
|
|
3
|
+
t.status === "uploading" && ((c = t.ossDestroy) == null || c.call(t));
|
|
4
|
+
const a = n.findIndex((d) => d.uid === t.uid);
|
|
5
|
+
a > -1 && (n.splice(a, 1), u != null && u.maxCount && n.length >= u.maxCount && n.splice(u.maxCount));
|
|
6
|
+
}
|
|
7
|
+
function o(t) {
|
|
8
|
+
t.forEach((n) => {
|
|
9
|
+
var u;
|
|
10
|
+
n.status === "uploading" && ((u = n.ossDestroy) == null || u.call(n));
|
|
11
|
+
}), t.splice(0);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
o as clearAllFile,
|
|
15
|
+
e as clearSingleFile
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApUploadCustomRequest, ApUploadFile } from '../interface';
|
|
2
|
+
import { Translator } from '../../../config-provider';
|
|
3
|
+
export declare function injectUtilUpload(tValue: Translator): void;
|
|
4
|
+
export declare function changeFileStatus(file: ApUploadFile, status: ApUploadFile['status'], errMsg: string): void;
|
|
5
|
+
export declare function uploadBeforeUpload(file: ApUploadFile, fileList: ApUploadFile[], props: {
|
|
6
|
+
maxSize?: number;
|
|
7
|
+
maxCount?: number;
|
|
8
|
+
accept?: string;
|
|
9
|
+
}): boolean;
|
|
10
|
+
export declare const uploadCustomRequest: ApUploadCustomRequest;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { message as r } from "@aplus-frontend/antdv";
|
|
2
|
+
import { fileMatchesAccept as g } from "./accept.mjs";
|
|
3
|
+
import { getOssInstance as U } from "../hook/useOss.mjs";
|
|
4
|
+
let u;
|
|
5
|
+
function w(e) {
|
|
6
|
+
u = e;
|
|
7
|
+
}
|
|
8
|
+
function x(e, n, a) {
|
|
9
|
+
e.status = n, e.error = a;
|
|
10
|
+
}
|
|
11
|
+
function z(e, n, a) {
|
|
12
|
+
if (a != null && a.maxCount && a.maxCount > 1 && n.length >= a.maxCount) {
|
|
13
|
+
const t = u("ap.apUpload.maxUploadPicture", {
|
|
14
|
+
maxCount: a.maxCount
|
|
15
|
+
});
|
|
16
|
+
return r.warning(t), x(e, "error", t), !1;
|
|
17
|
+
}
|
|
18
|
+
if (a != null && a.maxSize && ((e == null ? void 0 : e.size) || 0) > (a == null ? void 0 : a.maxSize) * 1024 * 1024) {
|
|
19
|
+
const t = u("ap.apUpload.maxUploadFileSize", {
|
|
20
|
+
maxSize: a == null ? void 0 : a.maxSize
|
|
21
|
+
});
|
|
22
|
+
return r.warning(t), x(e, "error", t), !1;
|
|
23
|
+
}
|
|
24
|
+
if (!g(e, a.accept)) {
|
|
25
|
+
const t = u("ap.apUpload.fileFormatNotSupported");
|
|
26
|
+
return r.warning(t), x(e, "error", t), !1;
|
|
27
|
+
}
|
|
28
|
+
return !0;
|
|
29
|
+
}
|
|
30
|
+
const S = async (e, n) => {
|
|
31
|
+
const { file: a, onError: t, onProgress: i, onSuccess: d } = e;
|
|
32
|
+
try {
|
|
33
|
+
const c = await U(), m = await (c == null ? void 0 : c.put({
|
|
34
|
+
dirName: n == null ? void 0 : n.dirName,
|
|
35
|
+
fileName: a == null ? void 0 : a.name,
|
|
36
|
+
data: a,
|
|
37
|
+
progressCallBack: (l) => {
|
|
38
|
+
i == null || i({
|
|
39
|
+
percent: l
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
if (m.status === 204)
|
|
44
|
+
return;
|
|
45
|
+
if (m.status === 200) {
|
|
46
|
+
const { saveUrl: l } = m;
|
|
47
|
+
d == null || d({
|
|
48
|
+
fileName: a == null ? void 0 : a.name,
|
|
49
|
+
path: l
|
|
50
|
+
});
|
|
51
|
+
} else
|
|
52
|
+
t == null || t((m == null ? void 0 : m.message) || u("ap.apUpload.networkAnomaly"));
|
|
53
|
+
} catch (c) {
|
|
54
|
+
t == null || t(c);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
x as changeFileStatus,
|
|
59
|
+
w as injectUtilUpload,
|
|
60
|
+
z as uploadBeforeUpload,
|
|
61
|
+
S as uploadCustomRequest
|
|
62
|
+
};
|