vxe-table 3.15.34 → 3.15.35
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/style.css +1 -1
- package/es/table/src/body.js +20 -3
- package/es/table/src/cell.js +52 -36
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/methods.js +117 -69
- package/es/table/src/props.js +3 -1
- package/es/table/src/table.js +19 -6
- package/es/table/src/util.js +5 -2
- package/es/ui/index.js +4 -4
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +227 -109
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +19 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +43 -28
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +2 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +129 -65
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +3 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +19 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +7 -4
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +4 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/body.ts +20 -3
- package/packages/table/src/cell.ts +52 -36
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/methods.ts +122 -68
- package/packages/table/src/props.ts +3 -1
- package/packages/table/src/table.ts +20 -6
- package/packages/table/src/util.ts +6 -2
- package/packages/ui/index.ts +3 -3
- /package/es/{iconfont.1749092456241.ttf → iconfont.1749202936550.ttf} +0 -0
- /package/es/{iconfont.1749092456241.woff → iconfont.1749202936550.woff} +0 -0
- /package/es/{iconfont.1749092456241.woff2 → iconfont.1749202936550.woff2} +0 -0
- /package/lib/{iconfont.1749092456241.ttf → iconfont.1749202936550.ttf} +0 -0
- /package/lib/{iconfont.1749092456241.woff → iconfont.1749202936550.woff} +0 -0
- /package/lib/{iconfont.1749092456241.woff2 → iconfont.1749202936550.woff2} +0 -0
|
@@ -270,11 +270,11 @@ function renderCellHandle (h: CreateElement, params: VxeTableDefines.CellRenderB
|
|
|
270
270
|
const { editConfig } = tableProps
|
|
271
271
|
const { isRowGroupStatus } = tableReactData
|
|
272
272
|
const { type, treeNode, rowGroupNode, editRender } = column
|
|
273
|
-
const
|
|
274
|
-
const { mode } =
|
|
273
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
274
|
+
const { mode } = aggregateOpts
|
|
275
275
|
const checkboxOpts = $table.computeCheckboxOpts
|
|
276
276
|
const editOpts = $table.computeEditOpts
|
|
277
|
-
const isDeepCell = treeNode || (isRowGroupStatus &&
|
|
277
|
+
const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode))
|
|
278
278
|
switch (type) {
|
|
279
279
|
case 'seq':
|
|
280
280
|
return isDeepCell ? Cell.renderDeepIndexCell(h, params) : Cell.renderSeqCell(h, params)
|
|
@@ -375,7 +375,7 @@ export const Cell = {
|
|
|
375
375
|
const tableReactData = $table as unknown as TableReactData
|
|
376
376
|
const tableInternalData = $table as unknown as TableInternalData
|
|
377
377
|
const { isRowGroupStatus } = tableReactData
|
|
378
|
-
const { field, slots, editRender, cellRender, rowGroupNode } = column
|
|
378
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column
|
|
379
379
|
const renderOpts = editRender || cellRender
|
|
380
380
|
if (slots && slots.default) {
|
|
381
381
|
return renderCellBaseVNs(h, params, $table.callSlot(slots.default, params, h))
|
|
@@ -390,38 +390,50 @@ export const Cell = {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
let cellValue: string | number | null = ''
|
|
393
|
-
if (isRowGroupStatus && row.isAggregate) {
|
|
393
|
+
if (isRowGroupStatus && field && row.isAggregate) {
|
|
394
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = row
|
|
394
395
|
const { fullColumnFieldData } = tableInternalData
|
|
395
|
-
const
|
|
396
|
-
const { mode, showTotal, totalMethod, countFields,
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
const
|
|
396
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
397
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, mapChildrenField } = aggregateOpts
|
|
398
|
+
const aggMethod = aggregateOpts.aggregateMethod || aggregateOpts.countMethod
|
|
399
|
+
const groupField = aggRow.groupField
|
|
400
|
+
const groupContent = aggRow.groupContent
|
|
401
|
+
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : []
|
|
402
|
+
const childCount = aggRow.childCount
|
|
401
403
|
const colRest = fullColumnFieldData[groupField] || {}
|
|
402
|
-
const
|
|
404
|
+
const ctParams = {
|
|
403
405
|
$table,
|
|
404
406
|
groupField,
|
|
405
407
|
groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
|
|
406
408
|
column,
|
|
407
409
|
groupValue: groupContent,
|
|
408
410
|
children: childList,
|
|
409
|
-
|
|
411
|
+
childCount,
|
|
412
|
+
aggValue: null as any,
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* 已废弃
|
|
416
|
+
* @deprecated
|
|
417
|
+
*/
|
|
418
|
+
totalValue: childCount
|
|
410
419
|
}
|
|
411
|
-
if (mode === 'column' ?
|
|
420
|
+
if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
|
|
412
421
|
cellValue = groupContent
|
|
413
422
|
if (contentMethod) {
|
|
414
|
-
cellValue = `${contentMethod(
|
|
423
|
+
cellValue = `${contentMethod(ctParams)}`
|
|
415
424
|
}
|
|
416
425
|
if (showTotal) {
|
|
417
|
-
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(
|
|
426
|
+
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
|
|
418
427
|
}
|
|
419
|
-
} else if (
|
|
420
|
-
|
|
421
|
-
|
|
428
|
+
} else if ($table.getPivotTableAggregateCellAggValue) {
|
|
429
|
+
cellValue = $table.getPivotTableAggregateCellAggValue(params)
|
|
430
|
+
} else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
431
|
+
if (aggMethod) {
|
|
432
|
+
ctParams.aggValue = childCount
|
|
433
|
+
cellValue = `${aggMethod(ctParams)}`
|
|
422
434
|
}
|
|
423
435
|
}
|
|
424
|
-
} else
|
|
436
|
+
} else {
|
|
425
437
|
cellValue = $table.getCellLabel(row, column)
|
|
426
438
|
}
|
|
427
439
|
const cellPlaceholder = editRender ? editRender.placeholder : ''
|
|
@@ -455,8 +467,8 @@ export const Cell = {
|
|
|
455
467
|
const { row, level } = params
|
|
456
468
|
const { rowGroupExpandedFlag } = tableReactData
|
|
457
469
|
const { rowGroupExpandedMaps } = tableInternalData
|
|
458
|
-
const
|
|
459
|
-
const { padding, indent } =
|
|
470
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
471
|
+
const { padding, indent } = aggregateOpts
|
|
460
472
|
const rowid = getRowid($table, row)
|
|
461
473
|
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
|
|
462
474
|
return h('div', {
|
|
@@ -469,18 +481,20 @@ export const Cell = {
|
|
|
469
481
|
}
|
|
470
482
|
: undefined
|
|
471
483
|
}, [
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
484
|
+
row.isAggregate
|
|
485
|
+
? h('span', {
|
|
486
|
+
class: 'vxe-row-group--node-btn',
|
|
487
|
+
on: {
|
|
488
|
+
click (evnt: MouseEvent) {
|
|
489
|
+
$table.triggerRowGroupExpandEvent(evnt, params)
|
|
490
|
+
}
|
|
477
491
|
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
}, [
|
|
493
|
+
h('i', {
|
|
494
|
+
class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
|
|
495
|
+
})
|
|
496
|
+
])
|
|
497
|
+
: renderEmptyElement($table),
|
|
484
498
|
h('div', {
|
|
485
499
|
class: 'vxe-row-group-cell'
|
|
486
500
|
}, cellVNodes)
|
|
@@ -563,9 +577,11 @@ export const Cell = {
|
|
|
563
577
|
renderDeepNodeBtn (h: CreateElement, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
|
|
564
578
|
const { $table, row, column } = params
|
|
565
579
|
const { rowGroupNode } = column
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
580
|
+
const tableReactData = $table as unknown as TableReactData
|
|
581
|
+
const { rowGroupList } = tableReactData
|
|
582
|
+
if (rowGroupList.length) {
|
|
583
|
+
const aggregateOpts = $table.computeAggregateOpts
|
|
584
|
+
const { mode } = aggregateOpts
|
|
569
585
|
if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
|
|
570
586
|
return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
|
|
571
587
|
}
|
|
@@ -103,6 +103,7 @@ export class ColumnInfo {
|
|
|
103
103
|
titleHelp: _vm.titleHelp,
|
|
104
104
|
titlePrefix: _vm.titlePrefix,
|
|
105
105
|
titleSuffix: _vm.titleSuffix,
|
|
106
|
+
aggFunc: _vm.aggFunc,
|
|
106
107
|
// 自定义参数
|
|
107
108
|
params: _vm.params,
|
|
108
109
|
// 渲染属性
|
|
@@ -128,6 +129,8 @@ export class ColumnInfo {
|
|
|
128
129
|
sortNumber: 0, // 用于记录自定义列顺序
|
|
129
130
|
renderSortNumber: 0, // 用于记录自定义列顺序
|
|
130
131
|
|
|
132
|
+
renderAggFn: '',
|
|
133
|
+
|
|
131
134
|
renderFixed: '',
|
|
132
135
|
renderVisible: false,
|
|
133
136
|
|
|
@@ -447,8 +447,8 @@ function handleRowGroupBaseExpand ($xeTable: VxeTableConstructor & VxeTablePriva
|
|
|
447
447
|
const internalData = $xeTable as unknown as TableInternalData
|
|
448
448
|
|
|
449
449
|
const { fullAllDataRowIdData, tableFullGroupData, rowGroupExpandedMaps } = internalData
|
|
450
|
-
const
|
|
451
|
-
const { mapChildrenField, accordion } =
|
|
450
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
451
|
+
const { mapChildrenField, accordion } = aggregateOpts
|
|
452
452
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
453
453
|
let validRows = rows
|
|
454
454
|
if (mapChildrenField) {
|
|
@@ -602,7 +602,7 @@ function handleVirtualTreeToList ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
602
602
|
const { treeConfig } = props
|
|
603
603
|
const { isRowGroupStatus } = reactData
|
|
604
604
|
const { fullAllDataRowIdData, treeExpandedMaps, rowGroupExpandedMaps } = internalData
|
|
605
|
-
const
|
|
605
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
606
606
|
const treeOpts = $xeTable.computeTreeOpts
|
|
607
607
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
608
608
|
const fullData: any[] = []
|
|
@@ -627,7 +627,7 @@ function handleVirtualTreeToList ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
627
627
|
updateScrollYStatus($xeTable, fullData)
|
|
628
628
|
return fullData
|
|
629
629
|
} else if (isRowGroupStatus) {
|
|
630
|
-
const { childrenField } =
|
|
630
|
+
const { childrenField } = aggregateOpts
|
|
631
631
|
XEUtils.eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
|
|
632
632
|
const rowid = handleGetRowId(row)
|
|
633
633
|
const parentRowid = handleGetRowId(parentRow)
|
|
@@ -661,7 +661,7 @@ function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
661
661
|
const { tableFullColumn, tableFullData, tableFullTreeData, tableFullGroupData } = internalData
|
|
662
662
|
const filterOpts = $xeTable.computeFilterOpts
|
|
663
663
|
const sortOpts = $xeTable.computeSortOpts
|
|
664
|
-
const
|
|
664
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
665
665
|
const treeOpts = $xeTable.computeTreeOpts
|
|
666
666
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
667
667
|
const { transform, rowField, parentField, mapChildrenField } = treeOpts
|
|
@@ -728,8 +728,8 @@ function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
728
728
|
tableTree = XEUtils.searchTree(tableFullGroupData, handleFilter, {
|
|
729
729
|
original: true,
|
|
730
730
|
isEvery: true,
|
|
731
|
-
children:
|
|
732
|
-
mapChildren:
|
|
731
|
+
children: aggregateOpts.mapChildrenField,
|
|
732
|
+
mapChildren: aggregateOpts.childrenField
|
|
733
733
|
})
|
|
734
734
|
tableData = tableTree
|
|
735
735
|
} else if (treeConfig && transform) {
|
|
@@ -751,8 +751,8 @@ function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
751
751
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
752
752
|
original: true,
|
|
753
753
|
isEvery: true,
|
|
754
|
-
children:
|
|
755
|
-
mapChildren:
|
|
754
|
+
children: aggregateOpts.mapChildrenField,
|
|
755
|
+
mapChildren: aggregateOpts.childrenField
|
|
756
756
|
})
|
|
757
757
|
tableData = tableTree
|
|
758
758
|
} else if (treeConfig && transform) {
|
|
@@ -780,17 +780,17 @@ function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
780
780
|
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
|
|
781
781
|
} else {
|
|
782
782
|
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
783
|
-
key:
|
|
784
|
-
parentKey:
|
|
785
|
-
children:
|
|
783
|
+
key: aggregateOpts.rowField,
|
|
784
|
+
parentKey: aggregateOpts.parentField,
|
|
785
|
+
children: aggregateOpts.mapChildrenField
|
|
786
786
|
})
|
|
787
787
|
tableTree = XEUtils.toArrayTree(
|
|
788
788
|
XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField($xeTable, column), order])),
|
|
789
789
|
{
|
|
790
|
-
key:
|
|
791
|
-
parentKey:
|
|
792
|
-
children:
|
|
793
|
-
mapChildren:
|
|
790
|
+
key: aggregateOpts.rowField,
|
|
791
|
+
parentKey: aggregateOpts.parentField,
|
|
792
|
+
children: aggregateOpts.childrenField,
|
|
793
|
+
mapChildren: aggregateOpts.mapChildrenField
|
|
794
794
|
}
|
|
795
795
|
)
|
|
796
796
|
}
|
|
@@ -844,8 +844,8 @@ function updateAfterFullData ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
844
844
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
845
845
|
original: true,
|
|
846
846
|
isEvery: true,
|
|
847
|
-
children:
|
|
848
|
-
mapChildren:
|
|
847
|
+
children: aggregateOpts.mapChildrenField,
|
|
848
|
+
mapChildren: aggregateOpts.childrenField
|
|
849
849
|
})
|
|
850
850
|
tableData = tableTree
|
|
851
851
|
} else if (treeConfig && transform) {
|
|
@@ -1336,7 +1336,7 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1336
1336
|
const { isRowGroupStatus } = reactData
|
|
1337
1337
|
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps } = internalData
|
|
1338
1338
|
const treeOpts = $xeTable.computeTreeOpts
|
|
1339
|
-
const
|
|
1339
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
1340
1340
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
1341
1341
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
1342
1342
|
const { checkField, reserve, checkMethod } = checkboxOpts
|
|
@@ -1384,7 +1384,7 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1384
1384
|
const rowid = handleGetRowId(row)
|
|
1385
1385
|
selectRowMaps[rowid] = row
|
|
1386
1386
|
}
|
|
1387
|
-
}, { children:
|
|
1387
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
1388
1388
|
} else {
|
|
1389
1389
|
/**
|
|
1390
1390
|
* 如果是树取消
|
|
@@ -1396,7 +1396,7 @@ function handleCheckedAllCheckboxRow ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1396
1396
|
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
1397
1397
|
selectRowMaps[rowid] = row
|
|
1398
1398
|
}
|
|
1399
|
-
}, { children:
|
|
1399
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
1402
|
} else if (treeConfig) {
|
|
@@ -2711,12 +2711,54 @@ const handleUpdateRowGroup = ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
2711
2711
|
: []
|
|
2712
2712
|
}
|
|
2713
2713
|
|
|
2714
|
+
function handleeGroupSummary ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, aggList: VxeTableDefines.AggregateRowInfo[]) {
|
|
2715
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
2716
|
+
const { mapChildrenField } = aggregateOpts
|
|
2717
|
+
if (mapChildrenField) {
|
|
2718
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
2719
|
+
let count = 0
|
|
2720
|
+
XEUtils.each(aggRow[mapChildrenField], (row: VxeTableDefines.AggregateRowInfo) => {
|
|
2721
|
+
if (row.isAggregate) {
|
|
2722
|
+
count += row.childCount || 0
|
|
2723
|
+
} else {
|
|
2724
|
+
count++
|
|
2725
|
+
}
|
|
2726
|
+
})
|
|
2727
|
+
aggRow.childCount = count
|
|
2728
|
+
})
|
|
2729
|
+
if ($xeTable.handlePivotTableAggregateData) {
|
|
2730
|
+
$xeTable.handlePivotTableAggregateData(aggList)
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
function updateGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
2736
|
+
const props = $xeTable
|
|
2737
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
2738
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2739
|
+
|
|
2740
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
2741
|
+
const { isRowGroupStatus } = reactData
|
|
2742
|
+
const { tableFullGroupData } = internalData
|
|
2743
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
2744
|
+
const { mapChildrenField } = aggregateOpts
|
|
2745
|
+
if ((aggregateConfig || rowGroupConfig) && isRowGroupStatus) {
|
|
2746
|
+
const aggList: VxeTableDefines.AggregateRowInfo[] = []
|
|
2747
|
+
XEUtils.eachTree(tableFullGroupData, row => {
|
|
2748
|
+
if (row.isAggregate) {
|
|
2749
|
+
aggList.push(row)
|
|
2750
|
+
}
|
|
2751
|
+
}, { children: mapChildrenField })
|
|
2752
|
+
handleeGroupSummary($xeTable, aggList)
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2714
2756
|
function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, list: any[], rowGroups: VxeTableDefines.RowGroupItem[]) {
|
|
2715
2757
|
let fullData = list
|
|
2716
2758
|
let treeData = list
|
|
2717
2759
|
if (rowGroups) {
|
|
2718
|
-
const
|
|
2719
|
-
const { rowField, parentField, childrenField, mapChildrenField } =
|
|
2760
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
2761
|
+
const { rowField, parentField, childrenField, mapChildrenField } = aggregateOpts
|
|
2720
2762
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
2721
2763
|
const { checkField } = checkboxOpts
|
|
2722
2764
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
@@ -2727,7 +2769,7 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2727
2769
|
const groupField = rgItem.field
|
|
2728
2770
|
const groupColumn = $xeTable.getColumnByField(groupField)
|
|
2729
2771
|
const groupMaps: Record<string, any[]> = {}
|
|
2730
|
-
const
|
|
2772
|
+
const aggList: VxeTableDefines.AggregateRowInfo[] = []
|
|
2731
2773
|
const rowkey = getRowkey($xeTable)
|
|
2732
2774
|
list.forEach((row) => {
|
|
2733
2775
|
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField)
|
|
@@ -2744,12 +2786,12 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2744
2786
|
})
|
|
2745
2787
|
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
2746
2788
|
const { fullData: childFullData, treeData: childTreeData } = handleGroupData($xeTable, childList, rowGroups.slice(1))
|
|
2747
|
-
const
|
|
2748
|
-
const groupRow = {
|
|
2789
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = {
|
|
2749
2790
|
isAggregate: true,
|
|
2750
|
-
|
|
2791
|
+
aggData: {},
|
|
2751
2792
|
groupContent: groupValue,
|
|
2752
2793
|
groupField,
|
|
2794
|
+
childCount: 0,
|
|
2753
2795
|
[rowField]: getRowUniqueId(),
|
|
2754
2796
|
[parentField]: null,
|
|
2755
2797
|
[rowkey]: getRowUniqueId(),
|
|
@@ -2757,29 +2799,19 @@ function handleGroupData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2757
2799
|
[mapChildrenField]: childTreeData
|
|
2758
2800
|
}
|
|
2759
2801
|
if (checkField) {
|
|
2760
|
-
|
|
2802
|
+
aggRow[checkField] = false
|
|
2761
2803
|
}
|
|
2762
2804
|
if (indeterminateField) {
|
|
2763
|
-
|
|
2805
|
+
aggRow[indeterminateField] = false
|
|
2764
2806
|
}
|
|
2765
|
-
|
|
2766
|
-
treeData.push(
|
|
2767
|
-
fullData.push(
|
|
2807
|
+
aggList.push(aggRow)
|
|
2808
|
+
treeData.push(aggRow)
|
|
2809
|
+
fullData.push(aggRow)
|
|
2768
2810
|
if (childFullData.length) {
|
|
2769
2811
|
fullData.push(...childFullData)
|
|
2770
2812
|
}
|
|
2771
2813
|
})
|
|
2772
|
-
|
|
2773
|
-
let count = 0
|
|
2774
|
-
XEUtils.each(groupItem[childrenField], row => {
|
|
2775
|
-
if (row.isAggregate) {
|
|
2776
|
-
count += row[childrenField] ? row[childrenField].length : 0
|
|
2777
|
-
} else {
|
|
2778
|
-
count++
|
|
2779
|
-
}
|
|
2780
|
-
})
|
|
2781
|
-
groupItem.childCount = count
|
|
2782
|
-
})
|
|
2814
|
+
handleeGroupSummary($xeTable, aggList)
|
|
2783
2815
|
}
|
|
2784
2816
|
}
|
|
2785
2817
|
return {
|
|
@@ -2797,7 +2829,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2797
2829
|
const reactData = $xeTable as unknown as TableReactData
|
|
2798
2830
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2799
2831
|
|
|
2800
|
-
const { keepSource, treeConfig, rowGroupConfig } = props
|
|
2832
|
+
const { keepSource, treeConfig, aggregateConfig, rowGroupConfig } = props
|
|
2801
2833
|
const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData
|
|
2802
2834
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
2803
2835
|
const rowOpts = $xeTable.computeRowOpts
|
|
@@ -2811,11 +2843,11 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2811
2843
|
errLog('vxe.error.errMaxRow', [supportMaxRow])
|
|
2812
2844
|
}
|
|
2813
2845
|
if (treeConfig && rowGroupList.length) {
|
|
2814
|
-
errLog('vxe.error.noTree', ['
|
|
2846
|
+
errLog('vxe.error.noTree', ['aggregate-config'])
|
|
2815
2847
|
return $xeTable.$nextTick()
|
|
2816
2848
|
}
|
|
2817
2849
|
if (rowOpts.drag && rowGroupList.length) {
|
|
2818
|
-
errLog('vxe.error.errConflicts', ['row-config.drag', '
|
|
2850
|
+
errLog('vxe.error.errConflicts', ['row-config.drag', 'aggregate-config'])
|
|
2819
2851
|
return $xeTable.$nextTick()
|
|
2820
2852
|
}
|
|
2821
2853
|
let isRGroup = false
|
|
@@ -2852,7 +2884,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2852
2884
|
} else {
|
|
2853
2885
|
treeData = fullData.slice(0)
|
|
2854
2886
|
}
|
|
2855
|
-
} else if (rowGroupConfig && rowGroupList.length) {
|
|
2887
|
+
} else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
|
|
2856
2888
|
const groupRest = handleGroupData($xeTable, fullData, rowGroupList)
|
|
2857
2889
|
treeData = groupRest.treeData
|
|
2858
2890
|
fullData = groupRest.fullData
|
|
@@ -2964,12 +2996,16 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2964
2996
|
if (oldScrollYLoad === sYLoad) {
|
|
2965
2997
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2966
2998
|
.then(() => {
|
|
2999
|
+
calcCellHeight($xeTable)
|
|
3000
|
+
updateRowOffsetTop($xeTable)
|
|
2967
3001
|
resolve()
|
|
2968
3002
|
})
|
|
2969
3003
|
} else {
|
|
2970
3004
|
setTimeout(() => {
|
|
2971
3005
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2972
3006
|
.then(() => {
|
|
3007
|
+
calcCellHeight($xeTable)
|
|
3008
|
+
updateRowOffsetTop($xeTable)
|
|
2973
3009
|
resolve()
|
|
2974
3010
|
})
|
|
2975
3011
|
})
|
|
@@ -3226,6 +3262,7 @@ function handleColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
3226
3262
|
$xeTable.clearMergeCells()
|
|
3227
3263
|
$xeTable.clearMergeFooterItems()
|
|
3228
3264
|
$xeTable.handleTableData(true)
|
|
3265
|
+
$xeTable.handleAggregateSummaryData()
|
|
3229
3266
|
|
|
3230
3267
|
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3231
3268
|
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
@@ -3938,8 +3975,8 @@ const Methods = {
|
|
|
3938
3975
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
3939
3976
|
}, { children: childrenField })
|
|
3940
3977
|
} else if (isRowGroupStatus) {
|
|
3941
|
-
const
|
|
3942
|
-
const { mapChildrenField } =
|
|
3978
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
3979
|
+
const { mapChildrenField } = aggregateOpts
|
|
3943
3980
|
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
3944
3981
|
const rowid = handleUpdateRowId(row)
|
|
3945
3982
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
@@ -6385,6 +6422,11 @@ const Methods = {
|
|
|
6385
6422
|
internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList)
|
|
6386
6423
|
reactData.mergeFootFlag++
|
|
6387
6424
|
},
|
|
6425
|
+
handleAggregateSummaryData () {
|
|
6426
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6427
|
+
|
|
6428
|
+
return updateGroupData($xeTable)
|
|
6429
|
+
},
|
|
6388
6430
|
handleTargetLeaveEvent () {
|
|
6389
6431
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6390
6432
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -6695,7 +6737,7 @@ const Methods = {
|
|
|
6695
6737
|
const { treeConfig } = props
|
|
6696
6738
|
const { isRowGroupStatus } = reactData
|
|
6697
6739
|
const { selectCheckboxMaps } = internalData
|
|
6698
|
-
const
|
|
6740
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
6699
6741
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6700
6742
|
const { transform, mapChildrenField } = treeOpts
|
|
6701
6743
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -6747,7 +6789,7 @@ const Methods = {
|
|
|
6747
6789
|
}
|
|
6748
6790
|
handleCheckboxReserveRow($xeTable, row, checked)
|
|
6749
6791
|
}
|
|
6750
|
-
}, { children:
|
|
6792
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
6751
6793
|
reactData.updateCheckboxFlag++
|
|
6752
6794
|
return
|
|
6753
6795
|
} else if (treeConfig) {
|
|
@@ -6898,7 +6940,7 @@ const Methods = {
|
|
|
6898
6940
|
const { treeConfig } = props
|
|
6899
6941
|
const { isRowGroupStatus } = reactData
|
|
6900
6942
|
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
6901
|
-
const
|
|
6943
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
6902
6944
|
const treeOpts = $xeTable.computeTreeOpts
|
|
6903
6945
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6904
6946
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
@@ -6913,7 +6955,7 @@ const Methods = {
|
|
|
6913
6955
|
|
|
6914
6956
|
if (isRowGroupStatus) {
|
|
6915
6957
|
// 行分组
|
|
6916
|
-
const mapChildrenField =
|
|
6958
|
+
const mapChildrenField = aggregateOpts.mapChildrenField
|
|
6917
6959
|
if (mapChildrenField) {
|
|
6918
6960
|
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
6919
6961
|
const rowid = handleGetRowId(row)
|
|
@@ -7527,7 +7569,7 @@ const Methods = {
|
|
|
7527
7569
|
const radioOpts = $xeTable.computeRadioOpts
|
|
7528
7570
|
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
7529
7571
|
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
7530
|
-
const
|
|
7572
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
7531
7573
|
const rowOpts = $xeTable.computeRowOpts
|
|
7532
7574
|
const columnOpts = $xeTable.computeColumnOpts
|
|
7533
7575
|
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
@@ -7554,7 +7596,7 @@ const Methods = {
|
|
|
7554
7596
|
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
7555
7597
|
}
|
|
7556
7598
|
// 如果是行分组
|
|
7557
|
-
if ((
|
|
7599
|
+
if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
|
|
7558
7600
|
$xeTable.triggerRowGroupExpandEvent(evnt, params)
|
|
7559
7601
|
}
|
|
7560
7602
|
}
|
|
@@ -9034,9 +9076,9 @@ const Methods = {
|
|
|
9034
9076
|
const props = $xeTable
|
|
9035
9077
|
const internalData = $xeTable as unknown as TableInternalData
|
|
9036
9078
|
|
|
9037
|
-
const { rowGroupConfig } = props
|
|
9038
|
-
if (!rowGroupConfig) {
|
|
9039
|
-
errLog('vxe.error.reqProp', ['
|
|
9079
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
9080
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
9081
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
9040
9082
|
return $xeTable.$nextTick()
|
|
9041
9083
|
}
|
|
9042
9084
|
if (fieldOrColumns) {
|
|
@@ -9052,9 +9094,9 @@ const Methods = {
|
|
|
9052
9094
|
const props = $xeTable
|
|
9053
9095
|
const internalData = $xeTable as unknown as TableInternalData
|
|
9054
9096
|
|
|
9055
|
-
const { rowGroupConfig } = props
|
|
9056
|
-
if (!rowGroupConfig) {
|
|
9057
|
-
errLog('vxe.error.reqProp', ['
|
|
9097
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
9098
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
9099
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
9058
9100
|
return $xeTable.$nextTick()
|
|
9059
9101
|
}
|
|
9060
9102
|
handleUpdateRowGroup($xeTable, [])
|
|
@@ -9062,12 +9104,24 @@ const Methods = {
|
|
|
9062
9104
|
},
|
|
9063
9105
|
isRowGroupRecord (row: any) {
|
|
9064
9106
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9107
|
+
|
|
9108
|
+
warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord'])
|
|
9109
|
+
return $xeTable.isAggregateRecord(row)
|
|
9110
|
+
},
|
|
9111
|
+
isRowGroupExpandByRow (row: any) {
|
|
9112
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9113
|
+
|
|
9114
|
+
warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow'])
|
|
9115
|
+
return $xeTable.isAggregateExpandByRow(row)
|
|
9116
|
+
},
|
|
9117
|
+
isAggregateRecord (row: any) {
|
|
9118
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9065
9119
|
const reactData = $xeTable as unknown as TableReactData
|
|
9066
9120
|
|
|
9067
9121
|
const { isRowGroupStatus } = reactData
|
|
9068
9122
|
return isRowGroupStatus && row.isAggregate
|
|
9069
9123
|
},
|
|
9070
|
-
|
|
9124
|
+
isAggregateExpandByRow (row: any) {
|
|
9071
9125
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9072
9126
|
const reactData = $xeTable as unknown as TableReactData
|
|
9073
9127
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -9093,8 +9147,8 @@ const Methods = {
|
|
|
9093
9147
|
const internalData = $xeTable as unknown as TableInternalData
|
|
9094
9148
|
|
|
9095
9149
|
const { tableFullGroupData } = internalData
|
|
9096
|
-
const
|
|
9097
|
-
const { mapChildrenField } =
|
|
9150
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
9151
|
+
const { mapChildrenField } = aggregateOpts
|
|
9098
9152
|
const rgExpandedMaps: Record<string, any> = {}
|
|
9099
9153
|
if (expanded && mapChildrenField) {
|
|
9100
9154
|
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
@@ -9234,9 +9288,9 @@ const Methods = {
|
|
|
9234
9288
|
const internalData = $xeTable as unknown as TableInternalData
|
|
9235
9289
|
|
|
9236
9290
|
const { rowGroupExpandedMaps } = internalData
|
|
9237
|
-
const
|
|
9291
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
9238
9292
|
const { row, column } = params
|
|
9239
|
-
const { trigger } =
|
|
9293
|
+
const { trigger } = aggregateOpts
|
|
9240
9294
|
if (trigger === 'manual') {
|
|
9241
9295
|
return
|
|
9242
9296
|
}
|
|
@@ -10240,10 +10294,10 @@ const Methods = {
|
|
|
10240
10294
|
const { tableFullData } = internalData
|
|
10241
10295
|
const rests: Promise<any>[] = []
|
|
10242
10296
|
if (treeConfig || isRowGroupStatus) {
|
|
10243
|
-
const
|
|
10297
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
10244
10298
|
const treeOpts = $xeTable.computeTreeOpts
|
|
10245
10299
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
10246
|
-
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ?
|
|
10300
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField })
|
|
10247
10301
|
if (matchObj) {
|
|
10248
10302
|
const nodes = matchObj.nodes
|
|
10249
10303
|
nodes.forEach((row, index) => {
|
|
@@ -177,7 +177,9 @@ export default {
|
|
|
177
177
|
footerCellConfig: Object as PropType<VxeTablePropTypes.FooterCellConfig>,
|
|
178
178
|
// 行配置项
|
|
179
179
|
rowConfig: Object as PropType<VxeTablePropTypes.RowConfig>,
|
|
180
|
-
//
|
|
180
|
+
// 数据聚合配置项
|
|
181
|
+
aggregateConfig: Object as PropType<VxeTablePropTypes.AggregateConfig>,
|
|
182
|
+
// 已废弃,被 aggregateConfig 替换
|
|
181
183
|
rowGroupConfig: Object as PropType<VxeTablePropTypes.RowGroupConfig>,
|
|
182
184
|
// 当前行配置项
|
|
183
185
|
currentRowConfig: Object as PropType<VxeTablePropTypes.CurrentRowConfig>,
|