vxe-table 3.18.0 → 3.18.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 (45) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/edit/mixin.js +58 -20
  3. package/es/table/module/filter/mixin.js +12 -10
  4. package/es/table/module/menu/mixin.js +16 -9
  5. package/es/table/module/validator/mixin.js +4 -2
  6. package/es/table/src/methods.js +344 -46
  7. package/es/table/src/store.js +8 -0
  8. package/es/table/src/table.js +26 -9
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +518 -104
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/edit/mixin.js +55 -16
  15. package/lib/table/module/edit/mixin.min.js +1 -1
  16. package/lib/table/module/filter/mixin.js +12 -10
  17. package/lib/table/module/filter/mixin.min.js +1 -1
  18. package/lib/table/module/menu/mixin.js +20 -13
  19. package/lib/table/module/menu/mixin.min.js +1 -1
  20. package/lib/table/module/validator/mixin.js +4 -2
  21. package/lib/table/module/validator/mixin.min.js +1 -1
  22. package/lib/table/src/methods.js +388 -52
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/store.js +15 -0
  25. package/lib/table/src/store.min.js +1 -0
  26. package/lib/table/src/table.js +28 -9
  27. package/lib/table/src/table.min.js +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +1 -1
  33. package/packages/table/module/edit/mixin.ts +59 -23
  34. package/packages/table/module/filter/mixin.ts +17 -13
  35. package/packages/table/module/menu/mixin.ts +16 -9
  36. package/packages/table/module/validator/mixin.ts +8 -4
  37. package/packages/table/src/methods.ts +362 -50
  38. package/packages/table/src/store.ts +15 -0
  39. package/packages/table/src/table.ts +27 -9
  40. /package/es/{iconfont.1756083626568.ttf → iconfont.1756272539382.ttf} +0 -0
  41. /package/es/{iconfont.1756083626568.woff → iconfont.1756272539382.woff} +0 -0
  42. /package/es/{iconfont.1756083626568.woff2 → iconfont.1756272539382.woff2} +0 -0
  43. /package/lib/{iconfont.1756083626568.ttf → iconfont.1756272539382.ttf} +0 -0
  44. /package/lib/{iconfont.1756083626568.woff → iconfont.1756272539382.woff} +0 -0
  45. /package/lib/{iconfont.1756083626568.woff2 → iconfont.1756272539382.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -2002,7 +2002,7 @@ function getClass(property, params) {
2002
2002
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2003
2003
 
2004
2004
 
2005
- const version = "3.18.0";
2005
+ const version = "3.18.1";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2678,7 +2678,7 @@ function isNodeElement(elem) {
2678
2678
  const {
2679
2679
  log: log_log
2680
2680
  } = core_.VxeUI;
2681
- const log_version = `table v${"3.18.0"}`;
2681
+ const log_version = `table v${"3.18.1"}`;
2682
2682
  const warnLog = log_log.create('warn', log_version);
2683
2683
  const errLog = log_log.create('error', log_version);
2684
2684
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5730,6 +5730,15 @@ function clearColAnimate(elem, clss) {
5730
5730
  }
5731
5731
  }, 500);
5732
5732
  }
5733
+ ;// CONCATENATED MODULE: ./packages/table/src/store.ts
5734
+ // 跨表拖拽
5735
+ const crossTableDragRowGlobal = {
5736
+ row: null
5737
+ };
5738
+ function getCrossTableDragRowInfo($xeTable) {
5739
+ const crossTableDragRowInfo = $xeTable.crossTableDragRowInfo;
5740
+ return crossTableDragRowInfo;
5741
+ }
5733
5742
  ;// CONCATENATED MODULE: ./packages/table/src/methods.ts
5734
5743
 
5735
5744
 
