vxe-table 3.21.2 → 3.21.4

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 (170) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/ar-EG.js +6 -2
  4. package/es/locale/lang/de-DE.js +5 -1
  5. package/es/locale/lang/en-US.js +5 -1
  6. package/es/locale/lang/es-ES.js +4 -0
  7. package/es/locale/lang/fr-FR.js +6 -2
  8. package/es/locale/lang/hu-HU.js +5 -1
  9. package/es/locale/lang/hy-AM.js +5 -1
  10. package/es/locale/lang/id-ID.js +6 -2
  11. package/es/locale/lang/it-IT.js +5 -1
  12. package/es/locale/lang/ja-JP.js +4 -0
  13. package/es/locale/lang/ko-KR.js +5 -1
  14. package/es/locale/lang/ms-MY.js +6 -2
  15. package/es/locale/lang/nb-NO.js +6 -2
  16. package/es/locale/lang/pt-BR.js +6 -2
  17. package/es/locale/lang/ru-RU.js +4 -0
  18. package/es/locale/lang/th-TH.js +5 -1
  19. package/es/locale/lang/ug-CN.js +5 -1
  20. package/es/locale/lang/uk-UA.js +5 -1
  21. package/es/locale/lang/uz-UZ.js +5 -1
  22. package/es/locale/lang/vi-VN.js +4 -0
  23. package/es/locale/lang/zh-CHT.js +4 -0
  24. package/es/locale/lang/zh-CN.js +4 -0
  25. package/es/style.css +1 -1
  26. package/es/style.min.css +1 -1
  27. package/es/table/module/custom/panel.js +28 -20
  28. package/es/table/module/export/export-panel.js +29 -16
  29. package/es/table/module/export/mixin.js +183 -28
  30. package/es/table/src/cell.js +7 -1
  31. package/es/table/src/methods.js +82 -31
  32. package/es/table/src/table.js +16 -0
  33. package/es/table/src/util.js +3 -1
  34. package/es/table/style.css +1 -1
  35. package/es/table/style.min.css +1 -1
  36. package/es/ui/index.js +1 -1
  37. package/es/ui/src/log.js +1 -1
  38. package/es/vxe-table/style.css +1 -1
  39. package/es/vxe-table/style.min.css +1 -1
  40. package/lib/index.css +1 -1
  41. package/lib/index.min.css +1 -1
  42. package/lib/index.umd.js +304 -67
  43. package/lib/index.umd.min.js +1 -1
  44. package/lib/locale/lang/ar-EG.js +6 -2
  45. package/lib/locale/lang/ar-EG.min.js +1 -1
  46. package/lib/locale/lang/ar-EG.umd.js +6 -2
  47. package/lib/locale/lang/de-DE.js +5 -1
  48. package/lib/locale/lang/de-DE.min.js +1 -1
  49. package/lib/locale/lang/de-DE.umd.js +5 -1
  50. package/lib/locale/lang/en-US.js +5 -1
  51. package/lib/locale/lang/en-US.min.js +1 -1
  52. package/lib/locale/lang/en-US.umd.js +5 -1
  53. package/lib/locale/lang/es-ES.js +4 -0
  54. package/lib/locale/lang/es-ES.min.js +1 -1
  55. package/lib/locale/lang/es-ES.umd.js +4 -0
  56. package/lib/locale/lang/fr-FR.js +6 -2
  57. package/lib/locale/lang/fr-FR.min.js +1 -1
  58. package/lib/locale/lang/fr-FR.umd.js +6 -2
  59. package/lib/locale/lang/hu-HU.js +5 -1
  60. package/lib/locale/lang/hu-HU.min.js +1 -1
  61. package/lib/locale/lang/hu-HU.umd.js +5 -1
  62. package/lib/locale/lang/hy-AM.js +5 -1
  63. package/lib/locale/lang/hy-AM.min.js +1 -1
  64. package/lib/locale/lang/hy-AM.umd.js +5 -1
  65. package/lib/locale/lang/id-ID.js +6 -2
  66. package/lib/locale/lang/id-ID.min.js +1 -1
  67. package/lib/locale/lang/id-ID.umd.js +6 -2
  68. package/lib/locale/lang/it-IT.js +5 -1
  69. package/lib/locale/lang/it-IT.min.js +1 -1
  70. package/lib/locale/lang/it-IT.umd.js +5 -1
  71. package/lib/locale/lang/ja-JP.js +4 -0
  72. package/lib/locale/lang/ja-JP.min.js +1 -1
  73. package/lib/locale/lang/ja-JP.umd.js +4 -0
  74. package/lib/locale/lang/ko-KR.js +5 -1
  75. package/lib/locale/lang/ko-KR.min.js +1 -1
  76. package/lib/locale/lang/ko-KR.umd.js +5 -1
  77. package/lib/locale/lang/ms-MY.js +6 -2
  78. package/lib/locale/lang/ms-MY.min.js +1 -1
  79. package/lib/locale/lang/ms-MY.umd.js +6 -2
  80. package/lib/locale/lang/nb-NO.js +6 -2
  81. package/lib/locale/lang/nb-NO.min.js +1 -1
  82. package/lib/locale/lang/nb-NO.umd.js +6 -2
  83. package/lib/locale/lang/pt-BR.js +6 -2
  84. package/lib/locale/lang/pt-BR.min.js +1 -1
  85. package/lib/locale/lang/pt-BR.umd.js +6 -2
  86. package/lib/locale/lang/ru-RU.js +4 -0
  87. package/lib/locale/lang/ru-RU.min.js +1 -1
  88. package/lib/locale/lang/ru-RU.umd.js +4 -0
  89. package/lib/locale/lang/th-TH.js +5 -1
  90. package/lib/locale/lang/th-TH.min.js +1 -1
  91. package/lib/locale/lang/th-TH.umd.js +5 -1
  92. package/lib/locale/lang/ug-CN.js +5 -1
  93. package/lib/locale/lang/ug-CN.min.js +1 -1
  94. package/lib/locale/lang/ug-CN.umd.js +5 -1
  95. package/lib/locale/lang/uk-UA.js +5 -1
  96. package/lib/locale/lang/uk-UA.min.js +1 -1
  97. package/lib/locale/lang/uk-UA.umd.js +5 -1
  98. package/lib/locale/lang/uz-UZ.js +5 -1
  99. package/lib/locale/lang/uz-UZ.min.js +1 -1
  100. package/lib/locale/lang/uz-UZ.umd.js +5 -1
  101. package/lib/locale/lang/vi-VN.js +4 -0
  102. package/lib/locale/lang/vi-VN.min.js +1 -1
  103. package/lib/locale/lang/vi-VN.umd.js +4 -0
  104. package/lib/locale/lang/zh-CHT.js +4 -0
  105. package/lib/locale/lang/zh-CHT.min.js +1 -1
  106. package/lib/locale/lang/zh-CHT.umd.js +4 -0
  107. package/lib/locale/lang/zh-CN.js +4 -0
  108. package/lib/locale/lang/zh-CN.min.js +1 -1
  109. package/lib/locale/lang/zh-CN.umd.js +4 -0
  110. package/lib/style.css +1 -1
  111. package/lib/style.min.css +1 -1
  112. package/lib/table/module/custom/panel.js +29 -18
  113. package/lib/table/module/custom/panel.min.js +1 -1
  114. package/lib/table/module/export/export-panel.js +26 -13
  115. package/lib/table/module/export/export-panel.min.js +1 -1
  116. package/lib/table/module/export/mixin.js +216 -30
  117. package/lib/table/module/export/mixin.min.js +1 -1
  118. package/lib/table/src/cell.js +6 -1
  119. package/lib/table/src/cell.min.js +1 -1
  120. package/lib/table/src/methods.js +2 -2
  121. package/lib/table/src/methods.min.js +1 -1
  122. package/lib/table/src/table.js +16 -0
  123. package/lib/table/src/table.min.js +1 -1
  124. package/lib/table/src/util.js +3 -1
  125. package/lib/table/src/util.min.js +1 -1
  126. package/lib/table/style/style.css +1 -1
  127. package/lib/table/style/style.min.css +1 -1
  128. package/lib/ui/index.js +1 -1
  129. package/lib/ui/index.min.js +1 -1
  130. package/lib/ui/src/log.js +1 -1
  131. package/lib/ui/src/log.min.js +1 -1
  132. package/lib/vxe-table/style/style.css +1 -1
  133. package/lib/vxe-table/style/style.min.css +1 -1
  134. package/package.json +2 -2
  135. package/packages/locale/lang/ar-EG.ts +850 -846
  136. package/packages/locale/lang/de-DE.ts +850 -846
  137. package/packages/locale/lang/en-US.ts +850 -846
  138. package/packages/locale/lang/es-ES.ts +850 -846
  139. package/packages/locale/lang/fr-FR.ts +850 -846
  140. package/packages/locale/lang/hu-HU.ts +850 -846
  141. package/packages/locale/lang/hy-AM.ts +850 -846
  142. package/packages/locale/lang/id-ID.ts +850 -846
  143. package/packages/locale/lang/it-IT.ts +850 -846
  144. package/packages/locale/lang/ja-JP.ts +850 -846
  145. package/packages/locale/lang/ko-KR.ts +850 -846
  146. package/packages/locale/lang/ms-MY.ts +850 -846
  147. package/packages/locale/lang/nb-NO.ts +850 -846
  148. package/packages/locale/lang/pt-BR.ts +850 -846
  149. package/packages/locale/lang/ru-RU.ts +850 -846
  150. package/packages/locale/lang/th-TH.ts +850 -846
  151. package/packages/locale/lang/ug-CN.ts +850 -846
  152. package/packages/locale/lang/uk-UA.ts +850 -846
  153. package/packages/locale/lang/uz-UZ.ts +850 -846
  154. package/packages/locale/lang/vi-VN.ts +850 -846
  155. package/packages/locale/lang/zh-CHT.ts +850 -846
  156. package/packages/locale/lang/zh-CN.ts +4 -0
  157. package/packages/table/module/custom/panel.ts +29 -21
  158. package/packages/table/module/export/export-panel.ts +29 -17
  159. package/packages/table/module/export/mixin.ts +183 -30
  160. package/packages/table/src/cell.ts +6 -1
  161. package/packages/table/src/methods.ts +82 -31
  162. package/packages/table/src/table.ts +18 -0
  163. package/packages/table/src/util.ts +3 -1
  164. package/styles/components/table-module/export.scss +1 -1
  165. /package/es/{iconfont.1779778409753.ttf → iconfont.1779936730544.ttf} +0 -0
  166. /package/es/{iconfont.1779778409753.woff → iconfont.1779936730544.woff} +0 -0
  167. /package/es/{iconfont.1779778409753.woff2 → iconfont.1779936730544.woff2} +0 -0
  168. /package/lib/{iconfont.1779778409753.ttf → iconfont.1779936730544.ttf} +0 -0
  169. /package/lib/{iconfont.1779778409753.woff → iconfont.1779936730544.woff} +0 -0
  170. /package/lib/{iconfont.1779778409753.woff2 → iconfont.1779936730544.woff2} +0 -0
