vxe-table 3.11.26 → 3.11.27-beta.1

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 (151) 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 +3 -3
  4. package/es/locale/lang/de-DE.js +3 -3
  5. package/es/locale/lang/en-US.js +3 -3
  6. package/es/locale/lang/es-ES.js +3 -3
  7. package/es/locale/lang/fr-FR.js +3 -3
  8. package/es/locale/lang/hu-HU.js +3 -3
  9. package/es/locale/lang/hy-AM.js +3 -3
  10. package/es/locale/lang/ja-JP.js +3 -3
  11. package/es/locale/lang/ko-KR.js +3 -3
  12. package/es/locale/lang/nb-NO.js +3 -3
  13. package/es/locale/lang/pt-BR.js +3 -3
  14. package/es/locale/lang/ru-RU.js +3 -3
  15. package/es/locale/lang/ug-CN.js +3 -3
  16. package/es/locale/lang/uk-UA.js +3 -3
  17. package/es/locale/lang/vi-VN.js +3 -3
  18. package/es/locale/lang/zh-CHT.js +3 -3
  19. package/es/locale/lang/zh-CN.js +3 -3
  20. package/es/style.css +1 -1
  21. package/es/style.min.css +1 -1
  22. package/es/table/module/custom/mixin.js +2 -0
  23. package/es/table/module/custom/panel.js +433 -231
  24. package/es/table/src/body.js +2 -2
  25. package/es/table/src/cell.js +2 -2
  26. package/es/table/src/column.js +10 -8
  27. package/es/table/src/group.js +37 -6
  28. package/es/table/src/methods.js +167 -73
  29. package/es/table/src/table.js +1 -1
  30. package/es/table/src/util.js +0 -1
  31. package/es/table/style.css +106 -37
  32. package/es/table/style.min.css +1 -1
  33. package/es/ui/index.js +1 -1
  34. package/es/ui/src/dom.js +1 -0
  35. package/es/ui/src/log.js +1 -1
  36. package/es/vxe-table/style.css +106 -37
  37. package/es/vxe-table/style.min.css +1 -1
  38. package/lib/index.css +1 -1
  39. package/lib/index.min.css +1 -1
  40. package/lib/index.umd.js +618 -260
  41. package/lib/index.umd.min.js +1 -1
  42. package/lib/locale/lang/ar-EG.js +3 -3
  43. package/lib/locale/lang/ar-EG.min.js +1 -1
  44. package/lib/locale/lang/de-DE.js +3 -3
  45. package/lib/locale/lang/de-DE.min.js +1 -1
  46. package/lib/locale/lang/en-US.js +3 -3
  47. package/lib/locale/lang/en-US.min.js +1 -1
  48. package/lib/locale/lang/en-US.umd.js +3 -3
  49. package/lib/locale/lang/es-ES.js +3 -3
  50. package/lib/locale/lang/es-ES.min.js +1 -1
  51. package/lib/locale/lang/es-ES.umd.js +3 -3
  52. package/lib/locale/lang/fr-FR.js +3 -3
  53. package/lib/locale/lang/fr-FR.min.js +1 -1
  54. package/lib/locale/lang/hu-HU.js +3 -3
  55. package/lib/locale/lang/hu-HU.min.js +1 -1
  56. package/lib/locale/lang/hu-HU.umd.js +3 -3
  57. package/lib/locale/lang/hy-AM.js +3 -3
  58. package/lib/locale/lang/hy-AM.min.js +1 -1
  59. package/lib/locale/lang/ja-JP.js +3 -3
  60. package/lib/locale/lang/ja-JP.min.js +1 -1
  61. package/lib/locale/lang/ja-JP.umd.js +3 -3
  62. package/lib/locale/lang/ko-KR.js +3 -3
  63. package/lib/locale/lang/ko-KR.min.js +1 -1
  64. package/lib/locale/lang/ko-KR.umd.js +3 -3
  65. package/lib/locale/lang/nb-NO.js +3 -3
  66. package/lib/locale/lang/nb-NO.min.js +1 -1
  67. package/lib/locale/lang/pt-BR.js +3 -3
  68. package/lib/locale/lang/pt-BR.min.js +1 -1
  69. package/lib/locale/lang/pt-BR.umd.js +3 -3
  70. package/lib/locale/lang/ru-RU.js +3 -3
  71. package/lib/locale/lang/ru-RU.min.js +1 -1
  72. package/lib/locale/lang/ru-RU.umd.js +3 -3
  73. package/lib/locale/lang/ug-CN.js +3 -3
  74. package/lib/locale/lang/ug-CN.min.js +1 -1
  75. package/lib/locale/lang/uk-UA.js +3 -3
  76. package/lib/locale/lang/uk-UA.min.js +1 -1
  77. package/lib/locale/lang/uk-UA.umd.js +3 -3
  78. package/lib/locale/lang/vi-VN.js +3 -3
  79. package/lib/locale/lang/vi-VN.min.js +1 -1
  80. package/lib/locale/lang/zh-CHT.js +3 -3
  81. package/lib/locale/lang/zh-CHT.min.js +1 -1
  82. package/lib/locale/lang/zh-CHT.umd.js +3 -3
  83. package/lib/locale/lang/zh-CN.js +3 -3
  84. package/lib/locale/lang/zh-CN.min.js +1 -1
  85. package/lib/locale/lang/zh-CN.umd.js +3 -3
  86. package/lib/style.css +1 -1
  87. package/lib/style.min.css +1 -1
  88. package/lib/table/module/custom/mixin.js +2 -0
  89. package/lib/table/module/custom/mixin.min.js +1 -1
  90. package/lib/table/module/custom/panel.js +369 -156
  91. package/lib/table/module/custom/panel.min.js +1 -1
  92. package/lib/table/src/body.js +2 -2
  93. package/lib/table/src/body.min.js +1 -1
  94. package/lib/table/src/cell.js +2 -1
  95. package/lib/table/src/cell.min.js +1 -1
  96. package/lib/table/src/column.js +11 -9
  97. package/lib/table/src/column.min.js +1 -1
  98. package/lib/table/src/group.js +39 -6
  99. package/lib/table/src/group.min.js +1 -1
  100. package/lib/table/src/methods.js +181 -74
  101. package/lib/table/src/methods.min.js +1 -1
  102. package/lib/table/src/table.js +1 -1
  103. package/lib/table/src/table.min.js +1 -1
  104. package/lib/table/src/util.js +0 -1
  105. package/lib/table/src/util.min.js +1 -1
  106. package/lib/table/style/style.css +106 -37
  107. package/lib/table/style/style.min.css +1 -1
  108. package/lib/ui/index.js +1 -1
  109. package/lib/ui/index.min.js +1 -1
  110. package/lib/ui/src/dom.js +2 -0
  111. package/lib/ui/src/dom.min.js +1 -1
  112. package/lib/ui/src/log.js +1 -1
  113. package/lib/ui/src/log.min.js +1 -1
  114. package/lib/vxe-table/style/style.css +106 -37
  115. package/lib/vxe-table/style/style.min.css +1 -1
  116. package/package.json +2 -2
  117. package/packages/locale/lang/ar-EG.ts +3 -3
  118. package/packages/locale/lang/de-DE.ts +3 -3
  119. package/packages/locale/lang/en-US.ts +3 -3
  120. package/packages/locale/lang/es-ES.ts +3 -3
  121. package/packages/locale/lang/fr-FR.ts +3 -3
  122. package/packages/locale/lang/hu-HU.ts +3 -3
  123. package/packages/locale/lang/hy-AM.ts +3 -3
  124. package/packages/locale/lang/ja-JP.ts +3 -3
  125. package/packages/locale/lang/ko-KR.ts +3 -3
  126. package/packages/locale/lang/nb-NO.ts +3 -3
  127. package/packages/locale/lang/pt-BR.ts +3 -3
  128. package/packages/locale/lang/ru-RU.ts +3 -3
  129. package/packages/locale/lang/ug-CN.ts +3 -3
  130. package/packages/locale/lang/uk-UA.ts +3 -3
  131. package/packages/locale/lang/vi-VN.ts +3 -3
  132. package/packages/locale/lang/zh-CHT.ts +3 -3
  133. package/packages/locale/lang/zh-CN.ts +3 -3
  134. package/packages/table/module/custom/mixin.ts +2 -0
  135. package/packages/table/module/custom/panel.ts +458 -234
  136. package/packages/table/src/body.ts +2 -2
  137. package/packages/table/src/cell.ts +2 -2
  138. package/packages/table/src/column.ts +10 -8
  139. package/packages/table/src/group.ts +40 -6
  140. package/packages/table/src/methods.ts +182 -86
  141. package/packages/table/src/table.ts +1 -1
  142. package/packages/table/src/util.ts +0 -1
  143. package/packages/ui/src/dom.ts +2 -0
  144. package/styles/components/table-module/custom.scss +92 -12
  145. package/styles/components/table.scss +5 -0
  146. /package/es/{iconfont.1733885890565.ttf → iconfont.1734000397391.ttf} +0 -0
  147. /package/es/{iconfont.1733885890565.woff → iconfont.1734000397391.woff} +0 -0
  148. /package/es/{iconfont.1733885890565.woff2 → iconfont.1734000397391.woff2} +0 -0
  149. /package/lib/{iconfont.1733885890565.ttf → iconfont.1734000397391.ttf} +0 -0
  150. /package/lib/{iconfont.1733885890565.woff → iconfont.1734000397391.woff} +0 -0
  151. /package/lib/{iconfont.1733885890565.woff2 → iconfont.1734000397391.woff2} +0 -0
