tomtaw-vxe-table 3.25.20 → 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 (40) hide show
  1. package/es/colgroup/index.d.ts +2 -0
  2. package/es/column/index.d.ts +2 -0
  3. package/es/table/src/body.js +58 -13
  4. package/es/table/src/column.d.ts +2 -0
  5. package/es/table/src/column.js +2 -0
  6. package/es/table/src/columnInfo.js +1 -0
  7. package/es/table/src/group.d.ts +1 -0
  8. package/es/table/src/header.d.ts +3 -1
  9. package/es/table/src/header.js +49 -12
  10. package/es/table/src/methods.js +82 -65
  11. package/es/table/src/table.js +4 -13
  12. package/es/table/src/util.js +4 -2
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/lib/index.umd.js +205 -113
  16. package/lib/index.umd.min.js +3 -3
  17. package/lib/table/src/body.js +58 -13
  18. package/lib/table/src/column.js +2 -0
  19. package/lib/table/src/columnInfo.js +1 -0
  20. package/lib/table/src/header.js +48 -11
  21. package/lib/table/src/methods.js +82 -65
  22. package/lib/table/src/table.js +4 -13
  23. package/lib/table/src/util.js +4 -2
  24. package/lib/ui/index.js +1 -1
  25. package/lib/ui/src/log.js +1 -1
  26. package/package.json +1 -1
  27. package/packages/table/src/body.ts +42 -13
  28. package/packages/table/src/column.ts +2 -0
  29. package/packages/table/src/columnInfo.ts +1 -0
  30. package/packages/table/src/header.ts +53 -13
  31. package/packages/table/src/methods.ts +102 -65
  32. package/packages/table/src/table.ts +8 -16
  33. package/packages/table/src/util.ts +4 -2
  34. package/types/all.d.ts +21 -1
  35. /package/es/{iconfont.1795759903178.ttf → iconfont.1795761876277.ttf} +0 -0
  36. /package/es/{iconfont.1795759903178.woff → iconfont.1795761876277.woff} +0 -0
  37. /package/es/{iconfont.1795759903178.woff2 → iconfont.1795761876277.woff2} +0 -0
  38. /package/lib/{iconfont.1795759903178.ttf → iconfont.1795761876277.ttf} +0 -0
  39. /package/lib/{iconfont.1795759903178.woff → iconfont.1795761876277.woff} +0 -0
  40. /package/lib/{iconfont.1795759903178.woff2 → iconfont.1795761876277.woff2} +0 -0
