vxe-table 3.13.15 → 3.14.0-beta.0

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 (33) hide show
  1. package/es/grid/src/grid.js +41 -31
  2. package/es/style.css +1 -1
  3. package/es/table/module/edit/mixin.js +3 -1
  4. package/es/table/src/methods.js +275 -160
  5. package/es/table/src/table.js +52 -51
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/grid/src/grid.js +41 -32
  9. package/lib/grid/src/grid.min.js +1 -1
  10. package/lib/index.umd.js +1595 -2542
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/table/module/edit/mixin.js +3 -1
  14. package/lib/table/module/edit/mixin.min.js +1 -1
  15. package/lib/table/src/methods.js +289 -166
  16. package/lib/table/src/methods.min.js +1 -1
  17. package/lib/table/src/table.js +52 -51
  18. package/lib/table/src/table.min.js +1 -1
  19. package/lib/ui/index.js +1 -1
  20. package/lib/ui/index.min.js +1 -1
  21. package/lib/ui/src/log.js +1 -1
  22. package/lib/ui/src/log.min.js +1 -1
  23. package/package.json +1 -1
  24. package/packages/grid/src/grid.ts +41 -31
  25. package/packages/table/module/edit/mixin.ts +3 -1
  26. package/packages/table/src/methods.ts +286 -164
  27. package/packages/table/src/table.ts +55 -53
  28. /package/es/{iconfont.1740723810366.ttf → iconfont.1740732119954.ttf} +0 -0
  29. /package/es/{iconfont.1740723810366.woff → iconfont.1740732119954.woff} +0 -0
  30. /package/es/{iconfont.1740723810366.woff2 → iconfont.1740732119954.woff2} +0 -0
  31. /package/lib/{iconfont.1740723810366.ttf → iconfont.1740732119954.ttf} +0 -0
  32. /package/lib/{iconfont.1740723810366.woff → iconfont.1740732119954.woff} +0 -0
  33. /package/lib/{iconfont.1740723810366.woff2 → iconfont.1740732119954.woff2} +0 -0
@@ -22,6 +22,8 @@ const {
22
22
  createEvent
23
23
  } = _ui.VxeUI;
24
24
  const customStorageKey = 'VXE_CUSTOM_STORE';
