@aplus-frontend/ui 6.21.1 → 6.22.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.
Files changed (77) hide show
  1. package/es/index.mjs +27 -25
  2. package/es/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.d.ts +2 -9
  3. package/es/src/ag-grid/components/body-cell/index.vue2.mjs +27 -0
  4. package/{lib/src/ap-pro-card/components/divider → es/src/ag-grid/components/header-cell}/index.vue.d.ts +2 -9
  5. package/es/src/ag-grid/components/header-cell/index.vue2.mjs +59 -0
  6. package/es/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
  7. package/es/src/ag-grid/hooks/use-row-selection.mjs +98 -0
  8. package/es/src/ag-grid/index.d.ts +3 -0
  9. package/es/src/ag-grid/index.mjs +2 -0
  10. package/es/src/ag-grid/index.vue.d.ts +41 -0
  11. package/es/src/ag-grid/index.vue.mjs +377 -0
  12. package/es/src/ag-grid/index.vue2.mjs +4 -0
  13. package/es/src/ag-grid/interface.d.ts +194 -0
  14. package/es/src/ag-grid/interface.mjs +1 -0
  15. package/es/src/ag-grid/style/css.d.ts +0 -0
  16. package/es/src/ag-grid/style/css.js +1 -0
  17. package/es/src/ag-grid/style/index.d.ts +0 -0
  18. package/es/src/ag-grid/style/index.js +1 -0
  19. package/es/src/ap-grid/index.vue.mjs +1 -1
  20. package/es/src/ap-grid/utils/col.d.ts +11 -0
  21. package/es/src/ap-grid/utils/col.mjs +99 -95
  22. package/es/src/ap-pro-card/components/card/index.vue2.mjs +37 -37
  23. package/es/src/ap-pro-card/index.d.ts +41 -9
  24. package/es/src/ap-pro-card/index.mjs +4 -10
  25. package/es/src/ap-pro-card/interface.d.ts +2 -2
  26. package/es/src/ap-table/utils.d.ts +1 -1
  27. package/es/src/index.d.ts +1 -0
  28. package/es/src/index.mjs +293 -290
  29. package/es/src/version.d.ts +1 -1
  30. package/es/src/version.mjs +1 -1
  31. package/lib/index.js +1 -1
  32. package/lib/src/ag-grid/components/body-cell/index.vue.d.ts +6 -0
  33. package/lib/src/ag-grid/components/body-cell/index.vue2.js +1 -0
  34. package/lib/src/ag-grid/components/header-cell/index.vue.d.ts +6 -0
  35. package/lib/src/ag-grid/components/header-cell/index.vue2.js +1 -0
  36. package/lib/src/ag-grid/hooks/use-row-selection.d.ts +78 -0
  37. package/lib/src/ag-grid/hooks/use-row-selection.js +1 -0
  38. package/lib/src/ag-grid/index.d.ts +3 -0
  39. package/lib/src/ag-grid/index.js +1 -0
  40. package/lib/src/ag-grid/index.vue.d.ts +41 -0
  41. package/lib/src/ag-grid/index.vue.js +1 -0
  42. package/lib/src/ag-grid/index.vue2.js +1 -0
  43. package/lib/src/ag-grid/interface.d.ts +194 -0
  44. package/lib/src/ag-grid/interface.js +1 -0
  45. package/lib/src/ag-grid/style/css.cjs +1 -0
  46. package/lib/src/ag-grid/style/css.d.ts +0 -0
  47. package/lib/src/ag-grid/style/index.cjs +1 -0
  48. package/lib/src/ag-grid/style/index.d.ts +0 -0
  49. package/lib/src/ap-grid/index.vue.js +1 -1
  50. package/lib/src/ap-grid/utils/col.d.ts +11 -0
  51. package/lib/src/ap-grid/utils/col.js +1 -1
  52. package/lib/src/ap-pro-card/components/card/index.vue2.js +1 -1
  53. package/lib/src/ap-pro-card/index.d.ts +41 -9
  54. package/lib/src/ap-pro-card/index.js +1 -1
  55. package/lib/src/ap-pro-card/interface.d.ts +2 -2
  56. package/lib/src/ap-table/utils.d.ts +1 -1
  57. package/lib/src/index.d.ts +1 -0
  58. package/lib/src/index.js +1 -1
  59. package/lib/src/version.d.ts +1 -1
  60. package/lib/src/version.js +1 -1
  61. package/package.json +3 -1
  62. package/theme/ap-grid/index.css +3 -0
  63. package/theme/ap-grid/index.less +3 -0
  64. package/theme/ap-pro-card/index.css +0 -52
  65. package/theme/ap-pro-card/index.less +0 -56
  66. package/theme/index.css +164 -55
  67. package/theme/index.less +1 -0
  68. package/es/src/ap-pro-card/components/divider/index.vue2.mjs +0 -29
  69. package/es/src/ap-pro-card/components/title/index.vue.d.ts +0 -23
  70. package/es/src/ap-pro-card/components/title/index.vue2.mjs +0 -28
  71. package/lib/src/ap-pro-card/components/divider/index.vue2.js +0 -1
  72. package/lib/src/ap-pro-card/components/title/index.vue.d.ts +0 -23
  73. package/lib/src/ap-pro-card/components/title/index.vue2.js +0 -1
  74. /package/es/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.mjs +0 -0
  75. /package/es/src/{ap-pro-card/components/title → ag-grid/components/header-cell}/index.vue.mjs +0 -0
  76. /package/lib/src/{ap-pro-card/components/divider → ag-grid/components/body-cell}/index.vue.js +0 -0
  77. /package/lib/src/{ap-pro-card/components/title → ag-grid/components/header-cell}/index.vue.js +0 -0
