vxe-table 3.21.1 → 3.21.3

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 (186) 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 +6 -2
  5. package/es/locale/lang/en-US.js +6 -2
  6. package/es/locale/lang/es-ES.js +6 -2
  7. package/es/locale/lang/fr-FR.js +6 -2
  8. package/es/locale/lang/hu-HU.js +6 -2
  9. package/es/locale/lang/hy-AM.js +6 -2
  10. package/es/locale/lang/id-ID.js +6 -2
  11. package/es/locale/lang/it-IT.js +6 -2
  12. package/es/locale/lang/ja-JP.js +6 -2
  13. package/es/locale/lang/ko-KR.js +6 -2
  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 +6 -2
  18. package/es/locale/lang/th-TH.js +6 -2
  19. package/es/locale/lang/ug-CN.js +6 -2
  20. package/es/locale/lang/uk-UA.js +6 -2
  21. package/es/locale/lang/uz-UZ.js +6 -2
  22. package/es/locale/lang/vi-VN.js +6 -2
  23. package/es/locale/lang/zh-CHT.js +6 -2
  24. package/es/locale/lang/zh-CN.js +6 -2
  25. package/es/style.css +1 -1
  26. package/es/style.min.css +1 -1
  27. package/es/table/module/custom/panel.js +29 -22
  28. package/es/table/module/export/export-panel.js +29 -16
  29. package/es/table/module/export/mixin.js +121 -26
  30. package/es/table/module/menu/mixin.js +3 -2
  31. package/es/table/module/validator/mixin.js +4 -4
  32. package/es/table/src/cell.js +1 -1
  33. package/es/table/src/column.js +2 -0
  34. package/es/table/src/columnInfo.js +1 -0
  35. package/es/table/src/methods.js +82 -31
  36. package/es/table/src/table.js +16 -0
  37. package/es/table/src/util.js +3 -1
  38. package/es/table/style.css +1 -1
  39. package/es/table/style.min.css +1 -1
  40. package/es/ui/index.js +1 -1
  41. package/es/ui/src/log.js +1 -1
  42. package/es/vxe-table/style.css +1 -1
  43. package/es/vxe-table/style.min.css +1 -1
  44. package/lib/index.css +1 -1
  45. package/lib/index.min.css +1 -1
  46. package/lib/index.umd.js +235 -75
  47. package/lib/index.umd.min.js +1 -1
  48. package/lib/locale/lang/ar-EG.js +6 -2
  49. package/lib/locale/lang/ar-EG.min.js +1 -1
  50. package/lib/locale/lang/ar-EG.umd.js +6 -2
  51. package/lib/locale/lang/de-DE.js +6 -2
  52. package/lib/locale/lang/de-DE.min.js +1 -1
  53. package/lib/locale/lang/de-DE.umd.js +6 -2
  54. package/lib/locale/lang/en-US.js +6 -2
  55. package/lib/locale/lang/en-US.min.js +1 -1
  56. package/lib/locale/lang/en-US.umd.js +6 -2
  57. package/lib/locale/lang/es-ES.js +6 -2
  58. package/lib/locale/lang/es-ES.min.js +1 -1
  59. package/lib/locale/lang/es-ES.umd.js +6 -2
  60. package/lib/locale/lang/fr-FR.js +6 -2
  61. package/lib/locale/lang/fr-FR.min.js +1 -1
  62. package/lib/locale/lang/fr-FR.umd.js +6 -2
  63. package/lib/locale/lang/hu-HU.js +6 -2
  64. package/lib/locale/lang/hu-HU.min.js +1 -1
  65. package/lib/locale/lang/hu-HU.umd.js +6 -2
  66. package/lib/locale/lang/hy-AM.js +6 -2
  67. package/lib/locale/lang/hy-AM.min.js +1 -1
  68. package/lib/locale/lang/hy-AM.umd.js +6 -2
  69. package/lib/locale/lang/id-ID.js +6 -2
  70. package/lib/locale/lang/id-ID.min.js +1 -1
  71. package/lib/locale/lang/id-ID.umd.js +6 -2
  72. package/lib/locale/lang/it-IT.js +6 -2
  73. package/lib/locale/lang/it-IT.min.js +1 -1
  74. package/lib/locale/lang/it-IT.umd.js +6 -2
  75. package/lib/locale/lang/ja-JP.js +6 -2
  76. package/lib/locale/lang/ja-JP.min.js +1 -1
  77. package/lib/locale/lang/ja-JP.umd.js +6 -2
  78. package/lib/locale/lang/ko-KR.js +6 -2
  79. package/lib/locale/lang/ko-KR.min.js +1 -1
  80. package/lib/locale/lang/ko-KR.umd.js +6 -2
  81. package/lib/locale/lang/ms-MY.js +6 -2
  82. package/lib/locale/lang/ms-MY.min.js +1 -1
  83. package/lib/locale/lang/ms-MY.umd.js +6 -2
  84. package/lib/locale/lang/nb-NO.js +6 -2
  85. package/lib/locale/lang/nb-NO.min.js +1 -1
  86. package/lib/locale/lang/nb-NO.umd.js +6 -2
  87. package/lib/locale/lang/pt-BR.js +6 -2
  88. package/lib/locale/lang/pt-BR.min.js +1 -1
  89. package/lib/locale/lang/pt-BR.umd.js +6 -2
  90. package/lib/locale/lang/ru-RU.js +6 -2
  91. package/lib/locale/lang/ru-RU.min.js +1 -1
  92. package/lib/locale/lang/ru-RU.umd.js +6 -2
  93. package/lib/locale/lang/th-TH.js +6 -2
  94. package/lib/locale/lang/th-TH.min.js +1 -1
  95. package/lib/locale/lang/th-TH.umd.js +6 -2
  96. package/lib/locale/lang/ug-CN.js +6 -2
  97. package/lib/locale/lang/ug-CN.min.js +1 -1
  98. package/lib/locale/lang/ug-CN.umd.js +6 -2
  99. package/lib/locale/lang/uk-UA.js +6 -2
  100. package/lib/locale/lang/uk-UA.min.js +1 -1
  101. package/lib/locale/lang/uk-UA.umd.js +6 -2
  102. package/lib/locale/lang/uz-UZ.js +6 -2
  103. package/lib/locale/lang/uz-UZ.min.js +1 -1
  104. package/lib/locale/lang/uz-UZ.umd.js +6 -2
  105. package/lib/locale/lang/vi-VN.js +6 -2
  106. package/lib/locale/lang/vi-VN.min.js +1 -1
  107. package/lib/locale/lang/vi-VN.umd.js +6 -2
  108. package/lib/locale/lang/zh-CHT.js +6 -2
  109. package/lib/locale/lang/zh-CHT.min.js +1 -1
  110. package/lib/locale/lang/zh-CHT.umd.js +6 -2
  111. package/lib/locale/lang/zh-CN.js +6 -2
  112. package/lib/locale/lang/zh-CN.min.js +1 -1
  113. package/lib/locale/lang/zh-CN.umd.js +6 -2
  114. package/lib/style.css +1 -1
  115. package/lib/style.min.css +1 -1
  116. package/lib/table/module/custom/panel.js +30 -21
  117. package/lib/table/module/custom/panel.min.js +1 -1
  118. package/lib/table/module/export/export-panel.js +26 -13
  119. package/lib/table/module/export/export-panel.min.js +1 -1
  120. package/lib/table/module/export/mixin.js +139 -27
  121. package/lib/table/module/export/mixin.min.js +1 -1
  122. package/lib/table/module/menu/mixin.js +3 -2
  123. package/lib/table/module/menu/mixin.min.js +1 -1
  124. package/lib/table/module/validator/mixin.js +4 -4
  125. package/lib/table/module/validator/mixin.min.js +1 -1
  126. package/lib/table/src/cell.js +1 -1
  127. package/lib/table/src/cell.min.js +1 -1
  128. package/lib/table/src/column.js +2 -0
  129. package/lib/table/src/column.min.js +1 -1
  130. package/lib/table/src/columnInfo.js +1 -0
  131. package/lib/table/src/columnInfo.min.js +1 -1
  132. package/lib/table/src/methods.js +2 -2
  133. package/lib/table/src/methods.min.js +1 -1
  134. package/lib/table/src/table.js +16 -0
  135. package/lib/table/src/table.min.js +1 -1
  136. package/lib/table/src/util.js +3 -1
  137. package/lib/table/src/util.min.js +1 -1
  138. package/lib/table/style/style.css +1 -1
  139. package/lib/table/style/style.min.css +1 -1
  140. package/lib/ui/index.js +1 -1
  141. package/lib/ui/index.min.js +1 -1
  142. package/lib/ui/src/log.js +1 -1
  143. package/lib/ui/src/log.min.js +1 -1
  144. package/lib/vxe-table/style/style.css +1 -1
  145. package/lib/vxe-table/style/style.min.css +1 -1
  146. package/package.json +2 -2
  147. package/packages/locale/lang/ar-EG.ts +6 -2
  148. package/packages/locale/lang/de-DE.ts +6 -2
  149. package/packages/locale/lang/en-US.ts +6 -2
  150. package/packages/locale/lang/es-ES.ts +6 -2
  151. package/packages/locale/lang/fr-FR.ts +6 -2
  152. package/packages/locale/lang/hu-HU.ts +6 -2
  153. package/packages/locale/lang/hy-AM.ts +6 -2
  154. package/packages/locale/lang/id-ID.ts +6 -2
  155. package/packages/locale/lang/it-IT.ts +6 -2
  156. package/packages/locale/lang/ja-JP.ts +6 -2
  157. package/packages/locale/lang/ko-KR.ts +6 -2
  158. package/packages/locale/lang/ms-MY.ts +6 -2
  159. package/packages/locale/lang/nb-NO.ts +6 -2
  160. package/packages/locale/lang/pt-BR.ts +6 -2
  161. package/packages/locale/lang/ru-RU.ts +6 -2
  162. package/packages/locale/lang/th-TH.ts +6 -2
  163. package/packages/locale/lang/ug-CN.ts +6 -2
  164. package/packages/locale/lang/uk-UA.ts +6 -2
  165. package/packages/locale/lang/uz-UZ.ts +6 -2
  166. package/packages/locale/lang/vi-VN.ts +6 -2
  167. package/packages/locale/lang/zh-CHT.ts +6 -2
  168. package/packages/locale/lang/zh-CN.ts +6 -2
  169. package/packages/table/module/custom/panel.ts +30 -23
  170. package/packages/table/module/export/export-panel.ts +29 -17
  171. package/packages/table/module/export/mixin.ts +122 -27
  172. package/packages/table/module/menu/mixin.ts +3 -2
  173. package/packages/table/module/validator/mixin.ts +4 -4
  174. package/packages/table/src/cell.ts +1 -1
  175. package/packages/table/src/column.ts +2 -0
  176. package/packages/table/src/columnInfo.ts +1 -0
  177. package/packages/table/src/methods.ts +82 -31
  178. package/packages/table/src/table.ts +18 -0
  179. package/packages/table/src/util.ts +3 -1
  180. package/styles/components/table-module/export.scss +1 -1
  181. /package/es/{iconfont.1779447236462.ttf → iconfont.1779843521280.ttf} +0 -0
  182. /package/es/{iconfont.1779447236462.woff → iconfont.1779843521280.woff} +0 -0
  183. /package/es/{iconfont.1779447236462.woff2 → iconfont.1779843521280.woff2} +0 -0
  184. /package/lib/{iconfont.1779447236462.ttf → iconfont.1779843521280.ttf} +0 -0
  185. /package/lib/{iconfont.1779447236462.woff → iconfont.1779843521280.woff} +0 -0
  186. /package/lib/{iconfont.1779447236462.woff2 → iconfont.1779843521280.woff2} +0 -0
