@aplus-frontend/ui 0.2.0-beta.4 → 0.2.0-beta.5
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/hooks/use-default-placeholder.mjs +14 -14
- package/es/src/ap-form/items/checkbox/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/date/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/date-range/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/number/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/radio/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/select/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/switch/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/text/index.vue.d.ts +1 -1
- package/es/src/ap-form/items/text/password.vue.d.ts +1 -1
- package/es/src/ap-form/items/text-area/index.vue.d.ts +1 -1
- package/es/src/ap-table/ap-table.vue.mjs +103 -108
- package/es/src/ap-table/constants.d.ts +190 -190
- package/es/src/ap-table/utils.d.ts +195 -233
- package/es/src/ap-table/utils.mjs +69 -80
- package/es/src/ap-upload/apUpload.vue.d.ts +2 -2
- package/es/src/ap-upload/apUploadTypes.d.ts +18 -0
- package/es/src/ap-upload/components/MultipleFile.vue2.mjs +55 -57
- package/es/src/ap-upload/components/Picture.vue.d.ts +41 -1
- package/es/src/ap-upload/components/Picture.vue2.mjs +103 -82
- package/es/src/editable-table/hooks/use-get-columns.mjs +29 -34
- package/es/src/locale/lang/en.mjs +4 -0
- package/es/src/locale/lang/zh-cn.mjs +4 -0
- package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -1
- package/lib/src/ap-form/items/checkbox/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/date/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/date-range/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/number/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/radio/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/select/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/switch/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/text/index.vue.d.ts +1 -1
- package/lib/src/ap-form/items/text/password.vue.d.ts +1 -1
- package/lib/src/ap-form/items/text-area/index.vue.d.ts +1 -1
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +190 -190
- package/lib/src/ap-table/utils.d.ts +195 -233
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/ap-upload/apUpload.vue.d.ts +2 -2
- package/lib/src/ap-upload/apUploadTypes.d.ts +18 -0
- package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/ap-upload/components/Picture.vue.d.ts +41 -1
- package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/package.json +4 -4
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { defineComponent as K, inject as u, ref as R, watch as Q, nextTick as W, openBlock as h, createElementBlock as g, normalizeClass as X, unref as i, createElementVNode as d,
|
|
1
|
+
import { defineComponent as K, inject as u, ref as R, watch as Q, nextTick as W, openBlock as h, createElementBlock as g, normalizeClass as X, unref as i, createElementVNode as d, renderSlot as Y, Fragment as Z, renderList as F, withDirectives as ee, createVNode as k, createCommentVNode as $, vShow as te, 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 {
|
|
9
|
-
import {
|
|
10
|
-
|
|
3
|
+
import { getPath as ne, getName as ae, getReturnData as T } from "../utils/returnData.mjs";
|
|
4
|
+
import { CloseOutlined as se, PlusOutlined as oe } from "@ant-design/icons-vue";
|
|
5
|
+
import { useOss as ie, getOssInstance as D } from "../hooks/useOss.mjs";
|
|
6
|
+
import { fileMatchesAccept as ce, getAcceptText as ue } from "../utils/accept.mjs";
|
|
7
|
+
import { message as m, Progress as re } from "ant-design-vue";
|
|
8
|
+
import { omit as le } from "lodash-unified";
|
|
9
|
+
import { useLocale as pe } from "../../config-provider/hooks/use-locale.mjs";
|
|
10
|
+
import { useNamespace as de } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
|
+
const me = ["accept"], fe = { class: "picture-context" }, he = { class: "picture-item-box" }, ge = ["src"], ve = { class: "picture-item-shadow" }, xe = ["onClick"], _e = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "picture-item-uploading"
|
|
13
|
-
},
|
|
14
|
+
}, ye = { class: "picture-title" }, we = { key: 0 }, ke = { key: 1 }, Te = /* @__PURE__ */ K({
|
|
14
15
|
__name: "Picture",
|
|
15
|
-
setup(
|
|
16
|
-
const { t: r } =
|
|
16
|
+
setup(Ce, { expose: E }) {
|
|
17
|
+
const { t: r } = pe(), { b: U } = de("ap-upload-picture"), { put: O } = ie(), B = u("theme"), L = u("dirName"), y = u("accept") || "image/*", w = u("maxSize") ?? 5, A = u("title"), l = u("maxCount") ?? 10, v = u("uploadingCount"), N = u("beforeUpload"), P = u("customRequest"), S = u("getOssAccess"), x = R(null), c = u("value"), _ = u("needName");
|
|
17
18
|
let s = R([]);
|
|
18
19
|
const f = [];
|
|
19
20
|
Q(
|
|
20
21
|
() => c == null ? void 0 : c.value,
|
|
21
22
|
async function(e) {
|
|
22
23
|
var a;
|
|
23
|
-
!((a = s == null ? void 0 : s.value) != null && a.length) && e &&
|
|
24
|
+
!((a = s == null ? void 0 : s.value) != null && a.length) && e && b(e);
|
|
24
25
|
},
|
|
25
26
|
{ immediate: !0 }
|
|
26
27
|
);
|
|
27
|
-
function
|
|
28
|
+
function b(e) {
|
|
28
29
|
if (!e) {
|
|
29
30
|
c.value = void 0, f.splice(0, f.length), s.value = [];
|
|
30
31
|
return;
|
|
@@ -32,7 +33,8 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
32
33
|
W(async () => {
|
|
33
34
|
const a = [];
|
|
34
35
|
for (let t of e) {
|
|
35
|
-
const n =
|
|
36
|
+
const n = ne(_, t), o = ae(_, t), p = await D(S), H = await p.getSignatureUrl(n), J = {
|
|
37
|
+
...typeof t == "string" ? {} : t,
|
|
36
38
|
...new File([t], o, {}),
|
|
37
39
|
uid: `${(/* @__PURE__ */ new Date()).getTime()}-${Math.random()}`,
|
|
38
40
|
thumbUrl: H,
|
|
@@ -58,38 +60,38 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
58
60
|
}), c.value = e;
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
|
-
|
|
63
|
+
E({ setValue: b });
|
|
62
64
|
function q() {
|
|
63
65
|
var e;
|
|
64
|
-
(e =
|
|
66
|
+
(e = x.value) == null || e.click();
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function M(e) {
|
|
67
69
|
const a = e.target;
|
|
68
|
-
|
|
70
|
+
V(a == null ? void 0 : a.files);
|
|
69
71
|
}
|
|
70
|
-
function
|
|
72
|
+
function V(e) {
|
|
71
73
|
if (e != null && e.length)
|
|
72
74
|
for (let a = 0; a < e.length; a++)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
j(e[a]);
|
|
76
|
+
x.value && (x.value.value = "");
|
|
75
77
|
}
|
|
76
|
-
let
|
|
77
|
-
function
|
|
78
|
+
let z;
|
|
79
|
+
function j(e) {
|
|
78
80
|
if (l && l > 1 && s.value.length >= l)
|
|
79
|
-
return clearTimeout(
|
|
81
|
+
return clearTimeout(z), z = setTimeout(() => {
|
|
80
82
|
m.warning(
|
|
81
83
|
r("ap.apUpload.maxUploadPicture", { maxCount: l })
|
|
82
84
|
);
|
|
83
85
|
}), !1;
|
|
84
|
-
if (typeof
|
|
85
|
-
if (
|
|
86
|
+
if (typeof N == "function") {
|
|
87
|
+
if (N(e) === !1)
|
|
86
88
|
return !1;
|
|
87
89
|
} else {
|
|
88
|
-
if (e.size >
|
|
90
|
+
if (e.size > w * 1024 * 1024)
|
|
89
91
|
return m.warning(
|
|
90
|
-
r("ap.apUpload.maxUploadFileSize", { maxSize:
|
|
92
|
+
r("ap.apUpload.maxUploadFileSize", { maxSize: w })
|
|
91
93
|
), !1;
|
|
92
|
-
if (!/image\/\w+/.test(e.type) || !
|
|
94
|
+
if (!/image\/\w+/.test(e.type) || !ce(e, y))
|
|
93
95
|
return m.warning(r("ap.apUpload.pictureFormatNotSupported")), !1;
|
|
94
96
|
}
|
|
95
97
|
const a = new FileReader();
|
|
@@ -101,14 +103,14 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
101
103
|
status: "uploading",
|
|
102
104
|
percent: 0
|
|
103
105
|
};
|
|
104
|
-
|
|
106
|
+
G(t, e);
|
|
105
107
|
}, a.onerror = function() {
|
|
106
108
|
m.warning(r("ap.apUpload.imageParsingFailed"));
|
|
107
109
|
};
|
|
108
110
|
}
|
|
109
|
-
async function
|
|
110
|
-
if (v.value++, typeof
|
|
111
|
-
|
|
111
|
+
async function G(e, a) {
|
|
112
|
+
if (v.value++, typeof P == "function") {
|
|
113
|
+
P({
|
|
112
114
|
onProgress: (t) => {
|
|
113
115
|
const n = s.value.find((o) => o.uid === e.uid);
|
|
114
116
|
n && (n.percent = t);
|
|
@@ -122,7 +124,10 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
122
124
|
},
|
|
123
125
|
onSuccess: (t) => {
|
|
124
126
|
const n = s.value.find((o) => o.uid === e.uid);
|
|
125
|
-
n && (n.status = "success", n.path = t), c.value
|
|
127
|
+
n && (n.status = "success", n.path = t), c.value = [
|
|
128
|
+
...c.value || [],
|
|
129
|
+
T(_, t, a.name)
|
|
130
|
+
], f.push({
|
|
126
131
|
uid: e.uid,
|
|
127
132
|
path: t
|
|
128
133
|
}), v.value--;
|
|
@@ -132,14 +137,17 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
132
137
|
return;
|
|
133
138
|
}
|
|
134
139
|
try {
|
|
135
|
-
const t = await
|
|
136
|
-
e.oss = t, s.value.push(e),
|
|
140
|
+
const t = await D(S);
|
|
141
|
+
e.oss = t, s.value.push(e), O({
|
|
137
142
|
file: a,
|
|
138
|
-
dirName:
|
|
143
|
+
dirName: L,
|
|
139
144
|
oss: t,
|
|
140
145
|
successCallBack(n) {
|
|
141
146
|
const o = s.value.find((p) => p.uid === e.uid);
|
|
142
|
-
o && (o.status = "success", o.path = n), c.value
|
|
147
|
+
o && (o.status = "success", o.path = n), c.value = [
|
|
148
|
+
...c.value || [],
|
|
149
|
+
T(_, n, a.name)
|
|
150
|
+
], f.push({
|
|
143
151
|
uid: e.uid,
|
|
144
152
|
path: n
|
|
145
153
|
}), v.value--;
|
|
@@ -164,7 +172,7 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
164
172
|
n > -1 && s.value.splice(n, 1), v.value--;
|
|
165
173
|
}
|
|
166
174
|
}
|
|
167
|
-
function
|
|
175
|
+
function I(e) {
|
|
168
176
|
var t;
|
|
169
177
|
if (e.path) {
|
|
170
178
|
if (Array.isArray(c.value)) {
|
|
@@ -182,67 +190,80 @@ const pe = ["accept"], de = { class: "picture-context" }, me = { class: "picture
|
|
|
182
190
|
}
|
|
183
191
|
return (e, a) => (h(), g("div", {
|
|
184
192
|
class: X({
|
|
185
|
-
[i(
|
|
186
|
-
[i(
|
|
193
|
+
[i(U)()]: !0,
|
|
194
|
+
[i(U)("admin")]: i(B) === "admin"
|
|
187
195
|
})
|
|
188
196
|
}, [
|
|
189
197
|
d("input", {
|
|
190
198
|
style: { display: "none" },
|
|
191
199
|
type: "file",
|
|
192
200
|
ref_key: "fileRef",
|
|
193
|
-
ref:
|
|
194
|
-
accept: i(
|
|
195
|
-
onChange:
|
|
196
|
-
}, null, 40,
|
|
197
|
-
d("div",
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
201
|
+
ref: x,
|
|
202
|
+
accept: i(y),
|
|
203
|
+
onChange: M
|
|
204
|
+
}, null, 40, me),
|
|
205
|
+
d("div", fe, [
|
|
206
|
+
Y(e.$slots, "pictureContext", {
|
|
207
|
+
fileList: i(s).map((t) => {
|
|
208
|
+
var n;
|
|
209
|
+
return {
|
|
210
|
+
...i(le)(t, "oss"),
|
|
211
|
+
oss: {
|
|
212
|
+
pauseUpload: (n = t == null ? void 0 : t.oss) == null ? void 0 : n.pauseUpload
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}),
|
|
216
|
+
remove: I
|
|
217
|
+
}, () => [
|
|
218
|
+
(h(!0), g(Z, null, F(i(s), (t) => (h(), g("div", {
|
|
219
|
+
key: t.uid,
|
|
220
|
+
class: "picture-item"
|
|
221
|
+
}, [
|
|
222
|
+
d("div", he, [
|
|
223
|
+
d("img", {
|
|
224
|
+
src: t.thumbUrl,
|
|
225
|
+
alt: ""
|
|
226
|
+
}, null, 8, ge),
|
|
227
|
+
ee(d("div", ve, [
|
|
228
|
+
d("div", {
|
|
229
|
+
class: "picture-item-close",
|
|
230
|
+
onClick: (n) => I(t)
|
|
231
|
+
}, [
|
|
232
|
+
k(i(se))
|
|
233
|
+
], 8, xe),
|
|
234
|
+
t.status === "uploading" ? (h(), g("div", _e, [
|
|
235
|
+
k(i(re), {
|
|
236
|
+
percent: t.percent,
|
|
237
|
+
strokeColor: "#ffffff",
|
|
238
|
+
trailColor: "rgba(255, 255, 255, 0.3)",
|
|
239
|
+
size: 4,
|
|
240
|
+
showInfo: !1
|
|
241
|
+
}, null, 8, ["percent"])
|
|
242
|
+
])) : $("", !0)
|
|
243
|
+
], 512), [
|
|
244
|
+
[te, t.status === "uploading"]
|
|
245
|
+
])
|
|
225
246
|
])
|
|
226
|
-
])
|
|
227
|
-
])
|
|
247
|
+
]))), 128))
|
|
248
|
+
]),
|
|
228
249
|
i(l) === void 0 || i(s).length < i(l) ? (h(), g("div", {
|
|
229
250
|
key: 0,
|
|
230
251
|
class: "picture-upload",
|
|
231
252
|
onClick: q
|
|
232
253
|
}, [
|
|
233
|
-
|
|
234
|
-
d("div", null,
|
|
254
|
+
k(i(oe)),
|
|
255
|
+
d("div", null, C(i(r)("ap.apUpload.update")), 1)
|
|
235
256
|
])) : $("", !0)
|
|
236
257
|
]),
|
|
237
|
-
d("div",
|
|
238
|
-
i(
|
|
258
|
+
d("div", ye, [
|
|
259
|
+
i(A) ? (h(), g("div", we, C(i(A)), 1)) : (h(), g("div", ke, C(`${i(r)("ap.apUpload.supportExtension")}:${i(ue)(i(y))},${i(r)(
|
|
239
260
|
"ap.apUpload.maxUploadPictureSize",
|
|
240
|
-
{ maxSize: i(
|
|
261
|
+
{ maxSize: i(w) }
|
|
241
262
|
)}`), 1))
|
|
242
263
|
])
|
|
243
264
|
], 2));
|
|
244
265
|
}
|
|
245
266
|
});
|
|
246
267
|
export {
|
|
247
|
-
|
|
268
|
+
Te as default
|
|
248
269
|
};
|
|
@@ -1,50 +1,45 @@
|
|
|
1
|
-
import { useSlots as
|
|
2
|
-
import { omit as
|
|
1
|
+
import { useSlots as N, computed as T, unref as m } from "vue";
|
|
2
|
+
import { omit as y, isFunction as k, isArray as f } from "lodash-unified";
|
|
3
3
|
import { getEditableTableTitle as w, mergeClass as A, getFinalNode as q } from "../utils.mjs";
|
|
4
|
-
import { updateFormProps as
|
|
4
|
+
import { updateFormProps as v, getFieldProps as E, getTableRenderProps as G } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { useToken as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const W = (a, b) => {
|
|
6
|
+
import { useToken as S } from "ant-design-vue/es/theme/internal";
|
|
7
|
+
import { useNamespace as U } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
+
const M = (a, b) => {
|
|
10
9
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = j("editable-table"), F = y(), [, I] = U();
|
|
16
|
-
return N(() => {
|
|
10
|
+
em: x,
|
|
11
|
+
be: g
|
|
12
|
+
} = U("editable-table"), F = N(), [, h] = S();
|
|
13
|
+
return T(() => {
|
|
17
14
|
const d = a.columns;
|
|
18
15
|
if (!d)
|
|
19
16
|
return [];
|
|
20
|
-
function c(
|
|
21
|
-
return
|
|
22
|
-
...
|
|
17
|
+
function c(I) {
|
|
18
|
+
return I.map((e) => ({
|
|
19
|
+
...y(e, ["ellipsis"]),
|
|
23
20
|
children: c(e.children || []),
|
|
24
|
-
title: w(e,
|
|
21
|
+
title: w(e, g("table-header", "title"), x("header-cell", "required"), F.headerCell, m(h).colorPrimary),
|
|
25
22
|
customRender({
|
|
26
|
-
value:
|
|
23
|
+
value: t,
|
|
27
24
|
...n
|
|
28
25
|
}) {
|
|
29
|
-
const
|
|
26
|
+
const o = k(e.editable) ? e.editable(n.text, n.record, n.index) : !!e.editable;
|
|
30
27
|
if (!e.valueType && !e.customRender && !e.customRenderFormItem)
|
|
31
28
|
return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
|
|
32
29
|
let r;
|
|
33
|
-
if (
|
|
34
|
-
const l =
|
|
35
|
-
value:
|
|
30
|
+
if (o) {
|
|
31
|
+
const l = v(e, E(e.fieldProps, {
|
|
32
|
+
value: t,
|
|
36
33
|
...n
|
|
37
34
|
})), i = {};
|
|
38
|
-
a.onFieldChange && (i[`onUpdate:${l.valuePropName || "value"}`] = (
|
|
35
|
+
a.onFieldChange && (i[`onUpdate:${l.valuePropName || "value"}`] = (C) => {
|
|
39
36
|
var s;
|
|
40
|
-
return (s = a.onFieldChange) == null ? void 0 : s.call(a, n.index, e.dataIndex,
|
|
37
|
+
return (s = a.onFieldChange) == null ? void 0 : s.call(a, n.index, e.dataIndex, C);
|
|
41
38
|
});
|
|
42
|
-
const
|
|
39
|
+
const R = f(e.dataIndex) ? e.dataIndex : [e.dataIndex];
|
|
43
40
|
r = {
|
|
44
|
-
name: [...f(a.name) ? a.name : [a.name], n.index, ...
|
|
41
|
+
name: [...f(a.name) ? a.name : [a.name], n.index, ...R],
|
|
45
42
|
...l || {},
|
|
46
|
-
// 格式化placeholder
|
|
47
|
-
placeholder: L(g, e.valueType, l == null ? void 0 : l.placeholder),
|
|
48
43
|
field: {
|
|
49
44
|
style: "width: 100%",
|
|
50
45
|
...(l == null ? void 0 : l.field) || {},
|
|
@@ -54,16 +49,16 @@ const W = (a, b) => {
|
|
|
54
49
|
};
|
|
55
50
|
} else
|
|
56
51
|
r = {
|
|
57
|
-
field:
|
|
58
|
-
value:
|
|
52
|
+
field: G(e, {
|
|
53
|
+
value: t,
|
|
59
54
|
...n
|
|
60
55
|
})
|
|
61
56
|
};
|
|
62
|
-
const u = q(e,
|
|
57
|
+
const u = q(e, o, r, t, n.record, m(b));
|
|
63
58
|
return e.customRender ? e.customRender({
|
|
64
|
-
value:
|
|
59
|
+
value: t,
|
|
65
60
|
...n,
|
|
66
|
-
editable:
|
|
61
|
+
editable: o,
|
|
67
62
|
originalNode: u
|
|
68
63
|
}) : u;
|
|
69
64
|
}
|
|
@@ -73,5 +68,5 @@ const W = (a, b) => {
|
|
|
73
68
|
});
|
|
74
69
|
};
|
|
75
70
|
export {
|
|
76
|
-
|
|
71
|
+
M as default
|
|
77
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue");require("../../config-provider/index.js");const u=require("../../utils/index.js"),n=require("../../config-provider/hooks/use-locale.js"),c=["Select","Date"],s=["Text","TextArea","Number","TextPassword"],i=(t,r)=>{const{t:e}=n.useLocale();return o.computed(()=>{if(u.isDef(r.placeholder))return r.placeholder;if(t==="DateRange")return[e("ap.field.startDateText"),e("ap.field.endDateText")];if(c.includes(t))return e("ap.common.chooseText");if(s.includes(t))return e("ap.common.inputText")})};exports.useDefaultPlaceholder=i;
|
|
@@ -27,12 +27,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
27
27
|
field: () => {};
|
|
28
28
|
}>>>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
+
field: Omit< ApFieldCheckboxProps, "value" | "onUpdate:value">;
|
|
30
31
|
colon: boolean;
|
|
31
32
|
required: boolean;
|
|
32
33
|
hasFeedback: boolean;
|
|
33
34
|
autoLink: boolean;
|
|
34
35
|
validateFirst: boolean;
|
|
35
|
-
field: Omit< ApFieldCheckboxProps, "value" | "onUpdate:value">;
|
|
36
36
|
}, {}>;
|
|
37
37
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
38
38
|
export default _default;
|
|
@@ -50,12 +50,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
50
50
|
field: () => {};
|
|
51
51
|
}>>>, {
|
|
52
52
|
disabled: boolean;
|
|
53
|
+
field: Omit< ApFieldDateProps, "value" | "onUpdate:value">;
|
|
53
54
|
colon: boolean;
|
|
54
55
|
required: boolean;
|
|
55
56
|
hasFeedback: boolean;
|
|
56
57
|
autoLink: boolean;
|
|
57
58
|
validateFirst: boolean;
|
|
58
|
-
field: Omit< ApFieldDateProps, "value" | "onUpdate:value">;
|
|
59
59
|
}, {}>;
|
|
60
60
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
61
61
|
export default _default;
|
|
@@ -48,12 +48,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
48
48
|
field: () => {};
|
|
49
49
|
}>>>, {
|
|
50
50
|
disabled: boolean;
|
|
51
|
+
field: Omit< ApFieldDateRangeProps, "value" | "onUpdate:value">;
|
|
51
52
|
colon: boolean;
|
|
52
53
|
required: boolean;
|
|
53
54
|
hasFeedback: boolean;
|
|
54
55
|
autoLink: boolean;
|
|
55
56
|
validateFirst: boolean;
|
|
56
|
-
field: Omit< ApFieldDateRangeProps, "value" | "onUpdate:value">;
|
|
57
57
|
}, {}>;
|
|
58
58
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
59
59
|
export default _default;
|
|
@@ -594,12 +594,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
594
594
|
field: () => {};
|
|
595
595
|
}>>>, {
|
|
596
596
|
disabled: boolean;
|
|
597
|
+
field: Omit< ApFieldNumberProps, "value" | "onUpdate:value">;
|
|
597
598
|
colon: boolean;
|
|
598
599
|
required: boolean;
|
|
599
600
|
hasFeedback: boolean;
|
|
600
601
|
autoLink: boolean;
|
|
601
602
|
validateFirst: boolean;
|
|
602
|
-
field: Omit< ApFieldNumberProps, "value" | "onUpdate:value">;
|
|
603
603
|
}, {}>;
|
|
604
604
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
605
605
|
export default _default;
|
|
@@ -229,12 +229,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
229
229
|
field: () => {};
|
|
230
230
|
}>>>, {
|
|
231
231
|
disabled: boolean;
|
|
232
|
+
field: Omit< ApFieldRadioProps, "value" | "onUpdate:value">;
|
|
232
233
|
colon: boolean;
|
|
233
234
|
required: boolean;
|
|
234
235
|
hasFeedback: boolean;
|
|
235
236
|
autoLink: boolean;
|
|
236
237
|
validateFirst: boolean;
|
|
237
|
-
field: Omit< ApFieldRadioProps, "value" | "onUpdate:value">;
|
|
238
238
|
}, {}>;
|
|
239
239
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
240
240
|
export default _default;
|
|
@@ -55,12 +55,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
55
55
|
field: () => {};
|
|
56
56
|
}>>>, {
|
|
57
57
|
disabled: boolean;
|
|
58
|
+
field: Omit< ApFieldSelectProps, "value" | "onUpdate:value">;
|
|
58
59
|
colon: boolean;
|
|
59
60
|
required: boolean;
|
|
60
61
|
hasFeedback: boolean;
|
|
61
62
|
autoLink: boolean;
|
|
62
63
|
validateFirst: boolean;
|
|
63
|
-
field: Omit< ApFieldSelectProps, "value" | "onUpdate:value">;
|
|
64
64
|
}, {}>;
|
|
65
65
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
66
66
|
export default _default;
|
|
@@ -36,13 +36,13 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
36
36
|
field: () => {};
|
|
37
37
|
}>>>, {
|
|
38
38
|
disabled: boolean;
|
|
39
|
+
field: Omit< ApFieldSwitchProps, "checked" | "onUpdate:checked">;
|
|
39
40
|
colon: boolean;
|
|
40
41
|
required: boolean;
|
|
41
42
|
hasFeedback: boolean;
|
|
42
43
|
autoLink: boolean;
|
|
43
44
|
validateFirst: boolean;
|
|
44
45
|
valuePropName: string;
|
|
45
|
-
field: Omit< ApFieldSwitchProps, "checked" | "onUpdate:checked">;
|
|
46
46
|
}, {}>;
|
|
47
47
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
48
48
|
export default _default;
|
|
@@ -606,12 +606,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
606
606
|
field: () => {};
|
|
607
607
|
}>>>, {
|
|
608
608
|
disabled: boolean;
|
|
609
|
+
field: Omit< ApFieldTextProps, "value" | "onUpdate:value">;
|
|
609
610
|
colon: boolean;
|
|
610
611
|
required: boolean;
|
|
611
612
|
hasFeedback: boolean;
|
|
612
613
|
autoLink: boolean;
|
|
613
614
|
validateFirst: boolean;
|
|
614
|
-
field: Omit< ApFieldTextProps, "value" | "onUpdate:value">;
|
|
615
615
|
}, {}>;
|
|
616
616
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
617
617
|
export default _default;
|
|
@@ -669,12 +669,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
669
669
|
field: () => {};
|
|
670
670
|
}>>>, {
|
|
671
671
|
disabled: boolean;
|
|
672
|
+
field: Omit< ApFieldTextPasswordProps, "value" | "onUpdate:value">;
|
|
672
673
|
colon: boolean;
|
|
673
674
|
required: boolean;
|
|
674
675
|
hasFeedback: boolean;
|
|
675
676
|
autoLink: boolean;
|
|
676
677
|
validateFirst: boolean;
|
|
677
|
-
field: Omit< ApFieldTextPasswordProps, "value" | "onUpdate:value">;
|
|
678
678
|
}, {}>;
|
|
679
679
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
680
680
|
export default _default;
|
|
@@ -500,12 +500,12 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
|
|
|
500
500
|
field: () => {};
|
|
501
501
|
}>>>, {
|
|
502
502
|
disabled: boolean;
|
|
503
|
+
field: Omit< ApFieldTextAreaProps, "value" | "onUpdate:value">;
|
|
503
504
|
colon: boolean;
|
|
504
505
|
required: boolean;
|
|
505
506
|
hasFeedback: boolean;
|
|
506
507
|
autoLink: boolean;
|
|
507
508
|
validateFirst: boolean;
|
|
508
|
-
field: Omit< ApFieldTextAreaProps, "value" | "onUpdate:value">;
|
|
509
509
|
}, {}>;
|
|
510
510
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
511
511
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),S=require("ant-design-vue"),le=require("ant-design-vue/es/theme/internal"),se=require("../ap-form/index.js"),O=require("./constants.js");require("../config-provider/index.js");const ue=require("./hooks/use-table-paging.js"),i=require("lodash-unified"),u=require("./utils.js"),de=require("./hooks/use-table-content-height.js"),ie=require("../editable-table/utils.js"),ce=require("./hooks/use-table-row-selection.js"),fe=require("../utils/index.js"),pe=require("@ant-design/icons-vue");require("./components/setting/modal/index.vue.js");const me=require("./context.js"),ge=require("../config-provider/hooks/use-locale.js"),ye=require("../config-provider/hooks/use-namespace.js"),he=require("../config-provider/hooks/use-global-config.js"),we=require("./components/setting/modal/index.vue2.js"),Se=e.defineComponent({name:"ApTable",__name:"ap-table",props:{dropdownPrefixCls:{},loading:{type:[Boolean,Object],default:void 0},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},rowSelection:{type:[Boolean,Object]},card:{type:Boolean,default:!1},params:{},searchFormRender:{},request:{},onLoad:{},defaultData:{},dataSource:{},onLoadingChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},manual:{type:Boolean,default:!1},size:{default:"middle"},adaptive:{type:Boolean,default:!1},columnResizable:{type:Boolean,default:!1},settings:{type:[Boolean,Object],default:void 0}},setup(K,{expose:D}){const r=K;let B=0;const m=e.useSlots(),[,j]=le.useToken(),{t:A}=ge.useLocale(),{e:b,b:c,be:T}=ye.useNamespace("ap-table"),x=he.useGlobalConfig("valueTypeMap"),{height:U,contentRef:_}=de.default(),C=e.ref(r.size),d=e.ref([]),F=e.ref([]);me.useProvideApTable({columns:e.computed(()=>d.value),columnsBackup:e.computed(()=>F.value),size:e.computed(()=>C.value),updateColumns(t){d.value=t},updateSize(t){C.value=t}});const $=()=>{var n;let t=((n=r.columns)==null?void 0:n.filter(o=>!o.hideInTable))||[];function a(o,s){return o.map(l=>({resizable:fe.isDef(l.resizable)?l.resizable:r.columnResizable,...i.omit(u.apColumnToColumn(l),["ellipsis"]),fixed:s?s.fixed:l.fixed,title:u.getTableTitle(l,T("table-header","title"),m.headerCell,e.unref(j).colorPrimary),customRender({value:f,...p}){var E,L;const V=u.getTableRenderType(l),ae=u.getTableRenderProps({...l,valueType:V},{value:f,...p}),ne=u.getTableCellRenderNode(V,ae,p.record,e.unref(x)),I=((E=l.renderText)==null?void 0:E.call(l,{value:f,...p}))||f,oe=l.renderText?e.createVNode(e.Fragment,null,[(L=l.renderText)==null?void 0:L.call(l,{value:f,...p})]):ne;let R=Z(l,I,oe);return l.customRender&&(R=l.customRender({value:f,...p,column:l,originalNode:R,originalText:I})),R},children:a(l.children||[],s||l)}))}return a(t)};e.watchEffect(()=>{const t=$();d.value=t,F.value=t});const k=e.computed(()=>{var t,a,n;return B++,((n=(a=(t=r.columns)==null?void 0:t.filter(o=>!o.hideInSearch&&o.dataIndex&&(o.valueType||o.customRenderFormItem)&&!O.noRenderAsFormItemValueList.includes(o.valueType)))==null?void 0:a.sort((o,s)=>{let l=u.getColumnOrder(o.order);return u.getColumnOrder(s.order)-l}))==null?void 0:n.map(o=>{const s=u.updateFormProps(o,u.getFieldProps(o.fieldProps,{})),l={...o,fieldProps:{label:o.title,name:o.dataIndex,...s||{},placeholder:u.getPlaceholder(A,o.valueType,s==null?void 0:s.placeholder),_signal:B},renderNode:void 0};return l.renderNode=u.getSearchFormItemRenderNode(l,e.unref(x)),l}))||[]}),W=e.computed(()=>e.unref(d).filter(t=>t.sorter===!0).map(t=>t.dataIndex).filter(Boolean)),H=e.computed(()=>e.unref(d).filter(t=>t.filters&&!t.onFilter).map(t=>t.dataIndex).filter(Boolean)),M=e.computed(()=>i.isUndefined(r.dataSource)?w.value.records:r.dataSource),{rowSelection:g,selectedRows:y,...h}=ce.default({...r.rowSelection===!0?{}:r.rowSelection,rowKey:r.rowKey,dataSource:M}),{formRef:v,submit:z,reset:P,tableProps:q,refresh:G,data:w,setDataSource:J}=ue.useTablePaging({async request(t){var n,o;if(!g.value.preserveSelectedRowKeys&&i.isUndefined(r.dataSource)&&h.clearAll(),!i.isUndefined(r.dataSource))return{data:r.dataSource||[],total:r.dataSource.length||0};const a=await((n=r.request)==null?void 0:n.call(r,t));return(o=r.onLoad)==null||o.call(r,(a==null?void 0:a.data)||[]),{data:(a==null?void 0:a.data)||[],total:(a==null?void 0:a.total)||0}},filterFields:H,sortFields:W,defaultParams:r.params,defaultData:r.defaultData,manual:r.manual,defaultCurrent:r.pagination?r.pagination.defaultCurrent:void 0,defaultPageSize:r.pagination?r.pagination.defaultPageSize:void 0,formatParams:r.beforeSearchSubmit,showLessItems:r.pagination?r.pagination.showLessItems:void 0,showTotal:r.pagination?r.pagination.showTotal:void 0}),Q=e.computed(()=>{var a,n;if(r.adaptive&&(w.value.total>0||((a=r.dataSource)==null?void 0:a.length)))return{y:e.unref(U),x:((n=r.scroll)==null?void 0:n.x)||"100%"};if(r.scroll)return r.scroll}),X=e.computed(()=>{var t;if(r.tableLayout)return r.tableLayout;if((t=r.columns)!=null&&t.some(a=>a.ellipsis))return"fixed"}),N=e.computed(()=>{var n;const t=e.unref(q),a=e.unref(g);return{...r,...t,rowSelection:r.rowSelection===!0||((n=r.rowSelection)==null?void 0:n.mode)==="internal"?{...a,preserveSelectedRowKeys:i.isUndefined(r.dataSource)?a.preserveSelectedRowKeys:!0}:r.rowSelection,loading:i.isUndefined(r.loading)?t.loading:r.loading,pagination:r.pagination===!1?!1:t.pagination,scroll:e.unref(Q)}}),Y=e.computed(()=>[c(),r.card?null:c("wrapper"),r.adaptive?c("adaptive"):null].filter(Boolean));function Z(t,a,n){if(O.noRenderAsFormItemValueList.includes(t.valueType))return n;const o=u.objectToString(a);return t.copyable||t.ellipsis?e.createVNode(S.Typography.Paragraph,{copyable:t.copyable?{text:o,tooltip:!1}:!1,ellipsis:t.ellipsis?i.isBoolean(t.ellipsis)?{tooltip:o}:{...t.ellipsis,tooltip:o}:!1,content:t.ellipsis?ie.getRawDisplayValue(t,a):n},null):n}e.watch(()=>e.unref(w).loading,t=>{var a;(a=r.onLoadingChange)==null||a.call(r,t)}),e.watch(()=>r.dataSource,t=>{J(t)},{immediate:!0});function ee(t){var a,n,o;(o=(n=(a=v.value)==null?void 0:a.apForm)==null?void 0:n.setFieldsValue)==null||o.call(n,t)}function te(){var t,a,n;return(n=(a=(t=v.value)==null?void 0:t.apForm)==null?void 0:a.getFieldsValue)==null?void 0:n.call(a,!0)}function re(){return e.unref(d)}return D({submit:()=>z(),reset:()=>P(),refresh:()=>G(),setSearchFormValues:ee,getSearchFormValues:te,getShownColumns:re,dataSource:e.computed(()=>e.unref(w).records),rowSelection:{selectedRows:e.computed(()=>e.unref(y)),...h}}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(Y.value)},[e.unref(i.isUndefined)(t.dataSource)&&t.searchForm!==!1&&k.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.card?e.unref(b)("search-wrapper"):null),style:e.normalizeStyle(t.searchFormWrapperStyle)},[e.createVNode(e.unref(se.ApForm).SearchForm,e.mergeProps(t.searchForm||{},{ref_key:"formRef",ref:v,"custom-reset":"",onSubmit:e.unref(z),onReset:e.unref(P),"submit-loading":e.unref(q).loading}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),e.mergeProps({key:n.dataIndex,ref_for:!0},n.fieldProps||{},{span:n.span}),null,16,["span"]))),128))]),_:2},[m.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["onSubmit","onReset","submit-loading"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"contentRef",ref:_,class:e.normalizeClass([e.unref(b)("table-wrapper"),t.card?e.unref(b)("table-wrapper-card"):null]),style:e.normalizeStyle(t.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(c)("header-wrapper"))},[t.settings?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(c)("header"))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(T)("header","title"))},[e.renderSlot(t.$slots,"title",e.mergeProps({selectedRows:e.unref(y),selectedRowKeys:e.unref(g).selectedRowKeys,shownColumns:d.value},h))],2),m.title?(e.openBlock(),e.createBlock(e.unref(S.Divider),{key:0,type:"vertical"})):e.createCommentVNode("",!0),e.createVNode(we.default,{config:t.settings===!0?{}:t.settings},{trigger:e.withCtx(()=>[e.createVNode(e.unref(S.Button),{class:e.normalizeClass(e.unref(c)("setting-trigger-button")),icon:e.h(e.unref(pe.SettingOutlined))},null,8,["class","icon"])]),_:1},8,["config"])],2)):e.renderSlot(t.$slots,"title",e.mergeProps({key:1,selectedRows:e.unref(y),selectedRowKeys:e.unref(g).selectedRowKeys,shownColumns:d.value},h))],2),e.createVNode(e.unref(S.Table),e.mergeProps({class:e.unref(c)("table")},N.value,{size:C.value,"table-layout":X.value,columns:d.value,onResizeColumn:a[0]||(a[0]=(n,o)=>o.width=n)}),e.createSlots({summary:e.withCtx(()=>[e.renderSlot(t.$slots,"summary",{columns:d.value,records:N.value.dataSource,selectedRows:e.unref(y)})]),_:2},[e.renderList(e.unref(i.omit)(m,["title","searchFormExtra","headerCell","summary"]),(n,o)=>({name:o,fn:e.withCtx(s=>[e.renderSlot(t.$slots,o,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","size","table-layout","columns"])],6)],2))}});exports.default=Se;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),S=require("ant-design-vue"),oe=require("ant-design-vue/es/theme/internal"),le=require("../ap-form/index.js"),O=require("./constants.js");require("../config-provider/index.js");const se=require("./hooks/use-table-paging.js"),i=require("lodash-unified"),s=require("./utils.js"),ue=require("./hooks/use-table-content-height.js"),de=require("../editable-table/utils.js"),ie=require("./hooks/use-table-row-selection.js"),ce=require("../utils/index.js"),fe=require("@ant-design/icons-vue");require("./components/setting/modal/index.vue.js");const pe=require("./context.js"),me=require("../config-provider/hooks/use-namespace.js"),ge=require("../config-provider/hooks/use-global-config.js"),ye=require("./components/setting/modal/index.vue2.js"),he=e.defineComponent({name:"ApTable",__name:"ap-table",props:{dropdownPrefixCls:{},loading:{type:[Boolean,Object],default:void 0},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},rowSelection:{type:[Boolean,Object]},card:{type:Boolean,default:!1},params:{},searchFormRender:{},request:{},onLoad:{},defaultData:{},dataSource:{},onLoadingChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},manual:{type:Boolean,default:!1},size:{default:"middle"},adaptive:{type:Boolean,default:!1},columnResizable:{type:Boolean,default:!1},settings:{type:[Boolean,Object],default:void 0}},setup(K,{expose:D}){const r=K;let B=0;const m=e.useSlots(),[,j]=oe.useToken(),{e:b,b:c,be:T}=me.useNamespace("ap-table"),x=ge.useGlobalConfig("valueTypeMap"),{height:A,contentRef:U}=ue.default(),C=e.ref(r.size),u=e.ref([]),F=e.ref([]);pe.useProvideApTable({columns:e.computed(()=>u.value),columnsBackup:e.computed(()=>F.value),size:e.computed(()=>C.value),updateColumns(t){u.value=t},updateSize(t){C.value=t}});const _=()=>{var n;let t=((n=r.columns)==null?void 0:n.filter(o=>!o.hideInTable))||[];function a(o,d){return o.map(l=>({resizable:ce.isDef(l.resizable)?l.resizable:r.columnResizable,...i.omit(s.apColumnToColumn(l),["ellipsis"]),fixed:d?d.fixed:l.fixed,title:s.getTableTitle(l,T("table-header","title"),m.headerCell,e.unref(j).colorPrimary),customRender({value:f,...p}){var E,L;const V=s.getTableRenderType(l),re=s.getTableRenderProps({...l,valueType:V},{value:f,...p}),ae=s.getTableCellRenderNode(V,re,p.record,e.unref(x)),I=((E=l.renderText)==null?void 0:E.call(l,{value:f,...p}))||f,ne=l.renderText?e.createVNode(e.Fragment,null,[(L=l.renderText)==null?void 0:L.call(l,{value:f,...p})]):ae;let R=Y(l,I,ne);return l.customRender&&(R=l.customRender({value:f,...p,column:l,originalNode:R,originalText:I})),R},children:a(l.children||[],d||l)}))}return a(t)};e.watchEffect(()=>{const t=_();u.value=t,F.value=t});const k=e.computed(()=>{var t,a,n;return B++,((n=(a=(t=r.columns)==null?void 0:t.filter(o=>!o.hideInSearch&&o.dataIndex&&(o.valueType||o.customRenderFormItem)&&!O.noRenderAsFormItemValueList.includes(o.valueType)))==null?void 0:a.sort((o,d)=>{let l=s.getColumnOrder(o.order);return s.getColumnOrder(d.order)-l}))==null?void 0:n.map(o=>{const d=s.updateFormProps(o,s.getFieldProps(o.fieldProps,{})),l={...o,fieldProps:{label:o.title,name:o.dataIndex,...d||{},_signal:B},renderNode:void 0};return l.renderNode=s.getSearchFormItemRenderNode(l,e.unref(x)),l}))||[]}),$=e.computed(()=>e.unref(u).filter(t=>t.sorter===!0).map(t=>t.dataIndex).filter(Boolean)),W=e.computed(()=>e.unref(u).filter(t=>t.filters&&!t.onFilter).map(t=>t.dataIndex).filter(Boolean)),H=e.computed(()=>i.isUndefined(r.dataSource)?w.value.records:r.dataSource),{rowSelection:g,selectedRows:y,...h}=ie.default({...r.rowSelection===!0?{}:r.rowSelection,rowKey:r.rowKey,dataSource:H}),{formRef:v,submit:z,reset:P,tableProps:N,refresh:M,data:w,setDataSource:G}=se.useTablePaging({async request(t){var n,o;if(!g.value.preserveSelectedRowKeys&&i.isUndefined(r.dataSource)&&h.clearAll(),!i.isUndefined(r.dataSource))return{data:r.dataSource||[],total:r.dataSource.length||0};const a=await((n=r.request)==null?void 0:n.call(r,t));return(o=r.onLoad)==null||o.call(r,(a==null?void 0:a.data)||[]),{data:(a==null?void 0:a.data)||[],total:(a==null?void 0:a.total)||0}},filterFields:W,sortFields:$,defaultParams:r.params,defaultData:r.defaultData,manual:r.manual,defaultCurrent:r.pagination?r.pagination.defaultCurrent:void 0,defaultPageSize:r.pagination?r.pagination.defaultPageSize:void 0,formatParams:r.beforeSearchSubmit,showLessItems:r.pagination?r.pagination.showLessItems:void 0,showTotal:r.pagination?r.pagination.showTotal:void 0}),J=e.computed(()=>{var a,n;if(r.adaptive&&(w.value.total>0||((a=r.dataSource)==null?void 0:a.length)))return{y:e.unref(A),x:((n=r.scroll)==null?void 0:n.x)||"100%"};if(r.scroll)return r.scroll}),Q=e.computed(()=>{var t;if(r.tableLayout)return r.tableLayout;if((t=r.columns)!=null&&t.some(a=>a.ellipsis))return"fixed"}),q=e.computed(()=>{var n;const t=e.unref(N),a=e.unref(g);return{...r,...t,rowSelection:r.rowSelection===!0||((n=r.rowSelection)==null?void 0:n.mode)==="internal"?{...a,preserveSelectedRowKeys:i.isUndefined(r.dataSource)?a.preserveSelectedRowKeys:!0}:r.rowSelection,loading:i.isUndefined(r.loading)?t.loading:r.loading,pagination:r.pagination===!1?!1:t.pagination,scroll:e.unref(J)}}),X=e.computed(()=>[c(),r.card?null:c("wrapper"),r.adaptive?c("adaptive"):null].filter(Boolean));function Y(t,a,n){if(O.noRenderAsFormItemValueList.includes(t.valueType))return n;const o=s.objectToString(a);return t.copyable||t.ellipsis?e.createVNode(S.Typography.Paragraph,{copyable:t.copyable?{text:o,tooltip:!1}:!1,ellipsis:t.ellipsis?i.isBoolean(t.ellipsis)?{tooltip:o}:{...t.ellipsis,tooltip:o}:!1,content:t.ellipsis?de.getRawDisplayValue(t,a):n},null):n}e.watch(()=>e.unref(w).loading,t=>{var a;(a=r.onLoadingChange)==null||a.call(r,t)}),e.watch(()=>r.dataSource,t=>{G(t)},{immediate:!0});function Z(t){var a,n,o;(o=(n=(a=v.value)==null?void 0:a.apForm)==null?void 0:n.setFieldsValue)==null||o.call(n,t)}function ee(){var t,a,n;return(n=(a=(t=v.value)==null?void 0:t.apForm)==null?void 0:a.getFieldsValue)==null?void 0:n.call(a,!0)}function te(){return e.unref(u)}return D({submit:()=>z(),reset:()=>P(),refresh:()=>M(),setSearchFormValues:Z,getSearchFormValues:ee,getShownColumns:te,dataSource:e.computed(()=>e.unref(w).records),rowSelection:{selectedRows:e.computed(()=>e.unref(y)),...h}}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(X.value)},[e.unref(i.isUndefined)(t.dataSource)&&t.searchForm!==!1&&k.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.card?e.unref(b)("search-wrapper"):null),style:e.normalizeStyle(t.searchFormWrapperStyle)},[e.createVNode(e.unref(le.ApForm).SearchForm,e.mergeProps(t.searchForm||{},{ref_key:"formRef",ref:v,"custom-reset":"",onSubmit:e.unref(z),onReset:e.unref(P),"submit-loading":e.unref(N).loading}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),e.mergeProps({key:n.dataIndex,ref_for:!0},n.fieldProps||{},{span:n.span}),null,16,["span"]))),128))]),_:2},[m.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["onSubmit","onReset","submit-loading"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"contentRef",ref:U,class:e.normalizeClass([e.unref(b)("table-wrapper"),t.card?e.unref(b)("table-wrapper-card"):null]),style:e.normalizeStyle(t.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(c)("header-wrapper"))},[t.settings?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(c)("header"))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(T)("header","title"))},[e.renderSlot(t.$slots,"title",e.mergeProps({selectedRows:e.unref(y),selectedRowKeys:e.unref(g).selectedRowKeys,shownColumns:u.value},h))],2),m.title?(e.openBlock(),e.createBlock(e.unref(S.Divider),{key:0,type:"vertical"})):e.createCommentVNode("",!0),e.createVNode(ye.default,{config:t.settings===!0?{}:t.settings},{trigger:e.withCtx(()=>[e.createVNode(e.unref(S.Button),{class:e.normalizeClass(e.unref(c)("setting-trigger-button")),icon:e.h(e.unref(fe.SettingOutlined))},null,8,["class","icon"])]),_:1},8,["config"])],2)):e.renderSlot(t.$slots,"title",e.mergeProps({key:1,selectedRows:e.unref(y),selectedRowKeys:e.unref(g).selectedRowKeys,shownColumns:u.value},h))],2),e.createVNode(e.unref(S.Table),e.mergeProps({class:e.unref(c)("table")},q.value,{size:C.value,"table-layout":Q.value,columns:u.value,onResizeColumn:a[0]||(a[0]=(n,o)=>o.width=n)}),e.createSlots({summary:e.withCtx(()=>[e.renderSlot(t.$slots,"summary",{columns:u.value,records:q.value.dataSource,selectedRows:e.unref(y)})]),_:2},[e.renderList(e.unref(i.omit)(m,["title","searchFormExtra","headerCell","summary"]),(n,o)=>({name:o,fn:e.withCtx(d=>[e.renderSlot(t.$slots,o,e.normalizeProps(e.guardReactiveProps(d||{})))])}))]),1040,["class","size","table-layout","columns"])],6)],2))}});exports.default=he;
|