@@ -240,6 +240,10 @@ export default {
240
240
  expMergeTitle: '如果存在,则支持带有合并结构的单元格',
241
241
  expOptAllExpand: '展开树',
242
242
  expAllExpandTitle: '如果存在,则支持将带有层级结构的数据全部展开',
243
+ expOptTreeAllExpand: '展开树',
244
+ expTreeAllExpandTitle: '如果存在,则自动展开所有树层级',
245
+ expOptRowGroupAllExpand: '展开分组',
246
+ expRowGroupAllExpandTitle: '如果存在,则自动展开所有分组层级',
243
247
  expOptUseStyle: '样式',
244
248
  expUseStyleTitle: '如果存在,则支持带样式的单元格',
245
249
  expOptOriginal: '源数据',
@@ -420,7 +420,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
420
420
  const { immediate } = customOpts
421
421
  const trEl = evnt.currentTarget as HTMLElement
422
422
  const columnDragOpts = $xeTable.computeColumnDragOpts
423
- const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
423
+ const { isCrossDrag, isPeerDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
424
424
  const { dragCol } = customPanelReactData
425
425
  const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData
426
426
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
@@ -465,20 +465,28 @@ export default /* define-vxe-component start */ defineVxeComponent({
465
465
  if (dragColumn.parentId && newColumn.parentId) {
466
466
  // 子到子
467
467
 
468
- if (!isCrossDrag) {
469
- return
470
- }
471
- if (oldAllMaps[newColumn.id]) {
472
- isSelfToChildStatus = true
473
- if (!(isCrossDrag && isSelfToChildDrag)) {
474
- if (VxeUI.modal) {
475
- VxeUI.modal.message({
476
- status: 'error',
477
- content: getI18n('vxe.error.treeDragChild')
478
- })
479
- }
468
+ if (isPeerDrag && !isCrossDrag) {
469
+ if (dragColumn.parentId !== newColumn.parentId) {
470
+ // 非同级
471
+ return
472
+ }
473
+ } else {
474
+ if (!isCrossDrag) {
480
475
  return
481
476
  }
477
+
478
+ if (oldAllMaps[newColumn.id]) {
479
+ isSelfToChildStatus = true
480
+ if (!(isCrossDrag && isSelfToChildDrag)) {
481
+ if (VxeUI.modal) {
482
+ VxeUI.modal.message({
483
+ status: 'error',
484
+ content: getI18n('vxe.error.treeDragChild')
485
+ })
486
+ }
487
+ return
488
+ }
489
+ }
482
490
  }
483
491
  } else if (dragColumn.parentId) {
484
492
  // 子到根
@@ -616,7 +624,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
616
624
  const customOpts = $xeTable.computeCustomOpts
617
625
  const { showSortDragButton, allowSort, immediate } = customOpts
618
626
  const columnDragOpts = $xeTable.computeColumnDragOpts
619
- const { isCrossDrag, isToChildDrag } = columnDragOpts
627
+ const { isCrossDrag, isPeerDrag, isToChildDrag } = columnDragOpts
620
628
  const optEl = evnt.currentTarget as HTMLElement
621
629
  const isControlKey = hasControlKey(evnt)
622
630
  const colid = optEl.getAttribute('colid')
@@ -624,7 +632,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
624
632
  customPanelInternalData.prevDragGroupField = null
625
633
  customPanelInternalData.prevDragAggFnColid = null
626
634
  // 是否移入有效列
627
- if (column && (isCrossDrag || column.level === 1)) {
635
+ if (column && (isCrossDrag || isPeerDrag || column.level === 1)) {
628
636
  evnt.preventDefault()
629
637
  const offsetY = evnt.clientY - optEl.getBoundingClientRect().y
630
638
  const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom'
@@ -632,9 +640,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
632
640
  !dragCol ||
633
641
  !(showSortDragButton && allowSort) ||
634
642
  (dragCol && dragCol.id === column.id) ||
635
- (!isCrossDrag && column.level > 1) ||
643
+ (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.level > 1)) ||
636
644
  (!immediate && column.level > 1) ||
637
- (!isCrossDrag && dragCol.level > 1) ||
645
+ (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : dragCol.level > 1)) ||
638
646
  (!immediate && dragCol.level > 1)
639
647
  ) {
640
648
  showDropTip($xeTableCustomPanel, evnt, optEl, false, dragPos)
@@ -804,7 +812,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
804
812
  const { immediate, checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts
805
813
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
806
814
  const vSize = $xeTable.computeSize
807
- const { isCrossDrag } = columnDragOpts
815
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
808
816
  const slots = customOpts.slots || {}
809
817
  const headerSlot = slots.header
810
818
  const topSlot = slots.top
@@ -838,7 +846,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
838
846
  const colTitle = formatText(column.getTitle(), 1)
839
847
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
840
848
  const isHidden = !isChecked
841
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
849
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
842
850
  colVNs.push(
843
851
  h('li', {
844
852
  key: column.id,
@@ -1207,7 +1215,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1207
1215
  const modalOpts = Object.assign({}, modalOptions)
1208
1216
  const drawerOpts = Object.assign({}, drawerOptions)
1209
1217
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
1210
- const { isCrossDrag } = columnDragOpts
1218
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
1211
1219
  const slots = customOpts.slots || {}
1212
1220
  const headerSlot = slots.header
1213
1221
  const topSlot = slots.top
@@ -1255,7 +1263,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1255
1263
  const isColGroup = column.children && column.children.length
1256
1264
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
1257
1265
  const isHidden = !isChecked
1258
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
1266
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
1259
1267
  trVNs.push(
1260
1268
  h('tr', {
1261
1269
  key: column.id,
@@ -242,7 +242,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
242
242
 
243
243
  const { defaultOptions, storeData } = props
244
244
  const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData
245
- const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData
245
+ const { hasTree, hasRowGroup, hasMerge, isPrint, hasColgroup, columns } = storeData
246
246
  const { isHeader } = defaultOptions
247
247
  const colVNs: VNode[] = []
248
248
  const checkedAll = $xeExportPanel.computeCheckedAll
@@ -494,6 +494,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
494
494
  }
495
495
  }
496
496
  }),
497
+ h('vxe-checkbox', {
498
+ props: {
499
+ value: defaultOptions.isFooter,
500
+ disabled: !storeData.hasFooter,
501
+ title: getI18n('vxe.export.expFooterTitle'),
502
+ content: getI18n('vxe.export.expOptFooter')
503
+ },
504
+ on: {
505
+ input (value: any) {
506
+ defaultOptions.isFooter = value
507
+ }
508
+ }
509
+ }),
497
510
  h('vxe-checkbox', {
498
511
  props: {
499
512
  value: isHeader ? defaultOptions.isTitle : false,
@@ -564,35 +577,34 @@ export default /* define-vxe-component start */ defineVxeComponent({
564
577
  defaultOptions.useStyle = value
565
578
  }
566
579
  }
567
- }),
580
+ })
581
+ ]),
582
+ h('div', {
583
+ class: 'vxe-table-export--panel-option-row'
584
+ }, [
568
585
  h('vxe-checkbox', {
569
586
  props: {
570
- value: hasTree ? defaultOptions.isAllExpand : false,
587
+ value: hasTree ? defaultOptions.isTreeAllExpanded : false,
571
588
  disabled: hasEmptyData || !hasTree,
572
- title: getI18n('vxe.export.expAllExpandTitle'),
573
- content: getI18n('vxe.export.expOptAllExpand')
589
+ title: getI18n('vxe.export.expTreeAllExpandTitle'),
590
+ content: getI18n('vxe.export.expOptTreeAllExpand')
574
591
  },
575
592
  on: {
576
593
  input (value: any) {
577
- defaultOptions.isAllExpand = value
594
+ defaultOptions.isTreeAllExpanded = value
578
595
  }
579
596
  }
580
- })
581
- ]),
582
-
583
- h('div', {
584
- class: 'vxe-table-export--panel-option-row'
585
- }, [
597
+ }),
586
598
  h('vxe-checkbox', {
587
599
  props: {
588
- value: defaultOptions.isFooter,
589
- disabled: !storeData.hasFooter,
590
- title: getI18n('vxe.export.expFooterTitle'),
591
- content: getI18n('vxe.export.expOptFooter')
600
+ value: hasRowGroup ? defaultOptions.isRowGroupAllExpanded : false,
601
+ disabled: hasEmptyData || !hasRowGroup,
602
+ title: getI18n('vxe.export.expRowGroupAllExpandTitle'),
603
+ content: getI18n('vxe.export.expOptRowGroupAllExpand')
592
604
  },
593
605
  on: {
594
606
  input (value: any) {
595
- defaultOptions.isFooter = value
607
+ defaultOptions.isRowGroupAllExpanded = value
596
608
  }
597
609
  }
598
610
  })
@@ -15,12 +15,6 @@ let htmlCellElem: any
15
15
  const csvBOM = '\ufeff'
16
16
  const enterSymbol = '\r\n'
17
17
 
18
- function hasTreeChildren ($xeTable: VxeTableConstructor, row: any) {
19
- const treeOpts = $xeTable.computeTreeOpts
20
- const childrenField = treeOpts.children || treeOpts.childrenField
21
- return row[childrenField] && row[childrenField].length
22
- }
23
-
24
18
  function getSeq ($xeTable: VxeTableConstructor, cellValue: any, row: any, $rowIndex: number, column: VxeTableDefines.ColumnInfo, $columnIndex: number) {
25
19
  const seqOpts = $xeTable.computeSeqOpts
26
20
  const seqMd = seqOpts.seqMethod || (column as any).seqMethod
@@ -62,35 +56,179 @@ const toStringValue = (cellValue: any) => {
62
56
  return eqEmptyValue(cellValue) ? '' : `${cellValue}`
63
57
  }
64
58
 
65
- function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
59
+ function getBodyLabelData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
66
60
  const props = $xeTable
61
+ const reactData = $xeTable as unknown as TableReactData
62
+ const internalData = $xeTable as unknown as TableInternalData
67
63
 
68
- const { isAllExpand, mode } = opts
64
+ const { isTreeAllExpanded, isRowGroupAllExpanded, mode: expMode } = opts
69
65
  const { treeConfig } = props
66
+ const { isRowGroupStatus } = reactData
67
+ const { fullColumnFieldData } = internalData
70
68
  const radioOpts = $xeTable.computeRadioOpts
71
69
  const checkboxOpts = $xeTable.computeCheckboxOpts
72
70
  const treeOpts = $xeTable.computeTreeOpts
73
71
  const columnOpts = $xeTable.computeColumnOpts
72
+ const aggregateOpts = $xeTable.computeAggregateOpts
74
73
  if (!htmlCellElem) {
75
74
  htmlCellElem = document.createElement('div')
76
75
  }
76
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
77
+ if (isRowGroupStatus) {
78
+ // 如果是数据分组
79
+ const { mode: aggMode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts
80
+ const rest: any[] = []
81
+ const expandMaps: Record<string, boolean> = {}
82
+ const useMaps: Record<string, boolean> = {}
83
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
84
+ const row = item._row || item
85
+ const rowid = handleGetRowId(row)
86
+ if (useMaps[rowid]) {
87
+ return
88
+ }
89
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
90
+ const pRowid = parentRow ? handleGetRowId(parentRow) : ''
91
+ if ((isRowGroupAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)))) {
92
+ const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length
93
+ const item: any = {
94
+ _row: row,
95
+ _level: nodes.length - 1,
96
+ _hasChild: hasRowChild,
97
+ _expand: hasRowChild && $xeTable.isRowExpandByRow(row)
98
+ }
99
+ columns.forEach((column, $columnIndex) => {
100
+ const { field, editRender, cellRender, aggFunc, rowGroupNode } = column
101
+ let cellValue: string | number | boolean | null = ''
102
+ const renderOpts = editRender || cellRender
103
+ let bodyExportMethod: VxeColumnPropTypes.ExportMethod | undefined = column.exportMethod || columnOpts.exportMethod
104
+ if (!bodyExportMethod && renderOpts && renderOpts.name) {
105
+ const compConf = renderer.get(renderOpts.name)
106
+ if (compConf) {
107
+ bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
108
+ }
109
+ }
110
+ if (!bodyExportMethod) {
111
+ bodyExportMethod = columnOpts.exportMethod
112
+ }
113
+ if (bodyExportMethod) {
114
+ cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts })
115
+ } else {
116
+ switch (column.type) {
117
+ case 'seq': {
118
+ const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
119
+ cellValue = expMode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
120
+ break
121
+ }
122
+ case 'checkbox': {
123
+ cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row))
124
+ item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : ''
125
+ item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row })
126
+ break
127
+ }
128
+ case 'radio': {
129
+ cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row))
130
+ item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : ''
131
+ item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row })
132
+ break
133
+ }
134
+ default: {
135
+ if (field && row.isAggregate) {
136
+ const aggRow: VxeTableDefines.AggregateRowInfo = row
137
+ const aggData = aggRow.aggData
138
+ const currAggData = aggData ? aggData[field] : null
139
+ const groupField = aggRow.groupField
140
+ const groupContent = aggRow.groupContent
141
+ const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : []
142
+ const childCount = aggRow.childCount
143
+ const colRest = fullColumnFieldData[groupField] || {}
144
+ const ctParams = {
145
+ $table: $xeTable,
146
+ groupField,
147
+ groupColumn: (colRest ? colRest.column : null) as VxeTableDefines.ColumnInfo,
148
+ column,
149
+ groupValue: groupContent,
150
+ childList,
151
+ childCount,
152
+ aggValue: null as any,
153
+
154
+ /**
155
+ * 已废弃
156
+ * @deprecated
157
+ */
158
+ children: childList,
159
+ /**
160
+ * 已废弃
161
+ * @deprecated
162
+ */
163
+ totalValue: childCount
164
+ }
165
+ if (aggMode === 'column' ? field === aggRow.groupField : rowGroupNode) {
166
+ cellValue = groupContent
167
+ if (contentMethod) {
168
+ cellValue = `${contentMethod(ctParams)}`
169
+ }
170
+ if (showTotal) {
171
+ cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount])
172
+ }
173
+ } else if ($xeTable.getPivotTableAggregateCellAggValue) {
174
+ const aggParams = {
175
+ $table: $xeTable,
176
+ row,
177
+ column
178
+ }
179
+ cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams)
180
+ } else if (aggFunc === true || (countFields && countFields.includes(field))) {
181
+ cellValue = currAggData ? currAggData.value : childCount
182
+ ctParams.aggValue = cellValue
183
+ if (formatValuesMethod) {
184
+ cellValue = formatValuesMethod(ctParams)
185
+ }
186
+ }
187
+ } else if (opts.original) {
188
+ cellValue = getCellValue(row, column)
189
+ } else {
190
+ cellValue = $xeTable.getCellLabel(row, column)
191
+ if (column.type === 'html') {
192
+ htmlCellElem.innerHTML = cellValue
193
+ cellValue = htmlCellElem.innerText.trim()
194
+ } else {
195
+ const cell = $xeTable.getCellElement(row, column)
196
+ if (cell && !hasClass(cell, 'is--progress')) {
197
+ cellValue = cell.innerText.trim()
198
+ }
199
+ }
200
+ }
201
+ break
202
+ }
203
+ }
204
+ }
205
+ item[column.id] = toStringValue(cellValue)
206
+ })
207
+ useMaps[rowid] = true
208
+ if (pRowid) {
209
+ expandMaps[pRowid] = true
210
+ }
211
+ rest.push(Object.assign(item, row))
212
+ }
213
+ }, { children: mapChildrenField })
214
+ return rest
215
+ }
77
216
  if (treeConfig) {
78
217
  const childrenField = treeOpts.children || treeOpts.childrenField
79
- // 如果是树表格只允许导出数据源
218
+ // 如果是树结构
80
219
  const rest: any[] = []
81
220
  const expandMaps: Record<string, boolean> = {}
82
221
  const useMaps: Record<string, boolean> = {}
83
- const { handleGetRowId } = createHandleGetRowId($xeTable)
84
- XEUtils.eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
222
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
85
223
  const row = item._row || item
86
224
  const rowid = handleGetRowId(row)
87
225
  if (useMaps[rowid]) {
88
226
  return
89
227
  }
90
- const parentRow = parent && parent._row ? parent._row : parent
228
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
91
229
  const pRowid = parentRow ? handleGetRowId(parentRow) : ''
92
- if ((isAllExpand || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
93
- const hasRowChild = hasTreeChildren($xeTable, row)
230
+ if ((isTreeAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
231
+ const hasRowChild = row[childrenField] && row[childrenField].length
94
232
  const item: any = {
95
233
  _row: row,
96
234
  _level: nodes.length - 1,
@@ -116,7 +254,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
116
254
  switch (column.type) {
117
255
  case 'seq': {
118
256
  const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
119
- cellValue = mode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
257
+ cellValue = expMode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
120
258
  break
121
259
  }
122
260
  case 'checkbox':
@@ -177,7 +315,7 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
177
315
  switch (column.type) {
178
316
  case 'seq': {
179
317
  const seqValue = $rowIndex + 1
180
- cellValue = mode === 'all' ? seqValue : getSeq($xeTable, seqValue, row, $rowIndex, column, $columnIndex)
318
+ cellValue = expMode === 'all' ? seqValue : getSeq($xeTable, seqValue, row, $rowIndex, column, $columnIndex)
181
319
  break
182
320
  }
183
321
  case 'checkbox':
@@ -1005,10 +1143,11 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1005
1143
  const $xeGGWrapper = $xeGrid || $xeGantt
1006
1144
 
1007
1145
  const { treeConfig, showHeader, showFooter } = props
1008
- const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData
1146
+ const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData
1009
1147
  const { collectColumn, mergeBodyList, mergeFooterList } = internalData
1010
1148
  const exportOpts = $xeTable.computeExportOpts
1011
- const hasTree = treeConfig
1149
+ const hasTree = !!treeConfig
1150
+ const hasRowGroup = rowGroupList.length > 0
1012
1151
  const customOpts = $xeTable.computeCustomOpts
1013
1152
  const selectRecords = $xeTable.getCheckboxRecords()
1014
1153
  const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {}
@@ -1025,6 +1164,13 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1025
1164
  current: 'current',
1026
1165
  modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
1027
1166
  }, options)
1167
+
1168
+ // 已废弃,参数 isAllExpand
1169
+ if (XEUtils.isBoolean((defOpts as any).isAllExpand)) {
1170
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1171
+ defOpts.isTreeAllExpanded = (defOpts as any).isAllExpand
1172
+ }
1173
+
1028
1174
  const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps)
1029
1175
  const modes = defOpts.modes || []
1030
1176
  const checkMethod = customOpts.checkMethod
@@ -1065,17 +1211,16 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1065
1211
  column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false)
1066
1212
  })
1067
1213
  // 更新条件
1068
- Object.assign(exportStore, {
1069
- columns: exportColumns,
1070
- typeList,
1071
- modeList,
1072
- hasFooter,
1073
- hasMerge,
1074
- hasTree,
1075
- isPrint,
1076
- hasColgroup: isGroup,
1077
- visible: true
1078
- })
1214
+ exportStore.columns = exportColumns
1215
+ exportStore.typeList = typeList
1216
+ exportStore.modeList = modeList
1217
+ exportStore.hasFooter = hasFooter
1218
+ exportStore.hasMerge = hasMerge
1219
+ exportStore.hasTree = hasTree
1220
+ exportStore.hasRowGroup = hasRowGroup
1221
+ exportStore.isPrint = !!isPrint
1222
+ exportStore.hasColgroup = isGroup
1223
+ exportStore.visible = true
1079
1224
  // 默认参数
1080
1225
  Object.assign(exportParams, {
1081
1226
  mode: selectRecords.length ? 'selected' : 'current'
@@ -1212,7 +1357,8 @@ export default {
1212
1357
  // filename: '',
1213
1358
  // sheetName: '',
1214
1359
  // original: false,
1215
- // isAllExpand: false,
1360
+ // isTreeAllExpanded: false,
1361
+ // isRowGroupAllExpanded: false,
1216
1362
  // data: null,
1217
1363
  // remote: false,
1218
1364
  // dataFilterMethod: null,
@@ -1222,6 +1368,13 @@ export default {
1222
1368
  // beforeExportMethod: null,
1223
1369
  // afterExportMethod: null
1224
1370
  }, exportOpts, options)
1371
+
1372
+ // 已废弃,参数 isAllExpand
1373
+ if (XEUtils.isBoolean((opts as any).isAllExpand)) {
1374
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1375
+ opts.isTreeAllExpanded = (opts as any).isAllExpand
1376
+ }
1377
+
1225
1378
  let { filename, sheetName, type, mode, columns, original, columnFilterMethod, beforeExportMethod, includeFields, excludeFields } = opts
1226
1379
  let groups: any[] = []
1227
1380
  const selectRecords = $xeTable.getCheckboxRecords()
@@ -622,7 +622,12 @@ export const Cell = {
622
622
  if (rowGroupList.length) {
623
623
  const aggregateOpts = $table.computeAggregateOpts
624
624
  const { mode } = aggregateOpts
625
- if (mode === 'column' ? column.field === row.groupField : rowGroupNode) {
625
+ if (mode === 'column') {
626
+ if (row.groupField && column.field === row.groupField) {
627
+ return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
628
+ }
629
+ return cellVNodes
630
+ } else if (rowGroupNode) {
626
631
  return [Cell.renderRowGroupBtn(h, params, cellVNodes)]
627
632
  }
628
633
  }