vxe-table 4.13.34 → 4.13.36
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 +35 -11
- package/es/style.css +1 -1
- package/es/table/module/edit/hook.js +2 -2
- package/es/table/module/validator/hook.js +11 -3
- 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 +133 -75
- 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 +39 -15
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +173 -96
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/hook.js +2 -2
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +15 -3
- package/lib/table/module/validator/hook.min.js +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 +32 -32
- 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 +39 -12
- package/packages/table/module/edit/hook.ts +2 -2
- package/packages/table/module/validator/hook.ts +10 -3
- 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 +135 -74
- package/packages/table/src/util.ts +7 -3
- package/packages/ui/index.ts +3 -3
- /package/es/{iconfont.1749092482353.ttf → iconfont.1749440132931.ttf} +0 -0
- /package/es/{iconfont.1749092482353.woff → iconfont.1749440132931.woff} +0 -0
- /package/es/{iconfont.1749092482353.woff2 → iconfont.1749440132931.woff2} +0 -0
- /package/lib/{iconfont.1749092482353.ttf → iconfont.1749440132931.ttf} +0 -0
- /package/lib/{iconfont.1749092482353.woff → iconfont.1749440132931.woff} +0 -0
- /package/lib/{iconfont.1749092482353.woff2 → iconfont.1749440132931.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) {
|
|
@@ -4260,10 +4298,12 @@ export default defineComponent({
|
|
|
4260
4298
|
reloadRow (row, record, field?: string) {
|
|
4261
4299
|
const { keepSource } = props
|
|
4262
4300
|
const { tableData } = reactData
|
|
4263
|
-
const {
|
|
4301
|
+
const { sourceDataRowIdData } = internalData
|
|
4264
4302
|
if (keepSource) {
|
|
4265
|
-
|
|
4266
|
-
|
|
4303
|
+
if ($xeTable.isAggregateRecord(row)) {
|
|
4304
|
+
return nextTick()
|
|
4305
|
+
}
|
|
4306
|
+
const oRow = sourceDataRowIdData[getRowid($xeTable, row)]
|
|
4267
4307
|
if (oRow && row) {
|
|
4268
4308
|
if (field) {
|
|
4269
4309
|
const newValue = XEUtils.clone(XEUtils.get(record || row, field), true)
|
|
@@ -6145,9 +6185,9 @@ export default defineComponent({
|
|
|
6145
6185
|
return rest
|
|
6146
6186
|
},
|
|
6147
6187
|
setRowGroups (fieldOrColumns) {
|
|
6148
|
-
const { rowGroupConfig } = props
|
|
6149
|
-
if (!rowGroupConfig) {
|
|
6150
|
-
errLog('vxe.error.reqProp', ['
|
|
6188
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
6189
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6190
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
6151
6191
|
return nextTick()
|
|
6152
6192
|
}
|
|
6153
6193
|
if (fieldOrColumns) {
|
|
@@ -6159,19 +6199,27 @@ export default defineComponent({
|
|
|
6159
6199
|
return nextTick()
|
|
6160
6200
|
},
|
|
6161
6201
|
clearRowGroups () {
|
|
6162
|
-
const { rowGroupConfig } = props
|
|
6163
|
-
if (!rowGroupConfig) {
|
|
6164
|
-
errLog('vxe.error.reqProp', ['
|
|
6202
|
+
const { aggregateConfig, rowGroupConfig } = props
|
|
6203
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6204
|
+
errLog('vxe.error.reqProp', ['aggregate-config'])
|
|
6165
6205
|
return nextTick()
|
|
6166
6206
|
}
|
|
6167
6207
|
handleUpdateRowGroup([])
|
|
6168
6208
|
return loadTableData(internalData.tableSynchData, true)
|
|
6169
6209
|
},
|
|
6170
6210
|
isRowGroupRecord (row) {
|
|
6211
|
+
warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord'])
|
|
6212
|
+
return $xeTable.isAggregateRecord(row)
|
|
6213
|
+
},
|
|
6214
|
+
isRowGroupExpandByRow (row) {
|
|
6215
|
+
warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow'])
|
|
6216
|
+
return $xeTable.isAggregateExpandByRow(row)
|
|
6217
|
+
},
|
|
6218
|
+
isAggregateRecord (row) {
|
|
6171
6219
|
const { isRowGroupStatus } = reactData
|
|
6172
6220
|
return isRowGroupStatus && row.isAggregate
|
|
6173
6221
|
},
|
|
6174
|
-
|
|
6222
|
+
isAggregateExpandByRow (row) {
|
|
6175
6223
|
const { rowGroupExpandedFlag } = reactData
|
|
6176
6224
|
const { rowGroupExpandedMaps } = internalData
|
|
6177
6225
|
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)]
|
|
@@ -6187,8 +6235,8 @@ export default defineComponent({
|
|
|
6187
6235
|
},
|
|
6188
6236
|
setAllRowGroupExpand (expanded) {
|
|
6189
6237
|
const { tableFullGroupData } = internalData
|
|
6190
|
-
const
|
|
6191
|
-
const { mapChildrenField } =
|
|
6238
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
6239
|
+
const { mapChildrenField } = aggregateOpts
|
|
6192
6240
|
const rgExpandedMaps: Record<string, any> = {}
|
|
6193
6241
|
if (expanded && mapChildrenField) {
|
|
6194
6242
|
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
@@ -7717,8 +7765,8 @@ export default defineComponent({
|
|
|
7717
7765
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
7718
7766
|
}, { children: childrenField })
|
|
7719
7767
|
} else if (isRowGroupStatus) {
|
|
7720
|
-
const
|
|
7721
|
-
const { mapChildrenField } =
|
|
7768
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
7769
|
+
const { mapChildrenField } = aggregateOpts
|
|
7722
7770
|
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
7723
7771
|
const rowid = handleUpdateRowId(row)
|
|
7724
7772
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
|
|
@@ -8230,7 +8278,7 @@ export default defineComponent({
|
|
|
8230
8278
|
const { treeConfig } = props
|
|
8231
8279
|
const { isRowGroupStatus } = reactData
|
|
8232
8280
|
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
|
|
8233
|
-
const
|
|
8281
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8234
8282
|
const treeOpts = computeTreeOpts.value
|
|
8235
8283
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
8236
8284
|
const checkboxOpts = computeCheckboxOpts.value
|
|
@@ -8245,7 +8293,7 @@ export default defineComponent({
|
|
|
8245
8293
|
|
|
8246
8294
|
if (isRowGroupStatus) {
|
|
8247
8295
|
// 行分组
|
|
8248
|
-
const mapChildrenField =
|
|
8296
|
+
const mapChildrenField = aggregateOpts.mapChildrenField
|
|
8249
8297
|
if (mapChildrenField) {
|
|
8250
8298
|
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
8251
8299
|
const rowid = handleGetRowId(row)
|
|
@@ -8403,7 +8451,7 @@ export default defineComponent({
|
|
|
8403
8451
|
const { treeConfig } = props
|
|
8404
8452
|
const { isRowGroupStatus } = reactData
|
|
8405
8453
|
const { selectCheckboxMaps } = internalData
|
|
8406
|
-
const
|
|
8454
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8407
8455
|
const treeOpts = computeTreeOpts.value
|
|
8408
8456
|
const { transform, mapChildrenField } = treeOpts
|
|
8409
8457
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
@@ -8455,7 +8503,7 @@ export default defineComponent({
|
|
|
8455
8503
|
}
|
|
8456
8504
|
handleCheckboxReserveRow(row, checked)
|
|
8457
8505
|
}
|
|
8458
|
-
}, { children:
|
|
8506
|
+
}, { children: aggregateOpts.mapChildrenField })
|
|
8459
8507
|
reactData.updateCheckboxFlag++
|
|
8460
8508
|
return
|
|
8461
8509
|
} else if (treeConfig) {
|
|
@@ -8516,6 +8564,9 @@ export default defineComponent({
|
|
|
8516
8564
|
internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList)
|
|
8517
8565
|
reactData.mergeFootFlag++
|
|
8518
8566
|
},
|
|
8567
|
+
handleAggregateSummaryData () {
|
|
8568
|
+
return updateGroupData()
|
|
8569
|
+
},
|
|
8519
8570
|
triggerHeaderTitleEvent (evnt, iconParams, params) {
|
|
8520
8571
|
const tipContent = iconParams.content || (iconParams as any).message
|
|
8521
8572
|
if (tipContent) {
|
|
@@ -8675,7 +8726,7 @@ export default defineComponent({
|
|
|
8675
8726
|
const radioOpts = computeRadioOpts.value
|
|
8676
8727
|
const checkboxOpts = computeCheckboxOpts.value
|
|
8677
8728
|
const keyboardOpts = computeKeyboardOpts.value
|
|
8678
|
-
const
|
|
8729
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8679
8730
|
const rowOpts = computeRowOpts.value
|
|
8680
8731
|
const columnOpts = computeColumnOpts.value
|
|
8681
8732
|
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
@@ -8702,7 +8753,7 @@ export default defineComponent({
|
|
|
8702
8753
|
$xeTable.triggerTreeExpandEvent(evnt, params)
|
|
8703
8754
|
}
|
|
8704
8755
|
// 如果是行分组
|
|
8705
|
-
if ((
|
|
8756
|
+
if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
|
|
8706
8757
|
$xeTable.triggerRowGroupExpandEvent(evnt, params)
|
|
8707
8758
|
}
|
|
8708
8759
|
}
|
|
@@ -8981,9 +9032,9 @@ export default defineComponent({
|
|
|
8981
9032
|
*/
|
|
8982
9033
|
triggerRowGroupExpandEvent (evnt, params) {
|
|
8983
9034
|
const { rowGroupExpandedMaps } = internalData
|
|
8984
|
-
const
|
|
9035
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
8985
9036
|
const { row, column } = params
|
|
8986
|
-
const { trigger } =
|
|
9037
|
+
const { trigger } = aggregateOpts
|
|
8987
9038
|
if (trigger === 'manual') {
|
|
8988
9039
|
return
|
|
8989
9040
|
}
|
|
@@ -10249,10 +10300,10 @@ export default defineComponent({
|
|
|
10249
10300
|
const { tableFullData } = internalData
|
|
10250
10301
|
const rests: Promise<any>[] = []
|
|
10251
10302
|
if (treeConfig || isRowGroupStatus) {
|
|
10252
|
-
const
|
|
10303
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
10253
10304
|
const treeOpts = computeTreeOpts.value
|
|
10254
10305
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
10255
|
-
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ?
|
|
10306
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField })
|
|
10256
10307
|
if (matchObj) {
|
|
10257
10308
|
const nodes = matchObj.nodes
|
|
10258
10309
|
nodes.forEach((row, index) => {
|
|
@@ -11408,9 +11459,9 @@ export default defineComponent({
|
|
|
11408
11459
|
const columnOpts = computeColumnOpts.value
|
|
11409
11460
|
const rowOpts = computeRowOpts.value
|
|
11410
11461
|
const customOpts = computeCustomOpts.value
|
|
11411
|
-
const
|
|
11462
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
11412
11463
|
const virtualYOpts = computeVirtualYOpts.value
|
|
11413
|
-
const { groupFields } =
|
|
11464
|
+
const { groupFields } = aggregateOpts
|
|
11414
11465
|
|
|
11415
11466
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
11416
11467
|
initTpImg()
|
|
@@ -11434,6 +11485,7 @@ export default defineComponent({
|
|
|
11434
11485
|
const currentRowOpts = computeCurrentRowOpts.value
|
|
11435
11486
|
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
11436
11487
|
const keyboardOpts = computeKeyboardOpts.value
|
|
11488
|
+
const aggregateOpts = computeAggregateOpts.value
|
|
11437
11489
|
|
|
11438
11490
|
if (props.rowId) {
|
|
11439
11491
|
warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
|
|
@@ -11523,6 +11575,15 @@ export default defineComponent({
|
|
|
11523
11575
|
if (props.dragConfig) {
|
|
11524
11576
|
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config'])
|
|
11525
11577
|
}
|
|
11578
|
+
if (props.rowGroupConfig) {
|
|
11579
|
+
warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config'])
|
|
11580
|
+
}
|
|
11581
|
+
if (aggregateOpts.countFields) {
|
|
11582
|
+
warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func'])
|
|
11583
|
+
}
|
|
11584
|
+
if (aggregateOpts.countMethod) {
|
|
11585
|
+
warnLog('vxe.error.delProp', ['row-group-config.countMethod', 'aggregate-config.aggregateMethod'])
|
|
11586
|
+
}
|
|
11526
11587
|
if (props.treeConfig && treeOpts.children) {
|
|
11527
11588
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
|
|
11528
11589
|
}
|
|
@@ -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
|