@aplus-frontend/ui 7.0.0 → 7.1.0
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 +108 -106
- package/es/src/ag-grid/style/custom-header.mjs +1 -1
- package/es/src/ag-grid/style/index.mjs +0 -1
- package/es/src/ap-action/item-dropdown/index.vue.mjs +12 -12
- 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/item.mjs +5 -4
- package/es/src/ap-form/style/modal-form.mjs +11 -12
- package/es/src/ap-form/style/search-form-sorter.mjs +31 -27
- package/es/src/ap-form/style/token.d.ts +8 -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 +42 -41
- 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/ag-grid-modal/interface.d.ts +1 -1
- package/es/src/business/ag-grid-modal/wrapper/index.vue.d.ts +6 -2
- package/es/src/business/ag-grid-modal/wrapper/index.vue2.mjs +29 -12
- 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 +11 -39
- 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.d.ts +20 -4
- package/es/src/business/ap-size-input/ApSizeInput.mjs +37 -40
- package/es/src/business/ap-size-input/constans.d.ts +10 -2
- package/es/src/business/ap-size-input/constans.mjs +9 -1
- package/es/src/business/ap-size-input/form-item.vue.d.ts +13 -0
- package/es/src/business/ap-size-input/form-item.vue.mjs +65 -0
- package/es/src/business/ap-size-input/form-item.vue2.mjs +4 -0
- package/es/src/business/ap-size-input/index.d.ts +33 -8
- package/es/src/business/ap-size-input/index.mjs +3 -2
- package/es/src/business/ap-size-input/interface.d.ts +7 -0
- package/es/src/business/ap-size-input/style/index.mjs +2 -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 +1 -1
- 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/ap-view/components/menu-list-content.vue2.mjs +61 -64
- package/es/src/business/ap-view/style/index.mjs +1 -1
- package/es/src/business/batch-input-group/style/index.mjs +1 -1
- package/es/src/check-card/style/index.mjs +46 -51
- package/es/src/config-provider/hooks/use-token.d.ts +2 -2
- package/es/src/design-token/constants.mjs +4 -2
- package/es/src/design-token/interface.d.ts +39 -19
- package/es/src/index.mjs +95 -93
- 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.d.ts +1 -1
- package/es/src/utils/cssinjs/index.mjs +51 -50
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ag-grid/style/custom-header.js +1 -1
- package/lib/src/ap-action/item-dropdown/index.vue.js +1 -1
- 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/item.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 +8 -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/ag-grid-modal/interface.d.ts +1 -1
- package/lib/src/business/ag-grid-modal/wrapper/index.vue.d.ts +6 -2
- package/lib/src/business/ag-grid-modal/wrapper/index.vue2.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.d.ts +20 -4
- package/lib/src/business/ap-size-input/ApSizeInput.js +1 -1
- package/lib/src/business/ap-size-input/constans.d.ts +10 -2
- package/lib/src/business/ap-size-input/constans.js +1 -1
- package/lib/src/business/ap-size-input/form-item.vue.d.ts +13 -0
- package/lib/src/business/ap-size-input/form-item.vue.js +1 -0
- package/lib/src/business/ap-size-input/form-item.vue2.js +1 -0
- package/lib/src/business/ap-size-input/index.d.ts +33 -8
- package/lib/src/business/ap-size-input/index.js +1 -1
- package/lib/src/business/ap-size-input/interface.d.ts +7 -0
- package/lib/src/business/ap-size-input/style/index.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/ap-view/components/menu-list-content.vue2.js +1 -1
- package/lib/src/business/ap-view/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/config-provider/hooks/use-token.d.ts +2 -2
- package/lib/src/design-token/constants.js +1 -1
- package/lib/src/design-token/interface.d.ts +39 -19
- package/lib/src/index.js +1 -1
- 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.d.ts +1 -1
- 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 +1 -1
|
@@ -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
|
};
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ne, inject as l, ref as g, watch as se, computed as re, createElementBlock as E, openBlock as h, normalizeClass as ie, unref as a, createElementVNode as r, createCommentVNode as N, toDisplayString as x, normalizeStyle as ce, createBlock as ue, withModifiers as pe, createVNode as de } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
3
|
import { getName as ve, getReturnData as $ } from "../utils/returnData.mjs";
|
|
4
4
|
import { useOss as fe, useOssInit as me } from "../hooks/useOss.mjs";
|
|
5
5
|
import { fileMatchesAccept as ge, getAcceptText as he } from "../utils/accept.mjs";
|
|
6
6
|
import { message as c, Progress as _e } from "@aplus-frontend/antdv";
|
|
7
|
-
import { DeleteOutlined as
|
|
7
|
+
import { DeleteOutlined as ke } from "@ant-design/icons-vue";
|
|
8
8
|
import q from "../assets/single-file-icon.png.mjs";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
9
|
+
import ye from "../style/index.mjs";
|
|
10
|
+
import { useToken as we } from "../../config-provider/hooks/use-token.mjs";
|
|
11
|
+
import { useLocale as Ue } from "../../config-provider/hooks/use-locale.mjs";
|
|
12
|
+
import { useNamespace as Ce } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
const De = ["accept"], Fe = {
|
|
13
14
|
key: 0,
|
|
14
15
|
class: "state-un"
|
|
15
|
-
},
|
|
16
|
+
}, Se = ["src"], Ee = { class: "state-un-title" }, Ne = { class: "state-un-subtitle" }, xe = {
|
|
16
17
|
key: 1,
|
|
17
18
|
class: "state-ing"
|
|
18
|
-
},
|
|
19
|
+
}, ze = { class: "left" }, be = ["src"], Ae = { class: "center" }, Re = { class: "center-progress" }, He = /* @__PURE__ */ ne({
|
|
19
20
|
__name: "SingleFile",
|
|
20
|
-
setup(
|
|
21
|
-
const { t: s } =
|
|
21
|
+
setup(Be, { expose: j }) {
|
|
22
|
+
const { t: s } = Ue(), { b: z } = Ce("ap-upload-single-file"), G = ye("ap-upload"), { put: W, client: b } = fe(), H = l("dirName"), _ = l("accept") || "*", k = l("maxSize") ?? 500, J = l("title") || s("ap.apUpload.clickOrDragUpload"), y = l("subTitle"), { token: A } = we(), i = l("value"), w = l("needName"), u = l("uploadingCount"), R = l("beforeUpload"), B = l("customRequest"), K = l("getOssAccess"), Q = l("maxSizeErrorMsg"), X = l("acceptErrorMsg"), M = l("onRemove"), U = l("showUploadErrorMsg"), o = g(null);
|
|
22
23
|
se(
|
|
23
24
|
() => i?.value,
|
|
24
25
|
function(e) {
|
|
25
|
-
|
|
26
|
+
o.value === null && e && P(e);
|
|
26
27
|
},
|
|
27
28
|
{ immediate: !0 }
|
|
28
29
|
);
|
|
29
|
-
function
|
|
30
|
+
function P(e) {
|
|
30
31
|
e ? setTimeout(() => {
|
|
31
|
-
const t = ve(
|
|
32
|
-
|
|
33
|
-
}) : (
|
|
32
|
+
const t = ve(w, e);
|
|
33
|
+
n.value = 3, o.value = new File([e], t, {}), i.value = e;
|
|
34
|
+
}) : (n.value = 1, o.value = null, i.value = void 0);
|
|
34
35
|
}
|
|
35
|
-
j({ setValue:
|
|
36
|
-
const
|
|
36
|
+
j({ setValue: P });
|
|
37
|
+
const n = g(1), d = g(0), v = g(null), T = re(() => o.value && i?.value);
|
|
37
38
|
function Y() {
|
|
38
|
-
|
|
39
|
+
n.value === 1 && v.value?.click();
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function O(e) {
|
|
41
42
|
e.preventDefault(), e.stopPropagation();
|
|
42
43
|
}
|
|
43
44
|
function Z(e) {
|
|
@@ -47,7 +48,7 @@ const Ue = ["accept"], Fe = {
|
|
|
47
48
|
L(e);
|
|
48
49
|
}
|
|
49
50
|
function te(e) {
|
|
50
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
51
|
+
if (e.preventDefault(), e.stopPropagation(), n.value !== 1)
|
|
51
52
|
return;
|
|
52
53
|
var t = e.dataTransfer, f = [], V = 0, I = t.files.length;
|
|
53
54
|
function p() {
|
|
@@ -55,27 +56,27 @@ const Ue = ["accept"], Fe = {
|
|
|
55
56
|
}
|
|
56
57
|
if (t.items !== void 0)
|
|
57
58
|
for (var C = 0; C < t.items.length; C++) {
|
|
58
|
-
var
|
|
59
|
-
if (
|
|
60
|
-
var
|
|
61
|
-
f.push(
|
|
59
|
+
var D = t.items[C];
|
|
60
|
+
if (D.kind === "file" && D.webkitGetAsEntry().isFile) {
|
|
61
|
+
var le = D.getAsFile();
|
|
62
|
+
f.push(le), p();
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
else
|
|
65
|
-
for (let
|
|
66
|
-
var m = t.files[
|
|
66
|
+
for (let S = 0; S < I; S++) {
|
|
67
|
+
var m = t.files[S];
|
|
67
68
|
if (m.type)
|
|
68
69
|
f.push(m), p();
|
|
69
70
|
else
|
|
70
71
|
try {
|
|
71
|
-
var
|
|
72
|
-
|
|
72
|
+
var F = new FileReader();
|
|
73
|
+
F.readAsDataURL(m.slice(0, 3)), F.addEventListener(
|
|
73
74
|
"load",
|
|
74
75
|
function() {
|
|
75
76
|
f.push(m), p();
|
|
76
77
|
},
|
|
77
78
|
!1
|
|
78
|
-
),
|
|
79
|
+
), F.addEventListener(
|
|
79
80
|
"error",
|
|
80
81
|
function() {
|
|
81
82
|
c.warning(s("ap.apUpload.foldersNotSupported")), p();
|
|
@@ -93,15 +94,15 @@ const Ue = ["accept"], Fe = {
|
|
|
93
94
|
}
|
|
94
95
|
async function L(e) {
|
|
95
96
|
if (e?.length) {
|
|
96
|
-
if (e[0].size >
|
|
97
|
+
if (e[0].size > k * 1024 * 1024) {
|
|
97
98
|
c.warning(
|
|
98
99
|
Q || s("ap.apUpload.maxUploadFileSize", {
|
|
99
|
-
maxSize:
|
|
100
|
+
maxSize: k
|
|
100
101
|
})
|
|
101
102
|
);
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
if (!ge(e[0],
|
|
105
|
+
if (!ge(e[0], _)) {
|
|
105
106
|
c.warning(
|
|
106
107
|
X || s("ap.apUpload.fileFormatNotSupported")
|
|
107
108
|
);
|
|
@@ -109,20 +110,20 @@ const Ue = ["accept"], Fe = {
|
|
|
109
110
|
}
|
|
110
111
|
if (typeof R == "function" && await R(e[0]) === !1)
|
|
111
112
|
return;
|
|
112
|
-
if (
|
|
113
|
+
if (o.value = e[0], n.value = 2, d.value = 0, u.value++, typeof B == "function") {
|
|
113
114
|
B({
|
|
114
115
|
onProgress: (t) => {
|
|
115
116
|
d.value = t;
|
|
116
117
|
},
|
|
117
118
|
onError: (t) => {
|
|
118
|
-
|
|
119
|
+
U && c.warning(t || s("ap.apUpload.networkAnomaly")), n.value = 1, o.value = null, u.value--;
|
|
119
120
|
},
|
|
120
121
|
onSuccess: (t) => {
|
|
121
122
|
i.value = $(
|
|
122
|
-
|
|
123
|
+
w,
|
|
123
124
|
t,
|
|
124
|
-
|
|
125
|
-
),
|
|
125
|
+
o.value.name
|
|
126
|
+
), n.value = 3, u.value--;
|
|
126
127
|
},
|
|
127
128
|
file: e[0]
|
|
128
129
|
});
|
|
@@ -130,44 +131,43 @@ const Ue = ["accept"], Fe = {
|
|
|
130
131
|
}
|
|
131
132
|
try {
|
|
132
133
|
await me(K), W({
|
|
133
|
-
file:
|
|
134
|
+
file: o.value,
|
|
134
135
|
dirName: H,
|
|
135
136
|
oss: b,
|
|
136
137
|
successCallBack(t) {
|
|
137
138
|
i.value = $(
|
|
138
|
-
|
|
139
|
+
w,
|
|
139
140
|
t,
|
|
140
|
-
|
|
141
|
-
),
|
|
141
|
+
o.value.name
|
|
142
|
+
), n.value = 3, u.value--;
|
|
142
143
|
},
|
|
143
144
|
errorCallBack(t) {
|
|
144
|
-
|
|
145
|
+
U && c.warning(t || s("ap.apUpload.networkAnomaly")), n.value = 1, o.value = null, u.value--;
|
|
145
146
|
},
|
|
146
147
|
progressCallBack(t) {
|
|
147
148
|
d.value = t;
|
|
148
149
|
}
|
|
149
150
|
});
|
|
150
151
|
} catch (t) {
|
|
151
|
-
|
|
152
|
+
U && c.warning(
|
|
152
153
|
typeof t?.message == "string" ? t.message : s("ap.apUpload.networkAnomaly")
|
|
153
|
-
),
|
|
154
|
+
), n.value = 1, o.value = null, u.value--;
|
|
154
155
|
}
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
function oe() {
|
|
158
|
-
M && M?.(
|
|
159
|
+
M && M?.(o.value), o.value && !i?.value && b.pauseUpload(), n.value = 1, o.value = null, i.value = void 0;
|
|
159
160
|
}
|
|
160
|
-
return (e, t) => (h(),
|
|
161
|
+
return (e, t) => (h(), E("div", {
|
|
161
162
|
class: ie({
|
|
162
|
-
[a(
|
|
163
|
-
[a(
|
|
164
|
-
[a(_)("un")]: l.value === 1,
|
|
163
|
+
[a(z)()]: !0,
|
|
164
|
+
[a(z)("un")]: n.value === 1,
|
|
165
165
|
[a(G) ?? ""]: !0
|
|
166
166
|
}),
|
|
167
167
|
onClick: Y,
|
|
168
|
-
onDragenter:
|
|
168
|
+
onDragenter: O,
|
|
169
169
|
onDragover: Z,
|
|
170
|
-
onDragleave:
|
|
170
|
+
onDragleave: O,
|
|
171
171
|
onDrop: te
|
|
172
172
|
}, [
|
|
173
173
|
r("input", {
|
|
@@ -175,40 +175,40 @@ const Ue = ["accept"], Fe = {
|
|
|
175
175
|
ref: v,
|
|
176
176
|
style: { display: "none" },
|
|
177
177
|
type: "file",
|
|
178
|
-
accept: a(
|
|
178
|
+
accept: a(_),
|
|
179
179
|
onChange: ae
|
|
180
|
-
}, null, 40,
|
|
181
|
-
|
|
180
|
+
}, null, 40, De),
|
|
181
|
+
n.value === 1 ? (h(), E("div", Fe, [
|
|
182
182
|
r("img", {
|
|
183
183
|
class: "state-un-icon",
|
|
184
184
|
src: a(q)
|
|
185
|
-
}, null, 8,
|
|
186
|
-
r("div", Ee,
|
|
187
|
-
r("div",
|
|
188
|
-
a(
|
|
185
|
+
}, null, 8, Se),
|
|
186
|
+
r("div", Ee, x(a(J)), 1),
|
|
187
|
+
r("div", Ne, x(typeof a(y) == "string" && a(y).length > 0 ? a(y) : `${a(s)("ap.apUpload.supportExtension")}:${a(he)(
|
|
188
|
+
a(_)
|
|
189
189
|
)},${a(s)("ap.apUpload.maxWarnUploadFileSize", {
|
|
190
|
-
maxSize: a(
|
|
190
|
+
maxSize: a(k)
|
|
191
191
|
})}`), 1)
|
|
192
|
-
])) :
|
|
193
|
-
[2, 3].includes(
|
|
194
|
-
r("div",
|
|
195
|
-
r("img", { src: a(q) }, null, 8,
|
|
192
|
+
])) : N("", !0),
|
|
193
|
+
[2, 3].includes(n.value) ? (h(), E("div", xe, [
|
|
194
|
+
r("div", ze, [
|
|
195
|
+
r("img", { src: a(q) }, null, 8, be)
|
|
196
196
|
]),
|
|
197
197
|
r("div", Ae, [
|
|
198
198
|
r("div", {
|
|
199
199
|
class: "center-title",
|
|
200
200
|
style: ce({
|
|
201
|
-
color:
|
|
201
|
+
color: T.value ? "#0070FF" : "#182948"
|
|
202
202
|
})
|
|
203
|
-
},
|
|
204
|
-
r("div",
|
|
205
|
-
|
|
203
|
+
}, x(o.value?.name), 5),
|
|
204
|
+
r("div", Re, [
|
|
205
|
+
T.value ? N("", !0) : (h(), ue(a(_e), {
|
|
206
206
|
key: 0,
|
|
207
207
|
percent: d.value,
|
|
208
208
|
size: 4,
|
|
209
209
|
"show-info": !1,
|
|
210
|
-
"trail-color": a(
|
|
211
|
-
"stroke-color": a(
|
|
210
|
+
"trail-color": a(A).borderColorBase,
|
|
211
|
+
"stroke-color": a(A).colorPrimary
|
|
212
212
|
}, null, 8, ["percent", "trail-color", "stroke-color"]))
|
|
213
213
|
])
|
|
214
214
|
]),
|
|
@@ -216,12 +216,12 @@ const Ue = ["accept"], Fe = {
|
|
|
216
216
|
class: "right",
|
|
217
217
|
onClick: pe(oe, ["stop"])
|
|
218
218
|
}, [
|
|
219
|
-
de(a(
|
|
219
|
+
de(a(ke))
|
|
220
220
|
])
|
|
221
|
-
])) :
|
|
221
|
+
])) : N("", !0)
|
|
222
222
|
], 34));
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
He as default
|
|
227
227
|
};
|