vxe-table 4.13.5 → 4.13.7

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 (174) hide show
  1. package/es/grid/src/grid.js +1 -1
  2. package/es/index.css +1 -1
  3. package/es/index.min.css +1 -1
  4. package/es/locale/lang/ar-EG.js +3 -2
  5. package/es/locale/lang/de-DE.js +3 -2
  6. package/es/locale/lang/en-US.js +2 -1
  7. package/es/locale/lang/es-ES.js +3 -2
  8. package/es/locale/lang/fr-FR.js +2 -1
  9. package/es/locale/lang/hu-HU.js +2 -1
  10. package/es/locale/lang/hy-AM.js +2 -1
  11. package/es/locale/lang/id-ID.js +2 -1
  12. package/es/locale/lang/it-IT.js +2 -1
  13. package/es/locale/lang/ja-JP.js +2 -1
  14. package/es/locale/lang/ko-KR.js +2 -1
  15. package/es/locale/lang/nb-NO.js +2 -1
  16. package/es/locale/lang/pt-BR.js +2 -1
  17. package/es/locale/lang/ru-RU.js +2 -1
  18. package/es/locale/lang/th-TH.js +2 -1
  19. package/es/locale/lang/ug-CN.js +2 -1
  20. package/es/locale/lang/uk-UA.js +2 -1
  21. package/es/locale/lang/vi-VN.js +2 -1
  22. package/es/locale/lang/zh-CHT.js +2 -1
  23. package/es/locale/lang/zh-CN.js +2 -1
  24. package/es/style.css +1 -1
  25. package/es/style.min.css +1 -1
  26. package/es/table/module/custom/hook.js +11 -8
  27. package/es/table/module/custom/panel.js +7 -7
  28. package/es/table/module/export/hook.js +21 -20
  29. package/es/table/module/keyboard/hook.js +3 -2
  30. package/es/table/src/body.js +45 -10
  31. package/es/table/src/cell.js +159 -69
  32. package/es/table/src/column.js +2 -0
  33. package/es/table/src/columnInfo.js +1 -0
  34. package/es/table/src/emits.js +1 -0
  35. package/es/table/src/props.js +9 -7
  36. package/es/table/src/table.js +659 -171
  37. package/es/table/style.css +70 -40
  38. package/es/table/style.min.css +1 -1
  39. package/es/ui/index.js +13 -1
  40. package/es/ui/src/dom.js +3 -0
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +70 -40
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/grid/src/grid.js +1 -1
  45. package/lib/grid/src/grid.min.js +1 -1
  46. package/lib/index.css +1 -1
  47. package/lib/index.min.css +1 -1
  48. package/lib/index.umd.js +419 -179
  49. package/lib/index.umd.min.js +1 -1
  50. package/lib/locale/lang/ar-EG.js +3 -2
  51. package/lib/locale/lang/ar-EG.min.js +1 -1
  52. package/lib/locale/lang/de-DE.js +3 -2
  53. package/lib/locale/lang/de-DE.min.js +1 -1
  54. package/lib/locale/lang/en-US.js +2 -1
  55. package/lib/locale/lang/en-US.min.js +1 -1
  56. package/lib/locale/lang/en-US.umd.js +2 -1
  57. package/lib/locale/lang/es-ES.js +3 -2
  58. package/lib/locale/lang/es-ES.min.js +1 -1
  59. package/lib/locale/lang/es-ES.umd.js +3 -2
  60. package/lib/locale/lang/fr-FR.js +2 -1
  61. package/lib/locale/lang/fr-FR.min.js +1 -1
  62. package/lib/locale/lang/hu-HU.js +2 -1
  63. package/lib/locale/lang/hu-HU.min.js +1 -1
  64. package/lib/locale/lang/hu-HU.umd.js +2 -1
  65. package/lib/locale/lang/hy-AM.js +2 -1
  66. package/lib/locale/lang/hy-AM.min.js +1 -1
  67. package/lib/locale/lang/id-ID.js +2 -1
  68. package/lib/locale/lang/id-ID.min.js +1 -1
  69. package/lib/locale/lang/it-IT.js +2 -1
  70. package/lib/locale/lang/it-IT.min.js +1 -1
  71. package/lib/locale/lang/ja-JP.js +2 -1
  72. package/lib/locale/lang/ja-JP.min.js +1 -1
  73. package/lib/locale/lang/ja-JP.umd.js +2 -1
  74. package/lib/locale/lang/ko-KR.js +2 -1
  75. package/lib/locale/lang/ko-KR.min.js +1 -1
  76. package/lib/locale/lang/ko-KR.umd.js +2 -1
  77. package/lib/locale/lang/nb-NO.js +2 -1
  78. package/lib/locale/lang/nb-NO.min.js +1 -1
  79. package/lib/locale/lang/pt-BR.js +2 -1
  80. package/lib/locale/lang/pt-BR.min.js +1 -1
  81. package/lib/locale/lang/pt-BR.umd.js +2 -1
  82. package/lib/locale/lang/ru-RU.js +2 -1
  83. package/lib/locale/lang/ru-RU.min.js +1 -1
  84. package/lib/locale/lang/ru-RU.umd.js +2 -1
  85. package/lib/locale/lang/th-TH.js +2 -1
  86. package/lib/locale/lang/th-TH.min.js +1 -1
  87. package/lib/locale/lang/ug-CN.js +2 -1
  88. package/lib/locale/lang/ug-CN.min.js +1 -1
  89. package/lib/locale/lang/uk-UA.js +2 -1
  90. package/lib/locale/lang/uk-UA.min.js +1 -1
  91. package/lib/locale/lang/uk-UA.umd.js +2 -1
  92. package/lib/locale/lang/vi-VN.js +2 -1
  93. package/lib/locale/lang/vi-VN.min.js +1 -1
  94. package/lib/locale/lang/zh-CHT.js +2 -1
  95. package/lib/locale/lang/zh-CHT.min.js +1 -1
  96. package/lib/locale/lang/zh-CN.js +2 -1
  97. package/lib/locale/lang/zh-CN.min.js +1 -1
  98. package/lib/locale/lang/zh-CN.umd.js +2 -1
  99. package/lib/style.css +1 -1
  100. package/lib/style.min.css +1 -1
  101. package/lib/table/module/custom/hook.js +11 -1
  102. package/lib/table/module/custom/hook.min.js +1 -1
  103. package/lib/table/module/custom/panel.js +6 -2
  104. package/lib/table/module/custom/panel.min.js +1 -1
  105. package/lib/table/module/export/hook.js +21 -11
  106. package/lib/table/module/export/hook.min.js +1 -1
  107. package/lib/table/module/keyboard/hook.js +2 -1
  108. package/lib/table/module/keyboard/hook.min.js +1 -1
  109. package/lib/table/src/body.js +35 -9
  110. package/lib/table/src/body.min.js +1 -1
  111. package/lib/table/src/cell.js +177 -52
  112. package/lib/table/src/cell.min.js +1 -1
  113. package/lib/table/src/column.js +2 -0
  114. package/lib/table/src/column.min.js +1 -1
  115. package/lib/table/src/columnInfo.js +1 -0
  116. package/lib/table/src/columnInfo.min.js +1 -1
  117. package/lib/table/src/emits.js +1 -1
  118. package/lib/table/src/emits.min.js +1 -1
  119. package/lib/table/src/props.js +9 -7
  120. package/lib/table/src/props.min.js +1 -1
  121. package/lib/table/src/table.js +134 -91
  122. package/lib/table/src/table.min.js +1 -1
  123. package/lib/table/style/style.css +70 -40
  124. package/lib/table/style/style.min.css +1 -1
  125. package/lib/ui/index.js +13 -1
  126. package/lib/ui/index.min.js +1 -1
  127. package/lib/ui/src/dom.js +4 -0
  128. package/lib/ui/src/dom.min.js +1 -1
  129. package/lib/ui/src/log.js +1 -1
  130. package/lib/ui/src/log.min.js +1 -1
  131. package/lib/vxe-table/style/style.css +70 -40
  132. package/lib/vxe-table/style/style.min.css +1 -1
  133. package/package.json +2 -2
  134. package/packages/grid/src/grid.ts +1 -1
  135. package/packages/locale/lang/ar-EG.ts +3 -2
  136. package/packages/locale/lang/de-DE.ts +3 -2
  137. package/packages/locale/lang/en-US.ts +2 -1
  138. package/packages/locale/lang/es-ES.ts +3 -2
  139. package/packages/locale/lang/fr-FR.ts +2 -1
  140. package/packages/locale/lang/hu-HU.ts +2 -1
  141. package/packages/locale/lang/hy-AM.ts +2 -1
  142. package/packages/locale/lang/id-ID.ts +2 -1
  143. package/packages/locale/lang/it-IT.ts +2 -1
  144. package/packages/locale/lang/ja-JP.ts +2 -1
  145. package/packages/locale/lang/ko-KR.ts +2 -1
  146. package/packages/locale/lang/nb-NO.ts +2 -1
  147. package/packages/locale/lang/pt-BR.ts +2 -1
  148. package/packages/locale/lang/ru-RU.ts +2 -1
  149. package/packages/locale/lang/th-TH.ts +2 -1
  150. package/packages/locale/lang/ug-CN.ts +2 -1
  151. package/packages/locale/lang/uk-UA.ts +2 -1
  152. package/packages/locale/lang/vi-VN.ts +2 -1
  153. package/packages/locale/lang/zh-CHT.ts +2 -1
  154. package/packages/locale/lang/zh-CN.ts +2 -1
  155. package/packages/table/module/custom/hook.ts +14 -8
  156. package/packages/table/module/custom/panel.ts +7 -7
  157. package/packages/table/module/export/hook.ts +28 -27
  158. package/packages/table/module/keyboard/hook.ts +3 -2
  159. package/packages/table/src/body.ts +46 -10
  160. package/packages/table/src/cell.ts +162 -73
  161. package/packages/table/src/column.ts +2 -0
  162. package/packages/table/src/columnInfo.ts +1 -0
  163. package/packages/table/src/emits.ts +1 -0
  164. package/packages/table/src/props.ts +9 -7
  165. package/packages/table/src/table.ts +664 -176
  166. package/packages/ui/index.ts +12 -0
  167. package/packages/ui/src/dom.ts +4 -0
  168. package/styles/components/table.scss +131 -92
  169. /package/es/{iconfont.1744880866629.ttf → iconfont.1745290253213.ttf} +0 -0
  170. /package/es/{iconfont.1744880866629.woff → iconfont.1745290253213.woff} +0 -0
  171. /package/es/{iconfont.1744880866629.woff2 → iconfont.1745290253213.woff2} +0 -0
  172. /package/lib/{iconfont.1744880866629.ttf → iconfont.1745290253213.ttf} +0 -0
  173. /package/lib/{iconfont.1744880866629.woff → iconfont.1745290253213.woff} +0 -0
  174. /package/lib/{iconfont.1744880866629.woff2 → iconfont.1745290253213.woff2} +0 -0
