vxe-table 3.12.0-beta.9 → 3.12.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 (75) hide show
  1. package/es/locale/lang/de-DE.js +490 -490
  2. package/es/locale/lang/en-US.js +438 -438
  3. package/es/locale/lang/it-IT.js +692 -0
  4. package/es/locale/lang/ru-RU.js +36 -36
  5. package/es/locale/lang/th-TH.js +692 -0
  6. package/es/locale/lang/zh-CHT.js +19 -19
  7. package/es/style.css +1 -1
  8. package/es/table/module/custom/panel.js +5 -5
  9. package/es/table/module/export/mixin.js +208 -140
  10. package/es/table/src/cell.js +88 -61
  11. package/es/table/src/column.js +2 -2
  12. package/es/table/src/group.js +2 -2
  13. package/es/table/src/methods.js +112 -87
  14. package/es/table/src/table.js +7 -11
  15. package/es/toolbar/src/toolbar.js +22 -4
  16. package/es/ui/index.js +2 -2
  17. package/es/ui/src/log.js +1 -1
  18. package/es/ui/src/vn.js +3 -0
  19. package/lib/index.umd.js +512 -356
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/locale/lang/de-DE.js +490 -490
  22. package/lib/locale/lang/de-DE.min.js +1 -1
  23. package/lib/locale/lang/en-US.js +438 -438
  24. package/lib/locale/lang/en-US.min.js +1 -1
  25. package/lib/locale/lang/en-US.umd.js +438 -438
  26. package/lib/locale/lang/it-IT.js +698 -0
  27. package/lib/locale/lang/it-IT.min.js +1 -0
  28. package/lib/locale/lang/ru-RU.js +36 -36
  29. package/lib/locale/lang/ru-RU.min.js +1 -1
  30. package/lib/locale/lang/ru-RU.umd.js +36 -36
  31. package/lib/locale/lang/th-TH.js +698 -0
  32. package/lib/locale/lang/th-TH.min.js +1 -0
  33. package/lib/locale/lang/zh-CHT.js +19 -19
  34. package/lib/locale/lang/zh-CHT.min.js +1 -1
  35. package/lib/locale/lang/zh-CHT.umd.js +19 -19
  36. package/lib/style.css +1 -1
  37. package/lib/table/module/custom/panel.js +5 -5
  38. package/lib/table/module/custom/panel.min.js +1 -1
  39. package/lib/table/module/export/mixin.js +239 -167
  40. package/lib/table/module/export/mixin.min.js +1 -1
  41. package/lib/table/src/cell.js +109 -83
  42. package/lib/table/src/cell.min.js +1 -1
  43. package/lib/table/src/methods.js +112 -87
  44. package/lib/table/src/methods.min.js +1 -1
  45. package/lib/table/src/table.js +4 -9
  46. package/lib/table/src/table.min.js +1 -1
  47. package/lib/toolbar/src/toolbar.js +36 -2
  48. package/lib/toolbar/src/toolbar.min.js +1 -1
  49. package/lib/ui/index.js +2 -2
  50. package/lib/ui/index.min.js +1 -1
  51. package/lib/ui/src/log.js +1 -1
  52. package/lib/ui/src/log.min.js +1 -1
  53. package/lib/ui/src/vn.js +3 -0
  54. package/lib/ui/src/vn.min.js +1 -1
  55. package/package.json +3 -3
  56. package/packages/locale/lang/de-DE.ts +492 -491
  57. package/packages/locale/lang/en-US.ts +438 -438
  58. package/packages/locale/lang/it-IT.ts +692 -0
  59. package/packages/locale/lang/ru-RU.ts +36 -36
  60. package/packages/locale/lang/th-TH.ts +692 -0
  61. package/packages/locale/lang/zh-CHT.ts +19 -19
  62. package/packages/table/module/custom/panel.ts +5 -5
  63. package/packages/table/module/export/mixin.ts +227 -156
  64. package/packages/table/src/cell.ts +141 -108
  65. package/packages/table/src/methods.ts +136 -105
  66. package/packages/table/src/table.ts +8 -12
  67. package/packages/toolbar/src/toolbar.ts +26 -8
  68. package/packages/ui/index.ts +1 -1
  69. package/packages/ui/src/vn.ts +4 -1
  70. /package/es/{iconfont.1735301172726.ttf → iconfont.1735661059384.ttf} +0 -0
  71. /package/es/{iconfont.1735301172726.woff → iconfont.1735661059384.woff} +0 -0
  72. /package/es/{iconfont.1735301172726.woff2 → iconfont.1735661059384.woff2} +0 -0
  73. /package/lib/{iconfont.1735301172726.ttf → iconfont.1735661059384.ttf} +0 -0
  74. /package/lib/{iconfont.1735301172726.woff → iconfont.1735661059384.woff} +0 -0
  75. /package/lib/{iconfont.1735301172726.woff2 → iconfont.1735661059384.woff2} +0 -0
