@aplus-frontend/ui 0.4.33 → 0.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +121 -117
- package/es/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
- package/es/src/ap-button/ap-confirm-button.vue.mjs +56 -0
- package/es/src/ap-button/ap-confirm-button.vue2.mjs +4 -0
- package/es/src/ap-button/index.d.ts +2 -1
- package/es/src/ap-button/index.mjs +1 -0
- package/es/src/ap-button/interface.d.ts +6 -1
- package/es/src/ap-button/utils/index.d.ts +2 -0
- package/es/src/ap-button/utils/index.mjs +36 -16
- package/es/src/ap-grid/constants.d.ts +9 -0
- package/es/src/ap-grid/constants.mjs +12 -0
- package/es/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
- package/es/src/ap-grid/hooks/use-inner-params.mjs +41 -0
- package/es/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
- package/es/src/ap-grid/hooks/use-render-columns.mjs +29 -0
- package/es/src/ap-grid/index.d.ts +3 -0
- package/es/src/ap-grid/index.mjs +2 -0
- package/es/src/ap-grid/index.vue.mjs +399 -0
- package/es/src/ap-grid/index.vue2.mjs +4 -0
- package/es/src/ap-grid/interface.d.ts +279 -0
- package/es/src/ap-grid/interface.mjs +1 -0
- package/es/src/ap-grid/style/css.d.ts +0 -0
- package/es/src/ap-grid/style/css.js +1 -0
- package/es/src/ap-grid/style/index.d.ts +0 -0
- package/es/src/ap-grid/style/index.js +1 -0
- package/es/src/ap-grid/utils/col.d.ts +20 -0
- package/es/src/ap-grid/utils/col.mjs +106 -0
- package/es/src/ap-grid/utils/renderer.d.ts +3 -0
- package/es/src/ap-grid/utils/renderer.mjs +21 -0
- package/es/src/ap-grid/utils/table.d.ts +13 -0
- package/es/src/ap-grid/utils/table.mjs +64 -0
- package/es/src/ap-modal/utils/createModal.mjs +28 -28
- package/es/src/ap-table/ap-table.vue.d.ts +2 -0
- package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +38 -38
- package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +9 -9
- package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +21 -21
- package/es/src/ap-table/components/setting/utils.d.ts +15 -3
- package/es/src/ap-table/components/setting/utils.mjs +49 -38
- package/es/src/ap-table/context.d.ts +2 -1
- package/es/src/ap-table/context.mjs +8 -7
- package/es/src/ap-table/hooks/use-table-column-state.mjs +79 -70
- package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +43 -40
- package/es/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
- package/es/src/ap-table/hooks/use-table-row-selection.mjs +41 -27
- package/es/src/ap-table/interface.d.ts +4 -0
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/index.d.ts +8 -0
- package/es/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
- package/es/src/business/hooks/usePageListApTable.d.ts +2 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +242 -237
- package/es/src/path-map.mjs +2 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
- package/lib/src/ap-button/ap-confirm-button.vue.js +1 -0
- package/lib/src/ap-button/ap-confirm-button.vue2.js +1 -0
- package/lib/src/ap-button/index.d.ts +2 -1
- package/lib/src/ap-button/index.js +1 -1
- package/lib/src/ap-button/interface.d.ts +6 -1
- package/lib/src/ap-button/utils/index.d.ts +2 -0
- package/lib/src/ap-button/utils/index.js +1 -1
- package/lib/src/ap-grid/constants.d.ts +9 -0
- package/lib/src/ap-grid/constants.js +1 -0
- package/lib/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
- package/lib/src/ap-grid/hooks/use-inner-params.js +1 -0
- package/lib/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
- package/lib/src/ap-grid/hooks/use-render-columns.js +1 -0
- package/lib/src/ap-grid/index.d.ts +3 -0
- package/lib/src/ap-grid/index.js +1 -0
- package/lib/src/ap-grid/index.vue.js +1 -0
- package/lib/src/ap-grid/index.vue2.js +1 -0
- package/lib/src/ap-grid/interface.d.ts +279 -0
- package/lib/src/ap-grid/interface.js +1 -0
- package/lib/src/ap-grid/style/css.cjs +1 -0
- package/lib/src/ap-grid/style/css.d.ts +0 -0
- package/lib/src/ap-grid/style/index.cjs +1 -0
- package/lib/src/ap-grid/style/index.d.ts +0 -0
- package/lib/src/ap-grid/utils/col.d.ts +20 -0
- package/lib/src/ap-grid/utils/col.js +1 -0
- package/lib/src/ap-grid/utils/renderer.d.ts +3 -0
- package/lib/src/ap-grid/utils/renderer.js +1 -0
- package/lib/src/ap-grid/utils/table.d.ts +13 -0
- package/lib/src/ap-grid/utils/table.js +1 -0
- package/lib/src/ap-modal/utils/createModal.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
- package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/utils.d.ts +15 -3
- package/lib/src/ap-table/components/setting/utils.js +1 -1
- package/lib/src/ap-table/context.d.ts +2 -1
- package/lib/src/ap-table/context.js +1 -1
- package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
- package/lib/src/ap-table/hooks/use-table-row-selection.js +1 -1
- package/lib/src/ap-table/interface.d.ts +4 -0
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/index.d.ts +8 -0
- package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
- package/lib/src/business/hooks/usePageListApTable.d.ts +2 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/package.json +3 -1
- package/theme/antd-global-overwrite/admin/index.css +8 -1
- package/theme/antd-global-overwrite/admin/modal.css +8 -1
- package/theme/antd-global-overwrite/admin/modal.less +10 -1
- package/theme/antd-global-overwrite/aplus/index.css +8 -1
- package/theme/antd-global-overwrite/aplus/modal.css +8 -1
- package/theme/antd-global-overwrite/aplus/modal.less +10 -1
- package/theme/ap-grid/index.css +302 -0
- package/theme/ap-grid/index.less +65 -0
- package/theme/index.css +51 -0
- package/theme/index.less +1 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { defineComponent as ye, getCurrentInstance as Se, useSlots as we, ref as w, computed as l, unref as a, watchEffect as ve, watch as $, createElementBlock as v, openBlock as s, normalizeClass as b, createCommentVNode as R, createElementVNode as H, normalizeStyle as U, createVNode as be, mergeProps as c, createSlots as q, withCtx as f, Fragment as M, renderList as P, createBlock as u, resolveDynamicComponent as E, renderSlot as N, normalizeProps as Re, guardReactiveProps as xe } from "vue";
|
|
2
|
+
import { VxeTable as Fe, VxeColumn as G } from "vxe-table";
|
|
3
|
+
import ke from "vxe-pc-ui";
|
|
4
|
+
import "/Users/limoer/www/aplus/aplus-ui/node_modules/.pnpm/vxe-table@4.10.14_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-table/lib/style.css";
|
|
5
|
+
import "/Users/limoer/www/aplus/aplus-ui/node_modules/.pnpm/vxe-pc-ui@4.3.95_vue@3.5.13_typescript@5.7.3_/node_modules/vxe-pc-ui/lib/style.css";
|
|
6
|
+
import { isUndefined as x, omit as Be } from "lodash-unified";
|
|
7
|
+
import { ApForm as Ie } from "../ap-form/index.mjs";
|
|
8
|
+
import "../config-provider/index.mjs";
|
|
9
|
+
import { noRenderAsFormItemValueList as Pe } from "../ap-table/constants.mjs";
|
|
10
|
+
import { getColumnOrder as X, updateFormProps as Ee, getFieldProps as Ne, getSearchFormItemRenderNode as ze, recursionApColumns as J } from "../ap-table/utils.mjs";
|
|
11
|
+
import { useTablePaging as Te } from "../ap-table/hooks/use-table-paging-ng.mjs";
|
|
12
|
+
import { Pagination as Ve } from "@aplus-frontend/antdv";
|
|
13
|
+
import { useInnerParams as _e } from "./hooks/use-inner-params.mjs";
|
|
14
|
+
import { toVxeProps as Ae, getRowExpandProps as Oe, getRowSelectionProps as Le } from "./utils/table.mjs";
|
|
15
|
+
import De from "../ap-table/hooks/use-table-row-selection.mjs";
|
|
16
|
+
import { useProvideApTable as Ke } from "../ap-table/context.mjs";
|
|
17
|
+
import { sizeReverseMap as je, sizeMap as We } from "./constants.mjs";
|
|
18
|
+
import { useRenderColumns as $e } from "./hooks/use-render-columns.mjs";
|
|
19
|
+
import { useToken as He } from "@aplus-frontend/antdv/es/theme/internal";
|
|
20
|
+
import { useNamespace as Ue } from "../config-provider/hooks/use-namespace.mjs";
|
|
21
|
+
import { useGlobalConfig as qe } from "../config-provider/hooks/use-global-config.mjs";
|
|
22
|
+
const ga = /* @__PURE__ */ ye({
|
|
23
|
+
name: "ApGrid",
|
|
24
|
+
__name: "index",
|
|
25
|
+
props: {
|
|
26
|
+
dropdownPrefixCls: {},
|
|
27
|
+
loading: {
|
|
28
|
+
type: [Boolean, Object],
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
bordered: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
locale: {},
|
|
36
|
+
onChange: {},
|
|
37
|
+
onResizeColumn: {},
|
|
38
|
+
getPopupContainer: {},
|
|
39
|
+
scroll: {},
|
|
40
|
+
sortDirections: {
|
|
41
|
+
default: () => ["ascend", "descend"]
|
|
42
|
+
},
|
|
43
|
+
showSorterTooltip: {
|
|
44
|
+
type: [Boolean, Object],
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
prefixCls: {},
|
|
48
|
+
tableLayout: {},
|
|
49
|
+
title: {},
|
|
50
|
+
id: {},
|
|
51
|
+
showHeader: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !0
|
|
54
|
+
},
|
|
55
|
+
components: {},
|
|
56
|
+
customRow: {},
|
|
57
|
+
customHeaderRow: {},
|
|
58
|
+
direction: {},
|
|
59
|
+
expandFixed: {
|
|
60
|
+
type: [String, Boolean],
|
|
61
|
+
default: !1
|
|
62
|
+
},
|
|
63
|
+
expandColumnWidth: {},
|
|
64
|
+
expandedRowKeys: {},
|
|
65
|
+
defaultExpandedRowKeys: {},
|
|
66
|
+
expandedRowRender: {},
|
|
67
|
+
expandRowByClick: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !1
|
|
70
|
+
},
|
|
71
|
+
expandIcon: {},
|
|
72
|
+
onExpand: {},
|
|
73
|
+
onExpandedRowsChange: {},
|
|
74
|
+
defaultExpandAllRows: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: !1
|
|
77
|
+
},
|
|
78
|
+
indentSize: {
|
|
79
|
+
default: 15
|
|
80
|
+
},
|
|
81
|
+
expandIconColumnIndex: {},
|
|
82
|
+
showExpandColumn: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: !0
|
|
85
|
+
},
|
|
86
|
+
expandedRowClassName: {},
|
|
87
|
+
childrenColumnName: {
|
|
88
|
+
default: "children"
|
|
89
|
+
},
|
|
90
|
+
rowExpandable: {},
|
|
91
|
+
sticky: {
|
|
92
|
+
type: [Boolean, Object]
|
|
93
|
+
},
|
|
94
|
+
transformCellText: {},
|
|
95
|
+
rowClassName: {},
|
|
96
|
+
stripe: {
|
|
97
|
+
type: Boolean
|
|
98
|
+
},
|
|
99
|
+
headerRowClassName: {},
|
|
100
|
+
footerRowClassName: {},
|
|
101
|
+
cellClassName: {},
|
|
102
|
+
headerCellClassName: {},
|
|
103
|
+
footerCellClassName: {},
|
|
104
|
+
rowStyle: {},
|
|
105
|
+
headerRowStyle: {},
|
|
106
|
+
footerRowStyle: {},
|
|
107
|
+
cellStyle: {},
|
|
108
|
+
headerCellStyle: {},
|
|
109
|
+
footerCellStyle: {},
|
|
110
|
+
height: {},
|
|
111
|
+
minHeight: {},
|
|
112
|
+
maxHeight: {},
|
|
113
|
+
mergeCells: {},
|
|
114
|
+
mergeFooterItems: {},
|
|
115
|
+
cellConfig: {},
|
|
116
|
+
columns: {},
|
|
117
|
+
rowSelection: {
|
|
118
|
+
type: Boolean
|
|
119
|
+
},
|
|
120
|
+
card: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: !1
|
|
123
|
+
},
|
|
124
|
+
params: {},
|
|
125
|
+
request: {},
|
|
126
|
+
defaultData: {},
|
|
127
|
+
dataSource: {},
|
|
128
|
+
onLoadingChange: {},
|
|
129
|
+
searchForm: {
|
|
130
|
+
type: [Boolean, Object],
|
|
131
|
+
default: void 0
|
|
132
|
+
},
|
|
133
|
+
beforeSearchSubmit: {},
|
|
134
|
+
pagination: {
|
|
135
|
+
type: [Boolean, Object],
|
|
136
|
+
default: void 0
|
|
137
|
+
},
|
|
138
|
+
searchFormWrapperStyle: {},
|
|
139
|
+
tableWrapperStyle: {},
|
|
140
|
+
manual: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: !1
|
|
143
|
+
},
|
|
144
|
+
size: {
|
|
145
|
+
default: "medium"
|
|
146
|
+
},
|
|
147
|
+
adaptive: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: !1
|
|
150
|
+
},
|
|
151
|
+
columnResizable: {
|
|
152
|
+
type: [Boolean, Object],
|
|
153
|
+
default: !1
|
|
154
|
+
},
|
|
155
|
+
rowKey: {
|
|
156
|
+
default: "key"
|
|
157
|
+
},
|
|
158
|
+
footer: {},
|
|
159
|
+
virtual: {
|
|
160
|
+
type: [Boolean, Object],
|
|
161
|
+
default: void 0
|
|
162
|
+
},
|
|
163
|
+
expandable: {}
|
|
164
|
+
},
|
|
165
|
+
setup(Q, {
|
|
166
|
+
expose: Y
|
|
167
|
+
}) {
|
|
168
|
+
var W;
|
|
169
|
+
const m = (W = Se()) == null ? void 0 : W.appContext.app;
|
|
170
|
+
m && !m.__VXE_PC_UI_INSTALLED__ && (m.use(ke), m.__VXE_PC_UI_INSTALLED__ = !0);
|
|
171
|
+
const z = we(), o = Q, {
|
|
172
|
+
e: F,
|
|
173
|
+
b: g,
|
|
174
|
+
be: Z
|
|
175
|
+
} = Ue("ap-grid"), ee = qe("valueTypeMap"), d = w([]), T = w([]), h = w(), k = w(o.size), [, ae] = He(), {
|
|
176
|
+
renderConfig: oe,
|
|
177
|
+
updateSignal: te
|
|
178
|
+
} = $e(d);
|
|
179
|
+
let V = 0;
|
|
180
|
+
const _ = l(() => {
|
|
181
|
+
var e, n, r;
|
|
182
|
+
return V++, ((r = (n = (e = o.columns) == null ? void 0 : e.filter((t) => !t.hideInSearch && t.dataIndex && (t.valueType || t.customRenderFormItem) && !Pe.includes(t.valueType))) == null ? void 0 : n.sort((t, i) => {
|
|
183
|
+
let p = X(t.order);
|
|
184
|
+
return X(i.order) - p;
|
|
185
|
+
})) == null ? void 0 : r.map((t) => {
|
|
186
|
+
const i = Ee(t, Ne(t.fieldProps, {})), p = {
|
|
187
|
+
...t,
|
|
188
|
+
fieldProps: {
|
|
189
|
+
label: t.title,
|
|
190
|
+
name: t.dataIndex,
|
|
191
|
+
...i || {},
|
|
192
|
+
_signal: V
|
|
193
|
+
},
|
|
194
|
+
renderNode: void 0
|
|
195
|
+
};
|
|
196
|
+
return p.renderNode = ze(p, a(ee)), p;
|
|
197
|
+
})) || [];
|
|
198
|
+
}), re = l(() => [g(), o.card ? null : g("wrapper")].filter(Boolean)), A = l(() => J(a(d), (e) => {
|
|
199
|
+
if (e.sorter === !0)
|
|
200
|
+
return e.key || e.dataIndex;
|
|
201
|
+
}).filter(Boolean)), O = l(() => J(a(d), (e) => {
|
|
202
|
+
if (e.filters && !e.onFilter)
|
|
203
|
+
return e.key || e.dataIndex;
|
|
204
|
+
}).filter(Boolean)), {
|
|
205
|
+
formRef: B,
|
|
206
|
+
submit: L,
|
|
207
|
+
reset: D,
|
|
208
|
+
refresh: ne,
|
|
209
|
+
data: C,
|
|
210
|
+
tableProps: le,
|
|
211
|
+
setDataSource: se,
|
|
212
|
+
handleTableChange: de
|
|
213
|
+
} = Te({
|
|
214
|
+
async request(e) {
|
|
215
|
+
var r;
|
|
216
|
+
if (!S.value.preserveSelectedRowKeys && x(o.dataSource) && I(), !x(o.dataSource)) {
|
|
217
|
+
const t = e.pageSize * (e.current - 1);
|
|
218
|
+
return {
|
|
219
|
+
data: (o.pagination === !1 ? o.dataSource : o.dataSource.slice(t, t + e.pageSize)) || [],
|
|
220
|
+
total: o.dataSource.length || 0
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
const n = await ((r = o.request) == null ? void 0 : r.call(o, e));
|
|
224
|
+
return {
|
|
225
|
+
data: (n == null ? void 0 : n.data) || [],
|
|
226
|
+
total: (n == null ? void 0 : n.total) || 0
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
namespace: "ap-grid",
|
|
230
|
+
filterFields: O,
|
|
231
|
+
sortFields: A,
|
|
232
|
+
defaultParams: o.params,
|
|
233
|
+
defaultData: o.defaultData,
|
|
234
|
+
manual: o.manual,
|
|
235
|
+
formatParams: o.beforeSearchSubmit,
|
|
236
|
+
pagination: o.pagination
|
|
237
|
+
}), {
|
|
238
|
+
sortChangeEvent: ie,
|
|
239
|
+
filterChangeEvent: ue,
|
|
240
|
+
paginationChangeEvent: ce
|
|
241
|
+
} = _e(de);
|
|
242
|
+
Ke({
|
|
243
|
+
columns: l(() => d.value),
|
|
244
|
+
columnsBackup: l(() => T.value),
|
|
245
|
+
size: l(() => We[k.value]),
|
|
246
|
+
updateColumns(e) {
|
|
247
|
+
d.value = e;
|
|
248
|
+
},
|
|
249
|
+
updateSize(e) {
|
|
250
|
+
k.value = je[e];
|
|
251
|
+
},
|
|
252
|
+
renderConfig: l(() => ({
|
|
253
|
+
className: Z("table-header", "title"),
|
|
254
|
+
color: ae.value.colorPrimary
|
|
255
|
+
}))
|
|
256
|
+
});
|
|
257
|
+
const K = l(() => d.value.some((e) => e.fixed === "left" || e.fixed === !0) ? "left" : void 0), pe = l(() => x(o.dataSource) ? C.records : o.dataSource), {
|
|
258
|
+
selectedRows: y,
|
|
259
|
+
rowSelection: S,
|
|
260
|
+
...fe
|
|
261
|
+
} = De({
|
|
262
|
+
...o.rowSelection === !0 ? {} : o.rowSelection,
|
|
263
|
+
dataSource: pe,
|
|
264
|
+
rowKey: o.rowKey
|
|
265
|
+
}), j = () => {
|
|
266
|
+
const e = h.value;
|
|
267
|
+
e && (y.value = [...e.getCheckboxReserveRecords(), ...e.getCheckboxRecords()]);
|
|
268
|
+
}, me = () => {
|
|
269
|
+
const e = h.value;
|
|
270
|
+
e && (y.value = [e.getRadioRecord()]);
|
|
271
|
+
};
|
|
272
|
+
function ge() {
|
|
273
|
+
var e;
|
|
274
|
+
return ((e = o.columns) == null ? void 0 : e.filter((n) => !n.hideInTable)) || [];
|
|
275
|
+
}
|
|
276
|
+
function he(e) {
|
|
277
|
+
var n, r, t;
|
|
278
|
+
(t = (r = (n = B.value) == null ? void 0 : n.apForm) == null ? void 0 : r.setFieldsValue) == null || t.call(r, e);
|
|
279
|
+
}
|
|
280
|
+
function Ce(e = !1) {
|
|
281
|
+
var r, t, i;
|
|
282
|
+
const n = e ? "getFieldsValueTransformed" : "getFieldsValue";
|
|
283
|
+
return (i = (t = (r = B.value) == null ? void 0 : r.apForm) == null ? void 0 : t[n]) == null ? void 0 : i.call(t, !0);
|
|
284
|
+
}
|
|
285
|
+
function I() {
|
|
286
|
+
fe.clearAll();
|
|
287
|
+
const e = h.value;
|
|
288
|
+
e && (S.value.type === "radio" ? (e.clearRadioRow(), e.clearRadioReserve()) : (e.clearCheckboxRow(), e.clearCheckboxReserve()));
|
|
289
|
+
}
|
|
290
|
+
return ve(() => {
|
|
291
|
+
const e = ge();
|
|
292
|
+
d.value = e, T.value = e;
|
|
293
|
+
}), $(() => o.dataSource, (e) => {
|
|
294
|
+
se(e);
|
|
295
|
+
}, {
|
|
296
|
+
immediate: !0
|
|
297
|
+
}), $(() => a(C).loading, (e) => {
|
|
298
|
+
var n;
|
|
299
|
+
(n = o.onLoadingChange) == null || n.call(o, e);
|
|
300
|
+
}), Y({
|
|
301
|
+
submit: L,
|
|
302
|
+
reset: D,
|
|
303
|
+
refresh: ne,
|
|
304
|
+
setSearchFormValues: he,
|
|
305
|
+
getSearchFormValues: Ce,
|
|
306
|
+
getShowColumns: () => a(d),
|
|
307
|
+
rowSelection: {
|
|
308
|
+
selectedRows: l(() => y.value),
|
|
309
|
+
clearAll: I
|
|
310
|
+
}
|
|
311
|
+
}), (e, n) => (s(), v("div", {
|
|
312
|
+
class: b(re.value)
|
|
313
|
+
}, [a(x)(e.dataSource) && e.searchForm !== !1 && _.value.length > 0 ? (s(), v("div", {
|
|
314
|
+
key: 0,
|
|
315
|
+
class: b(e.card ? a(F)("search-wrapper") : null),
|
|
316
|
+
style: U(e.searchFormWrapperStyle)
|
|
317
|
+
}, [be(a(Ie).SearchForm, c(e.searchForm || {}, {
|
|
318
|
+
ref_key: "formRef",
|
|
319
|
+
ref: B,
|
|
320
|
+
"custom-reset": "",
|
|
321
|
+
"submit-loading": !1,
|
|
322
|
+
onSubmit: a(L),
|
|
323
|
+
onReset: a(D)
|
|
324
|
+
}), q({
|
|
325
|
+
default: f(() => [(s(!0), v(M, null, P(_.value, (r) => (s(), u(E(r.renderNode.Comp), c({
|
|
326
|
+
key: r.dataIndex,
|
|
327
|
+
item: r,
|
|
328
|
+
ref_for: !0
|
|
329
|
+
}, r.fieldProps || {}, {
|
|
330
|
+
span: r.span,
|
|
331
|
+
"custom-render": r.renderNode.render
|
|
332
|
+
}), null, 16, ["item", "span", "custom-render"]))), 128))]),
|
|
333
|
+
_: 2
|
|
334
|
+
}, [z.searchFormExtra ? {
|
|
335
|
+
name: "extra",
|
|
336
|
+
fn: f(() => [N(e.$slots, "searchFormExtra")]),
|
|
337
|
+
key: "0"
|
|
338
|
+
} : void 0]), 1040, ["onSubmit", "onReset"])], 6)) : R("", !0), H("div", {
|
|
339
|
+
class: b([a(F)("table-wrapper"), e.card ? a(F)("table-wrapper-card") : null]),
|
|
340
|
+
style: U(e.tableWrapperStyle)
|
|
341
|
+
}, [H("div", {
|
|
342
|
+
class: b(a(g)("header-wrapper"))
|
|
343
|
+
}, [N(e.$slots, "title", {
|
|
344
|
+
selectedRows: a(y),
|
|
345
|
+
selectedRowKeys: a(S).selectedRowKeys,
|
|
346
|
+
shownColumns: d.value,
|
|
347
|
+
clearAll: I
|
|
348
|
+
})], 2), (s(), u(a(Fe), c(a(Ae)(o), {
|
|
349
|
+
ref_key: "tableRef",
|
|
350
|
+
ref: h,
|
|
351
|
+
key: a(te),
|
|
352
|
+
data: a(C).records,
|
|
353
|
+
"sort-config": {
|
|
354
|
+
remote: A.value.length > 0
|
|
355
|
+
},
|
|
356
|
+
"filter-config": {
|
|
357
|
+
remote: O.value.length > 0
|
|
358
|
+
},
|
|
359
|
+
loading: a(C).loading,
|
|
360
|
+
"row-config": {
|
|
361
|
+
isHover: !0,
|
|
362
|
+
keyField: o.rowKey
|
|
363
|
+
},
|
|
364
|
+
size: k.value,
|
|
365
|
+
onSortChange: a(ie),
|
|
366
|
+
onFilterChange: a(ue),
|
|
367
|
+
onCheckboxChange: j,
|
|
368
|
+
onCheckboxAll: j,
|
|
369
|
+
onRadioChange: me
|
|
370
|
+
}), q({
|
|
371
|
+
default: f(() => [o.expandable ? (s(), u(a(G), c({
|
|
372
|
+
key: 0
|
|
373
|
+
}, a(Oe)(e.expandable), {
|
|
374
|
+
fixed: K.value
|
|
375
|
+
}), {
|
|
376
|
+
content: f((r) => [(s(), u(E(o.expandable.renderContent(r))))]),
|
|
377
|
+
_: 1
|
|
378
|
+
}, 16, ["fixed"])) : R("", !0), o.rowSelection ? (s(), u(a(G), c({
|
|
379
|
+
key: 1
|
|
380
|
+
}, a(Le)(a(S)), {
|
|
381
|
+
fixed: K.value
|
|
382
|
+
}), null, 16, ["fixed"])) : R("", !0), (s(!0), v(M, null, P(a(oe), (r) => (s(), u(E(r), {
|
|
383
|
+
key: r.props.colId
|
|
384
|
+
}))), 128))]),
|
|
385
|
+
_: 2
|
|
386
|
+
}, [P(a(Be)(z, ["searchFormExtra"]), (r, t) => ({
|
|
387
|
+
name: t,
|
|
388
|
+
fn: f((i) => [N(e.$slots, t, Re(xe(i || {})))])
|
|
389
|
+
}))]), 1040, ["data", "sort-config", "filter-config", "loading", "row-config", "size", "onSortChange", "onFilterChange"])), e.pagination !== !1 ? (s(), u(a(Ve), c({
|
|
390
|
+
key: 0,
|
|
391
|
+
class: a(g)("pagination")
|
|
392
|
+
}, a(le).pagination, {
|
|
393
|
+
onChange: a(ce)
|
|
394
|
+
}), null, 16, ["class", "onChange"])) : R("", !0)], 6)], 2));
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
export {
|
|
398
|
+
ga as default
|
|
399
|
+
};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { ApFormSearchFormProps } from '../ap-form/interface';
|
|
2
|
+
import { ApTablePaginationConfig, ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, ExtraProColumnType, FieldPropsType, RequestData, ValueEnum } from '../ap-table/interface';
|
|
3
|
+
import { Recordable } from '../type';
|
|
4
|
+
import { TableProps } from '@aplus-frontend/antdv';
|
|
5
|
+
import { ColumnFilterItem, SortOrder, TableRowSelection } from '@aplus-frontend/antdv/es/table/interface';
|
|
6
|
+
import { ComputedRef, CSSProperties, Ref, VNode } from 'vue';
|
|
7
|
+
import { VxeTablePropTypes, VxeTableSlots, VxeColumnPropTypes, VxeTableProps, VxeTableDefines, VxeColumnSlots } from 'vxe-table';
|
|
8
|
+
export type ColConfigType = VxeTableDefines.ColumnOptions;
|
|
9
|
+
export type ApGridColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ExtraProColumnType<RecordType>, 'sorter' | 'rowSpan' | 'customCell' | 'customHeaderCell' | 'minWidth'> & {
|
|
10
|
+
children?: ApGridColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
|
|
11
|
+
/**
|
|
12
|
+
* 表单项所占据的格子数(1-24格)
|
|
13
|
+
*/
|
|
14
|
+
span?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 列的最小宽度
|
|
17
|
+
*/
|
|
18
|
+
minWidth?: string | number;
|
|
19
|
+
/**
|
|
20
|
+
* 在title之后展示一个icon并触发tooltip
|
|
21
|
+
*/
|
|
22
|
+
tooltip?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 是否可以复制
|
|
25
|
+
* @deprecated 暂未实现
|
|
26
|
+
*/
|
|
27
|
+
copyable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 配置溢出隐藏的方式
|
|
30
|
+
*/
|
|
31
|
+
ellipsis?: VxeTablePropTypes.ShowOverflow;
|
|
32
|
+
/**
|
|
33
|
+
* 是否搜索表单中隐藏
|
|
34
|
+
*/
|
|
35
|
+
hideInSearch?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 是否在表格中隐藏
|
|
38
|
+
*/
|
|
39
|
+
hideInTable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 值的枚举,会自动转化把值当成 key 来取出要显示的内容(也会作为select等组件的选项)
|
|
42
|
+
*/
|
|
43
|
+
valueEnum?: ValueEnum;
|
|
44
|
+
/**
|
|
45
|
+
* 自定义查询表单渲染
|
|
46
|
+
*/
|
|
47
|
+
customRenderFormItem?: (config: ApGridColumnType<RecordType>) => any;
|
|
48
|
+
/**
|
|
49
|
+
* 自定义渲染文本,和customRender相比,其必须返回字符串,并且后续的渲染(例如copy/ellipsis)都将使用这个值
|
|
50
|
+
*/
|
|
51
|
+
renderText?: (option: {
|
|
52
|
+
value: any;
|
|
53
|
+
text: any;
|
|
54
|
+
record: RecordType;
|
|
55
|
+
index: number;
|
|
56
|
+
renderIndex: number;
|
|
57
|
+
column: ApGridColumnType<RecordType>;
|
|
58
|
+
}) => string;
|
|
59
|
+
/**
|
|
60
|
+
* 指定值类型(将会用于默认渲染和查询表单生成)
|
|
61
|
+
*/
|
|
62
|
+
valueType?: MergedValueType;
|
|
63
|
+
/**
|
|
64
|
+
* 值类型额外配置的参数(用于查询表单渲染)
|
|
65
|
+
*/
|
|
66
|
+
fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
|
|
67
|
+
/**
|
|
68
|
+
* 用于表单项排序的字段
|
|
69
|
+
* @description 值越大,越排在前面,请设置正整数,设置为0或负数将会无效
|
|
70
|
+
*/
|
|
71
|
+
order?: number;
|
|
72
|
+
/**
|
|
73
|
+
* 用于指定列排序,设置为true表示后端排序,否则为前端排序
|
|
74
|
+
* Table同时只能设置一种排序类型,当至少有一个后端排序列时,显式设置为前端排序的列将不会生效
|
|
75
|
+
*/
|
|
76
|
+
sorter?: true | {
|
|
77
|
+
type?: VxeColumnPropTypes.SortType;
|
|
78
|
+
by?: VxeColumnPropTypes.SortBy;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* 表头的菜单筛选项,设置为true后会尝试使用valueEnum生成filters
|
|
82
|
+
*/
|
|
83
|
+
filters?: Omit<ColumnFilterItem, 'children'>[] | true;
|
|
84
|
+
/**
|
|
85
|
+
* 自定义渲染,添加了`originalNode、originalText`
|
|
86
|
+
* @param opt
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
customRender?: (opt: {
|
|
90
|
+
value: any;
|
|
91
|
+
text: any;
|
|
92
|
+
record: RecordType;
|
|
93
|
+
index: number;
|
|
94
|
+
renderIndex: number;
|
|
95
|
+
column: ApGridColumnType<RecordType>;
|
|
96
|
+
originalNode?: VNode;
|
|
97
|
+
originalText?: any;
|
|
98
|
+
}) => any;
|
|
99
|
+
} : never;
|
|
100
|
+
export type ApGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>, 'defaultSelectedRowKeys' | 'type' | 'preserveSelectedRowKeys' | 'onChange' | 'fixed' | 'columnWidth' | 'columnTitle'> & {
|
|
101
|
+
/**
|
|
102
|
+
* 设置禁用的列
|
|
103
|
+
* @param row
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
disabled?: (row: RecordType) => boolean;
|
|
107
|
+
};
|
|
108
|
+
export type ApGridProps<RecordType = any, ParamsType = any> = Omit<TableProps<RecordType>, 'columns' | 'pagination' | 'dataSource' | 'size' | 'rowSelection' | 'rowKey' | 'rowClassName' | 'footer'> & Pick<VxeTableProps<RecordType>, 'rowClassName' | 'stripe' | 'headerRowClassName' | 'footerRowClassName' | 'cellClassName' | 'headerCellClassName' | 'footerCellClassName' | 'rowStyle' | 'headerRowStyle' | 'footerRowStyle' | 'cellStyle' | 'headerCellStyle' | 'footerCellStyle' | 'height' | 'minHeight' | 'maxHeight' | 'mergeCells' | 'mergeFooterItems' | 'cellConfig'> & {
|
|
109
|
+
/**
|
|
110
|
+
* 列配置
|
|
111
|
+
*/
|
|
112
|
+
columns?: ApGridColumnType<RecordType, any>[];
|
|
113
|
+
/**
|
|
114
|
+
* 行选中配置
|
|
115
|
+
*/
|
|
116
|
+
rowSelection?: true | ApGridRowSelection<RecordType>;
|
|
117
|
+
/**
|
|
118
|
+
* 是否启用卡片样式
|
|
119
|
+
*/
|
|
120
|
+
card?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* request额外请求的参数
|
|
123
|
+
* 如果传入响应式数据,将会在变更后重新执行
|
|
124
|
+
*/
|
|
125
|
+
params?: ParamsType | Ref<ParamsType>;
|
|
126
|
+
/**
|
|
127
|
+
* 请求获取dataSource
|
|
128
|
+
* @param params
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
request?: (params: Partial<ParamsType> & {
|
|
132
|
+
pageSize: number;
|
|
133
|
+
current: number;
|
|
134
|
+
sort?: Record<string, SortOrder>;
|
|
135
|
+
filter?: Recordable<any>;
|
|
136
|
+
}) => Promise<Partial<RequestData<RecordType>>>;
|
|
137
|
+
/**
|
|
138
|
+
* 表格的默认数据源,这些数据源将会在第一次请求后被替换
|
|
139
|
+
*/
|
|
140
|
+
defaultData?: RecordType[];
|
|
141
|
+
/**
|
|
142
|
+
* 表格的最终数据源(设置后request和defaultData都不会生效),离线表格的效果
|
|
143
|
+
*/
|
|
144
|
+
dataSource?: RecordType[];
|
|
145
|
+
/**
|
|
146
|
+
* 表格loading状态变更后触发
|
|
147
|
+
* @param loading
|
|
148
|
+
* @returns
|
|
149
|
+
*/
|
|
150
|
+
onLoadingChange?: (loading: boolean) => void;
|
|
151
|
+
/**
|
|
152
|
+
* 查询表单配置,设置为false表示不渲染查询表单
|
|
153
|
+
*/
|
|
154
|
+
searchForm?: false | ApFormSearchFormProps;
|
|
155
|
+
/**
|
|
156
|
+
* 查询表单提交之前,一般用于自定义对查询数据进行变更
|
|
157
|
+
* @param params
|
|
158
|
+
* @returns
|
|
159
|
+
*/
|
|
160
|
+
beforeSearchSubmit?: (params: Partial<ParamsType>) => any;
|
|
161
|
+
/**
|
|
162
|
+
* 是否显示分页器(特定的分页器)或者指定默认的当前页和pageSize
|
|
163
|
+
*/
|
|
164
|
+
pagination?: false | ApTablePaginationConfig;
|
|
165
|
+
/**
|
|
166
|
+
* 自定义查询表单容器样式
|
|
167
|
+
*/
|
|
168
|
+
searchFormWrapperStyle?: CSSProperties;
|
|
169
|
+
/**
|
|
170
|
+
* 自定义表格样式
|
|
171
|
+
*/
|
|
172
|
+
tableWrapperStyle?: CSSProperties;
|
|
173
|
+
/**
|
|
174
|
+
* 是否手动发起第一次网络请求
|
|
175
|
+
*/
|
|
176
|
+
manual?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* 表格尺寸(只支持中等大小和小尺寸)
|
|
179
|
+
*/
|
|
180
|
+
size?: 'medium' | 'small' | 'mini';
|
|
181
|
+
/**
|
|
182
|
+
* 表格是否自适应高度
|
|
183
|
+
* @deprecated 暂未实现
|
|
184
|
+
*/
|
|
185
|
+
adaptive?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* 设置表格列是否可以resize,还可以进行更多可变尺寸配置
|
|
188
|
+
*/
|
|
189
|
+
columnResizable?: boolean | VxeTablePropTypes.ResizableConfig;
|
|
190
|
+
rowKey?: string;
|
|
191
|
+
/**
|
|
192
|
+
* 指定用于渲染footer的数据,支持函数
|
|
193
|
+
*/
|
|
194
|
+
footer?: VxeTablePropTypes.FooterData | VxeTablePropTypes.FooterMethod<RecordType>;
|
|
195
|
+
/**
|
|
196
|
+
* 设置虚拟滚动
|
|
197
|
+
*/
|
|
198
|
+
virtual?: false | ApGridVirtualConfig;
|
|
199
|
+
/**
|
|
200
|
+
* 设置可展开及其配置
|
|
201
|
+
*/
|
|
202
|
+
expandable?: VxeTablePropTypes.ExpandConfig<RecordType> & {
|
|
203
|
+
/**
|
|
204
|
+
* 自定义渲染内容
|
|
205
|
+
*/
|
|
206
|
+
renderContent: VxeColumnSlots<RecordType>['content'];
|
|
207
|
+
/**
|
|
208
|
+
* 展开列占据的宽度,默认为auto
|
|
209
|
+
*/
|
|
210
|
+
width?: string | number;
|
|
211
|
+
/**
|
|
212
|
+
* 展开列的title
|
|
213
|
+
*/
|
|
214
|
+
title?: string;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
export type ApGridVirtualConfig = {
|
|
218
|
+
x?: false | number;
|
|
219
|
+
y?: false | number;
|
|
220
|
+
};
|
|
221
|
+
export type ApGridColumnProps<RecordType> = {
|
|
222
|
+
column: ApGridColumnType<RecordType>;
|
|
223
|
+
};
|
|
224
|
+
export type ApGridSlots<RecordType> = VxeTableSlots<RecordType> & {
|
|
225
|
+
/**
|
|
226
|
+
* 自定义查询表单额外的区域
|
|
227
|
+
*/
|
|
228
|
+
searchFormExtra?: any;
|
|
229
|
+
/**
|
|
230
|
+
* 自定义表格上部查询表单下部分区域的渲染
|
|
231
|
+
*/
|
|
232
|
+
title?: (params: {
|
|
233
|
+
selectedRows: RecordType[];
|
|
234
|
+
selectedRowKeys: (string | number)[];
|
|
235
|
+
shownColumns: ApGridColumnType<RecordType>[];
|
|
236
|
+
clearAll: () => void;
|
|
237
|
+
}) => any;
|
|
238
|
+
};
|
|
239
|
+
export type ApGridExpose<SearchParamsType = Recordable, RecordType = any> = {
|
|
240
|
+
/**
|
|
241
|
+
* 表格查询提交(重制页码但查询参数不会重置)
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
submit: () => void;
|
|
245
|
+
/**
|
|
246
|
+
* 表格查询重置(重置页码和查询参数)
|
|
247
|
+
* @returns
|
|
248
|
+
*/
|
|
249
|
+
reset: () => void;
|
|
250
|
+
/**
|
|
251
|
+
* 表格刷新当页数据
|
|
252
|
+
* @returns
|
|
253
|
+
*/
|
|
254
|
+
refresh: () => void;
|
|
255
|
+
/**
|
|
256
|
+
* 设置查询表单数据
|
|
257
|
+
* @param values
|
|
258
|
+
* @returns
|
|
259
|
+
*/
|
|
260
|
+
setSearchFormValues: (values: Partial<SearchParamsType>) => void;
|
|
261
|
+
/**
|
|
262
|
+
* 获取查询表单数据
|
|
263
|
+
* @param transform 是否获取转换后的数据 默认为`false`
|
|
264
|
+
* @returns
|
|
265
|
+
*/
|
|
266
|
+
getSearchFormValues: (transform?: boolean) => Partial<SearchParamsType> & Recordable<any>;
|
|
267
|
+
/**
|
|
268
|
+
* 获取最终现实的列配置
|
|
269
|
+
* @returns
|
|
270
|
+
*/
|
|
271
|
+
getShowColumns: () => ApGridColumnType<RecordType>[];
|
|
272
|
+
/**
|
|
273
|
+
* 行选中相关
|
|
274
|
+
*/
|
|
275
|
+
rowSelection: {
|
|
276
|
+
selectedRows: ComputedRef<RecordType[]>;
|
|
277
|
+
clearAll: () => void;
|
|
278
|
+
};
|
|
279
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/ap-grid/index.css';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui/theme/ap-grid/index.less';
|