vxe-table 4.8.0 → 4.8.2

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 (118) hide show
  1. package/es/locale/lang/en-US.js +4 -2
  2. package/es/locale/lang/es-ES.js +4 -2
  3. package/es/locale/lang/hu-HU.js +4 -2
  4. package/es/locale/lang/ja-JP.js +4 -2
  5. package/es/locale/lang/ko-KR.js +4 -2
  6. package/es/locale/lang/pt-BR.js +4 -2
  7. package/es/locale/lang/ru-RU.js +4 -2
  8. package/es/locale/lang/uk-UA.js +4 -2
  9. package/es/locale/lang/vi-VN.js +4 -2
  10. package/es/locale/lang/zh-CHT.js +4 -2
  11. package/es/locale/lang/zh-CN.js +4 -2
  12. package/es/style.css +1 -1
  13. package/es/style.min.css +1 -1
  14. package/es/table/module/edit/hook.js +7 -4
  15. package/es/table/src/body.js +22 -8
  16. package/es/table/src/cell.js +65 -27
  17. package/es/table/src/column.js +3 -1
  18. package/es/table/src/columnInfo.js +1 -0
  19. package/es/table/src/emits.js +3 -0
  20. package/es/table/src/props.js +2 -0
  21. package/es/table/src/table.js +241 -40
  22. package/es/table/style.css +77 -2
  23. package/es/table/style.min.css +1 -1
  24. package/es/ui/index.js +4 -1
  25. package/es/ui/src/log.js +1 -1
  26. package/es/vxe-table/style.css +77 -2
  27. package/es/vxe-table/style.min.css +1 -1
  28. package/helper/vetur/attributes.json +1 -1
  29. package/helper/vetur/tags.json +1 -1
  30. package/lib/index.umd.js +378 -85
  31. package/lib/index.umd.min.js +1 -1
  32. package/lib/locale/lang/en-US.js +4 -2
  33. package/lib/locale/lang/en-US.min.js +1 -1
  34. package/lib/locale/lang/en-US.umd.js +4 -2
  35. package/lib/locale/lang/es-ES.js +4 -2
  36. package/lib/locale/lang/es-ES.min.js +1 -1
  37. package/lib/locale/lang/es-ES.umd.js +4 -2
  38. package/lib/locale/lang/hu-HU.js +4 -2
  39. package/lib/locale/lang/hu-HU.min.js +1 -1
  40. package/lib/locale/lang/hu-HU.umd.js +4 -2
  41. package/lib/locale/lang/ja-JP.js +4 -2
  42. package/lib/locale/lang/ja-JP.min.js +1 -1
  43. package/lib/locale/lang/ja-JP.umd.js +4 -2
  44. package/lib/locale/lang/ko-KR.js +4 -2
  45. package/lib/locale/lang/ko-KR.min.js +1 -1
  46. package/lib/locale/lang/ko-KR.umd.js +4 -2
  47. package/lib/locale/lang/pt-BR.js +4 -2
  48. package/lib/locale/lang/pt-BR.min.js +1 -1
  49. package/lib/locale/lang/pt-BR.umd.js +4 -2
  50. package/lib/locale/lang/ru-RU.js +4 -2
  51. package/lib/locale/lang/ru-RU.min.js +1 -1
  52. package/lib/locale/lang/ru-RU.umd.js +4 -2
  53. package/lib/locale/lang/uk-UA.js +4 -2
  54. package/lib/locale/lang/uk-UA.min.js +1 -1
  55. package/lib/locale/lang/uk-UA.umd.js +4 -2
  56. package/lib/locale/lang/vi-VN.js +4 -2
  57. package/lib/locale/lang/vi-VN.min.js +1 -1
  58. package/lib/locale/lang/zh-CHT.js +4 -2
  59. package/lib/locale/lang/zh-CHT.min.js +1 -1
  60. package/lib/locale/lang/zh-CN.js +4 -2
  61. package/lib/locale/lang/zh-CN.min.js +1 -1
  62. package/lib/locale/lang/zh-CN.umd.js +4 -2
  63. package/lib/style.css +1 -1
  64. package/lib/style.min.css +1 -1
  65. package/lib/table/module/edit/hook.js +8 -4
  66. package/lib/table/module/edit/hook.min.js +1 -1
  67. package/lib/table/src/body.js +18 -5
  68. package/lib/table/src/body.min.js +1 -1
  69. package/lib/table/src/cell.js +79 -27
  70. package/lib/table/src/cell.min.js +1 -1
  71. package/lib/table/src/column.js +3 -1
  72. package/lib/table/src/column.min.js +1 -1
  73. package/lib/table/src/columnInfo.js +1 -0
  74. package/lib/table/src/columnInfo.min.js +1 -1
  75. package/lib/table/src/emits.js +1 -1
  76. package/lib/table/src/emits.min.js +1 -1
  77. package/lib/table/src/props.js +2 -0
  78. package/lib/table/src/props.min.js +1 -1
  79. package/lib/table/src/table.js +258 -43
  80. package/lib/table/src/table.min.js +1 -1
  81. package/lib/table/style/style.css +77 -2
  82. package/lib/table/style/style.min.css +1 -1
  83. package/lib/ui/index.js +4 -1
  84. package/lib/ui/index.min.js +1 -1
  85. package/lib/ui/src/log.js +1 -1
  86. package/lib/ui/src/log.min.js +1 -1
  87. package/lib/vxe-table/style/style.css +77 -2
  88. package/lib/vxe-table/style/style.min.css +1 -1
  89. package/package.json +2 -2
  90. package/packages/locale/lang/en-US.ts +4 -2
  91. package/packages/locale/lang/es-ES.ts +4 -2
  92. package/packages/locale/lang/hu-HU.ts +4 -2
  93. package/packages/locale/lang/ja-JP.ts +4 -2
  94. package/packages/locale/lang/ko-KR.ts +4 -2
  95. package/packages/locale/lang/pt-BR.ts +4 -2
  96. package/packages/locale/lang/ru-RU.ts +4 -2
  97. package/packages/locale/lang/uk-UA.ts +4 -2
  98. package/packages/locale/lang/vi-VN.ts +4 -2
  99. package/packages/locale/lang/zh-CHT.ts +4 -2
  100. package/packages/locale/lang/zh-CN.ts +4 -2
  101. package/packages/table/module/custom/panel.ts +1 -1
  102. package/packages/table/module/edit/hook.ts +7 -4
  103. package/packages/table/src/body.ts +22 -8
  104. package/packages/table/src/cell.ts +69 -27
  105. package/packages/table/src/column.ts +3 -1
  106. package/packages/table/src/columnInfo.ts +1 -0
  107. package/packages/table/src/emits.ts +4 -0
  108. package/packages/table/src/props.ts +2 -0
  109. package/packages/table/src/table.ts +258 -42
  110. package/packages/ui/index.ts +3 -0
  111. package/styles/components/table-module/custom.scss +14 -3
  112. package/styles/components/table.scss +80 -0
  113. /package/es/{iconfont.1730681238555.ttf → iconfont.1730898232530.ttf} +0 -0
  114. /package/es/{iconfont.1730681238555.woff → iconfont.1730898232530.woff} +0 -0
  115. /package/es/{iconfont.1730681238555.woff2 → iconfont.1730898232530.woff2} +0 -0
  116. /package/lib/{iconfont.1730681238555.ttf → iconfont.1730898232530.ttf} +0 -0
  117. /package/lib/{iconfont.1730681238555.woff → iconfont.1730898232530.woff} +0 -0
  118. /package/lib/{iconfont.1730681238555.woff2 → iconfont.1730898232530.woff2} +0 -0
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '{0} レコードがインポートされました',
63
63
  expLoading: 'エクスポート中',
