vxe-table 3.10.15 → 3.11.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 (72) hide show
  1. package/README.md +1 -1
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/module/custom/mixin.js +5 -1
  5. package/es/table/module/edit/mixin.js +24 -15
  6. package/es/table/module/validator/mixin.js +31 -10
  7. package/es/table/src/body.js +40 -24
  8. package/es/table/src/cell.js +75 -32
  9. package/es/table/src/footer.js +159 -131
  10. package/es/table/src/header.js +128 -90
  11. package/es/table/src/methods.js +292 -66
  12. package/es/table/src/props.js +5 -1
  13. package/es/table/src/table.js +64 -20
  14. package/es/table/style.css +33 -20
  15. package/es/table/style.min.css +1 -1
  16. package/es/ui/index.js +9 -4
  17. package/es/ui/src/log.js +1 -1
  18. package/es/vxe-table/style.css +33 -20
  19. package/es/vxe-table/style.min.css +1 -1
  20. package/helper/vetur/attributes.json +1 -1
  21. package/helper/vetur/tags.json +1 -1
  22. package/lib/index.umd.js +945 -460
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/style.min.css +1 -1
  26. package/lib/table/module/custom/mixin.js +5 -1
  27. package/lib/table/module/custom/mixin.min.js +1 -1
  28. package/lib/table/module/edit/mixin.js +24 -15
  29. package/lib/table/module/edit/mixin.min.js +1 -1
  30. package/lib/table/module/validator/mixin.js +31 -10
  31. package/lib/table/module/validator/mixin.min.js +1 -1
  32. package/lib/table/src/body.js +31 -15
  33. package/lib/table/src/body.min.js +1 -1
  34. package/lib/table/src/cell.js +82 -35
  35. package/lib/table/src/cell.min.js +1 -1
  36. package/lib/table/src/footer.js +198 -161
  37. package/lib/table/src/footer.min.js +1 -1
  38. package/lib/table/src/header.js +169 -128
  39. package/lib/table/src/header.min.js +1 -1
  40. package/lib/table/src/methods.js +321 -69
  41. package/lib/table/src/methods.min.js +1 -1
  42. package/lib/table/src/props.js +5 -1
  43. package/lib/table/src/props.min.js +1 -1
  44. package/lib/table/src/table.js +70 -20
  45. package/lib/table/src/table.min.js +1 -1
  46. package/lib/table/style/style.css +33 -20
  47. package/lib/table/style/style.min.css +1 -1
  48. package/lib/ui/index.js +9 -4
  49. package/lib/ui/index.min.js +1 -1
  50. package/lib/ui/src/log.js +1 -1
  51. package/lib/ui/src/log.min.js +1 -1
  52. package/lib/vxe-table/style/style.css +33 -20
  53. package/lib/vxe-table/style/style.min.css +1 -1
  54. package/package.json +3 -3
  55. package/packages/table/module/custom/mixin.ts +5 -1
  56. package/packages/table/module/edit/mixin.ts +24 -15
  57. package/packages/table/module/validator/mixin.ts +33 -10
  58. package/packages/table/src/body.ts +43 -25
  59. package/packages/table/src/cell.ts +120 -67
  60. package/packages/table/src/footer.ts +164 -150
  61. package/packages/table/src/header.ts +136 -90
  62. package/packages/table/src/methods.ts +304 -68
  63. package/packages/table/src/props.ts +5 -1
  64. package/packages/table/src/table.ts +71 -19
  65. package/packages/ui/index.ts +8 -3
  66. package/styles/components/table.scss +42 -35
  67. /package/es/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
  68. /package/es/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
  69. /package/es/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
  70. /package/lib/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
  71. /package/lib/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
  72. /package/lib/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
@@ -407,66 +407,124 @@ function updateRowDropOrigin($xeTable, row) {
407
407
  });
408
408
  }
409
409
  }
