@aplus-frontend/ui 0.2.0-beta.2 → 0.2.0-beta.4
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 +59 -52
- package/es/src/ap-field/interface.d.ts +6 -0
- package/es/src/ap-field/select/index.vue.mjs +14 -13
- package/es/src/ap-form/item/index.vue.mjs +58 -58
- package/es/src/ap-form/item-text/style/css.d.ts +0 -1
- package/es/src/ap-form/item-text/style/css.js +1 -1
- package/es/src/ap-form/item-text/style/index.d.ts +0 -1
- package/es/src/ap-form/item-text/style/index.js +1 -1
- package/es/src/ap-form/item-text-group/style/css.d.ts +0 -0
- package/es/src/ap-form/item-text-group/style/css.js +1 -0
- package/es/src/ap-form/item-text-group/style/index.d.ts +0 -0
- package/es/src/ap-form/item-text-group/style/index.js +1 -0
- package/es/src/ap-form/items/interface.d.ts +11 -0
- package/es/src/ap-form/items/text/group.vue.d.ts +42 -0
- package/es/src/ap-form/items/text/group.vue.mjs +4 -0
- package/es/src/ap-form/items/text/group.vue2.mjs +26 -0
- package/es/src/ap-form/items/text/index.d.ts +3 -1
- package/es/src/ap-form/items/text/index.mjs +10 -6
- package/es/src/ap-table/ap-table.vue.d.ts +2 -0
- package/es/src/ap-table/ap-table.vue.mjs +28 -27
- package/es/src/ap-table/constants.d.ts +20 -30
- package/es/src/ap-table/utils.d.ts +35 -3
- package/es/src/ap-table/utils.mjs +69 -69
- package/es/src/ap-upload/apUpload.vue.d.ts +17 -1
- package/es/src/ap-upload/apUpload.vue.mjs +54 -42
- package/es/src/ap-upload/apUploadTypes.d.ts +6 -1
- package/es/src/ap-upload/components/MultipleFile.vue.d.ts +4 -1
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +98 -90
- package/es/src/ap-upload/components/Picture.vue.d.ts +4 -1
- package/es/src/ap-upload/components/Picture.vue2.mjs +146 -138
- package/es/src/ap-upload/components/SingleFile.vue.d.ts +4 -1
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +84 -86
- package/es/src/business/ap-label/constans.d.ts +1 -1
- package/es/src/business/ap-label/interface.d.ts +2 -2
- package/es/src/business/ap-summary/ap-summary.vue.d.ts +30 -0
- package/es/src/business/ap-summary/ap-summary.vue.mjs +4 -0
- package/es/src/business/ap-summary/ap-summary.vue2.mjs +68 -0
- package/es/src/business/ap-summary/index.d.ts +95 -0
- package/es/src/business/ap-summary/index.mjs +13 -0
- package/es/src/business/ap-summary/interface.d.ts +41 -0
- package/es/src/business/ap-summary/interface.mjs +1 -0
- package/es/src/business/ap-summary/style/css.d.ts +0 -0
- package/es/src/business/ap-summary/style/css.js +1 -0
- package/es/src/business/ap-summary/style/index.d.ts +0 -0
- package/es/src/business/ap-summary/style/index.js +1 -0
- package/es/src/business/ap-summary/utils.d.ts +12 -0
- package/es/src/business/ap-summary/utils.mjs +36 -0
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +16 -14
- package/es/src/editable-table/utils.mjs +51 -51
- package/es/src/hooks/useControllableValue.d.ts +8 -3
- package/es/src/hooks/useControllableValue.mjs +18 -13
- package/es/src/index.mjs +59 -52
- package/es/src/path-map.mjs +3 -1
- package/es/src/utils/slot.d.ts +9 -1
- package/es/src/utils/slot.mjs +10 -6
- package/lib/index.js +1 -1
- package/lib/src/ap-field/interface.d.ts +6 -0
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-form/item/index.vue.js +1 -1
- package/lib/src/ap-form/item-text/style/css.d.ts +0 -1
- package/lib/src/ap-form/item-text/style/css.js +1 -1
- package/lib/src/ap-form/item-text/style/index.d.ts +0 -1
- package/lib/src/ap-form/item-text/style/index.js +1 -1
- package/lib/src/ap-form/item-text-group/style/css.d.ts +0 -0
- package/lib/src/ap-form/item-text-group/style/css.js +1 -0
- package/lib/src/ap-form/item-text-group/style/index.d.ts +0 -0
- package/lib/src/ap-form/item-text-group/style/index.js +1 -0
- package/lib/src/ap-form/items/interface.d.ts +11 -0
- package/lib/src/ap-form/items/text/group.vue.d.ts +42 -0
- package/lib/src/ap-form/items/text/group.vue.js +1 -0
- package/lib/src/ap-form/items/text/group.vue2.js +1 -0
- package/lib/src/ap-form/items/text/index.d.ts +3 -1
- package/lib/src/ap-form/items/text/index.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +20 -30
- package/lib/src/ap-table/utils.d.ts +35 -3
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/ap-upload/apUpload.vue.d.ts +17 -1
- package/lib/src/ap-upload/apUpload.vue.js +1 -1
- package/lib/src/ap-upload/apUploadTypes.d.ts +6 -1
- package/lib/src/ap-upload/components/MultipleFile.vue.d.ts +4 -1
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/ap-upload/components/Picture.vue.d.ts +4 -1
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/ap-upload/components/SingleFile.vue.d.ts +4 -1
- package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-label/constans.d.ts +1 -1
- package/lib/src/business/ap-label/interface.d.ts +2 -2
- package/lib/src/business/ap-summary/ap-summary.vue.d.ts +30 -0
- package/lib/src/business/ap-summary/ap-summary.vue.js +1 -0
- package/lib/src/business/ap-summary/ap-summary.vue2.js +1 -0
- package/lib/src/business/ap-summary/index.d.ts +95 -0
- package/lib/src/business/ap-summary/index.js +1 -0
- package/lib/src/business/ap-summary/interface.d.ts +41 -0
- package/lib/src/business/ap-summary/interface.js +1 -0
- package/lib/src/business/ap-summary/style/css.d.ts +0 -0
- package/lib/src/business/ap-summary/style/css.js +1 -0
- package/lib/src/business/ap-summary/style/index.d.ts +0 -0
- package/lib/src/business/ap-summary/style/index.js +1 -0
- package/lib/src/business/ap-summary/utils.d.ts +12 -0
- package/lib/src/business/ap-summary/utils.js +1 -0
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/hooks/useControllableValue.d.ts +8 -3
- package/lib/src/hooks/useControllableValue.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/lib/src/utils/slot.d.ts +9 -1
- package/lib/src/utils/slot.js +1 -1
- package/package.json +4 -4
|
@@ -1,70 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as te, inject as s, ref as h, watch as ae, computed as ne, openBlock as _, createElementBlock as x, normalizeClass as oe, unref as a, createElementVNode as i, toDisplayString as A, createCommentVNode as z, normalizeStyle as le, createBlock as se, withModifiers as re, createVNode as ie } from "vue";
|
|
2
2
|
import "../../config-provider/index.mjs";
|
|
3
|
-
import { getName as
|
|
4
|
-
import { useOss as
|
|
5
|
-
import { fileMatchesAccept as
|
|
6
|
-
import { message as u, Progress as
|
|
7
|
-
import { DeleteOutlined as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
const
|
|
3
|
+
import { getName as ce, getReturnData as q } from "../utils/returnData.mjs";
|
|
4
|
+
import { useOss as ue, useOssInit as pe } from "../hooks/useOss.mjs";
|
|
5
|
+
import { fileMatchesAccept as ve, getAcceptText as de } from "../utils/accept.mjs";
|
|
6
|
+
import { message as u, Progress as fe } from "ant-design-vue";
|
|
7
|
+
import { DeleteOutlined as me } from "@ant-design/icons-vue";
|
|
8
|
+
import M from "../assets/single-file-icon.png.mjs";
|
|
9
|
+
import { useLocale as ge } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
|
+
import { useNamespace as he } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
const _e = ["accept"], ke = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "state-un"
|
|
14
|
-
},
|
|
14
|
+
}, ye = ["src"], De = { class: "state-un-title" }, Ce = { class: "state-un-subtitle" }, we = {
|
|
15
15
|
key: 1,
|
|
16
16
|
class: "state-ing"
|
|
17
|
-
},
|
|
17
|
+
}, Fe = { class: "left" }, Ue = ["src"], Ne = { class: "center" }, Se = { class: "center-progress" }, Ie = /* @__PURE__ */ te({
|
|
18
18
|
__name: "SingleFile",
|
|
19
|
-
setup(
|
|
20
|
-
const { t: r } =
|
|
21
|
-
|
|
22
|
-
() =>
|
|
19
|
+
setup(Ee, { expose: j }) {
|
|
20
|
+
const { t: r } = ge(), { b: k } = he("ap-upload-single-file"), { put: G, client: B } = ue(), y = s("theme"), W = s("dirName"), D = s("accept") || "*", C = s("maxSize") ?? 500, H = s("title") || r("ap.apUpload.clickOrDragUpload"), w = s("subTitle"), n = s("value"), F = s("needName"), p = s("uploadingCount"), b = s("beforeUpload"), O = s("customRequest"), J = s("getOssAccess"), o = h(null);
|
|
21
|
+
ae(
|
|
22
|
+
() => n == null ? void 0 : n.value,
|
|
23
23
|
function(e) {
|
|
24
|
-
|
|
25
|
-
if (n.value === null && e) {
|
|
26
|
-
const t = re(F, e);
|
|
27
|
-
o.value = 3, n.value = new File(
|
|
28
|
-
[e],
|
|
29
|
-
t,
|
|
30
|
-
{}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
24
|
+
o.value === null && e && P(e);
|
|
34
25
|
},
|
|
35
26
|
{ immediate: !0 }
|
|
36
27
|
);
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
function P(e) {
|
|
29
|
+
e ? setTimeout(() => {
|
|
30
|
+
const t = ce(F, e);
|
|
31
|
+
l.value = 3, o.value = new File([e], t, {}), n.value = e;
|
|
32
|
+
}) : (l.value = 1, o.value = null, n.value = void 0);
|
|
33
|
+
}
|
|
34
|
+
j({ setValue: P });
|
|
35
|
+
const l = h(1), f = h(0), m = h(null), T = ne(() => o.value && (n == null ? void 0 : n.value));
|
|
36
|
+
function K() {
|
|
39
37
|
var e;
|
|
40
|
-
|
|
38
|
+
l.value === 1 && ((e = m.value) == null || e.click());
|
|
41
39
|
}
|
|
42
|
-
function
|
|
40
|
+
function L(e) {
|
|
43
41
|
e.preventDefault(), e.stopPropagation();
|
|
44
42
|
}
|
|
45
|
-
function
|
|
43
|
+
function Q(e) {
|
|
46
44
|
e.dataTransfer.dropEffect = "copy", e.preventDefault(), e.stopPropagation();
|
|
47
45
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
46
|
+
function X(e) {
|
|
47
|
+
R(e);
|
|
50
48
|
}
|
|
51
|
-
function
|
|
52
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
49
|
+
function Y(e) {
|
|
50
|
+
if (e.preventDefault(), e.stopPropagation(), l.value !== 1)
|
|
53
51
|
return;
|
|
54
|
-
var t = e.dataTransfer, c = [],
|
|
52
|
+
var t = e.dataTransfer, c = [], I = 0, $ = t.files.length;
|
|
55
53
|
function v() {
|
|
56
|
-
|
|
54
|
+
I === $ - 1 && X(c), I++;
|
|
57
55
|
}
|
|
58
56
|
if (t.items !== void 0)
|
|
59
57
|
for (var U = 0; U < t.items.length; U++) {
|
|
60
58
|
var N = t.items[U];
|
|
61
59
|
if (N.kind === "file" && N.webkitGetAsEntry().isFile) {
|
|
62
|
-
var
|
|
63
|
-
c.push(
|
|
60
|
+
var ee = N.getAsFile();
|
|
61
|
+
c.push(ee), v();
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
else
|
|
67
|
-
for (let E = 0; E <
|
|
65
|
+
for (let E = 0; E < $; E++) {
|
|
68
66
|
var g = t.files[E];
|
|
69
67
|
if (g.type)
|
|
70
68
|
c.push(g), v();
|
|
@@ -89,11 +87,11 @@ const ge = ["accept"], he = {
|
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
function
|
|
90
|
+
function Z(e) {
|
|
93
91
|
const t = e.target;
|
|
94
|
-
|
|
92
|
+
R(t == null ? void 0 : t.files), m.value && (m.value.value = "");
|
|
95
93
|
}
|
|
96
|
-
async function
|
|
94
|
+
async function R(e) {
|
|
97
95
|
if (e != null && e.length) {
|
|
98
96
|
if (typeof b == "function") {
|
|
99
97
|
if (b(e[0]) === !1)
|
|
@@ -107,44 +105,44 @@ const ge = ["accept"], he = {
|
|
|
107
105
|
);
|
|
108
106
|
return;
|
|
109
107
|
}
|
|
110
|
-
if (!
|
|
108
|
+
if (!ve(e[0], D)) {
|
|
111
109
|
u.warning(r("ap.apUpload.fileFormatNotSupported"));
|
|
112
110
|
return;
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
if (
|
|
113
|
+
if (o.value = e[0], l.value = 2, f.value = 0, p.value++, typeof O == "function") {
|
|
116
114
|
O({
|
|
117
115
|
onProgress: (t) => {
|
|
118
116
|
f.value = t;
|
|
119
117
|
},
|
|
120
118
|
onError: (t) => {
|
|
121
|
-
u.warning(t || r("ap.apUpload.networkAnomaly")),
|
|
119
|
+
u.warning(t || r("ap.apUpload.networkAnomaly")), l.value = 1, o.value = null, p.value--;
|
|
122
120
|
},
|
|
123
121
|
onSuccess: (t) => {
|
|
124
|
-
|
|
122
|
+
n.value = q(
|
|
125
123
|
F,
|
|
126
124
|
t,
|
|
127
|
-
|
|
128
|
-
),
|
|
125
|
+
o.value.name
|
|
126
|
+
), l.value = 3, p.value--;
|
|
129
127
|
},
|
|
130
128
|
file: e[0]
|
|
131
129
|
});
|
|
132
130
|
return;
|
|
133
131
|
}
|
|
134
132
|
try {
|
|
135
|
-
await
|
|
136
|
-
file:
|
|
137
|
-
dirName:
|
|
133
|
+
await pe(J), G({
|
|
134
|
+
file: o.value,
|
|
135
|
+
dirName: W,
|
|
138
136
|
oss: B,
|
|
139
137
|
successCallBack(t) {
|
|
140
|
-
|
|
138
|
+
n.value = q(
|
|
141
139
|
F,
|
|
142
140
|
t,
|
|
143
|
-
|
|
144
|
-
),
|
|
141
|
+
o.value.name
|
|
142
|
+
), l.value = 3, p.value--;
|
|
145
143
|
},
|
|
146
144
|
errorCallBack(t) {
|
|
147
|
-
u.warning(t || r("ap.apUpload.networkAnomaly")),
|
|
145
|
+
u.warning(t || r("ap.apUpload.networkAnomaly")), l.value = 1, o.value = null, p.value--;
|
|
148
146
|
},
|
|
149
147
|
progressCallBack(t) {
|
|
150
148
|
f.value = t;
|
|
@@ -153,26 +151,26 @@ const ge = ["accept"], he = {
|
|
|
153
151
|
} catch (t) {
|
|
154
152
|
u.warning(
|
|
155
153
|
typeof (t == null ? void 0 : t.message) == "string" ? t.message : r("ap.apUpload.networkAnomaly")
|
|
156
|
-
),
|
|
154
|
+
), l.value = 1, o.value = null, p.value--;
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
158
|
+
function V() {
|
|
159
|
+
o.value && !(n != null && n.value) && B.pauseUpload(), l.value = 1, o.value = null, n.value = void 0;
|
|
162
160
|
}
|
|
163
161
|
return (e, t) => {
|
|
164
162
|
var c;
|
|
165
|
-
return _(),
|
|
166
|
-
class:
|
|
163
|
+
return _(), x("div", {
|
|
164
|
+
class: oe({
|
|
167
165
|
[a(k)()]: !0,
|
|
168
166
|
[a(k)("admin")]: a(y) === "admin",
|
|
169
|
-
[a(k)("un")]:
|
|
167
|
+
[a(k)("un")]: l.value === 1
|
|
170
168
|
}),
|
|
171
|
-
onClick:
|
|
172
|
-
onDragenter:
|
|
173
|
-
onDragover:
|
|
174
|
-
onDragleave:
|
|
175
|
-
onDrop:
|
|
169
|
+
onClick: K,
|
|
170
|
+
onDragenter: L,
|
|
171
|
+
onDragover: Q,
|
|
172
|
+
onDragleave: L,
|
|
173
|
+
onDrop: Y
|
|
176
174
|
}, [
|
|
177
175
|
i("input", {
|
|
178
176
|
style: { display: "none" },
|
|
@@ -180,33 +178,33 @@ const ge = ["accept"], he = {
|
|
|
180
178
|
ref_key: "fileRef",
|
|
181
179
|
ref: m,
|
|
182
180
|
accept: a(D),
|
|
183
|
-
onChange:
|
|
184
|
-
}, null, 40,
|
|
185
|
-
|
|
181
|
+
onChange: Z
|
|
182
|
+
}, null, 40, _e),
|
|
183
|
+
l.value === 1 ? (_(), x("div", ke, [
|
|
186
184
|
i("img", {
|
|
187
185
|
class: "state-un-icon",
|
|
188
|
-
src: a(
|
|
189
|
-
}, null, 8,
|
|
190
|
-
i("div",
|
|
191
|
-
i("div",
|
|
186
|
+
src: a(M)
|
|
187
|
+
}, null, 8, ye),
|
|
188
|
+
i("div", De, A(a(H)), 1),
|
|
189
|
+
i("div", Ce, A(typeof a(w) == "string" && a(w).length > 0 ? a(w) : `${a(r)("ap.apUpload.supportExtension")}:${a(de)(
|
|
192
190
|
a(D)
|
|
193
191
|
)},${a(r)("ap.apUpload.maxWarnUploadFileSize", {
|
|
194
192
|
maxSize: a(C)
|
|
195
193
|
})}`), 1)
|
|
196
194
|
])) : z("", !0),
|
|
197
|
-
[2, 3].includes(
|
|
198
|
-
i("div", Ce, [
|
|
199
|
-
i("img", { src: a(q) }, null, 8, we)
|
|
200
|
-
]),
|
|
195
|
+
[2, 3].includes(l.value) ? (_(), x("div", we, [
|
|
201
196
|
i("div", Fe, [
|
|
197
|
+
i("img", { src: a(M) }, null, 8, Ue)
|
|
198
|
+
]),
|
|
199
|
+
i("div", Ne, [
|
|
202
200
|
i("div", {
|
|
203
201
|
class: "center-title",
|
|
204
|
-
style:
|
|
205
|
-
color:
|
|
202
|
+
style: le({
|
|
203
|
+
color: T.value ? "#0070FF" : "#182948"
|
|
206
204
|
})
|
|
207
|
-
},
|
|
208
|
-
i("div",
|
|
209
|
-
|
|
205
|
+
}, A((c = o.value) == null ? void 0 : c.name), 5),
|
|
206
|
+
i("div", Se, [
|
|
207
|
+
T.value ? z("", !0) : (_(), se(a(fe), {
|
|
210
208
|
key: 0,
|
|
211
209
|
percent: f.value,
|
|
212
210
|
size: 4,
|
|
@@ -218,9 +216,9 @@ const ge = ["accept"], he = {
|
|
|
218
216
|
]),
|
|
219
217
|
i("div", {
|
|
220
218
|
class: "right",
|
|
221
|
-
onClick:
|
|
219
|
+
onClick: re(V, ["stop"])
|
|
222
220
|
}, [
|
|
223
|
-
|
|
221
|
+
ie(a(me))
|
|
224
222
|
])
|
|
225
223
|
])) : z("", !0)
|
|
226
224
|
], 34);
|
|
@@ -228,5 +226,5 @@ const ge = ["accept"], he = {
|
|
|
228
226
|
}
|
|
229
227
|
});
|
|
230
228
|
export {
|
|
231
|
-
|
|
229
|
+
Ie as default
|
|
232
230
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropType, VNode, CSSProperties } from 'vue';
|
|
2
2
|
import { ApLabelGroupItemProps } from './interface';
|
|
3
|
-
import { TooltipPlacement } from 'ant-design-vue/es/Tooltip';
|
|
3
|
+
import { TooltipPlacement } from 'ant-design-vue/es/tooltip/Tooltip';
|
|
4
4
|
import { VueTypeValidableDef } from '../../../node_modules/vue-types';
|
|
5
5
|
import { LiteralUnion } from 'ant-design-vue/es/_util/type';
|
|
6
6
|
export declare const ApLabelGroupProps: () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BadgeProps } from 'ant-design-vue';
|
|
2
|
-
import { TooltipPlacement } from 'ant-design-vue/es/Tooltip';
|
|
3
|
-
import { TagProps } from 'ant-design-vue/es/
|
|
2
|
+
import { TooltipPlacement } from 'ant-design-vue/es/tooltip/Tooltip';
|
|
3
|
+
import { TagProps } from 'ant-design-vue/es/tag';
|
|
4
4
|
import { VNode, VNodeChild } from 'vue';
|
|
5
5
|
type Recordable = Record<string, any>;
|
|
6
6
|
export type ApLabelProps = BadgeProps & Partial<{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ApSummaryProps } from './interface';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
|
|
3
|
+
declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<ApSummaryProps>, {
|
|
4
|
+
summaryTitle: string;
|
|
5
|
+
hasSelect: boolean;
|
|
6
|
+
}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ApSummaryProps>, {
|
|
7
|
+
summaryTitle: string;
|
|
8
|
+
hasSelect: boolean;
|
|
9
|
+
}>>>, {
|
|
10
|
+
summaryTitle: string;
|
|
11
|
+
hasSelect: boolean;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithDefaults<P, D> = {
|
|
15
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
16
|
+
default: D[K];
|
|
17
|
+
}> : P[K];
|
|
18
|
+
};
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToOption<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type __VLS_PrettifyLocal<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent as k, computed as S, openBlock as o, createBlock as u, unref as n, normalizeClass as i, withCtx as c, createElementBlock as g, Fragment as T, renderList as _, normalizeStyle as C, createTextVNode as b, toDisplayString as L } from "vue";
|
|
2
|
+
import { isNil as N, get as w } from "lodash-unified";
|
|
3
|
+
import { TableSummaryRow as B, TableSummaryCell as z } from "ant-design-vue";
|
|
4
|
+
import { flattenColumns as A, formatDataIndex as D } from "./utils.mjs";
|
|
5
|
+
import "../../config-provider/index.mjs";
|
|
6
|
+
import { isNumeric as F, toThousand as I, toFixed as v } from "@aplus-frontend/utils";
|
|
7
|
+
import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
+
const J = /* @__PURE__ */ k({
|
|
9
|
+
name: "ApSummary",
|
|
10
|
+
__name: "ap-summary",
|
|
11
|
+
props: {
|
|
12
|
+
data: {},
|
|
13
|
+
columns: {},
|
|
14
|
+
summaryTitle: {
|
|
15
|
+
default: "合计"
|
|
16
|
+
},
|
|
17
|
+
hasSelect: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !0
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(p) {
|
|
23
|
+
const s = p, y = (e) => e === 0, d = (e, r) => {
|
|
24
|
+
var l;
|
|
25
|
+
if (!e || !F(e) || r.valueType !== "number")
|
|
26
|
+
return e;
|
|
27
|
+
const t = (l = r.fieldProps) == null ? void 0 : l.field, a = (t == null ? void 0 : t.precision) || 0;
|
|
28
|
+
return (N(t == null ? void 0 : t.thousands) ? !0 : t == null ? void 0 : t.thousands) ? I(e, a) : v(e, a);
|
|
29
|
+
}, f = S(() => {
|
|
30
|
+
let e = [];
|
|
31
|
+
s.hasSelect && e.push({
|
|
32
|
+
key: "select",
|
|
33
|
+
rowSpan: 1,
|
|
34
|
+
align: "left",
|
|
35
|
+
value: ""
|
|
36
|
+
});
|
|
37
|
+
const t = A(s.columns).map((a, m) => ({
|
|
38
|
+
key: a.key,
|
|
39
|
+
rowSpan: 1,
|
|
40
|
+
align: a.align,
|
|
41
|
+
value: y(m) ? s.summaryTitle : d(w(s.data, D(a.dataIndex || a.key)), a)
|
|
42
|
+
}));
|
|
43
|
+
return e.concat(t);
|
|
44
|
+
}), {
|
|
45
|
+
b: h,
|
|
46
|
+
e: x
|
|
47
|
+
} = E("ap-summary");
|
|
48
|
+
return (e, r) => (o(), u(n(B), {
|
|
49
|
+
class: i(n(h)())
|
|
50
|
+
}, {
|
|
51
|
+
default: c(() => [(o(!0), g(T, null, _(f.value, (t, a) => (o(), u(n(z), {
|
|
52
|
+
class: i(n(x)("item")),
|
|
53
|
+
key: t.key,
|
|
54
|
+
index: a,
|
|
55
|
+
style: C({
|
|
56
|
+
textAlign: t.align
|
|
57
|
+
})
|
|
58
|
+
}, {
|
|
59
|
+
default: c(() => [b(L(t.value), 1)]),
|
|
60
|
+
_: 2
|
|
61
|
+
}, 1032, ["class", "index", "style"]))), 128))]),
|
|
62
|
+
_: 1
|
|
63
|
+
}, 8, ["class"]));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export {
|
|
67
|
+
J as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { CreateComponentPublicInstance, ExtractPropTypes, PropType, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComponentOptionsBase, Plugin } from 'vue';
|
|
2
|
+
import { ValueType, SummaryColumnType } from './interface';
|
|
3
|
+
export * from './interface';
|
|
4
|
+
export * from './utils';
|
|
5
|
+
declare const ApSummary: {
|
|
6
|
+
new (...args: any[]): CreateComponentPublicInstance<Readonly< ExtractPropTypes<{
|
|
7
|
+
data: {
|
|
8
|
+
type: PropType<ValueType>;
|
|
9
|
+
};
|
|
10
|
+
columns: {
|
|
11
|
+
type: PropType<SummaryColumnType>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
summaryTitle: {
|
|
15
|
+
type: PropType<string>;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
hasSelect: {
|
|
19
|
+
type: PropType<boolean>;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
|
|
23
|
+
data: {
|
|
24
|
+
type: PropType<ValueType>;
|
|
25
|
+
};
|
|
26
|
+
columns: {
|
|
27
|
+
type: PropType<SummaryColumnType>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
summaryTitle: {
|
|
31
|
+
type: PropType<string>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
hasSelect: {
|
|
35
|
+
type: PropType<boolean>;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
}>>, {
|
|
39
|
+
summaryTitle: string;
|
|
40
|
+
hasSelect: boolean;
|
|
41
|
+
}, true, {}, {}, {
|
|
42
|
+
P: {};
|
|
43
|
+
B: {};
|
|
44
|
+
D: {};
|
|
45
|
+
C: {};
|
|
46
|
+
M: {};
|
|
47
|
+
Defaults: {};
|
|
48
|
+
}, Readonly< ExtractPropTypes<{
|
|
49
|
+
data: {
|
|
50
|
+
type: PropType<ValueType>;
|
|
51
|
+
};
|
|
52
|
+
columns: {
|
|
53
|
+
type: PropType<SummaryColumnType>;
|
|
54
|
+
required: true;
|
|
55
|
+
};
|
|
56
|
+
summaryTitle: {
|
|
57
|
+
type: PropType<string>;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
hasSelect: {
|
|
61
|
+
type: PropType<boolean>;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
}>>, {}, {}, {}, {}, {
|
|
65
|
+
summaryTitle: string;
|
|
66
|
+
hasSelect: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
__isFragment?: never;
|
|
69
|
+
__isTeleport?: never;
|
|
70
|
+
__isSuspense?: never;
|
|
71
|
+
} & ComponentOptionsBase<Readonly< ExtractPropTypes<{
|
|
72
|
+
data: {
|
|
73
|
+
type: PropType<ValueType>;
|
|
74
|
+
};
|
|
75
|
+
columns: {
|
|
76
|
+
type: PropType<SummaryColumnType>;
|
|
77
|
+
required: true;
|
|
78
|
+
};
|
|
79
|
+
summaryTitle: {
|
|
80
|
+
type: PropType<string>;
|
|
81
|
+
default: string;
|
|
82
|
+
};
|
|
83
|
+
hasSelect: {
|
|
84
|
+
type: PropType<boolean>;
|
|
85
|
+
default: boolean;
|
|
86
|
+
};
|
|
87
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
88
|
+
summaryTitle: string;
|
|
89
|
+
hasSelect: boolean;
|
|
90
|
+
}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
91
|
+
$props: {
|
|
92
|
+
onClick?: () => void;
|
|
93
|
+
};
|
|
94
|
+
}));
|
|
95
|
+
export { ApSummary };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { withInstall as m } from "@aplus-frontend/utils";
|
|
2
|
+
import "./ap-summary.vue.mjs";
|
|
3
|
+
import "./interface.mjs";
|
|
4
|
+
import { computedRecords as n, flattenColumns as s, formatDataIndex as c, formatNumber as l } from "./utils.mjs";
|
|
5
|
+
import o from "./ap-summary.vue2.mjs";
|
|
6
|
+
const e = m(o);
|
|
7
|
+
export {
|
|
8
|
+
e as ApSummary,
|
|
9
|
+
n as computedRecords,
|
|
10
|
+
s as flattenColumns,
|
|
11
|
+
c as formatDataIndex,
|
|
12
|
+
l as formatNumber
|
|
13
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ColumnsType } from 'ant-design-vue/es/table';
|
|
2
|
+
import { AlignType, DataIndex, Key } from 'ant-design-vue/es/vc-table/interface';
|
|
3
|
+
import { ApColumnType } from 'src/ap-table';
|
|
4
|
+
export type SummaryColumnType = ApColumnType[] | ColumnsType;
|
|
5
|
+
export type ValueType = {
|
|
6
|
+
[key in string]: any;
|
|
7
|
+
};
|
|
8
|
+
export interface ApSummaryProps {
|
|
9
|
+
data?: ValueType;
|
|
10
|
+
columns: SummaryColumnType;
|
|
11
|
+
/**
|
|
12
|
+
* @default 合计
|
|
13
|
+
*/
|
|
14
|
+
summaryTitle?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
hasSelect?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface SummaryItemType {
|
|
21
|
+
key: any | undefined;
|
|
22
|
+
rowSpan: number;
|
|
23
|
+
align?: AlignType | undefined;
|
|
24
|
+
value: any;
|
|
25
|
+
}
|
|
26
|
+
export interface SumConfig {
|
|
27
|
+
/**
|
|
28
|
+
* 优先用 columns 的dataIndex做对比,再用 key 做对比
|
|
29
|
+
*/
|
|
30
|
+
key: Key;
|
|
31
|
+
dataIndex: DataIndex | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface ComputedRecordParams<T> {
|
|
34
|
+
records: T[];
|
|
35
|
+
columns: SummaryColumnType;
|
|
36
|
+
configList?: SumConfig[];
|
|
37
|
+
/**
|
|
38
|
+
* 排出 在 columns 和 configList中相同key 的配置项
|
|
39
|
+
*/
|
|
40
|
+
exclude?: Key[];
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/dist/ap-summary/ap-summary.css';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/src/ap-summary/index.less';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRecordParams, SummaryColumnType, ValueType } from './interface';
|
|
2
|
+
import { DataIndex, Key } from 'ant-design-vue/es/vc-table/interface';
|
|
3
|
+
import { ApColumnType } from '../../ap-table/interface';
|
|
4
|
+
export declare const flattenColumns: (columns?: SummaryColumnType) => ApColumnType[];
|
|
5
|
+
export declare const formatDataIndex: (dataIndex?: DataIndex | Key) => string | number | readonly (string | number)[];
|
|
6
|
+
export declare const formatNumber: (value: any, precision: number, thousands: boolean) => string;
|
|
7
|
+
/**
|
|
8
|
+
* 自动对表格数据进行求和
|
|
9
|
+
* @param params ComputedRecordParams
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function computedRecords<T>(params: ComputedRecordParams<T>): ValueType;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { flatten as k, uniqBy as I, get as s, set as N } from "lodash-unified";
|
|
2
|
+
import { toThousand as R, toFixed as V, addNumber as S } from "@aplus-frontend/utils";
|
|
3
|
+
const b = (t) => {
|
|
4
|
+
var e, d;
|
|
5
|
+
return t != null && t.children && ((e = t == null ? void 0 : t.children) == null ? void 0 : e.length) > 0 ? k((d = t.children) == null ? void 0 : d.map((n) => b(n))) : [t];
|
|
6
|
+
}, T = (t) => k(
|
|
7
|
+
t == null ? void 0 : t.map((e) => b(e))
|
|
8
|
+
), u = (t) => Object.prototype.toString.call(t) === "[object Array]" ? t.map((e) => String(e)).join(".") : t || "", B = (t, e, d) => d ? R(t, e) : V(t, e);
|
|
9
|
+
function D(t) {
|
|
10
|
+
var y;
|
|
11
|
+
const { records: e, columns: d, configList: n, exclude: c } = t;
|
|
12
|
+
if (e.length === 0)
|
|
13
|
+
return {};
|
|
14
|
+
const f = T(d);
|
|
15
|
+
let a = (y = f == null ? void 0 : f.filter((r) => r.valueType === "number")) == null ? void 0 : y.map((r) => ({
|
|
16
|
+
key: r.key || "",
|
|
17
|
+
dataIndex: r.dataIndex
|
|
18
|
+
}));
|
|
19
|
+
n && (n == null ? void 0 : n.length) > 0 && (a = I(a == null ? void 0 : a.concat(n), "key")), c && c.length > 0 && (a = a.filter(
|
|
20
|
+
(r) => !c.includes(r.key)
|
|
21
|
+
));
|
|
22
|
+
const x = {};
|
|
23
|
+
return e.reduce((r, h) => (a.forEach((o) => {
|
|
24
|
+
var p;
|
|
25
|
+
if (s(h, u(o.dataIndex || o.key))) {
|
|
26
|
+
const i = o.dataIndex || o.key, g = s(r, u(i)) || 0, j = s(h, u(i)) || 0, l = (p = S(g, j)) == null ? void 0 : p.toNumber();
|
|
27
|
+
N(r, i, +l);
|
|
28
|
+
}
|
|
29
|
+
}), r), x);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
D as computedRecords,
|
|
33
|
+
T as flattenColumns,
|
|
34
|
+
u as formatDataIndex,
|
|
35
|
+
B as formatNumber
|
|
36
|
+
};
|