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.
package/lib/index.umd.js CHANGED
@@ -1998,7 +1998,7 @@ function eqEmptyValue(cellValue) {
1998
1998
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
1999
1999
 
2000
2000
 
2001
- const version = "4.8.7";
2001
+ const version = "4.8.8";
2002
2002
  core_.VxeUI.version = version;
2003
2003
  core_.VxeUI.tableVersion = version;
2004
2004
  core_.VxeUI.setConfig({
@@ -2389,7 +2389,7 @@ var es_array_push = __webpack_require__(4114);
2389
2389
  const {
2390
2390
  log: log_log
2391
2391
  } = core_.VxeUI;
2392
- const log_version = `table v${"4.8.7"}`;
2392
+ const log_version = `table v${"4.8.8"}`;
2393
2393
  const warnLog = log_log.create('warn', log_version);
2394
2394
  const errLog = log_log.create('error', log_version);
2395
2395
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3388,12 +3388,16 @@ function renderCellDragIcon(params) {
3388
3388
  function renderCellBaseVNs(params, content) {
3389
3389
  const {
3390
3390
  $table,
3391
- column
3391
+ column,
3392
+ level
3392
3393
  } = params;
3393
3394
  const {
3394
3395
  dragSort
3395
3396
  } = column;
3396
- const vns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content];
3397
+ const tableProps = $table.props;
3398
+ const {
3399
+ treeConfig
3400
+ } = tableProps;
3397
3401
  const {
3398
3402
  computeRowOpts,
3399
3403
  computeDragOpts
@@ -3404,8 +3408,11 @@ function renderCellBaseVNs(params, content) {
3404
3408
  showRowIcon,
3405
3409
  rowVisibleMethod
3406
3410
  } = dragOpts;
3411
+ const vns = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(content) ? content : [content];
3407
3412
  if (dragSort && rowOpts.drag && showRowIcon && (!rowVisibleMethod || rowVisibleMethod(params))) {
3408
- vns.unshift(renderCellDragIcon(params));
3413
+ if (!treeConfig || !level) {
3414
+ vns.unshift(renderCellDragIcon(params));
3415
+ }
3409
3416
  }
3410
3417
  return vns;
3411
3418
  }
@@ -14813,6 +14820,16 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14813
14820
  });
14814
14821
  }
14815
14822
  };
14823
+ const updateRowDropOrigin = row => {
14824
+ const el = refElem.value;
14825
+ if (el) {
14826
+ const clss = 'row--drag-origin';
14827
+ const rowid = getRowid($xeTable, row);
14828
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
14829
+ addClass(elem, clss);
14830
+ });
14831
+ }
14832
+ };
14816
14833
  const clearRowDropTarget = () => {
14817
14834
  const el = refElem.value;
14818
14835
  if (el) {
@@ -14822,6 +14839,17 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14822
14839
  });
14823
14840
  }
14824
14841
  };
14842
+ const updateRowDropTarget = (row, dragPos) => {
14843
+ const el = refElem.value;
14844
+ if (el) {
14845
+ const clss = 'row--drag-active-target';
14846
+ const rowid = getRowid($xeTable, row);
14847
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), elem => {
14848
+ addClass(elem, clss);
14849
+ elem.setAttribute('drag-pos', dragPos);
14850
+ });
14851
+ }
14852
+ };
14825
14853
  const showRowDropTip = evnt => {
14826
14854
  const rdTipEl = refRowDragTipElem.value;
14827
14855
  if (!rdTipEl) {
@@ -16207,7 +16235,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16207
16235
  } = reactData;
16208
16236
  const {
16209
16237
  afterFullData,
16238
+ afterTreeFullData,
16210
16239
  tableFullData,
16240
+ tableFullTreeData,
16211
16241
  prevDragRow,
16212
16242
  prevDragPos
16213
16243
  } = internalData;
@@ -16222,18 +16252,35 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16222
16252
  return;
16223
16253
  }
16224
16254
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
16225
- // 移出源位置
16226
- const oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
16227
- const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
16228
- afterFullData.splice(oafIndex, 1);
16229
- tableFullData.splice(otfIndex, 1);
16230
- // 插新位置
16231
- const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
16232
- const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
16233
- const nafIndex = pafIndex + dragOffsetIndex;
16234
- const ntfIndex = ptfIndex + dragOffsetIndex;
16235
- afterFullData.splice(nafIndex, 0, dragRow);
16236
- tableFullData.splice(ntfIndex, 0, dragRow);
16255
+ let oafIndex = -1;
16256
+ let nafIndex = -1;
16257
+ if (treeConfig) {
16258
+ // 移出源位置
16259
+ oafIndex = $xeTable.findRowIndexOf(afterTreeFullData, dragRow);
16260
+ const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow);
16261
+ afterTreeFullData.splice(oafIndex, 1);
16262
+ tableFullTreeData.splice(otfIndex, 1);
16263
+ // 插新位置
16264
+ const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow);
16265
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow);
16266
+ nafIndex = pafIndex + dragOffsetIndex;
16267
+ const ntfIndex = ptfIndex + dragOffsetIndex;
16268
+ afterTreeFullData.splice(nafIndex, 0, dragRow);
16269
+ tableFullTreeData.splice(ntfIndex, 0, dragRow);
16270
+ } else {
16271
+ // 移出源位置
16272
+ oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
16273
+ const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
16274
+ afterFullData.splice(oafIndex, 1);
16275
+ tableFullData.splice(otfIndex, 1);
16276
+ // 插新位置
16277
+ const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
16278
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
16279
+ nafIndex = pafIndex + dragOffsetIndex;
16280
+ const ntfIndex = ptfIndex + dragOffsetIndex;
16281
+ afterFullData.splice(nafIndex, 0, dragRow);
16282
+ tableFullData.splice(ntfIndex, 0, dragRow);
16283
+ }
16237
16284
  reactData.isDragRowMove = true;
16238
16285
  $xeTable.cacheRowMap();
16239
16286
  $xeTable.updateScrollYStatus();
@@ -16282,8 +16329,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16282
16329
  } = reactData;
16283
16330
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
16284
16331
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
16285
- addClass(trEl, 'row--drag-active-target');
16286
- trEl.setAttribute('drag-pos', dragPos);
16332
+ updateRowDropTarget(row, dragPos);
16287
16333
  internalData.prevDragRow = row;
16288
16334
  internalData.prevDragPos = dragPos;
16289
16335
  dispatchEvent('row-dragover', {
@@ -16316,7 +16362,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16316
16362
  }
16317
16363
  reactData.dragRow = row;
16318
16364
  trEl.draggable = true;
16319
- addClass(trEl, 'row--drag-origin');
16365
+ updateRowDropOrigin(row);
16320
16366
  showRowDropTip(evnt);
16321
16367
  updateRowDropTipContent(tdEl);
16322
16368
  dispatchEvent('row-dragstart', params, evnt);