25
+ const maxYHeight = 5e6;
26
+ const maxXWidth = 5e6;
25
27
  function eqCellValue(row1, row2, field) {
26
28
  const val1 = _xeUtils.default.get(row1, field);
27
29
  const val2 = _xeUtils.default.get(row2, field);
@@ -81,34 +83,50 @@ function handleReserveRow($xeTable, reserveRowMap) {
81
83
  return reserveList;
82
84
  }
83
85
  function handleVirtualXVisible($xeTable) {
86
+ const reactData = $xeTable;
84
87
  const internalData = $xeTable;
88
+ const {
89
+ isScrollXBig,
90
+ scrollXWidth
91
+ } = reactData;
85
92
  const {
86
93
  elemStore,
87
- visibleColumn
94
+ visibleColumn,
95
+ fullColumnIdData
88
96
  } = internalData;
89
97
  const leftFixedWidth = $xeTable.computeLeftFixedWidth;
90
98
  const rightFixedWidth = $xeTable.computeRightFixedWidth;
91
99
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
92
100
  if (bodyScrollElem) {
93
- const {
94
- scrollLeft,
95
- clientWidth
96
- } = bodyScrollElem;
97
- const startWidth = scrollLeft + leftFixedWidth;
98
- const endWidth = scrollLeft + clientWidth - rightFixedWidth;
99
- let toVisibleIndex = -1;
100
- let cWidth = 0;
101
- let visibleSize = 0;
102
- for (let colIndex = 0, colLen = visibleColumn.length; colIndex < colLen; colIndex++) {
103
- cWidth += visibleColumn[colIndex].renderWidth;
104
- if (toVisibleIndex === -1 && startWidth < cWidth) {
105
- toVisibleIndex = colIndex;
101
+ const clientWidth = bodyScrollElem.clientWidth;
102
+ let scrollLeft = bodyScrollElem.scrollLeft;
103
+ if (isScrollXBig) {
104
+ scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, scrollLeft / (maxXWidth - clientWidth)));
105
+ }
106
+ const startLeft = scrollLeft + leftFixedWidth;
107
+ const endLeft = scrollLeft + clientWidth - rightFixedWidth;
108
+ let leftIndex = 0;
109
+ let rightIndex = visibleColumn.length;
110
+ while (leftIndex < rightIndex) {
111
+ const cIndex = Math.floor((leftIndex + rightIndex) / 2);
112
+ const column = visibleColumn[cIndex];
113
+ const colid = column.id;
114
+ const colRest = fullColumnIdData[colid] || {};
115
+ if (colRest.oLeft <= startLeft) {
116
+ leftIndex = cIndex + 1;
117
+ } else {
118
+ rightIndex = cIndex;
106
119
  }
107
- if (toVisibleIndex >= 0) {
108
- visibleSize++;
109
- if (cWidth > endWidth) {
110
- break;
111
- }
120
+ }
121
+ let visibleSize = 0;
122
+ const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
123
+ for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
124
+ const column = visibleColumn[cIndex];
125
+ const colid = column.id;
126
+ const colRest = fullColumnIdData[colid] || {};
127
+ visibleSize++;
128
+ if (colRest.oLeft > endLeft || visibleSize >= 60) {
129
+ break;
112
130
  }
113
131
  }
114
132
  return {
@@ -534,6 +552,7 @@ function updateStyle($xeTable) {
534
552
  scrollbarWidth,
535
553
  overflowY,
536
554
  scrollbarHeight,
555
+ scrollXWidth,
537
556
  columnStore,
538
557
  editStore,
539
558
  isAllOverflow,
@@ -543,7 +562,6 @@ function updateStyle($xeTable) {
543
562
  visibleColumn,
544
563
  fullColumnIdData,
545
564
  tableHeight,
546
- tableWidth,
547
565
  headerHeight,
548
566
  footerHeight,
549
567
  elemStore,
@@ -588,9 +606,9 @@ function updateStyle($xeTable) {
588
606
  }
589
607
  bodyHeight = Math.max(bodyMinHeight, bodyHeight);
590
608
  }
609
+ const scrollbarXToTop = $xeTable.$refs.computeScrollbarXToTop;
591
610
  const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
592
611
  const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
593
- const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
594
612
  const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
595
613
  if (scrollXVirtualEl) {
596
614
  scrollXVirtualEl.style.height = `${osbHeight}px`;
@@ -678,7 +696,7 @@ function updateStyle($xeTable) {
678
696
  if (fixedType) {
679
697
  if (isGroup) {
680
698
  if (wrapperElem) {
681
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
699
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
682
700
  }
683
701
  } else {
684
702
  if (isOptimizeMode) {
@@ -687,7 +705,7 @@ function updateStyle($xeTable) {
687
705
  }
688
706
  } else {
689
707
  if (wrapperElem) {
690
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
708
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
691
709
  }
692
710
  }
693
711
  }
@@ -698,10 +716,6 @@ function updateStyle($xeTable) {
698
716
  if (tableElem) {
699
717
  tableElem.style.width = tWidth ? `${tWidth}px` : '';
700
718
  }
701
- const repairElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-repair`]);
702
- if (repairElem) {
703
- repairElem.style.width = `${tableWidth}px`;
704
- }
705
719
  const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
706
720
  if (isGroup && listElem) {
707
721
  _xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
@@ -770,7 +784,7 @@ function updateStyle($xeTable) {
770
784
  }
771
785
  } else {
772
786
  if (wrapperElem) {
773
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
787
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
774
788
  }
775
789
  }
776
790
  }
@@ -808,7 +822,7 @@ function updateStyle($xeTable) {
808
822
  }
809
823
  } else {
810
824
  if (wrapperElem) {
811
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
825
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
812
826
  }
813
827
  }
814
828
  }
@@ -1174,13 +1188,14 @@ function computeRowHeight($xeTable) {
1174
1188
  // 最低支持 18px 行高
1175
1189
  return Math.max(18, rowHeight);
1176
1190
  }
1177
- function handleVirtualYVisible($xeTable, currScrollTop) {
1191
+ function handleVirtualYVisible($xeTable) {
1178
1192
  const reactData = $xeTable;
1179
1193
  const internalData = $xeTable;
1180
1194
  const {
1181
1195
  isAllOverflow,
1182
1196
  expandColumn,
1183
- rowExpandedMaps
1197
+ isScrollYBig,
1198
+ scrollYHeight
1184
1199
  } = reactData;
1185
1200
  const {
1186
1201
  elemStore,
@@ -1188,40 +1203,46 @@ function handleVirtualYVisible($xeTable, currScrollTop) {
1188
1203
  afterFullData,
1189
1204
  fullAllDataRowIdData
1190
1205
  } = internalData;
1191
- const expandOpts = $xeTable.computeExpandOpts;
1192
1206
  const rowOpts = $xeTable.computeRowOpts;
1193
1207
  const cellOpts = $xeTable.computeCellOpts;
1194
1208
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
1195
1209
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
1196
1210
  if (bodyScrollElem) {
1197
1211
  const clientHeight = bodyScrollElem.clientHeight;
1198
- const scrollTop = _xeUtils.default.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
1199
- const endHeight = scrollTop + clientHeight;
1212
+ let scrollTop = bodyScrollElem.scrollTop;
1213
+ if (isScrollYBig) {
1214
+ scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (maxYHeight - clientHeight)));
1215
+ }
1216
+ const startTop = scrollTop;
1217
+ const endTop = scrollTop + clientHeight;
1200
1218
  let toVisibleIndex = -1;
1201
- let offsetTop = 0;
1202
1219
  let visibleSize = 0;
1203
1220
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
1204
1221
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
1205
- toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
1222
+ toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
1206
1223
  visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
1207
1224
  } else {
1208
- for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1225
+ let leftIndex = 0;
1226
+ let rightIndex = afterFullData.length;
1227
+ while (leftIndex < rightIndex) {
1228
+ const rIndex = Math.floor((leftIndex + rightIndex) / 2);
1209
1229
  const row = afterFullData[rIndex];
1210
1230
  const rowid = (0, _util.getRowid)($xeTable, row);
1211
1231
  const rowRest = fullAllDataRowIdData[rowid] || {};
1212
- offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
1213
- if (toVisibleIndex === -1 && scrollTop < offsetTop) {
1214
- toVisibleIndex = rIndex;
1215
- }
1216
- if (toVisibleIndex >= 0) {
1217
- visibleSize++;
1218
- if (offsetTop > endHeight) {
1219
- break;
1220
- }
1232
+ if (rowRest.oTop <= startTop) {
1233
+ leftIndex = rIndex + 1;
1234
+ } else {
1235
+ rightIndex = rIndex;
1221
1236
  }
1222
- // 是否展开行
1223
- if (expandColumn && rowExpandedMaps[rowid]) {
1224
- offsetTop += rowRest.expandHeight || expandOpts.height || 0;
1237
+ }
1238
+ toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1239
+ for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1240
+ const row = afterFullData[rIndex];
1241
+ const rowid = (0, _util.getRowid)($xeTable, row);
1242
+ const rowRest = fullAllDataRowIdData[rowid] || {};
1243
+ visibleSize++;
1244
+ if (rowRest.oTop > endTop || visibleSize >= 100) {
1245
+ break;
1225
1246
  }
1226
1247
  }
1227
1248
  }
@@ -1400,7 +1421,7 @@ function autoCellWidth($xeTable) {
1400
1421
  if (!xHandleEl) {
1401
1422
  return;
1402
1423
  }
1403
- let tableWidth = 0;
1424
+ let tWidth = 0;
1404
1425
  const minCellWidth = 40; // 列宽最少限制 40px
1405
1426
  const bodyWidth = bodyElem.clientWidth;
1406
1427
  let remainWidth = bodyWidth;
@@ -1424,51 +1445,51 @@ function autoCellWidth($xeTable) {
1424
1445
  // 最小宽
1425
1446
  pxMinList.forEach(column => {
1426
1447
  const minWidth = _xeUtils.default.toInteger(column.minWidth);
1427
- tableWidth += minWidth;
1448
+ tWidth += minWidth;
1428
1449
  column.renderWidth = minWidth;
1429
1450
  });
1430
1451
  // 最小自适应
1431
1452
  autoMinList.forEach(column => {
1432
1453
  const scaleWidth = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
1433
- tableWidth += scaleWidth;
1454
+ tWidth += scaleWidth;
1434
1455
  column.renderWidth = scaleWidth;
1435
1456
  });
1436
1457
  // 最小百分比
1437
1458
  scaleMinList.forEach(column => {
1438
1459
  const scaleWidth = Math.floor(_xeUtils.default.toInteger(column.minWidth) * meanWidth);
1439
- tableWidth += scaleWidth;
1460
+ tWidth += scaleWidth;
1440
1461
  column.renderWidth = scaleWidth;
1441
1462
  });
1442
1463
  // 固定百分比
1443
1464
  scaleList.forEach(column => {
1444
1465
  const scaleWidth = Math.floor(_xeUtils.default.toInteger(column.width) * meanWidth);
1445
- tableWidth += scaleWidth;
1466
+ tWidth += scaleWidth;
1446
1467
  column.renderWidth = scaleWidth;
1447
1468
  });
1448
1469
  // 固定宽
1449
1470
  pxList.forEach(column => {
1450
1471
  const width = _xeUtils.default.toInteger(column.width);
1451
- tableWidth += width;
1472
+ tWidth += width;
1452
1473
  column.renderWidth = width;
1453
1474
  });
1454
1475
  // 自适应宽
1455
1476
  autoList.forEach(column => {
1456
1477
  const width = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
1457
- tableWidth += width;
1478
+ tWidth += width;
1458
1479
  column.renderWidth = width;
1459
1480
  });
1460
1481
  // 调整了列宽
1461
1482
  resizeList.forEach(column => {
1462
1483
  const width = _xeUtils.default.toInteger(column.resizeWidth);
1463
- tableWidth += width;
1484
+ tWidth += width;
1464
1485
  column.renderWidth = width;
1465
1486
  });
1466
- remainWidth -= tableWidth;
1487
+ remainWidth -= tWidth;
1467
1488
  meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
1468
1489
  if (fit) {
1469
1490
  if (remainWidth > 0) {
1470
1491
  scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
1471
- tableWidth += meanWidth;
1492
+ tWidth += meanWidth;
1472
1493
  column.renderWidth += meanWidth;
1473
1494
  });
1474
1495
  }
@@ -1479,7 +1500,7 @@ function autoCellWidth($xeTable) {
1479
1500
  remainList.forEach(column => {
1480
1501
  const width = Math.max(meanWidth, minCellWidth);
1481
1502
  column.renderWidth = width;
1482
- tableWidth += width;
1503
+ tWidth += width;
1483
1504
  });
1484
1505
  if (fit) {
1485
1506
  /**
@@ -1489,13 +1510,13 @@ function autoCellWidth($xeTable) {
1489
1510
  const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
1490
1511
  let dynamicSize = dynamicList.length - 1;
1491
1512
  if (dynamicSize > 0) {
1492
- let i = bodyWidth - tableWidth;
1513
+ let i = bodyWidth - tWidth;
1493
1514
  if (i > 0) {
1494
1515
  while (i > 0 && dynamicSize >= 0) {
1495
1516
  i--;
1496
1517
  dynamicList[dynamicSize--].renderWidth++;
1497
1518
  }
1498
- tableWidth = bodyWidth;
1519
+ tWidth = bodyWidth;
1499
1520
  }
1500
1521
  }
1501
1522
  }
@@ -1503,17 +1524,18 @@ function autoCellWidth($xeTable) {
1503
1524
  const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1504
1525
  reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1505
1526
  reactData.overflowY = overflowY;
1506
- internalData.tableWidth = tableWidth;
1527
+ reactData.scrollXWidth = tWidth;
1507
1528
  internalData.tableHeight = tableHeight;
1508
1529
  const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
1509
1530
  const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
1510
1531
  const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1511
- const overflowX = tableWidth > bodyWidth;
1532
+ const overflowX = tWidth > bodyWidth;
1512
1533
  const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1513
1534
  reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1514
1535
  internalData.headerHeight = headerHeight;
1515
1536
  internalData.footerHeight = footerHeight;
1516
1537
  reactData.overflowX = overflowX;
1538
+ updateColumnOffsetLeft($xeTable);
1517
1539
  updateHeight($xeTable);
1518
1540
  reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
1519
1541
  if (overflowX) {
@@ -1716,8 +1738,8 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1716
1738
  const wrapperRect = el.getBoundingClientRect();
1717
1739
  const osbWidth = overflowY ? scrollbarWidth : 0;
1718
1740
  const osbHeight = overflowX ? scrollbarHeight : 0;
1719
- const tableWidth = el.clientWidth;
1720
- const tableHeight = el.clientHeight;
1741
+ const tableWrapperWidth = el.clientWidth;
1742
+ const tableWrapperHeight = el.clientHeight;
1721
1743
  if (trEl) {
1722
1744
  const rdLineEl = $xeTable.$refs.refDragRowLineElem;
1723
1745
  if (rdLineEl) {
@@ -1726,14 +1748,14 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1726
1748
  const trRect = trEl.getBoundingClientRect();
1727
1749
  let trHeight = trEl.clientHeight;
1728
1750
  const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
1729
- if (offsetTop + trHeight > tableHeight - osbHeight) {
1730
- trHeight = tableHeight - offsetTop - osbHeight;
1751
+ if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
1752
+ trHeight = tableWrapperHeight - offsetTop - osbHeight;
1731
1753
  }
1732
1754
  rdLineEl.style.display = 'block';
1733
1755
  rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
1734
1756
  rdLineEl.style.top = `${offsetTop}px`;
1735
1757
  rdLineEl.style.height = `${trHeight}px`;
1736
- rdLineEl.style.width = `${tableWidth - osbWidth}px`;
1758
+ rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
1737
1759
  rdLineEl.setAttribute('drag-pos', dragPos);
1738
1760
  rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
1739
1761
  } else {
@@ -1758,7 +1780,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1758
1780
  thWidth -= startX - offsetLeft;
1759
1781
  offsetLeft = startX;
1760
1782
  }
1761
- const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
1783
+ const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
1762
1784
  if (offsetLeft + thWidth > endX) {
1763
1785
  thWidth = endX - offsetLeft;
1764
1786
  }
@@ -1769,7 +1791,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
1769
1791
  if (prevDragToChild) {
1770
1792
  cdLineEl.style.height = `${thRect.height}px`;
1771
1793
  } else {
1772
- cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
1794
+ cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
1773
1795
  }
1774
1796
  cdLineEl.setAttribute('drag-pos', dragPos);
1775
1797
  cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
@@ -1854,6 +1876,21 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
1854
1876
  }
1855
1877
  return $xeTable.$nextTick();
1856
1878
  }
1879
+ const handleRowExpandReserve = ($xeTable, row, expanded) => {
1880
+ const internalData = $xeTable;
1881
+ const {
1882
+ rowExpandedReserveRowMap
1883
+ } = internalData;
1884
+ const expandOpts = $xeTable.computeExpandOpts;
1885
+ if (expandOpts.reserve) {
1886
+ const rowid = (0, _util.getRowid)($xeTable, row);
1887
+ if (expanded) {
1888
+ rowExpandedReserveRowMap[rowid] = row;
1889
+ } else if (rowExpandedReserveRowMap[rowid]) {
1890
+ delete rowExpandedReserveRowMap[rowid];
1891
+ }
1892
+ }
1893
+ };
1857
1894
  // 计算可视渲染相关数据
1858
1895
  function computeScrollLoad($xeTable) {
1859
1896
  const reactData = $xeTable;
@@ -1933,14 +1970,19 @@ function handleRecalculateLayout($xeTable, reFull) {
1933
1970
  calcCellWidth($xeTable);
1934
1971
  autoCellWidth($xeTable);
1935
1972
  updateStyle($xeTable);
1973
+ if (reFull) {
1974
+ updateRowOffsetTop($xeTable);
1975
+ }
1936
1976
  updateRowExpandStyle($xeTable);
1937
1977
  return computeScrollLoad($xeTable).then(() => {
1938
1978
  if (reFull === true) {
1939
1979
  // 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
1940
- calcCellHeight($xeTable);
1941
1980
  calcCellWidth($xeTable);
1942
1981
  autoCellWidth($xeTable);
1943
1982
  updateStyle($xeTable);
1983
+ if (reFull) {
1984
+ updateRowOffsetTop($xeTable);
1985
+ }
1944
1986
  updateRowExpandStyle($xeTable);
1945
1987
  return computeScrollLoad($xeTable);
1946
1988
  }
@@ -1980,7 +2022,8 @@ function loadScrollXData($xeTable) {
1980
2022
  const internalData = $xeTable;
1981
2023
  const {
1982
2024
  mergeList,
1983
- mergeFooterList
2025
+ mergeFooterList,
2026
+ isScrollXBig
1984
2027
  } = reactData;
1985
2028
  const {
1986
2029
  scrollXStore
@@ -1996,11 +2039,11 @@ function loadScrollXData($xeTable) {
1996
2039
  visibleSize
1997
2040
  } = handleVirtualXVisible($xeTable);
1998
2041
  const offsetItem = {
1999
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
2000
- endIndex: toVisibleIndex + visibleSize + offsetSize + preloadSize
2042
+ startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
2043
+ endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
2001
2044
  };
2002
- scrollXStore.visibleStartIndex = toVisibleIndex;
2003
- scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize;
2045
+ scrollXStore.visibleStartIndex = toVisibleIndex - 1;
2046
+ scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
2004
2047
  calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
2005
2048
  const {
2006
2049
  startIndex: offsetStartIndex,
@@ -2224,12 +2267,13 @@ function handleColumn($xeTable, collectColumn) {
2224
2267
  /**
2225
2268
  * 纵向 Y 可视渲染处理
2226
2269
  */
2227
- function loadScrollYData($xeTable, scrollTop) {
2270
+ function loadScrollYData($xeTable) {
2228
2271
  const reactData = $xeTable;
2229
2272
  const internalData = $xeTable;
2230
2273
  const {
2231
2274
  mergeList,
2232
- isAllOverflow
2275
+ isAllOverflow,
2276
+ isScrollYBig
2233
2277
  } = reactData;
2234
2278
  const {
2235
2279
  scrollYStore
@@ -2244,13 +2288,13 @@ function loadScrollYData($xeTable, scrollTop) {
2244
2288
  const {
2245
2289
  toVisibleIndex,
2246
2290
  visibleSize
2247
- } = handleVirtualYVisible($xeTable, scrollTop);
2291
+ } = handleVirtualYVisible($xeTable);
2248
2292
  const offsetItem = {
2249
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
2250
- endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
2293
+ startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
2294
+ endIndex: isScrollYBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
2251
2295
  };
2252
- scrollYStore.visibleStartIndex = toVisibleIndex;
2253
- scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize;
2296
+ scrollYStore.visibleStartIndex = toVisibleIndex - 1;
2297
+ scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
2254
2298
  calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
2255
2299
  const {
2256
2300
  startIndex: offsetStartIndex,
@@ -2453,6 +2497,49 @@ function handleUpdateRowResize($xeTable, evnt, params) {
2453
2497
  setTimeout(() => $xeTable.recalculate(true), 300);
2454
2498
  });
2455
2499
  }
2500
+ function updateColumnOffsetLeft($xeTable) {
2501
+ const internalData = $xeTable;
2502
+ const {
2503
+ visibleColumn,
2504
+ fullColumnIdData
2505
+ } = internalData;
2506
+ let offsetLeft = 0;
2507
+ for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
2508
+ const column = visibleColumn[cIndex];
2509
+ const colid = column.id;
2510
+ const colRest = fullColumnIdData[colid];
2511
+ colRest.oLeft = offsetLeft;
2512
+ offsetLeft += column.renderWidth;
2513
+ }
2514
+ }
2515
+ function updateRowOffsetTop($xeTable) {
2516
+ const reactData = $xeTable;
2517
+ const internalData = $xeTable;
2518
+ const {
2519
+ expandColumn,
2520
+ rowExpandedMaps
2521
+ } = reactData;
2522
+ const {
2523
+ afterFullData,
2524
+ fullAllDataRowIdData
2525
+ } = internalData;
2526
+ const expandOpts = $xeTable.computeExpandOpts;
2527
+ const rowOpts = $xeTable.computeRowOpts;
2528
+ const cellOpts = $xeTable.computeCellOpts;
2529
+ const defaultRowHeight = $xeTable.computeDefaultRowHeight;
2530
+ let offsetTop = 0;
2531
+ for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
2532
+ const row = afterFullData[rIndex];
2533
+ const rowid = (0, _util.getRowid)($xeTable, row);
2534
+ const rowRest = fullAllDataRowIdData[rowid] || {};
2535
+ rowRest.oTop = offsetTop;
2536
+ offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
2537
+ // 是否展开行
2538
+ if (expandColumn && rowExpandedMaps[rowid]) {
2539
+ offsetTop += rowRest.expandHeight || expandOpts.height || 0;
2540
+ }
2541
+ }
2542
+ }
2456
2543
  function updateRowExpandStyle($xeTable) {
2457
2544
  const reactData = $xeTable;
2458
2545
  const internalData = $xeTable;
@@ -4724,7 +4811,7 @@ const Methods = {
4724
4811
  resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
4725
4812
  if (resizableOpts.showDragTip && resizeTipElem) {
4726
4813
  resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
4727
- const tableWidth = tableEl.clientWidth;
4814
+ const tableWrapperWidth = tableEl.clientWidth;
4728
4815
  const wrapperRect = wrapperElem.getBoundingClientRect();
4729
4816
  const resizeBarWidth = resizeBarElem.clientWidth;
4730
4817
  const resizeTipWidth = resizeTipElem.clientWidth;
@@ -4732,8 +4819,8 @@ const Methods = {
4732
4819
  let resizeTipLeft = -resizeTipWidth;
4733
4820
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
4734
4821
  resizeTipLeft = 0;
4735
- } else if (resizeBarLeft > tableWidth) {
4736
- resizeTipLeft += tableWidth - resizeBarLeft;
4822
+ } else if (resizeBarLeft > tableWrapperWidth) {
4823
+ resizeTipLeft += tableWrapperWidth - resizeBarLeft;
4737
4824
  }
4738
4825
  resizeTipElem.style.left = `${resizeTipLeft}px`;
4739
4826
  resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
@@ -4895,7 +4982,7 @@ const Methods = {
4895
4982
  const updateEvent = evnt => {
4896
4983
  evnt.stopPropagation();
4897
4984
  evnt.preventDefault();
4898
- const tableWidth = tableEl.clientWidth - osbWidth;
4985
+ const rtWidth = tableEl.clientWidth - osbWidth;
4899
4986
  const tableHeight = tableEl.clientHeight - osbHeight;
4900
4987
  let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
4901
4988
  if (dragTop < minTop) {
@@ -4905,15 +4992,15 @@ const Methods = {
4905
4992
  }
4906
4993
  resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
4907
4994
  resizeBarElem.style.top = `${dragTop}px`;
4908
- resizeBarElem.style.width = `${tableWidth}px`;
4995
+ resizeBarElem.style.width = `${rtWidth}px`;
4909
4996
  if (resizableOpts.showDragTip && resizeTipElem) {
4910
4997
  resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
4911
4998
  const resizeTipWidth = resizeTipElem.clientWidth;
4912
4999
  const resizeTipHeight = resizeTipElem.clientHeight;
4913
5000
  let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
4914
5001
  let resizeBarTop = 0;
4915
- if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
4916
- resizeBarLeft = tableWidth - resizeTipWidth - 2;
5002
+ if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
5003
+ resizeBarLeft = rtWidth - resizeTipWidth - 2;
4917
5004
  }
4918
5005
  if (dragTop + resizeTipHeight >= tableHeight) {
4919
5006
  resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
@@ -4946,6 +5033,7 @@ const Methods = {
4946
5033
  } else {
4947
5034
  rowRest.resizeHeight = resizeHeight;
4948
5035
  handleUpdateRowResize($xeTable, evnt, resizeParams);
5036
+ updateRowOffsetTop($xeTable);
4949
5037
  }
4950
5038
  }
4951
5039
  (0, _dom.removeClass)(tableEl, 'row-drag--resize');
@@ -8052,21 +8140,21 @@ const Methods = {
8052
8140
  const scrollTargetEl = xHandleEl || tableBodyElem;
8053
8141
  if (scrollTargetEl) {
8054
8142
  const wrapperRect = el.getBoundingClientRect();
8055
- const tableWidth = el.clientWidth;
8143
+ const tableWrapperWidth = el.clientWidth;
8056
8144
  const leftContainerElem = $xeTable.$refs.refLeftContainer;
8057
8145
  const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
8058
8146
  const rightContainerElem = $xeTable.$refs.refRightContainer;
8059
8147
  const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
8060
8148
  const srartX = wrapperRect.x + leftContainerWidth;
8061
- const endX = wrapperRect.x + tableWidth - rightContainerWidth;
8149
+ const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
8062
8150
  const distSize = 28;
8063
8151
  const startDistSize = clientX - srartX;
8064
8152
  const endDistSize = endX - clientX;
8065
8153
  if (startDistSize > 0 && startDistSize <= distSize) {
8066
- const scrollRatio = Math.floor(tableWidth / (startDistSize > distSize / 2 ? 240 : 120));
8154
+ const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
8067
8155
  scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
8068
8156
  } else if (endDistSize > 0 && endDistSize <= distSize) {
8069
- const scrollRatio = Math.floor(tableWidth / (endDistSize > distSize / 2 ? 240 : 120));
8157
+ const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
8070
8158
  scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
8071
8159
  }
8072
8160
  }
@@ -8674,15 +8762,14 @@ const Methods = {
8674
8762
  });
8675
8763
  }
8676
8764
  if (reserve) {
8677
- validRows.forEach(row => this.handleRowExpandReserve(row, expanded));
8765
+ validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
8678
8766
  }
8679
8767
  }
8680
8768
  this.rowExpandedMaps = rExpandedMaps;
8681
- return Promise.all(lazyRests).then(() => $xeTable.recalculate()).then(() => {
8682
- if (expandColumn) {
8683
- updateRowExpandStyle($xeTable);
8684
- handleRowExpandScroll($xeTable);
8685
- }
8769
+ return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => $xeTable.recalculate(true)).then(() => {
8770
+ updateRowOffsetTop($xeTable);
8771
+ updateRowExpandStyle($xeTable);
8772
+ handleRowExpandScroll($xeTable);
8686
8773
  return $xeTable.updateCellAreas();
8687
8774
  });
8688
8775
  },
@@ -8709,42 +8796,35 @@ const Methods = {
8709
8796
  */
8710
8797
  clearRowExpand() {
8711
8798
  const $xeTable = this;
8799
+ const reactData = $xeTable;
8800
+ const internalData = $xeTable;
8712
8801
  const {
8713
- expandOpts,
8714
8802
  tableFullData
8715
- } = this;
8803
+ } = internalData;
8804
+ const expandOpts = $xeTable.computeExpandOpts;
8716
8805
  const {
8717
8806
  reserve
8718
8807
  } = expandOpts;
8719
- const expList = this.getRowExpandRecords();
8720
- this.rowExpandedMaps = {};
8808
+ const expList = $xeTable.getRowExpandRecords();
8809
+ reactData.rowExpandedMaps = {};
8721
8810
  if (reserve) {
8722
- tableFullData.forEach(row => this.handleRowExpandReserve(row, false));
8811
+ tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
8723
8812
  }
8724
- return this.$nextTick().then(() => {
8813
+ return $xeTable.$nextTick().then(() => {
8725
8814
  if (expList.length) {
8726
- this.recalculate();
8815
+ return $xeTable.recalculate(true);
8727
8816
  }
8728
- }).then(() => $xeTable.updateCellAreas());
8817
+ }).then(() => {
8818
+ updateRowOffsetTop($xeTable);
8819
+ updateRowExpandStyle($xeTable);
8820
+ handleRowExpandScroll($xeTable);
8821
+ return $xeTable.updateCellAreas();
8822
+ });
8729
8823
  },
8730
8824
  clearRowExpandReserve() {
8731
8825
  this.rowExpandedReserveRowMap = {};
8732
8826
  return this.$nextTick();
8733
8827
  },
8734
- handleRowExpandReserve(row, expanded) {
8735
- const {
8736
- rowExpandedReserveRowMap,
8737
- expandOpts
8738
- } = this;
8739
- if (expandOpts.reserve) {
8740
- const rowid = (0, _util.getRowid)(this, row);
8741
- if (expanded) {
8742
- rowExpandedReserveRowMap[rowid] = row;
8743
- } else if (rowExpandedReserveRowMap[rowid]) {
8744
- delete rowExpandedReserveRowMap[rowid];
8745
- }
8746
- }
8747
- },
8748
8828
  getRowExpandRecords() {
8749
8829
  const rest = [];
8750
8830
  _xeUtils.default.each(this.rowExpandedMaps, item => {
@@ -9797,49 +9877,73 @@ const Methods = {
9797
9877
  const internalData = $xeTable;
9798
9878
  const {
9799
9879
  isGroup,
9800
- scrollXLoad
9880
+ scrollXLoad,
9881
+ overflowX,
9882
+ scrollXWidth
9801
9883
  } = reactData;
9802
9884
  const {
9803
9885
  visibleColumn,
9804
9886
  scrollXStore,
9805
9887
  elemStore,
9806
- tableWidth
9888
+ fullColumnIdData
9807
9889
  } = internalData;
9808
- const tableHeader = $xeTable.$refs.refTableHeader;
9809
9890
  const tableBody = $xeTable.$refs.refTableBody;
9810
- const tableFooter = $xeTable.$refs.refTableFooter;
9811
9891
  const tableBodyElem = tableBody ? tableBody.$el : null;
9812
9892
  if (tableBodyElem) {
9813
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
9814
- const tableFooterElem = tableFooter ? tableFooter.$el : null;
9815
- const headerElem = tableHeaderElem ? tableHeaderElem.querySelector('.vxe-table--header') : null;
9816
- const bodyElem = tableBodyElem.querySelector('.vxe-table--body');
9817
- const footerElem = tableFooterElem ? tableFooterElem.querySelector('.vxe-table--footer') : null;
9818
- const leftSpaceWidth = visibleColumn.slice(0, scrollXStore.startIndex).reduce((previous, column) => previous + column.renderWidth, 0);
9893
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
9894
+ const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
9895
+ const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
9896
+ const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
9897
+ let xSpaceLeft = 0;
9898
+ const firstColumn = visibleColumn[scrollXStore.startIndex];
9899
+ if (firstColumn) {
9900
+ const colRest = fullColumnIdData[firstColumn.id] || {};
9901
+ xSpaceLeft = colRest.oLeft;
9902
+ }
9903
+ let clientWidth = 0;
9904
+ if (bodyScrollElem) {
9905
+ clientWidth = bodyScrollElem.clientWidth;
9906
+ }
9907
+ // 虚拟渲染
9908
+ let isScrollXBig = false;
9909
+ let ySpaceWidth = scrollXWidth;
9910
+ if (scrollXWidth > maxXWidth) {
9911
+ // 触右
9912
+ if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
9913
+ xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
9914
+ } else {
9915
+ xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
9916
+ }
9917
+ ySpaceWidth = maxXWidth;
9918
+ isScrollXBig = true;
9919
+ }
9819
9920
  let marginLeft = '';
9820
- if (scrollXLoad) {
9821
- marginLeft = `${leftSpaceWidth}px`;
9921
+ if (scrollXLoad && overflowX) {
9922
+ marginLeft = `${xSpaceLeft}px`;
9923
+ }
9924
+ if (headerTableElem) {
9925
+ headerTableElem.style.marginLeft = isGroup ? '' : marginLeft;
9822
9926
  }
9823
- if (headerElem) {
9824
- headerElem.style.marginLeft = isGroup ? '' : marginLeft;
9927
+ if (bodyTableElem) {
9928
+ bodyTableElem.style.marginLeft = marginLeft;
9825
9929
  }
9826
- bodyElem.style.marginLeft = marginLeft;
9827
- if (footerElem) {
9828
- footerElem.style.marginLeft = marginLeft;
9930
+ if (footerTableElem) {
9931
+ footerTableElem.style.marginLeft = marginLeft;
9829
9932
  }
9933
+ reactData.isScrollXBig = isScrollXBig;
9830
9934
  const containerList = ['main'];
9831
9935
  containerList.forEach(name => {
9832
9936
  const layoutList = ['header', 'body', 'footer'];
9833
9937
  layoutList.forEach(layout => {
9834
9938
  const xSpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);
9835
9939
  if (xSpaceElem) {
9836
- xSpaceElem.style.width = scrollXLoad ? `${tableWidth}px` : '';
9940
+ xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
9837
9941
  }
9838
9942
  });
9839
9943
  });
9840
9944
  const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
9841
9945
  if (scrollXSpaceEl) {
9842
- scrollXSpaceEl.style.width = `${tableWidth}px`;
9946
+ scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
9843
9947
  }
9844
9948
  $xeTable.$nextTick(() => {
9845
9949
  updateStyle($xeTable);
@@ -9880,47 +9984,63 @@ const Methods = {
9880
9984
  const rowOpts = $xeTable.computeRowOpts;
9881
9985
  const cellOpts = $xeTable.computeCellOpts;
9882
9986
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
9987
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
9883
9988
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
9884
9989
  const containerList = ['main', 'left', 'right'];
9885
- let topSpaceHeight = 0;
9886
- let ySpaceHeight = 0;
9990
+ let ySpaceTop = 0;
9991
+ let scrollYHeight = 0;
9992
+ let isScrollYBig = false;
9887
9993
  if (scrollYLoad) {
9888
9994
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
9889
9995
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
9890
- ySpaceHeight = afterFullData.length * defaultRowHeight;
9891
- topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
9996
+ scrollYHeight = afterFullData.length * defaultRowHeight;
9997
+ if (scrollYHeight > maxYHeight) {
9998
+ isScrollYBig = true;
9999
+ }
10000
+ ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
9892
10001
  } else {
9893
- for (let i = 0; i < afterFullData.length; i++) {
9894
- const row = afterFullData[i];
9895
- const rowid = (0, _util.getRowid)($xeTable, row);
9896
- const rowRest = fullAllDataRowIdData[rowid] || {};
9897
- ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9898
- // 是否展开行
9899
- if (expandColumn && rowExpandedMaps[rowid]) {
9900
- ySpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
9901
- }
10002
+ const firstRow = afterFullData[startIndex];
10003
+ let rowid = (0, _util.getRowid)($xeTable, firstRow);
10004
+ let rowRest = fullAllDataRowIdData[rowid] || {};
10005
+ ySpaceTop = rowRest.oTop;
10006
+ const lastRow = afterFullData[afterFullData.length - 1];
10007
+ rowid = (0, _util.getRowid)($xeTable, lastRow);
10008
+ rowRest = fullAllDataRowIdData[rowid] || {};
10009
+ scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
10010
+ // 是否展开行
10011
+ if (expandColumn && rowExpandedMaps[rowid]) {
10012
+ scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
9902
10013
  }
9903
- for (let i = 0; i < startIndex; i++) {
9904
- const row = afterFullData[i];
9905
- const rowid = (0, _util.getRowid)($xeTable, row);
9906
- const rowRest = fullAllDataRowIdData[rowid] || {};
9907
- topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9908
- // 是否展开行
9909
- if (expandColumn && rowExpandedMaps[rowid]) {
9910
- topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
9911
- }
10014
+ if (scrollYHeight > maxYHeight) {
10015
+ isScrollYBig = true;
9912
10016
  }
9913
10017
  }
9914
10018
  } else {
9915
10019
  if (bodyTableElem) {
9916
- ySpaceHeight = bodyTableElem.clientHeight;
10020
+ scrollYHeight = bodyTableElem.clientHeight;
10021
+ }
10022
+ }
10023
+ let clientHeight = 0;
10024
+ if (bodyScrollElem) {
10025
+ clientHeight = bodyScrollElem.clientHeight;
10026
+ }
10027
+ // 虚拟渲染
10028
+ let ySpaceHeight = scrollYHeight;
10029
+ let scrollYTop = ySpaceTop;
10030
+ if (isScrollYBig) {
10031
+ // 触底
10032
+ if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
10033
+ scrollYTop = maxYHeight - bodyTableElem.clientHeight;
10034
+ } else {
10035
+ scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
9917
10036
  }
10037
+ ySpaceHeight = maxYHeight;
9918
10038
  }
9919
10039
  containerList.forEach(name => {
9920
10040
  const layoutList = ['header', 'body', 'footer'];
9921
10041
  const tableElem = (0, _util.getRefElem)(elemStore[`${name}-body-table`]);
9922
10042
  if (tableElem) {
9923
- tableElem.style.marginTop = topSpaceHeight ? `${topSpaceHeight}px` : '';
10043
+ tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
9924
10044
  }
9925
10045
  layoutList.forEach(layout => {
9926
10046
  const ySpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-ySpace`]);
@@ -9937,6 +10057,9 @@ const Methods = {
9937
10057
  if (rowExpandYSpaceEl) {
9938
10058
  rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
9939
10059
  }
10060
+ reactData.scrollYTop = scrollYTop;
10061
+ reactData.scrollYHeight = scrollYHeight;
10062
+ reactData.isScrollYBig = isScrollYBig;
9940
10063
  return $xeTable.$nextTick().then(() => {
9941
10064
  updateStyle($xeTable);
9942
10065
  });