vxe-table 3.15.33 → 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/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.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 +21 -8
- package/es/table/src/util.js +5 -2
- package/es/table/style.css +9 -3
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +4 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +9 -3
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +229 -111
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.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 +21 -8
- 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/table/style/style.css +9 -3
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +9 -3
- package/lib/vxe-table/style/style.min.css +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 +22 -8
- package/packages/table/src/util.ts +6 -2
- package/packages/ui/index.ts +3 -3
- package/styles/components/table.scss +13 -9
- package/styles/theme/base.scss +0 -2
- package/styles/theme/dark.scss +4 -1
- package/styles/theme/light.scss +3 -0
- package/styles/variable.scss +3 -0
- /package/es/{iconfont.1749019365308.ttf → iconfont.1749202936550.ttf} +0 -0
- /package/es/{iconfont.1749019365308.woff → iconfont.1749202936550.woff} +0 -0
- /package/es/{iconfont.1749019365308.woff2 → iconfont.1749202936550.woff2} +0 -0
- /package/lib/{iconfont.1749019365308.ttf → iconfont.1749202936550.ttf} +0 -0
- /package/lib/{iconfont.1749019365308.woff → iconfont.1749202936550.woff} +0 -0
- /package/lib/{iconfont.1749019365308.woff2 → iconfont.1749202936550.woff2} +0 -0
|
@@ -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>,
|
|
@@ -777,13 +777,13 @@ export default {
|
|
|
777
777
|
const $xeTable = this
|
|
778
778
|
const props = $xeTable
|
|
779
779
|
|
|
780
|
-
return Object.assign({}, getConfig().table.
|
|
780
|
+
return Object.assign({}, getConfig().table.virtualXConfig || getConfig().table.scrollX, props.virtualXConfig || props.scrollX)
|
|
781
781
|
},
|
|
782
782
|
computeVirtualYOpts () {
|
|
783
783
|
const $xeTable = this
|
|
784
784
|
const props = $xeTable
|
|
785
785
|
|
|
786
|
-
return Object.assign({}, getConfig().table.
|
|
786
|
+
return Object.assign({}, getConfig().table.virtualYConfig || getConfig().table.scrollY, props.virtualYConfig || props.scrollY)
|
|
787
787
|
},
|
|
788
788
|
computeScrollbarOpts () {
|
|
789
789
|
const $xeTable = this
|
|
@@ -881,11 +881,16 @@ export default {
|
|
|
881
881
|
|
|
882
882
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
|
|
883
883
|
},
|
|
884
|
-
|
|
884
|
+
computeAggregateOpts () {
|
|
885
885
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
886
886
|
const props = $xeTable
|
|
887
887
|
|
|
888
|
-
return Object.assign({}, getConfig().table.rowGroupConfig, props.rowGroupConfig)
|
|
888
|
+
return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig)
|
|
889
|
+
},
|
|
890
|
+
computeRowGroupOpts () {
|
|
891
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
892
|
+
|
|
893
|
+
return $xeTable.computeAggregateOpts
|
|
889
894
|
},
|
|
890
895
|
computeCurrentRowOpts () {
|
|
891
896
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -1279,8 +1284,8 @@ export default {
|
|
|
1279
1284
|
computeRowGroupFields () {
|
|
1280
1285
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1281
1286
|
|
|
1282
|
-
const
|
|
1283
|
-
return
|
|
1287
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
1288
|
+
return aggregateOpts.groupFields
|
|
1284
1289
|
},
|
|
1285
1290
|
tabsResizeFlag () {
|
|
1286
1291
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -1564,8 +1569,8 @@ export default {
|
|
|
1564
1569
|
const currentRowOpts = $xeTable.computeCurrentRowOpts
|
|
1565
1570
|
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
1566
1571
|
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
1567
|
-
const
|
|
1568
|
-
const { groupFields } =
|
|
1572
|
+
const aggregateOpts = $xeTable.computeAggregateOpts
|
|
1573
|
+
const { groupFields } = aggregateOpts
|
|
1569
1574
|
|
|
1570
1575
|
if (props.rowId) {
|
|
1571
1576
|
warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
|
|
@@ -1658,6 +1663,15 @@ export default {
|
|
|
1658
1663
|
if (props.dragConfig) {
|
|
1659
1664
|
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
|
|
1660
1665
|
}
|
|
1666
|
+
if (props.rowGroupConfig) {
|
|
1667
|
+
warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config'])
|
|
1668
|
+
}
|
|
1669
|
+
if (aggregateOpts.countFields) {
|
|
1670
|
+
warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func'])
|
|
1671
|
+
}
|
|
1672
|
+
if (aggregateOpts.countMethod) {
|
|
1673
|
+
warnLog('vxe.error.delProp', ['row-group-config.countMethod', 'aggregate-config.aggregateMethod'])
|
|
1674
|
+
}
|
|
1661
1675
|
if (props.treeConfig && treeOpts.children) {
|
|
1662
1676
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
|
|
1663
1677
|
}
|
|
@@ -4,7 +4,7 @@ import { isScale, isPx, queryElement } from '../../ui/src/dom'
|
|
|
4
4
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
5
5
|
import { eqEmptyValue } from '../../ui/src/utils'
|
|
6
6
|
|
|
7
|
-
import type { VxeTableDefines, VxeTableConstructor, TableReactData, TableInternalData, VxeTablePrivateMethods } from '../../../types'
|
|
7
|
+
import type { VxeTableDefines, VxeTableConstructor, TableReactData, TableInternalData, VxeTablePrivateMethods, VxeTablePropTypes } from '../../../types'
|
|
8
8
|
|
|
9
9
|
const getAllConvertColumns = (columns: any, parentColumn?: any) => {
|
|
10
10
|
const result: any[] = []
|
|
@@ -204,7 +204,7 @@ export function handleFieldOrColumn ($xeTable: VxeTableConstructor, fieldOrColum
|
|
|
204
204
|
return null
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
export
|
|
207
|
+
export function handleRowidOrRow ($xeTable: VxeTableConstructor, rowidOrRow: any) {
|
|
208
208
|
if (rowidOrRow) {
|
|
209
209
|
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow)
|
|
210
210
|
return $xeTable.getRowById(rowid)
|
|
@@ -212,6 +212,10 @@ export const handleRowidOrRow = ($xeTable: VxeTableConstructor, rowidOrRow: any)
|
|
|
212
212
|
return null
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
export function getCellRestHeight (rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
216
|
+
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
217
|
+
}
|
|
218
|
+
|
|
215
219
|
// 组装列配置
|
|
216
220
|
export function assembleColumn (_vm: any) {
|
|
217
221
|
const $xeTable = _vm.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
|
package/packages/ui/index.ts
CHANGED
|
@@ -133,7 +133,7 @@ VxeUI.setConfig({
|
|
|
133
133
|
// isEvery: false,
|
|
134
134
|
showIcon: true
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
aggregateConfig: {
|
|
137
137
|
padding: true,
|
|
138
138
|
rowField: 'id',
|
|
139
139
|
parentField: '_X_ROW_PARENT_KEY',
|
|
@@ -208,13 +208,13 @@ VxeUI.setConfig({
|
|
|
208
208
|
isReplace: true
|
|
209
209
|
},
|
|
210
210
|
virtualXConfig: {
|
|
211
|
-
enabled:
|
|
211
|
+
// enabled: false,
|
|
212
212
|
gt: 24,
|
|
213
213
|
preSize: 0,
|
|
214
214
|
oSize: 0
|
|
215
215
|
},
|
|
216
216
|
virtualYConfig: {
|
|
217
|
-
enabled:
|
|
217
|
+
// enabled: false,
|
|
218
218
|
gt: 100,
|
|
219
219
|
preSize: 1,
|
|
220
220
|
oSize: 0
|
|
@@ -1000,15 +1000,6 @@ $btnThemeList: (
|
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
&.column--highlight {
|
|
1004
|
-
.vxe-header--column {
|
|
1005
|
-
&:not(.col--seq) {
|
|
1006
|
-
&:hover {
|
|
1007
|
-
background-color: var(--vxe-ui-table-column-hover-background-color);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
1003
|
&.header-cell--area {
|
|
1013
1004
|
.vxe-table--header-wrapper {
|
|
1014
1005
|
user-select: none;
|
|
@@ -1090,6 +1081,16 @@ $btnThemeList: (
|
|
|
1090
1081
|
}
|
|
1091
1082
|
|
|
1092
1083
|
// 列高亮
|
|
1084
|
+
&.column--highlight {
|
|
1085
|
+
.vxe-header--column {
|
|
1086
|
+
&:hover {
|
|
1087
|
+
background-color: var(--vxe-ui-table-column-hover-background-color);
|
|
1088
|
+
&.col--current {
|
|
1089
|
+
background-color: var(--vxe-ui-table-column-hover-current-background-color);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1093
1094
|
.vxe-header--column,
|
|
1094
1095
|
.vxe-body--column,
|
|
1095
1096
|
.vxe-footer--column {
|
|
@@ -1135,6 +1136,9 @@ $btnThemeList: (
|
|
|
1135
1136
|
&.row--hover {
|
|
1136
1137
|
& > .vxe-body--column {
|
|
1137
1138
|
background-color: var(--vxe-ui-table-row-hover-background-color);
|
|
1139
|
+
&.col--current {
|
|
1140
|
+
background-color: var(--vxe-ui-table-column-current-background-color);
|
|
1141
|
+
}
|
|
1138
1142
|
}
|
|
1139
1143
|
&.row--stripe {
|
|
1140
1144
|
& > .vxe-body--column {
|
package/styles/theme/base.scss
CHANGED
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
--vxe-ui-table-row-height-mini: 36px;
|
|
37
37
|
--vxe-ui-table-row-line-height: 22px;
|
|
38
38
|
|
|
39
|
-
--vxe-ui-table-column-hover-background-color: #d7effb;
|
|
40
|
-
--vxe-ui-table-column-current-background-color: #e6f7ff;
|
|
41
39
|
--vxe-ui-table-column-icon-border-color: #c0c4cc;
|
|
42
40
|
--vxe-ui-table-column-icon-border-hover-color: #515A6E;
|
|
43
41
|
|
package/styles/theme/dark.scss
CHANGED
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
/*table*/
|
|
32
32
|
--vxe-ui-table-header-background-color: #28282a;
|
|
33
33
|
--vxe-ui-table-column-to-row-background-color: #28282a;
|
|
34
|
+
--vxe-ui-table-column-hover-background-color: #242f3b;
|
|
35
|
+
--vxe-ui-table-column-current-background-color: #18222c;
|
|
36
|
+
--vxe-ui-table-column-hover-current-background-color: #242f3b;
|
|
34
37
|
--vxe-ui-table-border-color: #37373a;
|
|
35
38
|
--vxe-ui-table-row-hover-background-color: #262727;
|
|
36
39
|
--vxe-ui-table-row-striped-background-color: #1D1D1D;
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
--vxe-ui-table-row-checkbox-checked-background-color: #604820;
|
|
41
44
|
--vxe-ui-table-row-hover-checkbox-checked-background-color: #6e5326;
|
|
42
45
|
--vxe-ui-table-row-current-background-color: #18222c;
|
|
43
|
-
--vxe-ui-table-row-hover-current-background-color: #
|
|
46
|
+
--vxe-ui-table-row-hover-current-background-color: #242f3b;
|
|
44
47
|
--vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.8);
|
|
45
48
|
--vxe-ui-table-drag-over-background-color:rgba(48, 48, 0, 0.3);
|
|
46
49
|
}
|