@@ -0,0 +1,377 @@
1
+ import { defineComponent as ce, useSlots as ue, ref as h, computed as d, unref as a, watch as pe, toRef as me, createElementBlock as C, openBlock as p, normalizeStyle as b, normalizeClass as c, createCommentVNode as z, createElementVNode as m, createVNode as R, mergeProps as N, createSlots as fe, withCtx as E, Fragment as we, renderList as ge, createBlock as W, resolveDynamicComponent as he, renderSlot as A, withDirectives as ye, vShow as Se } from "vue";
2
+ import { AgGridVue as Ce } from "ag-grid-vue3";
3
+ import { ModuleRegistry as be, AllCommunityModule as Re } from "ag-grid-community";
4
+ import { Spin as ve, Pagination as xe } from "@aplus-frontend/antdv";
5
+ import { isFunction as v, isUndefined as x } from "lodash-unified";
6
+ import "../config-provider/index.mjs";
7
+ import { ApForm as Be } from "../ap-form/index.mjs";
8
+ import { noRenderAsFormItemValueList as Fe } from "../ap-table/constants.mjs";
9
+ import { getColumnOrder as O, updateFormProps as Ie, getFieldProps as Te, getSearchFormItemRenderNode as ke, recursionApColumns as Ke } from "../ap-table/utils.mjs";
10
+ import { useTablePaging as Pe } from "../ap-table/hooks/use-table-paging-ng.mjs";
11
+ import { dataIndexToField as De } from "../ap-grid/utils/col.mjs";
12
+ import { isDef as ze } from "../utils/index.mjs";
13
+ import "./components/header-cell/index.vue.mjs";
14
+ import "./components/body-cell/index.vue.mjs";
15
+ import Ne from "./hooks/use-row-selection.mjs";
16
+ import { useNamespace as Ee } from "../config-provider/hooks/use-namespace.mjs";
17
+ import { useGlobalConfig as We } from "../config-provider/hooks/use-global-config.mjs";
18
+ import Ae from "./components/body-cell/index.vue2.mjs";
19
+ import Oe from "./components/header-cell/index.vue2.mjs";
20
+ const no = /* @__PURE__ */ ce({
21
+ name: "AgGrid",
22
+ __name: "index",
23
+ props: {
24
+ dropdownPrefixCls: {},
25
+ bordered: { type: Boolean },
26
+ locale: {},
27
+ onChange: {},
28
+ onResizeColumn: {},
29
+ getPopupContainer: {},
30
+ scroll: {},
31
+ sortDirections: {},
32
+ showSorterTooltip: { type: [Boolean, Object] },
33
+ prefixCls: {},
34
+ rowKey: { default: "key" },
35
+ tableLayout: {},
36
+ title: {},
37
+ id: {},
38
+ showHeader: { type: Boolean },
39
+ components: {},
40
+ customRow: {},
41
+ customHeaderRow: {},
42
+ direction: {},
43
+ expandFixed: { type: [String, Boolean] },
44
+ expandColumnWidth: {},
45
+ expandedRowKeys: {},
46
+ defaultExpandedRowKeys: {},
47
+ expandedRowRender: {},
48
+ expandRowByClick: { type: Boolean },
49
+ expandIcon: {},
50
+ onExpand: {},
51
+ onExpandedRowsChange: {},
52
+ defaultExpandAllRows: { type: Boolean },
53
+ indentSize: {},
54
+ expandIconColumnIndex: {},
55
+ showExpandColumn: { type: Boolean },
56
+ expandedRowClassName: {},
57
+ childrenColumnName: {},
58
+ rowExpandable: {},
59
+ transformCellText: {},
60
+ columns: {},
61
+ rowSelection: { type: Boolean },
62
+ card: { type: Boolean },
63
+ params: {},
64
+ request: {},
65
+ defaultData: {},
66
+ dataSource: {},
67
+ onLoadingChange: {},
68
+ onShownColumnsChange: {},
69
+ searchForm: { type: [Boolean, Object], default: void 0 },
70
+ beforeSearchSubmit: {},
71
+ pagination: { type: [Boolean, Object], default: void 0 },
72
+ searchFormWrapperStyle: {},
73
+ tableWrapperStyle: {},
74
+ wrapperStyle: {},
75
+ manual: { type: Boolean, default: void 0 },
76
+ size: { default: "mini" },
77
+ adaptive: { type: Boolean },
78
+ columnResizable: { type: Boolean, default: !1 },
79
+ loading: { type: Boolean, default: void 0 },
80
+ summary: {}
81
+ },
82
+ setup(M) {
83
+ be.registerModules([Re]);
84
+ const t = M, V = ue(), { e: f, b: i, em: G } = Ee("ag-grid"), B = h();
85
+ let w = !1, F = 0;
86
+ const I = We("valueTypeMap"), T = d(() => {
87
+ var e, r, n;
88
+ return F++, ((n = (r = (e = t.columns) == null ? void 0 : e.filter(
89
+ (o) => !o.hideInSearch && o.dataIndex && (o.valueType || o.customRenderFormItem) && !Fe.includes(o.valueType)
90
+ )) == null ? void 0 : r.sort((o, l) => {
91
+ let s = O(o.order);
92
+ return O(l.order) - s;
93
+ })) == null ? void 0 : n.map((o) => {
94
+ const l = Ie(
95
+ o,
96
+ Te(o.fieldProps, {})
97
+ ), s = {
98
+ ...o,
99
+ fieldProps: {
100
+ label: o.title,
101
+ name: o.dataIndex,
102
+ // tips: 在表格中的查询表单项默认是带边框的
103
+ bordered: !0,
104
+ ...l || {},
105
+ _signal: F
106
+ },
107
+ renderNode: void 0
108
+ };
109
+ return s.renderNode = ke(
110
+ s,
111
+ a(I)
112
+ ), s;
113
+ })) || [];
114
+ }), g = h([]);
115
+ function L() {
116
+ var e;
117
+ return ((e = t.columns) == null ? void 0 : e.filter((r) => !r.hideInTable)) || [];
118
+ }
119
+ pe(
120
+ () => t.columns,
121
+ () => {
122
+ var r;
123
+ const e = L();
124
+ g.value = e, (r = t.onShownColumnsChange) == null || r.call(t, e);
125
+ },
126
+ {
127
+ deep: !0,
128
+ immediate: !0
129
+ }
130
+ );
131
+ const $ = d(() => {
132
+ const e = a(g);
133
+ function r(n) {
134
+ return n.map((o) => {
135
+ var s;
136
+ const l = {
137
+ field: De(o.dataIndex),
138
+ colId: ze(o.key) ? String(o.key) : void 0,
139
+ sortable: !!o.sorter,
140
+ comparator: o.sorter === !0 ? () => 0 : o.sorter,
141
+ headerComponentParams: {
142
+ column: o
143
+ },
144
+ cellRendererParams: {
145
+ column: o,
146
+ extraValueType: a(I)
147
+ },
148
+ resizable: o.resizable,
149
+ width: o.width,
150
+ minWidth: o.minWidth,
151
+ maxWidth: o.maxWidth,
152
+ flex: o.width ? void 0 : 1,
153
+ // 如果没有设置确切的宽度,则设置为可自由伸缩列
154
+ pinned: o.fixed,
155
+ cellClass: (u) => {
156
+ const S = o.cellClass || "", ie = v(S) ? S(u.data, u.node) : S;
157
+ return [
158
+ `${G("cell", o.align || "left")}`,
159
+ ie
160
+ ].flat().filter(Boolean);
161
+ }
162
+ };
163
+ return (s = o.children) != null && s.length ? {
164
+ ...l,
165
+ children: r(o.children)
166
+ } : l;
167
+ });
168
+ }
169
+ return r(e);
170
+ }), j = h({
171
+ headerComponent: Oe,
172
+ cellRenderer: Ae,
173
+ resizable: t.columnResizable,
174
+ suppressMovable: !0,
175
+ cellDataType: !1
176
+ }), q = {
177
+ asc: "ascend",
178
+ desc: "descend"
179
+ };
180
+ function U() {
181
+ var r;
182
+ const e = (r = B.value.getColumns()) == null ? void 0 : r.filter((n) => n.getSort() !== void 0);
183
+ if (e && e.length > 0) {
184
+ const n = e[0], o = n.getColDef(), l = n.getSort();
185
+ K(void 0, void 0, {
186
+ column: o,
187
+ field: o.field,
188
+ order: l ? q[l] : null
189
+ });
190
+ }
191
+ }
192
+ const H = d(() => Ke(a(g), (e) => {
193
+ if (e.sorter === !0)
194
+ return e.key || e.dataIndex;
195
+ }).filter(Boolean)), {
196
+ formRef: J,
197
+ submit: Q,
198
+ reset: X,
199
+ data: y,
200
+ tableProps: k,
201
+ handleTableChangeOptional: K
202
+ } = Pe({
203
+ async request(e) {
204
+ var n;
205
+ if (w = !1, !x(t.dataSource)) {
206
+ const o = e.pageSize * (e.current - 1);
207
+ return {
208
+ data: (t.pagination === !1 ? t.dataSource : t.dataSource.slice(o, o + e.pageSize)) || [],
209
+ total: t.dataSource.length || 0
210
+ };
211
+ }
212
+ const r = await ((n = t.request) == null ? void 0 : n.call(t, e));
213
+ return {
214
+ data: (r == null ? void 0 : r.data) || [],
215
+ total: (r == null ? void 0 : r.total) || 0
216
+ };
217
+ },
218
+ namespace: "ap-grid",
219
+ filterFields: h([]),
220
+ params: me(t, "params"),
221
+ defaultData: t.defaultData,
222
+ manual: t.manual,
223
+ formatParams: t.beforeSearchSubmit,
224
+ pagination: t.pagination,
225
+ sortFields: H
226
+ }), { select: Y, unSelect: Z, selectedRows: P, selectedRowKeys: _ } = Ne({
227
+ ...t.rowSelection === !0 ? {} : t.rowSelection,
228
+ dataSource: d(() => y.records),
229
+ rowKey: t.rowKey
230
+ }), ee = {
231
+ checkbox: "multiRow",
232
+ radio: "singleRow"
233
+ }, oe = d(() => {
234
+ if (!t.rowSelection)
235
+ return;
236
+ const { type: e = "checkbox", disabled: r } = t.rowSelection === !0 ? {} : t.rowSelection;
237
+ return {
238
+ mode: ee[e],
239
+ isRowSelectable: (n) => r ? !r(n.data) : !0
240
+ };
241
+ }), te = d(() => {
242
+ if (!t.rowSelection)
243
+ return;
244
+ const e = t.rowSelection === !0 ? {} : t.rowSelection;
245
+ return {
246
+ sortable: !1,
247
+ resizable: !1,
248
+ width: e.columnWidth || 60,
249
+ pinned: e.fixed
250
+ };
251
+ });
252
+ function D(e) {
253
+ return v(t.rowKey) ? t.rowKey(e) : e[t.rowKey];
254
+ }
255
+ const re = ({ api: e }) => {
256
+ if (!t.rowSelection)
257
+ return;
258
+ const r = P.value;
259
+ if (console.log("run restore", r), !r.length)
260
+ return;
261
+ w = !1;
262
+ const n = [];
263
+ e.forEachNode((o) => {
264
+ const l = o.data, s = D(l);
265
+ r.find((u) => D(u) === s) && n.push(o);
266
+ }), e.setNodesSelected({ nodes: n, newValue: !0 }), setTimeout(() => {
267
+ w = !0;
268
+ }, 0);
269
+ }, ae = (e) => {
270
+ w && (e.node.isSelected() ? Y(e.data) : Z(e.data));
271
+ }, ne = d(
272
+ () => x(t.loading) ? y.loading : t.loading
273
+ ), le = d(() => [
274
+ i(),
275
+ t.card ? null : i("wrapper"),
276
+ t.adaptive ? i("adaptive") : null
277
+ ].filter(Boolean)), se = (e, r) => {
278
+ K({ current: e, pageSize: r });
279
+ };
280
+ function de(e) {
281
+ const r = e.data;
282
+ return v(t.rowKey) ? t.rowKey(r) : r[t.rowKey];
283
+ }
284
+ return (e, r) => {
285
+ var n, o;
286
+ return p(), C("div", {
287
+ class: c(le.value),
288
+ style: b(e.wrapperStyle)
289
+ }, [
290
+ a(x)(e.dataSource) && e.searchForm !== !1 && T.value.length > 0 ? (p(), C("div", {
291
+ key: 0,
292
+ class: c(e.card ? a(f)("search-wrapper") : null),
293
+ style: b(e.searchFormWrapperStyle)
294
+ }, [
295
+ R(a(Be).SearchForm, N(e.searchForm || {}, {
296
+ ref_key: "formRef",
297
+ ref: J,
298
+ "custom-reset": "",
299
+ "submit-loading": a(k).loading,
300
+ onSubmit: a(Q),
301
+ onReset: a(X)
302
+ }), fe({
303
+ default: E(() => [
304
+ (p(!0), C(we, null, ge(T.value, (l) => (p(), W(he(l.renderNode), {
305
+ key: l.dataIndex
306
+ }))), 128))
307
+ ]),
308
+ _: 2
309
+ }, [
310
+ V.searchFormExtra ? {
311
+ name: "extra",
312
+ fn: E(() => [
313
+ A(e.$slots, "searchFormExtra")
314
+ ]),
315
+ key: "0"
316
+ } : void 0
317
+ ]), 1040, ["submit-loading", "onSubmit", "onReset"])
318
+ ], 6)) : z("", !0),
319
+ m("div", {
320
+ class: c([a(f)("table-wrapper"), e.card ? a(f)("table-wrapper-card") : null]),
321
+ style: b(e.tableWrapperStyle)
322
+ }, [
323
+ m("div", {
324
+ class: c(a(i)("header-wrapper"))
325
+ }, [
326
+ A(e.$slots, "title", {
327
+ selectedRows: a(P),
328
+ selectedRowKeys: a(_),
329
+ shownColumns: g.value
330
+ })
331
+ ], 2),
332
+ m("div", {
333
+ class: c(a(i)("grid-wrapper"))
334
+ }, [
335
+ R(a(Ce), {
336
+ style: { height: "100%" },
337
+ "row-data": a(y).records,
338
+ "column-defs": $.value,
339
+ "default-col-def": j.value,
340
+ "locale-text": {
341
+ noRowsToShow: ""
342
+ // 为了隐藏默认的无数据提示,因为外部已经自行实现了loading
343
+ },
344
+ "row-selection": oe.value,
345
+ "selection-column-def": te.value,
346
+ "get-row-id": de,
347
+ "pinned-top-row-data": (n = e.summary) == null ? void 0 : n.top,
348
+ "pinned-bottom-row-data": (o = e.summary) == null ? void 0 : o.bottom,
349
+ onSortChanged: U,
350
+ onGridReady: r[0] || (r[0] = (l) => B.value = l.api),
351
+ onRowDataUpdated: re,
352
+ onRowSelected: ae
353
+ }, null, 8, ["row-data", "column-defs", "default-col-def", "row-selection", "selection-column-def", "pinned-top-row-data", "pinned-bottom-row-data"]),
354
+ ye(m("div", {
355
+ class: c(a(f)("table-loading-wrapper"))
356
+ }, [
357
+ R(a(ve), { delay: 300 })
358
+ ], 2), [
359
+ [Se, ne.value]
360
+ ])
361
+ ], 2),
362
+ m("div", {
363
+ class: c(a(i)("pagination-wrapper"))
364
+ }, [
365
+ e.pagination !== !1 ? (p(), W(a(xe), N({
366
+ key: 0,
367
+ class: a(i)("pagination")
368
+ }, a(k).pagination, { onChange: se }), null, 16, ["class"])) : z("", !0)
369
+ ], 2)
370
+ ], 6)
371
+ ], 6);
372
+ };
373
+ }
374
+ });
375
+ export {
376
+ no as default
377
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,194 @@
1
+ import { CSSProperties, VNode } from 'vue';
2
+ import { ApTablePaginationConfig, ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, ExtraProColumnType, FieldPropsType, RequestData, ValueEnum } from '../ap-table/interface';
3
+ import { TableProps } from '@aplus-frontend/antdv';
4
+ import { ApFormSearchFormProps } from '../ap-form/interface';
5
+ import { Recordable } from '../type';
6
+ import { SortOrder, TableRowSelection } from '@aplus-frontend/antdv/es/table/interface';
7
+ import { ColDef, IRowNode } from 'ag-grid-community';
8
+ export type AgGridColumnType<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' | 'width' | 'maxWidth' | 'className' | 'class'> & {
9
+ children?: AgGridColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>[];
10
+ /**
11
+ * 表单项所占据的格子数(1-24格)
12
+ */
13
+ span?: number;
14
+ tooltip?: string | ((column: AgGridColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>) => VNode);
15
+ /**
16
+ * 是否可以复制
17
+ */
18
+ copyable?: boolean;
19
+ /**
20
+ * 配置溢出隐藏的方式
21
+ * @description 如果传递数字,则表示需要满足溢出隐藏的行数,此时默认会显示tooltip
22
+ */
23
+ ellipsis?: number | boolean | 'ellipsis' | 'title' | 'tooltip';
24
+ /**
25
+ * 是否搜索表单中隐藏
26
+ */
27
+ hideInSearch?: boolean;
28
+ /**
29
+ * 是否在表格中隐藏
30
+ */
31
+ hideInTable?: boolean;
32
+ /**
33
+ * 值的枚举,会自动转化把值当成 key 来取出要显示的内容(也会作为select等组件的选项)
34
+ */
35
+ valueEnum?: ValueEnum;
36
+ /**
37
+ * 自定义查询表单渲染
38
+ */
39
+ customRenderFormItem?: (config: AgGridColumnType<RecordType>) => any;
40
+ /**
41
+ * 自定义渲染文本,和customRender相比,其必须返回字符串,并且后续的渲染(例如copy/ellipsis)都将使用这个值
42
+ */
43
+ renderText?: (option: {
44
+ value: any;
45
+ text: any;
46
+ record: RecordType;
47
+ column: AgGridColumnType<RecordType>;
48
+ }) => string;
49
+ /**
50
+ * 指定值类型(将会用于默认渲染和查询表单生成)
51
+ */
52
+ valueType?: MergedValueType;
53
+ /**
54
+ * 值类型额外配置的参数(用于查询表单渲染)
55
+ */
56
+ fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
57
+ /**
58
+ * 用于表单项排序的字段
59
+ * @description 值越大,越排在前面,请设置正整数,设置为0或负数将会无效
60
+ */
61
+ order?: number;
62
+ /**
63
+ * 用于表格列排序,设置为`true`表示开启后端排序,传入自定义比较函数表示使用前端排序
64
+ */
65
+ sorter?: true | ColDef['comparator'];
66
+ /**
67
+ * 自定义渲染,添加了`originalNode、originalText`
68
+ * @param opt
69
+ * @returns
70
+ */
71
+ customRender?: (opt: {
72
+ value: any;
73
+ text: any;
74
+ record: RecordType;
75
+ column: AgGridColumnType<RecordType>;
76
+ originalNode?: VNode;
77
+ originalText?: any;
78
+ }) => any;
79
+ width?: number;
80
+ minWidth?: number;
81
+ maxWidth?: number;
82
+ /**
83
+ * 为当前单元格添加类名
84
+ * @returns
85
+ */
86
+ cellClass?: string | string[] | ((data: RecordType, node: IRowNode<RecordType>) => string | string[] | undefined) | undefined;
87
+ } : null;
88
+ export type AgGridRowSelection<RecordType> = Pick<TableRowSelection<RecordType>, 'type' | 'fixed' | 'columnWidth' | 'defaultSelectedRowKeys'> & {
89
+ /**
90
+ * 设置禁用的列
91
+ * @param row
92
+ * @returns
93
+ */
94
+ disabled?: (row: RecordType) => boolean;
95
+ };
96
+ export type AgGridProps<RecordType = any, ParamsType = any> = Omit<TableProps<RecordType>, 'columns' | 'pagination' | 'dataSource' | 'size' | 'rowSelection' | 'rowClassName' | 'footer' | 'loading' | 'sticky'> & {
97
+ /**
98
+ * 列配置
99
+ */
100
+ columns?: AgGridColumnType<RecordType, any>[];
101
+ /**
102
+ * 行选中配置
103
+ */
104
+ rowSelection?: true | AgGridRowSelection<RecordType>;
105
+ /**
106
+ * 是否启用卡片样式
107
+ */
108
+ card?: boolean;
109
+ /**
110
+ * request额外请求的参数
111
+ * 数据变化后将会重新发起网络请求
112
+ */
113
+ params?: ParamsType;
114
+ /**
115
+ * 请求获取dataSource
116
+ * @param params
117
+ * @returns
118
+ */
119
+ request?: (params: Partial<ParamsType> & {
120
+ pageSize: number;
121
+ current: number;
122
+ sort?: Record<string, SortOrder>;
123
+ filter?: Recordable<any>;
124
+ }) => Promise<Partial<RequestData<RecordType>>>;
125
+ /**
126
+ * 表格的默认数据源,这些数据源将会在第一次请求后被替换
127
+ */
128
+ defaultData?: RecordType[];
129
+ /**
130
+ * 表格的最终数据源(设置后request和defaultData都不会生效),离线表格的效果
131
+ */
132
+ dataSource?: RecordType[];
133
+ /**
134
+ * 表格loading状态变更后触发
135
+ * @param loading
136
+ * @returns
137
+ */
138
+ onLoadingChange?: (loading: boolean) => void;
139
+ /**
140
+ * 当可显示列变更后触发
141
+ * @returns
142
+ */
143
+ onShownColumnsChange?: (columns: AgGridColumnType<RecordType>[]) => void;
144
+ /**
145
+ * 查询表单配置,设置为false表示不渲染查询表单
146
+ */
147
+ searchForm?: false | ApFormSearchFormProps;
148
+ /**
149
+ * 查询表单提交之前,一般用于自定义对查询数据进行变更
150
+ * @param params
151
+ * @returns
152
+ */
153
+ beforeSearchSubmit?: (params: Partial<ParamsType>) => any;
154
+ /**
155
+ * 是否显示分页器(特定的分页器)或者指定默认的当前页和pageSize
156
+ */
157
+ pagination?: false | ApTablePaginationConfig;
158
+ /**
159
+ * 自定义查询表单容器样式
160
+ */
161
+ searchFormWrapperStyle?: CSSProperties;
162
+ /**
163
+ * 自定义表格样式
164
+ */
165
+ tableWrapperStyle?: CSSProperties;
166
+ /**
167
+ * 表格最外层容器自定义样式
168
+ */
169
+ wrapperStyle?: CSSProperties;
170
+ /**
171
+ * 是否手动发起第一次网络请求
172
+ */
173
+ manual?: boolean;
174
+ /**
175
+ * 表格尺寸(只支持中等大小和小尺寸)
176
+ */
177
+ size?: 'medium' | 'mini';
178
+ /**
179
+ * 表格是否自适应高度
180
+ */
181
+ adaptive?: boolean;
182
+ /**
183
+ * 设置表格列是否可以resize,还可以进行更多可变尺寸配置
184
+ */
185
+ columnResizable?: boolean;
186
+ loading?: boolean;
187
+ /**
188
+ * 设置总结栏
189
+ */
190
+ summary?: {
191
+ top?: RecordType[];
192
+ bottom?: RecordType[];
193
+ };
194
+ };
@@ -0,0 +1 @@
1
+
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ag-grid/index.css';
File without changes
@@ -0,0 +1 @@
1
+ import '@aplus-frontend/ui/theme/ag-grid/index.less';
@@ -343,7 +343,7 @@ const Gt = /* @__PURE__ */ $e({
343
343
  return (r = s.value) == null ? void 0 : r.scrollToRow(l, t);
344
344
  }
345
345
  return B(
346
- () => [o.columnResizable, o.columns],
346
+ [o.columnResizable, o.columns],
347
347
  () => {
348
348
  var t;
349
349
  const e = _e();
@@ -1,11 +1,22 @@
1
+ import { DataIndex } from '@aplus-frontend/antdv/es/vc-table/interface';
1
2
  import { ApGridColumnType, ColConfigType } from '../interface';
2
3
  import { ValueTypeRenderConfig } from '../../config-provider';
4
+ export declare function dataIndexToField(dataIndex: DataIndex): string | undefined;
5
+ export declare function transformFixed(fixed: ApGridColumnType['fixed']): "left" | "right" | undefined;
3
6
  /**
4
7
  * 转换分组页
5
8
  * @param columnConfig
6
9
  * @returns
7
10
  */
8
11
  export declare function transformToColGroup<RecordType>(columnConfig: ApGridColumnType<RecordType>, color: string, className: string): ColConfigType;
12
+ /**
13
+ * 自定义渲染表格内容(返回节点)
14
+ * @param param0
15
+ * @param columnConfig
16
+ * @param extraValueType
17
+ * @returns
18
+ */
19
+ export declare const contentCustom: ({ value, ...restProps }: any, columnConfig: any, extraValueType: any) => any;
9
20
  /**
10
21
  * 转换渲染列
11
22
  * @param columnConfig