@aplus-frontend/ui 0.4.13 → 0.4.15
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 +84 -80
- package/es/src/ap-descriptions/help-message/index.vue2.mjs +17 -12
- package/es/src/ap-field/date/helper.mjs +9 -9
- package/es/src/ap-table/ap-table.vue2.mjs +206 -181
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +62 -62
- package/es/src/ap-upload/apUpload.vue.d.ts +9 -0
- package/es/src/ap-upload/apUpload.vue.mjs +22 -18
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +66 -66
- package/es/src/ap-upload/components/Picture.vue2.mjs +82 -82
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +114 -114
- package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +79 -67
- package/es/src/config-provider/config-provider.d.ts +3 -0
- package/es/src/config-provider/css-var.d.ts +3 -0
- package/es/src/config-provider/css-var.mjs +21 -14
- package/es/src/config-provider/index.d.ts +15 -0
- package/es/src/hooks/index.d.ts +1 -0
- package/es/src/hooks/index.mjs +6 -4
- package/es/src/hooks/useResize.d.ts +8 -0
- package/es/src/hooks/useResize.mjs +23 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +212 -209
- package/es/src/path-map.mjs +2 -1
- package/es/src/resize-observer/index.d.ts +3 -0
- package/es/src/resize-observer/index.mjs +2 -0
- package/es/src/resize-observer/index.vue.d.ts +25 -0
- package/es/src/resize-observer/index.vue.mjs +45 -0
- package/es/src/resize-observer/index.vue2.mjs +4 -0
- package/es/src/resize-observer/interface.d.ts +27 -0
- package/es/src/resize-observer/interface.mjs +1 -0
- package/es/src/resize-observer/style/css.d.ts +1 -0
- package/es/src/resize-observer/style/css.js +1 -0
- package/es/src/resize-observer/style/index.d.ts +1 -0
- package/es/src/resize-observer/style/index.js +1 -0
- package/es/src/scroll-bar/index.vue.d.ts +1 -0
- package/es/src/scroll-bar/index.vue.mjs +31 -30
- package/es/src/scroll-bar/interface.d.ts +3 -1
- package/es/src/theme/antd-global-overwrite/admin/index.css +24 -2
- package/es/src/theme/antd-global-overwrite/admin/table.css +24 -2
- package/es/src/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/es/src/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/es/src/utils/index.d.ts +1 -0
- package/es/src/utils/index.mjs +40 -30
- package/lib/index.js +1 -1
- package/lib/src/ap-descriptions/help-message/index.vue2.js +1 -1
- package/lib/src/ap-field/date/helper.js +1 -1
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/ap-upload/apUpload.vue.d.ts +9 -0
- 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/business/ap-export-group/ApExportGroup.vue2.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +3 -0
- package/lib/src/config-provider/css-var.d.ts +3 -0
- package/lib/src/config-provider/css-var.js +1 -1
- package/lib/src/config-provider/index.d.ts +15 -0
- package/lib/src/hooks/index.d.ts +1 -0
- package/lib/src/hooks/index.js +1 -1
- package/lib/src/hooks/useResize.d.ts +8 -0
- package/lib/src/hooks/useResize.js +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/resize-observer/index.d.ts +3 -0
- package/lib/src/resize-observer/index.js +1 -0
- package/lib/src/resize-observer/index.vue.d.ts +25 -0
- package/lib/src/resize-observer/index.vue.js +1 -0
- package/lib/src/resize-observer/index.vue2.js +1 -0
- package/lib/src/resize-observer/interface.d.ts +27 -0
- package/lib/src/resize-observer/interface.js +1 -0
- package/lib/src/resize-observer/style/css.cjs +1 -0
- package/lib/src/resize-observer/style/css.d.ts +1 -0
- package/lib/src/resize-observer/style/index.cjs +1 -0
- package/lib/src/resize-observer/style/index.d.ts +1 -0
- package/lib/src/scroll-bar/index.vue.d.ts +1 -0
- package/lib/src/scroll-bar/index.vue.js +1 -1
- package/lib/src/scroll-bar/interface.d.ts +3 -1
- package/lib/src/theme/antd-global-overwrite/admin/index.css +24 -2
- package/lib/src/theme/antd-global-overwrite/admin/table.css +24 -2
- package/lib/src/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/lib/src/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.js +1 -1
- package/package.json +3 -3
- package/theme/antd-global-overwrite/admin/index.css +24 -2
- package/theme/antd-global-overwrite/admin/table.css +24 -2
- package/theme/antd-global-overwrite/admin/table.less +8 -2
- package/theme/antd-global-overwrite/aplus/index.css +24 -2
- package/theme/antd-global-overwrite/aplus/table.css +24 -2
- package/theme/antd-global-overwrite/aplus/table.less +7 -2
- package/theme/ap-descriptions/ap-descriptions.css +3 -0
- package/theme/ap-descriptions/ap-descriptions.less +7 -0
- package/theme/ap-table/ap-table.css +8 -1
- package/theme/ap-table/ap-table.less +11 -9
- package/theme/ap-table-modal/index.css +8 -1
- package/theme/index.css +11 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { ref as ee, reactive as
|
|
1
|
+
import { ref as ee, reactive as I, unref as h, nextTick as te, onMounted as re, watch as oe, computed as A, createVNode as C } from "vue";
|
|
2
2
|
import { useTableSortedAndFiltered as ne } from "./use-sorted-filtered.mjs";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
4
|
import { parseFieldValue as ae, dataIndexToStr as se, isEqualCustom as ce } from "../utils.mjs";
|
|
5
|
-
import { isArray as
|
|
5
|
+
import { isArray as N, isEqualWith as ie } from "lodash-unified";
|
|
6
6
|
import { useLocale as le } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
7
|
import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
-
const
|
|
8
|
+
const S = 1, L = 100;
|
|
9
9
|
function fe(g) {
|
|
10
10
|
const l = {};
|
|
11
|
-
return g && (g === !0 ? (l.current =
|
|
11
|
+
return g && (g === !0 ? (l.current = S, l.pageSize = L) : (l.current = g.defaultCurrent || S, l.pageSize = g.defaultPageSize || L)), l;
|
|
12
12
|
}
|
|
13
13
|
const Te = ({
|
|
14
14
|
manual: g = !1,
|
|
15
15
|
request: l,
|
|
16
|
-
defaultParams:
|
|
17
|
-
defaultData:
|
|
18
|
-
formatParams:
|
|
19
|
-
paramsValueTypeMap:
|
|
20
|
-
resetFieldsIgnores:
|
|
16
|
+
defaultParams: v = {},
|
|
17
|
+
defaultData: y = [],
|
|
18
|
+
formatParams: D,
|
|
19
|
+
paramsValueTypeMap: R,
|
|
20
|
+
resetFieldsIgnores: V,
|
|
21
21
|
filterFields: U,
|
|
22
22
|
sortFields: B,
|
|
23
23
|
pagination: p = {
|
|
24
|
-
defaultCurrent:
|
|
25
|
-
defaultPageSize:
|
|
24
|
+
defaultCurrent: S,
|
|
25
|
+
defaultPageSize: L,
|
|
26
26
|
showLessItems: !1,
|
|
27
27
|
showTotal: !0
|
|
28
28
|
}
|
|
29
29
|
}) => {
|
|
30
30
|
let b = 0, s = {};
|
|
31
|
-
const K = p ?? {}, M = (e) =>
|
|
31
|
+
const K = p ?? {}, M = (e) => D ? D(e) : e, z = ee(), c = I(fe(p)), {
|
|
32
32
|
getColumnSFConfig: $,
|
|
33
33
|
setSF: G,
|
|
34
34
|
clearAll: J
|
|
35
35
|
} = ne(), {
|
|
36
|
-
t:
|
|
36
|
+
t: T
|
|
37
37
|
} = le(), {
|
|
38
|
-
b:
|
|
39
|
-
} = ue("ap-table"), o =
|
|
40
|
-
total:
|
|
41
|
-
records:
|
|
38
|
+
b: P
|
|
39
|
+
} = ue("ap-table"), o = I({
|
|
40
|
+
total: y.length,
|
|
41
|
+
records: y,
|
|
42
42
|
loading: !1
|
|
43
|
-
}),
|
|
43
|
+
}), F = () => {
|
|
44
44
|
var e, t;
|
|
45
|
-
return ((t = (e =
|
|
46
|
-
},
|
|
45
|
+
return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
46
|
+
}, O = async (e) => {
|
|
47
47
|
var n;
|
|
48
48
|
const t = M(e), r = Date.now();
|
|
49
49
|
b = r, o.loading = !0;
|
|
50
50
|
try {
|
|
51
51
|
const a = await l({
|
|
52
|
-
...h(
|
|
52
|
+
...h(v),
|
|
53
53
|
...t
|
|
54
54
|
});
|
|
55
55
|
b === r && (o.total = a.total || ((n = a.data) == null ? void 0 : n.length) || 0, o.records = [...a.data || []]);
|
|
@@ -58,47 +58,47 @@ const Te = ({
|
|
|
58
58
|
} finally {
|
|
59
59
|
o.loading = !1;
|
|
60
60
|
}
|
|
61
|
-
},
|
|
61
|
+
}, _ = (e) => {
|
|
62
62
|
const t = {};
|
|
63
63
|
return Object.entries(e).forEach(([r, n]) => {
|
|
64
|
-
if (t[r] = n,
|
|
65
|
-
const a =
|
|
64
|
+
if (t[r] = n, R && n) {
|
|
65
|
+
const a = R[r];
|
|
66
66
|
a && (t[r] = ae(a, n));
|
|
67
67
|
}
|
|
68
68
|
}), t;
|
|
69
69
|
}, Q = async (e) => {
|
|
70
70
|
var n, a, u, f, d;
|
|
71
|
-
const t =
|
|
72
|
-
Object.entries(t).forEach(([m,
|
|
73
|
-
|
|
74
|
-
}), await ((a = (n =
|
|
71
|
+
const t = F(), r = {};
|
|
72
|
+
Object.entries(t).forEach(([m, x]) => {
|
|
73
|
+
V && V.indexOf(m) > -1 && (r[m] = x);
|
|
74
|
+
}), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), te(() => {
|
|
75
75
|
e == null || e();
|
|
76
76
|
});
|
|
77
|
-
},
|
|
77
|
+
}, w = (e) => {
|
|
78
78
|
s = e;
|
|
79
|
-
const t =
|
|
80
|
-
|
|
79
|
+
const t = _(e);
|
|
80
|
+
O(t);
|
|
81
81
|
}, W = (e) => {
|
|
82
|
-
|
|
82
|
+
w({
|
|
83
83
|
...s,
|
|
84
84
|
...e
|
|
85
85
|
});
|
|
86
86
|
}, E = () => {
|
|
87
|
-
const e =
|
|
88
|
-
p && (c.current =
|
|
87
|
+
const e = F();
|
|
88
|
+
p && (c.current = S), w({
|
|
89
89
|
...e,
|
|
90
90
|
filter: s.filter,
|
|
91
91
|
sort: s.sort,
|
|
92
|
-
current: p ?
|
|
92
|
+
current: p ? S : void 0,
|
|
93
93
|
pageSize: p ? s.pageSize || c.pageSize : void 0
|
|
94
94
|
});
|
|
95
95
|
}, Z = () => {
|
|
96
96
|
J(), s.sort = {}, s.filter = {}, Q(E);
|
|
97
|
-
},
|
|
98
|
-
|
|
97
|
+
}, j = () => {
|
|
98
|
+
w(s);
|
|
99
99
|
}, H = (e) => {
|
|
100
100
|
if (!p)
|
|
101
|
-
|
|
101
|
+
j();
|
|
102
102
|
else {
|
|
103
103
|
const {
|
|
104
104
|
current: t,
|
|
@@ -108,16 +108,16 @@ const Te = ({
|
|
|
108
108
|
current: u > 0 ? u : 1
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
},
|
|
112
|
-
var m,
|
|
113
|
-
const n =
|
|
111
|
+
}, q = (e, t, r) => {
|
|
112
|
+
var m, x;
|
|
113
|
+
const n = F();
|
|
114
114
|
c.current = e.current, c.pageSize = e.pageSize, G(t, r);
|
|
115
|
-
const a =
|
|
115
|
+
const a = N(r) ? [...r] : [r], u = {};
|
|
116
116
|
for (const i of a)
|
|
117
117
|
(m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[se(i.columnKey || i.field)] = i.order);
|
|
118
118
|
const f = {};
|
|
119
119
|
for (const i of Object.keys(t))
|
|
120
|
-
(
|
|
120
|
+
(x = h(U)) != null && x.includes(i) && t[i] && (f[i] = t[i]);
|
|
121
121
|
const d = {
|
|
122
122
|
...n,
|
|
123
123
|
filter: f,
|
|
@@ -125,10 +125,10 @@ const Te = ({
|
|
|
125
125
|
current: e.current,
|
|
126
126
|
pageSize: e.pageSize
|
|
127
127
|
};
|
|
128
|
-
ie(s, d, ce) ||
|
|
128
|
+
ie(s, d, ce) || w(d);
|
|
129
129
|
};
|
|
130
130
|
re(() => {
|
|
131
|
-
const e =
|
|
131
|
+
const e = F(), {
|
|
132
132
|
current: t,
|
|
133
133
|
pageSize: r
|
|
134
134
|
} = c;
|
|
@@ -139,10 +139,10 @@ const Te = ({
|
|
|
139
139
|
sort: {},
|
|
140
140
|
...e
|
|
141
141
|
}, !g) {
|
|
142
|
-
const n =
|
|
143
|
-
|
|
142
|
+
const n = _(s);
|
|
143
|
+
O(n);
|
|
144
144
|
}
|
|
145
|
-
}), oe(() => h(
|
|
145
|
+
}), oe(() => h(v), () => {
|
|
146
146
|
E();
|
|
147
147
|
}, {
|
|
148
148
|
deep: !0
|
|
@@ -157,7 +157,7 @@ const Te = ({
|
|
|
157
157
|
return `${e}/${Math.ceil(o.total / t)}`;
|
|
158
158
|
});
|
|
159
159
|
function Y(e) {
|
|
160
|
-
|
|
160
|
+
N(e) && (o.records = e, o.total = e.length);
|
|
161
161
|
}
|
|
162
162
|
const k = A(() => {
|
|
163
163
|
const {
|
|
@@ -174,30 +174,30 @@ const Te = ({
|
|
|
174
174
|
showQuickJumper: !e,
|
|
175
175
|
showLessItems: e,
|
|
176
176
|
size: "default",
|
|
177
|
-
showTotal: t ? (r) =>
|
|
178
|
-
class:
|
|
179
|
-
}, [
|
|
180
|
-
class:
|
|
181
|
-
}, [r]), " ",
|
|
182
|
-
class:
|
|
183
|
-
}, [
|
|
184
|
-
class:
|
|
185
|
-
}, [h(X)]), " ",
|
|
177
|
+
showTotal: t ? (r) => C("span", {
|
|
178
|
+
class: P("pagination-total-wrapper")
|
|
179
|
+
}, [T("ap.apTable.pagination.totalLeftPrefix"), " ", C("span", {
|
|
180
|
+
class: P("pagination-count-text")
|
|
181
|
+
}, [r]), " ", T("ap.apTable.pagination.totalLeftSuffix"), C("span", {
|
|
182
|
+
class: P("pagination--total-right")
|
|
183
|
+
}, [T("ap.apTable.pagination.totalRightPrefix"), " ", C("span", {
|
|
184
|
+
class: P("pagination-count-text")
|
|
185
|
+
}, [h(X)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
186
186
|
},
|
|
187
|
-
onChange:
|
|
187
|
+
onChange: q,
|
|
188
188
|
dataSource: o.records
|
|
189
189
|
};
|
|
190
190
|
});
|
|
191
191
|
return {
|
|
192
|
-
formRef:
|
|
192
|
+
formRef: z,
|
|
193
193
|
submit: E,
|
|
194
194
|
reset: Z,
|
|
195
|
-
refresh:
|
|
195
|
+
refresh: j,
|
|
196
196
|
refreshByDelete: H,
|
|
197
197
|
data: o,
|
|
198
198
|
current: c.current,
|
|
199
199
|
pageSize: c.pageSize,
|
|
200
|
-
handleTableChange:
|
|
200
|
+
handleTableChange: q,
|
|
201
201
|
tableProps: k,
|
|
202
202
|
dataSource: A(() => o.records),
|
|
203
203
|
setDataSource: Y,
|
|
@@ -77,6 +77,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
|
77
77
|
type: StringConstructor;
|
|
78
78
|
default: undefined;
|
|
79
79
|
};
|
|
80
|
+
onRemove: {
|
|
81
|
+
type: FunctionConstructor;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
80
84
|
}>, {
|
|
81
85
|
done: ComputedRef<boolean>;
|
|
82
86
|
clear: typeof clear;
|
|
@@ -148,6 +152,10 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
|
148
152
|
type: StringConstructor;
|
|
149
153
|
default: undefined;
|
|
150
154
|
};
|
|
155
|
+
onRemove: {
|
|
156
|
+
type: FunctionConstructor;
|
|
157
|
+
default: undefined;
|
|
158
|
+
};
|
|
151
159
|
}>> & Readonly<{
|
|
152
160
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
153
161
|
}>, {
|
|
@@ -167,6 +175,7 @@ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
|
167
175
|
customRequest: CustomRequest;
|
|
168
176
|
maxSizeErrorMsg: string;
|
|
169
177
|
acceptErrorMsg: string;
|
|
178
|
+
onRemove: Function;
|
|
170
179
|
maxCount: number;
|
|
171
180
|
maxCountErrorMsg: string;
|
|
172
181
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as A, ref as g, computed as v, provide as t, openBlock as y, createElementBlock as
|
|
1
|
+
import { defineComponent as A, ref as g, computed as v, provide as t, openBlock as y, createElementBlock as R, normalizeClass as U, unref as $, createBlock as k, resolveDynamicComponent as T, mergeProps as B, createSlots as L, renderList as q, withCtx as P, renderSlot as V, normalizeProps as w, guardReactiveProps as D } from "vue";
|
|
2
2
|
import "../config-provider/index.mjs";
|
|
3
3
|
import "./components/SingleFile.vue.mjs";
|
|
4
4
|
import "./components/MultipleFile.vue.mjs";
|
|
@@ -12,7 +12,7 @@ import Q from "./components/SingleFile.vue2.mjs";
|
|
|
12
12
|
import W from "./components/MultipleFile.vue2.mjs";
|
|
13
13
|
import X from "./components/Picture.vue2.mjs";
|
|
14
14
|
import { useGlobalConfig as C } from "../config-provider/hooks/use-global-config.mjs";
|
|
15
|
-
const
|
|
15
|
+
const pe = /* @__PURE__ */ A({
|
|
16
16
|
name: "AplusFileUpload",
|
|
17
17
|
__name: "apUpload",
|
|
18
18
|
props: {
|
|
@@ -79,35 +79,39 @@ const me = /* @__PURE__ */ A({
|
|
|
79
79
|
acceptErrorMsg: {
|
|
80
80
|
type: String,
|
|
81
81
|
default: void 0
|
|
82
|
+
},
|
|
83
|
+
onRemove: {
|
|
84
|
+
type: Function,
|
|
85
|
+
default: void 0
|
|
82
86
|
}
|
|
83
87
|
},
|
|
84
88
|
emits: ["update:value"],
|
|
85
89
|
setup(S, { expose: b, emit: x }) {
|
|
86
|
-
var
|
|
87
|
-
const { t:
|
|
88
|
-
G(
|
|
89
|
-
const { b:
|
|
90
|
+
var m, p, d, f;
|
|
91
|
+
const { t: u, lang: F } = J();
|
|
92
|
+
G(u), I(u, F);
|
|
93
|
+
const { b: M } = K("ap-upload"), n = g(null), e = S, N = x, _ = {
|
|
90
94
|
singleFile: Q,
|
|
91
95
|
multipleFile: W,
|
|
92
96
|
picture: X
|
|
93
|
-
}, s = H.useInjectFormItemContext(),
|
|
97
|
+
}, s = H.useInjectFormItemContext(), E = v({
|
|
94
98
|
get() {
|
|
95
99
|
return e.value;
|
|
96
100
|
},
|
|
97
101
|
set(o) {
|
|
98
102
|
var a;
|
|
99
|
-
|
|
103
|
+
N("update:value", o), s == null || s.onFieldChange(), (a = e.onChange) == null || a.call(e, o);
|
|
100
104
|
}
|
|
101
105
|
}), O = C("uiMode"), i = C("apUpload");
|
|
102
|
-
t("theme", O.value), t("value",
|
|
106
|
+
t("theme", O.value), t("value", E), t("dirName", e.dirName ?? ((m = i.value) == null ? void 0 : m.dirName)), t(
|
|
103
107
|
"needName",
|
|
104
|
-
e.needName ?? ((
|
|
108
|
+
e.needName ?? ((p = i.value) == null ? void 0 : p.needName) ?? !1
|
|
105
109
|
), t("accept", e.accept ?? ((d = i.value) == null ? void 0 : d.accept) ?? ""), t("maxSize", e.maxSize), t("title", e.title), t("subTitle", e.subTitle), t("maxCount", e.maxCount), t("beforeUpload", e.beforeUpload), t("customRequest", e.customRequest), t(
|
|
106
110
|
"getOssAccess",
|
|
107
111
|
e.getOssAccess ?? ((f = i.value) == null ? void 0 : f.getOssAccess)
|
|
108
|
-
), t("maxSizeErrorMsg", e.maxSizeErrorMsg), t("maxCountErrorMsg", e.maxCountErrorMsg), t("acceptErrorMsg", e.acceptErrorMsg);
|
|
109
|
-
const z = v(() =>
|
|
110
|
-
t("uploadingCount",
|
|
112
|
+
), t("maxSizeErrorMsg", e.maxSizeErrorMsg), t("maxCountErrorMsg", e.maxCountErrorMsg), t("acceptErrorMsg", e.acceptErrorMsg), t("onRemove", e.onRemove);
|
|
113
|
+
const z = v(() => l.value === 0), l = g(0);
|
|
114
|
+
t("uploadingCount", l);
|
|
111
115
|
function h() {
|
|
112
116
|
c(void 0);
|
|
113
117
|
}
|
|
@@ -119,13 +123,13 @@ const me = /* @__PURE__ */ A({
|
|
|
119
123
|
done: z,
|
|
120
124
|
clear: h,
|
|
121
125
|
setValue: c
|
|
122
|
-
}), (o, a) => (y(),
|
|
123
|
-
class: $(
|
|
126
|
+
}), (o, a) => (y(), R("div", {
|
|
127
|
+
class: U($(M)())
|
|
124
128
|
}, [
|
|
125
|
-
(y(), T(
|
|
129
|
+
(y(), k(T(_[e.type]), B(o.$attrs, {
|
|
126
130
|
ref_key: "uploadRef",
|
|
127
131
|
ref: n
|
|
128
|
-
}),
|
|
132
|
+
}), L({ _: 2 }, [
|
|
129
133
|
q(Object.keys(o.$slots), (r) => ({
|
|
130
134
|
name: r,
|
|
131
135
|
fn: P((j) => [
|
|
@@ -137,5 +141,5 @@ const me = /* @__PURE__ */ A({
|
|
|
137
141
|
}
|
|
138
142
|
});
|
|
139
143
|
export {
|
|
140
|
-
|
|
144
|
+
pe as default
|
|
141
145
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as G, inject as s, ref as H, watch as J, nextTick as K, openBlock as h, createElementBlock as C, normalizeClass as Q, unref as n, createVNode as U, withCtx as b, createElementVNode as S, createTextVNode as X, toDisplayString as L, withModifiers as Y, createBlock as Z, resolveDynamicComponent as ee, createCommentVNode as te } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getPath as
|
|
4
|
-
import { useOss as ae, getOssInstance as
|
|
5
|
-
import { message as m, Upload as
|
|
6
|
-
import { UploadOutlined as
|
|
7
|
-
import { fileMatchesAccept as
|
|
8
|
-
import { useLocale as
|
|
9
|
-
import { useNamespace as
|
|
10
|
-
const
|
|
3
|
+
import { getPath as oe, getName as se, getReturnData as M } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as ae, getOssInstance as ne } from "../hooks/useOss.mjs";
|
|
5
|
+
import { message as m, Upload as re, Button as ie } from "@aplus-frontend/antdv";
|
|
6
|
+
import { UploadOutlined as le } from "@ant-design/icons-vue";
|
|
7
|
+
import { fileMatchesAccept as ue, getAcceptText as ce } from "../utils/accept.mjs";
|
|
8
|
+
import { useLocale as pe } from "../../config-provider/hooks/use-locale.mjs";
|
|
9
|
+
import { useNamespace as me } from "../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
const de = { class: "multiple-file-context" }, fe = { key: 0 }, ge = { key: 1 }, Ae = /* @__PURE__ */ G({
|
|
11
11
|
__name: "MultipleFile",
|
|
12
|
-
setup(
|
|
13
|
-
const { t: r } =
|
|
14
|
-
|
|
12
|
+
setup(ve, { expose: z }) {
|
|
13
|
+
const { t: r } = pe(), { b: E } = me("ap-upload-multiple-file"), { put: R } = ae(), B = s("theme"), I = s("dirName"), y = s("accept") || "*", _ = s("maxSize") ?? 500, P = s("title") || r("ap.apUpload.uploadFile"), f = s("subTitle"), i = s("maxCount") ?? 10, d = s("uploadingCount"), A = s("beforeUpload"), F = s("customRequest"), O = s("getOssAccess"), q = s("maxSizeErrorMsg"), D = s("maxCountErrorMsg"), $ = s("acceptErrorMsg"), g = s("onRemove"), a = s("value"), c = [], v = s("needName"), l = H(null);
|
|
14
|
+
J(
|
|
15
15
|
() => a == null ? void 0 : a.value,
|
|
16
16
|
function(e) {
|
|
17
17
|
var t, o;
|
|
18
|
-
!((o = (t = l == null ? void 0 : l.value) == null ? void 0 : t.fileList) != null && o.length) && e &&
|
|
18
|
+
!((o = (t = l == null ? void 0 : l.value) == null ? void 0 : t.fileList) != null && o.length) && e && N(e);
|
|
19
19
|
},
|
|
20
20
|
{ immediate: !0 }
|
|
21
21
|
);
|
|
22
|
-
function
|
|
22
|
+
function N(e) {
|
|
23
23
|
if (!e) {
|
|
24
24
|
p = [], l.value.fileList = [], a.value = void 0, c.splice(0, c.length);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
K(() => {
|
|
28
28
|
const t = e.map((o) => {
|
|
29
|
-
const u =
|
|
29
|
+
const u = oe(v, o), w = se(v, o), k = new File(
|
|
30
30
|
[o],
|
|
31
|
-
|
|
31
|
+
w,
|
|
32
32
|
{}
|
|
33
33
|
);
|
|
34
|
-
return
|
|
34
|
+
return k.response = u, k.uid = u, k;
|
|
35
35
|
});
|
|
36
36
|
if (i && t.length > i) {
|
|
37
37
|
m.warning(
|
|
@@ -49,9 +49,9 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
49
49
|
}), l.value.fileList = t, a.value = e;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
let p = [],
|
|
54
|
-
function
|
|
52
|
+
z({ setValue: N });
|
|
53
|
+
let p = [], T;
|
|
54
|
+
function x(e) {
|
|
55
55
|
setTimeout(() => {
|
|
56
56
|
const t = l.value.fileList.findIndex(
|
|
57
57
|
(o) => o.uid === e.uid
|
|
@@ -59,32 +59,32 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
59
59
|
t >= 0 && l.value.fileList.splice(t, 1);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
async function
|
|
62
|
+
async function j(e) {
|
|
63
63
|
if (i && i > 1 && p.length >= i)
|
|
64
|
-
return clearTimeout(
|
|
64
|
+
return clearTimeout(T), T = setTimeout(() => {
|
|
65
65
|
m.warning(
|
|
66
|
-
|
|
66
|
+
D || r("ap.apUpload.maxUploadFiles", {
|
|
67
67
|
maxCount: i
|
|
68
68
|
})
|
|
69
69
|
);
|
|
70
|
-
}),
|
|
71
|
-
if (e.size >
|
|
70
|
+
}), x(e), !1;
|
|
71
|
+
if (e.size > _ * 1024 * 1024)
|
|
72
72
|
return m.warning(
|
|
73
|
-
|
|
74
|
-
maxSize:
|
|
73
|
+
q || r("ap.apUpload.maxUploadFileSize", {
|
|
74
|
+
maxSize: _
|
|
75
75
|
})
|
|
76
|
-
),
|
|
77
|
-
if (!
|
|
76
|
+
), x(e), !1;
|
|
77
|
+
if (!ue(e, y))
|
|
78
78
|
return m.warning(
|
|
79
|
-
|
|
80
|
-
),
|
|
81
|
-
if (typeof
|
|
82
|
-
return
|
|
79
|
+
$ || r("ap.apUpload.fileFormatNotSupported")
|
|
80
|
+
), x(e), !1;
|
|
81
|
+
if (typeof A == "function" && await A(e) === !1)
|
|
82
|
+
return x(e), !1;
|
|
83
83
|
i && i === 1 && (p = [], a.value = void 0), p.push(e);
|
|
84
84
|
}
|
|
85
|
-
async function
|
|
86
|
-
if (d.value++, typeof
|
|
87
|
-
|
|
85
|
+
async function V(e) {
|
|
86
|
+
if (d.value++, typeof F == "function") {
|
|
87
|
+
F({
|
|
88
88
|
onProgress: (t) => {
|
|
89
89
|
setTimeout(() => {
|
|
90
90
|
e.onProgress({
|
|
@@ -105,7 +105,7 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
105
105
|
e.onSuccess(t);
|
|
106
106
|
}), a.value = [
|
|
107
107
|
...a.value || [],
|
|
108
|
-
|
|
108
|
+
M(v, t, e.file.name)
|
|
109
109
|
], c.push({
|
|
110
110
|
uid: e.file.uid,
|
|
111
111
|
path: t
|
|
@@ -116,15 +116,15 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
try {
|
|
119
|
-
const t = await
|
|
120
|
-
e.file.oss = t,
|
|
119
|
+
const t = await ne(O);
|
|
120
|
+
e.file.oss = t, R({
|
|
121
121
|
file: e.file,
|
|
122
|
-
dirName:
|
|
122
|
+
dirName: I,
|
|
123
123
|
oss: t,
|
|
124
124
|
successCallBack(o) {
|
|
125
125
|
e.onSuccess(o), a.value = [
|
|
126
126
|
...a.value || [],
|
|
127
|
-
|
|
127
|
+
M(v, o, e.file.name)
|
|
128
128
|
], c.push({
|
|
129
129
|
uid: e.file.uid,
|
|
130
130
|
path: o
|
|
@@ -151,11 +151,11 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
151
151
|
}), d.value--;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function W(e) {
|
|
155
155
|
var o;
|
|
156
|
-
if (e.response) {
|
|
156
|
+
if (g && (g == null || g(e)), e.response) {
|
|
157
157
|
if (Array.isArray(a.value)) {
|
|
158
|
-
const u = c.findIndex((
|
|
158
|
+
const u = c.findIndex((w) => w.uid === e.uid);
|
|
159
159
|
u >= 0 && (a == null || a.value.splice(u, 1), c.splice(u, 1)), a.value.length === 0 && (a.value = void 0);
|
|
160
160
|
}
|
|
161
161
|
} else
|
|
@@ -165,16 +165,16 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
165
165
|
);
|
|
166
166
|
return p.splice(t, 1), Promise.resolve(!0);
|
|
167
167
|
}
|
|
168
|
-
return (e, t) => (
|
|
169
|
-
class:
|
|
170
|
-
[n(
|
|
171
|
-
[n(
|
|
168
|
+
return (e, t) => (h(), C("div", {
|
|
169
|
+
class: Q({
|
|
170
|
+
[n(E)()]: !0,
|
|
171
|
+
[n(E)("admin")]: n(B) === "admin"
|
|
172
172
|
})
|
|
173
173
|
}, [
|
|
174
|
-
|
|
174
|
+
U(n(re), {
|
|
175
175
|
ref_key: "uploadRef",
|
|
176
176
|
ref: l,
|
|
177
|
-
accept: n(
|
|
177
|
+
accept: n(y),
|
|
178
178
|
multiple: "",
|
|
179
179
|
"max-count": n(i),
|
|
180
180
|
progress: {
|
|
@@ -182,27 +182,27 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
182
182
|
showInfo: !1,
|
|
183
183
|
strokeColor: "#0070FF"
|
|
184
184
|
},
|
|
185
|
-
"before-upload":
|
|
186
|
-
"custom-request":
|
|
187
|
-
onRemove:
|
|
185
|
+
"before-upload": j,
|
|
186
|
+
"custom-request": V,
|
|
187
|
+
onRemove: W
|
|
188
188
|
}, {
|
|
189
|
-
default:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
default:
|
|
193
|
-
|
|
194
|
-
|
|
189
|
+
default: b(() => [
|
|
190
|
+
S("div", de, [
|
|
191
|
+
U(n(ie), { class: "file-btn" }, {
|
|
192
|
+
default: b(() => [
|
|
193
|
+
U(n(le)),
|
|
194
|
+
X(" " + L(n(P)), 1)
|
|
195
195
|
]),
|
|
196
196
|
_: 1
|
|
197
197
|
}),
|
|
198
|
-
|
|
198
|
+
S("div", {
|
|
199
199
|
class: "sub-title",
|
|
200
|
-
onClick: t[0] || (t[0] =
|
|
200
|
+
onClick: t[0] || (t[0] = Y(() => {
|
|
201
201
|
}, ["stop"]))
|
|
202
202
|
}, [
|
|
203
|
-
typeof n(f) == "string" ? (
|
|
204
|
-
(
|
|
205
|
-
])) :
|
|
203
|
+
typeof n(f) == "string" ? (h(), C("div", fe, L(n(f) || `${n(r)("ap.apUpload.supportExtension")}:${n(ce)(n(y))}`), 1)) : n(f) ? (h(), C("div", ge, [
|
|
204
|
+
(h(), Z(ee(n(f))))
|
|
205
|
+
])) : te("", !0)
|
|
206
206
|
])
|
|
207
207
|
])
|
|
208
208
|
]),
|
|
@@ -212,5 +212,5 @@ const me = { class: "multiple-file-context" }, de = { key: 0 }, fe = { key: 1 },
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
export {
|
|
215
|
-
|
|
215
|
+
Ae as default
|
|
216
216
|
};
|