@@ -271,7 +271,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
271
271
  getClass(className, params),
272
272
  getClass(allCellClassName, params)
273
273
  ],
274
- key: columnKey || columnOpts.useKey || rowOpts.useKey ? column.id : $columnIndex,
274
+ key: columnKey || columnOpts.useKey || rowOpts.useKey || columnOpts.drag ? column.id : $columnIndex,
275
275
  attrs,
276
276
  style: Object.assign({
277
277
  height: cellHeight
@@ -375,7 +375,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
375
375
  rowid
376
376
  },
377
377
  style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
378
- key: rowKey || rowOpts.useKey || rowOpts.drag || treeConfig ? rowid : $rowIndex,
378
+ key: rowKey || rowOpts.useKey || rowOpts.drag || columnOpts.drag || treeConfig ? rowid : $rowIndex,
379
379
  nativeOn: trOn
380
380
  }, tdVNs)
381
381
  : h('tr', {
@@ -94,10 +94,10 @@ function renderHeaderCellDragIcon(h, params) {
94
94
  const { $table, column } = params;
95
95
  const columnOpts = $table.computeColumnOpts;
96
96
  const columnDragOpts = $table.computeColumnDragOpts;
97
- const { showIcon, icon, visibleMethod, disabledMethod } = columnDragOpts;
97
+ const { showIcon, icon, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts;
98
98
  const isDisabled = disabledMethod && disabledMethod(params);
99
99
  if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
100
- if (!(column.fixed || column.parentId)) {
100
+ if (!column.fixed && (isCrossDrag || !column.parentId)) {
101
101
  return h('span', {
102
102
  key: 'dg',
103
103
  class: ['vxe-cell--drag-handle', {
@@ -1,6 +1,7 @@
1
1
  import Cell from './cell';
2
+ import { defineVxeComponent } from '../../ui/src/comp';
2
3
  import { assembleColumn, destroyColumn } from './util';
3
- const props = {
4
+ export const columnProps = {
4
5
  // 列唯一主键
5
6
  colId: [String, Number],
6
7
  // 渲染类型 seq,radio,checkbox,expand,html
@@ -92,9 +93,9 @@ const props = {
92
93
  // 额外的参数
93
94
  params: Object
94
95
  };
95
- const watch = {};
96
- Object.keys(props).forEach(name => {
97
- watch[name] = function (value) {
96
+ export const columnWatch = {};
97
+ Object.keys(columnProps).forEach(name => {
98
+ columnWatch[name] = function (value) {
98
99
  this.columnConfig.update(name, value);
99
100
  if (this.$xetable) {
100
101
  if (name === 'filters') {
@@ -107,9 +108,9 @@ Object.keys(props).forEach(name => {
107
108
  }
108
109
  };
109
110
  });
110
- export default {
111
+ export default defineVxeComponent({
111
112
  name: 'VxeColumn',
112
- props,
113
+ props: columnProps,
113
114
  provide() {
114
115
  return {
115
116
  $xecolumn: this,
@@ -124,11 +125,12 @@ export default {
124
125
  default: null
125
126
  }
126
127
  },
127
- watch,
128
+ watch: columnWatch,
128
129
  created() {
129
130
  this.columnConfig = this.createColumn(this.$xetable, this);
130
131
  },
131
132
  mounted() {
133
+ this.columnConfig.slots = this.$scopedSlots;
132
134
  assembleColumn(this);
133
135
  },
134
136
  destroyed() {
@@ -138,4 +140,4 @@ export default {
138
140
  return h('div', this.$slots.default);
139
141
  },
140
142
  methods: Cell
141
- };
143
+ });
@@ -1,11 +1,42 @@
1
- import VxeTableColumn from './column';
2
- export default {
1
+ import Cell from './cell';
2
+ import { defineVxeComponent } from '../../ui/src/comp';
3
+ import { assembleColumn, destroyColumn } from './util';
4
+ import { columnProps, columnWatch } from './column';
5
+ export default defineVxeComponent({
3
6
  name: 'VxeColgroup',
4
- extends: VxeTableColumn,
7
+ props: columnProps,
5
8
  provide() {
6
9
  return {
7
- xecolgroup: this,
10
+ $xecolumn: this,
8
11
  $xegrid: null
9
12
  };
10
- }
11
- };
13
+ },
14
+ inject: {
15
+ $xetable: {
16
+ default: null
17
+ },
18
+ $xecolumn: {
19
+ default: null
20
+ }
21
+ },
22
+ watch: columnWatch,
23
+ created() {
24
+ this.columnConfig = this.createColumn(this.$xetable, this);
25
+ },
26
+ mounted() {
27
+ const { $scopedSlots } = this;
28
+ const columnSlots = {};
29
+ if ($scopedSlots.header) {
30
+ columnSlots.header = $scopedSlots.header;
31
+ }
32
+ this.columnConfig.slots = columnSlots;
33
+ assembleColumn(this);
34
+ },
35
+ destroyed() {
36
+ destroyColumn(this);
37
+ },
38
+ render(h) {
39
+ return h('div', this.$slots.default);
40
+ },
41
+ methods: Cell
42
+ });
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils';
2
- import { browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../ui/src/dom';
2
+ import { tpImg, browse, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, isNodeElement } from '../../ui/src/dom';
3
3
  import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
4
4
  import { VxeUI } from '../../ui';
5
5
  import Cell from './cell';
@@ -446,11 +446,19 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
446
446
  if (cdLineEl) {
447
447
  if (showLine) {
448
448
  const thRect = thEl.getBoundingClientRect();
449
+ const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
449
450
  cdLineEl.style.display = 'block';
451
+ cdLineEl.style.top = `${offsetTop}px`;
450
452
  cdLineEl.style.left = `${Math.max(1, thRect.x - wrapperRect.x)}px`;
451
453
  cdLineEl.style.width = `${thRect.width}px`;
452
- cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
454
+ if (prevDragToChild) {
455
+ cdLineEl.style.height = `${thRect.height}px`;
456
+ }
457
+ else {
458
+ cdLineEl.style.height = `${wrapperRect.height - offsetTop - scrollbarHeight}px`;
459
+ }
453
460
  cdLineEl.setAttribute('drag-pos', dragPos);
461
+ cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
454
462
  }
455
463
  else {
456
464
  cdLineEl.style.display = '';
@@ -941,12 +949,12 @@ const Methods = {
941
949
  if (!cacheItem) {
942
950
  cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 };
943
951
  }
952
+ cacheItem.row = row;
953
+ cacheItem.items = items;
954
+ cacheItem.parent = parent;
955
+ cacheItem.level = level;
956
+ cacheItem.index = treeConfig && parent ? -1 : index;
944
957
  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
958
  fullDataRowIdMaps[rowid] = cacheItem;
951
959
  }
952
960
  fullAllDataRowIdMaps[rowid] = cacheItem;
@@ -1030,11 +1038,20 @@ const Methods = {
1030
1038
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
1031
1039
  */
1032
1040
  cacheColumnMap() {
1033
- const { tableFullColumn, collectColumn, fullColumnMap, showOverflow, columnOpts, rowOpts } = this;
1034
- const fullColumnIdData = this.fullColumnIdData = {};
1035
- const fullColumnFieldData = this.fullColumnFieldData = {};
1041
+ const $xeTable = this;
1042
+ const props = $xeTable;
1043
+ const reactData = $xeTable;
1044
+ const internalData = $xeTable;
1045
+ const { tableFullColumn, collectColumn } = internalData;
1046
+ const fullColumnIdData = internalData.fullColumnIdData = {};
1047
+ const fullColumnFieldData = internalData.fullColumnFieldData = {};
1048
+ const mouseOpts = $xeTable.computeMouseOpts;
1049
+ const columnOpts = $xeTable.computeColumnOpts;
1050
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
1051
+ const { isCrossDrag, isSelfToChildDrag } = columnDragOpts;
1052
+ const rowOpts = $xeTable.computeRowOpts;
1036
1053
  const isGroup = collectColumn.some(hasChildrenList);
1037
- let isAllOverflow = !!showOverflow;
1054
+ let isAllOverflow = !!props.showOverflow;
1038
1055
  let expandColumn;
1039
1056
  let treeNodeColumn;
1040
1057
  let checkboxColumn;
@@ -1043,15 +1060,18 @@ const Methods = {
1043
1060
  let hasFixed;
1044
1061
  const handleFunc = (column, index, items, path, parent) => {
1045
1062
  const { id: colid, field, fixed, type, treeNode } = column;
1046
- const rest = { column, colid, index, items, parent: parent || null, width: 0 };
1063
+ const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parent || null, width: 0 };
1047
1064
  if (field) {
1048
- if (process.env.NODE_ENV === 'development') {
1049
- if (fullColumnFieldData[field]) {
1050
- warnLog('vxe.error.colRepet', ['field', field]);
1051
- }
1065
+ if (fullColumnFieldData[field]) {
1066
+ errLog('vxe.error.colRepet', ['field', field]);
1052
1067
  }
1053
1068
  fullColumnFieldData[field] = rest;
1054
1069
  }
1070
+ else {
1071
+ if (isCrossDrag || isSelfToChildDrag) {
1072
+ errLog('vxe.error.emptyProp', ['column.field']);
1073
+ }
1074
+ }
1055
1075
  if (!hasFixed && fixed) {
1056
1076
  hasFixed = fixed;
1057
1077
  }
@@ -1096,27 +1116,6 @@ const Methods = {
1096
1116
  }
1097
1117
  }
1098
1118
  }
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
1119
  if (isAllOverflow && column.showOverflow === false) {
1121
1120
  isAllOverflow = false;
1122
1121
  }
@@ -1124,9 +1123,7 @@ const Methods = {
1124
1123
  errLog('vxe.error.colRepet', ['colId', colid]);
1125
1124
  }
1126
1125
  fullColumnIdData[colid] = rest;
1127
- fullColumnMap.set(column, rest);
1128
1126
  };
1129
- fullColumnMap.clear();
1130
1127
  if (isGroup) {
1131
1128
  XEUtils.eachTree(collectColumn, (column, index, items, path, parent, nodes) => {
1132
1129
  column.level = nodes.length;
@@ -1137,14 +1134,24 @@ const Methods = {
1137
1134
  tableFullColumn.forEach(handleFunc);
1138
1135
  }
1139
1136
  if (process.env.NODE_ENV === 'development') {
1140
- if (expandColumn && this.mouseOpts.area) {
1137
+ if (expandColumn && mouseOpts.area) {
1141
1138
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
1142
1139
  }
1143
1140
  }
1144
- this.isGroup = isGroup;
1145
- this.treeNodeColumn = treeNodeColumn;
1146
- this.expandColumn = expandColumn;
1147
- this.isAllOverflow = isAllOverflow;
1141
+ if (process.env.NODE_ENV === 'development') {
1142
+ if (htmlColumn) {
1143
+ if (!columnOpts.useKey) {
1144
+ errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
1145
+ }
1146
+ if (!rowOpts.useKey) {
1147
+ errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
1148
+ }
1149
+ }
1150
+ }
1151
+ reactData.isGroup = isGroup;
1152
+ reactData.treeNodeColumn = treeNodeColumn;
1153
+ reactData.expandColumn = expandColumn;
1154
+ reactData.isAllOverflow = isAllOverflow;
1148
1155
  },
1149
1156
  /**
1150
1157
  * 根据 tr 元素获取对应的 row 信息
@@ -2668,6 +2675,10 @@ const Methods = {
2668
2675
  const $xeTable = this;
2669
2676
  const internalData = $xeTable;
2670
2677
  const { rceTimeout } = internalData;
2678
+ const el = $xeTable.$refs.refElem;
2679
+ if (!el || !el.clientWidth) {
2680
+ $xeTable.autoCellWidth();
2681
+ }
2671
2682
  if (rceTimeout) {
2672
2683
  clearTimeout(rceTimeout);
2673
2684
  $xeTable.$nextTick(() => {
@@ -5078,8 +5089,9 @@ const Methods = {
5078
5089
  * 行拖拽
5079
5090
  */
5080
5091
  handleRowDragDragstartEvent(evnt) {
5081
- const img = new Image();
5082
5092
  if (evnt.dataTransfer) {
5093
+ const img = new Image();
5094
+ img.src = tpImg;
5083
5095
  evnt.dataTransfer.setDragImage(img, 0, 0);
5084
5096
  }
5085
5097
  },
@@ -5137,8 +5149,8 @@ const Methods = {
5137
5149
  return;
5138
5150
  }
5139
5151
  if (oldAllMaps[newRowid]) {
5152
+ isSelfToChildStatus = true;
5140
5153
  if (!isSelfToChildDrag) {
5141
- isSelfToChildStatus = true;
5142
5154
  if (VxeUI.modal) {
5143
5155
  VxeUI.modal.message({
5144
5156
  status: 'error',
@@ -5216,7 +5228,7 @@ const Methods = {
5216
5228
  }
5217
5229
  reactData.isDragRowMove = true;
5218
5230
  $xeTable.handleTableData(treeConfig && transform);
5219
- $xeTable.cacheRowMap(true);
5231
+ $xeTable.cacheRowMap();
5220
5232
  $xeTable.updateScrollYStatus();
5221
5233
  if (!(treeConfig && transform)) {
5222
5234
  $xeTable.updateAfterDataIndex();
@@ -5245,6 +5257,7 @@ const Methods = {
5245
5257
  }
5246
5258
  hideDropTip($xeTable);
5247
5259
  clearRowDropOrigin($xeTable);
5260
+ internalData.prevDragToChild = false;
5248
5261
  reactData.dragRow = null;
5249
5262
  reactData.dragCol = null;
5250
5263
  setTimeout(() => {
@@ -5297,7 +5310,6 @@ const Methods = {
5297
5310
  const $xeTable = this;
5298
5311
  const props = $xeTable;
5299
5312
  const reactData = $xeTable;
5300
- evnt.stopPropagation();
5301
5313
  const { dragConfig } = props;
5302
5314
  const rowDragOpts = $xeTable.computeRowDragOpts;
5303
5315
  const { dragStartMethod } = rowDragOpts;
@@ -5335,8 +5347,9 @@ const Methods = {
5335
5347
  * 列拖拽
5336
5348
  */
5337
5349
  handleHeaderCellDragDragstartEvent(evnt) {
5338
- const img = new Image();
5339
5350
  if (evnt.dataTransfer) {
5351
+ const img = new Image();
5352
+ img.src = tpImg;
5340
5353
  evnt.dataTransfer.setDragImage(img, 0, 0);
5341
5354
  }
5342
5355
  },
@@ -5347,17 +5360,19 @@ const Methods = {
5347
5360
  const internalData = $xeTable;
5348
5361
  const { mouseConfig } = props;
5349
5362
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5350
- const { dragEndMethod } = columnDragOpts;
5363
+ const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
5351
5364
  const { dragCol } = reactData;
5352
- const { collectColumn, prevDragCol, prevDragPos } = internalData;
5365
+ const { collectColumn, prevDragCol, prevDragPos, prevDragToChild } = internalData;
5353
5366
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
5354
5367
  if (prevDragCol && dragCol) {
5355
5368
  // 判断是否有拖动
5356
5369
  if (prevDragCol !== dragCol) {
5370
+ const oldColumn = dragCol;
5371
+ const newColumn = prevDragCol;
5357
5372
  Promise.resolve(dragEndMethod
5358
5373
  ? dragEndMethod({
5359
- oldColumn: dragCol,
5360
- newColumn: prevDragCol,
5374
+ oldColumn,
5375
+ newColumn,
5361
5376
  dragPos: prevDragPos,
5362
5377
  offsetIndex: dragOffsetIndex
5363
5378
  })
@@ -5365,24 +5380,102 @@ const Methods = {
5365
5380
  if (!status) {
5366
5381
  return;
5367
5382
  }
5383
+ let oafIndex = -1;
5384
+ let nafIndex = -1;
5385
+ const oldAllMaps = {};
5386
+ XEUtils.eachTree([oldColumn], column => {
5387
+ oldAllMaps[column.id] = column;
5388
+ });
5389
+ let isSelfToChildStatus = false;
5390
+ if (oldColumn.parentId && newColumn.parentId) {
5391
+ // 子到子
5392
+ if (!isCrossDrag) {
5393
+ return;
5394
+ }
5395
+ if (oldAllMaps[newColumn.id]) {
5396
+ isSelfToChildStatus = true;
5397
+ if (!isSelfToChildDrag) {
5398
+ if (VxeUI.modal) {
5399
+ VxeUI.modal.message({
5400
+ status: 'error',
5401
+ content: getI18n('vxe.error.treeDragChild')
5402
+ });
5403
+ }
5404
+ return;
5405
+ }
5406
+ }
5407
+ }
5408
+ else if (oldColumn.parentId) {
5409
+ // 子到根
5410
+ if (!isCrossDrag) {
5411
+ return;
5412
+ }
5413
+ }
5414
+ else if (newColumn.parentId) {
5415
+ // 根到子
5416
+ if (!isCrossDrag) {
5417
+ return;
5418
+ }
5419
+ if (oldAllMaps[newColumn.id]) {
5420
+ isSelfToChildStatus = true;
5421
+ if (!isSelfToChildDrag) {
5422
+ if (VxeUI.modal) {
5423
+ VxeUI.modal.message({
5424
+ status: 'error',
5425
+ content: getI18n('vxe.error.treeDragChild')
5426
+ });
5427
+ }
5428
+ return;
5429
+ }
5430
+ }
5431
+ }
5432
+ else {
5433
+ // 根到根
5434
+ }
5435
+ const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === oldColumn.id);
5436
+ // 改变层级
5437
+ if (isSelfToChildStatus && isSelfToChildDrag) {
5438
+ if (oldewMatchRest) {
5439
+ const { items: oCols, index: oIndex } = oldewMatchRest;
5440
+ const childList = oldColumn.children || [];
5441
+ childList.forEach(column => {
5442
+ column.parentId = oldColumn.parentId;
5443
+ });
5444
+ oCols.splice(oIndex, 1, ...childList);
5445
+ oldColumn.children = [];
5446
+ }
5447
+ }
5448
+ else {
5449
+ if (oldewMatchRest) {
5450
+ const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
5451
+ oCols.splice(oIndex, 1);
5452
+ if (!oParent) {
5453
+ oafIndex = oIndex;
5454
+ }
5455
+ }
5456
+ }
5457
+ const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
5458
+ if (newMatchRest) {
5459
+ const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
5460
+ // 转子级
5461
+ if (isToChildDrag && prevDragToChild) {
5462
+ oldColumn.parentId = newColumn.id;
5463
+ newColumn.children = (newColumn.children || []).concat([oldColumn]);
5464
+ }
5465
+ else {
5466
+ oldColumn.parentId = newColumn.parentId;
5467
+ nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn);
5468
+ }
5469
+ if (!nParent) {
5470
+ nafIndex = nIndex;
5471
+ }
5472
+ }
5368
5473
  XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
5369
5474
  if (!parent) {
5370
5475
  const sortIndex = index + 1;
5371
5476
  column.renderSortNumber = sortIndex;
5372
5477
  }
5373
5478
  });
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
5479
  reactData.isDragColMove = true;
5387
5480
  if (mouseConfig) {
5388
5481
  if ($xeTable.clearSelected) {
@@ -5393,14 +5486,12 @@ const Methods = {
5393
5486
  $xeTable.clearCopyCellArea();
5394
5487
  }
5395
5488
  }
5396
- $xeTable.analyColumnWidth();
5397
- $xeTable.$nextTick().then(() => {
5489
+ $xeTable.refreshColumn(true).then(() => {
5398
5490
  $xeTable.updateCellAreas();
5399
- $xeTable.refreshColumn(true);
5400
5491
  });
5401
5492
  $xeTable.dispatchEvent('column-dragend', {
5402
- oldColumn: dragCol,
5403
- newColumn: prevDragCol,
5493
+ oldColumn,
5494
+ newColumn,
5404
5495
  dragPos: prevDragPos,
5405
5496
  offsetIndex: dragOffsetIndex,
5406
5497
  _index: {
@@ -5415,6 +5506,7 @@ const Methods = {
5415
5506
  }
5416
5507
  hideDropTip($xeTable);
5417
5508
  clearColDropOrigin($xeTable);
5509
+ internalData.prevDragToChild = false;
5418
5510
  reactData.dragRow = null;
5419
5511
  reactData.dragCol = null;
5420
5512
  setTimeout(() => {
@@ -5426,10 +5518,13 @@ const Methods = {
5426
5518
  const reactData = $xeTable;
5427
5519
  const internalData = $xeTable;
5428
5520
  const { dragCol } = reactData;
5521
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
5522
+ const { isToChildDrag, isCrossDrag } = columnDragOpts;
5429
5523
  if (!dragCol) {
5430
5524
  evnt.preventDefault();
5431
5525
  return;
5432
5526
  }
5527
+ const hasCtrlKey = evnt.ctrlKey;
5433
5528
  const thEl = evnt.currentTarget;
5434
5529
  const colid = thEl.getAttribute('colid');
5435
5530
  const column = $xeTable.getColumnById(colid);
@@ -5438,11 +5533,11 @@ const Methods = {
5438
5533
  const { dragCol } = reactData;
5439
5534
  const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
5440
5535
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
5441
- if (dragCol.id === column.id || column.parentId) {
5536
+ if ((dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
5442
5537
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
5443
5538
  return;
5444
5539
  }
5445
- internalData.prevDragToChild = false;
5540
+ internalData.prevDragToChild = !!(isToChildDrag && hasCtrlKey);
5446
5541
  internalData.prevDragCol = column;
5447
5542
  internalData.prevDragPos = dragPos;
5448
5543
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
@@ -5457,7 +5552,6 @@ const Methods = {
5457
5552
  var _a;
5458
5553
  const $xeTable = this;
5459
5554
  const reactData = $xeTable;
5460
- evnt.stopPropagation();
5461
5555
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5462
5556
  const { dragStartMethod } = columnDragOpts;
5463
5557
  const { column } = params;
@@ -764,7 +764,7 @@ export default {
764
764
  });
765
765
  },
766
766
  staticColumns(value) {
767
- this.handleColumn(value);
767
+ this.handleColumn(XEUtils.clone(value));
768
768
  },
769
769
  tableColumn() {
770
770
  this.analyColumnWidth();
@@ -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') {