@@ -450,9 +450,11 @@ export default defineComponent({
450
450
  }
451
451
 
452
452
  const renderRows = (fixedType: 'left' | 'right' | '', isOptimizeMode: boolean, tableData: any[], tableColumn: VxeTableDefines.ColumnInfo[]) => {
453
+ const $xeGrid = $xeTable.xeGrid
454
+
453
455
  const { stripe, rowKey, highlightHoverRow, rowClassName, rowStyle, editConfig, treeConfig } = tableProps
454
- const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag } = tableReactData
455
- const { fullAllDataRowIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
456
+ const { hasFixedColumn, treeExpandedFlag, isColLoading, scrollXLoad, scrollYLoad, isAllOverflow, rowExpandedFlag, expandColumn, selectRadioRow, pendingRowFlag, isDragColMove, rowExpandHeightFlag, isRowGroupStatus } = tableReactData
457
+ const { fullAllDataRowIdData, fullColumnIdData, treeExpandedMaps, pendingRowMaps, rowExpandedMaps } = tableInternalData
456
458
  const checkboxOpts = computeCheckboxOpts.value
457
459
  const radioOpts = computeRadioOpts.value
458
460
  const treeOpts = computeTreeOpts.value
@@ -464,6 +466,7 @@ export default defineComponent({
464
466
  const childrenField = treeOpts.children || treeOpts.childrenField
465
467
  const rows: any[] = []
466
468
  const { handleGetRowId } = createHandleGetRowId($xeTable)
469
+ const isDeepRow = treeConfig || isRowGroupStatus
467
470
  tableData.forEach((row, $rowIndex) => {
468
471
  const rowid = handleGetRowId(row)
469
472
  const rowRest = fullAllDataRowIdData[rowid] || {}
@@ -471,6 +474,7 @@ export default defineComponent({
471
474
  let rowLevel = 0
472
475
  let seq: string | number = -1
473
476
  let _rowIndex = -1
477
+ const hasRowGroupAggregate = isRowGroupStatus && row.isAggregate
474
478
  const trOn: Record<string, any> = {}
475
479
  // 当前行事件
476
480
  if (rowOpts.isHover || highlightHoverRow) {
@@ -489,7 +493,7 @@ export default defineComponent({
489
493
  }
490
494
  if (rowRest) {
491
495
  rowLevel = rowRest.level
492
- if (treeConfig && transform && seqMode === 'increasing') {
496
+ if (hasRowGroupAggregate || (treeConfig && transform && seqMode === 'increasing')) {
493
497
  seq = rowRest._index + 1
494
498
  } else {
495
499
  seq = rowRest.seq
@@ -512,14 +516,14 @@ export default defineComponent({
512
516
  isExpandTree = !!treeExpandedFlag && rowChildren && rowChildren.length > 0 && !!treeExpandedMaps[rowid]
513
517
  }
514
518
  // 拖拽行事件
515
- if (rowOpts.drag && (!treeConfig || transform)) {
519
+ if (rowOpts.drag && !isRowGroupStatus && (!treeConfig || transform)) {
516
520
  trOn.onDragstart = $xeTable.handleRowDragDragstartEvent
517
521
  trOn.onDragend = $xeTable.handleRowDragDragendEvent
518
522
  trOn.onDragover = $xeTable.handleRowDragDragoverEvent
519
523
  }
520
524
  const trClass = [
521
525
  'vxe-body--row',
522
- treeConfig ? `row--level-${rowLevel}` : '',
526
+ isDeepRow ? `row--level-${rowLevel}` : '',
523
527
  {
524
528
  'row--stripe': stripe && (_rowIndex + 1) % 2 === 0,
525
529
  'is--new': isNewRow,
@@ -528,7 +532,8 @@ export default defineComponent({
528
532
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
529
533
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
530
534
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
531
- 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
535
+ 'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid],
536
+ 'row--group': hasRowGroupAggregate
532
537
  },
533
538
  getPropClass(rowClassName, params)
534
539
  ]
@@ -543,7 +548,7 @@ export default defineComponent({
543
548
  class: trClass,
544
549
  rowid: rowid,
545
550
  style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
546
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
551
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
547
552
  ...trOn
548
553
  }, {
549
554
  default: () => tdVNs
@@ -552,7 +557,7 @@ export default defineComponent({
552
557
  class: trClass,
553
558
  rowid: rowid,
554
559
  style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
555
- key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
560
+ key: rowKey || scrollXLoad || scrollYLoad || rowOpts.useKey || rowOpts.drag || columnOpts.drag || isRowGroupStatus || treeConfig ? rowid : $rowIndex,
556
561
  ...trOn
557
562
  }, tdVNs)
558
563
  )
@@ -584,9 +589,40 @@ export default defineComponent({
584
589
  if (treeConfig) {
585
590
  cellStyle.paddingLeft = `${(rowLevel * treeOpts.indent) + 30}px`
586
591
  }
587
- const { showOverflow } = expandColumn
592
+ const { showOverflow } = expandColumn || {}
593
+ const colid = expandColumn.id
594
+ const colRest = fullColumnIdData[colid] || {}
588
595
  const hasEllipsis = (XEUtils.isUndefined(showOverflow) || XEUtils.isNull(showOverflow)) ? isAllOverflow : showOverflow
589
- const expandParams = { $table: $xeTable, seq, column: expandColumn, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex, _rowIndex }
596
+ let columnIndex = -1
597
+ let $columnIndex = -1
598
+ let _columnIndex = -1
599
+ if (colRest) {
600
+ columnIndex = colRest.index
601
+ $columnIndex = colRest.$index
602
+ _columnIndex = colRest._index
603
+ }
604
+ const expandParams: VxeTableDefines.CellRenderDataParams = {
605
+ $grid: $xeGrid,
606
+ $table: $xeTable,
607
+ seq,
608
+ column: expandColumn as VxeTableDefines.ColumnInfo,
609
+ columnIndex,
610
+ $columnIndex,
611
+ _columnIndex,
612
+ fixed: fixedType,
613
+ type: renderType,
614
+ level: rowLevel,
615
+ row,
616
+ rowid,
617
+ rowIndex,
618
+ $rowIndex,
619
+ _rowIndex,
620
+ isHidden: false,
621
+ isEdit: false,
622
+ visibleData: [],
623
+ data: [],
624
+ items: []
625
+ }
590
626
  rows.push(
591
627
  h('tr', {
592
628
  class: ['vxe-body--expanded-row', {
@@ -92,21 +92,21 @@ function renderCellBaseVNs (params: VxeTableDefines.CellRenderBodyParams & { $ta
92
92
  const treeOpts = computeTreeOpts.value
93
93
  const { showIcon, isPeerDrag, isCrossDrag, visibleMethod } = rowDragOpts
94
94
  const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null)
95
- const vns: VxeComponentSlotType[] = XEUtils.isArray(content) ? content : [content]
95
+ const vns: VxeComponentSlotType[] = []
96
96
  if (dragSort && rowOpts.drag && ((showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params)))) {
97
97
  if (treeConfig) {
98
98
  if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
99
- vns.unshift(
99
+ vns.push(
100
100
  renderCellDragIcon(params)
101
101
  )
102
102
  }
103
103
  } else {
104
- vns.unshift(
104
+ vns.push(
105
105
  renderCellDragIcon(params)
106
106
  )
107
107
  }
108
108
  }
109
- return vns
109
+ return vns.concat(XEUtils.isArray(content) ? content : [content])
110
110
  }
111
111
 
112
112
  function renderHeaderCellDragIcon (params: VxeTableDefines.CellRenderHeaderParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
@@ -277,26 +277,27 @@ function renderCellHandle (params: VxeTableDefines.CellRenderBodyParams & {
277
277
  const { column, $table } = params
278
278
  const tableProps = $table.props
279
279
  const { editConfig } = tableProps
280
- const { type, treeNode, editRender } = column
280
+ const { type, treeNode, rowGroupNode, editRender } = column
281
281
  const { computeEditOpts, computeCheckboxOpts } = $table.getComputeMaps()
282
282
  const checkboxOpts = computeCheckboxOpts.value
283
283
  const editOpts = computeEditOpts.value
284
+ const isDeepCell = treeNode || rowGroupNode
284
285
  switch (type) {
285
286
  case 'seq':
286
- return treeNode ? Cell.renderTreeIndexCell(params) : Cell.renderSeqCell(params)
287
+ return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params)
287
288
  case 'radio':
288
- return treeNode ? Cell.renderTreeRadioCell(params) : Cell.renderRadioCell(params)
289
+ return isDeepCell ? Cell.renderDeepRadioCell(params) : Cell.renderRadioCell(params)
289
290
  case 'checkbox':
290
- return checkboxOpts.checkField ? (treeNode ? Cell.renderTreeSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params)) : (treeNode ? Cell.renderTreeSelectionCell(params) : Cell.renderCheckboxCell(params))
291
+ return checkboxOpts.checkField ? (isDeepCell ? Cell.renderDeepSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params)) : (isDeepCell ? Cell.renderDeepSelectionCell(params) : Cell.renderCheckboxCell(params))
291
292
  case 'expand':
292
293
  return Cell.renderExpandCell(params)
293
294
  case 'html':
294
- return treeNode ? Cell.renderTreeHTMLCell(params) : Cell.renderHTMLCell(params)
295
+ return isDeepCell ? Cell.renderDeepHTMLCell(params) : Cell.renderHTMLCell(params)
295
296
  }
296
297
  if (isEnableConf(editConfig) && editRender) {
297
- return editOpts.mode === 'cell' ? (treeNode ? Cell.renderTreeCellEdit(params) : Cell.renderCellEdit(params)) : (treeNode ? Cell.renderTreeRowEdit(params) : Cell.renderRowEdit(params))
298
+ return editOpts.mode === 'cell' ? (isDeepCell ? Cell.renderDeepCellEdit(params) : Cell.renderCellEdit(params)) : (isDeepCell ? Cell.renderDeepRowEdit(params) : Cell.renderRowEdit(params))
298
299
  }
299
- return treeNode ? Cell.renderTreeCell(params) : Cell.renderDefaultCell(params)
300
+ return isDeepCell ? Cell.renderDeepCell(params) : Cell.renderDefaultCell(params)
300
301
  }
301
302
 
302
303
  function renderHeaderHandle (params: VxeTableDefines.CellRenderHeaderParams & {
@@ -381,7 +382,10 @@ export const Cell = {
381
382
  },
382
383
  renderDefaultCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
383
384
  const { $table, row, column } = params
384
- const { slots, editRender, cellRender } = column
385
+ const tableReactData = $table.reactData
386
+ const tableInternalData = $table.internalData
387
+ const { isRowGroupStatus } = tableReactData
388
+ const { slots, editRender, cellRender, rowGroupNode } = column
385
389
  const renderOpts = editRender || cellRender
386
390
  const defaultSlot = slots ? slots.default : null
387
391
  if (defaultSlot) {
@@ -398,7 +402,35 @@ export const Cell = {
398
402
  }
399
403
  }
400
404
  }
401
- const cellValue = $table.getCellLabel(row, column)
405
+ let cellValue: string | number | null = ''
406
+ if (isRowGroupStatus && rowGroupNode && row.isAggregate) {
407
+ const { fullColumnFieldData } = tableInternalData
408
+ const { computeRowGroupOpts } = $table.getComputeMaps()
409
+ const rowGroupOpts = computeRowGroupOpts.value
410
+ const { showTotal, totalMethod, contentMethod, mapChildrenField } = rowGroupOpts
411
+ const groupField = row.groupField
412
+ cellValue = row.groupContent
413
+ const childList = mapChildrenField ? (row[mapChildrenField] || []) : []
414
+ const totalValue = childList.length
415
+ const colRest = fullColumnFieldData[groupField] || {}
416
+ const params = {
417
+ $table,
418
+ groupField,
419
+ groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
420
+ column,
421
+ groupValue: cellValue,
422
+ children: childList,
423
+ totalValue: totalValue
424
+ }
425
+ if (contentMethod) {
426
+ cellValue = `${contentMethod(params)}`
427
+ }
428
+ if (showTotal) {
429
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(params) : totalValue, totalValue])
430
+ }
431
+ } else if (!(isRowGroupStatus && row.isAggregate)) {
432
+ cellValue = $table.getCellLabel(row, column)
433
+ }
402
434
  const cellPlaceholder = editRender ? editRender.placeholder : ''
403
435
  return renderCellBaseVNs(params, [
404
436
  h('span', {
@@ -414,40 +446,80 @@ export const Cell = {
414
446
  )
415
447
  ])
416
448
  },
417
- renderTreeCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
418
- return Cell.renderTreeIcon(params, Cell.renderDefaultCell(params) as VNode[])
449
+ renderDeepCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
450
+ return Cell.renderDeepNodeBtn(params, Cell.renderDefaultCell(params) as VNode[])
419
451
  },
420
452
  renderDefaultFooter (params: VxeTableDefines.CellRenderFooterParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
421
453
  return getFooterContent(params)
422
454
  },
423
455
 
424
456
  /**
425
- * 树节点
457
+ * 行分组
426
458
  */
427
- renderTreeIcon (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
459
+ renderRowGroupBtn (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
460
+ const { $table } = params
461
+ const tableReactData = $table.reactData
462
+ const tableInternalData = $table.internalData
463
+ const { row, level } = params
464
+ const { computeRowGroupOpts } = $table.getComputeMaps()
465
+ const { rowGroupExpandedFlag } = tableReactData
466
+ const { rowGroupExpandedMaps } = tableInternalData
467
+ const rowGroupOpts = computeRowGroupOpts.value
468
+ const { padding, indent } = rowGroupOpts
469
+ const rowid = getRowid($table, row)
470
+ const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid]
471
+ return h('div', {
472
+ class: ['vxe-row-group--tree-node', {
473
+ 'is--expanded': isExpand
474
+ }],
475
+ style: padding && indent
476
+ ? {
477
+ paddingLeft: `${level * indent}px`
478
+ }
479
+ : undefined
480
+ }, [
481
+ h('span', {
482
+ class: 'vxe-row-group--node-btn',
483
+ onClick (evnt: MouseEvent) {
484
+ $table.triggerRowGroupExpandEvent(evnt, params)
485
+ }
486
+ }, [
487
+ h('i', {
488
+ class: isExpand ? getIcon().TABLE_ROW_GROUP_OPEN : getIcon().TABLE_ROW_GROUP_CLOSE
489
+ })
490
+ ]),
491
+ h('div', {
492
+ class: 'vxe-row-group-cell'
493
+ }, cellVNodes)
494
+ ])
495
+ },
496
+ /**
497
+ * 树
498
+ */
499
+ renderTreeNodeBtn (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
428
500
  const { $table, isHidden } = params
429
501
  const tableReactData = $table.reactData
430
502
  const tableInternalData = $table.internalData
503
+ const { row, column, level } = params
504
+ const { slots } = column
505
+ const iconSlot = slots ? slots.icon : null
506
+ if (iconSlot) {
507
+ return $table.callSlot(iconSlot, params)
508
+ }
431
509
  const { computeTreeOpts } = $table.getComputeMaps()
432
510
  const { treeExpandedFlag } = tableReactData
433
511
  const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData
434
512
  const treeOpts = computeTreeOpts.value
435
- const { row, column, level } = params
436
- const { slots } = column
437
- const { indent, lazy, trigger, iconLoaded, showIcon, iconOpen, iconClose } = treeOpts
513
+ const { padding, indent, lazy, trigger, iconLoaded, showIcon, iconOpen, iconClose } = treeOpts
438
514
  const childrenField = treeOpts.children || treeOpts.childrenField
439
515
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
440
516
  const rowChilds = row[childrenField]
441
517
  const hasChild = rowChilds && rowChilds.length
442
- const iconSlot = slots ? slots.icon : null
443
518
  let hasLazyChilds = false
444
519
  let isActive = false
445
520
  let isLazyLoading = false
446
521
  let isLazyLoaded = false
447
522
  const ons: Record<string, any> = {}
448
- if (iconSlot) {
449
- return $table.callSlot(iconSlot, params)
450
- }
451
523
  if (!isHidden) {
452
524
  const rowid = getRowid($table, row)
453
525
  isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid]
@@ -463,32 +535,44 @@ export const Cell = {
463
535
  $table.triggerTreeExpandEvent(evnt, params)
464
536
  }
465
537
  }
466
- return [
538
+ return h('div', {
539
+ class: ['vxe-cell--tree-node', {
540
+ 'is--active': isActive
541
+ }],
542
+ style: padding && indent
543
+ ? {
544
+ paddingLeft: `${level * indent}px`
545
+ }
546
+ : undefined
547
+ }, [
548
+ showIcon && (lazy ? (isLazyLoaded ? hasChild : (hasChild || hasLazyChilds)) : hasChild)
549
+ ? [
550
+ h('div', {
551
+ class: 'vxe-cell--tree-btn',
552
+ ...ons
553
+ }, [
554
+ h('i', {
555
+ class: isLazyLoading ? (iconLoaded || getIcon().TABLE_TREE_LOADED) : (isActive ? (iconOpen || getIcon().TABLE_TREE_OPEN) : (iconClose || getIcon().TABLE_TREE_CLOSE))
556
+ })
557
+ ])
558
+ ]
559
+ : null,
467
560
  h('div', {
468
- class: ['vxe-cell--tree-node', {
469
- 'is--active': isActive
470
- }],
471
- style: {
472
- paddingLeft: `${level * indent}px`
473
- }
474
- }, [
475
- showIcon && (lazy ? (isLazyLoaded ? hasChild : (hasChild || hasLazyChilds)) : hasChild)
476
- ? [
477
- h('div', {
478
- class: 'vxe-tree--btn-wrapper',
479
- ...ons
480
- }, [
481
- h('i', {
482
- class: ['vxe-tree--node-btn', isLazyLoading ? (iconLoaded || getIcon().TABLE_TREE_LOADED) : (isActive ? (iconOpen || getIcon().TABLE_TREE_OPEN) : (iconClose || getIcon().TABLE_TREE_CLOSE))]
483
- })
484
- ])
485
- ]
486
- : null,
487
- h('div', {
488
- class: 'vxe-tree-cell'
489
- }, cellVNodes)
490
- ])
491
- ]
561
+ class: 'vxe-tree-cell'
562
+ }, cellVNodes)
563
+ ])
564
+ },
565
+ /**
566
+ * 层级节点。
567
+ * 行分组、树结构
568
+ */
569
+ renderDeepNodeBtn (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, cellVNodes: VxeComponentSlotType[]) {
570
+ const { row, column } = params
571
+ const { rowGroupNode } = column
572
+ if (rowGroupNode && row.isAggregate) {
573
+ return [Cell.renderRowGroupBtn(params, cellVNodes)]
574
+ }
575
+ return [Cell.renderTreeNodeBtn(params, cellVNodes)]
492
576
  },
493
577
 
494
578
  /**
@@ -517,8 +601,8 @@ export const Cell = {
517
601
  h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)}`)
518
602
  ])
519
603
  },
520
- renderTreeIndexCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
521
- return Cell.renderTreeIcon(params, Cell.renderSeqCell(params) as VNode[])
604
+ renderDeepIndexCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
605
+ return Cell.renderDeepNodeBtn(params, Cell.renderSeqCell(params) as VNode[])
522
606
  },
523
607
 
524
608
  /**
@@ -551,7 +635,7 @@ export const Cell = {
551
635
  const defaultSlot = slots ? slots.default : null
552
636
  const radioSlot = slots ? slots.radio : null
553
637
  const isChecked = $table.eqRow(row, selectRadioRow)
554
- const isVisible = !visibleMethod || visibleMethod({ row })
638
+ const isVisible = !visibleMethod || visibleMethod({ $table, row })
555
639
  let isDisabled = !!checkMethod
556
640
  let ons
557
641
  if (!isHidden) {
@@ -563,7 +647,7 @@ export const Cell = {
563
647
  }
564
648
  }
565
649
  if (checkMethod) {
566
- isDisabled = !checkMethod({ row })
650
+ isDisabled = !checkMethod({ $table, row })
567
651
  }
568
652
  }
569
653
  const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible }
@@ -595,8 +679,8 @@ export const Cell = {
595
679
  }, radioVNs)
596
680
  ])
597
681
  },
598
- renderTreeRadioCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
599
- return Cell.renderTreeIcon(params, Cell.renderRadioCell(params))
682
+ renderDeepRadioCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
683
+ return Cell.renderDeepNodeBtn(params, Cell.renderRadioCell(params))
600
684
  },
601
685
 
602
686
  /**
@@ -663,7 +747,7 @@ export const Cell = {
663
747
  const tableReactData = $table.reactData
664
748
  const tableInternalData = $table.internalData
665
749
  const { treeConfig } = tableProps
666
- const { updateCheckboxFlag } = tableReactData
750
+ const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
667
751
  const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData
668
752
  const { computeCheckboxOpts } = $table.getComputeMaps()
669
753
  const checkboxOpts = computeCheckboxOpts.value
@@ -673,7 +757,7 @@ export const Cell = {
673
757
  const checkboxSlot = slots ? slots.checkbox : null
674
758
  let indeterminate = false
675
759
  let isChecked = false
676
- const isVisible = !visibleMethod || visibleMethod({ row })
760
+ const isVisible = !visibleMethod || visibleMethod({ $table, row })
677
761
  let isDisabled = !!checkMethod
678
762
  const ons: Record<string, any> = {}
679
763
  if (!isHidden) {
@@ -685,9 +769,9 @@ export const Cell = {
685
769
  }
686
770
  }
687
771
  if (checkMethod) {
688
- isDisabled = !checkMethod({ row })
772
+ isDisabled = !checkMethod({ $table, row })
689
773
  }
690
- if (treeConfig) {
774
+ if (treeConfig || isRowGroupStatus) {
691
775
  indeterminate = !!treeIndeterminateRowMaps[rowid]
692
776
  }
693
777
  }
@@ -722,8 +806,8 @@ export const Cell = {
722
806
  }, checkVNs)
723
807
  ])
724
808
  },
725
- renderTreeSelectionCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
726
- return Cell.renderTreeIcon(params, Cell.renderCheckboxCell(params))
809
+ renderDeepSelectionCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
810
+ return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCell(params))
727
811
  },
728
812
  renderCheckboxCellByProp (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
729
813
  const { $table, row, column, isHidden } = params
@@ -731,7 +815,7 @@ export const Cell = {
731
815
  const tableReactData = $table.reactData
732
816
  const tableInternalData = $table.internalData
733
817
  const { treeConfig } = tableProps
734
- const { updateCheckboxFlag } = tableReactData
818
+ const { updateCheckboxFlag, isRowGroupStatus } = tableReactData
735
819
  const { treeIndeterminateRowMaps } = tableInternalData
736
820
  const { computeCheckboxOpts } = $table.getComputeMaps()
737
821
  const checkboxOpts = computeCheckboxOpts.value
@@ -742,7 +826,7 @@ export const Cell = {
742
826
  const checkboxSlot = slots ? slots.checkbox : null
743
827
  let isIndeterminate = false
744
828
  let isChecked = false
745
- const isVisible = !visibleMethod || visibleMethod({ row })
829
+ const isVisible = !visibleMethod || visibleMethod({ $table, row })
746
830
  let isDisabled = !!checkMethod
747
831
  const ons: Record<string, any> = {}
748
832
  if (!isHidden) {
@@ -754,9 +838,9 @@ export const Cell = {
754
838
  }
755
839
  }
756
840
  if (checkMethod) {
757
- isDisabled = !checkMethod({ row })
841
+ isDisabled = !checkMethod({ $table, row })
758
842
  }
759
- if (treeConfig) {
843
+ if (treeConfig || isRowGroupStatus) {
760
844
  isIndeterminate = !!treeIndeterminateRowMaps[rowid]
761
845
  }
762
846
  }
@@ -791,8 +875,8 @@ export const Cell = {
791
875
  }, checkVNs)
792
876
  ])
793
877
  },
794
- renderTreeSelectionCellByProp (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
795
- return Cell.renderTreeIcon(params, Cell.renderCheckboxCellByProp(params))
878
+ renderDeepSelectionCellByProp (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
879
+ return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCellByProp(params))
796
880
  },
797
881
 
798
882
  /**
@@ -800,7 +884,9 @@ export const Cell = {
800
884
  */
801
885
  renderExpandCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
802
886
  const { $table, isHidden, row, column } = params
887
+ const tableReactData = $table.reactData
803
888
  const tableInternalData = $table.internalData
889
+ const { isRowGroupStatus } = tableReactData
804
890
  const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData
805
891
  const { computeExpandOpts } = $table.getComputeMaps()
806
892
  const expandOpts = computeExpandOpts.value
@@ -810,6 +896,9 @@ export const Cell = {
810
896
  const iconSlot = slots ? slots.icon : null
811
897
  let isActive = false
812
898
  let isLazyLoading = false
899
+ if (isRowGroupStatus && row.isAggregate) {
900
+ return renderCellBaseVNs(params, [])
901
+ }
813
902
  if (iconSlot) {
814
903
  return renderCellBaseVNs(params, $table.callSlot(iconSlot, params))
815
904
  }
@@ -881,8 +970,8 @@ export const Cell = {
881
970
  })
882
971
  ])
883
972
  },
884
- renderTreeHTMLCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
885
- return Cell.renderTreeIcon(params, Cell.renderHTMLCell(params))
973
+ renderDeepHTMLCell (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
974
+ return Cell.renderDeepNodeBtn(params, Cell.renderHTMLCell(params))
886
975
  },
887
976
 
888
977
  /**
@@ -1027,8 +1116,8 @@ export const Cell = {
1027
1116
  const { editRender } = column
1028
1117
  return Cell.runRenderer(params, isEnableConf(editRender) && actived && actived.row === params.row)
1029
1118
  },
1030
- renderTreeRowEdit (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1031
- return Cell.renderTreeIcon(params, Cell.renderRowEdit(params) as VNode[])
1119
+ renderDeepRowEdit (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1120
+ return Cell.renderDeepNodeBtn(params, Cell.renderRowEdit(params) as VNode[])
1032
1121
  },
1033
1122
  // 单元格编辑模式
1034
1123
  renderCellEdit (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
@@ -1039,8 +1128,8 @@ export const Cell = {
1039
1128
  const { editRender } = column
1040
1129
  return Cell.runRenderer(params, isEnableConf(editRender) && actived && actived.row === params.row && actived.column === params.column)
1041
1130
  },
1042
- renderTreeCellEdit (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1043
- return Cell.renderTreeIcon(params, Cell.renderCellEdit(params) as VNode[])
1131
+ renderDeepCellEdit (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
1132
+ return Cell.renderDeepNodeBtn(params, Cell.renderCellEdit(params) as VNode[])
1044
1133
  },
1045
1134
  runRenderer (params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, isEdit: boolean) {
1046
1135
  const { $table, column } = params
@@ -91,6 +91,8 @@ export const columnProps = {
91
91
  filterRecoverMethod: Function as PropType<VxeColumnPropTypes.FilterRecoverMethod>,
92
92
  // 筛选模板配置项
93
93
  filterRender: Object as PropType<VxeColumnPropTypes.FilterRender>,
94
+ // 设置为分组节点
95
+ rowGroupNode: Boolean as PropType<VxeColumnPropTypes.RowGroupNode>,
94
96
  // 设置为树节点
95
97
  treeNode: Boolean as PropType<VxeColumnPropTypes.TreeNode>,
96
98
  // 设置为拖拽排序
@@ -81,6 +81,7 @@ export class ColumnInfo {
81
81
  filterResetMethod: _vm.filterResetMethod,
82
82
  filterRecoverMethod: _vm.filterRecoverMethod,
83
83
  filterRender: _vm.filterRender,
84
+ rowGroupNode: _vm.rowGroupNode,
84
85
  treeNode: _vm.treeNode,
85
86
  dragSort: _vm.dragSort,
86
87
  rowResize: _vm.rowResize,
@@ -47,6 +47,7 @@ export default [
47
47
 
48
48
  'column-resizable-change',
49
49
  'row-resizable-change',
50
+ 'toggle-row-group-expand',
50
51
  'toggle-row-expand',
51
52
  'toggle-tree-expand',
52
53
  'menu-click',
@@ -186,19 +186,21 @@ export default {
186
186
  syncResize: [Boolean, String, Number],
187
187
  // 响应式布局配置项
188
188
  resizeConfig: Object as PropType<VxeTablePropTypes.ResizeConfig>,
189
- // 列配置信息
189
+ // 列配置项
190
190
  columnConfig: Object as PropType<VxeTablePropTypes.ColumnConfig>,
191
- // 当前列配置信息
191
+ // 当前列配置项
192
192
  currentColumnConfig: Object as PropType<VxeTablePropTypes.CurrentColumnConfig>,
193
- // 单元格配置信息
193
+ // 单元格配置项
194
194
  cellConfig: Object as PropType<VxeTablePropTypes.CellConfig>,
195
- // 表头单元格配置信息
195
+ // 表头单元格配置项
196
196
  headerCellConfig: Object as PropType<VxeTablePropTypes.HeaderCellConfig>,
197
- // 表尾单元格配置信息
197
+ // 表尾单元格配置项
198
198
  footerCellConfig: Object as PropType<VxeTablePropTypes.FooterCellConfig>,
199
- // 行配置信息
199
+ // 行配置项
200
200
  rowConfig: Object as PropType<VxeTablePropTypes.RowConfig>,
201
- // 当前行配置信息
201
+ // 行分组配置项
202
+ rowGroupConfig: Object as PropType<VxeTablePropTypes.RowGroupConfig>,
203
+ // 当前行配置项
202
204
  currentRowConfig: Object as PropType<VxeTablePropTypes.CurrentRowConfig>,
203
205
  // 已废弃,被 rowDragConfig 替换
204
206
  dragConfig: Object as PropType<VxeTablePropTypes.DragConfig>,