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
package/es/table/src/table.js
CHANGED
|
@@ -528,8 +528,11 @@ export default defineComponent({
|
|
|
528
528
|
const computeRowOpts = computed(() => {
|
|
529
529
|
return Object.assign({}, getConfig().table.rowConfig, props.rowConfig);
|
|
530
530
|
});
|
|
531
|
+
const computeAggregateOpts = computed(() => {
|
|
532
|
+
return Object.assign({}, getConfig().table.aggregateConfig || getConfig().table.rowGroupConfig, props.aggregateConfig || props.rowGroupConfig);
|
|
533
|
+
});
|
|
531
534
|
const computeRowGroupOpts = computed(() => {
|
|
532
|
-
return
|
|
535
|
+
return computeAggregateOpts.value;
|
|
533
536
|
});
|
|
534
537
|
const computeCurrentRowOpts = computed(() => {
|
|
535
538
|
return Object.assign({}, getConfig().table.currentRowConfig, props.currentRowConfig);
|
|
@@ -811,6 +814,7 @@ export default defineComponent({
|
|
|
811
814
|
computeHeaderCellOpts,
|
|
812
815
|
computeFooterCellOpts,
|
|
813
816
|
computeRowOpts,
|
|
817
|
+
computeAggregateOpts,
|
|
814
818
|
computeRowGroupOpts,
|
|
815
819
|
computeCurrentRowOpts,
|
|
816
820
|
computeRowDragOpts,
|
|
@@ -1847,7 +1851,7 @@ export default defineComponent({
|
|
|
1847
1851
|
const { treeConfig } = props;
|
|
1848
1852
|
const { isRowGroupStatus } = reactData;
|
|
1849
1853
|
const { fullAllDataRowIdData, treeExpandedMaps, rowGroupExpandedMaps } = internalData;
|
|
1850
|
-
const
|
|
1854
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
1851
1855
|
const treeOpts = computeTreeOpts.value;
|
|
1852
1856
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
1853
1857
|
const fullData = [];
|
|
@@ -1871,7 +1875,7 @@ export default defineComponent({
|
|
|
1871
1875
|
return fullData;
|
|
1872
1876
|
}
|
|
1873
1877
|
else if (isRowGroupStatus) {
|
|
1874
|
-
const { childrenField } =
|
|
1878
|
+
const { childrenField } = aggregateOpts;
|
|
1875
1879
|
XEUtils.eachTree(internalData.afterGroupFullData, (row, index, items, path, parentRow) => {
|
|
1876
1880
|
const rowid = handleGetRowId(row);
|
|
1877
1881
|
const parentRowid = handleGetRowId(parentRow);
|
|
@@ -1900,7 +1904,7 @@ export default defineComponent({
|
|
|
1900
1904
|
const { tableFullColumn, tableFullData, tableFullTreeData, tableFullGroupData } = internalData;
|
|
1901
1905
|
const filterOpts = computeFilterOpts.value;
|
|
1902
1906
|
const sortOpts = computeSortOpts.value;
|
|
1903
|
-
const
|
|
1907
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
1904
1908
|
const treeOpts = computeTreeOpts.value;
|
|
1905
1909
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1906
1910
|
const { transform, rowField, parentField, mapChildrenField } = treeOpts;
|
|
@@ -1964,8 +1968,8 @@ export default defineComponent({
|
|
|
1964
1968
|
tableTree = XEUtils.searchTree(tableFullGroupData, handleFilter, {
|
|
1965
1969
|
original: true,
|
|
1966
1970
|
isEvery: true,
|
|
1967
|
-
children:
|
|
1968
|
-
mapChildren:
|
|
1971
|
+
children: aggregateOpts.mapChildrenField,
|
|
1972
|
+
mapChildren: aggregateOpts.childrenField
|
|
1969
1973
|
});
|
|
1970
1974
|
tableData = tableTree;
|
|
1971
1975
|
}
|
|
@@ -1990,8 +1994,8 @@ export default defineComponent({
|
|
|
1990
1994
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
1991
1995
|
original: true,
|
|
1992
1996
|
isEvery: true,
|
|
1993
|
-
children:
|
|
1994
|
-
mapChildren:
|
|
1997
|
+
children: aggregateOpts.mapChildrenField,
|
|
1998
|
+
mapChildren: aggregateOpts.childrenField
|
|
1995
1999
|
});
|
|
1996
2000
|
tableData = tableTree;
|
|
1997
2001
|
}
|
|
@@ -2021,15 +2025,15 @@ export default defineComponent({
|
|
|
2021
2025
|
}
|
|
2022
2026
|
else {
|
|
2023
2027
|
const treeList = XEUtils.toTreeArray(tableTree, {
|
|
2024
|
-
key:
|
|
2025
|
-
parentKey:
|
|
2026
|
-
children:
|
|
2028
|
+
key: aggregateOpts.rowField,
|
|
2029
|
+
parentKey: aggregateOpts.parentField,
|
|
2030
|
+
children: aggregateOpts.mapChildrenField
|
|
2027
2031
|
});
|
|
2028
2032
|
tableTree = XEUtils.toArrayTree(XEUtils.orderBy(treeList, orderColumns.map(({ column, order }) => [getOrderField(column), order])), {
|
|
2029
|
-
key:
|
|
2030
|
-
parentKey:
|
|
2031
|
-
children:
|
|
2032
|
-
mapChildren:
|
|
2033
|
+
key: aggregateOpts.rowField,
|
|
2034
|
+
parentKey: aggregateOpts.parentField,
|
|
2035
|
+
children: aggregateOpts.childrenField,
|
|
2036
|
+
mapChildren: aggregateOpts.mapChildrenField
|
|
2033
2037
|
});
|
|
2034
2038
|
}
|
|
2035
2039
|
tableData = tableTree;
|
|
@@ -2072,8 +2076,8 @@ export default defineComponent({
|
|
|
2072
2076
|
tableTree = XEUtils.searchTree(tableFullGroupData, () => true, {
|
|
2073
2077
|
original: true,
|
|
2074
2078
|
isEvery: true,
|
|
2075
|
-
children:
|
|
2076
|
-
mapChildren:
|
|
2079
|
+
children: aggregateOpts.mapChildrenField,
|
|
2080
|
+
mapChildren: aggregateOpts.childrenField
|
|
2077
2081
|
});
|
|
2078
2082
|
tableData = tableTree;
|
|
2079
2083
|
}
|
|
@@ -2517,7 +2521,7 @@ export default defineComponent({
|
|
|
2517
2521
|
const { isRowGroupStatus } = reactData;
|
|
2518
2522
|
const { afterFullData, afterTreeFullData, afterGroupFullData, checkboxReserveRowMap, selectCheckboxMaps } = internalData;
|
|
2519
2523
|
const treeOpts = computeTreeOpts.value;
|
|
2520
|
-
const
|
|
2524
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
2521
2525
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2522
2526
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
2523
2527
|
const { checkField, reserve, checkMethod } = checkboxOpts;
|
|
@@ -2566,7 +2570,7 @@ export default defineComponent({
|
|
|
2566
2570
|
const rowid = handleGetRowId(row);
|
|
2567
2571
|
selectRowMaps[rowid] = row;
|
|
2568
2572
|
}
|
|
2569
|
-
}, { children:
|
|
2573
|
+
}, { children: aggregateOpts.mapChildrenField });
|
|
2570
2574
|
}
|
|
2571
2575
|
else {
|
|
2572
2576
|
/**
|
|
@@ -2579,7 +2583,7 @@ export default defineComponent({
|
|
|
2579
2583
|
if (checkMethod({ $table: $xeTable, row }) ? false : selectCheckboxMaps[rowid]) {
|
|
2580
2584
|
selectRowMaps[rowid] = row;
|
|
2581
2585
|
}
|
|
2582
|
-
}, { children:
|
|
2586
|
+
}, { children: aggregateOpts.mapChildrenField });
|
|
2583
2587
|
}
|
|
2584
2588
|
}
|
|
2585
2589
|
}
|
|
@@ -2996,12 +3000,49 @@ export default defineComponent({
|
|
|
2996
3000
|
})
|
|
2997
3001
|
: [];
|
|
2998
3002
|
};
|
|
3003
|
+
const handleeGroupSummary = (aggList) => {
|
|
3004
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
3005
|
+
const { mapChildrenField } = aggregateOpts;
|
|
3006
|
+
if (mapChildrenField) {
|
|
3007
|
+
XEUtils.lastEach(aggList, aggRow => {
|
|
3008
|
+
let count = 0;
|
|
3009
|
+
XEUtils.each(aggRow[mapChildrenField], (row) => {
|
|
3010
|
+
if (row.isAggregate) {
|
|
3011
|
+
count += row.childCount || 0;
|
|
3012
|
+
}
|
|
3013
|
+
else {
|
|
3014
|
+
count++;
|
|
3015
|
+
}
|
|
3016
|
+
});
|
|
3017
|
+
aggRow.childCount = count;
|
|
3018
|
+
});
|
|
3019
|
+
if ($xeTable.handlePivotTableAggregateData) {
|
|
3020
|
+
$xeTable.handlePivotTableAggregateData(aggList);
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
const updateGroupData = () => {
|
|
3025
|
+
const { aggregateConfig, rowGroupConfig } = props;
|
|
3026
|
+
const { isRowGroupStatus } = reactData;
|
|
3027
|
+
const { tableFullGroupData } = internalData;
|
|
3028
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
3029
|
+
const { mapChildrenField } = aggregateOpts;
|
|
3030
|
+
if ((aggregateConfig || rowGroupConfig) && isRowGroupStatus) {
|
|
3031
|
+
const aggList = [];
|
|
3032
|
+
XEUtils.eachTree(tableFullGroupData, row => {
|
|
3033
|
+
if (row.isAggregate) {
|
|
3034
|
+
aggList.push(row);
|
|
3035
|
+
}
|
|
3036
|
+
}, { children: mapChildrenField });
|
|
3037
|
+
handleeGroupSummary(aggList);
|
|
3038
|
+
}
|
|
3039
|
+
};
|
|
2999
3040
|
const handleGroupData = (list, rowGroups) => {
|
|
3000
3041
|
let fullData = list;
|
|
3001
3042
|
let treeData = list;
|
|
3002
3043
|
if (rowGroups) {
|
|
3003
|
-
const
|
|
3004
|
-
const { rowField, parentField, childrenField, mapChildrenField } =
|
|
3044
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
3045
|
+
const { rowField, parentField, childrenField, mapChildrenField } = aggregateOpts;
|
|
3005
3046
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
3006
3047
|
const { checkField } = checkboxOpts;
|
|
3007
3048
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
@@ -3012,7 +3053,7 @@ export default defineComponent({
|
|
|
3012
3053
|
const groupField = rgItem.field;
|
|
3013
3054
|
const groupColumn = $xeTable.getColumnByField(groupField);
|
|
3014
3055
|
const groupMaps = {};
|
|
3015
|
-
const
|
|
3056
|
+
const aggList = [];
|
|
3016
3057
|
const rowkey = getRowkey($xeTable);
|
|
3017
3058
|
list.forEach((row) => {
|
|
3018
3059
|
const cellValue = groupColumn ? $xeTable.getCellLabel(row, groupColumn) : XEUtils.get(row, groupField);
|
|
@@ -3029,12 +3070,12 @@ export default defineComponent({
|
|
|
3029
3070
|
});
|
|
3030
3071
|
XEUtils.objectEach(groupMaps, (childList, groupValue) => {
|
|
3031
3072
|
const { fullData: childFullData, treeData: childTreeData } = handleGroupData(childList, rowGroups.slice(1));
|
|
3032
|
-
const
|
|
3033
|
-
const groupRow = {
|
|
3073
|
+
const aggRow = {
|
|
3034
3074
|
isAggregate: true,
|
|
3035
|
-
|
|
3075
|
+
aggData: {},
|
|
3036
3076
|
groupContent: groupValue,
|
|
3037
3077
|
groupField,
|
|
3078
|
+
childCount: 0,
|
|
3038
3079
|
[rowField]: getRowUniqueId(),
|
|
3039
3080
|
[parentField]: null,
|
|
3040
3081
|
[rowkey]: getRowUniqueId(),
|
|
@@ -3042,30 +3083,19 @@ export default defineComponent({
|
|
|
3042
3083
|
[mapChildrenField]: childTreeData
|
|
3043
3084
|
};
|
|
3044
3085
|
if (checkField) {
|
|
3045
|
-
|
|
3086
|
+
aggRow[checkField] = false;
|
|
3046
3087
|
}
|
|
3047
3088
|
if (indeterminateField) {
|
|
3048
|
-
|
|
3089
|
+
aggRow[indeterminateField] = false;
|
|
3049
3090
|
}
|
|
3050
|
-
|
|
3051
|
-
treeData.push(
|
|
3052
|
-
fullData.push(
|
|
3091
|
+
aggList.push(aggRow);
|
|
3092
|
+
treeData.push(aggRow);
|
|
3093
|
+
fullData.push(aggRow);
|
|
3053
3094
|
if (childFullData.length) {
|
|
3054
3095
|
fullData.push(...childFullData);
|
|
3055
3096
|
}
|
|
3056
3097
|
});
|
|
3057
|
-
|
|
3058
|
-
let count = 0;
|
|
3059
|
-
XEUtils.each(groupItem[childrenField], row => {
|
|
3060
|
-
if (row.isAggregate) {
|
|
3061
|
-
count += row[childrenField] ? row[childrenField].length : 0;
|
|
3062
|
-
}
|
|
3063
|
-
else {
|
|
3064
|
-
count++;
|
|
3065
|
-
}
|
|
3066
|
-
});
|
|
3067
|
-
groupItem.childCount = count;
|
|
3068
|
-
});
|
|
3098
|
+
handleeGroupSummary(aggList);
|
|
3069
3099
|
}
|
|
3070
3100
|
}
|
|
3071
3101
|
return {
|
|
@@ -3078,7 +3108,7 @@ export default defineComponent({
|
|
|
3078
3108
|
* @param {Array} datas 数据
|
|
3079
3109
|
*/
|
|
3080
3110
|
const loadTableData = (datas, isReset) => {
|
|
3081
|
-
const { keepSource, treeConfig, rowGroupConfig } = props;
|
|
3111
|
+
const { keepSource, treeConfig, rowGroupConfig, aggregateConfig } = props;
|
|
3082
3112
|
const { rowGroupList, scrollYLoad: oldScrollYLoad } = reactData;
|
|
3083
3113
|
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData;
|
|
3084
3114
|
const rowOpts = computeRowOpts.value;
|
|
@@ -3092,11 +3122,11 @@ export default defineComponent({
|
|
|
3092
3122
|
errLog('vxe.error.errMaxRow', [supportMaxRow]);
|
|
3093
3123
|
}
|
|
3094
3124
|
if (treeConfig && rowGroupList.length) {
|
|
3095
|
-
errLog('vxe.error.noTree', ['
|
|
3125
|
+
errLog('vxe.error.noTree', ['aggregate-config']);
|
|
3096
3126
|
return nextTick();
|
|
3097
3127
|
}
|
|
3098
3128
|
if (rowOpts.drag && rowGroupList.length) {
|
|
3099
|
-
errLog('vxe.error.errConflicts', ['row-config.drag', '
|
|
3129
|
+
errLog('vxe.error.errConflicts', ['row-config.drag', 'aggregate-config']);
|
|
3100
3130
|
return nextTick();
|
|
3101
3131
|
}
|
|
3102
3132
|
let isRGroup = false;
|
|
@@ -3135,7 +3165,7 @@ export default defineComponent({
|
|
|
3135
3165
|
treeData = fullData.slice(0);
|
|
3136
3166
|
}
|
|
3137
3167
|
}
|
|
3138
|
-
else if (rowGroupConfig && rowGroupList.length) {
|
|
3168
|
+
else if ((aggregateConfig || rowGroupConfig) && rowGroupList.length) {
|
|
3139
3169
|
const groupRest = handleGroupData(fullData, rowGroupList);
|
|
3140
3170
|
treeData = groupRest.treeData;
|
|
3141
3171
|
fullData = groupRest.fullData;
|
|
@@ -3244,6 +3274,8 @@ export default defineComponent({
|
|
|
3244
3274
|
if (oldScrollYLoad === sYLoad) {
|
|
3245
3275
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3246
3276
|
.then(() => {
|
|
3277
|
+
calcCellHeight();
|
|
3278
|
+
updateRowOffsetTop();
|
|
3247
3279
|
resolve();
|
|
3248
3280
|
});
|
|
3249
3281
|
}
|
|
@@ -3251,6 +3283,8 @@ export default defineComponent({
|
|
|
3251
3283
|
setTimeout(() => {
|
|
3252
3284
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3253
3285
|
.then(() => {
|
|
3286
|
+
calcCellHeight();
|
|
3287
|
+
updateRowOffsetTop();
|
|
3254
3288
|
resolve();
|
|
3255
3289
|
});
|
|
3256
3290
|
});
|
|
@@ -3487,6 +3521,7 @@ export default defineComponent({
|
|
|
3487
3521
|
$xeTable.clearMergeCells();
|
|
3488
3522
|
$xeTable.clearMergeFooterItems();
|
|
3489
3523
|
$xeTable.handleTableData(true);
|
|
3524
|
+
$xeTable.handleAggregateSummaryData();
|
|
3490
3525
|
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3491
3526
|
warnLog('vxe.error.scrollErrProp', ['column.type=expand']);
|
|
3492
3527
|
}
|
|
@@ -3612,8 +3647,8 @@ export default defineComponent({
|
|
|
3612
3647
|
*/
|
|
3613
3648
|
const handleRowGroupBaseExpand = (rows, expanded) => {
|
|
3614
3649
|
const { fullAllDataRowIdData, tableFullGroupData, rowGroupExpandedMaps } = internalData;
|
|
3615
|
-
const
|
|
3616
|
-
const { mapChildrenField, accordion } =
|
|
3650
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
3651
|
+
const { mapChildrenField, accordion } = aggregateOpts;
|
|
3617
3652
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
3618
3653
|
let validRows = rows;
|
|
3619
3654
|
if (mapChildrenField) {
|
|
@@ -4095,10 +4130,12 @@ export default defineComponent({
|
|
|
4095
4130
|
reloadRow(row, record, field) {
|
|
4096
4131
|
const { keepSource } = props;
|
|
4097
4132
|
const { tableData } = reactData;
|
|
4098
|
-
const {
|
|
4133
|
+
const { sourceDataRowIdData } = internalData;
|
|
4099
4134
|
if (keepSource) {
|
|
4100
|
-
|
|
4101
|
-
|
|
4135
|
+
if ($xeTable.isAggregateRecord(row)) {
|
|
4136
|
+
return nextTick();
|
|
4137
|
+
}
|
|
4138
|
+
const oRow = sourceDataRowIdData[getRowid($xeTable, row)];
|
|
4102
4139
|
if (oRow && row) {
|
|
4103
4140
|
if (field) {
|
|
4104
4141
|
const newValue = XEUtils.clone(XEUtils.get(record || row, field), true);
|
|
@@ -6005,9 +6042,9 @@ export default defineComponent({
|
|
|
6005
6042
|
return rest;
|
|
6006
6043
|
},
|
|
6007
6044
|
setRowGroups(fieldOrColumns) {
|
|
6008
|
-
const { rowGroupConfig } = props;
|
|
6009
|
-
if (!rowGroupConfig) {
|
|
6010
|
-
errLog('vxe.error.reqProp', ['
|
|
6045
|
+
const { aggregateConfig, rowGroupConfig } = props;
|
|
6046
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6047
|
+
errLog('vxe.error.reqProp', ['aggregate-config']);
|
|
6011
6048
|
return nextTick();
|
|
6012
6049
|
}
|
|
6013
6050
|
if (fieldOrColumns) {
|
|
@@ -6019,19 +6056,27 @@ export default defineComponent({
|
|
|
6019
6056
|
return nextTick();
|
|
6020
6057
|
},
|
|
6021
6058
|
clearRowGroups() {
|
|
6022
|
-
const { rowGroupConfig } = props;
|
|
6023
|
-
if (!rowGroupConfig) {
|
|
6024
|
-
errLog('vxe.error.reqProp', ['
|
|
6059
|
+
const { aggregateConfig, rowGroupConfig } = props;
|
|
6060
|
+
if (!(aggregateConfig || rowGroupConfig)) {
|
|
6061
|
+
errLog('vxe.error.reqProp', ['aggregate-config']);
|
|
6025
6062
|
return nextTick();
|
|
6026
6063
|
}
|
|
6027
6064
|
handleUpdateRowGroup([]);
|
|
6028
6065
|
return loadTableData(internalData.tableSynchData, true);
|
|
6029
6066
|
},
|
|
6030
6067
|
isRowGroupRecord(row) {
|
|
6068
|
+
warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord']);
|
|
6069
|
+
return $xeTable.isAggregateRecord(row);
|
|
6070
|
+
},
|
|
6071
|
+
isRowGroupExpandByRow(row) {
|
|
6072
|
+
warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow']);
|
|
6073
|
+
return $xeTable.isAggregateExpandByRow(row);
|
|
6074
|
+
},
|
|
6075
|
+
isAggregateRecord(row) {
|
|
6031
6076
|
const { isRowGroupStatus } = reactData;
|
|
6032
6077
|
return isRowGroupStatus && row.isAggregate;
|
|
6033
6078
|
},
|
|
6034
|
-
|
|
6079
|
+
isAggregateExpandByRow(row) {
|
|
6035
6080
|
const { rowGroupExpandedFlag } = reactData;
|
|
6036
6081
|
const { rowGroupExpandedMaps } = internalData;
|
|
6037
6082
|
return !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[getRowid($xeTable, row)];
|
|
@@ -6047,8 +6092,8 @@ export default defineComponent({
|
|
|
6047
6092
|
},
|
|
6048
6093
|
setAllRowGroupExpand(expanded) {
|
|
6049
6094
|
const { tableFullGroupData } = internalData;
|
|
6050
|
-
const
|
|
6051
|
-
const { mapChildrenField } =
|
|
6095
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
6096
|
+
const { mapChildrenField } = aggregateOpts;
|
|
6052
6097
|
const rgExpandedMaps = {};
|
|
6053
6098
|
if (expanded && mapChildrenField) {
|
|
6054
6099
|
XEUtils.eachTree(tableFullGroupData, (row) => {
|
|
@@ -7590,8 +7635,8 @@ export default defineComponent({
|
|
|
7590
7635
|
}, { children: childrenField });
|
|
7591
7636
|
}
|
|
7592
7637
|
else if (isRowGroupStatus) {
|
|
7593
|
-
const
|
|
7594
|
-
const { mapChildrenField } =
|
|
7638
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
7639
|
+
const { mapChildrenField } = aggregateOpts;
|
|
7595
7640
|
XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
|
|
7596
7641
|
const rowid = handleUpdateRowId(row);
|
|
7597
7642
|
handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path));
|
|
@@ -8104,7 +8149,7 @@ export default defineComponent({
|
|
|
8104
8149
|
const { treeConfig } = props;
|
|
8105
8150
|
const { isRowGroupStatus } = reactData;
|
|
8106
8151
|
const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData;
|
|
8107
|
-
const
|
|
8152
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
8108
8153
|
const treeOpts = computeTreeOpts.value;
|
|
8109
8154
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
8110
8155
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
@@ -8118,7 +8163,7 @@ export default defineComponent({
|
|
|
8118
8163
|
const childRowList = [];
|
|
8119
8164
|
if (isRowGroupStatus) {
|
|
8120
8165
|
// 行分组
|
|
8121
|
-
const mapChildrenField =
|
|
8166
|
+
const mapChildrenField = aggregateOpts.mapChildrenField;
|
|
8122
8167
|
if (mapChildrenField) {
|
|
8123
8168
|
XEUtils.eachTree(afterGroupFullData, (row) => {
|
|
8124
8169
|
const rowid = handleGetRowId(row);
|
|
@@ -8279,7 +8324,7 @@ export default defineComponent({
|
|
|
8279
8324
|
const { treeConfig } = props;
|
|
8280
8325
|
const { isRowGroupStatus } = reactData;
|
|
8281
8326
|
const { selectCheckboxMaps } = internalData;
|
|
8282
|
-
const
|
|
8327
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
8283
8328
|
const treeOpts = computeTreeOpts.value;
|
|
8284
8329
|
const { transform, mapChildrenField } = treeOpts;
|
|
8285
8330
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -8331,7 +8376,7 @@ export default defineComponent({
|
|
|
8331
8376
|
}
|
|
8332
8377
|
handleCheckboxReserveRow(row, checked);
|
|
8333
8378
|
}
|
|
8334
|
-
}, { children:
|
|
8379
|
+
}, { children: aggregateOpts.mapChildrenField });
|
|
8335
8380
|
reactData.updateCheckboxFlag++;
|
|
8336
8381
|
return;
|
|
8337
8382
|
}
|
|
@@ -8394,6 +8439,9 @@ export default defineComponent({
|
|
|
8394
8439
|
internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList);
|
|
8395
8440
|
reactData.mergeFootFlag++;
|
|
8396
8441
|
},
|
|
8442
|
+
handleAggregateSummaryData() {
|
|
8443
|
+
return updateGroupData();
|
|
8444
|
+
},
|
|
8397
8445
|
triggerHeaderTitleEvent(evnt, iconParams, params) {
|
|
8398
8446
|
const tipContent = iconParams.content || iconParams.message;
|
|
8399
8447
|
if (tipContent) {
|
|
@@ -8554,7 +8602,7 @@ export default defineComponent({
|
|
|
8554
8602
|
const radioOpts = computeRadioOpts.value;
|
|
8555
8603
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
8556
8604
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
8557
|
-
const
|
|
8605
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
8558
8606
|
const rowOpts = computeRowOpts.value;
|
|
8559
8607
|
const columnOpts = computeColumnOpts.value;
|
|
8560
8608
|
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
@@ -8581,7 +8629,7 @@ export default defineComponent({
|
|
|
8581
8629
|
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
8582
8630
|
}
|
|
8583
8631
|
// 如果是行分组
|
|
8584
|
-
if ((
|
|
8632
|
+
if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
|
|
8585
8633
|
$xeTable.triggerRowGroupExpandEvent(evnt, params);
|
|
8586
8634
|
}
|
|
8587
8635
|
}
|
|
@@ -8869,9 +8917,9 @@ export default defineComponent({
|
|
|
8869
8917
|
*/
|
|
8870
8918
|
triggerRowGroupExpandEvent(evnt, params) {
|
|
8871
8919
|
const { rowGroupExpandedMaps } = internalData;
|
|
8872
|
-
const
|
|
8920
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
8873
8921
|
const { row, column } = params;
|
|
8874
|
-
const { trigger } =
|
|
8922
|
+
const { trigger } = aggregateOpts;
|
|
8875
8923
|
if (trigger === 'manual') {
|
|
8876
8924
|
return;
|
|
8877
8925
|
}
|
|
@@ -10115,10 +10163,10 @@ export default defineComponent({
|
|
|
10115
10163
|
const { tableFullData } = internalData;
|
|
10116
10164
|
const rests = [];
|
|
10117
10165
|
if (treeConfig || isRowGroupStatus) {
|
|
10118
|
-
const
|
|
10166
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
10119
10167
|
const treeOpts = computeTreeOpts.value;
|
|
10120
10168
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
10121
|
-
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ?
|
|
10169
|
+
const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField });
|
|
10122
10170
|
if (matchObj) {
|
|
10123
10171
|
const nodes = matchObj.nodes;
|
|
10124
10172
|
nodes.forEach((row, index) => {
|
|
@@ -11231,9 +11279,9 @@ export default defineComponent({
|
|
|
11231
11279
|
const columnOpts = computeColumnOpts.value;
|
|
11232
11280
|
const rowOpts = computeRowOpts.value;
|
|
11233
11281
|
const customOpts = computeCustomOpts.value;
|
|
11234
|
-
const
|
|
11282
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
11235
11283
|
const virtualYOpts = computeVirtualYOpts.value;
|
|
11236
|
-
const { groupFields } =
|
|
11284
|
+
const { groupFields } = aggregateOpts;
|
|
11237
11285
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
11238
11286
|
initTpImg();
|
|
11239
11287
|
}
|
|
@@ -11254,6 +11302,7 @@ export default defineComponent({
|
|
|
11254
11302
|
const currentRowOpts = computeCurrentRowOpts.value;
|
|
11255
11303
|
const currentColumnOpts = computeCurrentColumnOpts.value;
|
|
11256
11304
|
const keyboardOpts = computeKeyboardOpts.value;
|
|
11305
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
11257
11306
|
if (props.rowId) {
|
|
11258
11307
|
warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField']);
|
|
11259
11308
|
}
|
|
@@ -11341,6 +11390,15 @@ export default defineComponent({
|
|
|
11341
11390
|
if (props.dragConfig) {
|
|
11342
11391
|
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
|
|
11343
11392
|
}
|
|
11393
|
+
if (props.rowGroupConfig) {
|
|
11394
|
+
warnLog('vxe.error.delProp', ['row-group-config', 'aggregate-config']);
|
|
11395
|
+
}
|
|
11396
|
+
if (aggregateOpts.countFields) {
|
|
11397
|
+
warnLog('vxe.error.delProp', ['row-group-config.countFields', 'column.agg-func']);
|
|
11398
|
+
}
|
|
11399
|
+
if (aggregateOpts.countMethod) {
|
|
11400
|
+
warnLog('vxe.error.delProp', ['row-group-config.countMethod', 'aggregate-config.aggregateMethod']);
|
|
11401
|
+
}
|
|
11344
11402
|
if (props.treeConfig && treeOpts.children) {
|
|
11345
11403
|
warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField']);
|
|
11346
11404
|
}
|
package/es/table/src/util.js
CHANGED
|
@@ -145,19 +145,22 @@ export function updateFastRowKey(row, rowKey) {
|
|
|
145
145
|
}
|
|
146
146
|
return rowid;
|
|
147
147
|
}
|
|
148
|
-
export
|
|
148
|
+
export function handleFieldOrColumn($xeTable, fieldOrColumn) {
|
|
149
149
|
if (fieldOrColumn) {
|
|
150
150
|
return XEUtils.isString(fieldOrColumn) || XEUtils.isNumber(fieldOrColumn) ? $xeTable.getColumnByField(`${fieldOrColumn}`) : fieldOrColumn;
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
|
-
}
|
|
154
|
-
export
|
|
153
|
+
}
|
|
154
|
+
export function handleRowidOrRow($xeTable, rowidOrRow) {
|
|
155
155
|
if (rowidOrRow) {
|
|
156
156
|
const rowid = XEUtils.isString(rowidOrRow) || XEUtils.isNumber(rowidOrRow) ? rowidOrRow : getRowid($xeTable, rowidOrRow);
|
|
157
157
|
return $xeTable.getRowById(rowid);
|
|
158
158
|
}
|
|
159
159
|
return null;
|
|
160
|
-
}
|
|
160
|
+
}
|
|
161
|
+
export function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
|
|
162
|
+
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
163
|
+
}
|
|
161
164
|
function getPaddingLeftRightSize(elem) {
|
|
162
165
|
if (elem) {
|
|
163
166
|
const computedStyle = getComputedStyle(elem);
|
package/es/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeUI } from '@vxe-ui/core';
|
|
2
2
|
import { getFuncText } from './src/utils';
|
|
3
|
-
export const version = "4.13.
|
|
3
|
+
export const version = "4.13.36";
|
|
4
4
|
VxeUI.version = version;
|
|
5
5
|
VxeUI.tableVersion = version;
|
|
6
6
|
VxeUI.setConfig({
|
|
@@ -126,7 +126,7 @@ VxeUI.setConfig({
|
|
|
126
126
|
// isEvery: false,
|
|
127
127
|
showIcon: true
|
|
128
128
|
},
|
|
129
|
-
|
|
129
|
+
aggregateConfig: {
|
|
130
130
|
padding: true,
|
|
131
131
|
rowField: 'id',
|
|
132
132
|
parentField: '_X_ROW_PARENT_KEY',
|
|
@@ -200,13 +200,13 @@ VxeUI.setConfig({
|
|
|
200
200
|
isReplace: true
|
|
201
201
|
},
|
|
202
202
|
virtualXConfig: {
|
|
203
|
-
enabled:
|
|
203
|
+
// enabled: false,
|
|
204
204
|
gt: 24,
|
|
205
205
|
preSize: 1,
|
|
206
206
|
oSize: 0
|
|
207
207
|
},
|
|
208
208
|
virtualYConfig: {
|
|
209
|
-
enabled:
|
|
209
|
+
// enabled: false,
|
|
210
210
|
gt: 100,
|
|
211
211
|
preSize: 1,
|
|
212
212
|
oSize: 0
|
package/es/ui/src/log.js
CHANGED