@@ -94,31 +94,28 @@ function handleVirtualXVisible($xeTable) {
94
94
  return { toVisibleIndex: 0, visibleSize: 6 };
95
95
  }
96
96
  const computeRowHeight = ($xeTable) => {
97
- const props = $xeTable;
98
- const { showOverflow } = props;
99
97
  const tableHeader = $xeTable.$refs.tableHeader;
100
98
  const tableBody = $xeTable.$refs.tableBody;
101
99
  const tableBodyElem = tableBody ? tableBody.$el : null;
102
100
  const vSize = $xeTable.computeSize;
103
101
  const rowHeightMaps = $xeTable.computeRowHeightMaps;
104
- let rowHeight = 24;
105
- if (showOverflow) {
106
- if (tableBodyElem) {
107
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
108
- let firstTrElem;
109
- firstTrElem = tableBodyElem.querySelector('tr');
110
- if (!firstTrElem && tableHeaderElem) {
111
- firstTrElem = tableHeaderElem.querySelector('tr');
112
- }
113
- if (firstTrElem) {
114
- rowHeight = firstTrElem.clientHeight;
115
- }
116
- if (!rowHeight) {
117
- rowHeight = rowHeightMaps[vSize || 'default'];
118
- }
102
+ let rowHeight = 0;
103
+ if (tableBodyElem) {
104
+ const tableHeaderElem = tableHeader ? tableHeader.$el : null;
105
+ let firstTrElem;
106
+ firstTrElem = tableBodyElem.querySelector('tr');
107
+ if (!firstTrElem && tableHeaderElem) {
108
+ firstTrElem = tableHeaderElem.querySelector('tr');
109
+ }
110
+ if (firstTrElem) {
111
+ rowHeight = firstTrElem.clientHeight;
119
112
  }
120
113
  }
121
- return rowHeight;
114
+ if (!rowHeight) {
115
+ rowHeight = rowHeightMaps[vSize || 'default'];
116
+ }
117
+ // 最低支持 18px 行高
118
+ return Math.max(18, rowHeight);
122
119
  };
123
120
  function handleVirtualYVisible($xeTable) {
124
121
  const internalData = $xeTable;
@@ -531,7 +528,9 @@ const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
531
528
  return $xeTable.$nextTick();
532
529
  };
533
530
  function handleRecalculateLayout($xeTable, reFull) {
531
+ const internalData = $xeTable;
534
532
  const el = $xeTable.$refs.refElem;
533
+ internalData.reRunTime = Date.now();
535
534
  if (!el || !el.clientWidth) {
536
535
  return $xeTable.$nextTick();
537
536
  }
@@ -967,7 +966,7 @@ const Methods = {
967
966
  const isLazy = treeConfig && treeOpts.lazy;
968
967
  const fullAllDataRowIdMaps = {};
969
968
  const fullDataRowIdMaps = {};
970
- const handleCache = (row, index, items, path, parent, nodes) => {
969
+ const handleCache = (row, index, items, path, parentRow, nodes) => {
971
970
  let rowid = getRowid(this, row);
972
971
  const seq = treeConfig && path ? toTreePathSeq(path) : index + 1;
973
972
  const level = nodes ? nodes.length - 1 : 0;
@@ -980,13 +979,13 @@ const Methods = {
980
979
  }
981
980
  let cacheItem = fullAllDataRowIdData[rowid];
982
981
  if (!cacheItem) {
983
- cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent, level, height: 0 };
982
+ cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, items, parent: parentRow, level, height: 0 };
984
983
  }
985
984
  cacheItem.row = row;
986
985
  cacheItem.items = items;
987
- cacheItem.parent = parent;
986
+ cacheItem.parent = parentRow;
988
987
  cacheItem.level = level;
989
- cacheItem.index = treeConfig && parent ? -1 : index;
988
+ cacheItem.index = treeConfig && parentRow ? -1 : index;
990
989
  if (isSource) {
991
990
  fullDataRowIdMaps[rowid] = cacheItem;
992
991
  }
@@ -1051,9 +1050,9 @@ const Methods = {
1051
1050
  sourceDataRowIdData[rowid] = XEUtils.clone(childRow, true);
1052
1051
  });
1053
1052
  }
1054
- XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
1053
+ XEUtils.eachTree(rows, (childRow, index, items, path, parentItem, nodes) => {
1055
1054
  const rowid = getRowid($xeTable, childRow);
1056
- const parentRow = parent || parentRest.row;
1055
+ const parentRow = parentItem || parentRest.row;
1057
1056
  const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length, height: 0 };
1058
1057
  fullDataRowIdData[rowid] = rest;
1059
1058
  fullAllDataRowIdData[rowid] = rest;
@@ -1091,9 +1090,9 @@ const Methods = {
1091
1090
  let radioColumn;
1092
1091
  let htmlColumn;
1093
1092
  let hasFixed;
1094
- const handleFunc = (column, index, items, path, parent) => {
1093
+ const handleFunc = (column, index, items, path, parentColumn) => {
1095
1094
  const { id: colid, field, fixed, type, treeNode } = column;
1096
- const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parent || null, width: 0 };
1095
+ const rest = { $index: -1, _index: -1, column, colid, index, items, parent: parentColumn || null, width: 0 };
1097
1096
  if (field) {
1098
1097
  if (fullColumnFieldData[field]) {
1099
1098
  errLog('vxe.error.colRepet', ['field', field]);
@@ -1158,9 +1157,9 @@ const Methods = {
1158
1157
  fullColumnIdData[colid] = rest;
1159
1158
  };
1160
1159
  if (isGroup) {
1161
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent, nodes) => {
1160
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn, nodes) => {
1162
1161
  column.level = nodes.length;
1163
- handleFunc(column, index, items, path, parent);
1162
+ handleFunc(column, index, items, path, parentColumn);
1164
1163
  });
1165
1164
  }
1166
1165
  else {
@@ -1752,10 +1751,10 @@ const Methods = {
1752
1751
  if (treeConfig && treeOpts.transform) {
1753
1752
  const fullData = [];
1754
1753
  const expandMaps = {};
1755
- XEUtils.eachTree(afterTreeFullData, (row, index, items, path, parent) => {
1754
+ XEUtils.eachTree(afterTreeFullData, (row, index, items, path, parentRow) => {
1756
1755
  const rowid = getRowid(this, row);
1757
- const parentRowid = getRowid(this, parent);
1758
- if (!parent || (expandMaps[parentRowid] && treeExpandedMaps[parentRowid])) {
1756
+ const parentRowid = getRowid(this, parentRow);
1757
+ if (!parentRow || (expandMaps[parentRowid] && treeExpandedMaps[parentRowid])) {
1759
1758
  const rowRest = fullAllDataRowIdData[rowid];
1760
1759
  if (rowRest) {
1761
1760
  rowRest._index = fullData.length;
@@ -2290,11 +2289,11 @@ const Methods = {
2290
2289
  let hasCustomSort = false;
2291
2290
  // 处理还原
2292
2291
  if (resizableData || sortData || visibleData || fixedData) {
2293
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
2292
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentRow) => {
2294
2293
  const colKey = column.getKey();
2295
2294
  // 支持一级
2296
- if (!parent) {
2297
- if (fixedData && fixedData[colKey]) {
2295
+ if (!parentRow) {
2296
+ if (fixedData && fixedData[colKey] !== undefined) {
2298
2297
  column.fixed = fixedData[colKey];
2299
2298
  }
2300
2299
  if (sortData && XEUtils.isNumber(sortData[colKey])) {
@@ -2373,9 +2372,9 @@ const Methods = {
2373
2372
  let hasSort = 0;
2374
2373
  let hasFixedt = 0;
2375
2374
  let hasVisible = 0;
2376
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
2375
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
2377
2376
  // 只支持一级
2378
- if (!parent) {
2377
+ if (!parentColumn) {
2379
2378
  collectColumn.forEach((column) => {
2380
2379
  const colKey = column.getKey();
2381
2380
  if (colKey) {
@@ -2383,7 +2382,7 @@ const Methods = {
2383
2382
  sortData[colKey] = column.renderSortNumber;
2384
2383
  }
2385
2384
  });
2386
- if (column.fixed && column.fixed !== column.defaultFixed) {
2385
+ if (column.fixed !== column.defaultFixed) {
2387
2386
  const colKey = column.getKey();
2388
2387
  if (colKey) {
2389
2388
  hasFixedt = 1;
@@ -2506,13 +2505,13 @@ const Methods = {
2506
2505
  const leftGroupList = [];
2507
2506
  const centerGroupList = [];
2508
2507
  const rightGroupList = [];
2509
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
2508
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
2510
2509
  const isColGroup = hasChildrenList(column);
2511
2510
  // 如果是分组,必须按组设置固定列,不允许给子列设置固定
2512
- if (parent && parent.fixed) {
2513
- column.fixed = parent.fixed;
2511
+ if (parentColumn && parentColumn.fixed) {
2512
+ column.fixed = parentColumn.fixed;
2514
2513
  }
2515
- if (parent && column.fixed !== parent.fixed) {
2514
+ if (parentColumn && column.fixed !== parentColumn.fixed) {
2516
2515
  errLog('vxe.error.groupFixed');
2517
2516
  }
2518
2517
  if (isColGroup) {
@@ -2705,27 +2704,34 @@ const Methods = {
2705
2704
  * 刷新布局
2706
2705
  */
2707
2706
  recalculate(reFull) {
2707
+ const $xeTable = this;
2708
+ const internalData = $xeTable;
2708
2709
  return new Promise(resolve => {
2709
- const $xeTable = this;
2710
- const internalData = $xeTable;
2711
- const { rceTimeout } = internalData;
2710
+ const { rceTimeout, reRunTime } = internalData;
2711
+ const resizeOpts = $xeTable.computeResizeOpts;
2712
+ const refreshDelay = resizeOpts.refreshDelay || 20;
2712
2713
  const el = $xeTable.$refs.refElem;
2713
2714
  if (el && el.clientWidth) {
2714
2715
  $xeTable.autoCellWidth();
2715
2716
  }
2716
2717
  if (rceTimeout) {
2717
2718
  clearTimeout(rceTimeout);
2718
- $xeTable.$nextTick(() => {
2719
- resolve();
2720
- });
2719
+ if (reRunTime && reRunTime + (refreshDelay - 5) < Date.now()) {
2720
+ resolve(handleRecalculateLayout($xeTable, !!reFull));
2721
+ }
2722
+ else {
2723
+ $xeTable.$nextTick(() => {
2724
+ resolve();
2725
+ });
2726
+ }
2721
2727
  }
2722
2728
  else {
2723
2729
  resolve(handleRecalculateLayout($xeTable, !!reFull));
2724
2730
  }
2725
2731
  internalData.rceTimeout = setTimeout(() => {
2726
2732
  internalData.rceTimeout = undefined;
2727
- resolve(handleRecalculateLayout($xeTable, !!reFull));
2728
- }, 15);
2733
+ handleRecalculateLayout($xeTable, !!reFull);
2734
+ }, refreshDelay);
2729
2735
  });
2730
2736
  },
2731
2737
  calcCellWidth() {
@@ -5062,7 +5068,7 @@ const Methods = {
5062
5068
  const { editStore, editConfig, editOpts } = this;
5063
5069
  const { actived } = editStore;
5064
5070
  const cell = evnt.currentTarget;
5065
- params.cell = cell;
5071
+ params = Object.assign({ cell }, params);
5066
5072
  if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
5067
5073
  if (!actived.args || evnt.currentTarget !== actived.args.cell) {
5068
5074
  if (editOpts.mode === 'row') {
@@ -5230,7 +5236,7 @@ const Methods = {
5230
5236
  const { treeConfig, dragConfig } = props;
5231
5237
  const rowDragOpts = $xeTable.computeRowDragOpts;
5232
5238
  const { fullAllDataRowIdData, prevDragToChild } = internalData;
5233
- const { isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
5239
+ const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
5234
5240
  const treeOpts = $xeTable.computeTreeOpts;
5235
5241
  const { transform, rowField, mapChildrenField, parentField } = treeOpts;
5236
5242
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -5272,20 +5278,28 @@ const Methods = {
5272
5278
  let isSelfToChildStatus = false;
5273
5279
  if (oldLevel && newLevel) {
5274
5280
  // 子到子
5275
- if (!isCrossDrag) {
5276
- return;
5281
+ if (isPeerDrag) {
5282
+ if (oldRest.row[parentField] !== newRest.row[parentField]) {
5283
+ // 非同级
5284
+ return;
5285
+ }
5277
5286
  }
5278
- if (oldAllMaps[newRowid]) {
5279
- isSelfToChildStatus = true;
5280
- if (!isSelfToChildDrag) {
5281
- if (VxeUI.modal) {
5282
- VxeUI.modal.message({
5283
- status: 'error',
5284
- content: getI18n('vxe.error.treeDragChild')
5285
- });
5286
- }
5287
+ else {
5288
+ if (!isCrossDrag) {
5287
5289
  return;
5288
5290
  }
5291
+ if (oldAllMaps[newRowid]) {
5292
+ isSelfToChildStatus = true;
5293
+ if (!(isCrossDrag && isSelfToChildDrag)) {
5294
+ if (VxeUI.modal) {
5295
+ VxeUI.modal.message({
5296
+ status: 'error',
5297
+ content: getI18n('vxe.error.treeDragChild')
5298
+ });
5299
+ }
5300
+ return;
5301
+ }
5302
+ }
5289
5303
  }
5290
5304
  }
5291
5305
  else if (oldLevel) {
@@ -5301,7 +5315,7 @@ const Methods = {
5301
5315
  }
5302
5316
  if (oldAllMaps[newRowid]) {
5303
5317
  isSelfToChildStatus = true;
5304
- if (!isSelfToChildDrag) {
5318
+ if (!(isCrossDrag && isSelfToChildDrag)) {
5305
5319
  if (VxeUI.modal) {
5306
5320
  VxeUI.modal.message({
5307
5321
  status: 'error',
@@ -5324,7 +5338,7 @@ const Methods = {
5324
5338
  const ntfIndex = ptfIndex + dragOffsetIndex;
5325
5339
  fullList.splice(ntfIndex, 0, dragRow);
5326
5340
  // 改变层级
5327
- if (isSelfToChildStatus && isSelfToChildDrag) {
5341
+ if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
5328
5342
  XEUtils.each(dragRow[childrenField], childRow => {
5329
5343
  childRow[parentField] = dragRow[parentField];
5330
5344
  });
@@ -5400,9 +5414,9 @@ const Methods = {
5400
5414
  const { fullAllDataRowIdData } = internalData;
5401
5415
  const { dragRow } = reactData;
5402
5416
  const treeOpts = $xeTable.computeTreeOpts;
5403
- const { transform } = treeOpts;
5417
+ const { transform, parentField } = treeOpts;
5404
5418
  const rowDragOpts = $xeTable.computeRowDragOpts;
5405
- const { isCrossDrag, isToChildDrag } = rowDragOpts;
5419
+ const { isPeerDrag, isCrossDrag, isToChildDrag } = rowDragOpts;
5406
5420
  if (!dragRow) {
5407
5421
  evnt.preventDefault();
5408
5422
  return;
@@ -5417,7 +5431,8 @@ const Methods = {
5417
5431
  const { dragRow } = reactData;
5418
5432
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
5419
5433
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
5420
- if ($xeTable.eqRow(dragRow, row) || (!isCrossDrag && treeConfig && rest.level)) {
5434
+ if ($xeTable.eqRow(dragRow, row) ||
5435
+ (!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))) {
5421
5436
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
5422
5437
  return;
5423
5438
  }
@@ -5489,7 +5504,7 @@ const Methods = {
5489
5504
  const internalData = $xeTable;
5490
5505
  const { mouseConfig } = props;
5491
5506
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5492
- const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
5507
+ const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
5493
5508
  const { collectColumn } = internalData;
5494
5509
  const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
5495
5510
  if (prevDragCol && dragCol) {
@@ -5517,20 +5532,28 @@ const Methods = {
5517
5532
  let isSelfToChildStatus = false;
5518
5533
  if (oldColumn.parentId && newColumn.parentId) {
5519
5534
  // 子到子
5520
- if (!isCrossDrag) {
5521
- return;
5535
+ if (isPeerDrag) {
5536
+ if (oldColumn.parentId !== newColumn.parentId) {
5537
+ // 非同级
5538
+ return;
5539
+ }
5522
5540
  }
5523
- if (oldAllMaps[newColumn.id]) {
5524
- isSelfToChildStatus = true;
5525
- if (!isSelfToChildDrag) {
5526
- if (VxeUI.modal) {
5527
- VxeUI.modal.message({
5528
- status: 'error',
5529
- content: getI18n('vxe.error.treeDragChild')
5530
- });
5531
- }
5541
+ else {
5542
+ if (!isCrossDrag) {
5532
5543
  return;
5533
5544
  }
5545
+ if (oldAllMaps[newColumn.id]) {
5546
+ isSelfToChildStatus = true;
5547
+ if (!(isCrossDrag && isSelfToChildDrag)) {
5548
+ if (VxeUI.modal) {
5549
+ VxeUI.modal.message({
5550
+ status: 'error',
5551
+ content: getI18n('vxe.error.treeDragChild')
5552
+ });
5553
+ }
5554
+ return;
5555
+ }
5556
+ }
5534
5557
  }
5535
5558
  }
5536
5559
  else if (oldColumn.parentId) {
@@ -5546,7 +5569,7 @@ const Methods = {
5546
5569
  }
5547
5570
  if (oldAllMaps[newColumn.id]) {
5548
5571
  isSelfToChildStatus = true;
5549
- if (!isSelfToChildDrag) {
5572
+ if (!(isCrossDrag && isSelfToChildDrag)) {
5550
5573
  if (VxeUI.modal) {
5551
5574
  VxeUI.modal.message({
5552
5575
  status: 'error',
@@ -5562,7 +5585,7 @@ const Methods = {
5562
5585
  }
5563
5586
  const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === oldColumn.id);
5564
5587
  // 改变层级
5565
- if (isSelfToChildStatus && isSelfToChildDrag) {
5588
+ if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
5566
5589
  if (oldewMatchRest) {
5567
5590
  const { items: oCols, index: oIndex } = oldewMatchRest;
5568
5591
  const childList = oldColumn.children || [];
@@ -5586,7 +5609,7 @@ const Methods = {
5586
5609
  if (newMatchRest) {
5587
5610
  const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
5588
5611
  // 转子级
5589
- if (isToChildDrag && prevDragToChild) {
5612
+ if ((isCrossDrag && isToChildDrag) && prevDragToChild) {
5590
5613
  oldColumn.parentId = newColumn.id;
5591
5614
  newColumn.children = (newColumn.children || []).concat([oldColumn]);
5592
5615
  }
@@ -5598,8 +5621,8 @@ const Methods = {
5598
5621
  nafIndex = nIndex;
5599
5622
  }
5600
5623
  }
5601
- XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
5602
- if (!parent) {
5624
+ XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
5625
+ if (!parentColumn) {
5603
5626
  const sortIndex = index + 1;
5604
5627
  column.renderSortNumber = sortIndex;
5605
5628
  }
@@ -5658,7 +5681,7 @@ const Methods = {
5658
5681
  const internalData = $xeTable;
5659
5682
  const { dragCol } = reactData;
5660
5683
  const columnDragOpts = $xeTable.computeColumnDragOpts;
5661
- const { isToChildDrag, isCrossDrag } = columnDragOpts;
5684
+ const { isToChildDrag, isPeerDrag, isCrossDrag } = columnDragOpts;
5662
5685
  if (!dragCol) {
5663
5686
  evnt.preventDefault();
5664
5687
  return;
@@ -5672,11 +5695,13 @@ const Methods = {
5672
5695
  const { clientX } = evnt;
5673
5696
  const offsetX = clientX - thEl.getBoundingClientRect().x;
5674
5697
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
5675
- if (column.fixed || (dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
5698
+ if (column.fixed ||
5699
+ (dragCol && dragCol.id === column.id) ||
5700
+ (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId))) {
5676
5701
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
5677
5702
  return;
5678
5703
  }
5679
- internalData.prevDragToChild = !!(isToChildDrag && hasCtrlKey);
5704
+ internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && hasCtrlKey);
5680
5705
  internalData.prevDragCol = column;
5681
5706
  internalData.prevDragPos = dragPos;
5682
5707
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
@@ -475,6 +475,9 @@ export default {
475
475
  return 0;
476
476
  },
477
477
  rowHeightMaps() {
478
+ return this.computeRowHeightMaps;
479
+ },
480
+ computeRowHeightMaps() {
478
481
  return {
479
482
  default: 48,
480
483
  medium: 44,
@@ -1112,18 +1115,11 @@ export default {
1112
1115
  });
1113
1116
  }
1114
1117
  if (this.autoResize) {
1115
- const handleWrapperResize = this.resizeOpts.refreshDelay ? XEUtils.throttle(() => this.recalculate(true), this.resizeOpts.refreshDelay, { leading: true, trailing: true }) : null;
1116
- const resizeObserver = globalResize.create(handleWrapperResize
1117
- ? () => {
1118
- if (this.autoResize) {
1119
- handleWrapperResize();
1120
- }
1118
+ const resizeObserver = globalResize.create(() => {
1119
+ if (this.autoResize) {
1120
+ this.recalculate(true);
1121
1121
  }
1122
- : () => {
1123
- if (this.autoResize) {
1124
- this.recalculate(true);
1125
- }
1126
- });
1122
+ });
1127
1123
  resizeObserver.observe(this.$el);
1128
1124
  resizeObserver.observe(this.getParentElem());
1129
1125
  this.$resize = resizeObserver;
@@ -4,7 +4,7 @@ import { VxeUI } from '../../ui';
4
4
  import { getSlotVNs } from '../../ui/src/vn';
5
5
  import { warnLog, errLog } from '../../ui/src/log';
6
6
  const { getConfig, getIcon, getI18n, renderer, commands, createEvent, globalMixins, renderEmptyElement } = VxeUI;
7
- export default defineVxeComponent({
7
+ export default {
8
8
  name: 'VxeToolbar',
9
9
  mixins: [
10
10
  globalMixins.sizeMixin
@@ -346,17 +346,23 @@ export default defineVxeComponent({
346
346
  /**
347
347
  * 渲染按钮
348
348
  */
349
- renderBtns(h) {
349
+ renderLeftBtns(h) {
350
350
  // 使用已安装的组件,如果未安装则不渲染
351
351
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
352
352
  const $xeToolbar = this;
353
353
  const props = $xeToolbar;
354
+ const slots = $xeToolbar.$scopedSlots;
354
355
  const internalData = $xeToolbar.internalData;
355
356
  const $xeGrid = $xeToolbar.$xeGrid;
356
357
  const { buttons } = props;
357
358
  const { connectTable } = internalData;
358
359
  const $table = connectTable;
360
+ const buttonPrefixSlot = slots.buttonPrefix || slots['button-prefix'];
361
+ const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix'];
359
362
  const btnVNs = [];
363
+ if (buttonPrefixSlot) {
364
+ btnVNs.push(...getSlotVNs(buttonPrefixSlot.call($xeToolbar, { buttons: buttons || [], $grid: $xeGrid, $table: $table })));
365
+ }
360
366
  if (buttons) {
361
367
  buttons.forEach((item) => {
362
368
  const { dropdowns, buttonRender } = item;
@@ -405,6 +411,9 @@ export default defineVxeComponent({
405
411
  }
406
412
  });
407
413
  }
414
+ if (buttonSuffixSlot) {
415
+ btnVNs.push(...getSlotVNs(buttonSuffixSlot.call($xeToolbar, { buttons: buttons || [], $grid: $xeGrid, $table: $table })));
416
+ }
408
417
  return btnVNs;
409
418
  },
410
419
  /**
@@ -415,12 +424,18 @@ export default defineVxeComponent({
415
424
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
416
425
  const $xeToolbar = this;
417
426
  const props = $xeToolbar;
427
+ const slots = $xeToolbar.$scopedSlots;
418
428
  const internalData = $xeToolbar.internalData;
419
429
  const $xeGrid = $xeToolbar.$xeGrid;
420
430
  const { tools } = props;
421
431
  const { connectTable } = internalData;
422
432
  const $table = connectTable;
433
+ const toolPrefixSlot = slots.toolPrefix || slots['tool-prefix'];
434
+ const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix'];
423
435
  const btnVNs = [];
436
+ if (toolPrefixSlot) {
437
+ btnVNs.push(...getSlotVNs(toolPrefixSlot.call($xeToolbar, { tools: tools || [], $grid: $xeGrid, $table: $table })));
438
+ }
424
439
  if (tools) {
425
440
  tools.forEach((item, tIndex) => {
426
441
  const { dropdowns, toolRender } = item;
@@ -472,6 +487,9 @@ export default defineVxeComponent({
472
487
  }
473
488
  });
474
489
  }
490
+ if (toolSuffixSlot) {
491
+ btnVNs.push(...getSlotVNs(toolSuffixSlot.call($xeToolbar, { tools: tools || [], $grid: $xeGrid, $table: $table })));
492
+ }
475
493
  return btnVNs;
476
494
  },
477
495
  renderToolImport(h) {
@@ -625,7 +643,7 @@ export default defineVxeComponent({
625
643
  }, [
626
644
  h('div', {
627
645
  class: 'vxe-buttons--wrapper'
628
- }, buttonsSlot ? buttonsSlot({ $grid: $xeGrid, $table: $table }) : $xeToolbar.renderBtns(h)),
646
+ }, buttonsSlot ? buttonsSlot({ $grid: $xeGrid, $table: $table }) : $xeToolbar.renderLeftBtns(h)),
629
647
  h('div', {
630
648
  class: 'vxe-tools--wrapper'
631
649
  }, toolsSlot ? toolsSlot({ $grid: $xeGrid, $table: $table }) : $xeToolbar.renderRightTools(h)),
@@ -686,4 +704,4 @@ export default defineVxeComponent({
686
704
  render(h) {
687
705
  return this.renderVN(h);
688
706
  }
689
- });
707
+ };
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "3.12.0-beta.9";
3
+ export const version = "3.12.0";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
@@ -31,7 +31,7 @@ VxeUI.setConfig({
31
31
  // keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
32
32
  // },
33
33
  resizeConfig: {
34
- // refreshDelay: 250
34
+ // refreshDelay: 20
35
35
  },
36
36
  resizableConfig: {
37
37
  dragMode: 'auto',
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"3.12.0-beta.9"}`;
3
+ const version = `table v${"3.12.0"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/es/ui/src/vn.js CHANGED
@@ -26,6 +26,9 @@ export function getChangeEvent(renderOpts) {
26
26
  return 'change';
27
27
  }
28
28
  export function getSlotVNs(vns) {
29
+ if (vns === null || vns === undefined) {
30
+ return [];
31
+ }
29
32
  if (XEUtils.isArray(vns)) {
30
33
  return vns;
31
34
  }