@@ -33,6 +33,7 @@ __export(body_exports, {
33
33
  module.exports = __toCommonJS(body_exports);
34
34
  var import_xe_utils = __toESM(require("xe-utils"));
35
35
  var import_core = require("@vxe-ui/core");
36
+ var import_comp = require("../../ui/src/comp");
36
37
  var import_utils = require("../../ui/src/utils");
37
38
  var import_util = require("./util");
38
39
  var import_expand_height = require("./expand-height");
@@ -41,6 +42,52 @@ var import_vn = require("../../ui/src/vn");
41
42
  const { getI18n, renderer, renderEmptyElement } = import_core.VxeUI;
42
43
  const sourceType = "table";
43
44
  const renderType = "body";
45
+ const cellScopeKeys = [
46
+ "$table",
47
+ "$grid",
48
+ "$gantt",
49
+ "isEdit",
50
+ "seq",
51
+ "rowid",
52
+ "row",
53
+ "rowIndex",
54
+ "$rowIndex",
55
+ "_rowIndex",
56
+ "column",
57
+ "columnIndex",
58
+ "$columnIndex",
59
+ "_columnIndex",
60
+ "fixed",
61
+ "source",
62
+ "type",
63
+ "isHidden",
64
+ "level",
65
+ "visibleData",
66
+ "data",
67
+ "items"
68
+ ];
69
+ const RowScopedCell = (0, import_comp.defineVxeComponent)({
70
+ name: "VxeRowScopedCell",
71
+ props: [...cellScopeKeys, "contentVersion", "rowOrder", "defaultSlot"],
72
+ data() {
73
+ const props = this.$props;
74
+ const scope = {};
75
+ for (const key of cellScopeKeys) {
76
+ Object.defineProperty(scope, key, { enumerable: true, get: () => props[key] });
77
+ }
78
+ return { cellScope: Object.freeze(scope) };
79
+ },
80
+ render(h) {
81
+ void this.contentVersion;
82
+ void this.rowOrder;
83
+ void this.defaultSlot;
84
+ const scope = this.cellScope;
85
+ return h("div", {
86
+ class: "vxe-cell--wrapper vxe-body-cell--wrapper",
87
+ attrs: { rowid: scope.rowid, colid: scope.column.id }
88
+ }, scope.column.renderCell(h, scope));
89
+ }
90
+ });
44
91
  const isVMScrollProcess = ($xeTable) => {
45
92
  const tableProps = $xeTable;
46
93
  const tableReactData = $xeTable;
@@ -363,19 +410,17 @@ function renderTdColumn(h, $xeTable, options, rowRest, seq, rowid, fixedType, is
363
410
  }
364
411
  const clVNs = [];
365
412
  if (!isVNPreEmptyStatus) {
366
- clVNs.push(
367
- h(
368
- "div",
369
- {
370
- attrs: {
371
- colid,
372
- rowid
373
- },
374
- class: "vxe-cell--wrapper vxe-body-cell--wrapper"
375
- },
376
- column.renderCell(h, cellParams)
377
- )
378
- );
413
+ if (column.rowScopedSlot && slots && slots.default && !type && !editRender && !treeNode && !tableReactData.isRowGroupStatus) {
414
+ clVNs.push(h(RowScopedCell, {
415
+ key: rowid,
416
+ props: { ...cellParams, contentVersion: rowRest.contentVersion, rowOrder: tableInternalData.afterFullRowMaps, defaultSlot: slots.default }
417
+ }));
418
+ } else {
419
+ clVNs.push(h("div", {
420
+ class: "vxe-cell--wrapper vxe-body-cell--wrapper",
421
+ attrs: { colid, rowid }
422
+ }, column.renderCell(h, cellParams)));
423
+ }
379
424
  }
380
425
  tdVNs.push(
381
426
  h(
@@ -86,6 +86,8 @@ const columnProps = {
86
86
  footerClassName: [String, Function],
87
87
  // 格式化显示内容
88
88
  formatter: [Function, Array, String],
89
+ // 只读插槽以独立组件订阅行内容及实际使用的窗口参数。
90
+ rowScopedSlot: Boolean,
89
91
  // 格式化表头显示内容
90
92
  headerFormatter: [Function, Array, String],
91
93
  // 格式化表尾显示内容
@@ -148,6 +148,7 @@ class ColumnInfo {
148
148
  dragSort: colConfs.dragSort,
149
149
  rowResize: colConfs.rowResize,
150
150
  cellType: colConfs.cellType,
151
+ rowScopedSlot: colConfs.rowScopedSlot,
151
152
  cellRender: colConfs.cellRender,
152
153
  editRender,
153
154
  contentRender: colConfs.contentRender,
@@ -39,7 +39,30 @@ var import_vn = require("../../ui/src/vn");
39
39
  const { renderer, renderEmptyElement } = import_core.VxeUI;
40
40
  const sourceType = "table";
41
41
  const renderType = "header";
42
- function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols) {
42
+ function projectHeaderWindow(leaves, rows, columnCache) {
43
+ var _a;
44
+ const groups = /* @__PURE__ */ new Map();
45
+ const headers = rows.map(() => []);
46
+ for (const leaf of leaves) {
47
+ let column = leaf;
48
+ while (column) {
49
+ const headerRow = headers[column.level - 1];
50
+ if (!headerRow) break;
51
+ const group = groups.get(column);
52
+ if (group) {
53
+ group.span++;
54
+ group.width += leaf.renderWidth;
55
+ group.lastLeaf = leaf;
56
+ } else {
57
+ headerRow.push(column);
58
+ groups.set(column, { span: 1, width: leaf.renderWidth, lastLeaf: leaf });
59
+ }
60
+ column = column.parentId ? (_a = columnCache[column.parentId]) == null ? void 0 : _a.column : void 0;
61
+ }
62
+ }
63
+ return { headers, groups };
64
+ }
65
+ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols, groups) {
43
66
  const props = _vm;
44
67
  const $xeTable = _vm.$parent;
45
68
  const $xeGrid = $xeTable.$xeGrid;
@@ -112,9 +135,11 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
112
135
  const thAttrs = {
113
136
  colid
114
137
  };
138
+ const group = groups == null ? void 0 : groups.get(column);
115
139
  let isMergeCell = false;
116
140
  if (!showCustomHeader) {
117
- thAttrs.colspan = column.colSpan > 1 ? column.colSpan : null;
141
+ const colSpan = group ? group.span : column.colSpan;
142
+ thAttrs.colspan = colSpan > 1 ? colSpan : null;
118
143
  thAttrs.rowspan = column.rowSpan > 1 ? column.rowSpan : null;
119
144
  }
120
145
  if (mergeHeadFlag && mergeHeaderList.length && (showCustomHeader || isLastRow)) {
@@ -172,6 +197,8 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
172
197
  tcStyle.minHeight = `${currCellHeight}px`;
173
198
  }
174
199
  if (showCustomHeader) {
200
+ } else if (isColGroup && group) {
201
+ tcStyle.width = `${group.width}px`;
175
202
  } else if (isColGroup && !isLastRow) {
176
203
  let childWidth = 0;
177
204
  import_xe_utils.default.eachTree(column.children, (childRow) => {
@@ -245,7 +272,7 @@ function renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, co
245
272
  /**
246
273
  * 列宽拖动
247
274
  */
248
- !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) ? h("div", {
275
+ !fixedHiddenColumn && showResizable && (!showCustomHeader || isLastRow) && (!group || !isColGroup || group.lastLeaf === (0, import_util.getLastChildColumn)(column)) ? h("div", {
249
276
  class: "vxe-cell--col-resizable",
250
277
  on: {
251
278
  mousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
@@ -381,13 +408,14 @@ function renderFilterRows(h, _vm, isOptimizeMode, cols) {
381
408
  );
382
409
  });
383
410
  }
384
- function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumnList) {
411
+ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumnList, groups) {
385
412
  const props = _vm;
386
413
  const $xeTable = _vm.$parent;
387
414
  const tableProps = $xeTable;
388
415
  const { fixedType } = props;
389
416
  const { headerRowClassName, headerRowStyle } = tableProps;
390
417
  const floatingFilterOpts = $xeTable.computeFloatingFilterOpts;
418
+ const groupRowStyle = groups ? { height: `${(0, import_util.getCalcHeight)($xeTable.computeHeaderCellOpts.height) || $xeTable.computeDefaultRowHeight}px` } : void 0;
391
419
  const rowVNs = headerGroups.map((cols, _rowIndex) => {
392
420
  const params = { $table: $xeTable, rowIndex: _rowIndex, _rowIndex, $rowIndex: _rowIndex, fixed: fixedType, type: renderType };
393
421
  return h(
@@ -395,9 +423,9 @@ function renderHeads(h, _vm, isGroup, isOptimizeMode, headerGroups, renderColumn
395
423
  {
396
424
  key: _rowIndex,
397
425
  class: ["vxe-header--row", headerRowClassName ? import_xe_utils.default.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ""],
398
- style: headerRowStyle ? import_xe_utils.default.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : void 0
426
+ style: headerRowStyle ? import_xe_utils.default.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : groupRowStyle
399
427
  },
400
- renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols)
428
+ renderRows(h, _vm, isGroup, isOptimizeMode, headerGroups, _rowIndex, cols, groups)
401
429
  );
402
430
  });
403
431
  if (floatingFilterOpts.enabled) {
@@ -432,6 +460,11 @@ var header_default = {
432
460
  headerColumn
433
461
  };
434
462
  },
463
+ computed: {
464
+ groupedHeaderRows() {
465
+ return (0, import_util.convertHeaderColumnToRows)(this.tableGroupColumn || []);
466
+ }
467
+ },
435
468
  watch: {
436
469
  tableColumn() {
437
470
  const _vm = this;
@@ -492,7 +525,13 @@ var header_default = {
492
525
  let renderHeaderList = headerColumn;
493
526
  let renderColumnList = tableColumn;
494
527
  const isOptimizeMode = isHeaderRenderOptimize;
495
- if (isGroup) {
528
+ let groups;
529
+ if (isGroup && isOptimizeMode) {
530
+ renderColumnList = fixedType ? fixedColumn : tableColumn;
531
+ const projection = projectHeaderWindow(renderColumnList, headerColumn, fullColumnIdData);
532
+ renderHeaderList = projection.headers;
533
+ groups = projection.groups;
534
+ } else if (isGroup) {
496
535
  renderColumnList = visibleColumn;
497
536
  } else {
498
537
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -598,7 +637,7 @@ var header_default = {
598
637
  {
599
638
  ref: "refHeaderTHead"
600
639
  },
601
- renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList)
640
+ renderHeads(h, _vm, isGroup, isOptimizeMode, renderHeaderList, renderColumnList, groups)
602
641
  )
603
642
  ]
604
643
  ),
@@ -643,12 +682,10 @@ var header_default = {
643
682
  const tableProps = $xeTable;
644
683
  const tableReactData = $xeTable;
645
684
  const tableInternalData = $xeTable;
646
- const props = _vm;
647
685
  const { showCustomHeader } = tableProps;
648
686
  const { collectColumn, visibleColumn } = tableInternalData;
649
- const { tableGroupColumn } = props;
650
687
  const { isGroup } = tableReactData;
651
- let spanColumns = isGroup ? (0, import_util.convertHeaderColumnToRows)(tableGroupColumn) : [];
688
+ let spanColumns = isGroup ? _vm.groupedHeaderRows : [];
652
689
  let visibleColgroups = [];
653
690
  if (showCustomHeader && spanColumns.length > 1) {
654
691
  visibleColgroups = (0, import_util.convertHeaderToGridRows)(spanColumns);
@@ -55,6 +55,7 @@ const supportMaxRow = 5e6;
55
55
  const customStorageKey = "VXE_CUSTOM_STORE";
56
56
  const maxXWidth = 5e6;
57
57
  const sourceType = "table";
58
+ const filteredRowModels = /* @__PURE__ */ new WeakMap();
58
59
  const customStorageQueues = /* @__PURE__ */ new WeakMap();
59
60
  const pendingExpandOffsetUpdates = /* @__PURE__ */ new WeakMap();
60
61
  const expandHeightCaches = /* @__PURE__ */ new WeakMap();
@@ -752,7 +753,7 @@ function handleVirtualTreeToList($xeTable) {
752
753
  }
753
754
  return internalData.afterFullData;
754
755
  }
755
- function updateAfterFullData($xeTable) {
756
+ function updateAfterFullData($xeTable, reason) {
756
757
  const props = $xeTable;
757
758
  const reactData = $xeTable;
758
759
  const internalData = $xeTable;
@@ -770,6 +771,8 @@ function updateAfterFullData($xeTable) {
770
771
  const { remote: allRemoteSort, sortMethod: allSortMethod, multiple: sortMultiple, chronological, isDeep: isSortDeep } = sortOpts;
771
772
  let tableData = [];
772
773
  let tableTree = [];
774
+ const previousFilter = reason === "sort" ? filteredRowModels.get($xeTable) : void 0;
775
+ filteredRowModels.delete($xeTable);
773
776
  if (!allRemoteFilter || !allRemoteSort) {
774
777
  const filterColumns = [];
775
778
  let orderColumns = [];
@@ -832,7 +835,19 @@ function updateAfterFullData($xeTable) {
832
835
  });
833
836
  tableData = tableTree;
834
837
  } else {
835
- 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
+ }
836
851
  tableTree = tableData;
837
852
  }
838
853
  } else {
@@ -1116,7 +1131,7 @@ function updateStyle($xeTable) {
1116
1131
  if (layout === "header") {
1117
1132
  let renderColumnList = tableColumn;
1118
1133
  const isOptimizeMode = isHeaderRenderOptimize;
1119
- if (isGroup) {
1134
+ if (isGroup && !isOptimizeMode) {
1120
1135
  renderColumnList = visibleColumn;
1121
1136
  } else {
1122
1137
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -1129,22 +1144,9 @@ function updateStyle($xeTable) {
1129
1144
  }
1130
1145
  }
1131
1146
  const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
1132
- if (fixedType) {
1133
- if (isGroup) {
1134
- if (wrapperElem) {
1135
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : "";
1136
- }
1137
- } else {
1138
- if (isOptimizeMode) {
1139
- if (wrapperElem) {
1140
- wrapperElem.style.width = tWidth ? `${tWidth}px` : "";
1141
- }
1142
- } else {
1143
- if (wrapperElem) {
1144
- wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : "";
1145
- }
1146
- }
1147
- }
1147
+ if (fixedType && wrapperElem) {
1148
+ const width = isOptimizeMode ? tWidth : scrollXWidth;
1149
+ wrapperElem.style.width = width ? `${width}px` : "";
1148
1150
  }
1149
1151
  if (currScrollElem) {
1150
1152
  currScrollElem.style.height = `${tHeaderHeight}px`;
@@ -1396,7 +1398,7 @@ function updateStyleWithDedupe($xeTable) {
1396
1398
  if (layout === "header") {
1397
1399
  let renderColumnList = tableColumn;
1398
1400
  const isOptimizeMode = isHeaderRenderOptimize;
1399
- if (isGroup) {
1401
+ if (isGroup && !isOptimizeMode) {
1400
1402
  renderColumnList = visibleColumn;
1401
1403
  } else {
1402
1404
  if (!isOptimizeMode || !isColLoading && (fixedType || !overflowX)) {
@@ -1409,22 +1411,9 @@ function updateStyleWithDedupe($xeTable) {
1409
1411
  }
1410
1412
  }
1411
1413
  const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0);
1412
- if (fixedType) {
1413
- if (isGroup) {
1414
- if (wrapperElem) {
1415
- setLayoutStyle(wrapperElem, "width", scrollXWidth ? `${scrollXWidth}px` : "");
1416
- }
1417
- } else {
1418
- if (isOptimizeMode) {
1419
- if (wrapperElem) {
1420
- setLayoutStyle(wrapperElem, "width", tWidth ? `${tWidth}px` : "");
1421
- }
1422
- } else {
1423
- if (wrapperElem) {
1424
- setLayoutStyle(wrapperElem, "width", scrollXWidth ? `${scrollXWidth}px` : "");
1425
- }
1426
- }
1427
- }
1414
+ if (fixedType && wrapperElem) {
1415
+ const width = isOptimizeMode ? tWidth : scrollXWidth;
1416
+ setLayoutStyle(wrapperElem, "width", width ? `${width}px` : "");
1428
1417
  }
1429
1418
  if (currScrollElem) {
1430
1419
  setLayoutStyle(currScrollElem, "height", `${tHeaderHeight}px`);
@@ -1521,7 +1510,7 @@ function updateStyleWithDedupe($xeTable) {
1521
1510
  }
1522
1511
  return $xeTable.$nextTick();
1523
1512
  }
1524
- function updateScrollXSpaceWithDedupe($xeTable) {
1513
+ function updateScrollXSpaceWithDedupe($xeTable, beforeWindowCommit) {
1525
1514
  const reactData = $xeTable;
1526
1515
  const internalData = $xeTable;
1527
1516
  const { scrollXLoad, overflowX, scrollXWidth } = reactData;
@@ -1597,6 +1586,7 @@ function updateScrollXSpaceWithDedupe($xeTable) {
1597
1586
  if (scrollXSpaceEl) {
1598
1587
  setLayoutStyle(scrollXSpaceEl, "width", `${ySpaceWidth}px`);
1599
1588
  }
1589
+ if (beforeWindowCommit) return;
1600
1590
  calcScrollbar($xeTable);
1601
1591
  if (isScrollXBig && mouseOpts.area) {
1602
1592
  errLog("vxe.error.notProp", ["mouse-config.area"]);
@@ -2566,7 +2556,7 @@ function handleSortEvent($xeTable, evnt, sortConfs, isUpdate) {
2566
2556
  }
2567
2557
  if (isUpdate) {
2568
2558
  if (!remote) {
2569
- $xeTable.handleTableData(true);
2559
+ $xeTable.handleTableData(true, false, "sort");
2570
2560
  }
2571
2561
  }
2572
2562
  if (evnt) {
@@ -3958,12 +3948,12 @@ function handleLoadDefaults($xeTable) {
3958
3948
  function handleInitDefaults($xeTable) {
3959
3949
  handleDefaultSort($xeTable);
3960
3950
  }
3961
- function getVirtualWindowSlice(source, previous, start, end) {
3951
+ function matchesVirtualWindow(source, previous, start, end) {
3962
3952
  const size = Math.max(0, Math.min(end, source.length) - start);
3963
- if (start >= 0 && end >= 0 && Number.isInteger(start) && Number.isInteger(end) && previous.length === size && previous.every((item, index) => item === source[start + index])) {
3964
- return previous;
3965
- }
3966
- 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);
3967
3957
  }
3968
3958
  function handleTableColumn($xeTable, reuseWindow = false) {
3969
3959
  const reactData = $xeTable;
@@ -4012,7 +4002,7 @@ function loadScrollXData($xeTable) {
4012
4002
  if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
4013
4003
  scrollXStore.startIndex = offsetStartIndex;
4014
4004
  scrollXStore.endIndex = offsetEndIndex;
4015
- $xeTable.updateScrollXData();
4005
+ $xeTable.updateScrollXData(true);
4016
4006
  }
4017
4007
  }
4018
4008
  $xeTable.closeTooltip();
@@ -4180,6 +4170,14 @@ function buildColumnInfo($xeTable) {
4180
4170
  if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
4181
4171
  warnLog("vxe.error.notConflictProp", ["show-custom-header & colgroup", "column-config.resizable=false"]);
4182
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
+ }
4183
4181
  reactData.isColLoading = false;
4184
4182
  return handleLazyRecalculate($xeTable, false, true, true);
4185
4183
  });
@@ -4321,10 +4319,12 @@ function handleSyncScroll($xeTable, isRollX, isRollY, syncGuard) {
4321
4319
  }
4322
4320
  let xRest = null;
4323
4321
  let yRest = null;
4324
- 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) {
4325
4325
  measureScrollRowOffsets($xeTable);
4326
4326
  }
4327
- if (syncGuard) syncGuard.markMeasured();
4327
+ if (syncGuard && !measureAfterCommit) syncGuard.markMeasured();
4328
4328
  if (isRollX && scrollXLoad) {
4329
4329
  xRest = $xeTable.updateScrollXData();
4330
4330
  }
@@ -4340,8 +4340,8 @@ function handleSyncScroll($xeTable, isRollX, isRollY, syncGuard) {
4340
4340
  }
4341
4341
  if (!isAllOverflow) {
4342
4342
  measureScrollRowOffsets($xeTable);
4343
+ if (syncGuard) syncGuard.markMeasured();
4343
4344
  }
4344
- if (syncGuard) syncGuard.markMeasured();
4345
4345
  return $xeTable.updateScrollYSpace();
4346
4346
  });
4347
4347
  }
@@ -4561,7 +4561,18 @@ function handleUpdateColResize($xeTable, evnt, params) {
4561
4561
  });
4562
4562
  $xeTable.dispatchEvent("column-resizable-change", params, evnt);
4563
4563
  $xeTable.dispatchEvent("resizable-change", params, evnt);
4564
- 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);
4565
4576
  });
4566
4577
  }
4567
4578
  function handleUpdateRowResize($xeTable, evnt, params) {
@@ -4605,8 +4616,12 @@ function updateRowOffsetTop($xeTable, dirtyIndex = 0) {
4605
4616
  const rowOpts = $xeTable.computeRowOpts;
4606
4617
  const cellOpts = $xeTable.computeCellOpts;
4607
4618
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
4608
- const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
4609
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);
4610
4625
  let startIndex = previous && previous.rows === afterFullData && previous.cache === fullAllDataRowIdData ? Math.max(0, Math.min(dirtyIndex, afterFullData.length)) : 0;
4611
4626
  const firstRow = afterFullData[startIndex];
4612
4627
  const firstRest = firstRow ? fullAllDataRowIdData[handleGetRowId(firstRow)] : null;
@@ -4634,6 +4649,7 @@ function updateRowOffsetTop($xeTable, dirtyIndex = 0) {
4634
4649
  cellOpts,
4635
4650
  defaultRowHeight,
4636
4651
  hasExpandColumn: !!expandColumn,
4652
+ uniformHeight,
4637
4653
  heightFlag: reactData.calcCellHeightFlag,
4638
4654
  firstChangedIndex: Infinity,
4639
4655
  resizeFlag: reactData.resizeHeightFlag
@@ -5139,7 +5155,10 @@ const tableMethods = {
5139
5155
  const rest = fullDataRowIdData[id];
5140
5156
  if (rest && rest.row === row) {
5141
5157
  rest.formatData = void 0;
5142
- if (visibleDataRowIdData[id] === row) hasVisibleRow = true;
5158
+ if (visibleDataRowIdData[id] === row) {
5159
+ rest.contentVersion = (rest.contentVersion || 0) + 1;
5160
+ hasVisibleRow = true;
5161
+ }
5143
5162
  } else {
5144
5163
  staleRow = true;
5145
5164
  }
@@ -5183,7 +5202,7 @@ const tableMethods = {
5183
5202
  setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50);
5184
5203
  });
5185
5204
  },
5186
- handleTableData(force, reuseWindow = false) {
5205
+ handleTableData(force, reuseWindow = false, reason) {
5187
5206
  const $xeTable = this;
5188
5207
  const reactData = $xeTable;
5189
5208
  const internalData = $xeTable;
@@ -5192,7 +5211,7 @@ const tableMethods = {
5192
5211
  const $xeGanttView = internalData.xeGanttView;
5193
5212
  let fullList = internalData.afterFullData;
5194
5213
  if (force) {
5195
- updateAfterFullData($xeTable);
5214
+ updateAfterFullData($xeTable, reason);
5196
5215
  fullList = handleVirtualTreeToList($xeTable);
5197
5216
  internalData.mergeHeaderRowMaps = {};
5198
5217
  internalData.mergeHeaderColMaps = {};
@@ -7360,12 +7379,7 @@ const tableMethods = {
7360
7379
  evnt.preventDefault();
7361
7380
  const { fullColumnIdData } = internalData;
7362
7381
  const { column } = params;
7363
- let resizeColumn = column;
7364
- if (column.children && column.children.length) {
7365
- import_xe_utils.default.eachTree(column.children, (childColumn) => {
7366
- resizeColumn = childColumn;
7367
- });
7368
- }
7382
+ const resizeColumn = (0, import_util.getLastChildColumn)(column);
7369
7383
  const colid = resizeColumn.id;
7370
7384
  const colRest = fullColumnIdData[colid];
7371
7385
  const dragBtnElem = evnt.target;
@@ -11394,7 +11408,7 @@ const tableMethods = {
11394
11408
  }
11395
11409
  });
11396
11410
  if (!remote || firstSortColumn && firstSortColumn.remoteSort) {
11397
- $xeTable.handleTableData(true);
11411
+ $xeTable.handleTableData(true, false, "sort");
11398
11412
  }
11399
11413
  return $xeTable.$nextTick().then(() => {
11400
11414
  updateRowOffsetTop($xeTable);
@@ -11429,7 +11443,7 @@ const tableMethods = {
11429
11443
  clearAllSort($xeTable);
11430
11444
  }
11431
11445
  if (!sortOpts.remote) {
11432
- $xeTable.handleTableData(true);
11446
+ $xeTable.handleTableData(true, false, "sort");
11433
11447
  }
11434
11448
  return $xeTable.$nextTick().then(() => {
11435
11449
  updateRowOffsetTop($xeTable);
@@ -11459,7 +11473,7 @@ const tableMethods = {
11459
11473
  });
11460
11474
  }
11461
11475
  if (!sortOpts.remote) {
11462
- $xeTable.handleTableData(true);
11476
+ $xeTable.handleTableData(true, false, "sort");
11463
11477
  }
11464
11478
  if (!multiple) {
11465
11479
  column = sortCols[0];
@@ -12859,12 +12873,14 @@ const tableMethods = {
12859
12873
  fixed: ""
12860
12874
  });
12861
12875
  },
12862
- updateScrollXData() {
12876
+ updateScrollXData(fromScroll = false) {
12863
12877
  const $xeTable = this;
12864
12878
  const reactData = $xeTable;
12865
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;
12866
12882
  handleTableColumn($xeTable);
12867
- $xeTable.updateScrollXSpace();
12883
+ $xeTable.updateScrollXSpace(deferLayout);
12868
12884
  return $xeTable.$nextTick().then(() => {
12869
12885
  handleTableColumn($xeTable, true);
12870
12886
  $xeTable.updateScrollXSpace();
@@ -12874,9 +12890,9 @@ const tableMethods = {
12874
12890
  });
12875
12891
  },
12876
12892
  // 更新横向 X 可视渲染上下剩余空间大小
12877
- updateScrollXSpace() {
12893
+ updateScrollXSpace(beforeWindowCommit = false) {
12878
12894
  if (this.computeVirtualXOpts.experimentalSkipUnchangedStyle === true) {
12879
- return updateScrollXSpaceWithDedupe(this);
12895
+ return updateScrollXSpaceWithDedupe(this, beforeWindowCommit);
12880
12896
  }
12881
12897
  const $xeTable = this;
12882
12898
  const reactData = $xeTable;
@@ -12954,6 +12970,7 @@ const tableMethods = {
12954
12970
  if (scrollXSpaceEl) {
12955
12971
  scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
12956
12972
  }
12973
+ if (beforeWindowCommit) return;
12957
12974
  calcScrollbar($xeTable);
12958
12975
  if (isScrollXBig && mouseOpts.area) {
12959
12976
  errLog("vxe.error.notProp", ["mouse-config.area"]);
@@ -1360,19 +1360,10 @@ 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;
@@ -932,8 +932,10 @@ function getFirstChildColumn(column) {
932
932
  }
933
933
  function getLastChildColumn(column) {
934
934
  const { children } = column;
935
- if (children && children.length) {
936
- 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
+ }
937
939
  }
938
940
  return column;
939
941
  }
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.20";
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.20"}`;
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.20",
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",