@@ -166,7 +166,7 @@ export default {
166
166
  cstmDragTarget: '移动:{0}',
167
167
  setting: {
168
168
  colSort: '排序',
169
- sortHelpTip: '点击并拖动图标可以调整顺序',
169
+ sortHelpTip: '点击图标开始拖动',
170
170
  colTitle: '列标题',
171
171
  colResizable: '列宽(像素)',
172
172
  colVisible: '是否显示',
@@ -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: '源数据',
@@ -652,7 +656,7 @@ export default {
652
656
  groupPlaceholder: '拖至此处进行分组',
653
657
  valuesPlaceholder: '拖至此处进行聚合',
654
658
  dragExistCol: '该列已存在',
655
- sortHelpTip: '点击并拖动图标可以调整顺序'
659
+ sortHelpTip: '点击图标开始拖动'
656
660
  },
657
661
  aggFuncs: {
658
662
  sum: '求和',
@@ -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
+ // 非同级
480
471
  return
481
472
  }
473
+ } else {
474
+ if (!isCrossDrag) {
475
+ return
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)
@@ -799,13 +807,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
799
807
  const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps
800
808
  const { isCustomStatus, customColumnList, isCustomDragStatus } = tableReactData
801
809
  const customOpts = $xeTable.computeCustomOpts
802
- const { immediate } = customOpts
803
810
  const columnDragOpts = $xeTable.computeColumnDragOpts
804
811
  const { popupStyle } = customStore
805
- const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts
812
+ const { immediate, checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts
806
813
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
807
814
  const vSize = $xeTable.computeSize
808
- const { isCrossDrag } = columnDragOpts
815
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
809
816
  const slots = customOpts.slots || {}
810
817
  const headerSlot = slots.header
811
818
  const topSlot = slots.top
@@ -839,7 +846,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
839
846
  const colTitle = formatText(column.getTitle(), 1)
840
847
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
841
848
  const isHidden = !isChecked
842
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
849
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
843
850
  colVNs.push(
844
851
  h('li', {
845
852
  key: column.id,
@@ -1208,7 +1215,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1208
1215
  const modalOpts = Object.assign({}, modalOptions)
1209
1216
  const drawerOpts = Object.assign({}, drawerOptions)
1210
1217
  const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
1211
- const { isCrossDrag } = columnDragOpts
1218
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
1212
1219
  const slots = customOpts.slots || {}
1213
1220
  const headerSlot = slots.header
1214
1221
  const topSlot = slots.top
@@ -1256,7 +1263,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1256
1263
  const isColGroup = column.children && column.children.length
1257
1264
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
1258
1265
  const isHidden = !isChecked
1259
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
1266
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
1260
1267
  trVNs.push(
1261
1268
  h('tr', {
1262
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
@@ -64,33 +58,119 @@ const toStringValue = (cellValue: any) => {
64
58
 
65
59
  function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
66
60
  const props = $xeTable
61
+ const reactData = $xeTable as unknown as TableReactData
67
62
 
68
- const { isAllExpand, mode } = opts
63
+ const { isTreeAllExpanded, isRowGroupAllExpanded, mode } = opts
69
64
  const { treeConfig } = props
65
+ const { isRowGroupStatus } = reactData
70
66
  const radioOpts = $xeTable.computeRadioOpts
71
67
  const checkboxOpts = $xeTable.computeCheckboxOpts
72
68
  const treeOpts = $xeTable.computeTreeOpts
73
69
  const columnOpts = $xeTable.computeColumnOpts
70
+ const aggregateOpts = $xeTable.computeAggregateOpts
74
71
  if (!htmlCellElem) {
75
72
  htmlCellElem = document.createElement('div')
76
73
  }
74
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
75
+ if (isRowGroupStatus) {
76
+ // 如果是数据分组
77
+ // 如果是数据分组
78
+ const { mapChildrenField } = aggregateOpts
79
+ const rest: any[] = []
80
+ const expandMaps: Record<string, boolean> = {}
81
+ const useMaps: Record<string, boolean> = {}
82
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
83
+ const row = item._row || item
84
+ const rowid = handleGetRowId(row)
85
+ if (useMaps[rowid]) {
86
+ return
87
+ }
88
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
89
+ const pRowid = parentRow ? handleGetRowId(parentRow) : ''
90
+ if ((isRowGroupAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)))) {
91
+ const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length
92
+ const item: any = {
93
+ _row: row,
94
+ _level: nodes.length - 1,
95
+ _hasChild: hasRowChild,
96
+ _expand: hasRowChild && $xeTable.isRowExpandByRow(row)
97
+ }
98
+ columns.forEach((column, $columnIndex) => {
99
+ let cellValue: string | number | boolean | null = ''
100
+ const renderOpts = column.editRender || column.cellRender
101
+ let bodyExportMethod: VxeColumnPropTypes.ExportMethod | undefined = column.exportMethod || columnOpts.exportMethod
102
+ if (!bodyExportMethod && renderOpts && renderOpts.name) {
103
+ const compConf = renderer.get(renderOpts.name)
104
+ if (compConf) {
105
+ bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
106
+ }
107
+ }
108
+ if (!bodyExportMethod) {
109
+ bodyExportMethod = columnOpts.exportMethod
110
+ }
111
+ if (bodyExportMethod) {
112
+ cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts })
113
+ } else {
114
+ switch (column.type) {
115
+ case 'seq': {
116
+ const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
117
+ cellValue = mode === 'all' ? seqVal : getSeq($xeTable, seqVal, row, $rowIndex, column, $columnIndex)
118
+ break
119
+ }
120
+ case 'checkbox':
121
+ cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row))
122
+ item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : ''
123
+ item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row })
124
+ break
125
+ case 'radio':
126
+ cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row))
127
+ item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : ''
128
+ item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row })
129
+ break
130
+ default:
131
+ if (opts.original) {
132
+ cellValue = getCellValue(row, column)
133
+ } else {
134
+ cellValue = $xeTable.getCellLabel(row, column)
135
+ if (column.type === 'html') {
136
+ htmlCellElem.innerHTML = cellValue
137
+ cellValue = htmlCellElem.innerText.trim()
138
+ } else {
139
+ const cell = $xeTable.getCellElement(row, column)
140
+ if (cell && !hasClass(cell, 'is--progress')) {
141
+ cellValue = cell.innerText.trim()
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+ item[column.id] = toStringValue(cellValue)
148
+ })
149
+ useMaps[rowid] = true
150
+ if (pRowid) {
151
+ expandMaps[pRowid] = true
152
+ }
153
+ rest.push(Object.assign(item, row))
154
+ }
155
+ }, { children: mapChildrenField })
156
+ return rest
157
+ }
77
158
  if (treeConfig) {
78
159
  const childrenField = treeOpts.children || treeOpts.childrenField
79
- // 如果是树表格只允许导出数据源
160
+ // 如果是树结构
80
161
  const rest: any[] = []
81
162
  const expandMaps: Record<string, boolean> = {}
82
163
  const useMaps: Record<string, boolean> = {}
83
- const { handleGetRowId } = createHandleGetRowId($xeTable)
84
- XEUtils.eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
164
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
85
165
  const row = item._row || item
86
166
  const rowid = handleGetRowId(row)
87
167
  if (useMaps[rowid]) {
88
168
  return
89
169
  }
90
- const parentRow = parent && parent._row ? parent._row : parent
170
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
91
171
  const pRowid = parentRow ? handleGetRowId(parentRow) : ''
92
- if ((isAllExpand || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
93
- const hasRowChild = hasTreeChildren($xeTable, row)
172
+ if ((isTreeAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
173
+ const hasRowChild = row[childrenField] && row[childrenField].length
94
174
  const item: any = {
95
175
  _row: row,
96
176
  _level: nodes.length - 1,
@@ -1005,10 +1085,11 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1005
1085
  const $xeGGWrapper = $xeGrid || $xeGantt
1006
1086
 
1007
1087
  const { treeConfig, showHeader, showFooter } = props
1008
- const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData
1088
+ const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData
1009
1089
  const { collectColumn, mergeBodyList, mergeFooterList } = internalData
1010
1090
  const exportOpts = $xeTable.computeExportOpts
1011
- const hasTree = treeConfig
1091
+ const hasTree = !!treeConfig
1092
+ const hasRowGroup = rowGroupList.length > 0
1012
1093
  const customOpts = $xeTable.computeCustomOpts
1013
1094
  const selectRecords = $xeTable.getCheckboxRecords()
1014
1095
  const proxyOpts = $xeGGWrapper ? $xeGGWrapper.computeProxyOpts : {}
@@ -1025,6 +1106,13 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1025
1106
  current: 'current',
1026
1107
  modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
1027
1108
  }, options)
1109
+
1110
+ // 已废弃,参数 isAllExpand
1111
+ if (XEUtils.isBoolean((defOpts as any).isAllExpand)) {
1112
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1113
+ defOpts.isTreeAllExpanded = (defOpts as any).isAllExpand
1114
+ }
1115
+
1028
1116
  const types = defOpts.types || XEUtils.keys(exportOpts._typeMaps)
1029
1117
  const modes = defOpts.modes || []
1030
1118
  const checkMethod = customOpts.checkMethod
@@ -1065,17 +1153,16 @@ function handleExportAndPrint ($xeTable: VxeTableConstructor, options: VxeTableP
1065
1153
  column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false)
1066
1154
  })
1067
1155
  // 更新条件
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
- })
1156
+ exportStore.columns = exportColumns
1157
+ exportStore.typeList = typeList
1158
+ exportStore.modeList = modeList
1159
+ exportStore.hasFooter = hasFooter
1160
+ exportStore.hasMerge = hasMerge
1161
+ exportStore.hasTree = hasTree
1162
+ exportStore.hasRowGroup = hasRowGroup
1163
+ exportStore.isPrint = !!isPrint
1164
+ exportStore.hasColgroup = isGroup
1165
+ exportStore.visible = true
1079
1166
  // 默认参数
1080
1167
  Object.assign(exportParams, {
1081
1168
  mode: selectRecords.length ? 'selected' : 'current'
@@ -1212,7 +1299,8 @@ export default {
1212
1299
  // filename: '',
1213
1300
  // sheetName: '',
1214
1301
  // original: false,
1215
- // isAllExpand: false,
1302
+ // isTreeAllExpanded: false,
1303
+ // isRowGroupAllExpanded: false,
1216
1304
  // data: null,
1217
1305
  // remote: false,
1218
1306
  // dataFilterMethod: null,
@@ -1222,6 +1310,13 @@ export default {
1222
1310
  // beforeExportMethod: null,
1223
1311
  // afterExportMethod: null
1224
1312
  }, exportOpts, options)
1313
+
1314
+ // 已废弃,参数 isAllExpand
1315
+ if (XEUtils.isBoolean((opts as any).isAllExpand)) {
1316
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1317
+ opts.isTreeAllExpanded = (opts as any).isAllExpand
1318
+ }
1319
+
1225
1320
  let { filename, sheetName, type, mode, columns, original, columnFilterMethod, beforeExportMethod, includeFields, excludeFields } = opts
1226
1321
  let groups: any[] = []
1227
1322
  const selectRecords = $xeTable.getCheckboxRecords()
@@ -312,8 +312,9 @@ export default {
312
312
  if (!menu.loading && !menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
313
313
  const gMenuOpts = menus.get(menu.code)
314
314
  const params = Object.assign({}, internalData._currMenuParams, { menu, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, $event: evnt })
315
- if (gMenuOpts && gMenuOpts.menuMethod) {
316
- gMenuOpts.menuMethod(params, evnt)
315
+ const tmMethod = gMenuOpts ? (gMenuOpts.tableMenuMethod || gMenuOpts.menuMethod) : null
316
+ if (tmMethod) {
317
+ tmMethod(params, evnt)
317
318
  }
318
319
  // 在 v4 中废弃事件 context-menu-click
319
320
  if ($xeTable.$listeners['context-menu-click']) {
@@ -394,9 +394,9 @@ export default {
394
394
  },
395
395
  hasCellRules (type: any, row: any, column: any) {
396
396
  const { editRules } = this
397
- const { property } = column
398
- if (property && editRules) {
399
- const rules = XEUtils.get(editRules, property)
397
+ const { field } = column
398
+ if (field && editRules) {
399
+ const rules = column.rules ? column.rules : XEUtils.get(editRules, field)
400
400
  return rules && XEUtils.find(rules, rule => type === 'all' || !rule.trigger || type === rule.trigger)
401
401
  }
402
402
  return false
@@ -425,7 +425,7 @@ export default {
425
425
  const errorRules: Rule[] = []
426
426
  const syncValidList: Promise<any>[] = []
427
427
  if (field && editRules) {
428
- const rules = XEUtils.get(editRules, field)
428
+ const rules = column.rules ? column.rules : XEUtils.get(editRules, field)
429
429
  if (rules) {
430
430
  const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, field) : val
431
431
  rules.forEach((rule: any) => {
@@ -1161,7 +1161,7 @@ export const Cell = {
1161
1161
  const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1162
1162
  let isRequired = false
1163
1163
  if (editRules) {
1164
- const columnRules = XEUtils.get(editRules, column.field)
1164
+ const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field)
1165
1165
  if (columnRules) {
1166
1166
  isRequired = columnRules.some((rule: any) => rule.required)
1167
1167
  }
@@ -103,6 +103,8 @@ export const columnProps = {
103
103
  filterRender: Object as PropType<VxeColumnPropTypes.FilterRender>,
104
104
  // 是否显示浮动筛选
105
105
  floatingFilters: Object as PropType<VxeColumnPropTypes.FloatingFilters>,
106
+ // 列的校验规则
107
+ rules: Array as PropType<VxeColumnPropTypes.Rules>,
106
108
  // 设置为分组节点
107
109
  rowGroupNode: Boolean as PropType<VxeColumnPropTypes.RowGroupNode>,
108
110
  // 设置为树节点
@@ -120,6 +120,7 @@ export class ColumnInfo {
120
120
  filterRecoverMethod: _vm.filterRecoverMethod,
121
121
  filterRender: filterRender,
122
122
  floatingFilters: _vm.floatingFilters,
123
+ rules: _vm.rules,
123
124
  rowGroupNode: _vm.rowGroupNode,
124
125
  treeNode: _vm.treeNode,
125
126
  dragSort: _vm.dragSort,