tomtaw-vxe-table 3.25.19 → 3.25.21

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.
Files changed (43) hide show
  1. package/es/colgroup/index.d.ts +2 -0
  2. package/es/column/index.d.ts +2 -0
  3. package/es/grid/index.d.ts +2 -0
  4. package/es/grid/src/grid.d.ts +1 -0
  5. package/es/table/src/body.js +84 -36
  6. package/es/table/src/column.d.ts +2 -0
  7. package/es/table/src/column.js +2 -0
  8. package/es/table/src/columnInfo.js +1 -0
  9. package/es/table/src/group.d.ts +1 -0
  10. package/es/table/src/header.d.ts +3 -1
  11. package/es/table/src/header.js +49 -12
  12. package/es/table/src/methods.js +142 -79
  13. package/es/table/src/table.js +6 -15
  14. package/es/table/src/util.d.ts +3 -1
  15. package/es/table/src/util.js +30 -14
  16. package/es/ui/index.js +1 -1
  17. package/es/ui/src/log.js +1 -1
  18. package/lib/index.umd.js +315 -164
  19. package/lib/index.umd.min.js +3 -3
  20. package/lib/table/src/body.js +84 -36
  21. package/lib/table/src/column.js +2 -0
  22. package/lib/table/src/columnInfo.js +1 -0
  23. package/lib/table/src/header.js +48 -11
  24. package/lib/table/src/methods.js +147 -86
  25. package/lib/table/src/table.js +6 -15
  26. package/lib/table/src/util.js +30 -14
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/src/log.js +1 -1
  29. package/package.json +1 -1
  30. package/packages/table/src/body.ts +71 -35
  31. package/packages/table/src/column.ts +2 -0
  32. package/packages/table/src/columnInfo.ts +1 -0
  33. package/packages/table/src/header.ts +53 -13
  34. package/packages/table/src/methods.ts +176 -79
  35. package/packages/table/src/table.ts +10 -18
  36. package/packages/table/src/util.ts +32 -15
  37. package/types/all.d.ts +23 -1
  38. /package/es/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
  39. /package/es/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
  40. /package/es/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
  41. /package/lib/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
  42. /package/lib/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
  43. /package/lib/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
