vxe-table 4.13.34 → 4.13.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/grid/src/grid.js +1 -1
- package/es/style.css +1 -1
- package/es/table/src/body.js +20 -3
- package/es/table/src/cell.js +55 -39
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +2 -0
- package/es/table/src/props.js +3 -1
- package/es/table/src/table.js +128 -72
- package/es/table/src/util.js +7 -4
- package/es/ui/index.js +4 -4
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +117 -76
- 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 +47 -32
- 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/props.js +3 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +31 -31
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -7
- 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/grid/src/grid.ts +1 -1
- package/packages/table/src/body.ts +20 -3
- package/packages/table/src/cell.ts +55 -39
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/props.ts +3 -1
- package/packages/table/src/table.ts +130 -71
- package/packages/table/src/util.ts +7 -3
- package/packages/ui/index.ts +3 -3
- /package/es/{iconfont.1749092482353.ttf → iconfont.1749202972772.ttf} +0 -0
- /package/es/{iconfont.1749092482353.woff → iconfont.1749202972772.woff} +0 -0
- /package/es/{iconfont.1749092482353.woff2 → iconfont.1749202972772.woff2} +0 -0
- /package/lib/{iconfont.1749092482353.ttf → iconfont.1749202972772.ttf} +0 -0
- /package/lib/{iconfont.1749092482353.woff → iconfont.1749202972772.woff} +0 -0
- /package/lib/{iconfont.1749092482353.woff2 → iconfont.1749202972772.woff2} +0 -0
|
@@ -582,8 +582,12 @@ export default defineComponent({
|
|
|
582
582
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
|
|
583
583
|
})
|
|
584
584
|
|
|
585
|
+
const computeAggregateOpts = computed(() => {
|
|
586
|
+
return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig)
|
|
587
|
+
})
|
|
588
|
+
|
|
585
589
|
const computeRowGroupOpts = computed(() => {
|
|
586
|
-
return
|
|
590
|
+
return computeAggregateOpts.value
|
|
587
591
|
})
|
|
588
592
|
|
|
589
593
|
const computeCurrentRowOpts = computed(() => {
|
|
@@ -910,6 +914,7 @@ export default defineComponent({
|
|
|
910
914
|
computeHeaderCellOpts,
|
|
911
915
|
computeFooterCellOpts,
|
|
912
916
|
computeRowOpts,
|
|
917
|
+
computeAggregateOpts,
|
|
913
918
|
computeRowGroupOpts,
|
|
914
919
|
computeCurrentRowOpts,
|
|
915
920
|
computeRowDragOpts,
|
|
@@ -1962,7 +1967,7 @@ export default defineComponent({
|
|
|
1962
1967
|
const { treeConfig } = props
|
|
1963
1968
|
const { isRowGroupStatus } = reactData
|
|
1964
1969
|
const { fullAllDataRowIdData, treeExpandedMaps, rowGroupExpandedMaps } = internalData
|
|
1965
|
-
const
|
|
1970
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
1966
1971
|
const treeOpts = computeTreeOpts.value
|
|
1967
1972
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
1968
1973
|
const fullData: any[] = []
|
|
@@ -1987,7 +1992,7 @@ export default defineComponent({
|
|
|
1987
1992
|
updateScrollYStatus(fullData)
|
|
1988
1993
|
return fullData
|
|
1989
1994
|
} else if (isRowGroupStatus) {
|
|
1990
|
-
const { childrenField } =
|
|
1995
|
+
const { childrenField } = aggregateOpts
|
|
1991
1996
|
XEUtils.eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
|
|
1992
1997
|
const rowid = handleGetRowId(row)
|
|
1993
1998
|
const parentRowid = handleGetRowId(parentRow)
|
|
@@ -2017,7 +2022,7 @@ export default defineComponent({
|
|
|
2017
2022
|
const { tableFullColumn, tableFullData, tableFullTreeData, tableFullGroupData } = internalData
|
|
2018
2023
|
const filterOpts = computeFilterOpts.value
|
|
2019
2024
|
const sortOpts = computeSortOpts.value
|
|
2020
|
-
const
|
|
2025
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
2021
2026
|
const treeOpts = computeTreeOpts.value
|
|
2022
2027
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2023
2028
|
const { transform, rowField, parentField, mapChildrenField } = treeOpts
|
|
@@ -2083,8 +2088,8 @@ export default defineComponent({
|
|
|
2083
2088
|
tableTree = XEUtils.searchTree(tableFullGroupData, handleFilter, {
|
|
2084
2089
|
original: true,
|
|
2085
2090
|
isEvery: true,
|
|
2086
|
-
children:
|
|
2087
|
-
mapChildren:
|
|
2091
|
+
children: aggregateOpts.mapChildrenField,
|
|
2092
|
+
mapChildren: aggregateOpts.childrenField
|
|
2088
2093
|
})
|
|
2089
2094
|
tableData = tableTree
|
|
2090
2095
|
} else if (treeConfig && transform) {
|
|
@@ -2106,8 +2111,8 @@ export default defineComponent({
|
|
|
2106
2111
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
2107
2112
|
original: true,
|
|
2108
2113
|
isEvery: true,
|
|
2109
|
-
children:
|
|
2110
|
-
mapChildren:
|
|
2114
|
+
children: aggregateOpts.mapChildrenField,
|
|
2115
|
+
mapChildren: aggregateOpts.childrenField
|
|
2111
2116
|
})
|
|
2112
2117
|
tableData = tableTree
|
|
2113
2118
|
} else if (treeConfig && transform) {
|
|
@@ -2135,17 +2140,17 @@ export default defineComponent({
|
|
|
2135
2140
|
tableTree = XEUtils.isArray(sortRests) ? sortRests : tableTree
|
|
2136
2141
|
} else {
|
|
2137
2142
|
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
2138
|
-
key:
|
|
2139
|
-
parentKey:
|
|
2140
|
-
children:
|
|
2143
|
+
key: aggregateOpts.rowField,
|
|
2144
|
+
parentKey: aggregateOpts.parentField,
|
|
2145
|
+
children: aggregateOpts.mapChildrenField
|
|
2141
2146
|
})
|
|
2142
2147
|
tableTree = XEUtils.toArrayTree(
|
|
2143
2148
|
XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField(column), order])),
|
|
2144
2149
|
{
|
|
2145
|
-
key:
|
|
2146
|
-
parentKey:
|
|
2147
|
-
children:
|
|
2148
|
-
mapChildren:
|
|
2150
|
+
key: aggregateOpts.rowField,
|
|
2151
|
+
parentKey: aggregateOpts.parentField,
|
|
2152
|
+
children: aggregateOpts.childrenField,
|
|
2153
|
+
mapChildren: aggregateOpts.mapChildrenField
|
|
2149
2154
|
}
|
|
2150
2155
|
)
|
|
2151
2156
|
}
|
|
@@ -2187,8 +2192,8 @@ export default defineComponent({
|
|
|
2187
2192
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
2188
2193
|
original: true,
|
|
2189
2194
|
isEvery: true,
|
|
2190
|
-
children:
|
|
2191
|
-
mapChildren:
|
|
2195
|
+
children: aggregateOpts.mapChildrenField,
|
|
2196
|
+
mapChildren: aggregateOpts.childrenField
|
|
2192
2197
|
})
|
|
2193
2198
|
tableData = tableTree
|
|
2194
2199
|
} else if (treeConfig && transform) {
|
|
@@ -2654,7 +2659,7 @@ export default defineComponent({
|
|
|
2654
2659
|
const { isRowGroupStatus } = reactData
|
|
2655
2660
|
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps } = internalData
|
|
2656
2661
|
const treeOpts = computeTreeOpts.value
|
|
2657
|
-
const
|
|
2662
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
2658
2663
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
2659
2664
|
const checkboxOpts = computeCheckboxOpts.value
|
|
2660
2665
|
const { checkField, reserve, checkMethod } = checkboxOpts
|
|
@@ -2702,7 +2707,7 @@ export default defineComponent({
|
|
|
2702
2707
|
const rowid = handleGetRowId(row)
|
|
2703
2708
|
selectRowMaps[rowid] = row
|
|
2704
2709
|
}
|
|
2705
|
-
}, { children:
|
|
2710
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
2706
2711
|
} else {
|
|
2707
2712
|
/**
|
|
2708
2713
|
* 如果是树取消
|
|
@@ -2714,7 +2719,7 @@ export default defineComponent({
|
|
|
2714
2719
|
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
2715
2720
|
selectRowMaps[rowid] = row
|
|
2716
2721
|
}
|
|
2717
|
-
}, { children:
|
|
2722
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
2718
2723
|
}
|
|
2719
2724
|
}
|
|
2720
2725
|
} else if (treeConfig) {
|
|
@@ -3139,12 +3144,50 @@ export default defineComponent({
|
|
|
3139
3144
|
: []
|
|
3140
3145
|
}
|
|
3141
3146
|
|
|
3147
|
+
const handleeGroupSummary = (aggList: VxeTableDefines.AggregateRowInfo[]) => {
|
|
3148
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
3149
|
+
const { mapChildrenField } = aggregateOpts
|
|
3150
|
+
if (mapChildrenField) {
|
|
3151
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
3152
|
+
let count = 0
|
|
3153
|
+
XEUtils.each(aggRow[mapChildrenField], (row: VxeTableDefines.AggregateRowInfo) => {
|
|
3154
|
+
if (row.isAggregate) {
|
|
3155
|
+
count += row.childCount || 0
|
|
3156
|
+
} else {
|
|
3157
|
+
count++
|
|
3158
|
+
}
|
|
3159
|
+
})
|
|
3160
|
+
aggRow.childCount = count
|
|
3161
|
+
})
|
|
3162
|
+
if ($xeTable.handlePivotTableAggregateData) {
|
|
3163
|
+
$xeTable.handlePivotTableAggregateData(aggList)
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
const updateGroupData = () => {
|
|
3169
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
3170
|
+
const { isRowGroupStatus } = reactData
|
|
3171
|
+
const { tableFullGroupData } = internalData
|
|
3172
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
3173
|
+
const { mapChildrenField } = aggregateOpts
|
|
3174
|
+
if ((aggregateConfig || rowGroupConfig) && isRowGroupStatus) {
|
|
3175
|
+
const aggList: VxeTableDefines.AggregateRowInfo[] = []
|
|
3176
|
+
XEUtils.eachTree(tableFullGroupData, row => {
|
|
3177
|
+
if (row.isAggregate) {
|
|
3178
|
+
aggList.push(row)
|
|
3179
|
+
}
|
|
3180
|
+
}, { children: mapChildrenField })
|
|
3181
|
+
handleeGroupSummary(aggList)
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3142
3185
|
const handleGroupData = (list: any[], rowGroups: VxeTableDefines.RowGroupItem[]) => {
|
|
3143
3186
|
let fullData = list
|
|
3144
3187
|
let treeData = list
|
|
3145
3188
|
if (rowGroups) {
|
|
3146
|
-
const
|
|
3147
|
-
const { rowField, parentField, childrenField, mapChildrenField } =
|
|
3189
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
3190
|
+
const { rowField, parentField, childrenField, mapChildrenField } = aggregateOpts
|
|
3148
3191
|
const checkboxOpts = computeCheckboxOpts.value
|
|
3149
3192
|
const { checkField } = checkboxOpts
|
|
3150
3193
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField
|
|
@@ -3155,7 +3198,7 @@ export default defineComponent({
|
|
|
3155
3198
|
const groupField = rgItem.field
|
|
3156
3199
|
const groupColumn = $xeTable.getColumnByField(groupField)
|
|
3157
3200
|
const groupMaps: Record<string, any[]> = {}
|
|
3158
|
-
const
|
|
3201
|
+
const aggList: VxeTableDefines.AggregateRowInfo[] = []
|
|
3159
3202
|
const rowkey = getRowkey($xeTable)
|
|
3160
3203
|
list.forEach((row) => {
|
|
3161
3204
|
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField)
|
|
@@ -3172,12 +3215,12 @@ export default defineComponent({
|
|
|
3172
3215
|
})
|
|
3173
3216
|
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
3174
3217
|
const { fullData: childFullData, treeData: childTreeData } = handleGroupData(childList, rowGroups.slice(1))
|
|
3175
|
-
const
|
|
3176
|
-
const groupRow = {
|
|
3218
|
+
const aggRow: VxeTableDefines.AggregateRowInfo = {
|
|
3177
3219
|
isAggregate: true,
|
|
3178
|
-
|
|
3220
|
+
aggData: {},
|
|
3179
3221
|
groupContent: groupValue,
|
|
3180
3222
|
groupField,
|
|
3223
|
+
childCount: 0,
|
|
3181
3224
|
[rowField]: getRowUniqueId(),
|
|
3182
3225
|
[parentField]: null,
|
|
3183
3226
|
[rowkey]: getRowUniqueId(),
|
|
@@ -3185,29 +3228,19 @@ export default defineComponent({
|
|
|
3185
3228
|
[mapChildrenField]: childTreeData
|
|
3186
3229
|
}
|
|
3187
3230
|
if (checkField) {
|
|
3188
|
-
|
|
3231
|
+
aggRow[checkField] = false
|
|
3189
3232
|
}
|
|
3190
3233
|
if (indeterminateField) {
|
|
3191
|
-
|
|
3234
|
+
aggRow[indeterminateField] = false
|
|
3192
3235
|
}
|
|
3193
|
-
|
|
3194
|
-
treeData.push(
|
|
3195
|
-
fullData.push(
|
|
3236
|
+
aggList.push(aggRow)
|
|
3237
|
+
treeData.push(aggRow)
|
|
3238
|
+
fullData.push(aggRow)
|
|
3196
3239
|
if (childFullData.length) {
|
|
3197
3240
|
fullData.push(...childFullData)
|
|
3198
3241
|
}
|
|
3199
3242
|
})
|
|
3200
|
-
|
|
3201
|
-
let count = 0
|
|
3202
|
-
XEUtils.each(groupItem[childrenField], row => {
|
|
3203
|
-
if (row.isAggregate) {
|
|
3204
|
-
count += row[childrenField] ? row[childrenField].length : 0
|
|
3205
|
-
} else {
|
|
3206
|
-
count++
|
|
3207
|
-
}
|
|
3208
|
-
})
|
|
3209
|
-
groupItem.childCount = count
|
|
3210
|
-
})
|
|
3243
|
+
handleeGroupSummary(aggList)
|
|
3211
3244
|
}
|
|
3212
3245
|
}
|
|
3213
3246
|
return {
|
|
@@ -3221,7 +3254,7 @@ export default defineComponent({
|
|
|
3221
3254
|
* @param {Array} datas 数据
|
|
3222
3255
|
*/
|
|
3223
3256
|
const loadTableData = (datas: any[], isReset: boolean) => {
|
|
3224
|
-
const { keepSource, treeConfig, rowGroupConfig } = props
|
|
3257
|
+
const { keepSource, treeConfig, rowGroupConfig, aggregateConfig } = props
|
|
3225
3258
|
const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData
|
|
3226
3259
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
|
|
3227
3260
|
const rowOpts = computeRowOpts.value
|
|
@@ -3235,11 +3268,11 @@ export default defineComponent({
|
|
|
3235
3268
|
errLog('vxe.error.errMaxRow', [supportMaxRow])
|
|
3236
3269
|
}
|
|
3237
3270
|
if (treeConfig && rowGroupList.length) {
|
|
3238
|
-
errLog('vxe.error.noTree', ['
|
|
3271
|
+
errLog('vxe.error.noTree', ['aggregate-config'])
|
|
3239
3272
|
return nextTick()
|
|
3240
3273
|
}
|
|
3241
3274
|
if (rowOpts.drag && rowGroupList.length) {
|
|
3242
|
-
errLog('vxe.error.errConflicts', ['row-config.drag', '
|
|
3275
|
+
errLog('vxe.error.errConflicts', ['row-config.drag', 'aggregate-config'])
|
|
3243
3276
|
return nextTick()
|
|
3244
3277
|
}
|
|
3245
3278
|
let isRGroup = false
|
|
@@ -3276,7 +3309,7 @@ export default defineComponent({
|
|
|
3276
3309
|
} else {
|
|
3277
3310
|
treeData = fullData.slice(0)
|
|
3278
3311
|
}
|
|
3279
|
-
} else if (rowGroupConfig && rowGroupList.length) {
|
|
3312
|
+
} else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
|
|
3280
3313
|
const groupRest = handleGroupData(fullData, rowGroupList)
|
|
3281
3314
|
treeData = groupRest.treeData
|
|
3282
3315
|
fullData = groupRest.fullData
|
|
@@ -3388,12 +3421,16 @@ export default defineComponent({
|
|
|
3388
3421
|
if (oldScrollYLoad === sYLoad) {
|
|
3389
3422
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3390
3423
|
.then(() => {
|
|
3424
|
+
calcCellHeight()
|
|
3425
|
+
updateRowOffsetTop()
|
|
3391
3426
|
resolve()
|
|
3392
3427
|
})
|
|
3393
3428
|
} else {
|
|
3394
3429
|
setTimeout(() => {
|
|
3395
3430
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3396
3431
|
.then(() => {
|
|
3432
|
+
calcCellHeight()
|
|
3433
|
+
updateRowOffsetTop()
|
|
3397
3434
|
resolve()
|
|
3398
3435
|
})
|
|
3399
3436
|
})
|
|
@@ -3633,6 +3670,7 @@ export default defineComponent({
|
|
|
3633
3670
|
$xeTable.clearMergeCells()
|
|
3634
3671
|
$xeTable.clearMergeFooterItems()
|
|
3635
3672
|
$xeTable.handleTableData(true)
|
|
3673
|
+
$xeTable.handleAggregateSummaryData()
|
|
3636
3674
|
|
|
3637
3675
|
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3638
3676
|
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
@@ -3762,8 +3800,8 @@ export default defineComponent({
|
|
|
3762
3800
|
*/
|
|
3763
3801
|
const handleRowGroupBaseExpand = (rows: any[], expanded: boolean) => {
|
|
3764
3802
|
const { fullAllDataRowIdData, tableFullGroupData, rowGroupExpandedMaps } = internalData
|
|
3765
|
-
const
|
|
3766
|
-
const { mapChildrenField, accordion } =
|
|
3803
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
3804
|
+
const { mapChildrenField, accordion } = aggregateOpts
|
|
3767
3805
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
3768
3806
|
let validRows = rows
|
|
3769
3807
|
if (mapChildrenField) {
|
|
@@ -6145,9 +6183,9 @@ export default defineComponent({
|
|
|
6145
6183
|
return rest
|
|
6146
6184
|
},
|
|
6147
6185
|
setRowGroups (fieldOrColumns) {
|
|
6148
|
-
const { rowGroupConfig } = props
|
|
6149
|
-
if (!rowGroupConfig) {
|
|
6150
|
-
errLog('vxe.error.reqProp', ['
|
|
6186
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
6187
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6188
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
6151
6189
|
return nextTick()
|
|
6152
6190
|
}
|
|
6153
6191
|
if (fieldOrColumns) {
|
|
@@ -6159,19 +6197,27 @@ export default defineComponent({
|
|
|
6159
6197
|
return nextTick()
|
|
6160
6198
|
},
|
|
6161
6199
|
clearRowGroups () {
|
|
6162
|
-
const { rowGroupConfig } = props
|
|
6163
|
-
if (!rowGroupConfig) {
|
|
6164
|
-
errLog('vxe.error.reqProp', ['
|
|
6200
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
6201
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6202
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
6165
6203
|
return nextTick()
|
|
6166
6204
|
}
|
|
6167
6205
|
handleUpdateRowGroup([])
|
|
6168
6206
|
return loadTableData(internalData.tableSynchData, true)
|
|
6169
6207
|
},
|
|
6170
6208
|
isRowGroupRecord (row) {
|
|
6209
|
+
warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord'])
|
|
6210
|
+
return $xeTable.isAggregateRecord(row)
|
|
6211
|
+
},
|
|
6212
|
+
isRowGroupExpandByRow (row) {
|
|
6213
|
+
warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow'])
|
|
6214
|
+
return $xeTable.isAggregateExpandByRow(row)
|
|
6215
|
+
},
|
|
6216
|
+
isAggregateRecord (row) {
|
|
6171
6217
|
const { isRowGroupStatus } = reactData
|
|
6172
6218
|
return isRowGroupStatus && row.isAggregate
|
|
6173
6219
|
},
|
|
6174
|
-
|
|
6220
|
+
isAggregateExpandByRow (row) {
|
|
6175
6221
|
const { rowGroupExpandedFlag } = reactData
|
|
6176
6222
|
const { rowGroupExpandedMaps } = internalData
|
|
6177
6223
|
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)]
|
|
@@ -6187,8 +6233,8 @@ export default defineComponent({
|
|
|
6187
6233
|
},
|
|
6188
6234
|
setAllRowGroupExpand (expanded) {
|
|
6189
6235
|
const { tableFullGroupData } = internalData
|
|
6190
|
-
const
|
|
6191
|
-
const { mapChildrenField } =
|
|
6236
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
6237
|
+
const { mapChildrenField } = aggregateOpts
|
|
6192
6238
|
const rgExpandedMaps: Record<string, any> = {}
|
|
6193
6239
|
if (expanded && mapChildrenField) {
|
|
6194
6240
|
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
@@ -7717,8 +7763,8 @@ export default defineComponent({
|
|
|
7717
7763
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
7718
7764
|
}, { children: childrenField })
|
|
7719
7765
|
} else if (isRowGroupStatus) {
|
|
7720
|
-
const
|
|
7721
|
-
const { mapChildrenField } =
|
|
7766
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
7767
|
+
const { mapChildrenField } = aggregateOpts
|
|
7722
7768
|
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
7723
7769
|
const rowid = handleUpdateRowId(row)
|
|
7724
7770
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
@@ -8230,7 +8276,7 @@ export default defineComponent({
|
|
|
8230
8276
|
const { treeConfig } = props
|
|
8231
8277
|
const { isRowGroupStatus } = reactData
|
|
8232
8278
|
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
8233
|
-
const
|
|
8279
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8234
8280
|
const treeOpts = computeTreeOpts.value
|
|
8235
8281
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8236
8282
|
const checkboxOpts = computeCheckboxOpts.value
|
|
@@ -8245,7 +8291,7 @@ export default defineComponent({
|
|
|
8245
8291
|
|
|
8246
8292
|
if (isRowGroupStatus) {
|
|
8247
8293
|
// 行分组
|
|
8248
|
-
const mapChildrenField =
|
|
8294
|
+
const mapChildrenField = aggregateOpts.mapChildrenField
|
|
8249
8295
|
if (mapChildrenField) {
|
|
8250
8296
|
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
8251
8297
|
const rowid = handleGetRowId(row)
|
|
@@ -8403,7 +8449,7 @@ export default defineComponent({
|
|
|
8403
8449
|
const { treeConfig } = props
|
|
8404
8450
|
const { isRowGroupStatus } = reactData
|
|
8405
8451
|
const { selectCheckboxMaps } = internalData
|
|
8406
|
-
const
|
|
8452
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8407
8453
|
const treeOpts = computeTreeOpts.value
|
|
8408
8454
|
const { transform, mapChildrenField } = treeOpts
|
|
8409
8455
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -8455,7 +8501,7 @@ export default defineComponent({
|
|
|
8455
8501
|
}
|
|
8456
8502
|
handleCheckboxReserveRow(row, checked)
|
|
8457
8503
|
}
|
|
8458
|
-
}, { children:
|
|
8504
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
8459
8505
|
reactData.updateCheckboxFlag++
|
|
8460
8506
|
return
|
|
8461
8507
|
} else if (treeConfig) {
|
|
@@ -8516,6 +8562,9 @@ export default defineComponent({
|
|
|
8516
8562
|
internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList)
|
|
8517
8563
|
reactData.mergeFootFlag++
|
|
8518
8564
|
},
|
|
8565
|
+
handleAggregateSummaryData () {
|
|
8566
|
+
return updateGroupData()
|
|
8567
|
+
},
|
|
8519
8568
|
triggerHeaderTitleEvent (evnt, iconParams, params) {
|
|
8520
8569
|
const tipContent = iconParams.content || (iconParams as any).message
|
|
8521
8570
|
if (tipContent) {
|
|
@@ -8675,7 +8724,7 @@ export default defineComponent({
|
|
|
8675
8724
|
const radioOpts = computeRadioOpts.value
|
|
8676
8725
|
const checkboxOpts = computeCheckboxOpts.value
|
|
8677
8726
|
const keyboardOpts = computeKeyboardOpts.value
|
|
8678
|
-
const
|
|
8727
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8679
8728
|
const rowOpts = computeRowOpts.value
|
|
8680
8729
|
const columnOpts = computeColumnOpts.value
|
|
8681
8730
|
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
@@ -8702,7 +8751,7 @@ export default defineComponent({
|
|
|
8702
8751
|
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
8703
8752
|
}
|
|
8704
8753
|
// 如果是行分组
|
|
8705
|
-
if ((
|
|
8754
|
+
if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
|
|
8706
8755
|
$xeTable.triggerRowGroupExpandEvent(evnt, params)
|
|
8707
8756
|
}
|
|
8708
8757
|
}
|
|
@@ -8981,9 +9030,9 @@ export default defineComponent({
|
|
|
8981
9030
|
*/
|
|
8982
9031
|
triggerRowGroupExpandEvent (evnt, params) {
|
|
8983
9032
|
const { rowGroupExpandedMaps } = internalData
|
|
8984
|
-
const
|
|
9033
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8985
9034
|
const { row, column } = params
|
|
8986
|
-
const { trigger } =
|
|
9035
|
+
const { trigger } = aggregateOpts
|
|
8987
9036
|
if (trigger === 'manual') {
|
|
8988
9037
|
return
|
|
8989
9038
|
}
|
|
@@ -10249,10 +10298,10 @@ export default defineComponent({
|
|
|
10249
10298
|
const { tableFullData } = internalData
|
|
10250
10299
|
const rests: Promise<any>[] = []
|
|
10251
10300
|
if (treeConfig || isRowGroupStatus) {
|
|
10252
|
-
const
|
|
10301
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
10253
10302
|
const treeOpts = computeTreeOpts.value
|
|
10254
10303
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
10255
|
-
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ?
|
|
10304
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField })
|
|
10256
10305
|
if (matchObj) {
|
|
10257
10306
|
const nodes = matchObj.nodes
|
|
10258
10307
|
nodes.forEach((row, index) => {
|
|
@@ -11408,9 +11457,9 @@ export default defineComponent({
|
|
|
11408
11457
|
const columnOpts = computeColumnOpts.value
|
|
11409
11458
|
const rowOpts = computeRowOpts.value
|
|
11410
11459
|
const customOpts = computeCustomOpts.value
|
|
11411
|
-
const
|
|
11460
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
11412
11461
|
const virtualYOpts = computeVirtualYOpts.value
|
|
11413
|
-
const { groupFields } =
|
|
11462
|
+
const { groupFields } = aggregateOpts
|
|
11414
11463
|
|
|
11415
11464
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
11416
11465
|
initTpImg()
|
|
@@ -11434,6 +11483,7 @@ export default defineComponent({
|
|
|
11434
11483
|
const currentRowOpts = computeCurrentRowOpts.value
|
|
11435
11484
|
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
11436
11485
|
const keyboardOpts = computeKeyboardOpts.value
|
|
11486
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
11437
11487
|
|
|
11438
11488
|
if (props.rowId) {
|
|
11439
11489
|
warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
|
|
@@ -11523,6 +11573,15 @@ export default defineComponent({
|
|
|
11523
11573
|
if (props.dragConfig) {
|
|
11524
11574
|
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
|
|
11525
11575
|
}
|
|
11576
|
+
if (props.rowGroupConfig) {
|
|
11577
|
+
warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config'])
|
|
11578
|
+
}
|
|
11579
|
+
if (aggregateOpts.countFields) {
|
|
11580
|
+
warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func'])
|
|
11581
|
+
}
|
|
11582
|
+
if (aggregateOpts.countMethod) {
|
|
11583
|
+
warnLog('vxe.error.delProp', ['row-group-config.countMethod', 'aggregate-config.aggregateMethod'])
|
|
11584
|
+
}
|
|
11526
11585
|
if (props.treeConfig && treeOpts.children) {
|
|
11527
11586
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
|
|
11528
11587
|
}
|
|
@@ -4,7 +4,7 @@ import { ColumnInfo } from './columnInfo'
|
|
|
4
4
|
import { isPx, isScale, queryElement } from '../../ui/src/dom'
|
|
5
5
|
import { eqEmptyValue } from '../../ui/src/utils'
|
|
6
6
|
|
|
7
|
-
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines } from '../../../types'
|
|
7
|
+
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, VxeTablePropTypes } from '../../../types'
|
|
8
8
|
|
|
9
9
|
const getAllConvertColumns = (columns: any, parentColumn?: any) => {
|
|
10
10
|
const result: any[] = []
|
|
@@ -169,14 +169,14 @@ export interface XEColumnInstance {
|
|
|
169
169
|
columnConfig: ColumnInfo;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
export
|
|
172
|
+
export function handleFieldOrColumn ($xeTable: VxeTableConstructor, fieldOrColumn: string | VxeTableDefines.ColumnInfo | null) {
|
|
173
173
|
if (fieldOrColumn) {
|
|
174
174
|
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn
|
|
175
175
|
}
|
|
176
176
|
return null
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
export
|
|
179
|
+
export function handleRowidOrRow ($xeTable: VxeTableConstructor, rowidOrRow: any) {
|
|
180
180
|
if (rowidOrRow) {
|
|
181
181
|
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow)
|
|
182
182
|
return $xeTable.getRowById(rowid)
|
|
@@ -184,6 +184,10 @@ export const handleRowidOrRow = ($xeTable: VxeTableConstructor, rowidOrRow: any)
|
|
|
184
184
|
return null
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
export function getCellRestHeight (rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
188
|
+
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
189
|
+
}
|
|
190
|
+
|
|
187
191
|
function getPaddingLeftRightSize (elem: HTMLElement | null) {
|
|
188
192
|
if (elem) {
|
|
189
193
|
const computedStyle = getComputedStyle(elem)
|
package/packages/ui/index.ts
CHANGED
|
@@ -132,7 +132,7 @@ VxeUI.setConfig({
|
|
|
132
132
|
// isEvery: false,
|
|
133
133
|
showIcon: true
|
|
134
134
|
},
|
|
135
|
-
|
|
135
|
+
aggregateConfig: {
|
|
136
136
|
padding: true,
|
|
137
137
|
rowField: 'id',
|
|
138
138
|
parentField: '_X_ROW_PARENT_KEY',
|
|
@@ -207,13 +207,13 @@ VxeUI.setConfig({
|
|
|
207
207
|
isReplace: true
|
|
208
208
|
},
|
|
209
209
|
virtualXConfig: {
|
|
210
|
-
enabled:
|
|
210
|
+
// enabled: false,
|
|
211
211
|
gt: 24,
|
|
212
212
|
preSize: 1,
|
|
213
213
|
oSize: 0
|
|
214
214
|
},
|
|
215
215
|
virtualYConfig: {
|
|
216
|
-
enabled:
|
|
216
|
+
// enabled: false,
|
|
217
217
|
gt: 100,
|
|
218
218
|
preSize: 1,
|
|
219
219
|
oSize: 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|