64
64
  expSuccess: 'エクスポートが成功しました',
65
+ expError: 'Export failure',
65
66
  expOriginFilename: 'エクスポート_{0}',
66
67
  expSrcFilename: 'エクスポート_ソース_{0}',
67
68
  customTitle: '列設定',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: 'Cancel',
72
73
  customRestore: 'リセット',
73
- maxFixedCol: '最大固定列数が {0} です。'
74
+ maxFixedCol: '最大固定列数が {0} です。',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '1つ以上のレコードを選択してください',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: 'キャンセル',
122
124
  cstmConfirm: 'OK',
123
125
  cstmConfirmRestore: '列をデフォルト状態に戻します。よろしいですか?',
124
- cstmDragTarget: '移動ターゲット: {0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: 'ソート',
127
129
  sortHelpTip: 'ドラッグして列を並べ替えます',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '成功导入 {0} 条记录',
63
63
  expLoading: '正在导出中',
64
64
  expSuccess: '导出成功',
65
+ expError: 'Export failure',
65
66
  expFilename: '导出_{0}',
66
67
  expOriginFilename: '导出_源_{0}',
67
68
  customTitle: '列设置',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: '取消',
72
73
  customRestore: '恢复默认',
73
- maxFixedCol: '最大冻结列的数量不能超过 {0} 个'
74
+ maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '请至少选择一条记录!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: '取消',
122
124
  cstmConfirm: '确定',