410
- function clearRowDropTarget($xeTable) {
410
+ const updateRowDropTipContent = ($xeTable, tdEl) => {
411
+ const reactData = $xeTable;
412
+ const props = $xeTable;
413
+ const {
414
+ dragConfig
415
+ } = props;
416
+ const {
417
+ dragRow
418
+ } = reactData;
419
+ const rowDragOpts = $xeTable.computeRowDragOpts;
420
+ const {
421
+ tooltipMethod
422
+ } = rowDragOpts;
423
+ const rTooltipMethod = tooltipMethod || (dragConfig ? dragConfig.rowTooltipMethod : null);
424
+ let tipContent = '';
425
+ if (rTooltipMethod) {
426
+ tipContent = `${rTooltipMethod({
427
+ row: dragRow
428
+ }) || ''}`;
429
+ } else {
430
+ tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
431
+ }
432
+ reactData.dragTipText = tipContent;
433
+ };
434
+ const updateColDropOrigin = ($xeTable, column) => {
411
435
  const el = $xeTable.$el;
412
436
  if (el) {
413
- const clss = 'row--drag-active-target';
414
- _xeUtils.default.arrayEach(el.querySelectorAll(`.${clss}`), elem => {
415
- (0, _dom.removeClass)(elem, clss);
437
+ const clss = 'col--drag-origin';
438
+ _xeUtils.default.arrayEach(el.querySelectorAll(`[colid="${column.id}"]`), elem => {
439
+ (0, _dom.addClass)(elem, clss);
416
440
  });
417
441
  }
418
- }
419
- function updateRowDropTarget($xeTable, row, dragPos) {
442
+ };
443
+ const clearColDropOrigin = $xeTable => {
420
444
  const el = $xeTable.$el;
421
445
  if (el) {
422
- const clss = 'row--drag-active-target';
423
- const rowid = (0, _util.getRowid)($xeTable, row);
424
- _xeUtils.default.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
425
- (0, _dom.addClass)(elem, clss);
426
- elem.setAttribute('drag-pos', dragPos);
446
+ const clss = 'col--drag-origin';
447
+ _xeUtils.default.arrayEach(el.querySelectorAll(`.${clss}`), elem => {
448
+ elem.draggable = false;
449
+ (0, _dom.removeClass)(elem, clss);
427
450
  });
428
451
  }
429
- }
430
- function showRowDropTip(evnt, $xeTable) {
431
- const rdTipEl = $xeTable.$refs.refRowDragTipElem;
432
- if (!rdTipEl) {
433
- return;
452
+ };
453
+ const updateColDropTipContent = ($xeTable, tdEl) => {
454
+ const reactData = $xeTable;
455
+ const {
456
+ dragCol
457
+ } = reactData;
458
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
459
+ const {
460
+ tooltipMethod
461
+ } = columnDragOpts;
462
+ let tipContent = '';
463
+ if (tooltipMethod) {
464
+ tipContent = `${tooltipMethod({
465
+ column: dragCol
466
+ }) || ''}`;
467
+ } else {
468
+ tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
434
469
  }
435
- const el = $xeTable.$el;
470
+ reactData.dragTipText = tipContent;
471
+ };
472
+ function showDropTip($xeTable, evnt, trEl, thEl, dragPos) {
473
+ const reactData = $xeTable;
474
+ const el = $xeTable.$refs.refElem;
436
475
  if (!el) {
437
476
  return;
438
477
  }
478
+ const {
479
+ scrollbarWidth,
480
+ scrollbarHeight
481
+ } = reactData;
482
+ const wrapperRect = el.getBoundingClientRect();
483
+ if (trEl) {
484
+ const rdLineEl = $xeTable.$refs.refDragRowLineElem;
485
+ if (rdLineEl) {
486
+ const trRect = trEl.getBoundingClientRect();
487
+ let top = Math.max(1, trRect.y - wrapperRect.y);
488
+ if (dragPos === 'bottom') {
489
+ top = Math.min(wrapperRect.height - 1, trRect.y - wrapperRect.y + trRect.height);
490
+ }
491
+ rdLineEl.style.top = `${top}px`;
492
+ rdLineEl.style.width = `${wrapperRect.width - scrollbarWidth}px`;
493
+ rdLineEl.style.display = 'block';
494
+ }
495
+ } else if (thEl) {
496
+ const cdLineEl = $xeTable.$refs.refDragColLineElem;
497
+ if (cdLineEl) {
498
+ const thRect = thEl.getBoundingClientRect();
499
+ let left = Math.max(1, thRect.x - wrapperRect.x);
500
+ if (dragPos === 'right') {
501
+ left = Math.min(wrapperRect.width - 2, thRect.x - wrapperRect.x + thRect.width);
502
+ }
503
+ cdLineEl.style.left = `${left}px`;
504
+ cdLineEl.style.height = `${wrapperRect.height - scrollbarHeight}px`;
505
+ cdLineEl.style.display = 'block';
506
+ }
507
+ }
508
+ const rdTipEl = $xeTable.$refs.refDragTipElem;
439
509
  if (rdTipEl) {
440
- const wrapperRect = el.getBoundingClientRect();
441
510
  rdTipEl.style.display = 'block';
442
511
  rdTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - rdTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
443
512
  rdTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - rdTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
444
513
  }
445
514
  }
446
- const hideRowDropTip = $xeTable => {
447
- const rdTipEl = $xeTable.$refs.refRowDragTipElem;
515
+ const hideDropTip = $xeTable => {
516
+ const rdTipEl = $xeTable.$refs.refDragTipElem;
517
+ const rdLineEl = $xeTable.$refs.refDragRowLineElem;
518
+ const cdLineEl = $xeTable.$refs.refDragColLineElem;
448
519
  if (rdTipEl) {
449
520
  rdTipEl.style.display = '';
450
521
  }
451
- };
452
- const updateRowDropTipContent = ($xeTable, tdEl) => {
453
- const reactData = $xeTable;
454
- const {
455
- dragRow
456
- } = reactData;
457
- const dragOpts = $xeTable.computeDragOpts;
458
- const {
459
- rowTooltipMethod
460
- } = dragOpts;
461
- let tipContent = '';
462
- if (rowTooltipMethod) {
463
- tipContent = `${rowTooltipMethod({
464
- row: dragRow
465
- }) || ''}`;
466
- } else {
467
- tipContent = getI18n('vxe.table.dragTip', [tdEl.textContent || '']);
522
+ if (rdLineEl) {
523
+ rdLineEl.style.display = '';
524
+ }
525
+ if (cdLineEl) {
526
+ cdLineEl.style.display = '';
468
527
  }
469
- reactData.dragTipText = tipContent;
470
528
  };
471
529
  const Methods = {
472
530
  callSlot(slotFunc, params, h, vNodes) {
@@ -671,6 +729,7 @@ const Methods = {
671
729
  editStore.removeMaps = {};
672
730
  const sYLoad = this.updateScrollYStatus(fullData);
673
731
  this.scrollYLoad = sYLoad;
732
+ this.isDragRowMove = false;
674
733
  // 全量数据
675
734
  this.tableFullData = fullData;
676
735
  this.tableFullTreeData = treeData;
@@ -860,6 +919,7 @@ const Methods = {
860
919
  const tableFullColumn = getColumnList(collectColumn);
861
920
  this.tableFullColumn = tableFullColumn;
862
921
  this._isLoading = true;
922
+ this.isDragColMove = false;
863
923
  this.initColumnSort();
864
924
  return Promise.resolve(this.restoreCustomStorage()).then(() => {
865
925
  this._isLoading = false;
@@ -3523,7 +3583,14 @@ const Methods = {
3523
3583
  if (isClear ||
3524
3584
  // 如果点击了当前表格之外
3525
3585
  !(0, _dom.getEventTargetNode)(evnt, $el).flag) {
3526
- setTimeout(() => this.clearEdit(evnt));
3586
+ setTimeout(() => {
3587
+ this.handleClearEdit(evnt).then(() => {
3588
+ // 如果存在校验,点击了表格之外则清除
3589
+ if (!this.isActivated && editRules && validOpts.autoClear) {
3590
+ this.validErrorMaps = {};
3591
+ }
3592
+ });
3593
+ });
3527
3594
  }
3528
3595
  });
3529
3596
  }
@@ -3600,8 +3667,8 @@ const Methods = {
3600
3667
  if (isEsc) {
3601
3668
  this.preventEvent(evnt, 'event.keydown', null, () => {
3602
3669
  this.emitEvent('keydown-start', {}, evnt);
3603
- if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardEvent) {
3604
- this.handleKeyboardEvent(evnt);
3670
+ if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
3671
+ this.handleKeyboardCellAreaEvent(evnt);
3605
3672
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
3606
3673
  evnt.stopPropagation();
3607
3674
  // 如果按下了 Esc 键,关闭快捷菜单、筛选
@@ -3611,7 +3678,7 @@ const Methods = {
3611
3678
  // 如果是激活编辑状态,则取消编辑
3612
3679
  if (actived.row) {
3613
3680
  const params = actived.args;
3614
- this.clearEdit(evnt);
3681
+ this.handleClearEdit(evnt);
3615
3682
  // 如果配置了选中功能,则为选中状态
3616
3683
  if (mouseConfig && mouseOpts.selected) {
3617
3684
  this.$nextTick(() => this.handleSelected(params, evnt));
@@ -3691,8 +3758,8 @@ const Methods = {
3691
3758
  } else {
3692
3759
  this.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, this.ctxMenuList);
3693
3760
  }
3694
- } else if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardEvent) {
3695
- this.handleKeyboardEvent(evnt);
3761
+ } else if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
3762
+ this.handleKeyboardCellAreaEvent(evnt);
3696
3763
  } else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
3697
3764
  // 空格键支持选中复选框
3698
3765
  evnt.preventDefault();
@@ -3723,7 +3790,7 @@ const Methods = {
3723
3790
  // 如果是激活编辑状态,则取消编辑
3724
3791
  if (actived.row) {
3725
3792
  const params = actived.args;
3726
- this.clearEdit(evnt);
3793
+ this.handleClearEdit(evnt);
3727
3794
  // 如果配置了选中功能,则为选中状态
3728
3795
  if (mouseConfig && mouseOpts.selected) {
3729
3796
  this.$nextTick(() => this.handleSelected(params, evnt));
@@ -5554,6 +5621,9 @@ const Methods = {
5554
5621
  this.emitEvent('sort-change', params, evnt);
5555
5622
  }
5556
5623
  },
5624
+ /**
5625
+ * 行拖拽
5626
+ */
5557
5627
  handleRowDragDragstartEvent(evnt) {
5558
5628
  const img = new Image();
5559
5629
  if (evnt.dataTransfer) {
@@ -5566,12 +5636,13 @@ const Methods = {
5566
5636
  const reactData = $xeTable;
5567
5637
  const internalData = $xeTable;
5568
5638
  const {
5569
- treeConfig
5639
+ treeConfig,
5640
+ dragConfig
5570
5641
  } = props;
5571
- const dragOpts = $xeTable.computeDragOpts;
5642
+ const rowDragOpts = $xeTable.computeRowDragOpts;
5572
5643
  const {
5573
5644
  dragEndMethod
5574
- } = dragOpts;
5645
+ } = rowDragOpts;
5575
5646
  const treeOpts = $xeTable.computeTreeOpts;
5576
5647
  const {
5577
5648
  transform
@@ -5587,17 +5658,20 @@ const Methods = {
5587
5658
  prevDragRow,
5588
5659
  prevDragPos
5589
5660
  } = internalData;
5661
+ const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
5662
+ const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
5590
5663
  if (prevDragRow && dragRow) {
5591
5664
  // 判断是否有拖动
5592
5665
  if (prevDragRow !== dragRow) {
5593
- Promise.resolve(dragEndMethod ? dragEndMethod({
5666
+ Promise.resolve(dEndMethod ? dEndMethod({
5594
5667
  oldRow: dragRow,
5595
- newRow: prevDragRow
5668
+ newRow: prevDragRow,
5669
+ dragPos: prevDragPos,
5670
+ offsetIndex: dragOffsetIndex
5596
5671
  }) : true).then(status => {
5597
5672
  if (!status) {
5598
5673
  return;
5599
5674
  }
5600
- const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
5601
5675
  let oafIndex = -1;
5602
5676
  let nafIndex = -1;
5603
5677
  if (treeConfig) {
@@ -5634,18 +5708,19 @@ const Methods = {
5634
5708
  if (!(treeConfig && transform)) {
5635
5709
  $xeTable.updateAfterDataIndex();
5636
5710
  }
5637
- $xeTable.updateFooter();
5638
5711
  $xeTable.checkSelectionStatus();
5639
5712
  if (reactData.scrollYLoad) {
5640
5713
  $xeTable.updateScrollYSpace();
5641
5714
  }
5642
5715
  $xeTable.$nextTick().then(() => {
5643
5716
  $xeTable.updateCellAreas();
5644
- return $xeTable.recalculate();
5717
+ $xeTable.recalculate();
5645
5718
  });
5646
5719
  $xeTable.dispatchEvent('row-dragend', {
5647
5720
  oldRow: dragRow,
5648
5721
  newRow: prevDragRow,
5722
+ dragPos: prevDragPos,
5723
+ offsetIndex: dragOffsetIndex,
5649
5724
  _index: {
5650
5725
  newIndex: nafIndex,
5651
5726
  oldIndex: oafIndex
@@ -5654,10 +5729,10 @@ const Methods = {
5654
5729
  }).catch(() => {});
5655
5730
  }
5656
5731
  }
5657
- hideRowDropTip($xeTable);
5732
+ hideDropTip($xeTable);
5658
5733
  clearRowDropOrigin($xeTable);
5659
- clearRowDropTarget($xeTable);
5660
5734
  reactData.dragRow = null;
5735
+ reactData.dragCol = null;
5661
5736
  setTimeout(() => {
5662
5737
  reactData.isDragRowMove = false;
5663
5738
  }, 500);
@@ -5666,10 +5741,16 @@ const Methods = {
5666
5741
  const $xeTable = this;
5667
5742
  const internalData = $xeTable;
5668
5743
  const reactData = $xeTable;
5744
+ const {
5745
+ dragRow
5746
+ } = reactData;
5747
+ if (!dragRow) {
5748
+ evnt.preventDefault();
5749
+ return;
5750
+ }
5669
5751
  const trEl = evnt.currentTarget;
5670
5752
  const rowid = trEl.getAttribute('rowid');
5671
5753
  const row = $xeTable.getRowById(rowid);
5672
- clearRowDropTarget($xeTable);
5673
5754
  if (row) {
5674
5755
  evnt.preventDefault();
5675
5756
  evnt.preventDefault();
@@ -5678,44 +5759,49 @@ const Methods = {
5678
5759
  } = reactData;
5679
5760
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
5680
5761
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
5681
- updateRowDropTarget($xeTable, row, dragPos);
5682
5762
  internalData.prevDragRow = row;
5683
5763
  internalData.prevDragPos = dragPos;
5764
+ showDropTip($xeTable, evnt, trEl, null, dragPos);
5684
5765
  $xeTable.dispatchEvent('row-dragover', {
5685
5766
  oldRow: dragRow,
5686
5767
  targetRow: row,
5687
5768
  dragPos
5688
5769
  }, evnt);
5689
5770
  }
5690
- showRowDropTip(evnt, $xeTable);
5691
5771
  },
5692
5772
  handleCellDragMousedownEvent(evnt, params) {
5693
5773
  var _a;
5694
5774
  const $xeTable = this;
5775
+ const props = $xeTable;
5695
5776
  const reactData = $xeTable;
5696
5777
  evnt.stopPropagation();
5697
- const dragOpts = $xeTable.computeDragOpts;
5778
+ const {
5779
+ dragConfig
5780
+ } = props;
5781
+ const rowDragOpts = $xeTable.computeRowDragOpts;
5698
5782
  const {
5699
5783
  dragStartMethod
5700
- } = dragOpts;
5784
+ } = rowDragOpts;
5701
5785
  const {
5702
5786
  row
5703
5787
  } = params;
5704
5788
  const dragEl = evnt.currentTarget;
5705
- const tdEl = (_a = dragEl.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode;
5706
- const trEl = tdEl.parentNode;
5789
+ const tdEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
5790
+ const trEl = tdEl.parentElement;
5791
+ const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
5707
5792
  reactData.isDragRowMove = false;
5708
5793
  clearRowDropOrigin($xeTable);
5709
- if (dragStartMethod && !dragStartMethod(params)) {
5794
+ if (dStartMethod && !dStartMethod(params)) {
5710
5795
  trEl.draggable = false;
5711
5796
  reactData.dragRow = null;
5712
- hideRowDropTip($xeTable);
5797
+ reactData.dragCol = null;
5798
+ hideDropTip($xeTable);
5713
5799
  return;
5714
5800
  }
5715
5801
  reactData.dragRow = row;
5802
+ reactData.dragCol = null;
5716
5803
  trEl.draggable = true;
5717
5804
  updateRowDropOrigin($xeTable, row);
5718
- showRowDropTip(evnt, $xeTable);
5719
5805
  updateRowDropTipContent($xeTable, tdEl);
5720
5806
  $xeTable.dispatchEvent('row-dragstart', params, evnt);
5721
5807
  },
@@ -5723,10 +5809,176 @@ const Methods = {
5723
5809
  const $xeTable = this;
5724
5810
  const reactData = $xeTable;
5725
5811
  clearRowDropOrigin($xeTable);
5726
- hideRowDropTip($xeTable);
5812
+ hideDropTip($xeTable);
5727
5813
  reactData.dragRow = null;
5814
+ reactData.dragCol = null;
5728
5815
  reactData.isDragRowMove = false;
5729
5816
  },
5817
+ /**
5818
+ * 列拖拽
5819
+ */
5820
+ handleHeaderCellDragDragstartEvent(evnt) {
5821
+ const img = new Image();
5822
+ if (evnt.dataTransfer) {
5823
+ evnt.dataTransfer.setDragImage(img, 0, 0);
5824
+ }
5825
+ },
5826
+ handleHeaderCellDragDragendEvent(evnt) {
5827
+ const $xeTable = this;
5828
+ const props = $xeTable;
5829
+ const reactData = $xeTable;
5830
+ const internalData = $xeTable;
5831
+ const {
5832
+ mouseConfig
5833
+ } = props;
5834
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
5835
+ const {
5836
+ dragEndMethod
5837
+ } = columnDragOpts;
5838
+ const {
5839
+ dragCol
5840
+ } = reactData;
5841
+ const {
5842
+ collectColumn,
5843
+ prevDragCol,
5844
+ prevDragPos
5845
+ } = internalData;
5846
+ const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
5847
+ if (prevDragCol && dragCol) {
5848
+ // 判断是否有拖动
5849
+ if (prevDragCol !== dragCol) {
5850
+ Promise.resolve(dragEndMethod ? dragEndMethod({
5851
+ oldColumn: dragCol,
5852
+ newColumn: prevDragCol,
5853
+ dragPos: prevDragPos,
5854
+ offsetIndex: dragOffsetIndex
5855
+ }) : true).then(status => {
5856
+ if (!status) {
5857
+ return;
5858
+ }
5859
+ _xeUtils.default.eachTree(collectColumn, (column, index, items, path, parent) => {
5860
+ if (!parent) {
5861
+ const sortIndex = index + 1;
5862
+ column.renderSortNumber = sortIndex;
5863
+ }
5864
+ });
5865
+ const oafIndex = _xeUtils.default.findIndexOf(collectColumn, item => item.id === dragCol.id);
5866
+ const nafIndex = _xeUtils.default.findIndexOf(collectColumn, item => item.id === prevDragCol.id) + dragOffsetIndex;
5867
+ const newTargetCol = collectColumn[nafIndex];
5868
+ if (newTargetCol) {
5869
+ // 插入最后位置
5870
+ dragCol.renderSortNumber = newTargetCol.renderSortNumber;
5871
+ newTargetCol.renderSortNumber = dragCol.renderSortNumber + 0.5;
5872
+ } else {
5873
+ // 插入新位置
5874
+ dragCol.renderSortNumber = collectColumn.length + 1.5;
5875
+ }
5876
+ reactData.isDragColMove = true;
5877
+ if (mouseConfig) {
5878
+ if ($xeTable.clearSelected) {
5879
+ $xeTable.clearSelected();
5880
+ }
5881
+ if ($xeTable.clearCellAreas) {
5882
+ $xeTable.clearCellAreas();
5883
+ $xeTable.clearCopyCellArea();
5884
+ }
5885
+ }
5886
+ $xeTable.analyColumnWidth();
5887
+ $xeTable.$nextTick().then(() => {
5888
+ $xeTable.updateCellAreas();
5889
+ $xeTable.refreshColumn(true);
5890
+ });
5891
+ $xeTable.dispatchEvent('column-dragend', {
5892
+ oldColumn: dragCol,
5893
+ newColumn: prevDragCol,
5894
+ dragPos: prevDragPos,
5895
+ offsetIndex: dragOffsetIndex,
5896
+ _index: {
5897
+ newIndex: nafIndex,
5898
+ oldIndex: oafIndex
5899
+ }
5900
+ }, evnt);
5901
+ }).catch(() => {});
5902
+ }
5903
+ }
5904
+ hideDropTip($xeTable);
5905
+ clearColDropOrigin($xeTable);
5906
+ reactData.dragRow = null;
5907
+ reactData.dragCol = null;
5908
+ setTimeout(() => {
5909
+ reactData.isDragColMove = false;
5910
+ }, 500);
5911
+ },
5912
+ handleHeaderCellDragDragoverEvent(evnt) {
5913
+ const $xeTable = this;
5914
+ const reactData = $xeTable;
5915
+ const internalData = $xeTable;
5916
+ const {
5917
+ dragCol
5918
+ } = reactData;
5919
+ if (!dragCol) {
5920
+ evnt.preventDefault();
5921
+ return;
5922
+ }
5923
+ const thEl = evnt.currentTarget;
5924
+ const colid = thEl.getAttribute('colid');
5925
+ const column = $xeTable.getColumnById(colid);
5926
+ if (column) {
5927
+ evnt.preventDefault();
5928
+ const {
5929
+ dragCol
5930
+ } = reactData;
5931
+ const offsetX = evnt.clientX - thEl.getBoundingClientRect().x;
5932
+ const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
5933
+ internalData.prevDragCol = column;
5934
+ internalData.prevDragPos = dragPos;
5935
+ showDropTip($xeTable, evnt, null, thEl, dragPos);
5936
+ $xeTable.dispatchEvent('column-dragover', {
5937
+ oldColumn: dragCol,
5938
+ targetColumn: column,
5939
+ dragPos
5940
+ }, evnt);
5941
+ }
5942
+ },
5943
+ handleHeaderCellDragMousedownEvent(evnt, params) {
5944
+ var _a;
5945
+ const $xeTable = this;
5946
+ const reactData = $xeTable;
5947
+ evnt.stopPropagation();
5948
+ const columnDragOpts = $xeTable.computeColumnDragOpts;
5949
+ const {
5950
+ dragStartMethod
5951
+ } = columnDragOpts;
5952
+ const {
5953
+ column
5954
+ } = params;
5955
+ const dragEl = evnt.currentTarget;
5956
+ const thEl = (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
5957
+ reactData.isDragColMove = false;
5958
+ clearColDropOrigin($xeTable);
5959
+ if (dragStartMethod && !dragStartMethod(params)) {
5960
+ thEl.draggable = false;
5961
+ reactData.dragRow = null;
5962
+ reactData.dragCol = null;
5963
+ hideDropTip($xeTable);
5964
+ return;
5965
+ }
5966
+ reactData.dragCol = column;
5967
+ reactData.dragRow = null;
5968
+ thEl.draggable = true;
5969
+ updateColDropOrigin($xeTable, column);
5970
+ updateColDropTipContent($xeTable, thEl);
5971
+ $xeTable.dispatchEvent('column-dragstart', params, evnt);
5972
+ },
5973
+ handleHeaderCellDragMouseupEvent() {
5974
+ const $xeTable = this;
5975
+ const reactData = $xeTable;
5976
+ clearColDropOrigin($xeTable);
5977
+ hideDropTip($xeTable);
5978
+ reactData.dragRow = null;
5979
+ reactData.dragCol = null;
5980
+ reactData.isDragColMove = false;
5981
+ },
5730
5982
  setPendingRow(rows, status) {
5731
5983
  const pendingMaps = Object.assign({}, this.pendingRowMaps);
5732
5984
  const pendingList = [...this.pendingRowList];
@@ -7546,8 +7798,8 @@ const Methods = {
7546
7798
  }
7547
7799
  },
7548
7800
  updateCellAreas() {
7549
- if (this.mouseConfig && this.mouseOpts.area && this.handleUpdateCellAreas) {
7550
- return this.handleUpdateCellAreas();
7801
+ if (this.mouseConfig && this.mouseOpts.area && this.handleRecalculateCellAreas) {
7802
+ return this.handleRecalculateCellAreas();
7551
7803
  }
7552
7804
  return this.$nextTick();
7553
7805
  },
@@ -7617,7 +7869,7 @@ const Methods = {
7617
7869
  }
7618
7870
  };
7619
7871
  // Module methods
7620
- const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
7872
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
7621
7873
  funcs.forEach(name => {
7622
7874
  Methods[name] = function (...args) {
7623
7875
  if (process.env.NODE_ENV === 'development') {