@aplus-frontend/ui 6.13.1 → 6.13.3
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-grid/index.vue.mjs +137 -134
- package/es/src/ap-grid/interface.d.ts +6 -0
- package/es/src/ap-table/ap-table.vue.d.ts +1 -0
- package/es/src/ap-table/ap-table.vue2.mjs +189 -186
- package/es/src/ap-table/context.d.ts +1 -0
- package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +1 -0
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +78 -75
- package/es/src/business/ap-table-modal/index.d.ts +1 -0
- package/es/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +68 -68
- package/es/src/business/ap-view/interface.d.ts +1 -1
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-grid/interface.d.ts +6 -0
- package/lib/src/ap-table/ap-table.vue.d.ts +1 -0
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/context.d.ts +1 -0
- package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +1 -0
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/business/ap-table-modal/index.d.ts +1 -0
- package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/interface.d.ts +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useTableSortedAndFiltered as
|
|
1
|
+
import { ref as fe, reactive as Q, unref as m, nextTick as ge, onMounted as de, watch as pe, computed as y, createVNode as x } from "vue";
|
|
2
|
+
import { useTableSortedAndFiltered as me } from "./use-sorted-filtered.mjs";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
|
-
import { parseFieldValue as
|
|
5
|
-
import { isArray as
|
|
4
|
+
import { parseFieldValue as he, dataIndexToStr as Se, isEqualCustom as ze } from "../utils.mjs";
|
|
5
|
+
import { isArray as W, isEqualWith as Pe, isUndefined as Te } from "lodash-unified";
|
|
6
6
|
import { isDef as $ } from "../../utils/index.mjs";
|
|
7
|
-
import { useLocale as
|
|
8
|
-
import { useNamespace as
|
|
9
|
-
const
|
|
10
|
-
defaultCurrent:
|
|
7
|
+
import { useLocale as we } from "../../config-provider/hooks/use-locale.mjs";
|
|
8
|
+
import { useNamespace as be } from "../../config-provider/hooks/use-namespace.mjs";
|
|
9
|
+
const h = 1, I = 20, G = {
|
|
10
|
+
defaultCurrent: h,
|
|
11
11
|
defaultPageSize: I,
|
|
12
12
|
showLessItems: !1,
|
|
13
13
|
showTotal: !0
|
|
@@ -18,11 +18,11 @@ function Fe(c) {
|
|
|
18
18
|
...c
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function xe(c) {
|
|
22
22
|
const f = {};
|
|
23
|
-
return c === !1 || (c === !0 || c == null ? (f.current =
|
|
23
|
+
return c === !1 || (c === !0 || c == null ? (f.current = h, f.pageSize = I) : (f.current = c.defaultCurrent || h, f.pageSize = c.defaultPageSize || I)), f;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const Ve = ({
|
|
26
26
|
manual: c = !1,
|
|
27
27
|
request: f,
|
|
28
28
|
params: V = {},
|
|
@@ -30,25 +30,25 @@ const Ie = ({
|
|
|
30
30
|
formatParams: U,
|
|
31
31
|
paramsValueTypeMap: _,
|
|
32
32
|
resetFieldsIgnores: A,
|
|
33
|
-
filterFields:
|
|
34
|
-
sortFields:
|
|
35
|
-
namespace:
|
|
36
|
-
pagination:
|
|
37
|
-
onClickReset:
|
|
33
|
+
filterFields: Z,
|
|
34
|
+
sortFields: H,
|
|
35
|
+
namespace: X = "ap-table",
|
|
36
|
+
pagination: S,
|
|
37
|
+
onClickReset: C,
|
|
38
38
|
onAfterRequest: E
|
|
39
39
|
}) => {
|
|
40
40
|
let v = 0, s = {};
|
|
41
|
-
const
|
|
42
|
-
getColumnSFConfig:
|
|
43
|
-
setSF:
|
|
44
|
-
clearAll:
|
|
41
|
+
const Y = Fe(S), q = (e) => U ? U(e) : e, z = fe(), i = Q(xe(S)), {
|
|
42
|
+
getColumnSFConfig: R,
|
|
43
|
+
setSF: k,
|
|
44
|
+
clearAll: ee,
|
|
45
45
|
sortedInfo: N,
|
|
46
46
|
filteredInfo: B
|
|
47
|
-
} =
|
|
47
|
+
} = me(), {
|
|
48
48
|
t: P
|
|
49
|
-
} =
|
|
49
|
+
} = we(), {
|
|
50
50
|
b: T
|
|
51
|
-
} =
|
|
51
|
+
} = be(X), o = Q({
|
|
52
52
|
total: j.length,
|
|
53
53
|
records: j,
|
|
54
54
|
loading: !1
|
|
@@ -57,7 +57,7 @@ const Ie = ({
|
|
|
57
57
|
return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
58
58
|
}, J = async (e) => {
|
|
59
59
|
var r;
|
|
60
|
-
const t =
|
|
60
|
+
const t = q(e), n = Date.now();
|
|
61
61
|
v = n, o.loading = !0;
|
|
62
62
|
try {
|
|
63
63
|
const a = await f({
|
|
@@ -75,61 +75,63 @@ const Ie = ({
|
|
|
75
75
|
return Object.entries(e).forEach(([n, r]) => {
|
|
76
76
|
if (t[n] = r, _ && r) {
|
|
77
77
|
const a = _[n];
|
|
78
|
-
a && (t[n] =
|
|
78
|
+
a && (t[n] = he(a, r));
|
|
79
79
|
}
|
|
80
80
|
}), t;
|
|
81
|
-
},
|
|
81
|
+
}, te = async (e) => {
|
|
82
82
|
var r, a, l, g, d;
|
|
83
83
|
const t = w(), n = {};
|
|
84
|
-
Object.entries(t).forEach(([p,
|
|
85
|
-
A && A.indexOf(p) > -1 && (n[p] =
|
|
86
|
-
}), await ((a = (r = z.value) == null ? void 0 : r.apForm) == null ? void 0 : a.resetFields()), (d = (g = (l = z.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || d.call(g, n),
|
|
84
|
+
Object.entries(t).forEach(([p, F]) => {
|
|
85
|
+
A && A.indexOf(p) > -1 && (n[p] = F);
|
|
86
|
+
}), await ((a = (r = z.value) == null ? void 0 : r.apForm) == null ? void 0 : a.resetFields()), (d = (g = (l = z.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || d.call(g, n), ge(() => {
|
|
87
87
|
e == null || e();
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, b = (e) => {
|
|
90
90
|
s = e;
|
|
91
91
|
const t = K(e);
|
|
92
92
|
J(t);
|
|
93
|
-
},
|
|
94
|
-
|
|
93
|
+
}, ne = (e) => {
|
|
94
|
+
b({
|
|
95
95
|
...s,
|
|
96
96
|
...e
|
|
97
97
|
});
|
|
98
98
|
}, D = () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
M(!0);
|
|
100
|
+
}, M = (e = !1) => {
|
|
101
|
+
const t = w(), n = S !== !1;
|
|
102
|
+
n && e && (i.current = h), b({
|
|
103
|
+
...t,
|
|
102
104
|
filter: s.filter,
|
|
103
105
|
sort: s.sort,
|
|
104
|
-
current:
|
|
105
|
-
pageSize:
|
|
106
|
+
current: n ? e ? h : s.current || i.current : void 0,
|
|
107
|
+
pageSize: n ? s.pageSize || i.pageSize : void 0
|
|
106
108
|
});
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
+
}, re = () => {
|
|
110
|
+
ee(), s.sort = {}, s.filter = {}, C == null || C(), te(D);
|
|
109
111
|
}, O = () => {
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
if (
|
|
112
|
+
b(s);
|
|
113
|
+
}, ae = (e) => {
|
|
114
|
+
if (S === !1)
|
|
113
115
|
O();
|
|
114
116
|
else {
|
|
115
117
|
const {
|
|
116
118
|
current: t,
|
|
117
119
|
pageSize: n
|
|
118
120
|
} = i, r = o.total - e, a = Math.ceil(r / n), l = t > a ? a : t;
|
|
119
|
-
|
|
121
|
+
ne({
|
|
120
122
|
current: l > 0 ? l : 1
|
|
121
123
|
});
|
|
122
124
|
}
|
|
123
125
|
}, L = (e, t, n) => {
|
|
124
|
-
var p,
|
|
126
|
+
var p, F;
|
|
125
127
|
const r = w();
|
|
126
|
-
i.current = e.current, i.pageSize = e.pageSize,
|
|
127
|
-
const a =
|
|
128
|
+
i.current = e.current, i.pageSize = e.pageSize, k(t, n);
|
|
129
|
+
const a = W(n) ? [...n] : [n], l = {};
|
|
128
130
|
for (const u of a)
|
|
129
|
-
(p = m(
|
|
131
|
+
(p = m(H)) != null && p.includes(u.columnKey || u.field) && u.order && (l[Se(u.columnKey || u.field)] = u.order);
|
|
130
132
|
const g = {};
|
|
131
133
|
for (const u of Object.keys(t))
|
|
132
|
-
(
|
|
134
|
+
(F = m(Z)) != null && F.includes(u) && t[u] && (g[u] = t[u]);
|
|
133
135
|
const d = {
|
|
134
136
|
...r,
|
|
135
137
|
filter: g,
|
|
@@ -137,8 +139,8 @@ const Ie = ({
|
|
|
137
139
|
current: e.current,
|
|
138
140
|
pageSize: e.pageSize
|
|
139
141
|
};
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
+
Pe(s, d, ze) || b(d);
|
|
143
|
+
}, oe = (e, t = B.value || {}, n = N.value || {}) => {
|
|
142
144
|
const r = (e == null ? void 0 : e.current) ?? i.current, a = (e == null ? void 0 : e.pageSize) ?? i.pageSize;
|
|
143
145
|
L(
|
|
144
146
|
{
|
|
@@ -154,7 +156,7 @@ const Ie = ({
|
|
|
154
156
|
}
|
|
155
157
|
);
|
|
156
158
|
};
|
|
157
|
-
|
|
159
|
+
de(() => {
|
|
158
160
|
const e = w(), {
|
|
159
161
|
current: t,
|
|
160
162
|
pageSize: n
|
|
@@ -169,12 +171,12 @@ const Ie = ({
|
|
|
169
171
|
const r = K(s);
|
|
170
172
|
J(r);
|
|
171
173
|
}
|
|
172
|
-
}),
|
|
174
|
+
}), pe(() => m(V), () => {
|
|
173
175
|
D();
|
|
174
176
|
}, {
|
|
175
177
|
deep: !0
|
|
176
178
|
});
|
|
177
|
-
const
|
|
179
|
+
const se = y(() => {
|
|
178
180
|
if (o.total === 0)
|
|
179
181
|
return "-";
|
|
180
182
|
const {
|
|
@@ -183,17 +185,17 @@ const Ie = ({
|
|
|
183
185
|
} = i;
|
|
184
186
|
return `${e}/${Math.ceil(o.total / t)}`;
|
|
185
187
|
});
|
|
186
|
-
function
|
|
187
|
-
|
|
188
|
+
function ie(e) {
|
|
189
|
+
W(e) && (o.records = e, o.total = e.length);
|
|
188
190
|
}
|
|
189
|
-
const
|
|
191
|
+
const ce = y(() => {
|
|
190
192
|
const {
|
|
191
193
|
showLessItems: e,
|
|
192
194
|
showTotal: t,
|
|
193
195
|
showQuickJumper: n,
|
|
194
196
|
showSizeChanger: r,
|
|
195
197
|
pageSizeOptions: a
|
|
196
|
-
} =
|
|
198
|
+
} = Y;
|
|
197
199
|
return {
|
|
198
200
|
loading: o.loading,
|
|
199
201
|
pagination: {
|
|
@@ -204,25 +206,25 @@ const Ie = ({
|
|
|
204
206
|
showQuickJumper: $(n) ? n : !e,
|
|
205
207
|
showLessItems: e,
|
|
206
208
|
size: "default",
|
|
207
|
-
pageSizeOptions:
|
|
208
|
-
showTotal: t ? (l) =>
|
|
209
|
+
pageSizeOptions: Te(a) ? ["10", "20", "50", "100"] : a,
|
|
210
|
+
showTotal: t ? (l) => x("span", {
|
|
209
211
|
class: T("pagination-total-wrapper")
|
|
210
|
-
}, [P("ap.apTable.pagination.totalLeftPrefix"), " ",
|
|
212
|
+
}, [P("ap.apTable.pagination.totalLeftPrefix"), " ", x("span", {
|
|
211
213
|
class: T("pagination-count-text")
|
|
212
|
-
}, [l]), " ", P("ap.apTable.pagination.totalLeftSuffix"),
|
|
214
|
+
}, [l]), " ", P("ap.apTable.pagination.totalLeftSuffix"), x("span", {
|
|
213
215
|
class: T("pagination--total-right")
|
|
214
|
-
}, [P("ap.apTable.pagination.totalRightPrefix"), " ",
|
|
216
|
+
}, [P("ap.apTable.pagination.totalRightPrefix"), " ", x("span", {
|
|
215
217
|
class: T("pagination-count-text")
|
|
216
|
-
}, [m(
|
|
218
|
+
}, [m(se)]), " ", P("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
217
219
|
},
|
|
218
220
|
onChange: L,
|
|
219
221
|
dataSource: o.records
|
|
220
222
|
};
|
|
221
223
|
});
|
|
222
|
-
function
|
|
224
|
+
function ue(e, t = !0) {
|
|
223
225
|
Object.assign(i, e), s.current = e.current, s.pageSize = e.pageSize, t && O();
|
|
224
226
|
}
|
|
225
|
-
function
|
|
227
|
+
function le() {
|
|
226
228
|
return {
|
|
227
229
|
...i
|
|
228
230
|
};
|
|
@@ -230,24 +232,25 @@ const Ie = ({
|
|
|
230
232
|
return {
|
|
231
233
|
formRef: z,
|
|
232
234
|
submit: D,
|
|
233
|
-
reset:
|
|
235
|
+
reset: re,
|
|
234
236
|
refresh: O,
|
|
235
|
-
refreshByDelete:
|
|
237
|
+
refreshByDelete: ae,
|
|
236
238
|
data: o,
|
|
237
239
|
handleTableChange: L,
|
|
238
|
-
handleTableChangeOptional:
|
|
239
|
-
tableProps:
|
|
240
|
+
handleTableChangeOptional: oe,
|
|
241
|
+
tableProps: ce,
|
|
240
242
|
dataSource: y(() => o.records),
|
|
241
|
-
setDataSource:
|
|
242
|
-
getColumnSFConfig:
|
|
243
|
+
setDataSource: ie,
|
|
244
|
+
getColumnSFConfig: R,
|
|
243
245
|
sortedInfo: N,
|
|
244
246
|
filteredInfo: B,
|
|
245
|
-
getPaging:
|
|
246
|
-
setPaging:
|
|
247
|
+
getPaging: le,
|
|
248
|
+
setPaging: ue,
|
|
249
|
+
submitWith: M
|
|
247
250
|
};
|
|
248
251
|
};
|
|
249
252
|
export {
|
|
250
|
-
|
|
253
|
+
h as DEFAULT_CURRENT,
|
|
251
254
|
I as DEFAULT_PAGE_SIZE,
|
|
252
|
-
|
|
255
|
+
Ve as useTablePaging
|
|
253
256
|
};
|
|
@@ -78,6 +78,7 @@ declare const ApTableModal: {
|
|
|
78
78
|
submit: () => void;
|
|
79
79
|
reset: () => void;
|
|
80
80
|
refresh: () => void;
|
|
81
|
+
submitWith: () => void;
|
|
81
82
|
setSearchFormValues: (fields: any) => void;
|
|
82
83
|
getSearchFormValues: (transform?: boolean) => Partial<any> | undefined;
|
|
83
84
|
setPaging: (nextPaging: Partial<{
|
|
@@ -67,6 +67,7 @@ declare const _default: DefineComponent<__VLS_Props, {
|
|
|
67
67
|
submit: () => void;
|
|
68
68
|
reset: () => void;
|
|
69
69
|
refresh: () => void;
|
|
70
|
+
submitWith: () => void;
|
|
70
71
|
setSearchFormValues: (fields: any) => void;
|
|
71
72
|
getSearchFormValues: (transform?: boolean) => Partial<any> | undefined;
|
|
72
73
|
setPaging: (nextPaging: Partial<{
|
|
@@ -7,12 +7,12 @@ import "./components/menu-list-content.vue.mjs";
|
|
|
7
7
|
import { useViewProvide as le } from "./hooks/use-view-provide.mjs";
|
|
8
8
|
import { useInjectApTable as se } from "../../ap-table/context.mjs";
|
|
9
9
|
import { SYSTEM_VIEW_KEY as V } from "./utils/enum.mjs";
|
|
10
|
-
import { isValid as
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import { useNamespace as
|
|
13
|
-
import { useLocale as
|
|
10
|
+
import { isValid as me } from "@aplus-frontend/utils";
|
|
11
|
+
import { useGlobalConfig as ne } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import { useNamespace as oe } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
import { useLocale as re } from "../../config-provider/hooks/use-locale.mjs";
|
|
14
14
|
import fe from "./components/main-button-content.vue2.mjs";
|
|
15
|
-
import
|
|
15
|
+
import ue from "./components/menu-list-content.vue2.mjs";
|
|
16
16
|
const Ie = /* @__PURE__ */ Z({
|
|
17
17
|
name: "ApView",
|
|
18
18
|
__name: "ap-view",
|
|
@@ -39,63 +39,63 @@ const Ie = /* @__PURE__ */ Z({
|
|
|
39
39
|
setup(k, {
|
|
40
40
|
expose: A
|
|
41
41
|
}) {
|
|
42
|
-
const
|
|
42
|
+
const r = k, L = ne("viewCacheOption"), {
|
|
43
43
|
b: g
|
|
44
|
-
} =
|
|
44
|
+
} = oe("ap-view"), {
|
|
45
45
|
t: P
|
|
46
|
-
} =
|
|
46
|
+
} = re(), v = E(() => ({
|
|
47
47
|
viewKey: V,
|
|
48
48
|
viewName: P("ap.apView.systemView")
|
|
49
49
|
})), {
|
|
50
50
|
getSearchFormValues: T,
|
|
51
|
-
setSearchFormValues:
|
|
52
|
-
submit:
|
|
53
|
-
reset:
|
|
54
|
-
|
|
55
|
-
getSearchFormSorterItems:
|
|
56
|
-
setSearchFormSorterItems:
|
|
57
|
-
resetSearchFormSorterItems:
|
|
51
|
+
setSearchFormValues: W,
|
|
52
|
+
submit: j,
|
|
53
|
+
reset: G,
|
|
54
|
+
submitWith: $,
|
|
55
|
+
getSearchFormSorterItems: Y,
|
|
56
|
+
setSearchFormSorterItems: z,
|
|
57
|
+
resetSearchFormSorterItems: M
|
|
58
58
|
} = se(), q = K(!1), F = K(!1), d = K("");
|
|
59
59
|
let c = !1, _ = !1;
|
|
60
60
|
const H = {
|
|
61
61
|
dropdownType: "dropdown",
|
|
62
62
|
content: N(fe, {
|
|
63
|
-
maxViewNum:
|
|
63
|
+
maxViewNum: r.maxViewNum
|
|
64
64
|
}, null)
|
|
65
|
-
},
|
|
65
|
+
}, m = K([v.value]), J = E(() => m.value.map((t) => ({
|
|
66
66
|
id: t.viewKey,
|
|
67
|
-
content: N(
|
|
67
|
+
content: N(ue, {
|
|
68
68
|
view: t
|
|
69
69
|
}, null)
|
|
70
70
|
}))), e = {
|
|
71
71
|
getSearchFormValues: T,
|
|
72
|
-
setSearchFormValues:
|
|
73
|
-
submit:
|
|
74
|
-
reset:
|
|
75
|
-
|
|
76
|
-
getSearchFormSorterItems:
|
|
77
|
-
setSearchFormSorterItems:
|
|
78
|
-
resetSearchFormSorterItems:
|
|
79
|
-
...
|
|
72
|
+
setSearchFormValues: W,
|
|
73
|
+
submit: j,
|
|
74
|
+
reset: G,
|
|
75
|
+
submitWith: $,
|
|
76
|
+
getSearchFormSorterItems: Y,
|
|
77
|
+
setSearchFormSorterItems: z,
|
|
78
|
+
resetSearchFormSorterItems: M,
|
|
79
|
+
...r.saveDataSource
|
|
80
80
|
}, l = {
|
|
81
81
|
...L.value,
|
|
82
|
-
...
|
|
82
|
+
...r.viewCacheOption
|
|
83
83
|
}, h = () => {
|
|
84
|
-
if (
|
|
84
|
+
if (r.isDefaultSystemView)
|
|
85
85
|
return V;
|
|
86
|
-
if ((
|
|
86
|
+
if ((r.isFirstDefaultSystemView || _) && c)
|
|
87
87
|
return V;
|
|
88
|
-
const t =
|
|
88
|
+
const t = m.value.find((i) => i.isDefault);
|
|
89
89
|
return (t == null ? void 0 : t.viewKey) ?? V;
|
|
90
90
|
}, p = (t) => {
|
|
91
91
|
d.value = t;
|
|
92
|
-
const i =
|
|
92
|
+
const i = m.value.find((s) => s.viewKey === d.value);
|
|
93
93
|
i && setTimeout(() => {
|
|
94
|
-
var s,
|
|
95
|
-
i.viewKey === V ? c ?
|
|
96
|
-
...Object.fromEntries(Object.keys(((
|
|
94
|
+
var s, n, o, u, f, a, y, I, x, B;
|
|
95
|
+
i.viewKey === V ? c ? r.manual || (s = e == null ? void 0 : e.submitWith) == null || s.call(e) : ((n = e == null ? void 0 : e.resetSearchFormSorterItems) == null || n.call(e), r.manual || (o = e == null ? void 0 : e.reset) == null || o.call(e)) : ((a = e == null ? void 0 : e.setSearchFormValues) == null || a.call(e, {
|
|
96
|
+
...Object.fromEntries(Object.keys(((u = e == null ? void 0 : e.getSearchFormValues) == null ? void 0 : u.call(e)) ?? {}).map((X) => [X, void 0])) ?? {},
|
|
97
97
|
...((f = i.viewConfig) == null ? void 0 : f.searchForm) ?? {}
|
|
98
|
-
}), (I = e == null ? void 0 : e.setSearchFormSorterItems) == null || I.call(e, ((y = i.viewConfig) == null ? void 0 : y.sorterItems) ?? []), c ?
|
|
98
|
+
}), (I = e == null ? void 0 : e.setSearchFormSorterItems) == null || I.call(e, ((y = i.viewConfig) == null ? void 0 : y.sorterItems) ?? []), c ? r.manual || (x = e == null ? void 0 : e.submitWith) == null || x.call(e) : (B = e == null ? void 0 : e.submit) == null || B.call(e)), c = !1;
|
|
99
99
|
});
|
|
100
100
|
}, w = {
|
|
101
101
|
getViewList: async (t) => {
|
|
@@ -103,12 +103,12 @@ const Ie = /* @__PURE__ */ Z({
|
|
|
103
103
|
try {
|
|
104
104
|
const {
|
|
105
105
|
tableKey: s
|
|
106
|
-
} = t,
|
|
106
|
+
} = t, n = await ((i = l == null ? void 0 : l.getViewList) == null ? void 0 : i.call(l, {
|
|
107
107
|
tableKey: s
|
|
108
108
|
}));
|
|
109
|
-
return
|
|
109
|
+
return m.value = [v.value, ...n ?? []], p(h()), m.value;
|
|
110
110
|
} catch {
|
|
111
|
-
return
|
|
111
|
+
return m.value = [v.value], p(V), m.value;
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
addView: async (t) => {
|
|
@@ -116,72 +116,72 @@ const Ie = /* @__PURE__ */ Z({
|
|
|
116
116
|
const {
|
|
117
117
|
tableKey: i,
|
|
118
118
|
viewKey: s,
|
|
119
|
-
viewName:
|
|
120
|
-
isDefault:
|
|
121
|
-
viewConfig:
|
|
119
|
+
viewName: n,
|
|
120
|
+
isDefault: o,
|
|
121
|
+
viewConfig: u
|
|
122
122
|
} = t;
|
|
123
123
|
await ((f = l == null ? void 0 : l.addView) == null ? void 0 : f.call(l, {
|
|
124
124
|
tableKey: i,
|
|
125
125
|
viewKey: s,
|
|
126
|
-
viewName:
|
|
127
|
-
isDefault:
|
|
128
|
-
viewConfig:
|
|
129
|
-
})),
|
|
130
|
-
...
|
|
126
|
+
viewName: n,
|
|
127
|
+
isDefault: o,
|
|
128
|
+
viewConfig: u
|
|
129
|
+
})), o && (m.value = m.value.map((a) => ({
|
|
130
|
+
...a,
|
|
131
131
|
isDefault: !1
|
|
132
|
-
}))),
|
|
132
|
+
}))), m.value = [...m.value, {
|
|
133
133
|
viewKey: s,
|
|
134
|
-
viewName:
|
|
135
|
-
isDefault:
|
|
136
|
-
viewConfig:
|
|
134
|
+
viewName: n,
|
|
135
|
+
isDefault: o,
|
|
136
|
+
viewConfig: u
|
|
137
137
|
}], p(s);
|
|
138
138
|
},
|
|
139
139
|
changeView: async (t) => {
|
|
140
|
-
var
|
|
140
|
+
var a;
|
|
141
141
|
const {
|
|
142
142
|
tableKey: i,
|
|
143
143
|
viewKey: s,
|
|
144
|
-
viewName:
|
|
145
|
-
isDefault:
|
|
146
|
-
viewConfig:
|
|
144
|
+
viewName: n,
|
|
145
|
+
isDefault: o,
|
|
146
|
+
viewConfig: u
|
|
147
147
|
} = t;
|
|
148
|
-
await ((
|
|
148
|
+
await ((a = l == null ? void 0 : l.changeView) == null ? void 0 : a.call(l, {
|
|
149
149
|
tableKey: i,
|
|
150
150
|
viewKey: s,
|
|
151
|
-
viewName:
|
|
152
|
-
isDefault:
|
|
153
|
-
viewConfig:
|
|
154
|
-
})),
|
|
151
|
+
viewName: n,
|
|
152
|
+
isDefault: o,
|
|
153
|
+
viewConfig: u
|
|
154
|
+
})), o && (m.value = m.value.map((y) => ({
|
|
155
155
|
...y,
|
|
156
156
|
isDefault: !1
|
|
157
157
|
})));
|
|
158
|
-
const f =
|
|
159
|
-
f && (f.viewName =
|
|
158
|
+
const f = m.value.find((y) => y.viewKey === s);
|
|
159
|
+
f && (f.viewName = n, f.isDefault = o, f.viewConfig = u), p(s);
|
|
160
160
|
},
|
|
161
161
|
removeView: async (t) => {
|
|
162
|
-
var
|
|
162
|
+
var n;
|
|
163
163
|
const {
|
|
164
164
|
tableKey: i,
|
|
165
165
|
viewKey: s
|
|
166
166
|
} = t;
|
|
167
|
-
await ((
|
|
167
|
+
await ((n = l == null ? void 0 : l.removeView) == null ? void 0 : n.call(l, {
|
|
168
168
|
tableKey: i,
|
|
169
169
|
viewKey: s
|
|
170
|
-
})),
|
|
170
|
+
})), m.value = m.value.filter((o) => o.viewKey !== s), s === d.value && p(h());
|
|
171
171
|
}
|
|
172
172
|
}, Q = {
|
|
173
|
-
tableKey:
|
|
173
|
+
tableKey: r.tableKey,
|
|
174
174
|
currentViewKey: d,
|
|
175
175
|
changeCurrentViewKey: p,
|
|
176
176
|
popoverOpen: q,
|
|
177
177
|
menuOpen: F,
|
|
178
|
-
viewList:
|
|
178
|
+
viewList: m,
|
|
179
179
|
viewListCRUD: w,
|
|
180
180
|
saveDataSource: e
|
|
181
181
|
};
|
|
182
|
-
return le(Q), U(() =>
|
|
182
|
+
return le(Q), U(() => r.tableKey, (t) => {
|
|
183
183
|
var i;
|
|
184
|
-
|
|
184
|
+
me(t) && (c = !0, (i = w == null ? void 0 : w.getViewList) == null || i.call(w, {
|
|
185
185
|
tableKey: t
|
|
186
186
|
}));
|
|
187
187
|
}, {
|
|
@@ -4,8 +4,8 @@ export interface SaveDataSource {
|
|
|
4
4
|
getSearchFormValues?: (transform?: boolean) => (Partial<Recordable> & Recordable<any>) | undefined;
|
|
5
5
|
setSearchFormValues?: (values: Partial<Recordable>) => void;
|
|
6
6
|
submit?: () => void;
|
|
7
|
+
submitWith?: () => void;
|
|
7
8
|
reset?: () => void;
|
|
8
|
-
refresh?: () => void;
|
|
9
9
|
getSearchFormSorterItems?: () => ApFormSearchFormPopoverSorterItem[];
|
|
10
10
|
setSearchFormSorterItems?: (sortedItems: ApFormSearchFormPopoverSorterItem[]) => void;
|
|
11
11
|
resetSearchFormSorterItems?: () => void;
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.13.
|
|
1
|
+
declare const _default: "6.13.3";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("vxe-table");require("vxe-table/es/style.css");const i=require("lodash-unified"),we=require("../ap-form/index.js");require("../config-provider/index.js");const be=require("../ap-table/constants.js"),p=require("../ap-table/utils.js"),Re=require("../ap-table/hooks/use-table-paging-ng.js"),b=require("@aplus-frontend/antdv"),xe=require("./hooks/use-inner-params.js"),F=require("./utils/table.js"),ke=require("./hooks/use-row-selection.js"),Be=require("../ap-table/context.js"),E=require("./constants.js"),Fe=require("./hooks/use-render-columns.js"),Ee=require("@aplus-frontend/antdv/es/theme/internal");require("../scroll-bar/index.js");const Ie=require("../utils/index.js"),Ne=require("../utils/slot.js"),Pe=require("./hooks/use-table-style.js"),Ve=require("../config-provider/hooks/use-namespace.js"),qe=require("../config-provider/hooks/use-global-config.js"),ze=require("../config-provider/hooks/use-locale.js"),Te=require("../scroll-bar/index.vue.js"),_e=e.defineComponent({name:"ApGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!1},prefixCls:{},tableLayout:{},title:{},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],default:!1},transformCellText:{},rowClassName:{},stripe:{type:Boolean},headerRowClassName:{},footerRowClassName:{},cellClassName:{},headerCellClassName:{},footerCellClassName:{},rowStyle:{},headerRowStyle:{},footerRowStyle:{},cellStyle:{},headerCellStyle:{},footerCellStyle:{},height:{},minHeight:{},maxHeight:{},mergeCells:{},mergeFooterItems:{},cellConfig:{},loading:{type:Boolean,default:void 0},loadingConfig:{},headerCellConfig:{},footerCellConfig:{},round:{type:Boolean,default:void 0},columns:{},rowSelection:{type:Boolean},card:{type:Boolean,default:!1},params:{},request:{},defaultData:{},dataSource:{},onLoadingChange:{},onShownColumnsChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},manual:{type:Boolean,default:void 0},size:{default:"mini"},adaptive:{type:Boolean,default:!1},columnResizable:{type:[Boolean,Object],default:!1},rowKey:{default:"key"},footer:{},virtual:{type:[Boolean,Object],default:void 0},expandable:{},value:{},rowHighlightable:{type:[Boolean,Function],default:!1},treeConfig:{}},setup(U,{expose:M}){var $;const g=e.useSlots(),o=U,y=($=e.getCurrentInstance())==null?void 0:$.appContext.app;y&&!y.__VXE_PC_UI_INSTALLED__&&(y.use(v.VxeUI),y.__VXE_PC_UI_INSTALLED__=!0);const{e:S,b:u,be:j}=Ve.useNamespace("ap-grid"),W=qe.useGlobalConfig("valueTypeMap"),s=e.ref([]),I=e.ref([]),l=e.ref(),w=e.ref(o.size),H=Pe.useTableStyle(),[,G]=Ee.useToken(),{t:X}=ze.useLocale();v.VxeUI.setConfig({i18n:(t,r)=>X(`ap.${t}`,r)});const{renderConfig:J,updateSignal:Q}=Fe.useRenderColumns(s);let N=0;const Y=e.computed(()=>{if(l.value)return l.value.$el.querySelector(".vxe-table--header-inner-wrapper")}),P=e.computed(()=>{var t,r,n;return N++,((n=(r=(t=o.columns)==null?void 0:t.filter(a=>!a.hideInSearch&&a.dataIndex&&(a.valueType||a.customRenderFormItem)&&!be.noRenderAsFormItemValueList.includes(a.valueType)))==null?void 0:r.sort((a,c)=>{let h=p.getColumnOrder(a.order);return p.getColumnOrder(c.order)-h}))==null?void 0:n.map(a=>{const c=p.updateFormProps(a,p.getFieldProps(a.fieldProps,{})),h={...a,fieldProps:{label:a.title,name:a.dataIndex,bordered:!0,...c||{},_signal:N},renderNode:void 0};return h.renderNode=p.getSearchFormItemRenderNode(h,e.unref(W)),h}))||[]}),Z=e.computed(()=>{var r;return Ie.isDef(o.manual)?o.manual:Ne.getValidVNodeList(((r=g.searchFormExtra)==null?void 0:r.call(g))||[]).some(n=>{var a;return((a=n.type)==null?void 0:a.name)==="ApView"})}),ee=e.computed(()=>[u(),o.card?null:u("wrapper"),o.adaptive?u("adaptive"):null,o.sticky?u("sticky"):null].filter(Boolean)),V=e.computed(()=>p.recursionApColumns(e.unref(s),t=>{if(t.sorter===!0)return t.key||t.dataIndex}).filter(Boolean)),q=e.computed(()=>p.recursionApColumns(e.unref(s),t=>{if(t.filters&&!t.onFilter)return t.key||t.dataIndex}).filter(Boolean)),{formRef:m,submit:R,reset:x,refresh:z,data:d,tableProps:T,setDataSource:te,handleTableChangeOptional:re,getPaging:oe,setPaging:ae}=Re.useTablePaging({async request(t){var n;if(!f.value.preserveSelectedRowKeys&&i.isUndefined(o.dataSource)&&B(),!i.isUndefined(o.dataSource)){const a=t.pageSize*(t.current-1);return{data:(o.pagination===!1?o.dataSource:o.dataSource.slice(a,a+t.pageSize))||[],total:o.dataSource.length||0}}const r=await((n=o.request)==null?void 0:n.call(o,t));return{data:(r==null?void 0:r.data)||[],total:(r==null?void 0:r.total)||0}},namespace:"ap-grid",filterFields:q,sortFields:V,params:e.toRef(o,"params"),defaultData:o.defaultData,manual:e.unref(Z),formatParams:o.beforeSearchSubmit,pagination:o.pagination,onClickReset:ye,onAfterRequest:O}),{sortChangeEvent:ne,filterChangeEvent:le,paginationChangeEvent:se}=xe.useInnerParams(re);Be.useProvideApTable({columns:e.computed(()=>s.value),columnsBackup:e.computed(()=>I.value),size:e.computed(()=>E.sizeMap[w.value]),updateColumns(t){var r;s.value=t,(r=o.onShownColumnsChange)==null||r.call(o,t)},updateSize(t){w.value=E.sizeReverseMap[t]},renderConfig:e.computed(()=>({className:j("table-header","title"),color:G.value.colorTextTertiary})),dataSource:e.computed(()=>e.unref(d).records),getSearchFormValues:A,setSearchFormValues:_,submit:R,reset:x,refresh:z,getSearchFormSorterItems:L,setSearchFormSorterItems:K,resetSearchFormSorterItems:D});const ue=e.computed(()=>s.value.some(t=>t.fixed==="left"||t.fixed===!0)?"left":void 0),ce=e.computed(()=>i.isUndefined(o.loading)?d.loading:o.loading),ie=e.computed(()=>i.isUndefined(o.dataSource)?d.records:o.dataSource),{selectedRows:k,rowSelection:f,...C}=ke.default({...o.rowSelection===!0?{}:o.rowSelection,dataSource:ie,rowKey:o.rowKey}),de=({checked:t,row:r})=>{const n=l.value;if(n&&n){const a=[...n.getCheckboxReserveRecords(),...n.getCheckboxRecords()];C.selectChange(r,t,a)}},fe=({checked:t})=>{const r=l.value;r&&C.selectAllChange(t,[...r.getCheckboxReserveRecords(),...r.getCheckboxRecords()])},pe=()=>{const t=l.value;t&&C.selectRangeChange(t.getCheckboxRecords(),[...t.getCheckboxReserveRecords(),...t.getCheckboxRecords()])},me=()=>{const t=l.value;t&&(k.value=[t.getRadioRecord()])},ge=({row:t})=>{const r=o.rowHighlightable;i.isFunction(r)&&r(t)};function Ce(){var t;return((t=o.columns)==null?void 0:t.filter(r=>!r.hideInTable))||[]}function _(t){var r,n,a;(a=(n=(r=m.value)==null?void 0:r.apForm)==null?void 0:n.setFieldsValue)==null||a.call(n,t)}function A(t=!1){var n,a,c;const r=t?"getFieldsValueTransformed":"getFieldsValue";return(c=(a=(n=m.value)==null?void 0:n.apForm)==null?void 0:a[r])==null?void 0:c.call(a,!0)}function L(){var t;return((t=m.value)==null?void 0:t.getSorterItems())||[]}function K(t){var r;(r=m.value)==null||r.setSorterItems(t)}function D(){var t;(t=m.value)==null||t.resetSorterItems()}function B(){C.clearAll();const t=l.value;t&&(f.value.type==="radio"?(t.clearRadioRow(),t.clearRadioReserve()):(t.clearCheckboxRow(),t.clearCheckboxReserve()))}function he(t){i.isFunction(o.rowKey)||(C.selectMultiByKeys(t),O())}function ve(t){const r=l.value;if(!r)return;const n=String(t[o.rowKey]),a=r.getRowById(n);r.setCurrentRow(a)}function ye(){const t=l.value;t&&(t.clearSort(),t.clearFilter())}function O(){e.nextTick(()=>{var t,r;f.value.type==="radio"?(t=l.value)==null||t.setRadioRowKey(f.value.selectedRowKeys[0]):(r=l.value)==null||r.setCheckboxRowKey(f.value.selectedRowKeys,!0)})}async function Se(t,r){var a;const n=d.records[t];if(n)return(a=l.value)==null?void 0:a.scrollToRow(n,r)}return e.watch(()=>[o.columnResizable,o.columns],()=>{var r;const t=Ce();s.value=t,(r=o.onShownColumnsChange)==null||r.call(o,t),I.value=t},{deep:!0,immediate:!0}),e.watch(()=>o.dataSource,t=>{te(t)},{immediate:!0,deep:!0}),e.watch(()=>e.unref(d).loading,t=>{var r;(r=o.onLoadingChange)==null||r.call(o,t)}),e.watch(()=>o.size,t=>{w.value=t}),M({submit:R,reset:x,refresh:z,setSearchFormValues:_,getSearchFormValues:A,getShowColumns:()=>e.unref(s),rowSelection:{selectedRows:e.computed(()=>k.value),setSelectedRowKeys:he,clearAll:B},scrollToRow:Se,getDataSource:()=>e.unref(d.records),setCurrentRow:ve,getPaging:oe,setPaging:ae,getSearchFormSorterItems:L,setSearchFormSorterItems:K,resetSearchFormSorterItems:D}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(ee.value),style:e.normalizeStyle(t.wrapperStyle)},[e.unref(i.isUndefined)(t.dataSource)&&t.searchForm!==!1&&P.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.card?e.unref(S)("search-wrapper"):null),style:e.normalizeStyle(t.searchFormWrapperStyle)},[e.createVNode(e.unref(we.ApForm).SearchForm,e.mergeProps(t.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"","submit-loading":e.unref(T).loading,onSubmit:e.unref(R),onReset:e.unref(x)}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),{key:n.dataIndex}))),128))]),_:2},[g.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["submit-loading","onSubmit","onReset"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(S)("table-wrapper"),t.card?e.unref(S)("table-wrapper-card"):null]),style:e.normalizeStyle(t.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("header-wrapper"))},[e.renderSlot(t.$slots,"title",{selectedRows:e.unref(k),selectedRowKeys:e.unref(f).selectedRowKeys,shownColumns:s.value,clearAll:B})],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("vxe-wrapper"))},[(e.openBlock(),e.createBlock(e.unref(v.VxeTable),e.mergeProps(e.unref(F.toVxeProps)(o),{ref_key:"tableRef",ref:l,key:e.unref(Q),data:e.unref(d).records,"sort-config":{remote:V.value.length>0,trigger:"cell"},"filter-config":{remote:q.value.length>0},loading:ce.value,style:e.unref(H),size:w.value,onSortChange:e.unref(ne),onFilterChange:e.unref(le),onCheckboxChange:de,onCheckboxRangeChange:pe,onCheckboxAll:fe,onRadioChange:me,onCurrentChange:ge}),e.createSlots({empty:e.withCtx(()=>[e.createVNode(e.unref(b.Empty),{image:e.unref(b.Empty).PRESENTED_IMAGE_SIMPLE},null,8,["image"])]),loading:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(S)("table-loading-wrapper"))},[e.createVNode(e.unref(b.Spin))],2)]),default:e.withCtx(()=>[o.expandable&&s.value.length?(e.openBlock(),e.createBlock(e.unref(v.VxeColumn),e.mergeProps({key:0},e.unref(F.getRowExpandProps)(t.expandable),{fixed:ue.value}),{content:e.withCtx(n=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.expandable.renderContent(n))))]),_:1},16,["fixed"])):e.createCommentVNode("",!0),o.rowSelection&&s.value.length?(e.openBlock(),e.createBlock(e.unref(v.VxeColumn),e.mergeProps({key:1},e.unref(F.getRowSelectionProps)(e.unref(f),s.value),{field:e.unref(E.ROW_SELECTION_FIELD)}),null,16,["field"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(J),n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n),{key:n.props.colId}))),128))]),_:2},[e.renderList(e.unref(i.omit)(g,["searchFormExtra"]),(n,a)=>({name:a,fn:e.withCtx(c=>[e.renderSlot(t.$slots,a,e.normalizeProps(e.guardReactiveProps(c||{})))])}))]),1040,["data","sort-config","filter-config","loading","style","size","onSortChange","onFilterChange"]))],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("pagination-wrapper"))},[t.sticky?(e.openBlock(),e.createBlock(e.unref(Te.default),{key:0,direction:"horizontal","scroll-container":Y.value,"extra-size":-4.2,"bar-color":"var(--ap-scrollbar-thumb-color-base)","track-color":"var(--ap-table-header-bg, #f2f6f9)"},null,8,["scroll-container"])):e.createCommentVNode("",!0),t.pagination!==!1?(e.openBlock(),e.createBlock(e.unref(b.Pagination),e.mergeProps({key:1,class:e.unref(u)("pagination")},e.unref(T).pagination,{onChange:e.unref(se)}),null,16,["class","onChange"])):e.createCommentVNode("",!0)],2)],6)],6))}});exports.default=_e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("vxe-table");require("vxe-table/es/style.css");const i=require("lodash-unified"),be=require("../ap-form/index.js");require("../config-provider/index.js");const Re=require("../ap-table/constants.js"),p=require("../ap-table/utils.js"),xe=require("../ap-table/hooks/use-table-paging-ng.js"),b=require("@aplus-frontend/antdv"),ke=require("./hooks/use-inner-params.js"),F=require("./utils/table.js"),Be=require("./hooks/use-row-selection.js"),Fe=require("../ap-table/context.js"),E=require("./constants.js"),Ee=require("./hooks/use-render-columns.js"),Ie=require("@aplus-frontend/antdv/es/theme/internal");require("../scroll-bar/index.js");const Ne=require("../utils/index.js"),Pe=require("../utils/slot.js"),Ve=require("./hooks/use-table-style.js"),qe=require("../config-provider/hooks/use-namespace.js"),ze=require("../config-provider/hooks/use-global-config.js"),Te=require("../config-provider/hooks/use-locale.js"),_e=require("../scroll-bar/index.vue.js"),Ae=e.defineComponent({name:"ApGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean,default:!1},locale:{},onChange:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!1},prefixCls:{},tableLayout:{},title:{},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],default:!1},transformCellText:{},rowClassName:{},stripe:{type:Boolean},headerRowClassName:{},footerRowClassName:{},cellClassName:{},headerCellClassName:{},footerCellClassName:{},rowStyle:{},headerRowStyle:{},footerRowStyle:{},cellStyle:{},headerCellStyle:{},footerCellStyle:{},height:{},minHeight:{},maxHeight:{},mergeCells:{},mergeFooterItems:{},cellConfig:{},loading:{type:Boolean,default:void 0},loadingConfig:{},headerCellConfig:{},footerCellConfig:{},round:{type:Boolean,default:void 0},columns:{},rowSelection:{type:Boolean},card:{type:Boolean,default:!1},params:{},request:{},defaultData:{},dataSource:{},onLoadingChange:{},onShownColumnsChange:{},searchForm:{type:[Boolean,Object],default:void 0},beforeSearchSubmit:{},pagination:{type:[Boolean,Object],default:void 0},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},manual:{type:Boolean,default:void 0},size:{default:"mini"},adaptive:{type:Boolean,default:!1},columnResizable:{type:[Boolean,Object],default:!1},rowKey:{default:"key"},footer:{},virtual:{type:[Boolean,Object],default:void 0},expandable:{},value:{},rowHighlightable:{type:[Boolean,Function],default:!1},treeConfig:{}},setup(M,{expose:W}){var U;const g=e.useSlots(),o=M,y=(U=e.getCurrentInstance())==null?void 0:U.appContext.app;y&&!y.__VXE_PC_UI_INSTALLED__&&(y.use(v.VxeUI),y.__VXE_PC_UI_INSTALLED__=!0);const{e:S,b:u,be:j}=qe.useNamespace("ap-grid"),H=ze.useGlobalConfig("valueTypeMap"),s=e.ref([]),I=e.ref([]),l=e.ref(),w=e.ref(o.size),G=Ve.useTableStyle(),[,X]=Ie.useToken(),{t:J}=Te.useLocale();v.VxeUI.setConfig({i18n:(t,r)=>J(`ap.${t}`,r)});const{renderConfig:Q,updateSignal:Y}=Ee.useRenderColumns(s);let N=0;const Z=e.computed(()=>{if(l.value)return l.value.$el.querySelector(".vxe-table--header-inner-wrapper")}),P=e.computed(()=>{var t,r,n;return N++,((n=(r=(t=o.columns)==null?void 0:t.filter(a=>!a.hideInSearch&&a.dataIndex&&(a.valueType||a.customRenderFormItem)&&!Re.noRenderAsFormItemValueList.includes(a.valueType)))==null?void 0:r.sort((a,c)=>{let h=p.getColumnOrder(a.order);return p.getColumnOrder(c.order)-h}))==null?void 0:n.map(a=>{const c=p.updateFormProps(a,p.getFieldProps(a.fieldProps,{})),h={...a,fieldProps:{label:a.title,name:a.dataIndex,bordered:!0,...c||{},_signal:N},renderNode:void 0};return h.renderNode=p.getSearchFormItemRenderNode(h,e.unref(H)),h}))||[]}),ee=e.computed(()=>{var r;return Ne.isDef(o.manual)?o.manual:Pe.getValidVNodeList(((r=g.searchFormExtra)==null?void 0:r.call(g))||[]).some(n=>{var a;return((a=n.type)==null?void 0:a.name)==="ApView"})}),te=e.computed(()=>[u(),o.card?null:u("wrapper"),o.adaptive?u("adaptive"):null,o.sticky?u("sticky"):null].filter(Boolean)),V=e.computed(()=>p.recursionApColumns(e.unref(s),t=>{if(t.sorter===!0)return t.key||t.dataIndex}).filter(Boolean)),q=e.computed(()=>p.recursionApColumns(e.unref(s),t=>{if(t.filters&&!t.onFilter)return t.key||t.dataIndex}).filter(Boolean)),{formRef:m,submit:R,reset:x,refresh:z,data:d,tableProps:T,setDataSource:re,handleTableChangeOptional:oe,getPaging:ae,setPaging:ne,submitWith:_}=xe.useTablePaging({async request(t){var n;if(!f.value.preserveSelectedRowKeys&&i.isUndefined(o.dataSource)&&B(),!i.isUndefined(o.dataSource)){const a=t.pageSize*(t.current-1);return{data:(o.pagination===!1?o.dataSource:o.dataSource.slice(a,a+t.pageSize))||[],total:o.dataSource.length||0}}const r=await((n=o.request)==null?void 0:n.call(o,t));return{data:(r==null?void 0:r.data)||[],total:(r==null?void 0:r.total)||0}},namespace:"ap-grid",filterFields:q,sortFields:V,params:e.toRef(o,"params"),defaultData:o.defaultData,manual:e.unref(ee),formatParams:o.beforeSearchSubmit,pagination:o.pagination,onClickReset:Se,onAfterRequest:$}),{sortChangeEvent:le,filterChangeEvent:se,paginationChangeEvent:ue}=ke.useInnerParams(oe);Fe.useProvideApTable({columns:e.computed(()=>s.value),columnsBackup:e.computed(()=>I.value),size:e.computed(()=>E.sizeMap[w.value]),updateColumns(t){var r;s.value=t,(r=o.onShownColumnsChange)==null||r.call(o,t)},updateSize(t){w.value=E.sizeReverseMap[t]},renderConfig:e.computed(()=>({className:j("table-header","title"),color:X.value.colorTextTertiary})),dataSource:e.computed(()=>e.unref(d).records),getSearchFormValues:L,setSearchFormValues:A,submit:R,submitWith:_,reset:x,refresh:z,getSearchFormSorterItems:K,setSearchFormSorterItems:D,resetSearchFormSorterItems:O});const ce=e.computed(()=>s.value.some(t=>t.fixed==="left"||t.fixed===!0)?"left":void 0),ie=e.computed(()=>i.isUndefined(o.loading)?d.loading:o.loading),de=e.computed(()=>i.isUndefined(o.dataSource)?d.records:o.dataSource),{selectedRows:k,rowSelection:f,...C}=Be.default({...o.rowSelection===!0?{}:o.rowSelection,dataSource:de,rowKey:o.rowKey}),fe=({checked:t,row:r})=>{const n=l.value;if(n&&n){const a=[...n.getCheckboxReserveRecords(),...n.getCheckboxRecords()];C.selectChange(r,t,a)}},pe=({checked:t})=>{const r=l.value;r&&C.selectAllChange(t,[...r.getCheckboxReserveRecords(),...r.getCheckboxRecords()])},me=()=>{const t=l.value;t&&C.selectRangeChange(t.getCheckboxRecords(),[...t.getCheckboxReserveRecords(),...t.getCheckboxRecords()])},ge=()=>{const t=l.value;t&&(k.value=[t.getRadioRecord()])},Ce=({row:t})=>{const r=o.rowHighlightable;i.isFunction(r)&&r(t)};function he(){var t;return((t=o.columns)==null?void 0:t.filter(r=>!r.hideInTable))||[]}function A(t){var r,n,a;(a=(n=(r=m.value)==null?void 0:r.apForm)==null?void 0:n.setFieldsValue)==null||a.call(n,t)}function L(t=!1){var n,a,c;const r=t?"getFieldsValueTransformed":"getFieldsValue";return(c=(a=(n=m.value)==null?void 0:n.apForm)==null?void 0:a[r])==null?void 0:c.call(a,!0)}function K(){var t;return((t=m.value)==null?void 0:t.getSorterItems())||[]}function D(t){var r;(r=m.value)==null||r.setSorterItems(t)}function O(){var t;(t=m.value)==null||t.resetSorterItems()}function B(){C.clearAll();const t=l.value;t&&(f.value.type==="radio"?(t.clearRadioRow(),t.clearRadioReserve()):(t.clearCheckboxRow(),t.clearCheckboxReserve()))}function ve(t){i.isFunction(o.rowKey)||(C.selectMultiByKeys(t),$())}function ye(t){const r=l.value;if(!r)return;const n=String(t[o.rowKey]),a=r.getRowById(n);r.setCurrentRow(a)}function Se(){const t=l.value;t&&(t.clearSort(),t.clearFilter())}function $(){e.nextTick(()=>{var t,r;f.value.type==="radio"?(t=l.value)==null||t.setRadioRowKey(f.value.selectedRowKeys[0]):(r=l.value)==null||r.setCheckboxRowKey(f.value.selectedRowKeys,!0)})}async function we(t,r){var a;const n=d.records[t];if(n)return(a=l.value)==null?void 0:a.scrollToRow(n,r)}return e.watch(()=>[o.columnResizable,o.columns],()=>{var r;const t=he();s.value=t,(r=o.onShownColumnsChange)==null||r.call(o,t),I.value=t},{deep:!0,immediate:!0}),e.watch(()=>o.dataSource,t=>{re(t)},{immediate:!0,deep:!0}),e.watch(()=>e.unref(d).loading,t=>{var r;(r=o.onLoadingChange)==null||r.call(o,t)}),e.watch(()=>o.size,t=>{w.value=t}),W({submit:R,reset:x,refresh:z,submitWith:_,setSearchFormValues:A,getSearchFormValues:L,getShowColumns:()=>e.unref(s),rowSelection:{selectedRows:e.computed(()=>k.value),setSelectedRowKeys:ve,clearAll:B},scrollToRow:we,getDataSource:()=>e.unref(d.records),setCurrentRow:ye,getPaging:ae,setPaging:ne,getSearchFormSorterItems:K,setSearchFormSorterItems:D,resetSearchFormSorterItems:O}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(te.value),style:e.normalizeStyle(t.wrapperStyle)},[e.unref(i.isUndefined)(t.dataSource)&&t.searchForm!==!1&&P.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.card?e.unref(S)("search-wrapper"):null),style:e.normalizeStyle(t.searchFormWrapperStyle)},[e.createVNode(e.unref(be.ApForm).SearchForm,e.mergeProps(t.searchForm||{},{ref_key:"formRef",ref:m,"custom-reset":"","submit-loading":e.unref(T).loading,onSubmit:e.unref(R),onReset:e.unref(x)}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderNode),{key:n.dataIndex}))),128))]),_:2},[g.searchFormExtra?{name:"extra",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"searchFormExtra")]),key:"0"}:void 0]),1040,["submit-loading","onSubmit","onReset"])],6)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(S)("table-wrapper"),t.card?e.unref(S)("table-wrapper-card"):null]),style:e.normalizeStyle(t.tableWrapperStyle)},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("header-wrapper"))},[e.renderSlot(t.$slots,"title",{selectedRows:e.unref(k),selectedRowKeys:e.unref(f).selectedRowKeys,shownColumns:s.value,clearAll:B})],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("vxe-wrapper"))},[(e.openBlock(),e.createBlock(e.unref(v.VxeTable),e.mergeProps(e.unref(F.toVxeProps)(o),{ref_key:"tableRef",ref:l,key:e.unref(Y),data:e.unref(d).records,"sort-config":{remote:V.value.length>0,trigger:"cell"},"filter-config":{remote:q.value.length>0},loading:ie.value,style:e.unref(G),size:w.value,onSortChange:e.unref(le),onFilterChange:e.unref(se),onCheckboxChange:fe,onCheckboxRangeChange:me,onCheckboxAll:pe,onRadioChange:ge,onCurrentChange:Ce}),e.createSlots({empty:e.withCtx(()=>[e.createVNode(e.unref(b.Empty),{image:e.unref(b.Empty).PRESENTED_IMAGE_SIMPLE},null,8,["image"])]),loading:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(S)("table-loading-wrapper"))},[e.createVNode(e.unref(b.Spin))],2)]),default:e.withCtx(()=>[o.expandable&&s.value.length?(e.openBlock(),e.createBlock(e.unref(v.VxeColumn),e.mergeProps({key:0},e.unref(F.getRowExpandProps)(t.expandable),{fixed:ce.value}),{content:e.withCtx(n=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.expandable.renderContent(n))))]),_:1},16,["fixed"])):e.createCommentVNode("",!0),o.rowSelection&&s.value.length?(e.openBlock(),e.createBlock(e.unref(v.VxeColumn),e.mergeProps({key:1},e.unref(F.getRowSelectionProps)(e.unref(f),s.value),{field:e.unref(E.ROW_SELECTION_FIELD)}),null,16,["field"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Q),n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n),{key:n.props.colId}))),128))]),_:2},[e.renderList(e.unref(i.omit)(g,["searchFormExtra"]),(n,a)=>({name:a,fn:e.withCtx(c=>[e.renderSlot(t.$slots,a,e.normalizeProps(e.guardReactiveProps(c||{})))])}))]),1040,["data","sort-config","filter-config","loading","style","size","onSortChange","onFilterChange"]))],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("pagination-wrapper"))},[t.sticky?(e.openBlock(),e.createBlock(e.unref(_e.default),{key:0,direction:"horizontal","scroll-container":Z.value,"extra-size":-4.2,"bar-color":"var(--ap-scrollbar-thumb-color-base)","track-color":"var(--ap-table-header-bg, #f2f6f9)"},null,8,["scroll-container"])):e.createCommentVNode("",!0),t.pagination!==!1?(e.openBlock(),e.createBlock(e.unref(b.Pagination),e.mergeProps({key:1,class:e.unref(u)("pagination")},e.unref(T).pagination,{onChange:e.unref(ue)}),null,16,["class","onChange"])):e.createCommentVNode("",!0)],2)],6)],6))}});exports.default=Ae;
|
|
@@ -284,6 +284,12 @@ export type ApGridExpose<SearchParamsType = Recordable, RecordType = any> = {
|
|
|
284
284
|
* @returns
|
|
285
285
|
*/
|
|
286
286
|
refresh: () => void;
|
|
287
|
+
/**
|
|
288
|
+
* 表格查询提交(重制页码但查询参数不会重置)
|
|
289
|
+
* @param resetCurrent 是否重置当前页码,默认为`false`
|
|
290
|
+
* @returns
|
|
291
|
+
*/
|
|
292
|
+
submitWith: (resetCurrent?: boolean) => void;
|
|
287
293
|
/**
|
|
288
294
|
* 设置查询表单数据
|
|
289
295
|
* @param values
|