123
125
  cstmConfirmRestore: '请确认是否恢复成默认列配置?',
124
- cstmDragTarget: '移动目标:{0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: '排序',
127
129
  sortHelpTip: '点击并拖动图标可以调整列的排序',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: 'Importado com sucesso {0} registros',
63
63
  expLoading: 'Exportando',
64
64
  expSuccess: 'Exportado com sucesso',
65
+ expError: 'Export failure',
65
66
  expFilename: 'Exportar_{0}',
66
67
  expOriginFilename: 'Exportar_original_{0}',
67
68
  customTitle: 'Configurações de coluna',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: 'Cancel',
72
73
  customRestore: 'Restore',
73
- maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}'
74
+ maxFixedCol: 'The maximum number of Freeze columns cannot exceed {0}',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: 'Por favor, selecione pelo menos um registro!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: 'Cancelar',
122
124
  cstmConfirm: 'Confirm',
123
125
  cstmConfirmRestore: 'Please confirm whether to restore the default column configuration?',
124
- cstmDragTarget: 'Moving target: {0}',
126
+ cstmDragTarget: 'Moving: {0}',
125
127
  setting: {
126
128
  colSort: 'Sort',
127
129
  sortHelpTip: 'Click and drag the icon to adjust the order of the columns.',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: 'Успешно импортировано {0} записей.',
63
63
  expLoading: 'Экспорт',
64
64
  expSuccess: 'Экспорт выполнен успешно',
65
+ expError: 'Export failure',
65
66
  expFilename: 'Экспорт_{0}',
66
67
  expOriginFilename: 'экспорт_источник_{0}',
67
68
  customTitle: 'Настройки столбца',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: 'закрытие',
71
72
  customCancel: 'Отмена',
72
73
  customRestore: 'Восстановить настройки по умолчанию',
73
- maxFixedCol: 'Максимальное количество замороженных столбцов не может превышать {0}.'
74
+ maxFixedCol: 'Максимальное количество замороженных столбцов не может превышать {0}.',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: 'Пожалуйста, выберите хотя бы одну запись!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: 'Отмена',
122
124
  cstmConfirm: 'Конечно',
123
125
  cstmConfirmRestore: 'Пожалуйста, подтвердите, нужно ли восстановить конфигурацию столбца по умолчанию?',
124
- cstmDragTarget: 'Движущаяся цель: {0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: 'сортировать',
127
129
  sortHelpTip: 'Нажмите и перетащите значок, чтобы изменить порядок столбцов.',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '成功导入 {0} 条记录',
63
63
  expLoading: '正在导出中',
64
64
  expSuccess: '导出成功',
65
+ expError: '导出失败',
65
66
  expFilename: '导出_{0}',
66
67
  expOriginFilename: '导出_源_{0}',
67
68
  customTitle: '列设置',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: '取消',
72
73
  customRestore: '恢复默认',
73
- maxFixedCol: '最大冻结列的数量不能超过 {0} 个'
74
+ maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '请至少选择一条记录!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: '取消',
122
124
  cstmConfirm: '确定',
123
125
  cstmConfirmRestore: '请确认是否恢复成默认列配置?',
124
- cstmDragTarget: '移动目标:{0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: '排序',
127
129
  sortHelpTip: '点击并拖动图标可以调整列的排序',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '成功导入 {0} 条记录',
63
63
  expLoading: '正在导出中',
64
64
  expSuccess: '导出成功',
65
+ expError: '导出失败',
65
66
  expFilename: '导出_{0}',
66
67
  expOriginFilename: '导出_源_{0}',
67
68
  customTitle: '列设置',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: '取消',
72
73
  customRestore: '恢复默认',
73
- maxFixedCol: '最大冻结列的数量不能超过 {0} 个'
74
+ maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '请至少选择一条记录!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: '取消',
122
124
  cstmConfirm: '确定',
123
125
  cstmConfirmRestore: '请确认是否恢复成默认列配置?',
124
- cstmDragTarget: '移动目标:{0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: '排序',
127
129
  sortHelpTip: '点击并拖动图标可以调整列的排序',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '成功導入 {0} 筆記錄',
63
63
  expLoading: '正在匯出中',
64
64
  expSuccess: '匯出成功',
65
+ expError: '导出失败',
65
66
  expFilename: '導出_{0}',
66
67
  expOriginFilename: '匯出_來源_{0}',
67
68
  customTitle: '列設定',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '關閉',
71
72
  customCancel: '取消',
72
73
  customRestore: '恢復預設',
73
- maxFixedCol: '最大凍結列的數量不能超過 {0} 個'
74
+ maxFixedCol: '最大凍結列的數量不能超過 {0} 個',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '請至少選擇一筆記錄!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: '取消',
122
124
  cstmConfirm: '確定',
123
125
  cstmConfirmRestore: '請確認是否恢復成預設列配置?',
124
- cstmDragTarget: '移動目標:{0}',
126
+ cstmDragTarget: '移動:{0}',
125
127
  setting: {
126
128
  colSort: '排序',
127
129
  sortHelpTip: '點擊並拖曳圖示可以調整列的排序',
@@ -62,6 +62,7 @@ export default {
62
62
  impSuccess: '成功导入 {0} 条记录',
63
63
  expLoading: '正在导出中',
64
64
  expSuccess: '导出成功',
65
+ expError: '导出失败',
65
66
  expFilename: '导出_{0}',
66
67
  expOriginFilename: '导出_源_{0}',
67
68
  customTitle: '列设置',
@@ -70,7 +71,8 @@ export default {
70
71
  customClose: '关闭',
71
72
  customCancel: '取消',
72
73
  customRestore: '恢复默认',
73
- maxFixedCol: '最大冻结列的数量不能超过 {0} 个'
74
+ maxFixedCol: '最大冻结列的数量不能超过 {0} 个',
75
+ dragTip: '移动:{0}'
74
76
  },
75
77
  grid: {
76
78
  selectOneRecord: '请至少选择一条记录!',
@@ -121,7 +123,7 @@ export default {
121
123
  cstmCancel: '取消',
122
124
  cstmConfirm: '确定',
123
125
  cstmConfirmRestore: '请确认是否恢复成默认列配置?',
124
- cstmDragTarget: '移动目标:{0}',
126
+ cstmDragTarget: '移动:{0}',
125
127
  setting: {
126
128
  colSort: '排序',
127
129
  sortHelpTip: '点击并拖动图标可以调整列的排序',
@@ -261,7 +261,7 @@ export default defineComponent({
261
261
  addClass(trEl, 'active--drag-origin')
262
262
  }
263
263
 
264
- const sortMouseupEvent = (evnt: DragEvent) => {
264
+ const sortMouseupEvent = (evnt: MouseEvent) => {
265
265
  const btnEl = evnt.currentTarget as HTMLElement
266
266
  const tdEl = btnEl.parentNode as HTMLElement
267
267
  const trEl = tdEl.parentNode as HTMLElement
@@ -16,7 +16,7 @@ hooks.add('tableEditModule', {
16
16
  setupTable ($xeTable) {
17
17
  const { props, reactData, internalData } = $xeTable
18
18
  const { refElem } = $xeTable.getRefMaps()
19
- const { computeMouseOpts, computeEditOpts, computeCheckboxOpts, computeTreeOpts } = $xeTable.getComputeMaps()
19
+ const { computeMouseOpts, computeEditOpts, computeCheckboxOpts, computeTreeOpts, computeValidOpts } = $xeTable.getComputeMaps()
20
20
 
21
21
  let editMethods = {} as TableEditMethods
22
22
  let editPrivateMethods = {} as TableEditPrivateMethods
@@ -528,6 +528,7 @@ hooks.add('tableEditModule', {
528
528
  const { editStore } = reactData
529
529
  const { actived, focused } = editStore
530
530
  const { row, column } = actived
531
+ const validOpts = computeValidOpts.value
531
532
  if (row || column) {
532
533
  syncActivedCell()
533
534
  actived.args = null
@@ -543,9 +544,11 @@ hooks.add('tableEditModule', {
543
544
  $columnIndex: $xeTable.getVMColumnIndex(column)
544
545
  }, evnt || null)
545
546
  }
546
- if (getConfig().cellVaildMode === 'obsolete') {
547
- if ($xeTable.clearValidate) {
548
- return $xeTable.clearValidate()
547
+ if (validOpts.autoClear) {
548
+ if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
549
+ if ($xeTable.clearValidate) {
550
+ return $xeTable.clearValidate()
551
+ }
549
552
  }
550
553
  }
551
554
  focused.row = null
@@ -1,4 +1,4 @@
1
- import { createCommentVNode, defineComponent, h, ref, Ref, PropType, inject, nextTick, ComputedRef, onBeforeUnmount, onMounted, onUnmounted } from 'vue'
1
+ import { createCommentVNode, defineComponent, TransitionGroup, h, ref, Ref, PropType, inject, nextTick, ComputedRef, onBeforeUnmount, onMounted, onUnmounted } from 'vue'
2
2
  import XEUtils from 'xe-utils'
3
3
  import { VxeUI } from '../../ui'
4
4
  import { mergeBodyMethod, getRowid, XEBodyScrollElement } from './util'
@@ -353,7 +353,7 @@ export default defineComponent({
353
353
  getPropClass(className, params),
354
354
  getPropClass(allCellClassName, params)
355
355
  ],
356
- key: columnKey || columnOpts.useKey ? colid : $columnIndex,
356
+ key: columnKey || columnOpts.useKey || rowOpts.useKey ? colid : $columnIndex,
357
357
  ...attrs,
358
358
  style: Object.assign({
359
359
  height: cellHeight
@@ -379,7 +379,7 @@ export default defineComponent({
379
379
  let rowIndex = $rowIndex
380
380
  // 确保任何情况下 rowIndex 都精准指向真实 data 索引
381
381
  rowIndex = $xeTable.getRowIndex(row)
382
- // 事件绑定
382
+ // 当前行事件
383
383
  if (rowOpts.isHover || highlightHoverRow) {
384
384
  trOn.onMouseenter = (evnt: any) => {
385
385
  if (isVMScrollProcess()) {
@@ -394,6 +394,12 @@ export default defineComponent({
394
394
  $xeTable.clearHoverRow()
395
395
  }
396
396
  }
397
+ // 拖拽行事件
398
+ if (rowOpts.drag) {
399
+ trOn.onDragstart = $xeTable.handleRowDragDragstartEvent
400
+ trOn.onDragend = $xeTable.handleRowDragDragendEvent
401
+ trOn.onDragover = $xeTable.handleRowDragDragoverEvent
402
+ }
397
403
  const rowid = getRowid($xeTable, row)
398
404
  const rest = fullAllDataRowIdData[rowid]
399
405
  let rowLevel = 0
@@ -438,7 +444,7 @@ export default defineComponent({
438
444
  ],
439
445
  rowid: rowid,
440
446
  style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
441
- key: (rowKey || rowOpts.useKey) || treeConfig ? rowid : $rowIndex,
447
+ key: rowKey || rowOpts.useKey || rowOpts.drag || treeConfig ? rowid : $rowIndex,
442
448
  ...trOn
443
449
  }, tableColumn.map((column: any, $columnIndex: any) => {
444
450
  return renderColumn(seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
@@ -700,9 +706,10 @@ export default defineComponent({
700
706
  const renderVN = () => {
701
707
  let { fixedColumn, fixedType, tableColumn } = props
702
708
  const { keyboardConfig, showOverflow: allColumnOverflow, spanMethod, mouseConfig } = tableProps
703
- const { tableData, mergeList, scrollYLoad, isAllOverflow } = tableReactData
709
+ const { tableData, mergeList, scrollYLoad, isAllOverflow, isDragRowMove } = tableReactData
704
710
  const { visibleColumn } = tableInternalData
705
711
  const { slots } = tableContext
712
+ const rowOpts = computeRowOpts.value
706
713
  const sYOpts = computeSYOpts.value
707
714
  const emptyOpts = computeEmptyOpts.value
708
715
  const keyboardOpts = computeKeyboardOpts.value
@@ -782,9 +789,16 @@ export default defineComponent({
782
789
  /**
783
790
  * 内容
784
791
  */
785
- h('tbody', {
786
- ref: refBodyTBody
787
- }, renderRows(fixedType, tableData, tableColumn))
792
+ rowOpts.drag
793
+ ? h(TransitionGroup, {
794
+ name: `vxe-body--row-list${isDragRowMove ? '' : '-disabled'}`,
795
+ tag: 'tbody'
796
+ }, {
797
+ default: () => renderRows(fixedType, tableData, tableColumn)
798
+ })
799
+ : h('tbody', {
800
+ ref: refBodyTBody
801
+ }, renderRows(fixedType, tableData, tableColumn))
788
802
  ]),
789
803
  h('div', {
790
804
  class: 'vxe-table--checkbox-range'
@@ -8,7 +8,7 @@ import { getSlotVNs } from '../../ui/src/vn'
8
8
 
9
9
  import type { VxeTableConstructor, VxeTableDefines, VxeColumnPropTypes, VxeTablePrivateMethods, VxeComponentSlotType } from '../../../types'
10
10
 
11
- const { getI18n, getIcon, renderer, formats } = VxeUI
11
+ const { getI18n, getIcon, renderer, formats, renderEmptyElement } = VxeUI
12
12
 
13
13
  function renderTitlePrefixIcon (params: VxeTableDefines.CellRenderHeaderParams) {
14
14
  const { $table, column } = params
@@ -46,6 +46,46 @@ function renderTitleSuffixIcon (params: VxeTableDefines.CellRenderHeaderParams)
46
46
  : []
47
47
  }
48
48
 
49
+ function renderCellDragIcon (params: VxeTableDefines.CellRenderBodyParams) {
50
+ const { $table } = params
51
+ const { computeDragOpts } = $table.getComputeMaps()
52
+ const dragOpts = computeDragOpts.value
53
+ const { rowDisabledMethod } = dragOpts
54
+ const isDisabled = rowDisabledMethod && rowDisabledMethod(params)
55
+ return h('span', {
56
+ key: 'dg',
57
+ class: ['vxe-cell--drag-handle', {
58
+ 'is--disabled': isDisabled
59
+ }],
60
+ onMousedown (evnt) {
61
+ if (!isDisabled) {
62
+ $table.handleCellDragMousedownEvent(evnt, params)
63
+ }
64
+ },
65
+ onMouseup: $table.handleCellDragMouseupEvent
66
+ }, [
67
+ h('i', {
68
+ class: 'vxe-table-icon-drag-handle'
69
+ })
70
+ ])
71
+ }
72
+
73
+ function renderCellBaseVNs (params: VxeTableDefines.CellRenderBodyParams, content: VxeComponentSlotType | VxeComponentSlotType[]) {
74
+ const { $table, column } = params
75
+ const { dragSort } = column
76
+ const vns: VxeComponentSlotType[] = XEUtils.isArray(content) ? content : [content]
77
+ const { computeRowOpts, computeDragOpts } = $table.getComputeMaps()
78
+ const rowOpts = computeRowOpts.value
79
+ const dragOpts = computeDragOpts.value
80
+ const { showRowIcon, rowVisibleMethod } = dragOpts
81
+ if (dragSort && rowOpts.drag && (showRowIcon && (!rowVisibleMethod || rowVisibleMethod(params)))) {
82
+ vns.unshift(
83
+ renderCellDragIcon(params)
84
+ )
85
+ }
86
+ return vns
87
+ }
88
+
49
89
  function renderTitleContent (params: VxeTableDefines.CellRenderHeaderParams, content: VxeComponentSlotType | VxeComponentSlotType[]) {
50
90
  const { $table, column } = params
51
91
  const { props, reactData } = $table
@@ -250,7 +290,7 @@ export const Cell = {
250
290
  const renderOpts = editRender || cellRender
251
291
  const defaultSlot = slots ? slots.default : null
252
292
  if (defaultSlot) {
253
- return $table.callSlot(defaultSlot, params)
293
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
254
294
  }
255
295
  if (renderOpts) {
256
296
  const compConf = renderer.get(renderOpts.name)
@@ -259,13 +299,13 @@ export const Cell = {
259
299
  const rtDefault = compConf.renderTableDefault || compConf.renderDefault
260
300
  const renderFn = editRender ? rtCell : rtDefault
261
301
  if (renderFn) {
262
- return getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)))
302
+ return renderCellBaseVNs(params, getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))))
263
303
  }
264
304
  }
265
305
  }
266
306
  const cellValue = $table.getCellLabel(row, column)
267
307
  const cellPlaceholder = editRender ? editRender.placeholder : ''
268
- return [
308
+ return renderCellBaseVNs(params, [
269
309
  h('span', {
270
310
  class: 'vxe-cell--label'
271
311
  }, [
@@ -277,7 +317,7 @@ export const Cell = {
277
317
  : h('span', formatText(cellValue, 1))
278
318
  ]
279
319
  )
280
- ]
320
+ ])
281
321
  },
282
322
  renderTreeCell (params: VxeTableDefines.CellRenderBodyParams) {
283
323
  return Cell.renderTreeIcon(params, Cell.renderDefaultCell(params) as VNode[])
@@ -377,11 +417,13 @@ export const Cell = {
377
417
  const { slots } = column
378
418
  const defaultSlot = slots ? slots.default : null
379
419
  if (defaultSlot) {
380
- return $table.callSlot(defaultSlot, params)
420
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
381
421
  }
382
422
  const { seq } = params
383
423
  const seqMethod = seqOpts.seqMethod
384
- return [formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)]
424
+ return renderCellBaseVNs(params, [
425
+ h('span', `${formatText(seqMethod ? seqMethod(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + (seq as number), 1)}`)
426
+ ])
385
427
  },
386
428
  renderTreeIndexCell (params: VxeTableDefines.CellRenderBodyParams) {
387
429
  return Cell.renderTreeIcon(params, Cell.renderSeqCell(params) as VNode[])
@@ -432,7 +474,7 @@ export const Cell = {
432
474
  }
433
475
  const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible }
434
476
  if (radioSlot) {
435
- return $table.callSlot(radioSlot, radioParams)
477
+ return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams))
436
478
  }
437
479
  const radioVNs: VNode[] = []
438
480
  if (isVisible) {
@@ -449,7 +491,7 @@ export const Cell = {
449
491
  }, defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField as string))
450
492
  )
451
493
  }
452
- return [
494
+ return renderCellBaseVNs(params, [
453
495
  h('span', {
454
496
  class: ['vxe-cell--radio', {
455
497
  'is--checked': isChecked,
@@ -457,7 +499,7 @@ export const Cell = {
457
499
  }],
458
500
  ...ons
459
501
  }, radioVNs)
460
- ]
502
+ ])
461
503
  },
462
504
  renderTreeRadioCell (params: VxeTableDefines.CellRenderBodyParams) {
463
505
  return Cell.renderTreeIcon(params, Cell.renderRadioCell(params))
@@ -555,7 +597,7 @@ export const Cell = {
555
597
  }
556
598
  const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
557
599
  if (checkboxSlot) {
558
- return $table.callSlot(checkboxSlot, checkboxParams)
600
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
559
601
  }
560
602
  const checkVNs: VNode[] = []
561
603
  if (isVisible) {
@@ -572,7 +614,7 @@ export const Cell = {
572
614
  }, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField as string))
573
615
  )
574
616
  }
575
- return [
617
+ return renderCellBaseVNs(params, [
576
618
  h('span', {
577
619
  class: ['vxe-cell--checkbox', {
578
620
  'is--checked': isChecked,
@@ -582,7 +624,7 @@ export const Cell = {
582
624
  }],
583
625
  ...ons
584
626
  }, checkVNs)
585
- ]
627
+ ])
586
628
  },
587
629
  renderTreeSelectionCell (params: VxeTableDefines.CellRenderBodyParams) {
588
630
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCell(params))
@@ -623,7 +665,7 @@ export const Cell = {
623
665
  }
624
666
  const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate: isIndeterminate }
625
667
  if (checkboxSlot) {
626
- return $table.callSlot(checkboxSlot, checkboxParams)
668
+ return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams))
627
669
  }
628
670
  const checkVNs: VNode[] = []
629
671
  if (isVisible) {
@@ -640,7 +682,7 @@ export const Cell = {
640
682
  )
641
683
  }
642
684
  }
643
- return [
685
+ return renderCellBaseVNs(params, [
644
686
  h('span', {
645
687
  class: ['vxe-cell--checkbox', {
646
688
  'is--checked': isChecked,
@@ -650,7 +692,7 @@ export const Cell = {
650
692
  }],
651
693
  ...ons
652
694
  }, checkVNs)
653
- ]
695
+ ])
654
696
  },
655
697
  renderTreeSelectionCellByProp (params: VxeTableDefines.CellRenderBodyParams) {
656
698
  return Cell.renderTreeIcon(params, Cell.renderCheckboxCellByProp(params))
@@ -672,7 +714,7 @@ export const Cell = {
672
714
  let isAceived = false
673
715
  let isLazyLoading = false
674
716
  if (iconSlot) {
675
- return $table.callSlot(iconSlot, params)
717
+ return renderCellBaseVNs(params, $table.callSlot(iconSlot, params))
676
718
  }
677
719
  if (!isHidden) {
678
720
  const rowid = getRowid($table, row)
@@ -681,7 +723,7 @@ export const Cell = {
681
723
  isLazyLoading = !!rowExpandLazyLoadedMaps[rowid]
682
724
  }
683
725
  }
684
- return [
726
+ return renderCellBaseVNs(params, [
685
727
  showIcon && (!visibleMethod || visibleMethod(params))
686
728
  ? h('span', {
687
729
  class: ['vxe-table--expanded', {
@@ -695,13 +737,13 @@ export const Cell = {
695
737
  class: ['vxe-table--expand-btn', isLazyLoading ? (iconLoaded || getIcon().TABLE_EXPAND_LOADED) : (isAceived ? (iconOpen || getIcon().TABLE_EXPAND_OPEN) : (iconClose || getIcon().TABLE_EXPAND_CLOSE))]
696
738
  })
697
739
  ])
698
- : null,
740
+ : renderEmptyElement($table),
699
741
  defaultSlot || labelField
700
742
  ? h('span', {
701
743
  class: 'vxe-table--expand-label'
702
744
  }, defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField as string))
703
- : null
704
- ]
745
+ : renderEmptyElement($table)
746
+ ])
705
747
  },
706
748
  renderExpandData (params: VxeTableDefines.CellRenderDataParams) {
707
749
  const { $table, column } = params
@@ -730,14 +772,14 @@ export const Cell = {
730
772
  const { slots } = column
731
773
  const defaultSlot = slots ? slots.default : null
732
774
  if (defaultSlot) {
733
- return $table.callSlot(defaultSlot, params)
775
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params))
734
776
  }
735
- return [
777
+ return renderCellBaseVNs(params, [
736
778
  h('span', {
737
779
  class: 'vxe-cell--html',
738
780
  innerHTML: getDefaultCellLabel(params)
739
781
  })
740
- ]
782
+ ])
741
783
  },
742
784
  renderTreeHTMLCell (params: VxeTableDefines.CellRenderBodyParams) {
743
785
  return Cell.renderTreeIcon(params, Cell.renderHTMLCell(params) as VNode[])
@@ -906,14 +948,14 @@ export const Cell = {
906
948
  return []
907
949
  }
908
950
  if (defaultSlot) {
909
- return $table.callSlot(defaultSlot, cellParams)
951
+ return renderCellBaseVNs(params, $table.callSlot(defaultSlot, cellParams))
910
952
  }
911
953
  if (formatter) {
912
- return [
954
+ return renderCellBaseVNs(params, [
913
955
  h('span', {
914
956
  class: 'vxe-cell--label'
915
957
  }, getDefaultCellLabel(cellParams))
916
- ]
958
+ ])
917
959
  }
918
960
  return Cell.renderDefaultCell(cellParams)
919
961
  }
@@ -81,8 +81,10 @@ export const columnProps = {
81
81
  filterRecoverMethod: Function as PropType<VxeColumnPropTypes.FilterRecoverMethod>,
82
82
  // 筛选模板配置项
83
83
  filterRender: Object as PropType<VxeColumnPropTypes.FilterRender>,
84
- // 指定为树节点
84
+ // 设置为树节点
85
85
  treeNode: Boolean as PropType<VxeColumnPropTypes.TreeNode>,
86
+ // 指定为树节点
87
+ dragSort: Boolean as PropType<VxeColumnPropTypes.DragSort>,
86
88
  // 是否可视
87
89
  visible: {
88
90
  type: Boolean as PropType<VxeColumnPropTypes.Visible>,
@@ -84,6 +84,7 @@ export class ColumnInfo {
84
84
  filterRecoverMethod: _vm.filterRecoverMethod,
85
85
  filterRender: _vm.filterRender,
86
86
  treeNode: _vm.treeNode,
87
+ dragSort: _vm.dragSort,
87
88
  cellType: _vm.cellType,
88
89
  cellRender: _vm.cellRender,
89
90
  editRender: _vm.editRender,
@@ -42,6 +42,10 @@ export default [
42
42
  'menu-click',
43
43
  'edit-closed',
44
44
 
45
+ 'row-dragstart',
46
+ 'row-dragover',
47
+ 'row-dragend',
48
+
45
49
  'edit-actived', // 废弃
46
50
 
47
51
  'edit-activated',
@@ -187,6 +187,8 @@ export default {
187
187
  cellConfig: Object as PropType<VxeTablePropTypes.CellConfig>,
188
188
  // 行配置信息
189
189
  rowConfig: Object as PropType<VxeTablePropTypes.RowConfig>,
190
+ // 可拖拽配置项
191
+ dragConfig: Object as PropType<VxeTablePropTypes.DragConfig>,
190
192
  // 列调整配置项
191
193
  resizableConfig: Object as PropType<VxeTablePropTypes.ResizableConfig>,
192
194
  // 序号配置项