vxe-table 3.12.4 → 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.
@@ -108,6 +108,8 @@ function cacheColumnMap($xeTable) {
108
108
  const columnOpts = $xeTable.computeColumnOpts;
109
109
  const columnDragOpts = $xeTable.computeColumnDragOpts;
110
110
  const { isCrossDrag, isSelfToChildDrag } = columnDragOpts;
111
+ const customOpts = $xeTable.computeCustomOpts;
112
+ const { storage } = customOpts;
111
113
  const rowOpts = $xeTable.computeRowOpts;
112
114
  const isGroup = collectColumn.some(hasChildrenList);
113
115
  let isAllOverflow = !!props.showOverflow;
@@ -127,8 +129,8 @@ function cacheColumnMap($xeTable) {
127
129
  fullColumnFieldData[field] = rest;
128
130
  }
129
131
  else {
130
- if (isCrossDrag || isSelfToChildDrag) {
131
- errLog('vxe.error.emptyProp', ['column.field']);
132
+ if (storage || isCrossDrag || isSelfToChildDrag) {
133
+ errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
132
134
  }
133
135
  }
134
136
  if (!hasFixed && fixed) {
@@ -5413,26 +5415,25 @@ const Methods = {
5413
5415
  evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
5414
5416
  }
5415
5417
  },
5416
- handleRowDragDragendEvent(evnt) {
5418
+ handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
5417
5419
  const $xeTable = this;
5418
5420
  const props = $xeTable;
5419
5421
  const reactData = $xeTable;
5420
5422
  const internalData = $xeTable;
5421
5423
  const { treeConfig, dragConfig } = props;
5422
5424
  const rowDragOpts = $xeTable.computeRowDragOpts;
5423
- const { fullAllDataRowIdData, prevDragToChild } = internalData;
5425
+ const { fullAllDataRowIdData } = internalData;
5424
5426
  const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod } = rowDragOpts;
5425
5427
  const treeOpts = $xeTable.computeTreeOpts;
5426
5428
  const { transform, rowField, mapChildrenField, parentField } = treeOpts;
5427
5429
  const childrenField = treeOpts.children || treeOpts.childrenField;
5428
- const { dragRow } = reactData;
5429
- const { afterFullData, tableFullData, prevDragRow, prevDragPos } = internalData;
5430
+ const { afterFullData, tableFullData } = internalData;
5430
5431
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
5431
5432
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
5432
5433
  if (prevDragRow && dragRow) {
5433
5434
  // 判断是否有拖动
5434
5435
  if (prevDragRow !== dragRow) {
5435
- Promise.resolve(dEndMethod
5436
+ return Promise.resolve(dEndMethod
5436
5437
  ? dEndMethod({
5437
5438
  oldRow: dragRow,
5438
5439
  newRow: prevDragRow,
@@ -5583,6 +5584,38 @@ const Methods = {
5583
5584
  });
5584
5585
  }
5585
5586
  }
5587
+ return Promise.resolve();
5588
+ },
5589
+ handleRowDragDragendEvent(evnt) {
5590
+ const $xeTable = this;
5591
+ const props = $xeTable;
5592
+ const reactData = $xeTable;
5593
+ const internalData = $xeTable;
5594
+ const { treeConfig } = props;
5595
+ const { fullAllDataRowIdData, prevDragToChild } = internalData;
5596
+ const { dragRow } = reactData;
5597
+ const treeOpts = $xeTable.computeTreeOpts;
5598
+ const { lazy } = treeOpts;
5599
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5600
+ const { prevDragRow, prevDragPos } = internalData;
5601
+ if (treeConfig && prevDragToChild) {
5602
+ // 懒加载
5603
+ if (lazy) {
5604
+ const newRowid = getRowid($xeTable, prevDragRow);
5605
+ const rowRest = fullAllDataRowIdData[newRowid];
5606
+ if (prevDragRow[hasChildField]) {
5607
+ if (rowRest && rowRest.treeLoaded) {
5608
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
5609
+ }
5610
+ }
5611
+ else {
5612
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
5613
+ }
5614
+ }
5615
+ }
5616
+ else {
5617
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
5618
+ }
5586
5619
  hideDropTip($xeTable);
5587
5620
  clearRowDropOrigin($xeTable);
5588
5621
  internalData.prevDragToChild = false;
@@ -5601,7 +5634,8 @@ const Methods = {
5601
5634
  const { fullAllDataRowIdData } = internalData;
5602
5635
  const { dragRow } = reactData;
5603
5636
  const treeOpts = $xeTable.computeTreeOpts;
5604
- const { transform, parentField } = treeOpts;
5637
+ const { lazy, transform, parentField } = treeOpts;
5638
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
5605
5639
  const rowDragOpts = $xeTable.computeRowDragOpts;
5606
5640
  const { isPeerDrag, isCrossDrag, isToChildDrag } = rowDragOpts;
5607
5641
  if (!dragRow) {
@@ -5614,18 +5648,21 @@ const Methods = {
5614
5648
  const rest = fullAllDataRowIdData[rowid];
5615
5649
  if (rest) {
5616
5650
  const row = rest.row;
5651
+ const rowid = getRowid($xeTable, row);
5652
+ const rowRest = fullAllDataRowIdData[rowid];
5617
5653
  evnt.preventDefault();
5618
5654
  const { dragRow } = reactData;
5619
5655
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
5620
5656
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
5657
+ internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
5658
+ internalData.prevDragRow = row;
5659
+ internalData.prevDragPos = dragPos;
5621
5660
  if ($xeTable.eqRow(dragRow, row) ||
5661
+ (hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded) ||
5622
5662
  (!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level))) {
5623
5663
  showDropTip($xeTable, evnt, trEl, null, false, dragPos);
5624
5664
  return;
5625
5665
  }
5626
- internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
5627
- internalData.prevDragRow = row;
5628
- internalData.prevDragPos = dragPos;
5629
5666
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
5630
5667
  $xeTable.dispatchEvent('row-dragover', {
5631
5668
  oldRow: dragRow,
@@ -5884,15 +5921,15 @@ const Methods = {
5884
5921
  const { clientX } = evnt;
5885
5922
  const offsetX = clientX - thEl.getBoundingClientRect().x;
5886
5923
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
5924
+ internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && hasCtrlKey);
5925
+ internalData.prevDragCol = column;
5926
+ internalData.prevDragPos = dragPos;
5887
5927
  if (column.fixed ||
5888
5928
  (dragCol && dragCol.id === column.id) ||
5889
5929
  (!isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId))) {
5890
5930
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
5891
5931
  return;
5892
5932
  }
5893
- internalData.prevDragToChild = !!((isCrossDrag && isToChildDrag) && hasCtrlKey);
5894
- internalData.prevDragCol = column;
5895
- internalData.prevDragPos = dragPos;
5896
5933
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
5897
5934
  $xeTable.dispatchEvent('column-dragover', {
5898
5935
  oldColumn: dragCol,
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 = "3.12.4";
3
+ export const version = "3.12.5";
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${"3.12.4"}`;
3
+ const version = `table v${"3.12.5"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.12.4";
2223
+ const version = "3.12.5";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2814,7 +2814,7 @@ function isNodeElement(elem) {
2814
2814
  const {
2815
2815
  log: log_log
2816
2816
  } = core_.VxeUI;
2817
- const log_version = `table v${"3.12.4"}`;
2817
+ const log_version = `table v${"3.12.5"}`;
2818
2818
  const warnLog = log_log.create('warn', log_version);
2819
2819
  const errLog = log_log.create('error', log_version);
2820
2820
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -4056,7 +4056,7 @@ const Cell = {
4056
4056
  style: {
4057
4057
  paddingLeft: `${level * indent}px`
4058
4058
  }
4059
- }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasLazyChilds : hasChild) ? [h('div', {
4059
+ }, [showIcon && (lazy ? isLazyLoaded ? hasChild : hasChild || hasLazyChilds : hasChild) ? [h('div', {
4060
4060
  class: 'vxe-tree--btn-wrapper',
4061
4061
  on: ons
4062
4062
  }, [h('i', {
@@ -5137,6 +5137,10 @@ function cacheColumnMap($xeTable) {
5137
5137
  isCrossDrag,
5138
5138
  isSelfToChildDrag
5139
5139
  } = columnDragOpts;
5140
+ const customOpts = $xeTable.computeCustomOpts;
5141
+ const {
5142
+ storage
5143
+ } = customOpts;
5140
5144
  const rowOpts = $xeTable.computeRowOpts;
5141
5145
  const isGroup = collectColumn.some(hasChildrenList);
5142
5146
  let isAllOverflow = !!props.showOverflow;
@@ -5170,8 +5174,8 @@ function cacheColumnMap($xeTable) {
5170
5174
  }
5171
5175
  fullColumnFieldData[field] = rest;
5172
5176
  } else {
5173
- if (isCrossDrag || isSelfToChildDrag) {
5174
- errLog('vxe.error.emptyProp', ['column.field']);
5177
+ if (storage || isCrossDrag || isSelfToChildDrag) {
5178
+ errLog('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field`]);
5175
5179
  }
5176
5180
  }
5177
5181
  if (!hasFixed && fixed) {
@@ -11393,7 +11397,7 @@ const Methods = {
11393
11397
  evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
11394
11398
  }
11395
11399
  },
11396
- handleRowDragDragendEvent(evnt) {
11400
+ handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
11397
11401
  const $xeTable = this;
11398
11402
  const props = $xeTable;
11399
11403
  const reactData = $xeTable;
@@ -11404,8 +11408,7 @@ const Methods = {
11404
11408
  } = props;
11405
11409
  const rowDragOpts = $xeTable.computeRowDragOpts;
11406
11410
  const {
11407
- fullAllDataRowIdData,
11408
- prevDragToChild
11411
+ fullAllDataRowIdData
11409
11412
  } = internalData;
11410
11413
  const {
11411
11414
  isPeerDrag,
@@ -11421,21 +11424,16 @@ const Methods = {
11421
11424
  parentField
11422
11425
  } = treeOpts;
11423
11426
  const childrenField = treeOpts.children || treeOpts.childrenField;
11424
- const {
11425
- dragRow
11426
- } = reactData;
11427
11427
  const {
11428
11428
  afterFullData,
11429
- tableFullData,
11430
- prevDragRow,
11431
- prevDragPos
11429
+ tableFullData
11432
11430
  } = internalData;
11433
11431
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
11434
11432
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
11435
11433
  if (prevDragRow && dragRow) {
11436
11434
  // 判断是否有拖动
11437
11435
  if (prevDragRow !== dragRow) {
11438
- Promise.resolve(dEndMethod ? dEndMethod({
11436
+ return Promise.resolve(dEndMethod ? dEndMethod({
11439
11437
  oldRow: dragRow,
11440
11438
  newRow: prevDragRow,
11441
11439
  dragPos: prevDragPos,
@@ -11586,6 +11584,48 @@ const Methods = {
11586
11584
  }).catch(() => {});
11587
11585
  }
11588
11586
  }
11587
+ return Promise.resolve();
11588
+ },
11589
+ handleRowDragDragendEvent(evnt) {
11590
+ const $xeTable = this;
11591
+ const props = $xeTable;
11592
+ const reactData = $xeTable;
11593
+ const internalData = $xeTable;
11594
+ const {
11595
+ treeConfig
11596
+ } = props;
11597
+ const {
11598
+ fullAllDataRowIdData,
11599
+ prevDragToChild
11600
+ } = internalData;
11601
+ const {
11602
+ dragRow
11603
+ } = reactData;
11604
+ const treeOpts = $xeTable.computeTreeOpts;
11605
+ const {
11606
+ lazy
11607
+ } = treeOpts;
11608
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
11609
+ const {
11610
+ prevDragRow,
11611
+ prevDragPos
11612
+ } = internalData;
11613
+ if (treeConfig && prevDragToChild) {
11614
+ // 懒加载
11615
+ if (lazy) {
11616
+ const newRowid = getRowid($xeTable, prevDragRow);
11617
+ const rowRest = fullAllDataRowIdData[newRowid];
11618
+ if (prevDragRow[hasChildField]) {
11619
+ if (rowRest && rowRest.treeLoaded) {
11620
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
11621
+ }
11622
+ } else {
11623
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
11624
+ }
11625
+ }
11626
+ } else {
11627
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
11628
+ }
11589
11629
  hideDropTip($xeTable);
11590
11630
  clearRowDropOrigin($xeTable);
11591
11631
  internalData.prevDragToChild = false;
@@ -11611,9 +11651,11 @@ const Methods = {
11611
11651
  } = reactData;
11612
11652
  const treeOpts = $xeTable.computeTreeOpts;
11613
11653
  const {
11654
+ lazy,
11614
11655
  transform,
11615
11656
  parentField
11616
11657
  } = treeOpts;
11658
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
11617
11659
  const rowDragOpts = $xeTable.computeRowDragOpts;
11618
11660
  const {
11619
11661
  isPeerDrag,
@@ -11630,19 +11672,21 @@ const Methods = {
11630
11672
  const rest = fullAllDataRowIdData[rowid];
11631
11673
  if (rest) {
11632
11674
  const row = rest.row;
11675
+ const rowid = getRowid($xeTable, row);
11676
+ const rowRest = fullAllDataRowIdData[rowid];
11633
11677
  evnt.preventDefault();
11634
11678
  const {
11635
11679
  dragRow
11636
11680
  } = reactData;
11637
11681
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
11638
11682
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
11639
- if ($xeTable.eqRow(dragRow, row) || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
11640
- showDropTip($xeTable, evnt, trEl, null, false, dragPos);
11641
- return;
11642
- }
11643
11683
  internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
11644
11684
  internalData.prevDragRow = row;
11645
11685
  internalData.prevDragPos = dragPos;
11686
+ if ($xeTable.eqRow(dragRow, row) || hasCtrlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
11687
+ showDropTip($xeTable, evnt, trEl, null, false, dragPos);
11688
+ return;
11689
+ }
11646
11690
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
11647
11691
  $xeTable.dispatchEvent('row-dragover', {
11648
11692
  oldRow: dragRow,
@@ -11933,13 +11977,13 @@ const Methods = {
11933
11977
  } = evnt;
11934
11978
  const offsetX = clientX - thEl.getBoundingClientRect().x;
11935
11979
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
11980
+ internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
11981
+ internalData.prevDragCol = column;
11982
+ internalData.prevDragPos = dragPos;
11936
11983
  if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
11937
11984
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
11938
11985
  return;
11939
11986
  }
11940
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
11941
- internalData.prevDragCol = column;
11942
- internalData.prevDragPos = dragPos;
11943
11987
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
11944
11988
  $xeTable.dispatchEvent('column-dragover', {
11945
11989
  oldColumn: dragCol,
@@ -23344,10 +23388,10 @@ function validErrorRuleValue(rule, val) {
23344
23388
  allowFixed,
23345
23389
  allowResizable
23346
23390
  } = customOpts;
23347
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
23348
- if (parent) {
23391
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parentColumn) => {
23392
+ if (parentColumn) {
23349
23393
  // 更新子列信息
23350
- column.fixed = parent.fixed;
23394
+ column.fixed = parentColumn.fixed;
23351
23395
  } else {
23352
23396
  if (allowSort) {
23353
23397
  const sortIndex = index + 1;