vxe-table 4.8.6 → 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.
@@ -5470,6 +5470,16 @@ export default defineComponent({
5470
5470
  });
5471
5471
  }
5472
5472
  };
5473
+ const updateRowDropOrigin = (row) => {
5474
+ const el = refElem.value;
5475
+ if (el) {
5476
+ const clss = 'row--drag-origin';
5477
+ const rowid = getRowid($xeTable, row);
5478
+ XEUtils.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), (elem) => {
5479
+ addClass(elem, clss);
5480
+ });
5481
+ }
5482
+ };
5473
5483
  const clearRowDropTarget = () => {
5474
5484
  const el = refElem.value;
5475
5485
  if (el) {
@@ -5479,6 +5489,17 @@ export default defineComponent({
5479
5489
  });
5480
5490
  }
5481
5491
  };
5492
+ const updateRowDropTarget = (row, dragPos) => {
5493
+ const el = refElem.value;
5494
+ if (el) {
5495
+ const clss = 'row--drag-active-target';
5496
+ const rowid = getRowid($xeTable, row);
5497
+ XEUtils.arrayEach(el.querySelectorAll(`[rowid="${rowid}"]`), (elem) => {
5498
+ addClass(elem, clss);
5499
+ elem.setAttribute('drag-pos', dragPos);
5500
+ });
5501
+ }
5502
+ };
5482
5503
  const showRowDropTip = (evnt) => {
5483
5504
  const rdTipEl = refRowDragTipElem.value;
5484
5505
  if (!rdTipEl) {
@@ -6614,7 +6635,7 @@ export default defineComponent({
6614
6635
  const treeOpts = computeTreeOpts.value;
6615
6636
  const { transform } = treeOpts;
6616
6637
  const { dragRow } = reactData;
6617
- const { afterFullData, tableFullData, prevDragRow, prevDragPos } = internalData;
6638
+ const { afterFullData, afterTreeFullData, tableFullData, tableFullTreeData, prevDragRow, prevDragPos } = internalData;
6618
6639
  if (prevDragRow && dragRow) {
6619
6640
  // 判断是否有拖动
6620
6641
  if (prevDragRow !== dragRow) {
@@ -6628,18 +6649,36 @@ export default defineComponent({
6628
6649
  return;
6629
6650
  }
6630
6651
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
6631
- // 移出源位置
6632
- const oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
6633
- const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
6634
- afterFullData.splice(oafIndex, 1);
6635
- tableFullData.splice(otfIndex, 1);
6636
- // 插新位置
6637
- const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
6638
- const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
6639
- const nafIndex = pafIndex + dragOffsetIndex;
6640
- const ntfIndex = ptfIndex + dragOffsetIndex;
6641
- afterFullData.splice(nafIndex, 0, dragRow);
6642
- tableFullData.splice(ntfIndex, 0, dragRow);
6652
+ let oafIndex = -1;
6653
+ let nafIndex = -1;
6654
+ if (treeConfig) {
6655
+ // 移出源位置
6656
+ oafIndex = $xeTable.findRowIndexOf(afterTreeFullData, dragRow);
6657
+ const otfIndex = $xeTable.findRowIndexOf(tableFullTreeData, dragRow);
6658
+ afterTreeFullData.splice(oafIndex, 1);
6659
+ tableFullTreeData.splice(otfIndex, 1);
6660
+ // 插新位置
6661
+ const pafIndex = $xeTable.findRowIndexOf(afterTreeFullData, prevDragRow);
6662
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullTreeData, prevDragRow);
6663
+ nafIndex = pafIndex + dragOffsetIndex;
6664
+ const ntfIndex = ptfIndex + dragOffsetIndex;
6665
+ afterTreeFullData.splice(nafIndex, 0, dragRow);
6666
+ tableFullTreeData.splice(ntfIndex, 0, dragRow);
6667
+ }
6668
+ else {
6669
+ // 移出源位置
6670
+ oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
6671
+ const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
6672
+ afterFullData.splice(oafIndex, 1);
6673
+ tableFullData.splice(otfIndex, 1);
6674
+ // 插新位置
6675
+ const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
6676
+ const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
6677
+ nafIndex = pafIndex + dragOffsetIndex;
6678
+ const ntfIndex = ptfIndex + dragOffsetIndex;
6679
+ afterFullData.splice(nafIndex, 0, dragRow);
6680
+ tableFullData.splice(ntfIndex, 0, dragRow);
6681
+ }
6643
6682
  reactData.isDragRowMove = true;
6644
6683
  $xeTable.cacheRowMap();
6645
6684
  $xeTable.updateScrollYStatus();
@@ -6687,8 +6726,7 @@ export default defineComponent({
6687
6726
  const { dragRow } = reactData;
6688
6727
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
6689
6728
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
6690
- addClass(trEl, 'row--drag-active-target');
6691
- trEl.setAttribute('drag-pos', dragPos);
6729
+ updateRowDropTarget(row, dragPos);
6692
6730
  internalData.prevDragRow = row;
6693
6731
  internalData.prevDragPos = dragPos;
6694
6732
  dispatchEvent('row-dragover', {
@@ -6718,7 +6756,7 @@ export default defineComponent({
6718
6756
  }
6719
6757
  reactData.dragRow = row;
6720
6758
  trEl.draggable = true;
6721
- addClass(trEl, 'row--drag-origin');
6759
+ updateRowDropOrigin(row);
6722
6760
  showRowDropTip(evnt);
6723
6761
  updateRowDropTipContent(tdEl);
6724
6762
  dispatchEvent('row-dragstart', params, evnt);
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 = "4.8.6";
3
+ export const version = "4.8.8";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
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${"4.8.6"}`;
3
+ const version = `table v${"4.8.8"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
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.6";
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.6"}`;
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
  }
@@ -5895,7 +5902,7 @@ const header_renderType = 'header';
5895
5902
  tableColumn
5896
5903
  } = props;
5897
5904
  const {
5898
- resizable,
5905
+ resizable: allResizable,
5899
5906
  border,
5900
5907
  columnKey,
5901
5908
  headerRowClassName,
@@ -6057,7 +6064,7 @@ const header_renderType = 'header';
6057
6064
  /**
6058
6065
  * 列宽拖动
6059
6066
  */
6060
- !fixedHiddenColumn && !isColGroup && (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || resizable) ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
6067
+ !fixedHiddenColumn && !isColGroup && (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
6061
6068
  class: ['vxe-resizable', {
6062
6069
  'is--line': !border || border === 'none'
6063
6070
  }],
@@ -6728,6 +6735,7 @@ const {
6728
6735
  const VxeUIRadioGroupComponent = core_.VxeUI.getComponent('VxeRadioGroup');
6729
6736
  const $xeTable = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeTable', {});
6730
6737
  const {
6738
+ props: tableProps,
6731
6739
  reactData
6732
6740
  } = $xeTable;
6733
6741
  const {
@@ -7183,6 +7191,9 @@ const {
7183
7191
  const {
7184
7192
  customStore
7185
7193
  } = props;
7194
+ const {
7195
+ resizable: allResizable
7196
+ } = tableProps;
7186
7197
  const {
7187
7198
  customColumnList
7188
7199
  } = reactData;
@@ -7310,7 +7321,7 @@ const {
7310
7321
  title: colTitle
7311
7322
  }, colTitle)]), allowResizable ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('td', {
7312
7323
  class: 'vxe-table-custom-popup--column-item col--resizable'
7313
- }, [column.children && column.children.length ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', '-') : VxeUINumberInputComponent ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(VxeUINumberInputComponent, {
7324
+ }, [column.children && column.children.length || !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', '-') : VxeUINumberInputComponent ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(VxeUINumberInputComponent, {
7314
7325
  type: 'integer',
7315
7326
  disabled: isDisabled || isHidden,
7316
7327
  modelValue: column.renderResizeWidth,
@@ -14809,6 +14820,16 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14809
14820
  });
14810
14821
  }
14811
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
+ };
14812
14833
  const clearRowDropTarget = () => {
14813
14834
  const el = refElem.value;
14814
14835
  if (el) {
@@ -14818,6 +14839,17 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
14818
14839
  });
14819
14840
  }
14820
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
+ };
14821
14853
  const showRowDropTip = evnt => {
14822
14854
  const rdTipEl = refRowDragTipElem.value;
14823
14855
  if (!rdTipEl) {
@@ -16203,7 +16235,9 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16203
16235
  } = reactData;
16204
16236
  const {
16205
16237
  afterFullData,
16238
+ afterTreeFullData,
16206
16239
  tableFullData,
16240
+ tableFullTreeData,
16207
16241
  prevDragRow,
16208
16242
  prevDragPos
16209
16243
  } = internalData;
@@ -16218,18 +16252,35 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16218
16252
  return;
16219
16253
  }
16220
16254
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
16221
- // 移出源位置
16222
- const oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
16223
- const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
16224
- afterFullData.splice(oafIndex, 1);
16225
- tableFullData.splice(otfIndex, 1);
16226
- // 插新位置
16227
- const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
16228
- const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
16229
- const nafIndex = pafIndex + dragOffsetIndex;
16230
- const ntfIndex = ptfIndex + dragOffsetIndex;
16231
- afterFullData.splice(nafIndex, 0, dragRow);
16232
- 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
+ }
16233
16284
  reactData.isDragRowMove = true;
16234
16285
  $xeTable.cacheRowMap();
16235
16286
  $xeTable.updateScrollYStatus();
@@ -16278,8 +16329,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16278
16329
  } = reactData;
16279
16330
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
16280
16331
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
16281
- addClass(trEl, 'row--drag-active-target');
16282
- trEl.setAttribute('drag-pos', dragPos);
16332
+ updateRowDropTarget(row, dragPos);
16283
16333
  internalData.prevDragRow = row;
16284
16334
  internalData.prevDragPos = dragPos;
16285
16335
  dispatchEvent('row-dragover', {
@@ -16312,7 +16362,7 @@ const customStorageKey = 'VXE_CUSTOM_STORE';
16312
16362
  }
16313
16363
  reactData.dragRow = row;
16314
16364
  trEl.draggable = true;
16315
- addClass(trEl, 'row--drag-origin');
16365
+ updateRowDropOrigin(row);
16316
16366
  showRowDropTip(evnt);
16317
16367
  updateRowDropTipContent(tdEl);
16318
16368
  dispatchEvent('row-dragstart', params, evnt);