@@ -5741,6 +5750,7 @@ function clearColAnimate(elem, clss) {
5741
5750
 
5742
5751
 
5743
5752
 
5753
+
5744
5754
  const {
5745
5755
  getConfig: methods_getConfig,
5746
5756
  getI18n: methods_getI18n,
@@ -5754,6 +5764,7 @@ const supportMaxRow = 5e6;
5754
5764
  const customStorageKey = 'VXE_CUSTOM_STORE';
5755
5765
  const maxYHeight = 5e6;
5756
5766
  const maxXWidth = 5e6;
5767
+ let crossTableDragRowObj = null;
5757
5768
  function eqCellValue(row1, row2, field) {
5758
5769
  const val1 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row1, field);
5759
5770
  const val2 = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row2, field);
@@ -7001,20 +7012,25 @@ function updateStyle($xeTable) {
7001
7012
  emptyPlaceholderElem.style.top = `${tHeaderHeight}px`;
7002
7013
  emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : '';
7003
7014
  }
7015
+ const scrollbarXConf = scrollbarOpts.x || {};
7004
7016
  const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
7017
+ const scrollbarYConf = scrollbarOpts.y || {};
7005
7018
  const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
7006
7019
  let xScrollbarVisible = overflowX ? 'visible' : 'hidden';
7007
- if ($xeGanttView) {
7020
+ if (scrollbarXConf.visible === 'visible' || $xeGanttView) {
7008
7021
  osbHeight = scrollbarHeight;
7009
7022
  xScrollbarVisible = 'visible';
7010
- } else if (scrollbarOpts.x && scrollbarOpts.x.visible === false) {
7023
+ } else if (scrollbarXConf.visible === 'hidden' || scrollbarXConf.visible === false) {
7011
7024
  osbHeight = 0;
7012
7025
  xScrollbarVisible = 'hidden';
7013
7026
  }
7014
7027
  let yScrollbarVisible = overflowY ? 'visible' : 'hidden';
7015
- if (scrollbarOpts.y && scrollbarOpts.y.visible === false || $xeGanttView && !scrollbarYToLeft) {
7028
+ if (scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false || $xeGanttView && !scrollbarYToLeft) {
7016
7029
  osbWidth = 0;
7017
7030
  yScrollbarVisible = 'hidden';
7031
+ } else if (scrollbarYConf.visible === 'visible') {
7032
+ osbWidth = scrollbarWidth;
7033
+ yScrollbarVisible = 'visible';
7018
7034
  }
7019
7035
  let tbHeight = 0;
7020
7036
  let bodyMaxHeight = 0;
@@ -8587,6 +8603,11 @@ function handleTargetEnterEvent($xeTable, isClear) {
8587
8603
  }
8588
8604
  }
8589
8605
  }
8606
+ function clearCrossTableDragStatus($xeTable) {
8607
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
8608
+ crossTableDragRowObj = null;
8609
+ crossTableDragRowInfo.row = null;
8610
+ }
8590
8611
  function clearDragStatus($xeTable) {
8591
8612
  const reactData = $xeTable;
8592
8613
  const {
@@ -8597,6 +8618,7 @@ function clearDragStatus($xeTable) {
8597
8618
  clearColDropOrigin($xeTable);
8598
8619
  clearRowDropOrigin($xeTable);
8599
8620
  hideDropTip($xeTable);
8621
+ clearCrossTableDragStatus($xeTable);
8600
8622
  reactData.dragRow = null;
8601
8623
  reactData.dragCol = null;
8602
8624
  }
@@ -8801,6 +8823,26 @@ function hideDropTip($xeTable) {
8801
8823
  cdLineEl.style.display = '';
8802
8824
  }
8803
8825
  }
8826
+ function clearRowDragData($xeTable) {
8827
+ const $xeGantt = $xeTable.$xeGantt;
8828
+ const reactData = $xeTable;
8829
+ const internalData = $xeTable;
8830
+ let wrapperEl = $xeTable.$refs.refElem;
8831
+ const dtClss = ['.vxe-body--row'];
8832
+ if ($xeGantt) {
8833
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
8834
+ if (ganttContainerElem) {
8835
+ wrapperEl = ganttContainerElem;
8836
+ }
8837
+ dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
8838
+ }
8839
+ hideDropTip($xeTable);
8840
+ clearRowDropOrigin($xeTable);
8841
+ clearRowAnimate(wrapperEl, dtClss);
8842
+ internalData.prevDragToChild = false;
8843
+ reactData.dragRow = null;
8844
+ reactData.dragCol = null;
8845
+ }
8804
8846
  /**
8805
8847
  * 处理显示 tooltip
8806
8848
  * @param {Event} evnt 事件
@@ -11362,7 +11404,9 @@ const Methods = {
11362
11404
  }
11363
11405
  }
11364
11406
  }
11365
- return $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
11407
+ const rest = $xeTable.handleRowDragSwapEvent(null, true, dragRow, prevDragRow, dragPos || defPos, dragToChild === true);
11408
+ clearRowDragData($xeTable);
11409
+ return rest;
11366
11410
  },
11367
11411
  /**
11368
11412
  * 获取表格的全量列
@@ -12946,7 +12990,7 @@ const Methods = {
12946
12990
  // 如果点击了当前表格之外
12947
12991
  !getEventTargetNode(evnt, $el).flag) {
12948
12992
  setTimeout(() => {
12949
- this.handleClearEdit(evnt).then(() => {
12993
+ $xeTable.handleClearEdit(evnt).then(() => {
12950
12994
  // 如果存在校验,点击了表格之外则清除
12951
12995
  if (!this.isActivated && editRules && validOpts.autoClear) {
12952
12996
  this.validErrorMaps = {};
@@ -12961,17 +13005,17 @@ const Methods = {
12961
13005
  }
12962
13006
  } else if (mouseConfig) {
12963
13007
  if (!getEventTargetNode(evnt, $el).flag && !($xeGGWrapper && getEventTargetNode(evnt, $xeGGWrapper.$el).flag) && !(tableMenu && getEventTargetNode(evnt, tableMenu.$el).flag) && !($toolbar && getEventTargetNode(evnt, $toolbar.$el).flag)) {
12964
- if (this.clearSelected) {
12965
- this.clearSelected();
13008
+ if ($xeTable.clearSelected) {
13009
+ $xeTable.clearSelected();
12966
13010
  }
12967
13011
  if (areaOpts.autoClear) {
12968
- if (this.getCellAreas) {
12969
- const cellAreas = this.getCellAreas();
13012
+ if ($xeTable.getCellAreas) {
13013
+ const cellAreas = $xeTable.getCellAreas();
12970
13014
  if (cellAreas && cellAreas.length && !getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
12971
- this.preventEvent(evnt, 'event.clearAreas', {}, () => {
12972
- this.clearCellAreas();
12973
- this.clearCopyCellArea();
12974
- this.emitEvent('clear-cell-area-selection', {
13015
+ $xeTable.preventEvent(evnt, 'event.clearAreas', {}, () => {
13016
+ $xeTable.clearCellAreas();
13017
+ $xeTable.clearCopyCellArea();
13018
+ $xeTable.dispatchEvent('clear-cell-area-selection', {
12975
13019
  cellAreas
12976
13020
  }, evnt);
12977
13021
  });
@@ -13010,6 +13054,7 @@ const Methods = {
13010
13054
  * 表格键盘事件
13011
13055
  */
13012
13056
  keydownEvent(evnt) {
13057
+ const $xeTable = this;
13013
13058
  const {
13014
13059
  filterStore,
13015
13060
  ctxMenuStore,
@@ -13028,7 +13073,7 @@ const Methods = {
13028
13073
  const isEsc = keyCode === 27;
13029
13074
  if (isEsc) {
13030
13075
  this.preventEvent(evnt, 'event.keydown', null, () => {
13031
- this.emitEvent('keydown-start', {}, evnt);
13076
+ $xeTable.dispatchEvent('keydown-start', {}, evnt);
13032
13077
  if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardCellAreaEvent) {
13033
13078
  this.handleKeyboardCellAreaEvent(evnt);
13034
13079
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
@@ -13048,8 +13093,8 @@ const Methods = {
13048
13093
  }
13049
13094
  }
13050
13095
  }
13051
- this.emitEvent('keydown', {}, evnt);
13052
- this.emitEvent('keydown-end', {}, evnt);
13096
+ $xeTable.dispatchEvent('keydown', {}, evnt);
13097
+ $xeTable.dispatchEvent('keydown-end', {}, evnt);
13053
13098
  });
13054
13099
  }
13055
13100
  },
@@ -13390,6 +13435,7 @@ const Methods = {
13390
13435
  }
13391
13436
  },
13392
13437
  handleGlobalPasteEvent(evnt) {
13438
+ const $xeTable = this;
13393
13439
  const {
13394
13440
  isActivated,
13395
13441
  keyboardConfig,
@@ -13408,10 +13454,11 @@ const Methods = {
13408
13454
  this.handlePasteCellAreaEvent(evnt);
13409
13455
  }
13410
13456
  }
13411
- this.emitEvent('paste', {}, evnt);
13457
+ $xeTable.dispatchEvent('paste', {}, evnt);
13412
13458
  }
13413
13459
  },
13414
13460
  handleGlobalCopyEvent(evnt) {
13461
+ const $xeTable = this;
13415
13462
  const {
13416
13463
  isActivated,
13417
13464
  keyboardConfig,
@@ -13430,10 +13477,11 @@ const Methods = {
13430
13477
  this.handleCopyCellAreaEvent(evnt);
13431
13478
  }
13432
13479
  }
13433
- this.emitEvent('copy', {}, evnt);
13480
+ $xeTable.dispatchEvent('copy', {}, evnt);
13434
13481
  }
13435
13482
  },
13436
13483
  handleGlobalCutEvent(evnt) {
13484
+ const $xeTable = this;
13437
13485
  const {
13438
13486
  isActivated,
13439
13487
  keyboardConfig,
@@ -13452,7 +13500,7 @@ const Methods = {
13452
13500
  this.handleCutCellAreaEvent(evnt);
13453
13501
  }
13454
13502
  }
13455
- this.emitEvent('cut', {}, evnt);
13503
+ $xeTable.dispatchEvent('cut', {}, evnt);
13456
13504
  }
13457
13505
  },
