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.
@@ -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) {
@@ -197,7 +199,7 @@ function cacheColumnMap($xeTable) {
197
199
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
198
200
  }
199
201
  }
200
- if (process.env.NODE_ENV === 'development') {
202
+ if (process.env.NODE_ENV === 'developmeznt') {
201
203
  if (htmlColumn) {
202
204
  if (!columnOpts.useKey) {
203
205
  errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
@@ -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,
@@ -7237,6 +7274,10 @@ const Methods = {
7237
7274
  }
7238
7275
  this.$nextTick(this.updateStyle);
7239
7276
  },
7277
+ updateScrollYStatus() {
7278
+ const $xeTable = this;
7279
+ return updateScrollYStatus($xeTable);
7280
+ },
7240
7281
  /**
7241
7282
  * 如果有滚动条,则滚动到对应的位置
7242
7283
  * @param {Number} scrollLeft 左距离
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.3";
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.3"}`;
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.3";
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.3"}`;
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) {
@@ -5237,16 +5241,7 @@ function cacheColumnMap($xeTable) {
5237
5241
  errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand']);
5238
5242
  }
5239
5243
  }
5240
- if (true) {
5241
- if (htmlColumn) {
5242
- if (!columnOpts.useKey) {
5243
- errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html']);
5244
- }
5245
- if (!rowOpts.useKey) {
5246
- errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html']);
5247
- }
5248
- }
5249
- }
5244
+ if (false) {}
5250
5245
  reactData.isGroup = isGroup;
5251
5246
  reactData.treeNodeColumn = treeNodeColumn;
5252
5247
  reactData.expandColumn = expandColumn;
@@ -11402,7 +11397,7 @@ const Methods = {
11402
11397
  evnt.dataTransfer.setDragImage(getTpImg(), 0, 0);
11403
11398
  }
11404
11399
  },
11405
- handleRowDragDragendEvent(evnt) {
11400
+ handleRowDragSwapEvent(evnt, isSyncRow, dragRow, prevDragRow, prevDragPos, prevDragToChild) {
11406
11401
  const $xeTable = this;
11407
11402
  const props = $xeTable;
11408
11403
  const reactData = $xeTable;
@@ -11413,8 +11408,7 @@ const Methods = {
11413
11408
  } = props;
11414
11409
  const rowDragOpts = $xeTable.computeRowDragOpts;
11415
11410
  const {
11416
- fullAllDataRowIdData,
11417
- prevDragToChild
11411
+ fullAllDataRowIdData
11418
11412
  } = internalData;
11419
11413
  const {
11420
11414
  isPeerDrag,
@@ -11430,21 +11424,16 @@ const Methods = {
11430
11424
  parentField
11431
11425
  } = treeOpts;
11432
11426
  const childrenField = treeOpts.children || treeOpts.childrenField;
11433
- const {
11434
- dragRow
11435
- } = reactData;
11436
11427
  const {
11437
11428
  afterFullData,
11438
- tableFullData,
11439
- prevDragRow,
11440
- prevDragPos
11429
+ tableFullData
11441
11430
  } = internalData;
11442
11431
  const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
11443
11432
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
11444
11433
  if (prevDragRow && dragRow) {
11445
11434
  // 判断是否有拖动
11446
11435
  if (prevDragRow !== dragRow) {
11447
- Promise.resolve(dEndMethod ? dEndMethod({
11436
+ return Promise.resolve(dEndMethod ? dEndMethod({
11448
11437
  oldRow: dragRow,
11449
11438
  newRow: prevDragRow,
11450
11439
  dragPos: prevDragPos,
@@ -11595,6 +11584,48 @@ const Methods = {
11595
11584
  }).catch(() => {});
11596
11585
  }
11597
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
+ }
11598
11629
  hideDropTip($xeTable);
11599
11630
  clearRowDropOrigin($xeTable);
11600
11631
  internalData.prevDragToChild = false;
@@ -11620,9 +11651,11 @@ const Methods = {
11620
11651
  } = reactData;
11621
11652
  const treeOpts = $xeTable.computeTreeOpts;
11622
11653
  const {
11654
+ lazy,
11623
11655
  transform,
11624
11656
  parentField
11625
11657
  } = treeOpts;
11658
+ const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
11626
11659
  const rowDragOpts = $xeTable.computeRowDragOpts;
11627
11660
  const {
11628
11661
  isPeerDrag,
@@ -11639,19 +11672,21 @@ const Methods = {
11639
11672
  const rest = fullAllDataRowIdData[rowid];
11640
11673
  if (rest) {
11641
11674
  const row = rest.row;
11675
+ const rowid = getRowid($xeTable, row);
11676
+ const rowRest = fullAllDataRowIdData[rowid];
11642
11677
  evnt.preventDefault();
11643
11678
  const {
11644
11679
  dragRow
11645
11680
  } = reactData;
11646
11681
  const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
11647
11682
  const dragPos = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
11648
- if ($xeTable.eqRow(dragRow, row) || !isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rest.level)) {
11649
- showDropTip($xeTable, evnt, trEl, null, false, dragPos);
11650
- return;
11651
- }
11652
11683
  internalData.prevDragToChild = !!(treeConfig && transform && isToChildDrag && hasCtrlKey);
11653
11684
  internalData.prevDragRow = row;
11654
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
+ }
11655
11690
  showDropTip($xeTable, evnt, trEl, null, true, dragPos);
11656
11691
  $xeTable.dispatchEvent('row-dragover', {
11657
11692
  oldRow: dragRow,
@@ -11942,13 +11977,13 @@ const Methods = {
11942
11977
  } = evnt;
11943
11978
  const offsetX = clientX - thEl.getBoundingClientRect().x;
11944
11979
  const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
11980
+ internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
11981
+ internalData.prevDragCol = column;
11982
+ internalData.prevDragPos = dragPos;
11945
11983
  if (column.fixed || dragCol && dragCol.id === column.id || !isCrossDrag && (isPeerDrag ? dragCol.parentId !== column.parentId : column.parentId)) {
11946
11984
  showDropTip($xeTable, evnt, null, thEl, false, dragPos);
11947
11985
  return;
11948
11986
  }
11949
- internalData.prevDragToChild = !!(isCrossDrag && isToChildDrag && hasCtrlKey);
11950
- internalData.prevDragCol = column;
11951
- internalData.prevDragPos = dragPos;
11952
11987
  showDropTip($xeTable, evnt, null, thEl, true, dragPos);
11953
11988
  $xeTable.dispatchEvent('column-dragover', {
11954
11989
  oldColumn: dragCol,
@@ -13587,6 +13622,10 @@ const Methods = {
13587
13622
  }
13588
13623
  this.$nextTick(this.updateStyle);
13589
13624
  },
13625
+ updateScrollYStatus() {
13626
+ const $xeTable = this;
13627
+ return updateScrollYStatus($xeTable);
13628
+ },
13590
13629
  /**
13591
13630
  * 如果有滚动条,则滚动到对应的位置
13592
13631
  * @param {Number} scrollLeft 左距离
@@ -23349,10 +23388,10 @@ function validErrorRuleValue(rule, val) {
23349
23388
  allowFixed,
23350
23389
  allowResizable
23351
23390
  } = customOpts;
23352
- external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(customColumnList, (column, index, items, path, parent) => {
23353
- 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) {
23354
23393
  // 更新子列信息
23355
- column.fixed = parent.fixed;
23394
+ column.fixed = parentColumn.fixed;
23356
23395
  } else {
23357
23396
  if (allowSort) {
23358
23397
  const sortIndex = index + 1;