@aplus-frontend/ui 6.35.2 → 6.36.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/src/ap-field/date/index.vue.mjs +6 -5
- package/es/src/ap-field/date/read.vue2.mjs +8 -7
- package/es/src/ap-field/date-range/index.vue.mjs +20 -17
- package/es/src/ap-field/date-range/read.vue2.mjs +3 -2
- package/es/src/ap-field/index.d.ts +3 -3
- package/es/src/ap-field/text/index.vue.d.ts +1 -1
- package/es/src/ap-field/text/password.vue.d.ts +1 -1
- package/es/src/ap-field/text/read-password.vue.d.ts +1 -1
- package/es/src/ap-field/text/read.vue.d.ts +1 -1
- package/es/src/ap-field/text-area/index.vue.d.ts +1 -1
- package/es/src/ap-field/text-area/read.vue.d.ts +1 -1
- package/es/src/ap-form/ap-form.vue.d.ts +1 -1
- package/es/src/ap-form/drawer-form/index.vue.d.ts +20 -20
- package/es/src/ap-form/interface.d.ts +12 -1
- package/es/src/ap-form/item/index.vue.d.ts +34 -34
- package/es/src/ap-form/items/checkbox/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/date/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/date-range/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/number/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/radio/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/select/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/switch/index.vue.d.ts +2 -2
- package/es/src/ap-form/items/text/index.vue.d.ts +8 -8
- package/es/src/ap-form/items/text/password.vue.d.ts +8 -8
- package/es/src/ap-form/items/text-area/index.vue.d.ts +6 -6
- package/es/src/ap-form/items/tree-select/index.vue.d.ts +2 -2
- package/es/src/ap-form/modal-form/index.vue.d.ts +30 -21
- package/es/src/ap-form/render/item.vue.d.ts +2 -2
- package/es/src/ap-form/search-form/hooks/use-count-per-row.d.ts +13 -2
- package/es/src/ap-form/search-form/hooks/use-count-per-row.mjs +32 -22
- package/es/src/ap-form/search-form/index.vue.d.ts +298 -20
- package/es/src/ap-form/search-form/index.vue.mjs +94 -88
- package/es/src/ap-modal/utils/createModal.mjs +38 -35
- package/es/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/es/src/ap-table/constants.d.ts +77 -77
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +132 -109
- package/es/src/business/ap-attachment/ApAttachment.d.ts +9 -0
- package/es/src/business/ap-attachment/ApAttachment.mjs +48 -47
- package/es/src/business/ap-attachment/constans.d.ts +4 -0
- package/es/src/business/ap-attachment/constans.mjs +4 -0
- package/es/src/business/ap-attachment/index.d.ts +15 -0
- package/es/src/business/ap-attachment/interface.d.ts +1 -0
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +15 -13
- package/es/src/business/ap-view/components/main-button-content.vue.d.ts +10 -10
- package/es/src/business/ap-view/components/menu-list-content.vue.d.ts +10 -10
- package/es/src/business/batch-input-group/form-item.vue.d.ts +2 -2
- package/es/src/business/batch-input-group/index.vue.d.ts +4 -4
- package/es/src/config-provider/config-provider-props.d.ts +5 -1
- package/es/src/config-provider/config-provider.d.ts +10 -1
- package/es/src/config-provider/hooks/use-global-config.d.ts +5 -1
- package/es/src/config-provider/index.d.ts +16 -1
- package/es/src/utils/config-provider-preset.d.ts +3 -1
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/es/src/work-order-modal/work-order-modal.vue.d.ts +10 -10
- package/es/src/work-order-modal/work-order-modal.vue.mjs +6 -4
- package/lib/src/ap-field/date/index.vue.js +1 -1
- package/lib/src/ap-field/date/read.vue2.js +1 -1
- package/lib/src/ap-field/date-range/index.vue.js +1 -1
- package/lib/src/ap-field/date-range/read.vue2.js +1 -1
- package/lib/src/ap-field/index.d.ts +3 -3
- package/lib/src/ap-field/text/index.vue.d.ts +1 -1
- package/lib/src/ap-field/text/password.vue.d.ts +1 -1
- package/lib/src/ap-field/text/read-password.vue.d.ts +1 -1
- package/lib/src/ap-field/text/read.vue.d.ts +1 -1
- package/lib/src/ap-field/text-area/index.vue.d.ts +1 -1
- package/lib/src/ap-field/text-area/read.vue.d.ts +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +20 -20
- package/lib/src/ap-form/interface.d.ts +12 -1
- package/lib/src/ap-form/item/index.vue.d.ts +34 -34
- package/lib/src/ap-form/items/checkbox/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/date/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/date-range/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/number/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/radio/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/select/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/switch/index.vue.d.ts +2 -2
- package/lib/src/ap-form/items/text/index.vue.d.ts +8 -8
- package/lib/src/ap-form/items/text/password.vue.d.ts +8 -8
- package/lib/src/ap-form/items/text-area/index.vue.d.ts +6 -6
- package/lib/src/ap-form/items/tree-select/index.vue.d.ts +2 -2
- package/lib/src/ap-form/modal-form/index.vue.d.ts +30 -21
- package/lib/src/ap-form/render/item.vue.d.ts +2 -2
- package/lib/src/ap-form/search-form/hooks/use-count-per-row.d.ts +13 -2
- package/lib/src/ap-form/search-form/hooks/use-count-per-row.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.d.ts +298 -20
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/lib/src/ap-table/constants.d.ts +77 -77
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.d.ts +9 -0
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/constans.d.ts +4 -0
- package/lib/src/business/ap-attachment/constans.js +1 -1
- package/lib/src/business/ap-attachment/index.d.ts +15 -0
- package/lib/src/business/ap-attachment/interface.d.ts +1 -0
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/business/ap-view/components/main-button-content.vue.d.ts +10 -10
- package/lib/src/business/ap-view/components/menu-list-content.vue.d.ts +10 -10
- package/lib/src/business/batch-input-group/form-item.vue.d.ts +2 -2
- package/lib/src/business/batch-input-group/index.vue.d.ts +4 -4
- package/lib/src/config-provider/config-provider-props.d.ts +5 -1
- package/lib/src/config-provider/config-provider.d.ts +10 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +5 -1
- package/lib/src/config-provider/index.d.ts +16 -1
- package/lib/src/utils/config-provider-preset.d.ts +3 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/lib/src/work-order-modal/work-order-modal.vue.d.ts +10 -10
- package/lib/src/work-order-modal/work-order-modal.vue.js +1 -1
- package/package.json +3 -3
- package/theme/ap-attachment/ap-attachment.css +8 -4
- package/theme/ap-attachment/ap-attachment.less +8 -4
- package/theme/ap-upload/index.css +6 -0
- package/theme/ap-upload/multiple-file.css +6 -0
- package/theme/ap-upload/multiple-file.less +7 -0
- package/theme/index.css +14 -4
|
@@ -1,113 +1,116 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Q, inject as a, ref as X, watch as Y, nextTick as Z, createElementBlock as U, openBlock as w, normalizeClass as ee, unref as s, createVNode as x, withCtx as k, createElementVNode as I, createTextVNode as oe, toDisplayString as L, withModifiers as te, createCommentVNode as ae, createBlock as se, resolveDynamicComponent as ne } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getPath as
|
|
4
|
-
import { useOss as
|
|
5
|
-
import { message as c, Upload as
|
|
6
|
-
import { UploadOutlined as
|
|
7
|
-
import { fileMatchesAccept as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
3
|
+
import { getPath as re, getName as le, getReturnData as S } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as ie, getOssInstance as z } from "../hooks/useOss.mjs";
|
|
5
|
+
import { message as c, Upload as ue, Button as ce } from "@aplus-frontend/antdv";
|
|
6
|
+
import { UploadOutlined as pe, VerticalAlignBottomOutlined as de } from "@ant-design/icons-vue";
|
|
7
|
+
import { fileMatchesAccept as me, getAcceptText as fe } from "../utils/accept.mjs";
|
|
8
|
+
import { useGlobalConfig as ge } from "../../config-provider/hooks/use-global-config.mjs";
|
|
9
|
+
import { useLocale as he } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
|
+
import { useNamespace as ve } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
const we = { class: "multiple-file-context" }, xe = { key: 0 }, ye = { key: 1 }, Me = /* @__PURE__ */ Q({
|
|
11
12
|
__name: "MultipleFile",
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
|
|
13
|
+
setup(Ce, { expose: B }) {
|
|
14
|
+
const E = ge(
|
|
15
|
+
"downloadCenterTriggerConfig"
|
|
16
|
+
), { t: r } = he(), { b: N } = ve("ap-upload-multiple-file"), { put: O } = ie(), P = a("theme"), D = a("dirName"), y = a("accept") || "*", _ = a("maxSize") ?? 500, V = a("title") || r("ap.apUpload.uploadFile"), m = a("subTitle"), l = a("maxCount") ?? 10, p = a("uploadingCount"), b = a("beforeUpload"), F = a("customRequest"), T = a("getOssAccess"), q = a("maxSizeErrorMsg"), j = a("maxCountErrorMsg"), $ = a("acceptErrorMsg"), A = a("onRemove"), C = a("showUploadErrorMsg"), n = a("value"), i = [], f = a("needName"), d = X(null);
|
|
17
|
+
Y(
|
|
15
18
|
() => n?.value,
|
|
16
19
|
function(e) {
|
|
17
|
-
!
|
|
20
|
+
!d?.value?.fileList?.length && e && R(e);
|
|
18
21
|
},
|
|
19
22
|
{ immediate: !0 }
|
|
20
23
|
);
|
|
21
|
-
function
|
|
24
|
+
function R(e) {
|
|
22
25
|
if (!e) {
|
|
23
|
-
u = [],
|
|
26
|
+
u = [], d.value.fileList = [], n.value = void 0, i.splice(0, i.length);
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
[
|
|
30
|
-
|
|
29
|
+
Z(() => {
|
|
30
|
+
const o = e.map((t) => {
|
|
31
|
+
const h = re(f, t), K = le(f, t), v = new File(
|
|
32
|
+
[t],
|
|
33
|
+
K,
|
|
31
34
|
{}
|
|
32
35
|
);
|
|
33
|
-
return
|
|
36
|
+
return v.response = h, v.uid = h, v.status = "done", v;
|
|
34
37
|
});
|
|
35
|
-
if (
|
|
38
|
+
if (l && o.length > l) {
|
|
36
39
|
c.warning(
|
|
37
40
|
r("ap.apUpload.fileInitializationException", {
|
|
38
|
-
maxCount:
|
|
41
|
+
maxCount: l
|
|
39
42
|
})
|
|
40
43
|
);
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
u.push(
|
|
45
|
-
uid:
|
|
46
|
-
path:
|
|
46
|
+
o.forEach((t) => {
|
|
47
|
+
u.push(t), i.push({
|
|
48
|
+
uid: t.uid,
|
|
49
|
+
path: t.response
|
|
47
50
|
});
|
|
48
|
-
}),
|
|
51
|
+
}), d.value.fileList = o, n.value = e;
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
|
-
|
|
52
|
-
let u = [],
|
|
54
|
+
B({ setValue: R });
|
|
55
|
+
let u = [], M;
|
|
53
56
|
function g(e) {
|
|
54
57
|
setTimeout(() => {
|
|
55
|
-
const
|
|
56
|
-
(
|
|
58
|
+
const o = d.value.fileList.findIndex(
|
|
59
|
+
(t) => t.uid === e.uid
|
|
57
60
|
);
|
|
58
|
-
|
|
61
|
+
o >= 0 && d.value.fileList.splice(o, 1);
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
|
-
async function
|
|
62
|
-
if (
|
|
63
|
-
return clearTimeout(
|
|
64
|
+
async function G(e) {
|
|
65
|
+
if (l && l > 1 && u.length >= l)
|
|
66
|
+
return clearTimeout(M), M = setTimeout(() => {
|
|
64
67
|
c.warning(
|
|
65
|
-
|
|
66
|
-
maxCount:
|
|
68
|
+
j || r("ap.apUpload.maxUploadFiles", {
|
|
69
|
+
maxCount: l
|
|
67
70
|
})
|
|
68
71
|
);
|
|
69
72
|
}), g(e), !1;
|
|
70
|
-
if (e.size >
|
|
73
|
+
if (e.size > _ * 1024 * 1024)
|
|
71
74
|
return c.warning(
|
|
72
|
-
|
|
73
|
-
maxSize:
|
|
75
|
+
q || r("ap.apUpload.maxUploadFileSize", {
|
|
76
|
+
maxSize: _
|
|
74
77
|
})
|
|
75
78
|
), g(e), !1;
|
|
76
|
-
if (!
|
|
79
|
+
if (!me(e, y))
|
|
77
80
|
return c.warning(
|
|
78
|
-
|
|
81
|
+
$ || r("ap.apUpload.fileFormatNotSupported")
|
|
79
82
|
), g(e), !1;
|
|
80
|
-
if (typeof
|
|
83
|
+
if (typeof b == "function" && await b(e) === !1)
|
|
81
84
|
return g(e), !1;
|
|
82
|
-
|
|
85
|
+
l && l === 1 && (u = [], n.value = void 0), u.push(e);
|
|
83
86
|
}
|
|
84
|
-
async function
|
|
85
|
-
if (p.value++, typeof
|
|
86
|
-
|
|
87
|
-
onProgress: (
|
|
87
|
+
async function W(e) {
|
|
88
|
+
if (p.value++, typeof F == "function") {
|
|
89
|
+
F({
|
|
90
|
+
onProgress: (o) => {
|
|
88
91
|
setTimeout(() => {
|
|
89
92
|
e.onProgress({
|
|
90
|
-
percent:
|
|
93
|
+
percent: o
|
|
91
94
|
});
|
|
92
95
|
});
|
|
93
96
|
},
|
|
94
|
-
onError: (
|
|
95
|
-
|
|
97
|
+
onError: (o) => {
|
|
98
|
+
C && c.warning(o || r("ap.apUpload.networkAnomaly")), setTimeout(() => {
|
|
96
99
|
e.onError({
|
|
97
|
-
name:
|
|
98
|
-
message:
|
|
100
|
+
name: o,
|
|
101
|
+
message: o
|
|
99
102
|
});
|
|
100
103
|
}), p.value--;
|
|
101
104
|
},
|
|
102
|
-
onSuccess: (
|
|
105
|
+
onSuccess: (o) => {
|
|
103
106
|
setTimeout(() => {
|
|
104
|
-
e.onSuccess(
|
|
107
|
+
e.onSuccess(o);
|
|
105
108
|
}), n.value = [
|
|
106
109
|
...n.value || [],
|
|
107
|
-
S(f,
|
|
108
|
-
],
|
|
110
|
+
S(f, o, e.file.name)
|
|
111
|
+
], i.push({
|
|
109
112
|
uid: e.file.uid,
|
|
110
|
-
path:
|
|
113
|
+
path: o
|
|
111
114
|
}), p.value--;
|
|
112
115
|
},
|
|
113
116
|
file: e.file
|
|
@@ -115,92 +118,112 @@ const fe = { class: "multiple-file-context" }, ge = { key: 0 }, ve = { key: 1 },
|
|
|
115
118
|
return;
|
|
116
119
|
}
|
|
117
120
|
try {
|
|
118
|
-
const
|
|
119
|
-
e.file.oss =
|
|
121
|
+
const o = await z(T);
|
|
122
|
+
e.file.oss = o, O({
|
|
120
123
|
file: e.file,
|
|
121
|
-
dirName:
|
|
122
|
-
oss:
|
|
123
|
-
successCallBack(
|
|
124
|
-
e.onSuccess(
|
|
124
|
+
dirName: D,
|
|
125
|
+
oss: o,
|
|
126
|
+
successCallBack(t) {
|
|
127
|
+
e.onSuccess(t), n.value = [
|
|
125
128
|
...n.value || [],
|
|
126
|
-
S(f,
|
|
127
|
-
],
|
|
129
|
+
S(f, t, e.file.name)
|
|
130
|
+
], i.push({
|
|
128
131
|
uid: e.file.uid,
|
|
129
|
-
path:
|
|
132
|
+
path: t
|
|
130
133
|
}), p.value--;
|
|
131
134
|
},
|
|
132
|
-
errorCallBack(
|
|
133
|
-
|
|
134
|
-
name:
|
|
135
|
-
message:
|
|
135
|
+
errorCallBack(t) {
|
|
136
|
+
C && c.warning(t || r("ap.apUpload.networkAnomaly")), e.onError({
|
|
137
|
+
name: t,
|
|
138
|
+
message: t
|
|
136
139
|
}), p.value--;
|
|
137
140
|
},
|
|
138
|
-
progressCallBack(
|
|
141
|
+
progressCallBack(t) {
|
|
139
142
|
e.onProgress({
|
|
140
|
-
percent:
|
|
143
|
+
percent: t
|
|
141
144
|
});
|
|
142
145
|
}
|
|
143
146
|
});
|
|
144
|
-
} catch (
|
|
145
|
-
|
|
146
|
-
typeof
|
|
147
|
+
} catch (o) {
|
|
148
|
+
C && c.warning(
|
|
149
|
+
typeof o?.message == "string" ? o.message : r("ap.apUpload.networkAnomaly")
|
|
147
150
|
), e.onError({
|
|
148
|
-
name:
|
|
149
|
-
message:
|
|
151
|
+
name: o?.message || r("ap.apUpload.networkAnomaly"),
|
|
152
|
+
message: o?.message || r("ap.apUpload.networkAnomaly")
|
|
150
153
|
}), p.value--;
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
|
-
function
|
|
154
|
-
if (
|
|
156
|
+
function H(e) {
|
|
157
|
+
if (A && A?.(e), e.response) {
|
|
155
158
|
if (Array.isArray(n.value)) {
|
|
156
|
-
const
|
|
157
|
-
|
|
159
|
+
const t = i.findIndex((h) => h.uid === e.uid);
|
|
160
|
+
t >= 0 && (n?.value.splice(t, 1), i.splice(t, 1)), n.value.length === 0 && (n.value = void 0);
|
|
158
161
|
}
|
|
159
162
|
} else
|
|
160
163
|
e?.oss?.pauseUpload();
|
|
161
|
-
const
|
|
162
|
-
(
|
|
164
|
+
const o = u.findIndex(
|
|
165
|
+
(t) => t.uid === e.uid
|
|
163
166
|
);
|
|
164
|
-
return u.splice(
|
|
167
|
+
return u.splice(o, 1), Promise.resolve(!0);
|
|
165
168
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
[
|
|
169
|
-
|
|
169
|
+
const J = async (e) => {
|
|
170
|
+
if (E.value?.trigger) {
|
|
171
|
+
let o = [e].map((t) => ({
|
|
172
|
+
objectName: t.response,
|
|
173
|
+
fileName: t.name
|
|
174
|
+
}));
|
|
175
|
+
E.value?.trigger?.(o);
|
|
176
|
+
} else
|
|
177
|
+
(await z(T)).downloadFile([
|
|
178
|
+
{
|
|
179
|
+
path: e.response,
|
|
180
|
+
fileName: e.name
|
|
181
|
+
}
|
|
182
|
+
]);
|
|
183
|
+
};
|
|
184
|
+
return (e, o) => (w(), U("div", {
|
|
185
|
+
class: ee({
|
|
186
|
+
[s(N)()]: !0,
|
|
187
|
+
[s(N)("admin")]: s(P) === "admin"
|
|
170
188
|
})
|
|
171
189
|
}, [
|
|
172
|
-
|
|
190
|
+
x(s(ue), {
|
|
173
191
|
ref_key: "uploadRef",
|
|
174
|
-
ref:
|
|
175
|
-
accept: s(
|
|
192
|
+
ref: d,
|
|
193
|
+
accept: s(y),
|
|
176
194
|
multiple: "",
|
|
177
|
-
"max-count": s(
|
|
195
|
+
"max-count": s(l),
|
|
178
196
|
progress: {
|
|
179
197
|
strokeWidth: 3,
|
|
180
198
|
showInfo: !1,
|
|
181
199
|
strokeColor: "#0070FF"
|
|
182
200
|
},
|
|
183
|
-
"before-upload":
|
|
184
|
-
"custom-request":
|
|
185
|
-
|
|
201
|
+
"before-upload": G,
|
|
202
|
+
"custom-request": W,
|
|
203
|
+
"show-upload-list": { showDownloadIcon: !0, showRemoveIcon: !0 },
|
|
204
|
+
onRemove: H,
|
|
205
|
+
onDownload: J
|
|
186
206
|
}, {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
207
|
+
downloadIcon: k(() => [
|
|
208
|
+
x(s(de))
|
|
209
|
+
]),
|
|
210
|
+
default: k(() => [
|
|
211
|
+
I("div", we, [
|
|
212
|
+
x(s(ce), { class: "file-btn" }, {
|
|
213
|
+
default: k(() => [
|
|
214
|
+
x(s(pe)),
|
|
215
|
+
oe(" " + L(s(V)), 1)
|
|
193
216
|
]),
|
|
194
217
|
_: 1
|
|
195
218
|
}),
|
|
196
|
-
|
|
219
|
+
I("div", {
|
|
197
220
|
class: "sub-title",
|
|
198
|
-
onClick:
|
|
221
|
+
onClick: o[0] || (o[0] = te(() => {
|
|
199
222
|
}, ["stop"]))
|
|
200
223
|
}, [
|
|
201
|
-
typeof s(
|
|
202
|
-
(
|
|
203
|
-
])) :
|
|
224
|
+
typeof s(m) == "string" ? (w(), U("div", xe, L(s(m) || `${s(r)("ap.apUpload.supportExtension")}:${s(fe)(s(y))}`), 1)) : s(m) ? (w(), U("div", ye, [
|
|
225
|
+
(w(), se(ne(s(m))))
|
|
226
|
+
])) : ae("", !0)
|
|
204
227
|
])
|
|
205
228
|
])
|
|
206
229
|
]),
|
|
@@ -210,5 +233,5 @@ const fe = { class: "multiple-file-context" }, ge = { key: 0 }, ve = { key: 1 },
|
|
|
210
233
|
}
|
|
211
234
|
});
|
|
212
235
|
export {
|
|
213
|
-
|
|
236
|
+
Me as default
|
|
214
237
|
};
|
|
@@ -22,6 +22,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
22
22
|
type: StringConstructor;
|
|
23
23
|
default: string;
|
|
24
24
|
};
|
|
25
|
+
maxWidth: {
|
|
26
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
25
29
|
needName: {
|
|
26
30
|
type: PropType<{
|
|
27
31
|
nameKey?: string;
|
|
@@ -63,6 +67,10 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
63
67
|
type: StringConstructor;
|
|
64
68
|
default: string;
|
|
65
69
|
};
|
|
70
|
+
maxWidth: {
|
|
71
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
72
|
+
default: string;
|
|
73
|
+
};
|
|
66
74
|
needName: {
|
|
67
75
|
type: PropType<{
|
|
68
76
|
nameKey?: string;
|
|
@@ -86,6 +94,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
86
94
|
}>> & Readonly<{}>, {
|
|
87
95
|
size: string;
|
|
88
96
|
disabled: boolean;
|
|
97
|
+
maxWidth: string | number;
|
|
89
98
|
needName: {
|
|
90
99
|
nameKey?: string;
|
|
91
100
|
pathKey?: string;
|
|
@@ -1,52 +1,50 @@
|
|
|
1
|
-
import { defineComponent as M, ref as
|
|
2
|
-
import { Tooltip as
|
|
1
|
+
import { defineComponent as M, ref as p, useSlots as S, computed as o, cloneVNode as U, toRaw as f, unref as W, createVNode as t, createTextVNode as _ } from "vue";
|
|
2
|
+
import { Tooltip as j, Popover as K } from "@aplus-frontend/antdv";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
|
-
import { ApAttachmentProps as
|
|
5
|
-
import { getHexWithOpacity as
|
|
6
|
-
import { useOssInit as
|
|
7
|
-
import { debounce as
|
|
4
|
+
import { ApAttachmentProps as B } from "./constans.mjs";
|
|
5
|
+
import { getHexWithOpacity as G, getFileInfo as w } from "../../ap-download/utils/getFileInfo.mjs";
|
|
6
|
+
import { useOssInit as H } from "../../ap-download/hooks/index.mjs";
|
|
7
|
+
import { debounce as R, isArray as q } from "lodash-unified";
|
|
8
8
|
import { LoadingOutlined as v } from "@ant-design/icons-vue";
|
|
9
|
-
import { warning as
|
|
10
|
-
import { useNamespace as
|
|
9
|
+
import { warning as D } from "../../utils/warning.mjs";
|
|
10
|
+
import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
11
|
import { useGlobalConfig as g } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
-
import { useLocale as
|
|
13
|
-
const
|
|
12
|
+
import { useLocale as J } from "../../config-provider/hooks/use-locale.mjs";
|
|
13
|
+
const ce = /* @__PURE__ */ M({
|
|
14
14
|
name: "ApAttachment",
|
|
15
|
-
props:
|
|
15
|
+
props: B(),
|
|
16
16
|
setup(e) {
|
|
17
17
|
const {
|
|
18
18
|
b: y,
|
|
19
19
|
e: l
|
|
20
|
-
} =
|
|
21
|
-
lang:
|
|
22
|
-
t:
|
|
23
|
-
} =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const a = m.default ? m.default()[0] : null;
|
|
30
|
-
return a ? _(a, {
|
|
20
|
+
} = E("ap-attachment"), F = g("uiMode"), b = g("apUpload"), h = g("downloadCenterTriggerConfig"), {
|
|
21
|
+
lang: x,
|
|
22
|
+
t: m
|
|
23
|
+
} = J(), i = p(!1), c = p(""), u = S(), O = o(() => x.value === "zh-cn" ? "zh_CN" : "en_US"), r = o(() => e.attachmentList.length === 1), N = o(() => e.needName ? e.attachmentList.length > 0 && e.needName && e.needName.nameKey ? e.attachmentList[0][e.needName.nameKey] : "" : e.attachmentList.length > 0 ? e.attachmentList[0].fileName : ""), T = o(() => r.value ? N.value : m("ap.apAttachment.downloadall")), L = o(() => e.color ? e.color : F.value === "aplus" ? "#0070FF" : "#1890FF"), A = o(() => ({
|
|
24
|
+
"--download-main-color": L.value,
|
|
25
|
+
"--download-main-color-opacity": G(L.value, 0.6)
|
|
26
|
+
})), P = o(() => e.getOssAccess || b.value?.getOssAccess), k = o(() => {
|
|
27
|
+
const a = u.default ? u.default()[0] : null;
|
|
28
|
+
return a ? U(a, {
|
|
31
29
|
style: {
|
|
32
30
|
"font-size": "16px"
|
|
33
31
|
}
|
|
34
32
|
}) : null;
|
|
35
|
-
}), d =
|
|
33
|
+
}), d = R(async (a, s) => {
|
|
36
34
|
if (!e.disabled) {
|
|
37
35
|
i.value = !0, s && (c.value = s);
|
|
38
36
|
try {
|
|
39
|
-
const
|
|
37
|
+
const n = q(f(a)) ? f(a) : [f(a)];
|
|
40
38
|
if (h.value?.trigger) {
|
|
41
|
-
const I = w(e.needName,
|
|
42
|
-
objectName:
|
|
43
|
-
fileName:
|
|
39
|
+
const I = w(e.needName, n).map((C) => ({
|
|
40
|
+
objectName: C.path,
|
|
41
|
+
fileName: C.fileName
|
|
44
42
|
}));
|
|
45
43
|
h.value?.trigger(I);
|
|
46
44
|
} else
|
|
47
|
-
await (await
|
|
48
|
-
} catch (
|
|
49
|
-
|
|
45
|
+
await (await H(P.value, W(O))).downloadFile(w(e.needName, n));
|
|
46
|
+
} catch (n) {
|
|
47
|
+
D(!1, n);
|
|
50
48
|
} finally {
|
|
51
49
|
i.value = !1, c.value = "";
|
|
52
50
|
}
|
|
@@ -54,11 +52,11 @@ const se = /* @__PURE__ */ M({
|
|
|
54
52
|
}, 500), V = (a) => a && a.length > 0 ? t("ul", {
|
|
55
53
|
class: [l("file-list")],
|
|
56
54
|
style: A.value
|
|
57
|
-
}, [a.map((s,
|
|
58
|
-
key:
|
|
55
|
+
}, [a.map((s, n) => t("li", {
|
|
56
|
+
key: n,
|
|
59
57
|
class: [l("file-item")],
|
|
60
|
-
onClick: () => d(s,
|
|
61
|
-
}, [i.value && c.value ===
|
|
58
|
+
onClick: () => d(s, n + 1)
|
|
59
|
+
}, [i.value && c.value === n + 1 ? t("span", {
|
|
62
60
|
class: [l("spin")]
|
|
63
61
|
}, [t(v, {
|
|
64
62
|
spin: !0
|
|
@@ -69,38 +67,41 @@ const se = /* @__PURE__ */ M({
|
|
|
69
67
|
class: [l("spin")]
|
|
70
68
|
}, [t(v, {
|
|
71
69
|
spin: !0
|
|
72
|
-
}, null)]) : null,
|
|
70
|
+
}, null)]) : null, m("ap.apAttachment.downloadall")])]) : null;
|
|
73
71
|
return () => e.attachmentList?.length > 0 && t("div", {
|
|
74
72
|
class: [y()],
|
|
75
|
-
style: [
|
|
76
|
-
}, [t(
|
|
77
|
-
title:
|
|
73
|
+
style: [A.value]
|
|
74
|
+
}, [t(j, {
|
|
75
|
+
title: T.value,
|
|
78
76
|
placement: e.textToolTipPlacement,
|
|
79
77
|
color: e.toolTipBgColor
|
|
80
78
|
}, {
|
|
81
79
|
default: () => [t("div", {
|
|
82
80
|
class: [l("content")],
|
|
83
|
-
onClick: () => d(
|
|
81
|
+
onClick: () => d(r.value ? e.attachmentList[0] : e.attachmentList, "global")
|
|
84
82
|
}, [i.value && c.value === "global" ? t("div", {
|
|
85
83
|
class: [l("spin")]
|
|
86
84
|
}, [t(v, {
|
|
87
85
|
spin: !0
|
|
88
|
-
}, null)]) : null,
|
|
86
|
+
}, null)]) : null, u.default ? t("div", {
|
|
89
87
|
class: [l("text-render")]
|
|
90
|
-
}, [
|
|
91
|
-
class: [l("text-inner")]
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
}, [k.value, _(" ")]) : null, t("div", {
|
|
89
|
+
class: [l("text-inner")],
|
|
90
|
+
style: {
|
|
91
|
+
"max-width": e.maxWidth ? e.maxWidth + "px" : "auto"
|
|
92
|
+
}
|
|
93
|
+
}, [N.value])])]
|
|
94
|
+
}), t(K, {
|
|
94
95
|
content: V(e.attachmentList),
|
|
95
96
|
placement: e.fileMorePopoverPlacement,
|
|
96
97
|
color: "#fff"
|
|
97
98
|
}, {
|
|
98
|
-
default: () => [!
|
|
99
|
+
default: () => [!r.value && t("div", {
|
|
99
100
|
class: [l("more")]
|
|
100
|
-
}, [
|
|
101
|
+
}, [m("ap.apAttachment.more")])]
|
|
101
102
|
})]);
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
105
|
export {
|
|
105
|
-
|
|
106
|
+
ce as default
|
|
106
107
|
};
|
|
@@ -24,6 +24,10 @@ declare const ApAttachment: {
|
|
|
24
24
|
type: StringConstructor;
|
|
25
25
|
default: string;
|
|
26
26
|
};
|
|
27
|
+
maxWidth: {
|
|
28
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
27
31
|
needName: {
|
|
28
32
|
type: PropType<{
|
|
29
33
|
nameKey?: string;
|
|
@@ -47,6 +51,7 @@ declare const ApAttachment: {
|
|
|
47
51
|
}>> & Readonly<{}>, () => false | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
48
52
|
size: string;
|
|
49
53
|
disabled: boolean;
|
|
54
|
+
maxWidth: string | number;
|
|
50
55
|
needName: {
|
|
51
56
|
nameKey?: string;
|
|
52
57
|
pathKey?: string;
|
|
@@ -82,6 +87,10 @@ declare const ApAttachment: {
|
|
|
82
87
|
type: StringConstructor;
|
|
83
88
|
default: string;
|
|
84
89
|
};
|
|
90
|
+
maxWidth: {
|
|
91
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
92
|
+
default: string;
|
|
93
|
+
};
|
|
85
94
|
needName: {
|
|
86
95
|
type: PropType<{
|
|
87
96
|
nameKey?: string;
|
|
@@ -105,6 +114,7 @@ declare const ApAttachment: {
|
|
|
105
114
|
}>> & Readonly<{}>, () => false | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
106
115
|
size: string;
|
|
107
116
|
disabled: boolean;
|
|
117
|
+
maxWidth: string | number;
|
|
108
118
|
needName: {
|
|
109
119
|
nameKey?: string;
|
|
110
120
|
pathKey?: string;
|
|
@@ -137,6 +147,10 @@ declare const ApAttachment: {
|
|
|
137
147
|
type: StringConstructor;
|
|
138
148
|
default: string;
|
|
139
149
|
};
|
|
150
|
+
maxWidth: {
|
|
151
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
152
|
+
default: string;
|
|
153
|
+
};
|
|
140
154
|
needName: {
|
|
141
155
|
type: PropType<{
|
|
142
156
|
nameKey?: string;
|
|
@@ -160,6 +174,7 @@ declare const ApAttachment: {
|
|
|
160
174
|
}>> & Readonly<{}>, () => false | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
161
175
|
size: string;
|
|
162
176
|
disabled: boolean;
|
|
177
|
+
maxWidth: string | number;
|
|
163
178
|
needName: {
|
|
164
179
|
nameKey?: string;
|
|
165
180
|
pathKey?: string;
|
|
@@ -10,4 +10,5 @@ export type ApAttachmentProps = Required<{
|
|
|
10
10
|
textToolTipPlacement?: TooltipPlacement;
|
|
11
11
|
fileMorePopoverPlacement?: TooltipPlacement;
|
|
12
12
|
toolTipBgColor?: string;
|
|
13
|
+
maxWidth?: number;
|
|
13
14
|
} & Pick<ApDownLoadProps, 'color' | 'size' | 'needName' | 'disabled'>> & Pick<ApDownLoadProps, 'getOssAccess'>;
|