vxe-table 3.11.26 → 3.11.27-beta.0

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 (134) 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 +2 -2
  4. package/es/locale/lang/de-DE.js +2 -2
  5. package/es/locale/lang/en-US.js +2 -2
  6. package/es/locale/lang/es-ES.js +2 -2
  7. package/es/locale/lang/fr-FR.js +2 -2
  8. package/es/locale/lang/hu-HU.js +2 -2
  9. package/es/locale/lang/hy-AM.js +2 -2
  10. package/es/locale/lang/ja-JP.js +2 -2
  11. package/es/locale/lang/ko-KR.js +2 -2
  12. package/es/locale/lang/nb-NO.js +2 -2
  13. package/es/locale/lang/pt-BR.js +2 -2
  14. package/es/locale/lang/ru-RU.js +2 -2
  15. package/es/locale/lang/ug-CN.js +2 -2
  16. package/es/locale/lang/uk-UA.js +2 -2
  17. package/es/locale/lang/vi-VN.js +2 -2
  18. package/es/locale/lang/zh-CHT.js +2 -2
  19. package/es/locale/lang/zh-CN.js +2 -2
  20. package/es/style.css +1 -1
  21. package/es/style.min.css +1 -1
  22. package/es/table/src/body.js +2 -2
  23. package/es/table/src/cell.js +2 -2
  24. package/es/table/src/column.js +10 -8
  25. package/es/table/src/group.js +37 -6
  26. package/es/table/src/methods.js +167 -70
  27. package/es/table/src/util.js +0 -1
  28. package/es/table/style.css +5 -0
  29. package/es/table/style.min.css +1 -1
  30. package/es/ui/index.js +1 -1
  31. package/es/ui/src/log.js +1 -1
  32. package/es/vxe-table/style.css +5 -0
  33. package/es/vxe-table/style.min.css +1 -1
  34. package/lib/index.css +1 -1
  35. package/lib/index.min.css +1 -1
  36. package/lib/index.umd.js +244 -99
  37. package/lib/index.umd.min.js +1 -1
  38. package/lib/locale/lang/ar-EG.js +2 -2
  39. package/lib/locale/lang/ar-EG.min.js +1 -1
  40. package/lib/locale/lang/de-DE.js +2 -2
  41. package/lib/locale/lang/de-DE.min.js +1 -1
  42. package/lib/locale/lang/en-US.js +2 -2
  43. package/lib/locale/lang/en-US.min.js +1 -1
  44. package/lib/locale/lang/en-US.umd.js +2 -2
  45. package/lib/locale/lang/es-ES.js +2 -2
  46. package/lib/locale/lang/es-ES.min.js +1 -1
  47. package/lib/locale/lang/es-ES.umd.js +2 -2
  48. package/lib/locale/lang/fr-FR.js +2 -2
  49. package/lib/locale/lang/fr-FR.min.js +1 -1
  50. package/lib/locale/lang/hu-HU.js +2 -2
  51. package/lib/locale/lang/hu-HU.min.js +1 -1
  52. package/lib/locale/lang/hu-HU.umd.js +2 -2
  53. package/lib/locale/lang/hy-AM.js +2 -2
  54. package/lib/locale/lang/hy-AM.min.js +1 -1
  55. package/lib/locale/lang/ja-JP.js +2 -2
  56. package/lib/locale/lang/ja-JP.min.js +1 -1
  57. package/lib/locale/lang/ja-JP.umd.js +2 -2
  58. package/lib/locale/lang/ko-KR.js +2 -2
  59. package/lib/locale/lang/ko-KR.min.js +1 -1
  60. package/lib/locale/lang/ko-KR.umd.js +2 -2
  61. package/lib/locale/lang/nb-NO.js +2 -2
  62. package/lib/locale/lang/nb-NO.min.js +1 -1
  63. package/lib/locale/lang/pt-BR.js +2 -2
  64. package/lib/locale/lang/pt-BR.min.js +1 -1
  65. package/lib/locale/lang/pt-BR.umd.js +2 -2
  66. package/lib/locale/lang/ru-RU.js +2 -2
  67. package/lib/locale/lang/ru-RU.min.js +1 -1
  68. package/lib/locale/lang/ru-RU.umd.js +2 -2
  69. package/lib/locale/lang/ug-CN.js +2 -2
  70. package/lib/locale/lang/ug-CN.min.js +1 -1
  71. package/lib/locale/lang/uk-UA.js +2 -2
  72. package/lib/locale/lang/uk-UA.min.js +1 -1
  73. package/lib/locale/lang/uk-UA.umd.js +2 -2
  74. package/lib/locale/lang/vi-VN.js +2 -2
  75. package/lib/locale/lang/vi-VN.min.js +1 -1
  76. package/lib/locale/lang/zh-CHT.js +2 -2
  77. package/lib/locale/lang/zh-CHT.min.js +1 -1
  78. package/lib/locale/lang/zh-CHT.umd.js +2 -2
  79. package/lib/locale/lang/zh-CN.js +2 -2
  80. package/lib/locale/lang/zh-CN.min.js +1 -1
  81. package/lib/locale/lang/zh-CN.umd.js +2 -2
  82. package/lib/style.css +1 -1
  83. package/lib/style.min.css +1 -1
  84. package/lib/table/src/body.js +2 -2
  85. package/lib/table/src/body.min.js +1 -1
  86. package/lib/table/src/cell.js +2 -1
  87. package/lib/table/src/cell.min.js +1 -1
  88. package/lib/table/src/column.js +11 -9
  89. package/lib/table/src/column.min.js +1 -1
  90. package/lib/table/src/group.js +39 -6
  91. package/lib/table/src/group.min.js +1 -1
  92. package/lib/table/src/methods.js +182 -72
  93. package/lib/table/src/methods.min.js +1 -1
  94. package/lib/table/src/util.js +0 -1
  95. package/lib/table/src/util.min.js +1 -1
  96. package/lib/table/style/style.css +5 -0
  97. package/lib/table/style/style.min.css +1 -1
  98. package/lib/ui/index.js +1 -1
  99. package/lib/ui/index.min.js +1 -1
  100. package/lib/ui/src/log.js +1 -1
  101. package/lib/ui/src/log.min.js +1 -1
  102. package/lib/vxe-table/style/style.css +5 -0
  103. package/lib/vxe-table/style/style.min.css +1 -1
  104. package/package.json +2 -2
  105. package/packages/locale/lang/ar-EG.ts +2 -2
  106. package/packages/locale/lang/de-DE.ts +2 -2
  107. package/packages/locale/lang/en-US.ts +2 -2
  108. package/packages/locale/lang/es-ES.ts +2 -2
  109. package/packages/locale/lang/fr-FR.ts +2 -2
  110. package/packages/locale/lang/hu-HU.ts +2 -2
  111. package/packages/locale/lang/hy-AM.ts +2 -2
  112. package/packages/locale/lang/ja-JP.ts +2 -2
  113. package/packages/locale/lang/ko-KR.ts +2 -2
  114. package/packages/locale/lang/nb-NO.ts +2 -2
  115. package/packages/locale/lang/pt-BR.ts +2 -2
  116. package/packages/locale/lang/ru-RU.ts +2 -2
  117. package/packages/locale/lang/ug-CN.ts +2 -2
  118. package/packages/locale/lang/uk-UA.ts +2 -2
  119. package/packages/locale/lang/vi-VN.ts +2 -2
  120. package/packages/locale/lang/zh-CHT.ts +2 -2
  121. package/packages/locale/lang/zh-CN.ts +2 -2
  122. package/packages/table/src/body.ts +2 -2
  123. package/packages/table/src/cell.ts +2 -2
  124. package/packages/table/src/column.ts +10 -8
  125. package/packages/table/src/group.ts +40 -6
  126. package/packages/table/src/methods.ts +183 -83
  127. package/packages/table/src/util.ts +0 -1
  128. package/styles/components/table.scss +5 -0
  129. /package/es/{iconfont.1733885890565.ttf → iconfont.1733931178504.ttf} +0 -0
  130. /package/es/{iconfont.1733885890565.woff → iconfont.1733931178504.woff} +0 -0
  131. /package/es/{iconfont.1733885890565.woff2 → iconfont.1733931178504.woff2} +0 -0
  132. /package/lib/{iconfont.1733885890565.ttf → iconfont.1733931178504.ttf} +0 -0
  133. /package/lib/{iconfont.1733885890565.woff → iconfont.1733931178504.woff} +0 -0
  134. /package/lib/{iconfont.1733885890565.woff2 → iconfont.1733931178504.woff2} +0 -0