13458
13506
  handleGlobalResizeEvent() {
@@ -14858,7 +14906,8 @@ const Methods = {
14858
14906
  return $xeTable.$nextTick();
14859
14907
  },
14860
14908
  triggerHeaderCellDblclickEvent(evnt, params) {
14861
- this.emitEvent('header-cell-dblclick', Object.assign({
14909
+ const $xeTable = this;
14910
+ $xeTable.dispatchEvent('header-cell-dblclick', Object.assign({
14862
14911
  cell: evnt.currentTarget
14863
14912
  }, params), evnt);
14864
14913
  },
@@ -15076,7 +15125,7 @@ const Methods = {
15076
15125
  }
15077
15126
  }
15078
15127
  }
15079
- this.emitEvent('cell-dblclick', params, evnt);
15128
+ $xeTable.dispatchEvent('cell-dblclick', params, evnt);
15080
15129
  },
15081
15130
  handleColumnSortEvent(evnt, column) {
15082
15131
  const $xeTable = this;
@@ -15575,12 +15624,273 @@ const Methods = {
15575
15624
  }
15576
15625
  return Promise.resolve(errRest);
15577
15626
  },
15578
- handleRowDragDragendEvent(evnt) {
15627
+ /**
15628
+ * 处理跨表拖拽完成
15629
+ */
15630
+ handleCrossTableRowDragFinishEvent(evnt) {
15631
+ const $xeTable = this;
15632
+ const $xeGantt = $xeTable.$xeGantt;
15633
+ const reactData = $xeTable;
15634
+ const internalData = $xeTable;
15635
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
15636
+ const {
15637
+ tableData
15638
+ } = reactData;
15639
+ const {
15640
+ fullAllDataRowIdData
15641
+ } = internalData;
15642
+ const rowOpts = $xeTable.computeRowOpts;
15643
+ const cellOpts = $xeTable.computeCellOpts;
15644
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
15645
+ const rowDragOpts = $xeTable.computeRowDragOpts;
15646
+ const {
15647
+ animation,
15648
+ isCrossTableDrag
15649
+ } = rowDragOpts;
15650
+ const treeOpts = $xeTable.computeTreeOpts;
15651
+ const {
15652
+ mapChildrenField
15653
+ } = treeOpts;
15654
+ const el = $xeTable.$refs.refElem;
15655
+ if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
15656
+ const {
15657
+ row: dragRow
15658
+ } = crossTableDragRowInfo;
15659
+ if (dragRow) {
15660
+ const dragRowid = getRowid($xeTable, dragRow);
15661
+ const dragRowRest = fullAllDataRowIdData[dragRowid];
15662
+ let dragRowHeight = 0;
15663
+ let rsIndex = -1;
15664
+ if (dragRowRest) {
15665
+ if (animation) {
15666
+ dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
15667
+ }
15668
+ rsIndex = dragRowRest.$index;
15669
+ }
15670
+ const dragRangeList = rsIndex > -1 && rsIndex < tableData.length - 1 ? tableData.slice(rsIndex + 1) : [];
15671
+ const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
15672
+ updated: true,
15673
+ children: mapChildrenField
15674
+ });
15675
+ $xeTable.remove(dragList).then(() => {
15676
+ if (animation && dragRowHeight && dragRangeList.length) {
15677
+ const $xeGanttView = internalData.xeGanttView;
15678
+ let wrapperEl = el;
15679
+ if ($xeGantt && $xeGanttView) {
15680
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
15681
+ if (ganttContainerElem) {
15682
+ wrapperEl = ganttContainerElem;
15683
+ }
15684
+ }
15685
+ const dtClss = [];
15686
+ dragRangeList.forEach(row => {
15687
+ const rowid = getRowid($xeTable, row);
15688
+ dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
15689
+ if ($xeGantt) {
15690
+ dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
15691
+ }
15692
+ });
15693
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
15694
+ moveRowAnimateToTb(dtTrList, dragRowHeight);
15695
+ }
15696
+ });
15697
+ $xeTable.dispatchEvent('row-remove-dragend', {
15698
+ row: dragRow
15699
+ }, evnt);
15700
+ clearRowDragData($xeTable);
15701
+ clearCrossTableDragStatus($xeTable);
15702
+ }
15703
+ }
15704
+ },
15705
+ /**
15706
+ * 处理跨表拖至新的空表
15707
+ */
15708
+ handleCrossTableRowDragoverEmptyEvent(evnt) {
15709
+ const $xeTable = this;
15710
+ const reactData = $xeTable;
15711
+ const internalData = $xeTable;
15712
+ const {
15713
+ tableData
15714
+ } = reactData;
15715
+ const rowDragOpts = $xeTable.computeRowDragOpts;
15716
+ const {
15717
+ isCrossTableDrag
15718
+ } = rowDragOpts;
15719
+ if (isCrossTableDrag && crossTableDragRowObj && !tableData.length) {
15720
+ const {
15721
+ $oldTable
15722
+ } = crossTableDragRowObj;
15723
+ if ($oldTable && $oldTable.xID !== $xeTable.xID) {
15724
+ evnt.preventDefault();
15725
+ crossTableDragRowObj.$newTable = $xeTable;
15726
+ internalData.prevDragRow = null;
15727
+ }
15728
+ }
15729
+ },
15730
+ /**
15731
+ * 处理跨表拖插入
15732
+ */
15733
+ handleCrossTableRowDragInsertEvent(evnt) {
15579
15734
  const $xeTable = this;
15580
15735
  const $xeGantt = $xeTable.$xeGantt;
15581
15736
  const props = $xeTable;
15582
15737
  const reactData = $xeTable;
15583
15738
  const internalData = $xeTable;
15739
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
15740
+ const {
15741
+ treeConfig
15742
+ } = props;
15743
+ const {
15744
+ prevDragRow,
15745
+ prevDragPos,
15746
+ prevDragToChild
15747
+ } = internalData;
15748
+ const rowDragOpts = $xeTable.computeRowDragOpts;
15749
+ const {
15750
+ animation,
15751
+ isSelfToChildDrag,
15752
+ isCrossTableDrag,
15753
+ dragEndMethod,
15754
+ dragToChildMethod
15755
+ } = rowDragOpts;
15756
+ const rowOpts = $xeTable.computeRowOpts;
15757
+ const cellOpts = $xeTable.computeCellOpts;
15758
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
15759
+ const treeOpts = $xeTable.computeTreeOpts;
15760
+ const {
15761
+ parentField,
15762
+ mapChildrenField
15763
+ } = treeOpts;
15764
+ const childrenField = treeOpts.children || treeOpts.childrenField;
15765
+ // 跨表拖拽
15766
+ if (isCrossTableDrag && crossTableDragRowObj && crossTableDragRowInfo) {
15767
+ const {
15768
+ row: oldRow
15769
+ } = crossTableDragRowInfo;
15770
+ const {
15771
+ $oldTable
15772
+ } = crossTableDragRowObj;
15773
+ const el = $xeTable.$refs.refElem;
15774
+ if ($oldTable && oldRow) {
15775
+ const dragRow = oldRow;
15776
+ let dragOffsetIndex = -1;
15777
+ if (prevDragRow) {
15778
+ dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
15779
+ }
15780
+ const dragParams = {
15781
+ oldRow: dragRow,
15782
+ newRow: prevDragRow,
15783
+ dragRow,
15784
+ dragPos: prevDragPos,
15785
+ dragToChild: !!prevDragToChild,
15786
+ offsetIndex: dragOffsetIndex
15787
+ };
15788
+ const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
15789
+ const errRest = {
15790
+ status: false
15791
+ };
15792
+ Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then(status => {
15793
+ if (!status) {
15794
+ return errRest;
15795
+ }
15796
+ let insertRest = Promise.resolve();
15797
+ if (treeConfig) {
15798
+ const dragList = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray([dragRow], {
15799
+ updated: true,
15800
+ children: mapChildrenField
15801
+ });
15802
+ $oldTable.handleCrossTableRowDragFinishEvent(evnt);
15803
+ if (prevDragRow) {
15804
+ dragRow[parentField] = prevDragRow[parentField];
15805
+ } else {
15806
+ dragRow[parentField] = null;
15807
+ }
15808
+ dragList.forEach(row => {
15809
+ row[childrenField] = undefined;
15810
+ row[mapChildrenField] = undefined;
15811
+ });
15812
+ if (prevDragRow) {
15813
+ if (prevDragPos === 'bottom') {
15814
+ insertRest = $xeTable.insertNextAt(dragList, prevDragRow);
15815
+ } else {
15816
+ insertRest = $xeTable.insertAt(dragList, prevDragRow);
15817
+ }
15818
+ } else {
15819
+ insertRest = $xeTable.insert(dragList);
15820
+ }
15821
+ } else {
15822
+ $oldTable.handleCrossTableRowDragFinishEvent(evnt);
15823
+ if (prevDragRow) {
15824
+ if (prevDragPos === 'bottom') {
15825
+ insertRest = $xeTable.insertNextAt(dragRow, prevDragRow);
15826
+ } else {
15827
+ insertRest = $xeTable.insertAt(dragRow, prevDragRow);
15828
+ }
15829
+ } else {
15830
+ insertRest = $xeTable.insert(dragRow);
15831
+ }
15832
+ }
15833
+ $xeTable.dispatchEvent('row-insert-dragend', {
15834
+ oldRow,
15835
+ newRow: prevDragRow,
15836
+ dragRow,
15837
+ dragPos: prevDragPos,
15838
+ dragToChild: isDragToChildFlag,
15839
+ offsetIndex: dragOffsetIndex
15840
+ }, evnt);
15841
+ clearRowDragData($xeTable);
15842
+ insertRest.then(() => {
15843
+ const {
15844
+ tableData
15845
+ } = reactData;
15846
+ const {
15847
+ fullAllDataRowIdData
15848
+ } = internalData;
15849
+ const oldRowid = getRowid($xeTable, dragRow);
15850
+ const oldRowRest = fullAllDataRowIdData[oldRowid];
15851
+ let dragRowHeight = 0;
15852
+ let rsIndex = -1;
15853
+ if (oldRowRest) {
15854
+ if (animation) {
15855
+ dragRowHeight = getCellRestHeight(oldRowRest, cellOpts, rowOpts, defaultRowHeight);
15856
+ }
15857
+ rsIndex = oldRowRest.$index;
15858
+ }
15859
+ const dragRangeList = rsIndex > -1 ? tableData.slice(rsIndex) : [];
15860
+ if (animation && dragRowHeight && dragRangeList.length) {
15861
+ const $xeGanttView = internalData.xeGanttView;
15862
+ let wrapperEl = el;
15863
+ if ($xeGantt && $xeGanttView) {
15864
+ const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
15865
+ if (ganttContainerElem) {
15866
+ wrapperEl = ganttContainerElem;
15867
+ }
15868
+ }
15869
+ const dtClss = [];
15870
+ dragRangeList.forEach(row => {
15871
+ const rowid = getRowid($xeTable, row);
15872
+ dtClss.push(`.vxe-body--row[rowid="${rowid}"]`);
15873
+ if ($xeGantt) {
15874
+ dtClss.push(`.vxe-gantt-view--body-row[rowid="${rowid}"]`, `.vxe-gantt-view--chart-row[rowid="${rowid}"]`);
15875
+ }
15876
+ });
15877
+ const dtTrList = wrapperEl.querySelectorAll(dtClss.join(','));
15878
+ moveRowAnimateToTb(dtTrList, -dragRowHeight);
15879
+ }
15880
+ });
15881
+ });
15882
+ }
15883
+ }
15884
+ },
15885
+ hideCrossTableRowDropClearStatus() {
15886
+ const $xeTable = this;
15887
+ hideDropTip($xeTable);
15888
+ },
15889
+ handleRowDragDragendEvent(evnt) {
15890
+ const $xeTable = this;
15891
+ const props = $xeTable;
15892
+ const reactData = $xeTable;
15893
+ const internalData = $xeTable;
15584
15894
  const {
15585
15895
  treeConfig
15586
15896
  } = props;
@@ -15600,7 +15910,23 @@ const Methods = {
15600
15910
  prevDragRow,
15601
15911
  prevDragPos
15602
15912
  } = internalData;
15603
- let wrapperEl = $xeTable.$refs.refElem;
15913
+ const rowDragOpts = $xeTable.computeRowDragOpts;
15914
+ const {
15915
+ isCrossTableDrag,
15916
+ isCrossDrag
15917
+ } = rowDragOpts;
15918
+ // 跨表拖拽
15919
+ if (isCrossTableDrag && crossTableDragRowObj) {
15920
+ const {
15921
+ $newTable
15922
+ } = crossTableDragRowObj;
15923
+ if ($newTable && $newTable.xID !== $xeTable.xID) {
15924
+ if (!treeConfig || isCrossDrag) {
15925
+ $newTable.handleCrossTableRowDragInsertEvent(evnt);
15926
+ }
15927
+ return;
15928
+ }
15929
+ }
15604
15930
  if (treeConfig && lazy && prevDragToChild) {
15605
15931
  // 懒加载
15606
15932
  const newRowid = getRowid($xeTable, prevDragRow);
@@ -15615,20 +15941,8 @@ const Methods = {
15615
15941
  } else {
15616
15942
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
15617
15943
  }
15618
- const dtClss = ['.vxe-body--row'];
15619
- if ($xeGantt) {
15620
- const ganttContainerElem = $xeGantt.$refs.refGanttContainerElem;
15621
- if (ganttContainerElem) {
15622
- wrapperEl = ganttContainerElem;
15623
- }
15624
- dtClss.push('.vxe-gantt-view--body-row', '.vxe-gantt-view--chart-row');
15625
- }
15626
- hideDropTip($xeTable);
15627
- clearRowDropOrigin($xeTable);
15628
- clearRowAnimate(wrapperEl, dtClss);
15629
- internalData.prevDragToChild = false;
15630
- reactData.dragRow = null;
15631
- reactData.dragCol = null;
15944
+ clearRowDragData($xeTable);
15945
+ clearCrossTableDragStatus($xeTable);
15632
15946
  },
15633
15947
  handleRowDragDragoverEvent(evnt) {
15634
15948
  const $xeTable = this;
@@ -15655,9 +15969,10 @@ const Methods = {
15655
15969
  const {
15656
15970
  isPeerDrag,
15657
15971
  isCrossDrag,
15658
- isToChildDrag
15972
+ isToChildDrag,
15973
+ isCrossTableDrag
15659
15974
  } = rowDragOpts;
15660
- if (!dragRow) {
15975
+ if (!dragRow && !(isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj)) {
15661
15976
  evnt.preventDefault();
15662
15977
  return;
15663
15978
  }
@@ -15666,18 +15981,40 @@ const Methods = {
15666
15981
  const rowid = trEl.getAttribute('rowid') || '';
15667
15982
  const rest = fullAllDataRowIdData[rowid];
15668
15983
  if (rest) {
15984
+ evnt.preventDefault();
15669
15985
  const row = rest.row;
15670
15986
  const rowid = getRowid($xeTable, row);
15671
15987
  const rowRest = fullAllDataRowIdData[rowid];
15672
- evnt.preventDefault();
15673
- const {
15674
- dragRow
15675
- } = reactData;
15676
15988
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
15677
15989
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
15678
- internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && isControlKey);
15990
+ internalData.prevDragToChild = !!(treeConfig && transform && isCrossDrag && isToChildDrag && isControlKey);
15679
15991
  internalData.prevDragRow = row;
15680
15992
  internalData.prevDragPos = dragPos;
15993
+ // 跨表拖拽
15994
+ if (isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj) {
15995
+ const {
15996
+ $oldTable,
15997
+ $newTable
15998
+ } = crossTableDragRowObj;
15999
+ if ($oldTable) {
16000
+ const oldTableReactData = $oldTable;
16001
+ if ($oldTable.xID === $xeTable.xID) {
16002
+ if ($newTable) {
16003
+ $newTable.hideCrossTableRowDropClearStatus();
16004
+ }
16005
+ reactData.isCrossDragRow = false;
16006
+ oldTableReactData.isCrossDragRow = false;
16007
+ crossTableDragRowObj.$newTable = null;
16008
+ } else if (!treeConfig || isCrossDrag) {
16009
+ $oldTable.hideCrossTableRowDropClearStatus();
16010
+ oldTableReactData.isCrossDragRow = true;
16011
+ reactData.dragTipText = oldTableReactData.dragTipText;
16012
+ crossTableDragRowObj.$newTable = $xeTable;
16013
+ showDropTip($xeTable, evnt, trEl, null, true, dragPos);
16014
+ return;
16015
+ }
16016
+ }
16017
+ }
15681
16018
  if ($xeTable.eqRow(dragRow, row) || isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
15682
16019
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
15683
16020
  return;
@@ -15694,12 +16031,14 @@ const Methods = {
15694
16031
  const $xeTable = this;
15695
16032
  const props = $xeTable;
15696
16033
  const reactData = $xeTable;
16034
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
15697
16035
  evnt.stopPropagation();
15698
16036
  const {
15699
16037
  dragConfig
15700
16038
  } = props;
15701
16039
  const rowDragOpts = $xeTable.computeRowDragOpts;
15702
16040
  const {
16041
+ isCrossTableDrag,
15703
16042
  trigger,
15704
16043
  dragStartMethod
15705
16044
  } = rowDragOpts;
@@ -15715,10 +16054,19 @@ const Methods = {
15715
16054
  trEl.draggable = false;
15716
16055
  reactData.dragRow = null;
15717
16056
  reactData.dragCol = null;
16057
+ clearCrossTableDragStatus($xeTable);
15718
16058
  hideDropTip($xeTable);
15719
16059
  return;
15720
16060
  }
16061
+ if (isCrossTableDrag) {
16062
+ crossTableDragRowInfo.row = row;
16063
+ crossTableDragRowObj = {
16064
+ $oldTable: $xeTable,
16065
+ $newTable: null
16066
+ };
16067
+ }
15721
16068
  reactData.dragRow = row;
16069
+ reactData.isCrossDragRow = false;
15722
16070
  reactData.dragCol = null;
15723
16071
  trEl.draggable = true;
15724
16072
  updateRowDropOrigin($xeTable, row);
@@ -16064,6 +16412,7 @@ const Methods = {
16064
16412
  internalData.prevDragToChild = false;
16065
16413
  reactData.dragRow = null;
16066
16414
  reactData.dragCol = null;
16415
+ clearCrossTableDragStatus($xeTable);
16067
16416
  },
16068
16417
  handleHeaderCellDragDragoverEvent(evnt) {
16069
16418
  const $xeTable = this;
@@ -16157,11 +16506,13 @@ const Methods = {
16157
16506
  reactData.dragRow = null;
16158
16507
  reactData.dragCol = null;
16159
16508
  hideDropTip($xeTable);
16509
+ clearCrossTableDragStatus($xeTable);
16160
16510
  return;
16161
16511
  }
16162
16512
  reactData.dragCol = column;
16163
16513
  reactData.dragRow = null;
16164
16514
  thEl.draggable = true;
16515
+ clearCrossTableDragStatus($xeTable);
16165
16516
  updateColDropOrigin($xeTable, column);
16166
16517
  updateColDropTipContent($xeTable, thEl);
16167
16518
  $xeTable.dispatchEvent('column-dragstart', params, evnt);
@@ -16171,6 +16522,7 @@ const Methods = {
16171
16522
  const reactData = $xeTable;
16172
16523
  clearColDropOrigin($xeTable);
16173
16524
  hideDropTip($xeTable);
16525
+ clearCrossTableDragStatus($xeTable);
16174
16526
  reactData.dragRow = null;
16175
16527
  reactData.dragCol = null;
16176
16528
  },
@@ -18575,14 +18927,7 @@ const Methods = {
18575
18927
  // 已废弃,使用 dispatchEvent
18576
18928
  emitEvent(type, params, evnt) {
18577
18929
  const $xeTable = this;
18578
- const $xeGrid = $xeTable.$xeGrid;
18579
- const $xeGantt = $xeTable.$xeGantt;
18580
- $xeTable.$emit(type, createEvent(evnt, {
18581
- $table: $xeTable,
18582
- $grid: $xeGrid,
18583
- $gantt: $xeGantt,
18584
- $event: evnt
18585
- }));
18930
+ $xeTable.dispatchEvent(type, params, evnt);
18586
18931
  },
18587
18932
  focus() {
18588
18933
  this.isActivated = true;
@@ -23041,6 +23386,7 @@ const {
23041
23386
  * @param column
23042
23387
  */
23043
23388
  _openFilter(fieldOrColumn) {
23389
+ const $xeTable = this;
23044
23390
  const column = handleFieldOrColumn(this, fieldOrColumn);
23045
23391
  if (column && column.filters) {
23046
23392
  const {
@@ -23049,7 +23395,7 @@ const {
23049
23395
  const {
23050
23396
  fixed
23051
23397
  } = column;
23052
- return this.scrollToColumn(column).then(() => {
23398
+ return $xeTable.scrollToColumn(column).then(() => {
23053
23399
  const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
23054
23400
  if (headerWrapperElem) {
23055
23401
  const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
@@ -23057,7 +23403,7 @@ const {
23057
23403
  }
23058
23404
  });
23059
23405
  }
23060
- return this.$nextTick();
23406
+ return $xeTable.$nextTick();
23061
23407
  },
23062
23408
  /**
23063
23409
  * 修改筛选条件列表
@@ -23278,9 +23624,9 @@ const {
23278
23624
  datas.push(item.data);
23279
23625
  }
23280
23626
  });
23281
- const filterList = this.getCheckedFilters();
23627
+ const filterList = $xeTable.getCheckedFilters();
23282
23628
  const params = {
23283
- $table: this,
23629
+ $table: $xeTable,
23284
23630
  $event: evnt,
23285
23631
  column,
23286
23632
  field,
@@ -23292,21 +23638,21 @@ const {
23292
23638
  };
23293
23639
  // 如果是服务端筛选,则跳过本地筛选处理
23294
23640
  if (!filterOpts.remote) {
23295
- this.handleTableData(true);
23296
- this.checkSelectionStatus();
23641
+ $xeTable.handleTableData(true);
23642
+ $xeTable.checkSelectionStatus();
23297
23643
  }
23298
- if (mouseConfig && mouseOpts.area && this.handleFilterEvent) {
23644
+ if (mouseConfig && mouseOpts.area && $xeTable.handleFilterEvent) {
23299
23645
  $xeTable.handleFilterEvent(evnt, params);
23300
23646
  }
23301
23647
  if (evnt) {
23302
- $xeTable.emitEvent('filter-change', params, evnt);
23648
+ $xeTable.dispatchEvent('filter-change', params, evnt);
23303
23649
  }
23304
23650
  $xeTable.closeFilter();
23305
23651
  return $xeTable.updateFooter().then(() => {
23306
23652
  const {
23307
23653
  scrollXLoad,
23308
23654
  scrollYLoad
23309
- } = this;
23655
+ } = reactData;
23310
23656
  if (oldScrollXLoad || scrollXLoad || oldScrollYLoad || scrollYLoad) {
23311
23657
  if (oldScrollXLoad || scrollXLoad) {
23312
23658
  $xeTable.updateScrollXSpace();
@@ -23341,6 +23687,7 @@ const {
23341
23687
  $xeTable.handleColumnConfirmFilter(column, evnt);
23342
23688
  },
23343
23689
  handleClearFilter(column) {
23690
+ const $xeTable = this;
23344
23691
  if (column) {
23345
23692
  const {
23346
23693
  filters,
@@ -23360,7 +23707,7 @@ const {
23360
23707
  filterResetMethod({
23361
23708
  options: filters,
23362
23709
  column,
23363
- $table: this
23710
+ $table: $xeTable
23364
23711
  });
23365
23712
  }
23366
23713
  }
@@ -23563,26 +23910,33 @@ const {
23563
23910
  };
23564
23911
  if (columnTargetNode.flag) {
23565
23912
  const cell = columnTargetNode.targetElem;
23566
- const column = this.getColumnNode(cell).item;
23913
+ const columnNodeRest = $xeTable.getColumnNode(cell);
23914
+ const column = columnNodeRest ? columnNodeRest.item : null;
23567
23915
  let typePrefix = `${layout}-`;
23568
- Object.assign(params, {
23569
- column,
23570
- columnIndex: this.getColumnIndex(column),
23571
- cell
23572
- });
23916
+ if (column) {
23917
+ Object.assign(params, {
23918
+ column,
23919
+ columnIndex: $xeTable.getColumnIndex(column),
23920
+ cell
23921
+ });
23922
+ }
23573
23923
  if (layout === 'body') {
23574
- const row = this.getRowNode(cell.parentNode).item;
23924
+ const rowNodeRest = $xeTable.getRowNode(cell.parentNode);
23925
+ const row = rowNodeRest ? rowNodeRest.item : null;
23575
23926
  typePrefix = '';
23576
- params.row = row;
23577
- params.rowIndex = this.getRowIndex(row);
23927
+ if (row) {
23928
+ params.row = row;
23929
+ params.rowIndex = $xeTable.getRowIndex(row);
23930
+ }
23578
23931
  }
23932
+ const eventType = `${typePrefix}cell-menu`;
23579
23933
  this.handleOpenMenuEvent(evnt, layout, params);
23580
23934
  // 在 v4 中废弃事件 cell-context-menu、header-cell-context-menu、footer-cell-context-menu
23581
23935
  if (this.$listeners[`${typePrefix}cell-context-menu`]) {
23582
23936
  warnLog('vxe.error.delEvent', [`${typePrefix}cell-context-menu`, `${typePrefix}cell-menu`]);
23583
- this.emitEvent(`${typePrefix}cell-context-menu`, params, evnt);
23937
+ $xeTable.dispatchEvent(`${typePrefix}cell-context-menu`, params, evnt);
23584
23938
  } else {
23585
- this.emitEvent(`${typePrefix}cell-menu`, params, evnt);
23939
+ $xeTable.dispatchEvent(eventType, params, evnt);
23586
23940
  }
23587
23941
  return;
23588
23942
  } else if (getEventTargetNode(evnt, this.$el, `vxe-table--${layout}-wrapper`, target => target.getAttribute('xid') === tId).flag) {
@@ -23765,9 +24119,9 @@ const {
23765
24119
  // 在 v4 中废弃事件 context-menu-click
23766
24120
  if (this.$listeners['context-menu-click']) {
23767
24121
  warnLog('vxe.error.delEvent', ['context-menu-click', 'menu-click']);
23768
- this.emitEvent('context-menu-click', params, evnt);
24122
+ $xeTable.dispatchEvent('context-menu-click', params, evnt);
23769
24123
  } else {
23770
- this.emitEvent('menu-click', params, evnt);
24124
+ $xeTable.dispatchEvent('menu-click', params, evnt);
23771
24125
  }
23772
24126
  this.closeMenu();
23773
24127
  }
@@ -23944,11 +24298,13 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
23944
24298
  tableFullData,
23945
24299
  fullDataRowIdData,
23946
24300
  fullAllDataRowIdData,
23947
- insertRowMaps
24301
+ insertRowMaps,
24302
+ removeRowMaps
23948
24303
  } = internalData;
23949
24304
  const treeOpts = $xeTable.computeTreeOpts;
23950
24305
  const {
23951
24306
  transform,
24307
+ parentField,
23952
24308
  rowField,
23953
24309
  mapChildrenField
23954
24310
  } = treeOpts;
@@ -23960,6 +24316,14 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
23960
24316
  [mapChildrenField]: [],
23961
24317
  [childrenField]: []
23962
24318
  } : {}, record)));
24319
+ let treeRecords = [];
24320
+ if (treeConfig && transform) {
24321
+ treeRecords = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(newRecords, {
24322
+ key: rowField,
24323
+ parentKey: parentField,
24324
+ children: childrenField
24325
+ });
24326
+ }
23963
24327
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(targetRow)) {
23964
24328
  // 如果为虚拟树
23965
24329
  if (treeConfig && transform) {
@@ -24057,21 +24421,26 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
24057
24421
  const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
24058
24422
  const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
24059
24423
  const parentLevel = parentRest ? parentRest.level : 0;
24060
- newRecords.forEach((item, i) => {
24061
- const rowid = getRowid($xeTable, item);
24062
- if (item[treeOpts.parentField]) {
24063
- if (parentRow && item[treeOpts.parentField] !== parentRow[rowField]) {
24064
- errLog('vxe.error.errProp', [`${treeOpts.parentField}=${item[treeOpts.parentField]}`, `${treeOpts.parentField}=${parentRow[rowField]}`]);
24065
- }
24066
- }
24424
+ treeRecords.forEach((row, i) => {
24067
24425
  if (parentRow) {
24068
- item[treeOpts.parentField] = parentRow[rowField];
24426
+ if (row[parentField] !== parentRow[rowField]) {
24427
+ row[parentField] = parentRow[rowField];
24428
+ errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
24429
+ }
24430
+ } else {
24431
+ if (row[parentField] !== null) {
24432
+ row[parentField] = null;
24433
+ errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, 'null']);
24434
+ }
24069
24435
  }
24070
24436
  let targetIndex = matchMapObj.index + i;
24071
24437
  if (isInsertNextRow) {
24072
24438
  targetIndex = targetIndex + 1;
24073
24439
  }
24074
- parentMapChilds.splice(targetIndex, 0, item);
24440
+ parentMapChilds.splice(targetIndex, 0, row);
24441
+ });
24442
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, item => {
24443
+ const rowid = getRowid($xeTable, item);
24075
24444
  const rest = {
24076
24445
  row: item,
24077
24446
  rowid,
@@ -24089,8 +24458,13 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
24089
24458
  oTop: 0,
24090
24459
  expandHeight: 0
24091
24460
  };
24461
+ if (item[childrenField]) {
24462
+ item[mapChildrenField] = item[childrenField];
24463
+ }
24092
24464
  fullDataRowIdData[rowid] = rest;
24093
24465
  fullAllDataRowIdData[rowid] = rest;
24466
+ }, {
24467
+ children: childrenField
24094
24468
  });
24095
24469
  // 源
24096
24470
  if (parentRow) {
@@ -24103,7 +24477,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
24103
24477
  if (isInsertNextRow) {
24104
24478
  targetIndex = targetIndex + 1;
24105
24479
  }
24106
- parentChilds.splice(targetIndex, 0, ...newRecords);
24480
+ parentChilds.splice(targetIndex, 0, ...treeRecords);
24107
24481
  }
24108
24482
  }
24109
24483
  } else {
@@ -24134,7 +24508,7 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
24134
24508
  afIndex = Math.min(afterFullData.length, afIndex + 1);
24135
24509
  }
24136
24510
  if (afIndex === -1) {
24137
- throw new Error(errLog('vxe.error.unableInsert'));
24511
+ throw new Error(mixin_getI18n('vxe.error.unableInsert'));
24138
24512
  }
24139
24513
  afterFullData.splice(afIndex, 0, ...newRecords);
24140
24514
  const tfIndex = $xeTable.findRowIndexOf(tableFullData, targetRow);
@@ -24158,10 +24532,27 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
24158
24532
  }
24159
24533
  }
24160
24534
  }
24161
- newRecords.forEach(newRow => {
24535
+ const handleStatus = newRow => {
24162
24536
  const rowid = getRowid($xeTable, newRow);
24163
- insertRowMaps[rowid] = newRow;
24164
- });
24537
+ // 如果是被删除的数据,则还原状态
24538
+ if (removeRowMaps[rowid]) {
24539
+ delete removeRowMaps[rowid];
24540
+ if (insertRowMaps[rowid]) {
24541
+ delete insertRowMaps[rowid];
24542
+ }
24543
+ } else {
24544
+ insertRowMaps[rowid] = newRow;
24545
+ }
24546
+ };
24547
+ // 如果为虚拟树
24548
+ if (treeConfig && transform) {
24549
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(treeRecords, handleStatus, {
24550
+ children: mapChildrenField
24551
+ });
24552
+ } else {
24553
+ newRecords.forEach(handleStatus);
24554
+ }
24555
+ reactData.removeRowFlag++;
24165
24556
  reactData.insertRowFlag++;
24166
24557
  $xeTable.cacheRowMap(false);
24167
24558
  $xeTable.updateScrollYStatus();
@@ -24812,7 +25203,9 @@ function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
24812
25203
  if (column && row) {
24813
25204
  return {
24814
25205
  row,
24815
- column
25206
+ rowIndex: $xeTable.getRowIndex(row),
25207
+ column,
25208
+ columnIndex: $xeTable.getColumnIndex(column)
24816
25209
  };
24817
25210
  }
24818
25211
  return null;
@@ -27783,12 +28176,13 @@ function checkRuleStatus(rule, val) {
27783
28176
  * 聚焦到校验通过的单元格并弹出校验错误提示
27784
28177
  */
27785
28178
  handleValidError(params) {
28179
+ const $xeTable = this;
27786
28180
  const {
27787
28181
  validOpts
27788
28182
  } = this;
27789
28183
  return new Promise(resolve => {
27790
28184
  if (validOpts.autoPos === false) {
27791
- this.emitEvent('valid-error', params);
28185
+ $xeTable.dispatchEvent('valid-error', params, null);
27792
28186
  resolve();
27793
28187
  } else {
27794
28188
  this.handleEdit(params, {
@@ -28201,6 +28595,7 @@ function checkRuleStatus(rule, val) {
28201
28595
  * 弹出校验错误提示
28202
28596
  */
28203
28597
  showValidTooltip(params) {
28598
+ const $xeTable = this;
28204
28599
  const {
28205
28600
  $refs,
28206
28601
  height,
@@ -28237,7 +28632,7 @@ function checkRuleStatus(rule, val) {
28237
28632
  }
28238
28633
  });
28239
28634
  }
28240
- this.emitEvent('valid-error', params, null);
28635
+ $xeTable.dispatchEvent('valid-error', params, null);
28241
28636
  if (validTip) {
28242
28637
  if (validTip && (validOpts.message === 'tooltip' || validOpts.message === 'default' && !height && tableData.length < 2)) {
28243
28638
  return validTip.open(cell, content);
@@ -28700,6 +29095,7 @@ function emitCustomEvent($xeTable, type, evnt) {
28700
29095
 
28701
29096
 
28702
29097
 
29098
+
28703
29099
 
28704
29100
 
28705
29101
  const {
@@ -28811,6 +29207,7 @@ function renderEmptyBody(h, $xeTable) {
28811
29207
  const renderDragTipContents = (h, $xeTable) => {
28812
29208
  const props = $xeTable;
28813
29209
  const reactData = $xeTable;
29210
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
28814
29211
  const {
28815
29212
  dragConfig
28816
29213
  } = props;
@@ -28825,9 +29222,10 @@ const renderDragTipContents = (h, $xeTable) => {
28825
29222
  const rTipSlot = rowDragSlots.tip || (dragConfig && dragConfig.slots ? dragConfig.slots.rowTip : null);
28826
29223
  const columnDragSlots = columnDragOpts.slots || {};
28827
29224
  const cTipSlot = columnDragSlots.tip;
28828
- if (dragRow && rTipSlot) {
29225
+ const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
29226
+ if (dRow && rTipSlot) {
28829
29227
  return $xeTable.callSlot(rTipSlot, {
28830
- row: dragRow
29228
+ row: dRow
28831
29229
  }, h);
28832
29230
  }
28833
29231
  if (dragCol && cTipSlot) {
@@ -28839,6 +29237,7 @@ const renderDragTipContents = (h, $xeTable) => {
28839
29237
  };
28840
29238
  const table_renderDragTip = (h, $xeTable) => {
28841
29239
  const reactData = $xeTable;
29240
+ const crossTableDragRowInfo = getCrossTableDragRowInfo($xeTable);
28842
29241
  const {
28843
29242
  dragRow,
28844
29243
  dragCol
@@ -28847,6 +29246,7 @@ const table_renderDragTip = (h, $xeTable) => {
28847
29246
  const columnOpts = $xeTable.computeColumnOpts;
28848
29247
  const rowDragOpts = $xeTable.computeRowDragOpts;
28849
29248
  const columnDragOpts = $xeTable.computeColumnDragOpts;
29249
+ const dRow = dragRow || (rowDragOpts.isCrossTableDrag ? crossTableDragRowInfo.row : null);
28850
29250
  if (rowOpts.drag || columnOpts.drag) {
28851
29251
  return h('div', {
28852
29252
  class: 'vxe-table--drag-wrapper'
@@ -28860,7 +29260,7 @@ const table_renderDragTip = (h, $xeTable) => {
28860
29260
  class: ['vxe-table--drag-col-line', {
28861
29261
  'is--guides': columnDragOpts.showGuidesStatus
28862
29262
  }]
28863
- }), dragRow && rowDragOpts.showDragTip || dragCol && columnDragOpts.showDragTip ? h('div', {
29263
+ }), dRow && rowDragOpts.showDragTip || dragCol && columnDragOpts.showDragTip ? h('div', {
28864
29264
  ref: 'refDragTipElem',
28865
29265
  class: 'vxe-table--drag-sort-tip'
28866
29266
  }, [h('div', {
@@ -28868,7 +29268,7 @@ const table_renderDragTip = (h, $xeTable) => {
28868
29268
  }, [h('div', {
28869
29269
  class: 'vxe-table--drag-sort-tip-status'
28870
29270
  }, [h('span', {
28871
- class: ['vxe-table--drag-sort-tip-normal-status', dragRow ? table_getIcon().TABLE_DRAG_STATUS_ROW : table_getIcon().TABLE_DRAG_STATUS_COLUMN]
29271
+ class: ['vxe-table--drag-sort-tip-normal-status', dRow ? table_getIcon().TABLE_DRAG_STATUS_ROW : table_getIcon().TABLE_DRAG_STATUS_COLUMN]
28872
29272
  }), h('span', {
28873
29273
  class: ['vxe-table--drag-sort-tip-sub-status', table_getIcon().TABLE_DRAG_STATUS_SUB_ROW]
28874
29274
  }), h('span', {
@@ -29373,9 +29773,9 @@ function renderBody(h, $xeTable) {
29373
29773
  resizeHeightFlag: 1,
29374
29774
  resizeWidthFlag: 1,
29375
29775
  isCustomStatus: false,
29376
- isDragRowMove: false,
29776
+ isCrossDragRow: false,
29377
29777
  dragRow: null,
29378
- isDragColMove: false,
29778
+ isCrossDragCol: false,
29379
29779
  dragCol: null,
29380
29780
  dragTipText: '',
29381
29781
  isDragResize: false,
@@ -29383,7 +29783,8 @@ function renderBody(h, $xeTable) {
29383
29783
  isColLoading: false,
29384
29784
  reScrollFlag: 0,
29385
29785
  reLayoutFlag: 0,
29386
- footFlag: 0
29786
+ footFlag: 0,
29787
+ crossTableDragRowInfo: crossTableDragRowGlobal
29387
29788
  };
29388
29789
  },
29389
29790
  computed: {
@@ -30207,6 +30608,7 @@ function renderBody(h, $xeTable) {
30207
30608
  const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
30208
30609
  const keyboardOpts = $xeTable.computeKeyboardOpts;
30209
30610
  const aggregateOpts = $xeTable.computeAggregateOpts;
30611
+ const rowDragOpts = $xeTable.computeRowDragOpts;
30210
30612
  const {
30211
30613
  groupFields
30212
30614
  } = aggregateOpts;
@@ -30314,7 +30716,10 @@ function renderBody(h, $xeTable) {
30314
30716
  }
30315
30717
  }
30316
30718
  if (treeConfig && rowOpts.drag && !treeOpts.transform) {
30317
- warnLog('vxe.error.notSupportProp', ['column-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
30719
+ warnLog('vxe.error.notSupportProp', ['row-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
30720
+ }
30721
+ if (treeConfig && rowDragOpts.isCrossTableDrag && !rowDragOpts.isCrossDrag) {
30722
+ errLog('vxe.error.reqSupportProp', ['tree-config & row-drag-config.isCrossTableDrag', 'row-drag-config.isCrossDrag']);
30318
30723
  }
30319
30724
  if (props.dragConfig) {
30320
30725
  warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
@@ -30641,6 +31046,7 @@ function renderBody(h, $xeTable) {
30641
31046
  rightList
30642
31047
  } = columnStore;
30643
31048
  const loadingSlot = slots.loading;
31049
+ const rowDragOpts = $xeTable.computeRowDragOpts;
30644
31050
  const tableTipConfig = $xeTable.computeTableTipConfig;
30645
31051
  const validTipConfig = $xeTable.computeValidTipConfig;
30646
31052
  const validOpts = $xeTable.computeValidOpts;
@@ -30660,6 +31066,13 @@ function renderBody(h, $xeTable) {
30660
31066
  const columnDragOpts = $xeTable.computeColumnDragOpts;
30661
31067
  const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
30662
31068
  const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft;
31069
+ const {
31070
+ isCrossTableDrag
31071
+ } = rowDragOpts;
31072
+ const rwOns = {};
31073
+ if (isCrossTableDrag && !tableData.length) {
31074
+ rwOns.onDragover = $xeTable.handleCrossTableRowDragoverEmptyEvent;
31075
+ }
30663
31076
  return h('div', {
30664
31077
  ref: 'refElem',
30665
31078
  class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
@@ -30719,7 +31132,8 @@ function renderBody(h, $xeTable) {
30719
31132
  class: 'vxe-table-var-mini'
30720
31133
  })]), h('div', {
30721
31134
  key: 'tw',
30722
- class: 'vxe-table--render-wrapper'
31135
+ class: 'vxe-table--render-wrapper',
31136
+ on: rwOns
30723
31137
  }, scrollbarXToTop ? [renderScrollX(h, $xeTable), renderBody(h, $xeTable)] : [renderBody(h, $xeTable), renderScrollX(h, $xeTable)]),
30724
31138
  /**
30725
31139
  * 空数据