vxe-table 4.8.7 → 4.8.8

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.
@@ -6306,6 +6306,16 @@ var _default = exports.default = (0, _vue.defineComponent)({
6306
6306
  });
6307
6307
  }
6308
6308
  };
6309
+ const updateRowDropOrigin = row => {
6310
+ const el = refElem.value;
6311
+ if (el) {
6312
+ const clss = 'row--drag-origin';
6313
+ const rowid = (0, _util.getRowid)($xeTable, row);
6314
+ _xeUtils.default.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
6315
+ (0, _dom.addClass)(elem, clss);
6316
+ });
6317
+ }
6318
+ };
6309
6319
  const clearRowDropTarget = () => {
6310
6320
  const el = refElem.value;
6311
6321
  if (el) {
@@ -6315,6 +6325,17 @@ var _default = exports.default = (0, _vue.defineComponent)({
6315
6325
  });
6316
6326
  }
6317
6327
  };
6328
+ const updateRowDropTarget = (row, dragPos) => {
6329
+ const el = refElem.value;
6330
+ if (el) {
6331
+ const clss = 'row--drag-active-target';
6332
+ const rowid = (0, _util.getRowid)($xeTable, row);
6333
+ _xeUtils.default.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
6334
+ (0, _dom.addClass)(elem, clss);
6335
+ elem.setAttribute('drag-pos', dragPos);
6336
+ });
6337
+ }
6338
+ };
6318
6339
  const showRowDropTip = evnt => {
6319
6340
  const rdTipEl = refRowDragTipElem.value;
6320
6341
  if (!rdTipEl) {
@@ -7698,7 +7719,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
7698
7719
  } = reactData;
7699
7720
  const {
7700
7721
  afterFullData,
7722
+ afterTreeFullData,
7701
7723
  tableFullData,
7724
+ tableFullTreeData,
7702
7725
  prevDragRow,
7703
7726
  prevDragPos
7704
7727
  } = internalData;
@@ -7713,18 +7736,35 @@ var _default = exports.default = (0, _vue.defineComponent)({
7713
7736
  return;
7714
7737
  }
7715
7738
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
7716
- // 移出源位置
7717
- const oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
7718
- const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
7719
- afterFullData.splice(oafIndex, 1);
7720
- tableFullData.splice(otfIndex, 1);
7721
- // 插新位置
7722
- const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
7723
- const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
7724
- const nafIndex = pafIndex + dragOffsetIndex;
7725
- const ntfIndex = ptfIndex + dragOffsetIndex;
7726
- afterFullData.splice(nafIndex, 0, dragRow);
7727
- tableFullData.splice(ntfIndex, 0, dragRow);
7739
+ let oafIndex = -1;
7740
+ let nafIndex = -1;
7741
+ if (treeConfig) {
7742
+ // 移出源位置
7743
+ oafIndex = $xeTable.findRowIndexOf(afterTreeFullData, dragRow);
7744
+ const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow);
7745
+ afterTreeFullData.splice(oafIndex, 1);
7746
+ tableFullTreeData.splice(otfIndex, 1);
7747
+ // 插新位置
7748
+ const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow);
7749
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow);
7750
+ nafIndex = pafIndex + dragOffsetIndex;
7751
+ const ntfIndex = ptfIndex + dragOffsetIndex;
7752
+ afterTreeFullData.splice(nafIndex, 0, dragRow);
7753
+ tableFullTreeData.splice(ntfIndex, 0, dragRow);
7754
+ } else {
7755
+ // 移出源位置
7756
+ oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
7757
+ const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
7758
+ afterFullData.splice(oafIndex, 1);
7759
+ tableFullData.splice(otfIndex, 1);
7760
+ // 插新位置
7761
+ const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
7762
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
7763
+ nafIndex = pafIndex + dragOffsetIndex;
7764
+ const ntfIndex = ptfIndex + dragOffsetIndex;
7765
+ afterFullData.splice(nafIndex, 0, dragRow);
7766
+ tableFullData.splice(ntfIndex, 0, dragRow);
7767
+ }
7728
7768
  reactData.isDragRowMove = true;
7729
7769
  $xeTable.cacheRowMap();
7730
7770
  $xeTable.updateScrollYStatus();
@@ -7773,8 +7813,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
7773
7813
  } = reactData;
7774
7814
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
7775
7815
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
7776
- (0, _dom.addClass)(trEl, 'row--drag-active-target');
7777
- trEl.setAttribute('drag-pos', dragPos);
7816
+ updateRowDropTarget(row, dragPos);
7778
7817
  internalData.prevDragRow = row;
7779
7818
  internalData.prevDragPos = dragPos;
7780
7819
  dispatchEvent('row-dragover', {
@@ -7808,7 +7847,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
7808
7847
  }
7809
7848
  reactData.dragRow = row;
7810
7849
  trEl.draggable = true;
7811
- (0, _dom.addClass)(trEl, 'row--drag-origin');
7850
+ updateRowDropOrigin(row);
7812
7851
  showRowDropTip(evnt);
7813
7852
  updateRowDropTipContent(tdEl);
7814
7853
  dispatchEvent('row-dragstart', params, evnt);