vxe-table 4.19.1 → 4.19.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 (181) hide show
  1. package/dist/all.esm.js +31932 -0
  2. package/dist/style.css +1 -0
  3. package/dist/style.min.css +1 -0
  4. package/es/index.css +1 -1
  5. package/es/index.min.css +1 -1
  6. package/es/locale/lang/ar-EG.js +6 -2
  7. package/es/locale/lang/de-DE.js +6 -2
  8. package/es/locale/lang/en-US.js +6 -2
  9. package/es/locale/lang/es-ES.js +6 -2
  10. package/es/locale/lang/fr-FR.js +6 -2
  11. package/es/locale/lang/hu-HU.js +6 -2
  12. package/es/locale/lang/hy-AM.js +6 -2
  13. package/es/locale/lang/id-ID.js +6 -2
  14. package/es/locale/lang/it-IT.js +6 -2
  15. package/es/locale/lang/ja-JP.js +6 -2
  16. package/es/locale/lang/ko-KR.js +6 -2
  17. package/es/locale/lang/ms-MY.js +6 -2
  18. package/es/locale/lang/nb-NO.js +6 -2
  19. package/es/locale/lang/pt-BR.js +6 -2
  20. package/es/locale/lang/ru-RU.js +6 -2
  21. package/es/locale/lang/th-TH.js +6 -2
  22. package/es/locale/lang/ug-CN.js +6 -2
  23. package/es/locale/lang/uk-UA.js +6 -2
  24. package/es/locale/lang/uz-UZ.js +6 -2
  25. package/es/locale/lang/vi-VN.js +6 -2
  26. package/es/locale/lang/zh-CHT.js +6 -2
  27. package/es/locale/lang/zh-CN.js +6 -2
  28. package/es/style.css +1 -1
  29. package/es/style.min.css +1 -1
  30. package/es/table/module/custom/panel.js +29 -22
  31. package/es/table/module/export/export-panel.js +27 -16
  32. package/es/table/module/export/hook.js +120 -27
  33. package/es/table/module/validator/hook.js +2 -2
  34. package/es/table/src/cell.js +1 -1
  35. package/es/table/src/column.js +2 -0
  36. package/es/table/src/columnInfo.js +1 -0
  37. package/es/table/src/table.js +94 -31
  38. package/es/table/src/util.js +3 -1
  39. package/es/table/style.css +1 -1
  40. package/es/table/style.min.css +1 -1
  41. package/es/ui/index.js +1 -1
  42. package/es/ui/src/log.js +1 -1
  43. package/es/vxe-table/style.css +1 -1
  44. package/es/vxe-table/style.min.css +1 -1
  45. package/lib/index.css +1 -1
  46. package/lib/index.min.css +1 -1
  47. package/lib/index.umd.js +213 -75
  48. package/lib/index.umd.min.js +1 -1
  49. package/lib/locale/lang/ar-EG.js +6 -2
  50. package/lib/locale/lang/ar-EG.min.js +1 -1
  51. package/lib/locale/lang/ar-EG.umd.js +6 -2
  52. package/lib/locale/lang/de-DE.js +6 -2
  53. package/lib/locale/lang/de-DE.min.js +1 -1
  54. package/lib/locale/lang/de-DE.umd.js +6 -2
  55. package/lib/locale/lang/en-US.js +6 -2
  56. package/lib/locale/lang/en-US.min.js +1 -1
  57. package/lib/locale/lang/en-US.umd.js +6 -2
  58. package/lib/locale/lang/es-ES.js +6 -2
  59. package/lib/locale/lang/es-ES.min.js +1 -1
  60. package/lib/locale/lang/es-ES.umd.js +6 -2
  61. package/lib/locale/lang/fr-FR.js +6 -2
  62. package/lib/locale/lang/fr-FR.min.js +1 -1
  63. package/lib/locale/lang/fr-FR.umd.js +6 -2
  64. package/lib/locale/lang/hu-HU.js +6 -2
  65. package/lib/locale/lang/hu-HU.min.js +1 -1
  66. package/lib/locale/lang/hu-HU.umd.js +6 -2
  67. package/lib/locale/lang/hy-AM.js +6 -2
  68. package/lib/locale/lang/hy-AM.min.js +1 -1
  69. package/lib/locale/lang/hy-AM.umd.js +6 -2
  70. package/lib/locale/lang/id-ID.js +6 -2
  71. package/lib/locale/lang/id-ID.min.js +1 -1
  72. package/lib/locale/lang/id-ID.umd.js +6 -2
  73. package/lib/locale/lang/it-IT.js +6 -2
  74. package/lib/locale/lang/it-IT.min.js +1 -1
  75. package/lib/locale/lang/it-IT.umd.js +6 -2
  76. package/lib/locale/lang/ja-JP.js +6 -2
  77. package/lib/locale/lang/ja-JP.min.js +1 -1
  78. package/lib/locale/lang/ja-JP.umd.js +6 -2
  79. package/lib/locale/lang/ko-KR.js +6 -2
  80. package/lib/locale/lang/ko-KR.min.js +1 -1
  81. package/lib/locale/lang/ko-KR.umd.js +6 -2
  82. package/lib/locale/lang/ms-MY.js +6 -2
  83. package/lib/locale/lang/ms-MY.min.js +1 -1
  84. package/lib/locale/lang/ms-MY.umd.js +6 -2
  85. package/lib/locale/lang/nb-NO.js +6 -2
  86. package/lib/locale/lang/nb-NO.min.js +1 -1
  87. package/lib/locale/lang/nb-NO.umd.js +6 -2
  88. package/lib/locale/lang/pt-BR.js +6 -2
  89. package/lib/locale/lang/pt-BR.min.js +1 -1
  90. package/lib/locale/lang/pt-BR.umd.js +6 -2
  91. package/lib/locale/lang/ru-RU.js +6 -2
  92. package/lib/locale/lang/ru-RU.min.js +1 -1
  93. package/lib/locale/lang/ru-RU.umd.js +6 -2
  94. package/lib/locale/lang/th-TH.js +6 -2
  95. package/lib/locale/lang/th-TH.min.js +1 -1
  96. package/lib/locale/lang/th-TH.umd.js +6 -2
  97. package/lib/locale/lang/ug-CN.js +6 -2
  98. package/lib/locale/lang/ug-CN.min.js +1 -1
  99. package/lib/locale/lang/ug-CN.umd.js +6 -2
  100. package/lib/locale/lang/uk-UA.js +6 -2
  101. package/lib/locale/lang/uk-UA.min.js +1 -1
  102. package/lib/locale/lang/uk-UA.umd.js +6 -2
  103. package/lib/locale/lang/uz-UZ.js +6 -2
  104. package/lib/locale/lang/uz-UZ.min.js +1 -1
  105. package/lib/locale/lang/uz-UZ.umd.js +6 -2
  106. package/lib/locale/lang/vi-VN.js +6 -2
  107. package/lib/locale/lang/vi-VN.min.js +1 -1
  108. package/lib/locale/lang/vi-VN.umd.js +6 -2
  109. package/lib/locale/lang/zh-CHT.js +6 -2
  110. package/lib/locale/lang/zh-CHT.min.js +1 -1
  111. package/lib/locale/lang/zh-CHT.umd.js +6 -2
  112. package/lib/locale/lang/zh-CN.js +6 -2
  113. package/lib/locale/lang/zh-CN.min.js +1 -1
  114. package/lib/locale/lang/zh-CN.umd.js +6 -2
  115. package/lib/style.css +1 -1
  116. package/lib/style.min.css +1 -1
  117. package/lib/table/module/custom/panel.js +30 -21
  118. package/lib/table/module/custom/panel.min.js +1 -1
  119. package/lib/table/module/export/export-panel.js +22 -13
  120. package/lib/table/module/export/export-panel.min.js +1 -1
  121. package/lib/table/module/export/hook.js +139 -28
  122. package/lib/table/module/export/hook.min.js +1 -1
  123. package/lib/table/module/validator/hook.js +2 -2
  124. package/lib/table/module/validator/hook.min.js +1 -1
  125. package/lib/table/src/cell.js +1 -1
  126. package/lib/table/src/cell.min.js +1 -1
  127. package/lib/table/src/column.js +2 -0
  128. package/lib/table/src/column.min.js +1 -1
  129. package/lib/table/src/columnInfo.js +1 -0
  130. package/lib/table/src/columnInfo.min.js +1 -1
  131. package/lib/table/src/table.js +5 -5
  132. package/lib/table/src/table.min.js +1 -1
  133. package/lib/table/src/util.js +3 -1
  134. package/lib/table/src/util.min.js +1 -1
  135. package/lib/table/style/style.css +1 -1
  136. package/lib/table/style/style.min.css +1 -1
  137. package/lib/ui/index.js +1 -1
  138. package/lib/ui/index.min.js +1 -1
  139. package/lib/ui/src/log.js +1 -1
  140. package/lib/ui/src/log.min.js +1 -1
  141. package/lib/vxe-table/style/style.css +1 -1
  142. package/lib/vxe-table/style/style.min.css +1 -1
  143. package/package.json +5 -2
  144. package/packages/locale/lang/ar-EG.ts +6 -2
  145. package/packages/locale/lang/de-DE.ts +6 -2
  146. package/packages/locale/lang/en-US.ts +6 -2
  147. package/packages/locale/lang/es-ES.ts +6 -2
  148. package/packages/locale/lang/fr-FR.ts +6 -2
  149. package/packages/locale/lang/hu-HU.ts +6 -2
  150. package/packages/locale/lang/hy-AM.ts +6 -2
  151. package/packages/locale/lang/id-ID.ts +6 -2
  152. package/packages/locale/lang/it-IT.ts +6 -2
  153. package/packages/locale/lang/ja-JP.ts +6 -2
  154. package/packages/locale/lang/ko-KR.ts +6 -2
  155. package/packages/locale/lang/ms-MY.ts +6 -2
  156. package/packages/locale/lang/nb-NO.ts +6 -2
  157. package/packages/locale/lang/pt-BR.ts +6 -2
  158. package/packages/locale/lang/ru-RU.ts +6 -2
  159. package/packages/locale/lang/th-TH.ts +6 -2
  160. package/packages/locale/lang/ug-CN.ts +6 -2
  161. package/packages/locale/lang/uk-UA.ts +6 -2
  162. package/packages/locale/lang/uz-UZ.ts +6 -2
  163. package/packages/locale/lang/vi-VN.ts +6 -2
  164. package/packages/locale/lang/zh-CHT.ts +6 -2
  165. package/packages/locale/lang/zh-CN.ts +6 -2
  166. package/packages/table/module/custom/panel.ts +30 -23
  167. package/packages/table/module/export/export-panel.ts +27 -16
  168. package/packages/table/module/export/hook.ts +121 -28
  169. package/packages/table/module/validator/hook.ts +2 -2
  170. package/packages/table/src/cell.ts +1 -1
  171. package/packages/table/src/column.ts +2 -0
  172. package/packages/table/src/columnInfo.ts +1 -0
  173. package/packages/table/src/table.ts +96 -31
  174. package/packages/table/src/util.ts +3 -1
  175. package/styles/components/table-module/export.scss +1 -1
  176. /package/es/{iconfont.1779447258442.ttf → iconfont.1779843543280.ttf} +0 -0
  177. /package/es/{iconfont.1779447258442.woff → iconfont.1779843543280.woff} +0 -0
  178. /package/es/{iconfont.1779447258442.woff2 → iconfont.1779843543280.woff2} +0 -0
  179. /package/lib/{iconfont.1779447258442.ttf → iconfont.1779843543280.ttf} +0 -0
  180. /package/lib/{iconfont.1779447258442.woff → iconfont.1779843543280.woff} +0 -0
  181. /package/lib/{iconfont.1779447258442.woff2 → iconfont.1779843543280.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: '求和',
@@ -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: '求和',
@@ -348,7 +348,7 @@ export default defineVxeComponent({
348
348
  const { immediate } = customOpts
349
349
  const trEl = evnt.currentTarget as HTMLElement
350
350
  const columnDragOpts = computeColumnDragOpts.value
351
- const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
351
+ const { isCrossDrag, isPeerDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
352
352
  const { dragCol } = customPanelReactData
353
353
  const { prevDragCol, prevDragGroupField, prevDragAggFnColid, prevDragPos, prevDragToChild } = customPanelInternalData
354
354
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
@@ -393,20 +393,28 @@ export default defineVxeComponent({
393
393
  if (dragColumn.parentId && newColumn.parentId) {
394
394
  // 子到子
395
395
 
396
- if (!isCrossDrag) {
397
- return
398
- }
399
- if (oldAllMaps[newColumn.id]) {
400
- isSelfToChildStatus = true
401
- if (!(isCrossDrag && isSelfToChildDrag)) {
402
- if (VxeUI.modal) {
403
- VxeUI.modal.message({
404
- status: 'error',
405
- content: getI18n('vxe.error.treeDragChild')
406
- })
407
- }
396
+ if (isPeerDrag && !isCrossDrag) {
397
+ if (dragColumn.parentId !== newColumn.parentId) {
398
+ // 非同级
408
399
  return
409
400
  }
401
+ } else {
402
+ if (!isCrossDrag) {
403
+ return
404
+ }
405
+
406
+ if (oldAllMaps[newColumn.id]) {
407
+ isSelfToChildStatus = true
408
+ if (!(isCrossDrag && isSelfToChildDrag)) {
409
+ if (VxeUI.modal) {
410
+ VxeUI.modal.message({
411
+ status: 'error',
412
+ content: getI18n('vxe.error.treeDragChild')
413
+ })
414
+ }
415
+ return
416
+ }
417
+ }
410
418
  }
411
419
  } else if (dragColumn.parentId) {
412
420
  // 子到根
@@ -539,7 +547,7 @@ export default defineVxeComponent({
539
547
  const customOpts = computeCustomOpts.value
540
548
  const { showSortDragButton, allowSort, immediate } = customOpts
541
549
  const columnDragOpts = computeColumnDragOpts.value
542
- const { isCrossDrag, isToChildDrag } = columnDragOpts
550
+ const { isCrossDrag, isPeerDrag, isToChildDrag } = columnDragOpts
543
551
  const optEl = evnt.currentTarget as HTMLElement
544
552
  const isControlKey = hasControlKey(evnt)
545
553
  const colid = optEl.getAttribute('colid')
@@ -548,7 +556,7 @@ export default defineVxeComponent({
548
556
  customPanelInternalData.prevDragGroupField = null
549
557
  customPanelInternalData.prevDragAggFnColid = null
550
558
  // 是否移入有效列
551
- if (column && (isCrossDrag || column.level === 1)) {
559
+ if (column && (isCrossDrag || isPeerDrag || column.level === 1)) {
552
560
  evnt.preventDefault()
553
561
  const offsetY = evnt.clientY - optEl.getBoundingClientRect().y
554
562
  const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom'
@@ -556,9 +564,9 @@ export default defineVxeComponent({
556
564
  !dragCol ||
557
565
  !(showSortDragButton && allowSort) ||
558
566
  (dragCol && dragCol.id === column.id) ||
559
- (!isCrossDrag && column.level > 1) ||
567
+ (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.level > 1)) ||
560
568
  (!immediate && column.level > 1) ||
561
- (!isCrossDrag && dragCol.level > 1) ||
569
+ (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : dragCol.level > 1)) ||
562
570
  (!immediate && dragCol.level > 1)
563
571
  ) {
564
572
  showDropTip(evnt, optEl, false, dragPos)
@@ -697,13 +705,12 @@ export default defineVxeComponent({
697
705
  const { treeConfig, rowGroupConfig, aggregateConfig } = tableProps
698
706
  const { isCustomStatus, customColumnList, isCustomDragStatus } = tableReactData
699
707
  const customOpts = computeCustomOpts.value
700
- const { immediate } = customOpts
701
708
  const columnDragOpts = computeColumnDragOpts.value
702
709
  const { popupStyle } = customStore
703
- const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts
710
+ const { immediate, checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, allowGroup, allowValues, trigger, placement, showSortDragButton, showSortMoveButton, showSortPutButton } = customOpts
704
711
  const isMaxFixedColumn = computeIsMaxFixedColumn.value
705
712
  const vSize = computeSize.value
706
- const { isCrossDrag } = columnDragOpts
713
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
707
714
  const slots = customOpts.slots || {}
708
715
  const headerSlot = slots.header
709
716
  const topSlot = slots.top
@@ -737,7 +744,7 @@ export default defineVxeComponent({
737
744
  const colTitle = formatText(column.getTitle(), 1)
738
745
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
739
746
  const isHidden = !isChecked
740
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
747
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
741
748
  colVNs.push(
742
749
  h('li', {
743
750
  key: column.id,
@@ -1048,7 +1055,7 @@ export default defineVxeComponent({
1048
1055
  const modalOpts = Object.assign({}, modalOptions)
1049
1056
  const drawerOpts = Object.assign({}, drawerOptions)
1050
1057
  const isMaxFixedColumn = computeIsMaxFixedColumn.value
1051
- const { isCrossDrag } = columnDragOpts
1058
+ const { isCrossDrag, isPeerDrag } = columnDragOpts
1052
1059
  const slots = customOpts.slots || {}
1053
1060
  const headerSlot = slots.header
1054
1061
  const topSlot = slots.top
@@ -1096,7 +1103,7 @@ export default defineVxeComponent({
1096
1103
  const isColGroup = column.children && column.children.length
1097
1104
  const isDisabled = checkMethod ? !checkMethod({ $table: $xeTable, column }) : false
1098
1105
  const isHidden = !isChecked
1099
- const showSortBtn = ((isCrossDrag ? immediate : false) || column.level === 1)
1106
+ const showSortBtn = (isCrossDrag || isPeerDrag ? immediate : false) || column.level === 1
1100
1107
  trVNs.push(
1101
1108
  h('tr', {
1102
1109
  key: column.id,
@@ -173,7 +173,7 @@ export default defineVxeComponent({
173
173
 
174
174
  const { defaultOptions, storeData } = props
175
175
  const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData
176
- const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData
176
+ const { hasTree, hasRowGroup, hasMerge, isPrint, hasColgroup, columns } = storeData
177
177
  const { isHeader } = defaultOptions
178
178
  const colVNs: VNode[] = []
179
179
  const checkedAll = computeCheckedAll.value
@@ -407,6 +407,17 @@ export default defineVxeComponent({
407
407
  }
408
408
  })
409
409
  : renderEmptyElement($xeTable),
410
+ VxeUICheckboxComponent
411
+ ? h(VxeUICheckboxComponent, {
412
+ modelValue: defaultOptions.isFooter,
413
+ disabled: !storeData.hasFooter,
414
+ title: getI18n('vxe.export.expFooterTitle'),
415
+ content: getI18n('vxe.export.expOptFooter'),
416
+ 'onUpdate:modelValue' (value: any) {
417
+ defaultOptions.isFooter = value
418
+ }
419
+ })
420
+ : renderEmptyElement($xeTable),
410
421
  VxeUICheckboxComponent
411
422
  ? h(VxeUICheckboxComponent, {
412
423
  modelValue: isHeader ? defaultOptions.isTitle : false,
@@ -465,30 +476,30 @@ export default defineVxeComponent({
465
476
  'onUpdate:modelValue' (value: any) {
466
477
  defaultOptions.useStyle = value
467
478
  }
468
- }),
479
+ })
480
+ ]),
481
+ h('div', {
482
+ class: 'vxe-table-export--panel-option-row'
483
+ }, [
469
484
  VxeUICheckboxComponent
470
485
  ? h(VxeUICheckboxComponent, {
471
- modelValue: hasTree ? defaultOptions.isAllExpand : false,
486
+ modelValue: hasTree ? defaultOptions.isTreeAllExpanded : false,
472
487
  disabled: hasEmptyData || !hasTree,
473
- title: getI18n('vxe.export.expAllExpandTitle'),
474
- content: getI18n('vxe.export.expOptAllExpand'),
488
+ title: getI18n('vxe.export.expTreeAllExpandTitle'),
489
+ content: getI18n('vxe.export.expOptTreeAllExpand'),
475
490
  'onUpdate:modelValue' (value: any) {
476
- defaultOptions.isAllExpand = value
491
+ defaultOptions.isTreeAllExpanded = value
477
492
  }
478
493
  })
479
- : renderEmptyElement($xeTable)
480
- ]),
481
- h('div', {
482
- class: 'vxe-table-export--panel-option-row'
483
- }, [
494
+ : renderEmptyElement($xeTable),
484
495
  VxeUICheckboxComponent
485
496
  ? h(VxeUICheckboxComponent, {
486
- modelValue: defaultOptions.isFooter,
487
- disabled: !storeData.hasFooter,
488
- title: getI18n('vxe.export.expFooterTitle'),
489
- content: getI18n('vxe.export.expOptFooter'),
497
+ modelValue: hasRowGroup ? defaultOptions.isRowGroupAllExpanded : false,
498
+ disabled: hasEmptyData || !hasRowGroup,
499
+ title: getI18n('vxe.export.expRowGroupAllExpandTitle'),
500
+ content: getI18n('vxe.export.expOptRowGroupAllExpand'),
490
501
  'onUpdate:modelValue' (value: any) {
491
- defaultOptions.isFooter = value
502
+ defaultOptions.isRowGroupAllExpanded = value
492
503
  }
493
504
  })
494
505
  : renderEmptyElement($xeTable)
@@ -302,13 +302,7 @@ const tableExportMethodKeys: (keyof TableExportMethods)[] = ['exportData', 'impo
302
302
  hooks.add('tableExportModule', {
303
303
  setupTable ($xeTable) {
304
304
  const { props, reactData, internalData } = $xeTable
305
- const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts } = $xeTable.getComputeMaps()
306
-
307
- const hasTreeChildren = (row: any) => {
308
- const treeOpts = computeTreeOpts.value
309
- const childrenField = treeOpts.children || treeOpts.childrenField
310
- return row[childrenField] && row[childrenField].length
311
- }
305
+ const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts, computeAggregateOpts } = $xeTable.getComputeMaps()
312
306
 
313
307
  const getSeq = (cellValue: any, row: any, $rowIndex: number, column: VxeTableDefines.ColumnInfo, $columnIndex: number) => {
314
308
  const seqOpts = computeSeqOpts.value
@@ -344,32 +338,116 @@ hooks.add('tableExportModule', {
344
338
  }
345
339
 
346
340
  const getBodyLabelData = (opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) => {
347
- const { isAllExpand, mode } = opts
341
+ const { isTreeAllExpanded, isRowGroupAllExpanded, mode } = opts
348
342
  const { treeConfig } = props
343
+ const { isRowGroupStatus } = reactData
349
344
  const radioOpts = computeRadioOpts.value
350
345
  const checkboxOpts = computeCheckboxOpts.value
351
346
  const treeOpts = computeTreeOpts.value
352
347
  const columnOpts = computeColumnOpts.value
348
+ const aggregateOpts = computeAggregateOpts.value
353
349
  if (!htmlCellElem) {
354
350
  htmlCellElem = document.createElement('div')
355
351
  }
352
+ const { handleGetRowId } = createHandleGetRowId($xeTable)
353
+ if (isRowGroupStatus) {
354
+ // 如果是数据分组
355
+ const { mapChildrenField } = aggregateOpts
356
+ const rest: any[] = []
357
+ const expandMaps: Record<string, boolean> = {}
358
+ const useMaps: Record<string, boolean> = {}
359
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
360
+ const row = item._row || item
361
+ const rowid = handleGetRowId(row)
362
+ if (useMaps[rowid]) {
363
+ return
364
+ }
365
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
366
+ const pRowid = parentRow ? handleGetRowId(parentRow) : ''
367
+ if ((isRowGroupAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)))) {
368
+ const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length
369
+ const item: any = {
370
+ _row: row,
371
+ _level: nodes.length - 1,
372
+ _hasChild: hasRowChild,
373
+ _expand: hasRowChild && $xeTable.isRowExpandByRow(row)
374
+ }
375
+ columns.forEach((column, $columnIndex) => {
376
+ let cellValue: string | number | boolean | null = ''
377
+ const renderOpts = column.editRender || column.cellRender
378
+ let bodyExportMethod: VxeColumnPropTypes.ExportMethod | undefined = column.exportMethod || columnOpts.exportMethod
379
+ if (!bodyExportMethod && renderOpts && renderOpts.name) {
380
+ const compConf = renderer.get(renderOpts.name)
381
+ if (compConf) {
382
+ bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
383
+ }
384
+ }
385
+ if (!bodyExportMethod) {
386
+ bodyExportMethod = columnOpts.exportMethod
387
+ }
388
+ if (bodyExportMethod) {
389
+ cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts })
390
+ } else {
391
+ switch (column.type) {
392
+ case 'seq': {
393
+ const seqVal = path.map((num, i) => i % 2 === 0 ? (Number(num) + 1) : '.').join('')
394
+ cellValue = mode === 'all' ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex)
395
+ break
396
+ }
397
+ case 'checkbox':
398
+ cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row))
399
+ item._checkboxLabel = checkboxOpts.labelField ? XEUtils.get(row, checkboxOpts.labelField) : ''
400
+ item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row })
401
+ break
402
+ case 'radio':
403
+ cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row))
404
+ item._radioLabel = radioOpts.labelField ? XEUtils.get(row, radioOpts.labelField) : ''
405
+ item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row })
406
+ break
407
+ default:
408
+ if (opts.original) {
409
+ cellValue = getCellValue(row, column)
410
+ } else {
411
+ cellValue = $xeTable.getCellLabel(row, column)
412
+ if (column.type === 'html') {
413
+ htmlCellElem.innerHTML = cellValue
414
+ cellValue = htmlCellElem.innerText.trim()
415
+ } else {
416
+ const cell = $xeTable.getCellElement(row, column)
417
+ if (cell && !hasClass(cell, 'is--progress')) {
418
+ cellValue = cell.innerText.trim()
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
424
+ item[column.id] = toStringValue(cellValue)
425
+ })
426
+ useMaps[rowid] = true
427
+ if (pRowid) {
428
+ expandMaps[pRowid] = true
429
+ }
430
+ rest.push(Object.assign(item, row))
431
+ }
432
+ }, { children: mapChildrenField })
433
+ return rest
434
+ }
356
435
  if (treeConfig) {
436
+ // 如果是树结构
357
437
  const childrenField = treeOpts.children || treeOpts.childrenField
358
- // 如果是树表格只允许导出数据源
359
438
  const rest: any[] = []
360
439
  const expandMaps: Record<string, boolean> = {}
361
440
  const useMaps: Record<string, boolean> = {}
362
- const { handleGetRowId } = createHandleGetRowId($xeTable)
363
- XEUtils.eachTree(datas, (item, $rowIndex, items, path, parent, nodes) => {
441
+ XEUtils.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
364
442
  const row = item._row || item
365
443
  const rowid = handleGetRowId(row)
366
444
  if (useMaps[rowid]) {
367
445
  return
368
446
  }
369
- const parentRow = parent && parent._row ? parent._row : parent
447
+ const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem
370
448
  const pRowid = parentRow ? handleGetRowId(parentRow) : ''
371
- if ((isAllExpand || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
372
- const hasRowChild = hasTreeChildren(row)
449
+ if ((isTreeAllExpanded || !parentRow || (expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)))) {
450
+ const hasRowChild = row[childrenField] && row[childrenField].length
373
451
  const item: any = {
374
452
  _row: row,
375
453
  _level: nodes.length - 1,
@@ -1037,10 +1115,11 @@ hooks.add('tableExportModule', {
1037
1115
  const $xeGGWrapper = $xeGrid || $xeGantt
1038
1116
 
1039
1117
  const { treeConfig, showHeader, showFooter } = props
1040
- const { initStore, isGroup, footerTableData, exportStore, exportParams } = reactData
1118
+ const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData
1041
1119
  const { collectColumn, mergeBodyList, mergeFooterList } = internalData
1042
1120
  const exportOpts = computeExportOpts.value
1043
- const hasTree = treeConfig
1121
+ const hasTree = !!treeConfig
1122
+ const hasRowGroup = rowGroupList.length > 0
1044
1123
  const customOpts = computeCustomOpts.value
1045
1124
  const selectRecords = $xeTable.getCheckboxRecords()
1046
1125
  const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {} as VxeGridPropTypes.ProxyOpts
@@ -1057,6 +1136,13 @@ hooks.add('tableExportModule', {
1057
1136
  current: 'current',
1058
1137
  modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ['all'] : []).concat(['current', 'selected', 'empty'])
1059
1138
  }, options)
1139
+
1140
+ // 已废弃,参数 isAllExpand
1141
+ if (XEUtils.isBoolean((defOpts as any).isAllExpand)) {
1142
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1143
+ defOpts.isTreeAllExpanded = (defOpts as any).isAllExpand
1144
+ }
1145
+
1060
1146
  const types: string[] = defOpts.types || XEUtils.keys(exportOpts._typeMaps)
1061
1147
  const modes: string[] = defOpts.modes || []
1062
1148
  const checkMethod = customOpts.checkMethod
@@ -1097,17 +1183,16 @@ hooks.add('tableExportModule', {
1097
1183
  column.disabled = (parent && parent.disabled) || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false)
1098
1184
  })
1099
1185
  // 更新条件
1100
- Object.assign(exportStore, {
1101
- columns: exportColumns,
1102
- typeList,
1103
- modeList,
1104
- hasFooter,
1105
- hasMerge,
1106
- hasTree,
1107
- isPrint,
1108
- hasColgroup: isGroup,
1109
- visible: true
1110
- })
1186
+ exportStore.columns = exportColumns
1187
+ exportStore.typeList = typeList
1188
+ exportStore.modeList = modeList
1189
+ exportStore.hasFooter = hasFooter
1190
+ exportStore.hasMerge = hasMerge
1191
+ exportStore.hasTree = hasTree
1192
+ exportStore.hasRowGroup = hasRowGroup
1193
+ exportStore.isPrint = !!isPrint
1194
+ exportStore.hasColgroup = isGroup
1195
+ exportStore.visible = true
1111
1196
  // 默认参数
1112
1197
  Object.assign(exportParams, {
1113
1198
  mode: selectRecords.length ? 'selected' : 'current'
@@ -1188,7 +1273,8 @@ hooks.add('tableExportModule', {
1188
1273
  // filename: '',
1189
1274
  // sheetName: '',
1190
1275
  // original: false,
1191
- // isAllExpand: false,
1276
+ // isTreeAllExpanded: false,
1277
+ // isRowGroupAllExpanded: false,
1192
1278
  // data: null,
1193
1279
  // remote: false,
1194
1280
  // dataFilterMethod: null,
@@ -1198,6 +1284,13 @@ hooks.add('tableExportModule', {
1198
1284
  // beforeExportMethod: null,
1199
1285
  // afterExportMethod: null
1200
1286
  }, exportOpts, options)
1287
+
1288
+ // 已废弃,参数 isAllExpand
1289
+ if (XEUtils.isBoolean((opts as any).isAllExpand)) {
1290
+ warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded'])
1291
+ opts.isTreeAllExpanded = (opts as any).isAllExpand
1292
+ }
1293
+
1201
1294
  let { filename, sheetName, type, mode, columns, original, columnFilterMethod, beforeExportMethod, includeFields, excludeFields } = opts
1202
1295
  let groups: any[] = []
1203
1296
  const selectRecords = $xeTable.getCheckboxRecords()
@@ -469,7 +469,7 @@ hooks.add('tableValidatorModule', {
469
469
  const errorRules: Rule[] = []
470
470
  const syncValidList: Promise<any>[] = []
471
471
  if (field && editRules) {
472
- const rules = XEUtils.get(editRules, field)
472
+ const rules = column.rules ? column.rules : XEUtils.get(editRules, field)
473
473
  if (rules) {
474
474
  const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, field) : val
475
475
  rules.forEach((rule) => {
@@ -540,7 +540,7 @@ hooks.add('tableValidatorModule', {
540
540
  const { editRules } = props
541
541
  const { field } = column
542
542
  if (field && editRules) {
543
- const rules = XEUtils.get(editRules, field)
543
+ const rules = column.rules ? column.rules : XEUtils.get(editRules, field)
544
544
  return rules && !!XEUtils.find(rules, rule => type === 'all' || !rule.trigger || type === rule.trigger)
545
545
  }
546
546
  return false
@@ -1165,7 +1165,7 @@ export const Cell = {
1165
1165
  const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null
1166
1166
  let isRequired = false
1167
1167
  if (editRules) {
1168
- const columnRules = XEUtils.get(editRules, column.field) as VxeTableDefines.ValidatorRule[]
1168
+ const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field)
1169
1169
  if (columnRules) {
1170
1170
  isRequired = columnRules.some((rule) => rule.required)
1171
1171
  }
@@ -96,6 +96,8 @@ export const columnProps = {
96
96
  filterRender: Object as PropType<VxeColumnPropTypes.FilterRender>,
97
97
  // 是否显示浮动筛选
98
98
  floatingFilters: Object as PropType<VxeColumnPropTypes.FloatingFilters>,
99
+ // 列的校验规则
100
+ rules: Array as PropType<VxeColumnPropTypes.Rules>,
99
101
  // 设置为分组节点
100
102
  rowGroupNode: Boolean as PropType<VxeColumnPropTypes.RowGroupNode>,
101
103
  // 设置为树节点
@@ -113,6 +113,7 @@ export class ColumnInfo {
113
113
  filterRecoverMethod: _vm.filterRecoverMethod,
114
114
  filterRender: filterRender,
115
115
  floatingFilters: _vm.floatingFilters,
116
+ rules: _vm.rules,
116
117
  rowGroupNode: _vm.rowGroupNode,
117
118
  treeNode: _vm.treeNode,
118
119
  dragSort: _vm.dragSort,