@@ -10,6 +10,7 @@ const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeU
10
10
  // const isWebkit = browse['-webkit'] && !browse.edge
11
11
  // const debounceScrollYDuration = browse.msie ? 80 : 20
12
12
  const customStorageKey = 'VXE_CUSTOM_STORE';
13
+ const tpImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
13
14
  // 获取所有的列,排除分组
14
15
  const getColumnList = (columns) => {
15
16
  const result = [];
@@ -446,11 +447,19 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
446
447
  if (cdLineEl) {
447
448
  if (showLine) {
448
449
  const thRect = thEl.getBoundingClientRect();
450
+ const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
449
451
  cdLineEl.style.display = 'block';
452
+ cdLineEl.style.top = `${offsetTop}px`;
450
453
  cdLineEl.style.left = `${Math.max(1, thRect.x - wrapperRect.x)}px`;
451
454
  cdLineEl.style.width = `${thRect.width}px`;
452
- cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
455
+ if (prevDragToChild) {
456
+ cdLineEl.style.height = `${thRect.height}px`;
457
+ }
458
+ else {
459
+ cdLineEl.style.height = `${wrapperRect.height - offsetTop - scrollbarHeight}px`;
460
+ }
453
461
  cdLineEl.setAttribute('drag-pos', dragPos);
462
+ cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
454
463
  }
455
464
  else {
456
465
  cdLineEl.style.display = '';
@@ -941,12 +950,12 @@ const Methods = {
941
950
  if (!cacheItem) {
942
951
  cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 };
943
952
  }
953
+ cacheItem.row = row;
954
+ cacheItem.items = items;
955
+ cacheItem.parent = parent;
956
+ cacheItem.level = level;
957
+ cacheItem.index = treeConfig && parent ? -1 : index;
944
958
  if (isSource) {
945
- cacheItem.row = row;
946
- cacheItem.items = items;
947
- cacheItem.parent = parent;
948
- cacheItem.level = level;
949
- cacheItem.index = treeConfig && parent ? -1 : index;
950
959
  fullDataRowIdMaps[rowid] = cacheItem;
951
960
  }
952
961
  fullAllDataRowIdMaps[rowid] = cacheItem;
@@ -1030,11 +1039,20 @@ const Methods = {
1030
1039
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
1031
1040
  */
1032
1041
  cacheColumnMap() {
1033
- const { tableFullColumn, collectColumn, fullColumnMap, showOverflow, columnOpts, rowOpts } = this;
1034
- const fullColumnIdData = this.fullColumnIdData = {};
1035
- const fullColumnFieldData = this.fullColumnFieldData = {};
1042
+ const $xeTable = this;
1043
+ const props = $xeTable;
1044
+ const reactData = $xeTable;
1045
+ const internalData = $xeTable;
1046
+ const { tableFullColumn, collectColumn } = internalData;
1047
+ const fullColumnIdData = internalData.fullColumnIdData = {};
1048
+ const fullColumnFieldData = internalData.fullColumnFieldData = {};
1049
+ const mouseOpts = $xeTable.computeMouseOpts;
1050
+ const columnOpts = $xeTable.computeColumnOpts;
1051
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
1052
+ const { isCrossDrag, isSelfToChildDrag } = columnDragOpts;
1053
+ const rowOpts = $xeTable.computeRowOpts;
1036
1054
  const isGroup = collectColumn.some(hasChildrenList);
1037
- let isAllOverflow = !!showOverflow;
1055
+ let isAllOverflow = !!props.showOverflow;
1038
1056
  let expandColumn;
1039
1057
  let treeNodeColumn;
1040
1058
  let checkboxColumn;
@@ -1043,15 +1061,18 @@ const Methods = {
1043
1061
  let hasFixed;
1044
1062
  const handleFunc = (column, index, items, path, parent) => {
1045
1063
  const { id: colid, field, fixed, type, treeNode } = column;
1046
- const rest = { column, colid, index, items, parent: parent || null, width: 0 };
1064
+ const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parent || null, width: 0 };
1047
1065
  if (field) {
1048
- if (process.env.NODE_ENV === 'development') {
1049
- if (fullColumnFieldData[field]) {
1050
- warnLog('vxe.error.colRepet', ['field', field]);
1051
- }
1066
+ if (fullColumnFieldData[field]) {
1067
+ errLog('vxe.error.colRepet', ['field', field]);
1052
1068
  }
1053
1069
  fullColumnFieldData[field] = rest;
1054
1070
  }
1071
+ else {
1072
+ if (isCrossDrag || isSelfToChildDrag) {
1073
+ errLog('vxe.error.emptyProp', ['column.field']);
1074
+ }
1075
+ }
1055
1076
  if (!hasFixed && fixed) {
1056
1077
  hasFixed = fixed;
1057
1078
  }
@@ -1096,27 +1117,6 @@ const Methods = {
1096
1117
  }
1097
1118
  }
1098
1119
  }
1099
- if (process.env.NODE_ENV === 'development') {
1100
- if (this.showOverflow && column.showOverflow === false) {
1101
- warnLog('vxe.error.errConflicts', [`table.show-overflow=${this.showOverflow}`, `column.show-overflow=${column.showOverflow}`]);
1102
- }
1103
- if (this.showHeaderOverflow && column.showHeaderOverflow === false) {
1104
- warnLog('vxe.error.errConflicts', [`table.show-header-overflow=${this.showHeaderOverflow}`, `column.show-header-overflow=${column.showHeaderOverflow}`]);
1105
- }
1106
- if (this.showFooterOverflow && column.showFooterOverflow === false) {
1107
- warnLog('vxe.error.errConflicts', [`table.show-footer-overflow=${this.showFooterOverflow}`, `column.show-footer-overflow=${column.showFooterOverflow}`]);
1108
- }
1109
- }
1110
- if (process.env.NODE_ENV === 'development') {
1111
- if (htmlColumn) {
1112
- if (!columnOpts.useKey) {
1113
- errLog('vxe.error.reqProp', ['column-config.useKey', 'column.type=html']);
1114
- }
1115
- if (!rowOpts.useKey) {
1116
- errLog('vxe.error.reqProp', ['row-config.useKey', 'column.type=html']);
1117
- }
1118
- }
1119
- }
1120
1120
  if (isAllOverflow && column.showOverflow === false) {
1121
1121
  isAllOverflow = false;
1122
1122
  }
@@ -1124,9 +1124,7 @@ const Methods = {
1124
1124
  errLog('vxe.error.colRepet', ['colId', colid]);
1125
1125
  }
1126
1126
  fullColumnIdData[colid] = rest;
1127
- fullColumnMap.set(column, rest);
1128
1127
  };
1129
- fullColumnMap.clear();
1130
1128
  if (isGroup) {
1131
1129
  XEUtils.eachTree(collectColumn, (column, index, items, path, parent, nodes) => {
1132
1130
  column.level = nodes.length;
@@ -1137,14 +1135,24 @@ const Methods = {
1137
1135
  tableFullColumn.forEach(handleFunc);
1138
1136
  }
1139
1137
  if (process.env.NODE_ENV === 'development') {
1140
- if (expandColumn && this.mouseOpts.area) {
1138
+ if (expandColumn && mouseOpts.area) {
1141
1139
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
1142
1140
  }
1143
1141
  }
1144
- this.isGroup = isGroup;
1145
- this.treeNodeColumn = treeNodeColumn;
1146
- this.expandColumn = expandColumn;
1147
- this.isAllOverflow = isAllOverflow;
1142
+ if (process.env.NODE_ENV === 'development') {
1143
+ if (htmlColumn) {
1144
+ if (!columnOpts.useKey) {
1145
+ errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
1146
+ }
1147
+ if (!rowOpts.useKey) {
1148
+ errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
1149
+ }
1150
+ }
1151
+ }
1152
+ reactData.isGroup = isGroup;
1153
+ reactData.treeNodeColumn = treeNodeColumn;
1154
+ reactData.expandColumn = expandColumn;
1155
+ reactData.isAllOverflow = isAllOverflow;
1148
1156
  },
1149
1157
  /**
1150
1158
  * 根据 tr 元素获取对应的 row 信息
@@ -2668,6 +2676,10 @@ const Methods = {
2668
2676
  const $xeTable = this;
2669
2677
  const internalData = $xeTable;
2670
2678
  const { rceTimeout } = internalData;
2679
+ const el = $xeTable.$refs.refElem;
2680
+ if (!el || !el.clientWidth) {
2681
+ $xeTable.autoCellWidth();
2682
+ }
2671
2683
  if (rceTimeout) {
2672
2684
  clearTimeout(rceTimeout);
2673
2685
  $xeTable.$nextTick(() => {
@@ -5078,8 +5090,9 @@ const Methods = {
5078
5090
  * 行拖拽
5079
5091
  */
5080
5092
  handleRowDragDragstartEvent(evnt) {
5081
- const img = new Image();
5082
5093
  if (evnt.dataTransfer) {
5094
+ const img = new Image();
5095
+ img.src = tpImg;
5083
5096
  evnt.dataTransfer.setDragImage(img, 0, 0);
5084
5097
  }
5085
5098
  },
@@ -5137,8 +5150,8 @@ const Methods = {
5137
5150
  return;
5138
5151
  }
5139
5152
  if (oldAllMaps[newRowid]) {
5153
+ isSelfToChildStatus = true;
5140
5154
  if (!isSelfToChildDrag) {
5141
- isSelfToChildStatus = true;
5142
5155
  if (VxeUI.modal) {
5143
5156
  VxeUI.modal.message({
5144
5157
  status: 'error',
@@ -5216,7 +5229,7 @@ const Methods = {
5216
5229
  }
5217
5230
  reactData.isDragRowMove = true;
5218
5231
  $xeTable.handleTableData(treeConfig && transform);
5219
- $xeTable.cacheRowMap(true);
5232
+ $xeTable.cacheRowMap();
5220
5233
  $xeTable.updateScrollYStatus();
5221
5234
  if (!(treeConfig && transform)) {
5222
5235
  $xeTable.updateAfterDataIndex();
@@ -5245,6 +5258,7 @@ const Methods = {
5245
5258
  }
5246
5259
  hideDropTip($xeTable);
5247
5260
  clearRowDropOrigin($xeTable);
5261
+ internalData.prevDragToChild = false;
5248
5262
  reactData.dragRow = null;
5249
5263
  reactData.dragCol = null;
5250
5264
  setTimeout(() => {
@@ -5335,8 +5349,9 @@ const Methods = {
5335
5349
  * 列拖拽
5336
5350
  */
5337
5351
  handleHeaderCellDragDragstartEvent(evnt) {
5338
- const img = new Image();
5339
5352
  if (evnt.dataTransfer) {
5353
+ const img = new Image();
5354
+ img.src = tpImg;
5340
5355
  evnt.dataTransfer.setDragImage(img, 0, 0);
5341
5356
  }
5342
5357
  },
@@ -5347,17 +5362,19 @@ const Methods = {
5347
5362
  const internalData = $xeTable;
5348
5363
  const { mouseConfig } = props;
5349
5364
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5350
- const { dragEndMethod } = columnDragOpts;
5365
+ const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
5351
5366
  const { dragCol } = reactData;
5352
- const { collectColumn, prevDragCol, prevDragPos } = internalData;
5367
+ const { collectColumn, prevDragCol, prevDragPos, prevDragToChild } = internalData;
5353
5368
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
5354
5369
  if (prevDragCol && dragCol) {
5355
5370
  // 判断是否有拖动
5356
5371
  if (prevDragCol !== dragCol) {
5372
+ const oldColumn = dragCol;
5373
+ const newColumn = prevDragCol;
5357
5374
  Promise.resolve(dragEndMethod
5358
5375
  ? dragEndMethod({
5359
- oldColumn: dragCol,
5360
- newColumn: prevDragCol,
5376
+ oldColumn,
5377
+ newColumn,
5361
5378
  dragPos: prevDragPos,
5362
5379
  offsetIndex: dragOffsetIndex
5363
5380
  })
@@ -5365,24 +5382,102 @@ const Methods = {
5365
5382
  if (!status) {
5366
5383
  return;
5367
5384
  }
5385
+ let oafIndex = -1;
5386
+ let nafIndex = -1;
5387
+ const oldAllMaps = {};
5388
+ XEUtils.eachTree([oldColumn], column => {
5389
+ oldAllMaps[column.id] = column;
5390
+ });
5391
+ let isSelfToChildStatus = false;
5392
+ if (oldColumn.parentId && newColumn.parentId) {
5393
+ // 子到子
5394
+ if (!isCrossDrag) {
5395
+ return;
5396
+ }
5397
+ if (oldAllMaps[newColumn.id]) {
5398
+ isSelfToChildStatus = true;
5399
+ if (!isSelfToChildDrag) {
5400
+ if (VxeUI.modal) {
5401
+ VxeUI.modal.message({
5402
+ status: 'error',
5403
+ content: getI18n('vxe.error.treeDragChild')
5404
+ });
5405
+ }
5406
+ return;
5407
+ }
5408
+ }
5409
+ }
5410
+ else if (oldColumn.parentId) {
5411
+ // 子到根
5412
+ if (!isCrossDrag) {
5413
+ return;
5414
+ }
5415
+ }
5416
+ else if (newColumn.parentId) {
5417
+ // 根到子
5418
+ if (!isCrossDrag) {
5419
+ return;
5420
+ }
5421
+ if (oldAllMaps[newColumn.id]) {
5422
+ isSelfToChildStatus = true;
5423
+ if (!isSelfToChildDrag) {
5424
+ if (VxeUI.modal) {
5425
+ VxeUI.modal.message({
5426
+ status: 'error',
5427
+ content: getI18n('vxe.error.treeDragChild')
5428
+ });
5429
+ }
5430
+ return;
5431
+ }
5432
+ }
5433
+ }
5434
+ else {
5435
+ // 根到根
5436
+ }
5437
+ const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === oldColumn.id);
5438
+ // 改变层级
5439
+ if (isSelfToChildStatus && isSelfToChildDrag) {
5440
+ if (oldewMatchRest) {
5441
+ const { items: oCols, index: oIndex } = oldewMatchRest;
5442
+ const childList = oldColumn.children || [];
5443
+ childList.forEach(column => {
5444
+ column.parentId = oldColumn.parentId;
5445
+ });
5446
+ oCols.splice(oIndex, 1, ...childList);
5447
+ oldColumn.children = [];
5448
+ }
5449
+ }
5450
+ else {
5451
+ if (oldewMatchRest) {
5452
+ const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
5453
+ oCols.splice(oIndex, 1);
5454
+ if (!oParent) {
5455
+ oafIndex = oIndex;
5456
+ }
5457
+ }
5458
+ }
5459
+ const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
5460
+ if (newMatchRest) {
5461
+ const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
5462
+ // 转子级
5463
+ if (isToChildDrag && prevDragToChild) {
5464
+ oldColumn.parentId = newColumn.id;
5465
+ newColumn.children = (newColumn.children || []).concat([oldColumn]);
5466
+ }
5467
+ else {
5468
+ oldColumn.parentId = newColumn.parentId;
5469
+ nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn);
5470
+ }
5471
+ if (!nParent) {
5472
+ nafIndex = nIndex;
5473
+ }
5474
+ }
5368
5475
  XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
5369
5476
  if (!parent) {
5370
5477
  const sortIndex = index + 1;
5371
5478
  column.renderSortNumber = sortIndex;
5372
5479
  }
5373
5480
  });
5374
- const oafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === dragCol.id);
5375
- const nafIndex = XEUtils.findIndexOf(collectColumn, item => item.id === prevDragCol.id) + dragOffsetIndex;
5376
- const newTargetCol = collectColumn[nafIndex];
5377
- if (newTargetCol) {
5378
- // 插入最后位置
5379
- dragCol.renderSortNumber = newTargetCol.renderSortNumber;
5380
- newTargetCol.renderSortNumber = dragCol.renderSortNumber + 0.5;
5381
- }
5382
- else {
5383
- // 插入新位置
5384
- dragCol.renderSortNumber = collectColumn.length + 1.5;
5385
- }
5386
5481
  reactData.isDragColMove = true;
5387
5482
  if (mouseConfig) {
5388
5483
  if ($xeTable.clearSelected) {
@@ -5393,14 +5488,12 @@ const Methods = {
5393
5488
  $xeTable.clearCopyCellArea();
5394
5489
  }
5395
5490
  }
5396
- $xeTable.analyColumnWidth();
5397
- $xeTable.$nextTick().then(() => {
5491
+ $xeTable.refreshColumn(true).then(() => {
5398
5492
  $xeTable.updateCellAreas();
5399
- $xeTable.refreshColumn(true);
5400
5493
  });
5401
5494
  $xeTable.dispatchEvent('column-dragend', {
5402
- oldColumn: dragCol,
5403
- newColumn: prevDragCol,
5495
+ oldColumn,
5496
+ newColumn,
5404
5497
  dragPos: prevDragPos,
5405
5498
  offsetIndex: dragOffsetIndex,
5406
5499
  _index: {
@@ -5415,6 +5508,7 @@ const Methods = {
5415
5508
  }
5416
5509
  hideDropTip($xeTable);
5417
5510
  clearColDropOrigin($xeTable);
5511
+ internalData.prevDragToChild = false;
5418
5512
  reactData.dragRow = null;
5419
5513
  reactData.dragCol = null;
5420
5514
  setTimeout(() => {
@@ -5426,10 +5520,13 @@ const Methods = {
5426
5520
  const reactData = $xeTable;
5427
5521
  const internalData = $xeTable;
5428
5522
  const { dragCol } = reactData;
5523
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
5524
+ const { isToChildDrag, isCrossDrag } = columnDragOpts;
5429
5525
  if (!dragCol) {
5430
5526
  evnt.preventDefault();
5431
5527
  return;
5432
5528
  }
5529
+ const hasCtrlKey = evnt.ctrlKey;
5433
5530
  const thEl = evnt.currentTarget;
5434
5531
  const colid = thEl.getAttribute('colid');
5435
5532
  const column = $xeTable.getColumnById(colid);
@@ -5438,11 +5535,11 @@ const Methods = {
5438
5535
  const { dragCol } = reactData;
5439
5536
  const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
5440
5537
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
5441
- if (dragCol.id === column.id || column.parentId) {
5538
+ if ((dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
5442
5539
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
5443
5540
  return;
5444
5541
  }
5445
- internalData.prevDragToChild = false;
5542
+ internalData.prevDragToChild = !!(isToChildDrag && hasCtrlKey);
5446
5543
  internalData.prevDragCol = column;
5447
5544
  internalData.prevDragPos = dragPos;
5448
5545
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
@@ -123,7 +123,6 @@ export function handleFieldOrColumn(_vm, fieldOrColumn) {
123
123
  export function assembleColumn(_vm) {
124
124
  const { $el, $xetable, $xecolumn, columnConfig } = _vm;
125
125
  const groupConfig = $xecolumn ? $xecolumn.columnConfig : null;
126
- columnConfig.slots = _vm.$scopedSlots;
127
126
  if (groupConfig) {
128
127
  if (process.env.NODE_ENV === 'development') {
129
128
  if ($xecolumn.$options._componentTag === 'vxe-table-column') {
@@ -2675,6 +2675,11 @@
2675
2675
  .vxe-table--render-default .vxe-table--drag-col-line[drag-pos=right] {
2676
2676
  border-right-color: var(--vxe-ui-font-primary-color);
2677
2677
  }
2678
+ .vxe-table--render-default .vxe-table--drag-col-line[drag-to-child=y] {
2679
+ border-left-color: transparent;
2680
+ border-right-color: transparent;
2681
+ border-bottom-color: var(--vxe-ui-status-success-color);
2682
+ }
2678
2683
  .vxe-table--render-default .vxe-table--drag-col-line.is--guides {
2679
2684
  background-color: var(--vxe-ui-table-drag-over-background-color);
2680
2685
  }