vxe-table 3.12.3 → 3.12.5

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.
@@ -145,6 +145,10 @@ function cacheColumnMap($xeTable) {
145
145
  isCrossDrag,
146
146
  isSelfToChildDrag
147
147
  } = columnDragOpts;
148
+ const customOpts = $xeTable.computeCustomOpts;
149
+ const {
150
+ storage
151
+ } = customOpts;
148
152
  const rowOpts = $xeTable.computeRowOpts;
149
153
  const isGroup = collectColumn.some(_utils.hasChildrenList);
150
154
  let isAllOverflow = !!props.showOverflow;
@@ -178,8 +182,8 @@ function cacheColumnMap($xeTable) {
178
182
  }
179
183
  fullColumnFieldData[field] = rest;
180
184
  } else {
181
- if (isCrossDrag || isSelfToChildDrag) {
182
- (0, _log.errLog)('vxe.error.emptyProp', ['column.field']);
185
+ if (storage || isCrossDrag || isSelfToChildDrag) {
186
+ (0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
183
187
  }
184
188
  }
185
189
  if (!hasFixed && fixed) {
@@ -245,7 +249,7 @@ function cacheColumnMap($xeTable) {
245
249
  (0, _log.errLog)('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
246
250
  }
247
251
  }
248
- if (process.env.NODE_ENV === 'development') {
252
+ if (process.env.NODE_ENV === 'developmeznt') {
249
253
  if (htmlColumn) {
250
254
  if (!columnOpts.useKey) {
251
255
  (0, _log.errLog)('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
@@ -6404,7 +6408,7 @@ const Methods = {
6404
6408
  evnt.dataTransfer.setDragImage((0, _dom.getTpImg)(), 0, 0);
6405
6409
  }
6406
6410
  },
6407
- handleRowDragDragendEvent(evnt) {
6411
+ handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
6408
6412
  const $xeTable = this;
6409
6413
  const props = $xeTable;
6410
6414
  const reactData = $xeTable;
@@ -6415,8 +6419,7 @@ const Methods = {
6415
6419
  } = props;
6416
6420
  const rowDragOpts = $xeTable.computeRowDragOpts;
6417
6421
  const {
6418
- fullAllDataRowIdData,
6419
- prevDragToChild
6422
+ fullAllDataRowIdData
6420
6423
  } = internalData;
6421
6424
  const {
6422
6425
  isPeerDrag,
@@ -6432,21 +6435,16 @@ const Methods = {
6432
6435
  parentField
6433
6436
  } = treeOpts;
6434
6437
  const childrenField = treeOpts.children || treeOpts.childrenField;
6435
- const {
6436
- dragRow
6437
- } = reactData;
6438
6438
  const {
6439
6439
  afterFullData,
6440
- tableFullData,
6441
- prevDragRow,
6442
- prevDragPos
6440
+ tableFullData
6443
6441
  } = internalData;
6444
6442
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
6445
6443
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
6446
6444
  if (prevDragRow && dragRow) {
6447
6445
  // 判断是否有拖动
6448
6446
  if (prevDragRow !== dragRow) {
6449
- Promise.resolve(dEndMethod ? dEndMethod({
6447
+ return Promise.resolve(dEndMethod ? dEndMethod({
6450
6448
  oldRow: dragRow,
6451
6449
  newRow: prevDragRow,
6452
6450
  dragPos: prevDragPos,
@@ -6597,6 +6595,48 @@ const Methods = {
6597
6595
  }).catch(() => {});
6598
6596
  }
6599
6597
  }
6598
+ return Promise.resolve();
6599
+ },
6600
+ handleRowDragDragendEvent(evnt) {
6601
+ const $xeTable = this;
6602
+ const props = $xeTable;
6603
+ const reactData = $xeTable;
6604
+ const internalData = $xeTable;
6605
+ const {
6606
+ treeConfig
6607
+ } = props;
6608
+ const {
6609
+ fullAllDataRowIdData,
6610
+ prevDragToChild
6611
+ } = internalData;
6612
+ const {
6613
+ dragRow
6614
+ } = reactData;
6615
+ const treeOpts = $xeTable.computeTreeOpts;
6616
+ const {
6617
+ lazy
6618
+ } = treeOpts;
6619
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
6620
+ const {
6621
+ prevDragRow,
6622
+ prevDragPos
6623
+ } = internalData;
6624
+ if (treeConfig && prevDragToChild) {
6625
+ // 懒加载
6626
+ if (lazy) {
6627
+ const newRowid = (0, _util.getRowid)($xeTable, prevDragRow);
6628
+ const rowRest = fullAllDataRowIdData[newRowid];
6629
+ if (prevDragRow[hasChildField]) {
6630
+ if (rowRest && rowRest.treeLoaded) {
6631
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6632
+ }
6633
+ } else {
6634
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6635
+ }
6636
+ }
6637
+ } else {
6638
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
6639
+ }
6600
6640
  hideDropTip($xeTable);
6601
6641
  clearRowDropOrigin($xeTable);
6602
6642
  internalData.prevDragToChild = false;
@@ -6622,9 +6662,11 @@ const Methods = {
6622
6662
  } = reactData;
6623
6663
  const treeOpts = $xeTable.computeTreeOpts;
6624
6664
  const {
6665
+ lazy,
6625
6666
  transform,
6626
6667
  parentField
6627
6668
  } = treeOpts;
6669
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
6628
6670
  const rowDragOpts = $xeTable.computeRowDragOpts;
6629
6671
  const {
6630
6672
  isPeerDrag,
@@ -6641,19 +6683,21 @@ const Methods = {
6641
6683
  const rest = fullAllDataRowIdData[rowid];
6642
6684
  if (rest) {
6643
6685
  const row = rest.row;
6686
+ const rowid = (0, _util.getRowid)($xeTable, row);
6687
+ const rowRest = fullAllDataRowIdData[rowid];
6644
6688
  evnt.preventDefault();
6645
6689
  const {
6646
6690
  dragRow
6647
6691
  } = reactData;
6648
6692
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
6649
6693
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
6650
- if ($xeTable.eqRow(dragRow, row) || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
6651
- showDropTip($xeTable, evnt, trEl, null, false, dragPos);
6652
- return;
6653
- }
6654
6694
  internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
6655
6695
  internalData.prevDragRow = row;
6656
6696
  internalData.prevDragPos = dragPos;
6697
+ if ($xeTable.eqRow(dragRow, row) || hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
6698
+ showDropTip($xeTable, evnt, trEl, null, false, dragPos);
6699
+ return;
6700
+ }
6657
6701
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
6658
6702
  $xeTable.dispatchEvent('row-dragover', {
6659
6703
  oldRow: dragRow,
@@ -6945,13 +6989,13 @@ const Methods = {
6945
6989
  } = evnt;
6946
6990
  const offsetX = clientX - thEl.getBoundingClientRect().x;
6947
6991
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
6992
+ internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
6993
+ internalData.prevDragCol = column;
6994
+ internalData.prevDragPos = dragPos;
6948
6995
  if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
6949
6996
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
6950
6997
  return;
6951
6998
  }
6952
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
6953
- internalData.prevDragCol = column;
6954
- internalData.prevDragPos = dragPos;
6955
6999
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
6956
7000
  $xeTable.dispatchEvent('column-dragover', {
6957
7001
  oldColumn: dragCol,
@@ -8576,6 +8620,10 @@ const Methods = {
8576
8620
  }
8577
8621
  this.$nextTick(this.updateStyle);
8578
8622
  },
8623
+ updateScrollYStatus() {
8624
+ const $xeTable = this;
8625
+ return updateScrollYStatus($xeTable);
8626
+ },
8579
8627
  /**
8580
8628
  * 如果有滚动条,则滚动到对应的位置
8581
8629
  * @param {Number} scrollLeft 左距离