vxe-table 3.15.34 → 3.15.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.
Files changed (62) hide show
  1. package/es/grid/src/grid.js +50 -17
  2. package/es/style.css +1 -1
  3. package/es/table/module/edit/mixin.js +2 -2
  4. package/es/table/module/validator/mixin.js +11 -2
  5. package/es/table/src/body.js +20 -3
  6. package/es/table/src/cell.js +52 -36
  7. package/es/table/src/column.js +2 -0
  8. package/es/table/src/columnInfo.js +2 -0
  9. package/es/table/src/methods.js +135 -76
  10. package/es/table/src/props.js +3 -1
  11. package/es/table/src/table.js +19 -6
  12. package/es/table/src/util.js +5 -2
  13. package/es/ui/index.js +4 -4
  14. package/es/ui/src/log.js +1 -1
  15. package/lib/grid/src/grid.js +57 -24
  16. package/lib/grid/src/grid.min.js +1 -1
  17. package/lib/index.umd.js +323 -149
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/table/module/edit/mixin.js +2 -2
  21. package/lib/table/module/edit/mixin.min.js +1 -1
  22. package/lib/table/module/validator/mixin.js +14 -2
  23. package/lib/table/module/validator/mixin.min.js +1 -1
  24. package/lib/table/src/body.js +19 -2
  25. package/lib/table/src/body.min.js +1 -1
  26. package/lib/table/src/cell.js +43 -28
  27. package/lib/table/src/cell.min.js +1 -1
  28. package/lib/table/src/column.js +2 -0
  29. package/lib/table/src/column.min.js +1 -1
  30. package/lib/table/src/columnInfo.js +2 -0
  31. package/lib/table/src/columnInfo.min.js +1 -1
  32. package/lib/table/src/methods.js +151 -74
  33. package/lib/table/src/methods.min.js +1 -1
  34. package/lib/table/src/props.js +3 -1
  35. package/lib/table/src/props.min.js +1 -1
  36. package/lib/table/src/table.js +19 -6
  37. package/lib/table/src/table.min.js +1 -1
  38. package/lib/table/src/util.js +7 -4
  39. package/lib/table/src/util.min.js +1 -1
  40. package/lib/ui/index.js +4 -4
  41. package/lib/ui/index.min.js +1 -1
  42. package/lib/ui/src/log.js +1 -1
  43. package/lib/ui/src/log.min.js +1 -1
  44. package/package.json +1 -1
  45. package/packages/grid/src/grid.ts +56 -17
  46. package/packages/table/module/edit/mixin.ts +2 -2
  47. package/packages/table/module/validator/mixin.ts +11 -3
  48. package/packages/table/src/body.ts +20 -3
  49. package/packages/table/src/cell.ts +52 -36
  50. package/packages/table/src/column.ts +2 -0
  51. package/packages/table/src/columnInfo.ts +3 -0
  52. package/packages/table/src/methods.ts +143 -77
  53. package/packages/table/src/props.ts +3 -1
  54. package/packages/table/src/table.ts +20 -6
  55. package/packages/table/src/util.ts +6 -2
  56. package/packages/ui/index.ts +3 -3
  57. /package/es/{iconfont.1749092456241.ttf → iconfont.1749440099787.ttf} +0 -0
  58. /package/es/{iconfont.1749092456241.woff → iconfont.1749440099787.woff} +0 -0
  59. /package/es/{iconfont.1749092456241.woff2 → iconfont.1749440099787.woff2} +0 -0
  60. /package/lib/{iconfont.1749092456241.ttf → iconfont.1749440099787.ttf} +0 -0
  61. /package/lib/{iconfont.1749092456241.woff → iconfont.1749440099787.woff} +0 -0
  62. /package/lib/{iconfont.1749092456241.woff2 → iconfont.1749440099787.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 rowGroupOpts = $xeTable.computeRowGroupOpts
451
- const { mapChildrenField, accordion } = rowGroupOpts
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 rowGroupOpts = $xeTable.computeRowGroupOpts
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 } = rowGroupOpts
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 rowGroupOpts = $xeTable.computeRowGroupOpts
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: rowGroupOpts.mapChildrenField,
732
- mapChildren: rowGroupOpts.childrenField
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: rowGroupOpts.mapChildrenField,
755
- mapChildren: rowGroupOpts.childrenField
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: rowGroupOpts.rowField,
784
- parentKey: rowGroupOpts.parentField,
785
- children: rowGroupOpts.mapChildrenField
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: rowGroupOpts.rowField,
791
- parentKey: rowGroupOpts.parentField,
792
- children: rowGroupOpts.childrenField,
793
- mapChildren: rowGroupOpts.mapChildrenField
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: rowGroupOpts.mapChildrenField,
848
- mapChildren: rowGroupOpts.childrenField
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 rowGroupOpts = $xeTable.computeRowGroupOpts
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: rowGroupOpts.mapChildrenField })
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: rowGroupOpts.mapChildrenField })
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 rowGroupOpts = $xeTable.computeRowGroupOpts
2719
- const { rowField, parentField, childrenField, mapChildrenField } = rowGroupOpts
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 groupList: any[] = []
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 childCount = 0
2748
- const groupRow = {
2789
+ const aggRow: VxeTableDefines.AggregateRowInfo = {
2749
2790
  isAggregate: true,
2750
- childCount,
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
- groupRow[checkField] = false
2802
+ aggRow[checkField] = false
2761
2803
  }
2762
2804
  if (indeterminateField) {
2763
- groupRow[indeterminateField] = false
2805
+ aggRow[indeterminateField] = false
2764
2806
  }
2765
- groupList.push(groupRow)
2766
- treeData.push(groupRow)
2767
- fullData.push(groupRow)
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
- XEUtils.lastEach(groupList, groupItem => {
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', ['row-group-config'])
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', 'row-group-config'])
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'])
@@ -3837,25 +3874,37 @@ const Methods = {
3837
3874
  * @param {String} field 字段名
3838
3875
  */
3839
3876
  reloadRow (row: any, record: any, field: any) {
3840
- const { keepSource, tableSourceData, tableData } = this
3877
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
3878
+ const props = $xeTable
3879
+ const reactData = $xeTable as unknown as TableReactData
3880
+ const internalData = $xeTable as unknown as TableInternalData
3881
+
3882
+ const { keepSource } = props
3883
+ const { tableData } = reactData
3884
+ const { sourceDataRowIdData } = internalData
3841
3885
  if (keepSource) {
3842
- const rowIndex = this.getRowIndex(row)
3843
- const oRow = tableSourceData[rowIndex]
3886
+ if ($xeTable.isAggregateRecord(row)) {
3887
+ return $xeTable.$nextTick()
3888
+ }
3889
+ const oRow = sourceDataRowIdData[getRowid($xeTable, row)]
3844
3890
  if (oRow && row) {
3845
3891
  if (field) {
3846
- const newValue = XEUtils.get(record || row, field)
3892
+ const newValue = XEUtils.clone(XEUtils.get(record || row, field), true)
3847
3893
  XEUtils.set(row, field, newValue)
3848
3894
  XEUtils.set(oRow, field, newValue)
3849
3895
  } else {
3850
- const newRecord = XEUtils.clone({ ...record }, true)
3896
+ const rowkey = getRowkey($xeTable)
3897
+ const rowid = getRowid($xeTable, row)
3898
+ const newRecord = XEUtils.clone(Object.assign({}, record), true)
3899
+ XEUtils.set(newRecord, rowkey, rowid)
3851
3900
  XEUtils.destructuring(oRow, Object.assign(row, newRecord))
3852
3901
  }
3853
3902
  }
3854
- this.tableData = tableData.slice(0)
3903
+ reactData.tableData = tableData.slice(0)
3855
3904
  } else {
3856
3905
  errLog('vxe.error.reqProp', ['keep-source'])
3857
3906
  }
3858
- return this.$nextTick()
3907
+ return $xeTable.$nextTick()
3859
3908
  },
3860
3909
  /**
3861
3910
  * 加载列配置
@@ -3863,9 +3912,9 @@ const Methods = {
3863
3912
  * @param {ColumnInfo} columns 列配置
3864
3913
  */
3865
3914
  loadColumn (columns: any) {
3866
- const $xeTable = this
3915
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
3867
3916
 
3868
- const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn(this, column), { children: 'children' })
3917
+ const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn($xeTable, column), { children: 'children' })
3869
3918
  return handleColumn($xeTable, collectColumn)
3870
3919
  },
3871
3920
  /**
@@ -3938,8 +3987,8 @@ const Methods = {
3938
3987
  handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
3939
3988
  }, { children: childrenField })
3940
3989
  } else if (isRowGroupStatus) {
3941
- const rowGroupOpts = $xeTable.computeRowGroupOpts
3942
- const { mapChildrenField } = rowGroupOpts
3990
+ const aggregateOpts = $xeTable.computeAggregateOpts
3991
+ const { mapChildrenField } = aggregateOpts
3943
3992
  XEUtils.eachTree(tableFullGroupData, (row, index, items, path, parentRow, nodes) => {
3944
3993
  const rowid = handleUpdateRowId(row)
3945
3994
  handleRowCache(row, index, items, parentRow ? -1 : index, parentRow, rowid, nodes.length - 1, toTreePathSeq(path))
@@ -6385,6 +6434,11 @@ const Methods = {
6385
6434
  internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList)
6386
6435
  reactData.mergeFootFlag++
6387
6436
  },
6437
+ handleAggregateSummaryData () {
6438
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
6439
+
6440
+ return updateGroupData($xeTable)
6441
+ },
6388
6442
  handleTargetLeaveEvent () {
6389
6443
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
6390
6444
  const internalData = $xeTable as unknown as TableInternalData
@@ -6695,7 +6749,7 @@ const Methods = {
6695
6749
  const { treeConfig } = props
6696
6750
  const { isRowGroupStatus } = reactData
6697
6751
  const { selectCheckboxMaps } = internalData
6698
- const rowGroupOpts = $xeTable.computeRowGroupOpts
6752
+ const aggregateOpts = $xeTable.computeAggregateOpts
6699
6753
  const treeOpts = $xeTable.computeTreeOpts
6700
6754
  const { transform, mapChildrenField } = treeOpts
6701
6755
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -6747,7 +6801,7 @@ const Methods = {
6747
6801
  }
6748
6802
  handleCheckboxReserveRow($xeTable, row, checked)
6749
6803
  }
6750
- }, { children: rowGroupOpts.mapChildrenField })
6804
+ }, { children: aggregateOpts.mapChildrenField })
6751
6805
  reactData.updateCheckboxFlag++
6752
6806
  return
6753
6807
  } else if (treeConfig) {
@@ -6898,7 +6952,7 @@ const Methods = {
6898
6952
  const { treeConfig } = props
6899
6953
  const { isRowGroupStatus } = reactData
6900
6954
  const { afterTreeFullData, afterGroupFullData, selectCheckboxMaps, treeIndeterminateRowMaps } = internalData
6901
- const rowGroupOpts = $xeTable.computeRowGroupOpts
6955
+ const aggregateOpts = $xeTable.computeAggregateOpts
6902
6956
  const treeOpts = $xeTable.computeTreeOpts
6903
6957
  const childrenField = treeOpts.children || treeOpts.childrenField
6904
6958
  const checkboxOpts = $xeTable.computeCheckboxOpts
@@ -6913,7 +6967,7 @@ const Methods = {
6913
6967
 
6914
6968
  if (isRowGroupStatus) {
6915
6969
  // 行分组
6916
- const mapChildrenField = rowGroupOpts.mapChildrenField
6970
+ const mapChildrenField = aggregateOpts.mapChildrenField
6917
6971
  if (mapChildrenField) {
6918
6972
  XEUtils.eachTree(afterGroupFullData, (row) => {
6919
6973
  const rowid = handleGetRowId(row)
@@ -7527,7 +7581,7 @@ const Methods = {
7527
7581
  const radioOpts = $xeTable.computeRadioOpts
7528
7582
  const checkboxOpts = $xeTable.computeCheckboxOpts
7529
7583
  const keyboardOpts = $xeTable.computeKeyboardOpts
7530
- const rowGroupOpts = $xeTable.computeRowGroupOpts
7584
+ const aggregateOpts = $xeTable.computeAggregateOpts
7531
7585
  const rowOpts = $xeTable.computeRowOpts
7532
7586
  const columnOpts = $xeTable.computeColumnOpts
7533
7587
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts
@@ -7554,7 +7608,7 @@ const Methods = {
7554
7608
  $xeTable.triggerTreeExpandEvent(evnt, params)
7555
7609
  }
7556
7610
  // 如果是行分组
7557
- if ((rowGroupOpts.trigger === 'row' || (rowGroupNode && rowGroupOpts.trigger === 'cell'))) {
7611
+ if ((aggregateOpts.trigger === 'row' || (rowGroupNode && aggregateOpts.trigger === 'cell'))) {
7558
7612
  $xeTable.triggerRowGroupExpandEvent(evnt, params)
7559
7613
  }
7560
7614
  }
@@ -9034,9 +9088,9 @@ const Methods = {
9034
9088
  const props = $xeTable
9035
9089
  const internalData = $xeTable as unknown as TableInternalData
9036
9090
 
9037
- const { rowGroupConfig } = props
9038
- if (!rowGroupConfig) {
9039
- errLog('vxe.error.reqProp', ['row-group-config'])
9091
+ const { aggregateConfig, rowGroupConfig } = props
9092
+ if (!(aggregateConfig || rowGroupConfig)) {
9093
+ errLog('vxe.error.reqProp', ['aggregate-config'])
9040
9094
  return $xeTable.$nextTick()
9041
9095
  }
9042
9096
  if (fieldOrColumns) {
@@ -9052,9 +9106,9 @@ const Methods = {
9052
9106
  const props = $xeTable
9053
9107
  const internalData = $xeTable as unknown as TableInternalData
9054
9108
 
9055
- const { rowGroupConfig } = props
9056
- if (!rowGroupConfig) {
9057
- errLog('vxe.error.reqProp', ['row-group-config'])
9109
+ const { aggregateConfig, rowGroupConfig } = props
9110
+ if (!(aggregateConfig || rowGroupConfig)) {
9111
+ errLog('vxe.error.reqProp', ['aggregate-config'])
9058
9112
  return $xeTable.$nextTick()
9059
9113
  }
9060
9114
  handleUpdateRowGroup($xeTable, [])
@@ -9062,12 +9116,24 @@ const Methods = {
9062
9116
  },
9063
9117
  isRowGroupRecord (row: any) {
9064
9118
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
9119
+
9120
+ warnLog('vxe.error.delFunc', ['isRowGroupRecord', 'isAggregateRecord'])
9121
+ return $xeTable.isAggregateRecord(row)
9122
+ },
9123
+ isRowGroupExpandByRow (row: any) {
9124
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
9125
+
9126
+ warnLog('vxe.error.delFunc', ['isRowGroupExpandByRow', 'isAggregateExpandByRow'])
9127
+ return $xeTable.isAggregateExpandByRow(row)
9128
+ },
9129
+ isAggregateRecord (row: any) {
9130
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
9065
9131
  const reactData = $xeTable as unknown as TableReactData
9066
9132
 
9067
9133
  const { isRowGroupStatus } = reactData
9068
9134
  return isRowGroupStatus && row.isAggregate
9069
9135
  },
9070
- isRowGroupExpandByRow (row: any) {
9136
+ isAggregateExpandByRow (row: any) {
9071
9137
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
9072
9138
  const reactData = $xeTable as unknown as TableReactData
9073
9139
  const internalData = $xeTable as unknown as TableInternalData
@@ -9093,8 +9159,8 @@ const Methods = {
9093
9159
  const internalData = $xeTable as unknown as TableInternalData
9094
9160
 
9095
9161
  const { tableFullGroupData } = internalData
9096
- const rowGroupOpts = $xeTable.computeRowGroupOpts
9097
- const { mapChildrenField } = rowGroupOpts
9162
+ const aggregateOpts = $xeTable.computeAggregateOpts
9163
+ const { mapChildrenField } = aggregateOpts
9098
9164
  const rgExpandedMaps: Record<string, any> = {}
9099
9165
  if (expanded && mapChildrenField) {
9100
9166
  XEUtils.eachTree(tableFullGroupData, (row) => {
@@ -9234,9 +9300,9 @@ const Methods = {
9234
9300
  const internalData = $xeTable as unknown as TableInternalData
9235
9301
 
9236
9302
  const { rowGroupExpandedMaps } = internalData
9237
- const rowGroupOpts = $xeTable.computeRowGroupOpts
9303
+ const aggregateOpts = $xeTable.computeAggregateOpts
9238
9304
  const { row, column } = params
9239
- const { trigger } = rowGroupOpts
9305
+ const { trigger } = aggregateOpts
9240
9306
  if (trigger === 'manual') {
9241
9307
  return
9242
9308
  }
@@ -10240,10 +10306,10 @@ const Methods = {
10240
10306
  const { tableFullData } = internalData
10241
10307
  const rests: Promise<any>[] = []
10242
10308
  if (treeConfig || isRowGroupStatus) {
10243
- const rowGroupOpts = $xeTable.computeRowGroupOpts
10309
+ const aggregateOpts = $xeTable.computeAggregateOpts
10244
10310
  const treeOpts = $xeTable.computeTreeOpts
10245
10311
  const childrenField = treeOpts.children || treeOpts.childrenField
10246
- const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? rowGroupOpts.mapChildrenField : childrenField })
10312
+ const matchObj = XEUtils.findTree(tableFullData, item => $xeTable.eqRow(item, row), { children: isRowGroupStatus ? aggregateOpts.mapChildrenField : childrenField })
10247
10313
  if (matchObj) {
10248
10314
  const nodes = matchObj.nodes
10249
10315
  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>,
@@ -881,11 +881,16 @@ export default {
881
881
 
882
882
  return Object.assign({}, getConfig().table.rowConfig, props.rowConfig)
883
883
  },
884
- computeRowGroupOpts () {
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 rowGroupOpts = $xeTable.computeRowGroupOpts
1283
- return rowGroupOpts.groupFields
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 rowGroupOpts = $xeTable.computeRowGroupOpts
1568
- const { groupFields } = rowGroupOpts
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 const handleRowidOrRow = ($xeTable: VxeTableConstructor, rowidOrRow: any) => {
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
@@ -133,7 +133,7 @@ VxeUI.setConfig({
133
133
  // isEvery: false,
134
134
  showIcon: true
135
135
  },
136
- rowGroupConfig: {
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: true,
211
+ // enabled: false,
212
212
  gt: 24,
213
213
  preSize: 0,
214
214
  oSize: 0
215
215
  },
216
216
  virtualYConfig: {
217
- enabled: true,
217
+ // enabled: false,
218
218
  gt: 100,
219
219
  preSize: 1,
220
220
  oSize: 0