vxe-table 4.23.4 → 4.23.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.
package/dist/all.esm.js CHANGED
@@ -56,7 +56,7 @@ function getDefaultConfig(val1, def1) {
56
56
  return XEUtils.eqNull(val1) ? def1 : val1;
57
57
  }
58
58
 
59
- const version = "4.23.4";
59
+ const version = "4.23.5";
60
60
  VxeUI.version = version;
61
61
  VxeUI.tableVersion = version;
62
62
  VxeUI.setConfig({
@@ -952,7 +952,7 @@ function getPopupAppendElement(appendTo) {
952
952
  }
953
953
 
954
954
  const { log } = VxeUI;
955
- const tableVersion = `table v${"4.23.4"}`;
955
+ const tableVersion = `table v${"4.23.5"}`;
956
956
  function createComponentLog(name) {
957
957
  const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
958
958
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -10075,7 +10075,7 @@ hooks$5.add('tableEditModule', {
10075
10075
  }
10076
10076
  reactData.removeRowFlag++;
10077
10077
  reactData.insertRowFlag++;
10078
- $xeTable.cacheRowMap(false);
10078
+ $xeTable.cacheRowMap(false, false);
10079
10079
  $xeTable.updateScrollYStatus();
10080
10080
  $xeTable.handleTableData(treeConfig && transform);
10081
10081
  if (!(treeConfig && transform)) {
@@ -10442,7 +10442,7 @@ hooks$5.add('tableEditModule', {
10442
10442
  reactData.removeRowFlag++;
10443
10443
  reactData.insertRowFlag++;
10444
10444
  reactData.pendingRowFlag++;
10445
- $xeTable.cacheRowMap(false);
10445
+ $xeTable.cacheRowMap(false, false);
10446
10446
  $xeTable.handleTableData(treeConfig && transform);
10447
10447
  $xeTable.updateFooter();
10448
10448
  $xeTable.handleUpdateBodyMerge();
@@ -17608,7 +17608,7 @@ var VxeTableComponent = defineVxeComponent({
17608
17608
  internalData.tableFullGroupData = groupRest.treeData;
17609
17609
  reactData.isRowGroupStatus = true;
17610
17610
  reactData.rowGroupList = aggGroupConfs;
17611
- $xeTable.cacheRowMap(false);
17611
+ $xeTable.cacheRowMap(false, false);
17612
17612
  }
17613
17613
  // 如果自定义了顺序
17614
17614
  if (isCustomSort && sortData) {
@@ -19137,7 +19137,7 @@ var VxeTableComponent = defineVxeComponent({
19137
19137
  }
19138
19138
  }
19139
19139
  };
19140
- const handleAsyncTreeExpandChilds = (row) => {
19140
+ const handleAsyncTreeExpandChilds = (row, autoExpand) => {
19141
19141
  const treeOpts = computeTreeOpts.value;
19142
19142
  const checkboxOpts = computeCheckboxOpts.value;
19143
19143
  const { transform, loadMethod } = treeOpts;
@@ -19161,7 +19161,7 @@ var VxeTableComponent = defineVxeComponent({
19161
19161
  if (childRecords) {
19162
19162
  return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
19163
19163
  const { treeExpandedMaps } = internalData;
19164
- if (childRows.length && !treeExpandedMaps[rowid]) {
19164
+ if (autoExpand && childRows.length && !treeExpandedMaps[rowid]) {
19165
19165
  treeExpandedMaps[rowid] = row;
19166
19166
  }
19167
19167
  reactData.treeExpandedFlag++;
@@ -19869,7 +19869,7 @@ var VxeTableComponent = defineVxeComponent({
19869
19869
  internalData.tableFullTreeData = isRGroup ? [] : treeData;
19870
19870
  internalData.tableFullGroupData = isRGroup ? treeData : [];
19871
19871
  // 缓存数据
19872
- $xeTable.cacheRowMap(isReset);
19872
+ $xeTable.cacheRowMap(isReset, true);
19873
19873
  // 原始数据
19874
19874
  internalData.tableSynchData = datas;
19875
19875
  if (isReset) {
@@ -20340,7 +20340,7 @@ var VxeTableComponent = defineVxeComponent({
20340
20340
  const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
20341
20341
  // 是否使用懒加载
20342
20342
  if (isLoad) {
20343
- result.push(handleAsyncTreeExpandChilds(row));
20343
+ result.push(handleAsyncTreeExpandChilds(row, true));
20344
20344
  }
20345
20345
  else {
20346
20346
  if (row[childrenField] && row[childrenField].length) {
@@ -21331,7 +21331,7 @@ var VxeTableComponent = defineVxeComponent({
21331
21331
  if (reDelFlag) {
21332
21332
  reactData.removeRowFlag++;
21333
21333
  $xeTable.updateFooter();
21334
- $xeTable.cacheRowMap(false);
21334
+ $xeTable.cacheRowMap(false, true);
21335
21335
  $xeTable.handleTableData(treeConfig && transform);
21336
21336
  if (!(treeConfig && transform)) {
21337
21337
  $xeTable.updateAfterDataIndex();
@@ -23569,7 +23569,7 @@ var VxeTableComponent = defineVxeComponent({
23569
23569
  * 重新懒加载树节点,并展开该节点
23570
23570
  * @param {Row} row 行对象
23571
23571
  */
23572
- reloadTreeExpand(row) {
23572
+ reloadTreeExpand(row, autoExpand = true) {
23573
23573
  const { treeExpandLazyLoadedMaps } = internalData;
23574
23574
  const treeOpts = computeTreeOpts.value;
23575
23575
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
@@ -23577,7 +23577,7 @@ var VxeTableComponent = defineVxeComponent({
23577
23577
  const rowid = getRowid($xeTable, row);
23578
23578
  if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
23579
23579
  return $xeTable.clearTreeExpandLoaded(row).then(() => {
23580
- return handleAsyncTreeExpandChilds(row);
23580
+ return handleAsyncTreeExpandChilds(row, autoExpand);
23581
23581
  }).then(() => {
23582
23582
  if (transform) {
23583
23583
  handleVirtualTreeToList();
@@ -25467,7 +25467,7 @@ var VxeTableComponent = defineVxeComponent({
25467
25467
  internalData.insertRowMaps = iRowMaps;
25468
25468
  internalData.removeRowMaps = rRowMaps;
25469
25469
  internalData.afterFullData = afterFullList;
25470
- $xeTable.cacheRowMap(false);
25470
+ $xeTable.cacheRowMap(false, false);
25471
25471
  $xeTable.handleTableData(treeConfig && transform);
25472
25472
  $xeTable.updateFooter();
25473
25473
  $xeTable.handleUpdateBodyMerge();
@@ -25695,7 +25695,7 @@ var VxeTableComponent = defineVxeComponent({
25695
25695
  /**
25696
25696
  * 更新数据行的 Map
25697
25697
  */
25698
- cacheRowMap(isReset) {
25698
+ cacheRowMap(isReset, isReLoaded) {
25699
25699
  const { treeConfig } = props;
25700
25700
  const { isRowGroupStatus } = reactData;
25701
25701
  const { currKeyField, fullAllDataRowIdData, tableFullData, tableFullTreeData, tableFullGroupData, treeExpandedMaps, rowExpandedMaps, selectCheckboxMaps } = internalData;
@@ -25714,8 +25714,10 @@ var VxeTableComponent = defineVxeComponent({
25714
25714
  fullDataRowIdMaps[rowid] = rowRest;
25715
25715
  fullAllDataRowIdMaps[rowid] = rowRest;
25716
25716
  }
25717
- rowRest.treeLoaded = false;
25718
- rowRest.expandLoaded = false;
25717
+ if (isReset || isReLoaded) {
25718
+ rowRest.treeLoaded = false;
25719
+ rowRest.expandLoaded = false;
25720
+ }
25719
25721
  rowRest._seq = rowNum++;
25720
25722
  rowRest.row = row;
25721
25723
  rowRest.items = items;
@@ -27749,7 +27751,7 @@ var VxeTableComponent = defineVxeComponent({
27749
27751
  }
27750
27752
  $xeTable.handleClearStack();
27751
27753
  $xeTable.handleTableData(treeConfig && transform);
27752
- $xeTable.cacheRowMap(false);
27754
+ $xeTable.cacheRowMap(false, false);
27753
27755
  updateScrollYStatus();
27754
27756
  if (!(treeConfig && transform)) {
27755
27757
  $xeTable.updateAfterDataIndex();
@@ -28106,31 +28108,62 @@ var VxeTableComponent = defineVxeComponent({
28106
28108
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
28107
28109
  const { prevDragRow, prevDragPos } = internalData;
28108
28110
  const rowDragOpts = computeRowDragOpts.value;
28109
- const { isCrossTableDrag } = rowDragOpts;
28111
+ const { isCrossDrag, isCrossTableDrag, isAutoExpandToChild, isAutoLazyLoadToChild } = rowDragOpts;
28112
+ const childrenField = treeOpts.children || treeOpts.childrenField;
28110
28113
  // 跨表拖拽
28111
- if (isCrossTableDrag && crossTableDragRowObj) {
28114
+ if (isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj) {
28112
28115
  const { $newTable } = crossTableDragRowObj;
28113
28116
  if ($newTable && $newTable.xID !== $xeTable.xID) {
28114
28117
  $newTable.handleCrossTableRowDragInsertEvent(evnt);
28115
28118
  return;
28116
28119
  }
28117
28120
  }
28118
- if (treeConfig && lazy && prevDragToChild) {
28121
+ if (treeConfig && prevDragToChild) {
28119
28122
  // 懒加载
28120
- const newRowid = getRowid($xeTable, prevDragRow);
28121
- const rowRest = fullAllDataRowIdData[newRowid];
28122
- if (prevDragRow[hasChildField]) {
28123
- if (rowRest && rowRest.treeLoaded) {
28123
+ const prevRowid = getRowid($xeTable, prevDragRow);
28124
+ const rowRest = fullAllDataRowIdData[prevRowid];
28125
+ if (!rowRest) {
28126
+ handleRowDragEndClearStatus();
28127
+ return;
28128
+ }
28129
+ const hasLazyChilds = prevDragRow[hasChildField];
28130
+ const rowChilds = prevDragRow[childrenField];
28131
+ // 如果懒加载节点未被加载
28132
+ if (isAutoExpandToChild) {
28133
+ // 判断目标节点是否有树子级
28134
+ if ((lazy && hasLazyChilds) || (rowChilds && rowChilds.length)) {
28135
+ hideDropTip();
28136
+ $xeTable.setTreeExpand(prevDragRow, true).then(() => {
28137
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28138
+ });
28139
+ return;
28140
+ }
28141
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild).then(() => {
28142
+ if (!$xeTable.isTreeExpandByRow(prevDragRow)) {
28143
+ $xeTable.setTreeExpand(prevDragRow, true);
28144
+ }
28145
+ });
28146
+ return;
28147
+ }
28148
+ // 如果是懒加载节点。只加载不自动展开
28149
+ if ((lazy && hasLazyChilds) && isAutoLazyLoadToChild) {
28150
+ if (rowChilds && rowChilds.length) {
28124
28151
  $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28152
+ return;
28125
28153
  }
28154
+ hideDropTip();
28155
+ $xeTable.reloadTreeExpand(prevDragRow, false).then(() => {
28156
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28157
+ });
28158
+ return;
28126
28159
  }
28127
- else {
28128
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28160
+ // 懒加载的行默认需要先展开过后才允许拖拽,除非启用 isAutoExpandToChild | isAutoLazyLoadToChild
28161
+ if (lazy && hasLazyChilds && !rowRest.treeLoaded) {
28162
+ handleRowDragEndClearStatus();
28163
+ return;
28129
28164
  }
28130
28165
  }
28131
- else {
28132
- $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28133
- }
28166
+ $xeTable.handleRowDragSwapEvent(evnt, true, dragRow, prevDragRow, prevDragPos, prevDragToChild);
28134
28167
  },
28135
28168
  handleRowDragDragoverEvent(evnt) {
28136
28169
  const { treeConfig } = props;
@@ -28140,7 +28173,7 @@ var VxeTableComponent = defineVxeComponent({
28140
28173
  const { lazy, transform, parentField } = treeOpts;
28141
28174
  const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
28142
28175
  const rowDragOpts = computeRowDragOpts.value;
28143
- const { isPeerDrag, isCrossDrag, isToChildDrag, isCrossTableDrag } = rowDragOpts;
28176
+ const { isPeerDrag, isCrossDrag, isToChildDrag, isCrossTableDrag, isAutoLazyLoadToChild, isAutoExpandToChild } = rowDragOpts;
28144
28177
  if (!dragRow && !(isCrossTableDrag && (!treeConfig || isCrossDrag) && crossTableDragRowObj)) {
28145
28178
  evnt.preventDefault();
28146
28179
  return;
@@ -28184,7 +28217,7 @@ var VxeTableComponent = defineVxeComponent({
28184
28217
  }
28185
28218
  }
28186
28219
  if ($xeTable.eqRow(dragRow, row) ||
28187
- (isControlKey && treeConfig && lazy && row[hasChildField] && rowRest && !rowRest.treeLoaded) ||
28220
+ (isControlKey && treeConfig && lazy && row[hasChildField] && (rowRest && !rowRest.treeLoaded) && !isAutoLazyLoadToChild && !isAutoExpandToChild) ||
28188
28221
  (!isCrossDrag && treeConfig && transform && (isPeerDrag ? dragRow[parentField] !== row[parentField] : rowRest.level))) {
28189
28222
  showDropTip(evnt, trEl, null, false, dragPos);
28190
28223
  return;