@@ -53,9 +53,9 @@ function isTableDestroyed($xeTable) {
53
53
  const { getConfig, getI18n, renderer, formats, interceptor, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = import_core.VxeUI;
54
54
  const supportMaxRow = 5e6;
55
55
  const customStorageKey = "VXE_CUSTOM_STORE";
56
- const maxYHeight = 5e6;
57
56
  const maxXWidth = 5e6;
58
57
  const sourceType = "table";
58
+ const filteredRowModels = /* @__PURE__ */ new WeakMap();
59
59
  const customStorageQueues = /* @__PURE__ */ new WeakMap();
60
60
  const pendingExpandOffsetUpdates = /* @__PURE__ */ new WeakMap();
61
61
  const expandHeightCaches = /* @__PURE__ */ new WeakMap();
@@ -753,7 +753,7 @@ function handleVirtualTreeToList($xeTable) {
753
753
  }
754
754
  return internalData.afterFullData;
755
755
  }
756
- function updateAfterFullData($xeTable) {
756
+ function updateAfterFullData($xeTable, reason) {
757
757
  const props = $xeTable;
758
758
  const reactData = $xeTable;
759
759
  const internalData = $xeTable;
@@ -771,6 +771,8 @@ function updateAfterFullData($xeTable) {
771
771
  const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological, isDeep: isSortDeep } = sortOpts;
772
772
  let tableData = [];
773
773
  let tableTree = [];
774
+ const previousFilter = reason === "sort" ? filteredRowModels.get($xeTable) : void 0;
775
+ filteredRowModels.delete($xeTable);
774
776
  if (!allRemoteFilter || !allRemoteSort) {
775
777
  const filterColumns = [];
776
778
  let orderColumns = [];
@@ -833,7 +835,19 @@ function updateAfterFullData($xeTable) {
833
835
  });
834
836
  tableData = tableTree;
835
837
  } else {
836
- tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
838
+ if (!treeConfig && filterOpts.cacheOnSort === true) {
839
+ const keys = [allFilterMethod, rendererOpts];
840
+ for (const { column, itemList } of filterColumns) {
841
+ keys.push(column, column.field, column.filterMethod, column.filterRender, itemList.length);
842
+ for (const item of itemList) keys.push(item, item.value, item.data);
843
+ }
844
+ const reuse = previousFilter && previousFilter.source === tableFullData && previousFilter.length === tableFullData.length && keys.length === previousFilter.keys.length && keys.every((value, index) => value === previousFilter.keys[index]);
845
+ const rows = reuse ? previousFilter.rows : tableFullData.filter(handleFilter);
846
+ filteredRowModels.set($xeTable, { source: tableFullData, length: tableFullData.length, keys, rows });
847
+ tableData = rows.slice();
848
+ } else {
849
+ tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
850
+ }
837
851
  tableTree = tableData;
838
852
  }
839
853
  } else {
@@ -958,6 +972,18 @@ function updateAfterFullData($xeTable) {
958
972
  internalData.afterGroupFullData = tableTree;
959
973
  updateAfterDataIndex($xeTable);
960
974
  }
975
+ function syncReusedCurrentRows($xeTable, root, currentRow) {
976
+ const internalData = $xeTable;
977
+ const rowid = $xeTable.computeRowOpts.isCurrent || $xeTable.highlightCurrentRow ? (0, import_util.getRowid)($xeTable, currentRow) : null;
978
+ const marked = root.querySelectorAll(".row--current[rowid]");
979
+ for (let i = 0; i < marked.length; i++) {
980
+ if (marked[i].getAttribute("rowid") !== rowid) (0, import_dom.removeClass)(marked[i], "row--current");
981
+ }
982
+ if (rowid !== null && internalData.visibleDataRowIdData[rowid]) {
983
+ const matches = root.querySelectorAll(`[rowid="${rowid}"]`);
984
+ for (let i = 0; i < matches.length; i++) (0, import_dom.addClass)(matches[i], "row--current");
985
+ }
986
+ }
961
987
  function updateStyle($xeTable) {
962
988
  const props = $xeTable;
963
989
  const reactData = $xeTable;
@@ -1105,7 +1131,7 @@ function updateStyle($xeTable) {
1105
1131
  if (layout === "header") {
1106
1132
  let renderColumnList = tableColumn;
1107
1133
  const isOptimizeMode = isHeaderRenderOptimize;
1108
- if (isGroup) {
1134
+ if (isGroup && !isOptimizeMode) {
1109
1135
  renderColumnList = visibleColumn;
1110
1136
  } else {
1111
1137
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -1118,22 +1144,9 @@ function updateStyle($xeTable) {
1118
1144
  }
1119
1145
  }
1120
1146
  const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
1121
- if (fixedType) {
1122
- if (isGroup) {
1123
- if (wrapperElem) {
1124
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : "";
1125
- }
1126
- } else {
1127
- if (isOptimizeMode) {
1128
- if (wrapperElem) {
1129
- wrapperElem.style.width = tWidth ? `${tWidth}px` : "";
1130
- }
1131
- } else {
1132
- if (wrapperElem) {
1133
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : "";
1134
- }
1135
- }
1136
- }
1147
+ if (fixedType && wrapperElem) {
1148
+ const width = isOptimizeMode ? tWidth : scrollXWidth;
1149
+ wrapperElem.style.width = width ? `${width}px` : "";
1137
1150
  }
1138
1151
  if (currScrollElem) {
1139
1152
  currScrollElem.style.height = `${tHeaderHeight}px`;
@@ -1385,7 +1398,7 @@ function updateStyleWithDedupe($xeTable) {
1385
1398
  if (layout === "header") {
1386
1399
  let renderColumnList = tableColumn;
1387
1400
  const isOptimizeMode = isHeaderRenderOptimize;
1388
- if (isGroup) {
1401
+ if (isGroup && !isOptimizeMode) {
1389
1402
  renderColumnList = visibleColumn;
1390
1403
  } else {
1391
1404
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -1398,22 +1411,9 @@ function updateStyleWithDedupe($xeTable) {
1398
1411
  }
1399
1412
  }
1400
1413
  const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
1401
- if (fixedType) {
1402
- if (isGroup) {
1403
- if (wrapperElem) {
1404
- setLayoutStyle(wrapperElem, "width", scrollXWidth ? `${scrollXWidth}px` : "");
1405
- }
1406
- } else {
1407
- if (isOptimizeMode) {
1408
- if (wrapperElem) {
1409
- setLayoutStyle(wrapperElem, "width", tWidth ? `${tWidth}px` : "");
1410
- }
1411
- } else {
1412
- if (wrapperElem) {
1413
- setLayoutStyle(wrapperElem, "width", scrollXWidth ? `${scrollXWidth}px` : "");
1414
- }
1415
- }
1416
- }
1414
+ if (fixedType && wrapperElem) {
1415
+ const width = isOptimizeMode ? tWidth : scrollXWidth;
1416
+ setLayoutStyle(wrapperElem, "width", width ? `${width}px` : "");
1417
1417
  }
1418
1418
  if (currScrollElem) {
1419
1419
  setLayoutStyle(currScrollElem, "height", `${tHeaderHeight}px`);
@@ -1510,7 +1510,7 @@ function updateStyleWithDedupe($xeTable) {
1510
1510
  }
1511
1511
  return $xeTable.$nextTick();
1512
1512
  }
1513
- function updateScrollXSpaceWithDedupe($xeTable) {
1513
+ function updateScrollXSpaceWithDedupe($xeTable, beforeWindowCommit) {
1514
1514
  const reactData = $xeTable;
1515
1515
  const internalData = $xeTable;
1516
1516
  const { scrollXLoad, overflowX, scrollXWidth } = reactData;
@@ -1586,6 +1586,7 @@ function updateScrollXSpaceWithDedupe($xeTable) {
1586
1586
  if (scrollXSpaceEl) {
1587
1587
  setLayoutStyle(scrollXSpaceEl, "width", `${ySpaceWidth}px`);
1588
1588
  }
1589
+ if (beforeWindowCommit) return;
1589
1590
  calcScrollbar($xeTable);
1590
1591
  if (isScrollXBig && mouseOpts.area) {
1591
1592
  errLog("vxe.error.notProp", ["mouse-config.area"]);
@@ -2116,26 +2117,23 @@ function computeRowHeight($xeTable) {
2116
2117
  function handleVirtualYVisible($xeTable) {
2117
2118
  const reactData = $xeTable;
2118
2119
  const internalData = $xeTable;
2119
- const { isAllOverflow, expandColumn, isScrollYBig, scrollYHeight } = reactData;
2120
- const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
2121
- const rowOpts = $xeTable.computeRowOpts;
2122
- const cellOpts = $xeTable.computeCellOpts;
2123
- const defaultRowHeight = $xeTable.computeDefaultRowHeight;
2120
+ const { isScrollYBig, scrollYHeight } = reactData;
2121
+ const { elemStore, afterFullData, fullAllDataRowIdData } = internalData;
2124
2122
  const bodyScrollElem = (0, import_util.getRefElem)(elemStore["main-body-scroll"]);
2125
2123
  if (bodyScrollElem) {
2126
2124
  const clientHeight = bodyScrollElem.clientHeight;
2127
2125
  let scrollTop = bodyScrollElem.scrollTop;
2128
2126
  if (isScrollYBig) {
2129
- scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (maxYHeight - clientHeight)));
2127
+ scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (import_util.maxYHeight - clientHeight)));
2130
2128
  }
2131
2129
  const startTop = scrollTop;
2132
2130
  const endTop = scrollTop + clientHeight;
2133
2131
  let toVisibleIndex = -1;
2134
2132
  let visibleSize = 0;
2135
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
2136
- if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
2137
- toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
2138
- visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
2133
+ const uniformHeight = (0, import_util.getUniformRowHeight)($xeTable);
2134
+ if (uniformHeight) {
2135
+ toVisibleIndex = Math.max(0, Math.floor(startTop / uniformHeight) - 1);
2136
+ visibleSize = $xeTable.computeCellOpts.height || $xeTable.computeRowOpts.height ? Math.min(afterFullData.length - toVisibleIndex, Math.floor(endTop / uniformHeight) + 2 - toVisibleIndex) : Math.ceil(clientHeight / uniformHeight) + 1;
2139
2137
  } else {
2140
2138
  const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
2141
2139
  let leftIndex = 0;
@@ -2558,7 +2556,7 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
2558
2556
  }
2559
2557
  if (isUpdate) {
2560
2558
  if (!remote) {
2561
- $xeTable.handleTableData(true);
2559
+ $xeTable.handleTableData(true, false, "sort");
2562
2560
  }
2563
2561
  }
2564
2562
  if (evnt) {
@@ -3950,12 +3948,12 @@ function handleLoadDefaults($xeTable) {
3950
3948
  function handleInitDefaults($xeTable) {
3951
3949
  handleDefaultSort($xeTable);
3952
3950
  }
3953
- function getVirtualWindowSlice(source, previous, start, end) {
3951
+ function matchesVirtualWindow(source, previous, start, end) {
3954
3952
  const size = Math.max(0, Math.min(end, source.length) - start);
3955
- if (start >= 0 && end >= 0 && Number.isInteger(start) && Number.isInteger(end) && previous.length === size && previous.every((item, index) => item === source[start + index])) {
3956
- return previous;
3957
- }
3958
- return source.slice(start, end);
3953
+ return start >= 0 && end >= 0 && Number.isInteger(start) && Number.isInteger(end) && previous.length === size && previous.every((item, index) => item === source[start + index]);
3954
+ }
3955
+ function getVirtualWindowSlice(source, previous, start, end) {
3956
+ return matchesVirtualWindow(source, previous, start, end) ? previous : source.slice(start, end);
3959
3957
  }
3960
3958
  function handleTableColumn($xeTable, reuseWindow = false) {
3961
3959
  const reactData = $xeTable;
@@ -4004,7 +4002,7 @@ function loadScrollXData($xeTable) {
4004
4002
  if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
4005
4003
  scrollXStore.startIndex = offsetStartIndex;
4006
4004
  scrollXStore.endIndex = offsetEndIndex;
4007
- $xeTable.updateScrollXData();
4005
+ $xeTable.updateScrollXData(true);
4008
4006
  }
4009
4007
  }
4010
4008
  $xeTable.closeTooltip();
@@ -4172,6 +4170,14 @@ function buildColumnInfo($xeTable) {
4172
4170
  if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
4173
4171
  warnLog("vxe.error.notConflictProp", ["show-custom-header & colgroup", "column-config.resizable=false"]);
4174
4172
  }
4173
+ if (reactData.scrollXLoad && !reactData.overflowX && reactData.tableColumn.length < internalData.visibleColumn.length && !$xeTable.computeAutoWidthColumnList.length) {
4174
+ const body = (0, import_util.getRefElem)(internalData.elemStore["main-body-wrapper"]);
4175
+ if (body && body.clientWidth) {
4176
+ $xeTable.analyColumnWidth();
4177
+ autoCellWidth($xeTable);
4178
+ reactData.overflowX = reactData.scrollXWidth > body.clientWidth;
4179
+ }
4180
+ }
4175
4181
  reactData.isColLoading = false;
4176
4182
  return handleLazyRecalculate($xeTable, false, true, true);
4177
4183
  });
@@ -4313,10 +4319,12 @@ function handleSyncScroll($xeTable, isRollX, isRollY, syncGuard) {
4313
4319
  }
4314
4320
  let xRest = null;
4315
4321
  let yRest = null;
4316
- if (!isAllOverflow) {
4322
+ const { startIndex, endIndex } = internalData.scrollYStore;
4323
+ const measureAfterCommit = !isAllOverflow && !!syncGuard && isRollY && !isRollX && scrollYLoad && !reactData.expandColumn && !autoWidthColumnList.length && matchesVirtualWindow(internalData.afterFullData, reactData.tableData, startIndex, endIndex);
4324
+ if (!isAllOverflow && !measureAfterCommit) {
4317
4325
  measureScrollRowOffsets($xeTable);
4318
4326
  }
4319
- if (syncGuard) syncGuard.markMeasured();
4327
+ if (syncGuard && !measureAfterCommit) syncGuard.markMeasured();
4320
4328
  if (isRollX && scrollXLoad) {
4321
4329
  xRest = $xeTable.updateScrollXData();
4322
4330
  }
@@ -4332,8 +4340,8 @@ function handleSyncScroll($xeTable, isRollX, isRollY, syncGuard) {
4332
4340
  }
4333
4341
  if (!isAllOverflow) {
4334
4342
  measureScrollRowOffsets($xeTable);
4343
+ if (syncGuard) syncGuard.markMeasured();
4335
4344
  }
4336
- if (syncGuard) syncGuard.markMeasured();
4337
4345
  return $xeTable.updateScrollYSpace();
4338
4346
  });
4339
4347
  }
@@ -4553,7 +4561,18 @@ function handleUpdateColResize($xeTable, evnt, params) {
4553
4561
  });
4554
4562
  $xeTable.dispatchEvent("column-resizable-change", params, evnt);
4555
4563
  $xeTable.dispatchEvent("resizable-change", params, evnt);
4556
- setTimeout(() => $xeTable.recalculate(true), 300);
4564
+ const internalData = $xeTable;
4565
+ const reactData = $xeTable;
4566
+ const fixedGeometry = (0, import_util.getUniformRowHeight)($xeTable) && ($xeTable.computeCellOpts.height || $xeTable.computeRowOpts.height) && !$xeTable.treeConfig && !internalData.xeGanttView && !$xeTable.computeAutoWidthColumnList.length && !reactData.isGroup && !reactData.isRowGroupStatus && !$xeTable.headerRowStyle && !$xeTable.headerCellStyle && !$xeTable.showFooter && $xeTable.showHeaderOverflow && !internalData.visibleColumn.some((column) => column.showHeaderOverflow === false);
4567
+ const root = $xeTable.$refs.refElem;
4568
+ const width = fixedGeometry && root ? root.clientWidth : 0;
4569
+ const height = fixedGeometry && root ? root.clientHeight : 0;
4570
+ setTimeout(() => {
4571
+ if (isTableDestroyed($xeTable)) return;
4572
+ if (!fixedGeometry || !root || root.clientWidth !== width || root.clientHeight !== height) {
4573
+ $xeTable.recalculate(true);
4574
+ }
4575
+ }, 300);
4557
4576
  });
4558
4577
  }
4559
4578
  function handleUpdateRowResize($xeTable, evnt, params) {
@@ -4597,8 +4616,12 @@ function updateRowOffsetTop($xeTable, dirtyIndex = 0) {
4597
4616
  const rowOpts = $xeTable.computeRowOpts;
4598
4617
  const cellOpts = $xeTable.computeCellOpts;
4599
4618
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4600
- const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
4601
4619
  const previous = rowOffsetIndexes.get($xeTable);
4620
+ const uniformHeight = cellOpts.height || rowOpts.height ? (0, import_util.getUniformRowHeight)($xeTable) : 0;
4621
+ if (uniformHeight && previous && previous.uniformHeight === uniformHeight && previous.rows === afterFullData && previous.rowOrder === internalData.afterFullRowMaps && previous.cache === fullAllDataRowIdData && previous.length === afterFullData.length) {
4622
+ return;
4623
+ }
4624
+ const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
4602
4625
  let startIndex = previous && previous.rows === afterFullData && previous.cache === fullAllDataRowIdData ? Math.max(0, Math.min(dirtyIndex, afterFullData.length)) : 0;
4603
4626
  const firstRow = afterFullData[startIndex];
4604
4627
  const firstRest = firstRow ? fullAllDataRowIdData[handleGetRowId(firstRow)] : null;
@@ -4626,6 +4649,7 @@ function updateRowOffsetTop($xeTable, dirtyIndex = 0) {
4626
4649
  cellOpts,
4627
4650
  defaultRowHeight,
4628
4651
  hasExpandColumn: !!expandColumn,
4652
+ uniformHeight,
4629
4653
  heightFlag: reactData.calcCellHeightFlag,
4630
4654
  firstChangedIndex: Infinity,
4631
4655
  resizeFlag: reactData.resizeHeightFlag
@@ -5116,6 +5140,42 @@ const tableMethods = {
5116
5140
  return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true, true));
5117
5141
  });
5118
5142
  },
5143
+ /** 只改变现有行的展示内容。数据模型或尺寸依赖行值时,沿用完整更新。 */
5144
+ refreshRowContent(rows) {
5145
+ const $xeTable = this;
5146
+ const internalData = $xeTable;
5147
+ const reactData = $xeTable;
5148
+ if (!rows.length) return $xeTable.$nextTick();
5149
+ const { fullDataRowIdData, visibleDataRowIdData, tableFullColumn } = internalData;
5150
+ const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
5151
+ let hasVisibleRow = false;
5152
+ let staleRow = false;
5153
+ for (const row of rows) {
5154
+ const id = handleGetRowId(row);
5155
+ const rest = fullDataRowIdData[id];
5156
+ if (rest && rest.row === row) {
5157
+ rest.formatData = void 0;
5158
+ if (visibleDataRowIdData[id] === row) {
5159
+ rest.contentVersion = (rest.contentVersion || 0) + 1;
5160
+ hasVisibleRow = true;
5161
+ }
5162
+ } else {
5163
+ staleRow = true;
5164
+ }
5165
+ }
5166
+ const remoteFilter = $xeTable.computeFilterOpts.remote;
5167
+ const remoteSort = $xeTable.computeSortOpts.remote;
5168
+ if (staleRow || !reactData.isAllOverflow || internalData.isResizeCellHeight || $xeTable.treeConfig || reactData.isRowGroupStatus || reactData.expandColumn || $xeTable.showFooter || $xeTable.spanMethod || internalData.mergeBodyList.length || internalData.xeGanttView || $xeTable.computeAutoWidthColumnList.length || tableFullColumn.some((column) => !remoteSort && column.sortable && column.order || !remoteFilter && column.filters && column.filters.some((item) => item.checked))) {
5169
+ return $xeTable.updateData();
5170
+ }
5171
+ if (hasVisibleRow) {
5172
+ for (const ref of ["refTableBody", "leftBody", "rightBody"]) {
5173
+ const body = $xeTable.$refs[ref];
5174
+ if (body) body.$forceUpdate();
5175
+ }
5176
+ }
5177
+ return $xeTable.$nextTick();
5178
+ },
5119
5179
  /**
5120
5180
  * 手动处理数据,用于手动排序与筛选
5121
5181
  * 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
@@ -5142,7 +5202,7 @@ const tableMethods = {
5142
5202
  setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50);
5143
5203
  });
5144
5204
  },
5145
- handleTableData(force, reuseWindow = false) {
5205
+ handleTableData(force, reuseWindow = false, reason) {
5146
5206
  const $xeTable = this;
5147
5207
  const reactData = $xeTable;
5148
5208
  const internalData = $xeTable;
@@ -5151,7 +5211,7 @@ const tableMethods = {
5151
5211
  const $xeGanttView = internalData.xeGanttView;
5152
5212
  let fullList = internalData.afterFullData;
5153
5213
  if (force) {
5154
- updateAfterFullData($xeTable);
5214
+ updateAfterFullData($xeTable, reason);
5155
5215
  fullList = handleVirtualTreeToList($xeTable);
5156
5216
  internalData.mergeHeaderRowMaps = {};
5157
5217
  internalData.mergeHeaderColMaps = {};
@@ -7319,12 +7379,7 @@ const tableMethods = {
7319
7379
  evnt.preventDefault();
7320
7380
  const { fullColumnIdData } = internalData;
7321
7381
  const { column } = params;
7322
- let resizeColumn = column;
7323
- if (column.children && column.children.length) {
7324
- import_xe_utils.default.eachTree(column.children, (childColumn) => {
7325
- resizeColumn = childColumn;
7326
- });
7327
- }
7382
+ const resizeColumn = (0, import_util.getLastChildColumn)(column);
7328
7383
  const colid = resizeColumn.id;
7329
7384
  const colRest = fullColumnIdData[colid];
7330
7385
  const dragBtnElem = evnt.target;
@@ -11353,7 +11408,7 @@ const tableMethods = {
11353
11408
  }
11354
11409
  });
11355
11410
  if (!remote || firstSortColumn && firstSortColumn.remoteSort) {
11356
- $xeTable.handleTableData(true);
11411
+ $xeTable.handleTableData(true, false, "sort");
11357
11412
  }
11358
11413
  return $xeTable.$nextTick().then(() => {
11359
11414
  updateRowOffsetTop($xeTable);
@@ -11388,7 +11443,7 @@ const tableMethods = {
11388
11443
  clearAllSort($xeTable);
11389
11444
  }
11390
11445
  if (!sortOpts.remote) {
11391
- $xeTable.handleTableData(true);
11446
+ $xeTable.handleTableData(true, false, "sort");
11392
11447
  }
11393
11448
  return $xeTable.$nextTick().then(() => {
11394
11449
  updateRowOffsetTop($xeTable);
@@ -11418,7 +11473,7 @@ const tableMethods = {
11418
11473
  });
11419
11474
  }
11420
11475
  if (!sortOpts.remote) {
11421
- $xeTable.handleTableData(true);
11476
+ $xeTable.handleTableData(true, false, "sort");
11422
11477
  }
11423
11478
  if (!multiple) {
11424
11479
  column = sortCols[0];
@@ -12818,12 +12873,14 @@ const tableMethods = {
12818
12873
  fixed: ""
12819
12874
  });
12820
12875
  },
12821
- updateScrollXData() {
12876
+ updateScrollXData(fromScroll = false) {
12822
12877
  const $xeTable = this;
12823
12878
  const reactData = $xeTable;
12824
12879
  const { isAllOverflow } = reactData;
12880
+ const internalData = $xeTable;
12881
+ const deferLayout = fromScroll && isAllOverflow && reactData.overflowX && reactData.scrollXWidth < maxXWidth && !reactData.expandColumn && !internalData.xeGanttView && !$xeTable.computeAutoWidthColumnList.length;
12825
12882
  handleTableColumn($xeTable);
12826
- $xeTable.updateScrollXSpace();
12883
+ $xeTable.updateScrollXSpace(deferLayout);
12827
12884
  return $xeTable.$nextTick().then(() => {
12828
12885
  handleTableColumn($xeTable, true);
12829
12886
  $xeTable.updateScrollXSpace();
@@ -12833,9 +12890,9 @@ const tableMethods = {
12833
12890
  });
12834
12891
  },
12835
12892
  // 更新横向 X 可视渲染上下剩余空间大小
12836
- updateScrollXSpace() {
12893
+ updateScrollXSpace(beforeWindowCommit = false) {
12837
12894
  if (this.computeVirtualXOpts.experimentalSkipUnchangedStyle === true) {
12838
- return updateScrollXSpaceWithDedupe(this);
12895
+ return updateScrollXSpaceWithDedupe(this, beforeWindowCommit);
12839
12896
  }
12840
12897
  const $xeTable = this;
12841
12898
  const reactData = $xeTable;
@@ -12913,6 +12970,7 @@ const tableMethods = {
12913
12970
  if (scrollXSpaceEl) {
12914
12971
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
12915
12972
  }
12973
+ if (beforeWindowCommit) return;
12916
12974
  calcScrollbar($xeTable);
12917
12975
  if (isScrollXBig && mouseOpts.area) {
12918
12976
  errLog("vxe.error.notProp", ["mouse-config.area"]);
@@ -12967,13 +13025,13 @@ const tableMethods = {
12967
13025
  let sYHeight = scrollYHeight;
12968
13026
  let isScrollYBig = false;
12969
13027
  if (scrollYLoad) {
12970
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
12971
- if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
12972
- sYHeight = afterFullData.length * defaultRowHeight;
12973
- if (sYHeight > maxYHeight) {
13028
+ const uniformHeight = (0, import_util.getUniformRowHeight)($xeTable);
13029
+ if (uniformHeight) {
13030
+ sYHeight = afterFullData.length * uniformHeight;
13031
+ if (sYHeight > import_util.maxYHeight) {
12974
13032
  isScrollYBig = true;
12975
13033
  }
12976
- ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
13034
+ ySpaceTop = Math.max(0, startIndex * uniformHeight);
12977
13035
  } else {
12978
13036
  const firstRow = afterFullData[startIndex];
12979
13037
  if (firstRow) {
@@ -12992,7 +13050,7 @@ const tableMethods = {
12992
13050
  }
12993
13051
  }
12994
13052
  }
12995
- if (sYHeight > maxYHeight) {
13053
+ if (sYHeight > import_util.maxYHeight) {
12996
13054
  isScrollYBig = true;
12997
13055
  }
12998
13056
  } else {
@@ -13011,12 +13069,12 @@ const tableMethods = {
13011
13069
  let ySpaceHeight = sYHeight;
13012
13070
  let scrollYTop = ySpaceTop;
13013
13071
  if (isScrollYBig) {
13014
- if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
13015
- scrollYTop = maxYHeight - bodyTableElem.clientHeight;
13072
+ if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= import_util.maxYHeight) {
13073
+ scrollYTop = import_util.maxYHeight - bodyTableElem.clientHeight;
13016
13074
  } else {
13017
- scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
13075
+ scrollYTop = (import_util.maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
13018
13076
  }
13019
- ySpaceHeight = maxYHeight;
13077
+ ySpaceHeight = import_util.maxYHeight;
13020
13078
  }
13021
13079
  if (!(scrollYLoad && overflowY)) {
13022
13080
  scrollYTop = 0;
@@ -13048,7 +13106,7 @@ const tableMethods = {
13048
13106
  return;
13049
13107
  }
13050
13108
  const root = $xeTable.$refs.refElem;
13051
- if (stableSpace && fromScroll && root && bodyScrollElem && (cellOpts.height || rowOpts.height) && internalData.customHeight > 0 && !$xeTable.computeAutoWidthColumnList.length && !$xeTable.spanMethod && !internalData.mergeBodyList.length && !internalData.currentRow && !($xeTable.mouseConfig && mouseOpts.selected)) {
13109
+ if (stableSpace && fromScroll && root && bodyScrollElem && (cellOpts.height || rowOpts.height) && internalData.customHeight > 0 && !$xeTable.computeAutoWidthColumnList.length && !$xeTable.spanMethod && !internalData.mergeBodyList.length && !($xeTable.mouseConfig && mouseOpts.selected)) {
13052
13110
  const header = (0, import_util.getRefElem)(elemStore["main-header-table"]);
13053
13111
  const footer = (0, import_util.getRefElem)(elemStore["main-footer-table"]);
13054
13112
  const layout = [
@@ -13076,6 +13134,9 @@ const tableMethods = {
13076
13134
  ];
13077
13135
  const previous = scrollYWindowLayouts.get($xeTable);
13078
13136
  if (previous && layout.every((value, index) => value === previous[index])) {
13137
+ if (internalData.currentRow && !$xeTable.rowKey && !rowOpts.useKey) {
13138
+ syncReusedCurrentRows($xeTable, root, internalData.currentRow);
13139
+ }
13079
13140
  reactData.scrollYTop = scrollYTop;
13080
13141
  return;
13081
13142
  }
@@ -1360,31 +1360,22 @@ var table_default = {
1360
1360
  const $xeTable = this;
1361
1361
  const props = $xeTable;
1362
1362
  const reactData = $xeTable;
1363
- const { spanMethod, footerSpanMethod, showHeaderOverflow: allColumnHeaderOverflow } = props;
1364
- const { isGroup, scrollXLoad } = reactData;
1365
- let isOptimizeMode = false;
1366
- if (isGroup) {
1367
- } else {
1368
- if (scrollXLoad && allColumnHeaderOverflow) {
1369
- if (spanMethod || footerSpanMethod) {
1370
- } else {
1371
- isOptimizeMode = true;
1372
- }
1373
- }
1374
- }
1375
- return isOptimizeMode;
1363
+ if (!reactData.scrollXLoad || !props.showHeaderOverflow || props.spanMethod || props.footerSpanMethod) return false;
1364
+ if (!reactData.isGroup) return true;
1365
+ const internalData = $xeTable;
1366
+ return !!(reactData.overflowX && !props.showCustomHeader && !props.headerRowStyle && !props.headerCellStyle && !$xeTable.computeColumnOpts.drag && !$xeTable.computeMouseOpts.area && !(reactData.mergeHeadFlag && internalData.mergeHeaderList.length) && !import_xe_utils.default.findTree(reactData.tableGroupColumn, (column) => column.visible && (column.showHeaderOverflow === false || column.width === "auto" || column.minWidth === "auto")));
1376
1367
  },
1377
1368
  computeIsBodyRenderOptimize() {
1378
1369
  const $xeTable = this;
1379
1370
  const props = $xeTable;
1380
1371
  const reactData = $xeTable;
1381
- const { spanMethod, footerSpanMethod } = props;
1372
+ const { spanMethod } = props;
1382
1373
  const { scrollXLoad, scrollYLoad, isAllOverflow, expandColumn } = reactData;
1383
1374
  const bodyMergeCoverFixed = $xeTable.computeBodyMergeCoverFixed;
1384
1375
  const expandOpts = $xeTable.computeExpandOpts;
1385
1376
  let isOptimizeMode = false;
1386
1377
  if (scrollXLoad || scrollYLoad || isAllOverflow) {
1387
- if (expandColumn && expandOpts.mode !== "fixed" || bodyMergeCoverFixed || spanMethod || footerSpanMethod) {
1378
+ if (expandColumn && expandOpts.mode !== "fixed" || bodyMergeCoverFixed || spanMethod) {
1388
1379
  } else {
1389
1380
  isOptimizeMode = true;
1390
1381
  }
@@ -56,11 +56,13 @@ __export(util_exports, {
56
56
  getRowUniqueId: () => getRowUniqueId,
57
57
  getRowid: () => getRowid,
58
58
  getRowkey: () => getRowkey,
59
+ getUniformRowHeight: () => getUniformRowHeight,
59
60
  handleCustomStoreConfig: () => handleCustomStoreConfig,
60
61
  handleFieldOrColumn: () => handleFieldOrColumn,
61
62
  handleRowidOrRow: () => handleRowidOrRow,
62
63
  hasDeepKey: () => hasDeepKey,
63
64
  isColumnInfo: () => isColumnInfo,
65
+ maxYHeight: () => maxYHeight,
64
66
  restoreScrollLocation: () => restoreScrollLocation,
65
67
  rowToVisible: () => rowToVisible,
66
68
  setCellValue: () => setCellValue,
@@ -774,6 +776,14 @@ function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
774
776
  }
775
777
  return cellHeight;
776
778
  }
779
+ const maxYHeight = 5e6;
780
+ function getUniformRowHeight($xeTable) {
781
+ const reactData = $xeTable;
782
+ const internalData = $xeTable;
783
+ if (!reactData.isAllOverflow || reactData.expandColumn || internalData.isResizeCellHeight) return 0;
784
+ const height = getCellRestHeight({ height: 0, resizeHeight: 0 }, $xeTable.computeCellOpts, $xeTable.computeRowOpts, $xeTable.computeDefaultRowHeight);
785
+ return Number.isFinite(height) && height > 0 ? height : 0;
786
+ }
777
787
  function assembleColumn(_vm) {
778
788
  const $xeTable = _vm.$xeTable;
779
789
  const reactData = $xeTable;
@@ -922,8 +932,10 @@ function getFirstChildColumn(column) {
922
932
  }
923
933
  function getLastChildColumn(column) {
924
934
  const { children } = column;
925
- if (children && children.length) {
926
- return getFirstChildColumn(import_xe_utils.default.last(children));
935
+ if (children) {
936
+ for (let i = children.length - 1; i >= 0; i--) {
937
+ if (children[i].visible !== false) return getLastChildColumn(children[i]);
938
+ }
927
939
  }
928
940
  return column;
929
941
  }
@@ -999,8 +1011,8 @@ function createColumn($xeTable, options, renderOptions) {
999
1011
  function rowToVisible($xeTable, row) {
1000
1012
  const reactData = $xeTable;
1001
1013
  const internalData = $xeTable;
1002
- const { scrollYLoad, scrollYTop, isAllOverflow } = reactData;
1003
- const { elemStore, afterFullData, fullAllDataRowIdData, isResizeCellHeight } = internalData;
1014
+ const { scrollYLoad, scrollYTop, isScrollYBig, scrollYHeight } = reactData;
1015
+ const { elemStore, afterFullData, fullAllDataRowIdData } = internalData;
1004
1016
  const rowOpts = $xeTable.computeRowOpts;
1005
1017
  const cellOpts = $xeTable.computeCellOpts;
1006
1018
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
@@ -1022,17 +1034,21 @@ function rowToVisible($xeTable, row) {
1022
1034
  }
1023
1035
  } else {
1024
1036
  if (scrollYLoad) {
1025
- const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
1026
- if (!isCustomCellHeight && isAllOverflow) {
1027
- return $xeTable.scrollTo(null, ($xeTable.findRowIndexOf(afterFullData, row) - 1) * defaultRowHeight);
1028
- }
1029
- const rowRest = fullAllDataRowIdData[rowid] || {};
1030
- const rHeight = rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
1031
- const scrollTop = rowRest.oTop;
1032
- if (scrollTop < bodyScrollTop) {
1033
- return $xeTable.scrollTo(null, scrollTop - leftFixedWidth - 1);
1037
+ const rowRest = fullAllDataRowIdData[rowid];
1038
+ if (!rowRest) return Promise.resolve();
1039
+ const uniformHeight = getUniformRowHeight($xeTable);
1040
+ const rHeight = uniformHeight || getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight);
1041
+ const index = rowRest._index;
1042
+ if (uniformHeight && afterFullData[index] !== rowRest.row) return Promise.resolve();
1043
+ const rowTop = uniformHeight ? index * rHeight : rowRest.oTop;
1044
+ const scale = isScrollYBig ? (maxYHeight - bodyHeight) / (scrollYHeight - bodyHeight) : 1;
1045
+ let target = rowTop + rHeight - (bodyHeight - rightFixedWidth - 1);
1046
+ if (uniformHeight && !cellOpts.height && !rowOpts.height) {
1047
+ target = rowTop - rHeight;
1048
+ } else if (rowTop < bodyScrollTop / scale) {
1049
+ target = rowTop - leftFixedWidth - 1;
1034
1050
  }
1035
- return $xeTable.scrollTo(null, scrollTop + rHeight - (bodyHeight - rightFixedWidth - 1));
1051
+ return $xeTable.scrollTo(null, isScrollYBig ? Math.round(target * scale) : target);
1036
1052
  }
1037
1053
  }
1038
1054
  }
package/lib/ui/index.js CHANGED
@@ -33,7 +33,7 @@ __export(ui_exports, {
33
33
  module.exports = __toCommonJS(ui_exports);
34
34
  var import_core = require("@vxe-ui/core");
35
35
  var import_utils = require("./src/utils");
36
- const version = "3.25.19";
36
+ const version = "3.25.21";
37
37
  import_core.VxeUI.version = version;
38
38
  import_core.VxeUI.tableVersion = version;
39
39
  import_core.VxeUI.setConfig({
package/lib/ui/src/log.js CHANGED
@@ -25,7 +25,7 @@ __export(log_exports, {
25
25
  module.exports = __toCommonJS(log_exports);
26
26
  var import_core = require("@vxe-ui/core");
27
27
  const { log } = import_core.VxeUI;
28
- const tableVersion = `table v${"3.25.19"}`;
28
+ const tableVersion = `table v${"3.25.21"}`;
29
29
  function createComponentLog(name) {
30
30
  const uiVersion = import_core.VxeUI.uiVersion ? `ui v${import_core.VxeUI.uiVersion}` : "";
31
31
  const ganttVersion = import_core.VxeUI.ganttVersion ? `gantt v${import_core.VxeUI.ganttVersion}` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tomtaw-vxe-table",
3
- "version": "3.25.19",
3
+ "version": "3.25.21",
4
4
  "description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
5
5
  "scripts": {
6
6
  "test:table-performance": "node --test scripts/test-table-performance.cjs",