vxe-table 4.11.16 → 4.12.0-beta.1

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.
@@ -40,6 +40,8 @@ const {
40
40
  renderEmptyElement
41
41
  } = _ui.VxeUI;
42
42
  const customStorageKey = 'VXE_CUSTOM_STORE';
43
+ const maxYHeight = 5e6;
44
+ const maxXWidth = 5e6;
43
45
  var _default = exports.default = (0, _vue.defineComponent)({
44
46
  name: 'VxeTable',
45
47
  props: _props.default,
@@ -931,33 +933,48 @@ var _default = exports.default = (0, _vue.defineComponent)({
931
933
  return reserveList;
932
934
  };
933
935
  const handleVirtualXVisible = () => {
936
+ const {
937
+ isScrollXBig,
938
+ scrollXWidth
939
+ } = reactData;
934
940
  const {
935
941
  elemStore,
936
- visibleColumn
942
+ visibleColumn,
943
+ fullColumnIdData
937
944
  } = internalData;
938
945
  const leftFixedWidth = computeLeftFixedWidth.value;
939
946
  const rightFixedWidth = computeRightFixedWidth.value;
940
947
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
941
948
  if (bodyScrollElem) {
942
- const {
943
- scrollLeft,
944
- clientWidth
945
- } = bodyScrollElem;
946
- const startWidth = scrollLeft + leftFixedWidth;
947
- const endWidth = scrollLeft + clientWidth - rightFixedWidth;
948
- let toVisibleIndex = -1;
949
- let cWidth = 0;
950
- let visibleSize = 0;
951
- for (let colIndex = 0, colLen = visibleColumn.length; colIndex < colLen; colIndex++) {
952
- cWidth += visibleColumn[colIndex].renderWidth;
953
- if (toVisibleIndex === -1 && startWidth < cWidth) {
954
- toVisibleIndex = colIndex;
949
+ const clientWidth = bodyScrollElem.clientWidth;
950
+ let scrollLeft = bodyScrollElem.scrollLeft;
951
+ if (isScrollXBig) {
952
+ scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, scrollLeft / (maxXWidth - clientWidth)));
953
+ }
954
+ const startLeft = scrollLeft + leftFixedWidth;
955
+ const endLeft = scrollLeft + clientWidth - rightFixedWidth;
956
+ let leftIndex = 0;
957
+ let rightIndex = visibleColumn.length;
958
+ while (leftIndex < rightIndex) {
959
+ const cIndex = Math.floor((leftIndex + rightIndex) / 2);
960
+ const column = visibleColumn[cIndex];
961
+ const colid = column.id;
962
+ const colRest = fullColumnIdData[colid] || {};
963
+ if (colRest.oLeft <= startLeft) {
964
+ leftIndex = cIndex + 1;
965
+ } else {
966
+ rightIndex = cIndex;
955
967
  }
956
- if (toVisibleIndex >= 0) {
957
- visibleSize++;
958
- if (cWidth > endWidth) {
959
- break;
960
- }
968
+ }
969
+ let visibleSize = 0;
970
+ const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
971
+ for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
972
+ const column = visibleColumn[cIndex];
973
+ const colid = column.id;
974
+ const colRest = fullColumnIdData[colid] || {};
975
+ visibleSize++;
976
+ if (colRest.oLeft > endLeft || visibleSize >= 60) {
977
+ break;
961
978
  }
962
979
  }
963
980
  return {
@@ -1008,11 +1025,12 @@ var _default = exports.default = (0, _vue.defineComponent)({
1008
1025
  // 最低支持 18px 行高
1009
1026
  return Math.max(18, rowHeight);
1010
1027
  };
1011
- const handleVirtualYVisible = currScrollTop => {
1028
+ const handleVirtualYVisible = () => {
1012
1029
  const {
1013
1030
  isAllOverflow,
1014
1031
  expandColumn,
1015
- rowExpandedMaps
1032
+ isScrollYBig,
1033
+ scrollYHeight
1016
1034
  } = reactData;
1017
1035
  const {
1018
1036
  elemStore,
@@ -1020,40 +1038,46 @@ var _default = exports.default = (0, _vue.defineComponent)({
1020
1038
  afterFullData,
1021
1039
  fullAllDataRowIdData
1022
1040
  } = internalData;
1023
- const expandOpts = computeExpandOpts.value;
1024
1041
  const rowOpts = computeRowOpts.value;
1025
1042
  const cellOpts = computeCellOpts.value;
1026
1043
  const defaultRowHeight = computeDefaultRowHeight.value;
1027
1044
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
1028
1045
  if (bodyScrollElem) {
1029
1046
  const clientHeight = bodyScrollElem.clientHeight;
1030
- const scrollTop = _xeUtils.default.isNumber(currScrollTop) ? currScrollTop : bodyScrollElem.scrollTop;
1031
- const endHeight = scrollTop + clientHeight;
1047
+ let scrollTop = bodyScrollElem.scrollTop;
1048
+ if (isScrollYBig) {
1049
+ scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, scrollTop / (maxYHeight - clientHeight)));
1050
+ }
1051
+ const startTop = scrollTop;
1052
+ const endTop = scrollTop + clientHeight;
1032
1053
  let toVisibleIndex = -1;
1033
- let offsetTop = 0;
1034
1054
  let visibleSize = 0;
1035
1055
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
1036
1056
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
1037
- toVisibleIndex = Math.floor(scrollTop / defaultRowHeight);
1057
+ toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
1038
1058
  visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
1039
1059
  } else {
1040
- for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1060
+ let leftIndex = 0;
1061
+ let rightIndex = afterFullData.length;
1062
+ while (leftIndex < rightIndex) {
1063
+ const rIndex = Math.floor((leftIndex + rightIndex) / 2);
1041
1064
  const row = afterFullData[rIndex];
1042
1065
  const rowid = (0, _util.getRowid)($xeTable, row);
1043
1066
  const rowRest = fullAllDataRowIdData[rowid] || {};
1044
- offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
1045
- if (toVisibleIndex === -1 && scrollTop < offsetTop) {
1046
- toVisibleIndex = rIndex;
1047
- }
1048
- if (toVisibleIndex >= 0) {
1049
- visibleSize++;
1050
- if (offsetTop > endHeight) {
1051
- break;
1052
- }
1067
+ if (rowRest.oTop <= startTop) {
1068
+ leftIndex = rIndex + 1;
1069
+ } else {
1070
+ rightIndex = rIndex;
1053
1071
  }
1054
- // 是否展开行
1055
- if (expandColumn && rowExpandedMaps[rowid]) {
1056
- offsetTop += rowRest.expandHeight || expandOpts.height || 0;
1072
+ }
1073
+ toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
1074
+ for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
1075
+ const row = afterFullData[rIndex];
1076
+ const rowid = (0, _util.getRowid)($xeTable, row);
1077
+ const rowRest = fullAllDataRowIdData[rowid] || {};
1078
+ visibleSize++;
1079
+ if (rowRest.oTop > endTop || visibleSize >= 100) {
1080
+ break;
1057
1081
  }
1058
1082
  }
1059
1083
  }
@@ -1496,7 +1520,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1496
1520
  if (!xHandleEl) {
1497
1521
  return;
1498
1522
  }
1499
- let tableWidth = 0;
1523
+ let tWidth = 0;
1500
1524
  const minCellWidth = 40; // 列宽最少限制 40px
1501
1525
  const bodyWidth = bodyElem.clientWidth;
1502
1526
  let remainWidth = bodyWidth;
@@ -1520,51 +1544,51 @@ var _default = exports.default = (0, _vue.defineComponent)({
1520
1544
  // 最小宽
1521
1545
  pxMinList.forEach(column => {
1522
1546
  const minWidth = _xeUtils.default.toInteger(column.minWidth);
1523
- tableWidth += minWidth;
1547
+ tWidth += minWidth;
1524
1548
  column.renderWidth = minWidth;
1525
1549
  });
1526
1550
  // 最小自适应
1527
1551
  autoMinList.forEach(column => {
1528
1552
  const caWidth = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
1529
- tableWidth += caWidth;
1553
+ tWidth += caWidth;
1530
1554
  column.renderWidth = caWidth;
1531
1555
  });
1532
1556
  // 最小百分比
1533
1557
  scaleMinList.forEach(column => {
1534
1558
  const smWidth = Math.floor(_xeUtils.default.toInteger(column.minWidth) * meanWidth);
1535
- tableWidth += smWidth;
1559
+ tWidth += smWidth;
1536
1560
  column.renderWidth = smWidth;
1537
1561
  });
1538
1562
  // 固定百分比
1539
1563
  scaleList.forEach(column => {
1540
1564
  const sfWidth = Math.floor(_xeUtils.default.toInteger(column.width) * meanWidth);
1541
- tableWidth += sfWidth;
1565
+ tWidth += sfWidth;
1542
1566
  column.renderWidth = sfWidth;
1543
1567
  });
1544
1568
  // 固定宽
1545
1569
  pxList.forEach(column => {
1546
1570
  const pWidth = _xeUtils.default.toInteger(column.width);
1547
- tableWidth += pWidth;
1571
+ tWidth += pWidth;
1548
1572
  column.renderWidth = pWidth;
1549
1573
  });
1550
1574
  // 自适应宽
1551
1575
  autoList.forEach(column => {
1552
1576
  const aWidth = Math.max(60, _xeUtils.default.toInteger(column.renderAutoWidth));
1553
- tableWidth += aWidth;
1577
+ tWidth += aWidth;
1554
1578
  column.renderWidth = aWidth;
1555
1579
  });
1556
1580
  // 调整了列宽
1557
1581
  resizeList.forEach(column => {
1558
1582
  const reWidth = _xeUtils.default.toInteger(column.resizeWidth);
1559
- tableWidth += reWidth;
1583
+ tWidth += reWidth;
1560
1584
  column.renderWidth = reWidth;
1561
1585
  });
1562
- remainWidth -= tableWidth;
1586
+ remainWidth -= tWidth;
1563
1587
  meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
1564
1588
  if (fit) {
1565
1589
  if (remainWidth > 0) {
1566
1590
  scaleMinList.concat(pxMinList).concat(autoMinList).forEach(column => {
1567
- tableWidth += meanWidth;
1591
+ tWidth += meanWidth;
1568
1592
  column.renderWidth += meanWidth;
1569
1593
  });
1570
1594
  }
@@ -1575,7 +1599,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
1575
1599
  remainList.forEach(column => {
1576
1600
  const width = Math.max(meanWidth, minCellWidth);
1577
1601
  column.renderWidth = width;
1578
- tableWidth += width;
1602
+ tWidth += width;
1579
1603
  });
1580
1604
  if (fit) {
1581
1605
  /**
@@ -1585,13 +1609,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
1585
1609
  const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
1586
1610
  let dynamicSize = dynamicList.length - 1;
1587
1611
  if (dynamicSize > 0) {
1588
- let i = bodyWidth - tableWidth;
1612
+ let i = bodyWidth - tWidth;
1589
1613
  if (i > 0) {
1590
1614
  while (i > 0 && dynamicSize >= 0) {
1591
1615
  i--;
1592
1616
  dynamicList[dynamicSize--].renderWidth++;
1593
1617
  }
1594
- tableWidth = bodyWidth;
1618
+ tWidth = bodyWidth;
1595
1619
  }
1596
1620
  }
1597
1621
  }
@@ -1599,17 +1623,18 @@ var _default = exports.default = (0, _vue.defineComponent)({
1599
1623
  const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
1600
1624
  reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
1601
1625
  reactData.overflowY = overflowY;
1602
- internalData.tableWidth = tableWidth;
1626
+ reactData.scrollXWidth = tWidth;
1603
1627
  internalData.tableHeight = tableHeight;
1604
1628
  const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
1605
1629
  const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
1606
1630
  const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
1607
- const overflowX = tableWidth > bodyWidth;
1631
+ const overflowX = tWidth > bodyWidth;
1608
1632
  const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
1609
1633
  reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
1610
1634
  internalData.headerHeight = headerHeight;
1611
1635
  internalData.footerHeight = footerHeight;
1612
1636
  reactData.overflowX = overflowX;
1637
+ updateColumnOffsetLeft();
1613
1638
  updateHeight();
1614
1639
  reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
1615
1640
  if (overflowX) {
@@ -2060,6 +2085,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2060
2085
  scrollbarWidth,
2061
2086
  overflowY,
2062
2087
  scrollbarHeight,
2088
+ scrollXWidth,
2063
2089
  columnStore,
2064
2090
  editStore,
2065
2091
  isAllOverflow,
@@ -2069,7 +2095,6 @@ var _default = exports.default = (0, _vue.defineComponent)({
2069
2095
  visibleColumn,
2070
2096
  fullColumnIdData,
2071
2097
  tableHeight,
2072
- tableWidth,
2073
2098
  headerHeight,
2074
2099
  footerHeight,
2075
2100
  elemStore,
@@ -2114,9 +2139,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
2114
2139
  }
2115
2140
  bodyHeight = Math.max(bodyMinHeight, bodyHeight);
2116
2141
  }
2142
+ const scrollbarXToTop = computeScrollbarXToTop.value;
2117
2143
  const xLeftCornerEl = refScrollXLeftCornerElem.value;
2118
2144
  const xRightCornerEl = refScrollXRightCornerElem.value;
2119
- const scrollbarXToTop = computeScrollbarXToTop.value;
2120
2145
  const scrollXVirtualEl = refScrollXVirtualElem.value;
2121
2146
  if (scrollXVirtualEl) {
2122
2147
  scrollXVirtualEl.style.height = `${osbHeight}px`;
@@ -2204,7 +2229,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2204
2229
  if (fixedType) {
2205
2230
  if (isGroup) {
2206
2231
  if (wrapperElem) {
2207
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
2232
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
2208
2233
  }
2209
2234
  } else {
2210
2235
  if (isOptimizeMode) {
@@ -2213,7 +2238,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2213
2238
  }
2214
2239
  } else {
2215
2240
  if (wrapperElem) {
2216
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
2241
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
2217
2242
  }
2218
2243
  }
2219
2244
  }
@@ -2292,7 +2317,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2292
2317
  }
2293
2318
  } else {
2294
2319
  if (wrapperElem) {
2295
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
2320
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
2296
2321
  }
2297
2322
  }
2298
2323
  }
@@ -2330,7 +2355,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
2330
2355
  }
2331
2356
  } else {
2332
2357
  if (wrapperElem) {
2333
- wrapperElem.style.width = tableWidth ? `${tableWidth}px` : '';
2358
+ wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
2334
2359
  }
2335
2360
  }
2336
2361
  }
@@ -3054,6 +3079,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
3054
3079
  calcCellWidth();
3055
3080
  autoCellWidth();
3056
3081
  updateStyle();
3082
+ if (reFull) {
3083
+ updateRowOffsetTop();
3084
+ }
3057
3085
  updateRowExpandStyle();
3058
3086
  return computeScrollLoad().then(() => {
3059
3087
  if (reFull === true) {
@@ -3061,6 +3089,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
3061
3089
  calcCellWidth();
3062
3090
  autoCellWidth();
3063
3091
  updateStyle();
3092
+ if (reFull) {
3093
+ updateRowOffsetTop();
3094
+ }
3064
3095
  updateRowExpandStyle();
3065
3096
  return computeScrollLoad();
3066
3097
  }
@@ -3209,6 +3240,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
3209
3240
  }
3210
3241
  reactData.isRowLoading = false;
3211
3242
  calcCellHeight();
3243
+ updateRowOffsetTop();
3212
3244
  // 是否变更虚拟滚动
3213
3245
  if (oldScrollYLoad === sYLoad) {
3214
3246
  (0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
@@ -3274,7 +3306,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
3274
3306
  const loadScrollXData = () => {
3275
3307
  const {
3276
3308
  mergeList,
3277
- mergeFooterList
3309
+ mergeFooterList,
3310
+ isScrollXBig
3278
3311
  } = reactData;
3279
3312
  const {
3280
3313
  scrollXStore
@@ -3290,11 +3323,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
3290
3323
  visibleSize
3291
3324
  } = handleVirtualXVisible();
3292
3325
  const offsetItem = {
3293
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
3294
- endIndex: toVisibleIndex + visibleSize + offsetSize + preloadSize
3326
+ startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
3327
+ endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
3295
3328
  };
3296
- scrollXStore.visibleStartIndex = toVisibleIndex;
3297
- scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize;
3329
+ scrollXStore.visibleStartIndex = toVisibleIndex - 1;
3330
+ scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
3298
3331
  calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
3299
3332
  const {
3300
3333
  startIndex: offsetStartIndex,
@@ -3448,6 +3481,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
3448
3481
  internalData.visibleColumn = visibleColumn;
3449
3482
  handleTableColumn();
3450
3483
  if (isReset) {
3484
+ updateColumnOffsetLeft();
3451
3485
  return $xeTable.updateFooter().then(() => {
3452
3486
  return $xeTable.recalculate();
3453
3487
  }).then(() => {
@@ -3643,10 +3677,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
3643
3677
  /**
3644
3678
  * 纵向 Y 可视渲染处理
3645
3679
  */
3646
- const loadScrollYData = scrollTop => {
3680
+ const loadScrollYData = () => {
3647
3681
  const {
3648
3682
  mergeList,
3649
- isAllOverflow
3683
+ isAllOverflow,
3684
+ isScrollYBig
3650
3685
  } = reactData;
3651
3686
  const {
3652
3687
  scrollYStore
@@ -3661,13 +3696,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
3661
3696
  const {
3662
3697
  toVisibleIndex,
3663
3698
  visibleSize
3664
- } = handleVirtualYVisible(scrollTop);
3699
+ } = handleVirtualYVisible();
3665
3700
  const offsetItem = {
3666
- startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
3667
- endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
3701
+ startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
3702
+ endIndex: isScrollYBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
3668
3703
  };
3669
- scrollYStore.visibleStartIndex = toVisibleIndex;
3670
- scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize;
3704
+ scrollYStore.visibleStartIndex = toVisibleIndex - 1;
3705
+ scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
3671
3706
  calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
3672
3707
  const {
3673
3708
  startIndex: offsetStartIndex,
@@ -3787,6 +3822,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
3787
3822
  $xeTable.updateScrollYSpace();
3788
3823
  });
3789
3824
  }
3825
+ updateRowExpandStyle();
3790
3826
  $xeTable.updateCellAreas();
3791
3827
  }, 200);
3792
3828
  };
@@ -3873,11 +3909,52 @@ var _default = exports.default = (0, _vue.defineComponent)({
3873
3909
  setTimeout(() => $xeTable.recalculate(true), 300);
3874
3910
  });
3875
3911
  };
3912
+ const updateColumnOffsetLeft = () => {
3913
+ const {
3914
+ visibleColumn,
3915
+ fullColumnIdData
3916
+ } = internalData;
3917
+ let offsetLeft = 0;
3918
+ for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
3919
+ const column = visibleColumn[cIndex];
3920
+ const colid = column.id;
3921
+ const colRest = fullColumnIdData[colid];
3922
+ colRest.oLeft = offsetLeft;
3923
+ offsetLeft += column.renderWidth;
3924
+ }
3925
+ };
3926
+ const updateRowOffsetTop = () => {
3927
+ const {
3928
+ expandColumn,
3929
+ rowExpandedMaps
3930
+ } = reactData;
3931
+ const {
3932
+ afterFullData,
3933
+ fullAllDataRowIdData
3934
+ } = internalData;
3935
+ const expandOpts = computeExpandOpts.value;
3936
+ const rowOpts = computeRowOpts.value;
3937
+ const cellOpts = computeCellOpts.value;
3938
+ const defaultRowHeight = computeDefaultRowHeight.value;
3939
+ let offsetTop = 0;
3940
+ for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
3941
+ const row = afterFullData[rIndex];
3942
+ const rowid = (0, _util.getRowid)($xeTable, row);
3943
+ const rowRest = fullAllDataRowIdData[rowid] || {};
3944
+ rowRest.oTop = offsetTop;
3945
+ offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
3946
+ // 是否展开行
3947
+ if (expandColumn && rowExpandedMaps[rowid]) {
3948
+ offsetTop += rowRest.expandHeight || expandOpts.height || 0;
3949
+ }
3950
+ }
3951
+ };
3876
3952
  const updateRowExpandStyle = () => {
3877
3953
  const {
3878
3954
  expandColumn,
3879
3955
  scrollYLoad,
3880
- rowExpandedMaps
3956
+ scrollYTop,
3957
+ isScrollYBig
3881
3958
  } = reactData;
3882
3959
  const expandOpts = computeExpandOpts.value;
3883
3960
  const rowOpts = computeRowOpts.value;
@@ -3889,41 +3966,35 @@ var _default = exports.default = (0, _vue.defineComponent)({
3889
3966
  if (expandColumn && mode === 'fixed') {
3890
3967
  const {
3891
3968
  elemStore,
3892
- afterFullData,
3893
3969
  fullAllDataRowIdData
3894
3970
  } = internalData;
3895
3971
  const rowExpandEl = refRowExpandElem.value;
3896
3972
  const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
3897
3973
  if (rowExpandEl && bodyScrollElem) {
3898
3974
  let isUpdateHeight = false;
3899
- if (scrollYLoad) {
3900
- let offsetTop = 0;
3901
- for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
3902
- const row = afterFullData[rIndex];
3903
- const rowid = (0, _util.getRowid)($xeTable, row);
3904
- const rowRest = fullAllDataRowIdData[rowid] || {};
3905
- rowRest.oTop = offsetTop;
3906
- offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
3907
- // 是否展开行
3908
- if (expandColumn && rowExpandedMaps[rowid]) {
3909
- offsetTop += rowRest.expandHeight || expandOpts.height || 0;
3910
- }
3911
- }
3912
- }
3913
3975
  _xeUtils.default.arrayEach(rowExpandEl.children, reEl => {
3914
3976
  const expandEl = reEl;
3915
3977
  const rowid = expandEl.getAttribute('rowid') || '';
3916
3978
  const rowRest = fullAllDataRowIdData[rowid];
3917
3979
  if (rowRest) {
3918
3980
  const expandHeight = expandEl.offsetHeight + 1;
3981
+ const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
3982
+ let offsetTop = 0;
3919
3983
  if (scrollYLoad) {
3920
- expandEl.style.top = (0, _dom.toCssUnit)(rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight));
3984
+ if (isScrollYBig && trEl) {
3985
+ offsetTop = trEl.offsetTop + trEl.offsetHeight;
3986
+ } else {
3987
+ offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
3988
+ }
3921
3989
  } else {
3922
- const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
3923
3990
  if (trEl) {
3924
- expandEl.style.top = (0, _dom.toCssUnit)(trEl.offsetTop + trEl.offsetHeight);
3991
+ offsetTop = trEl.offsetTop + trEl.offsetHeight;
3925
3992
  }
3926
3993
  }
3994
+ if (isScrollYBig) {
3995
+ offsetTop += scrollYTop;
3996
+ }
3997
+ expandEl.style.top = (0, _dom.toCssUnit)(offsetTop);
3927
3998
  if (!isUpdateHeight) {
3928
3999
  if (rowRest.expandHeight !== expandHeight) {
3929
4000
  isUpdateHeight = true;
@@ -3934,6 +4005,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
3934
4005
  });
3935
4006
  if (isUpdateHeight) {
3936
4007
  reactData.rowExpandHeightFlag++;
4008
+ (0, _vue.nextTick)(() => {
4009
+ updateRowOffsetTop();
4010
+ });
3937
4011
  }
3938
4012
  }
3939
4013
  }
@@ -4971,6 +5045,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
4971
5045
  }
4972
5046
  }
4973
5047
  return (0, _vue.nextTick)().then(() => {
5048
+ updateRowOffsetTop();
4974
5049
  return {
4975
5050
  status
4976
5051
  };
@@ -5994,11 +6069,10 @@ var _default = exports.default = (0, _vue.defineComponent)({
5994
6069
  }
5995
6070
  }
5996
6071
  reactData.rowExpandedMaps = rExpandedMaps;
5997
- return Promise.all(lazyRests).then(() => $xeTable.recalculate()).then(() => {
5998
- if (expandColumn) {
5999
- updateRowExpandStyle();
6000
- handleRowExpandScroll();
6001
- }
6072
+ return Promise.all(lazyRests).then(() => (0, _vue.nextTick)()).then(() => $xeTable.recalculate(true)).then(() => {
6073
+ updateRowOffsetTop();
6074
+ updateRowExpandStyle();
6075
+ handleRowExpandScroll();
6002
6076
  return $xeTable.updateCellAreas();
6003
6077
  });
6004
6078
  },
@@ -6031,16 +6105,21 @@ var _default = exports.default = (0, _vue.defineComponent)({
6031
6105
  const {
6032
6106
  reserve
6033
6107
  } = expandOpts;
6034
- const expList = tableMethods.getRowExpandRecords();
6108
+ const expList = $xeTable.getRowExpandRecords();
6035
6109
  reactData.rowExpandedMaps = {};
6036
6110
  if (reserve) {
6037
6111
  tableFullData.forEach(row => handleRowExpandReserve(row, false));
6038
6112
  }
6039
6113
  return (0, _vue.nextTick)().then(() => {
6040
6114
  if (expList.length) {
6041
- tableMethods.recalculate();
6115
+ return $xeTable.recalculate(true);
6042
6116
  }
6043
- }).then(() => $xeTable.updateCellAreas());
6117
+ }).then(() => {
6118
+ updateRowOffsetTop();
6119
+ updateRowExpandStyle();
6120
+ handleRowExpandScroll();
6121
+ return $xeTable.updateCellAreas();
6122
+ });
6044
6123
  },
6045
6124
  clearRowExpandReserve() {
6046
6125
  internalData.rowExpandedReserveRowMap = {};
@@ -7384,8 +7463,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
7384
7463
  const wrapperRect = el.getBoundingClientRect();
7385
7464
  const osbWidth = overflowY ? scrollbarWidth : 0;
7386
7465
  const osbHeight = overflowX ? scrollbarHeight : 0;
7387
- const tableWidth = el.clientWidth;
7388
- const tableHeight = el.clientHeight;
7466
+ const tableWrapperWidth = el.clientWidth;
7467
+ const tableWrapperHeight = el.clientHeight;
7389
7468
  if (trEl) {
7390
7469
  const rdLineEl = refDragRowLineElem.value;
7391
7470
  if (rdLineEl) {
@@ -7394,14 +7473,14 @@ var _default = exports.default = (0, _vue.defineComponent)({
7394
7473
  const trRect = trEl.getBoundingClientRect();
7395
7474
  let trHeight = trEl.clientHeight;
7396
7475
  const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
7397
- if (offsetTop + trHeight > tableHeight - osbHeight) {
7398
- trHeight = tableHeight - offsetTop - osbHeight;
7476
+ if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
7477
+ trHeight = tableWrapperHeight - offsetTop - osbHeight;
7399
7478
  }
7400
7479
  rdLineEl.style.display = 'block';
7401
7480
  rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
7402
7481
  rdLineEl.style.top = `${offsetTop}px`;
7403
7482
  rdLineEl.style.height = `${trHeight}px`;
7404
- rdLineEl.style.width = `${tableWidth - osbWidth}px`;
7483
+ rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
7405
7484
  rdLineEl.setAttribute('drag-pos', dragPos);
7406
7485
  rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
7407
7486
  } else {
@@ -7426,7 +7505,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
7426
7505
  thWidth -= startX - offsetLeft;
7427
7506
  offsetLeft = startX;
7428
7507
  }
7429
- const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
7508
+ const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
7430
7509
  if (offsetLeft + thWidth > endX) {
7431
7510
  thWidth = endX - offsetLeft;
7432
7511
  }
@@ -7437,7 +7516,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
7437
7516
  if (prevDragToChild) {
7438
7517
  cdLineEl.style.height = `${thRect.height}px`;
7439
7518
  } else {
7440
- cdLineEl.style.height = `${tableHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
7519
+ cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
7441
7520
  }
7442
7521
  cdLineEl.setAttribute('drag-pos', dragPos);
7443
7522
  cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
@@ -7898,7 +7977,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
7898
7977
  resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
7899
7978
  if (resizableOpts.showDragTip && resizeTipElem) {
7900
7979
  resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
7901
- const tableWidth = tableEl.clientWidth;
7980
+ const tableWrapperWidth = tableEl.clientWidth;
7902
7981
  const wrapperRect = wrapperElem.getBoundingClientRect();
7903
7982
  const resizeBarWidth = resizeBarElem.clientWidth;
7904
7983
  const resizeTipWidth = resizeTipElem.clientWidth;
@@ -7906,8 +7985,8 @@ var _default = exports.default = (0, _vue.defineComponent)({
7906
7985
  let resizeTipLeft = -resizeTipWidth;
7907
7986
  if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
7908
7987
  resizeTipLeft = 0;
7909
- } else if (resizeBarLeft > tableWidth) {
7910
- resizeTipLeft += tableWidth - resizeBarLeft;
7988
+ } else if (resizeBarLeft > tableWrapperWidth) {
7989
+ resizeTipLeft += tableWrapperWidth - resizeBarLeft;
7911
7990
  }
7912
7991
  resizeTipElem.style.left = `${resizeTipLeft}px`;
7913
7992
  resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
@@ -8063,7 +8142,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
8063
8142
  const updateEvent = evnt => {
8064
8143
  evnt.stopPropagation();
8065
8144
  evnt.preventDefault();
8066
- const tableWidth = tableEl.clientWidth - osbWidth;
8145
+ const rtWidth = tableEl.clientWidth - osbWidth;
8067
8146
  const tableHeight = tableEl.clientHeight - osbHeight;
8068
8147
  let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
8069
8148
  if (dragTop < minTop) {
@@ -8073,15 +8152,15 @@ var _default = exports.default = (0, _vue.defineComponent)({
8073
8152
  }
8074
8153
  resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
8075
8154
  resizeBarElem.style.top = `${dragTop}px`;
8076
- resizeBarElem.style.width = `${tableWidth}px`;
8155
+ resizeBarElem.style.width = `${rtWidth}px`;
8077
8156
  if (resizableOpts.showDragTip && resizeTipElem) {
8078
8157
  resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
8079
8158
  const resizeTipWidth = resizeTipElem.clientWidth;
8080
8159
  const resizeTipHeight = resizeTipElem.clientHeight;
8081
8160
  let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
8082
8161
  let resizeBarTop = 0;
8083
- if (resizeBarLeft + resizeTipWidth >= tableWidth - 2) {
8084
- resizeBarLeft = tableWidth - resizeTipWidth - 2;
8162
+ if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
8163
+ resizeBarLeft = rtWidth - resizeTipWidth - 2;
8085
8164
  }
8086
8165
  if (dragTop + resizeTipHeight >= tableHeight) {
8087
8166
  resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
@@ -8114,6 +8193,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
8114
8193
  } else {
8115
8194
  rowRest.resizeHeight = resizeHeight;
8116
8195
  handleUpdateRowResize(evnt, resizeParams);
8196
+ updateRowOffsetTop();
8117
8197
  }
8118
8198
  }
8119
8199
  (0, _dom.removeClass)(tableEl, 'row-drag--resize');
@@ -8382,11 +8462,13 @@ var _default = exports.default = (0, _vue.defineComponent)({
8382
8462
  const checkboxOpts = computeCheckboxOpts.value;
8383
8463
  const {
8384
8464
  checkField,
8385
- checkMethod
8465
+ checkMethod,
8466
+ showReserveStatus
8386
8467
  } = checkboxOpts;
8387
8468
  const {
8388
8469
  afterFullData,
8389
- afterTreeFullData
8470
+ afterTreeFullData,
8471
+ checkboxReserveRowMap
8390
8472
  } = internalData;
8391
8473
  let sLen = 0; // 已选
8392
8474
  let hLen = 0; // 半选
@@ -8422,7 +8504,11 @@ var _default = exports.default = (0, _vue.defineComponent)({
8422
8504
  vLen++;
8423
8505
  });
8424
8506
  const isSelected = rootList.length > 0 ? vLen > 0 ? sLen >= vLen : sLen >= rootList.length : false;
8425
- const halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
8507
+ let halfSelect = !isSelected && (sLen >= 1 || hLen >= 1);
8508
+ // 如果复选框启用保留记录,当保留数据存在时显示半选
8509
+ if (!isSelected && !halfSelect && showReserveStatus) {
8510
+ halfSelect = !_xeUtils.default.isEmpty(checkboxReserveRowMap);
8511
+ }
8426
8512
  reactData.isAllSelected = isSelected;
8427
8513
  reactData.isIndeterminate = halfSelect;
8428
8514
  },
@@ -9861,21 +9947,21 @@ var _default = exports.default = (0, _vue.defineComponent)({
9861
9947
  const scrollTargetEl = xHandleEl || tableBodyElem;
9862
9948
  if (scrollTargetEl) {
9863
9949
  const wrapperRect = el.getBoundingClientRect();
9864
- const tableWidth = el.clientWidth;
9950
+ const tableWrapperWidth = el.clientWidth;
9865
9951
  const leftContainerElem = refLeftContainer.value;
9866
9952
  const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
9867
9953
  const rightContainerElem = refRightContainer.value;
9868
9954
  const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
9869
9955
  const srartX = wrapperRect.x + leftContainerWidth;
9870
- const endX = wrapperRect.x + tableWidth - rightContainerWidth;
9956
+ const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
9871
9957
  const distSize = 28;
9872
9958
  const startDistSize = clientX - srartX;
9873
9959
  const endDistSize = endX - clientX;
9874
9960
  if (startDistSize > 0 && startDistSize <= distSize) {
9875
- const scrollRatio = Math.floor(tableWidth / (startDistSize > distSize / 2 ? 240 : 120));
9961
+ const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
9876
9962
  scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
9877
9963
  } else if (endDistSize > 0 && endDistSize <= distSize) {
9878
- const scrollRatio = Math.floor(tableWidth / (endDistSize > distSize / 2 ? 240 : 120));
9964
+ const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
9879
9965
  scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
9880
9966
  }
9881
9967
  }
@@ -10454,49 +10540,72 @@ var _default = exports.default = (0, _vue.defineComponent)({
10454
10540
  const {
10455
10541
  isGroup,
10456
10542
  scrollXLoad,
10457
- overflowX
10543
+ overflowX,
10544
+ scrollXWidth
10458
10545
  } = reactData;
10459
10546
  const {
10460
10547
  visibleColumn,
10461
10548
  scrollXStore,
10462
10549
  elemStore,
10463
- tableWidth
10550
+ fullColumnIdData
10464
10551
  } = internalData;
10465
- const tableHeader = refTableHeader.value;
10466
10552
  const tableBody = refTableBody.value;
10467
- const tableFooter = refTableFooter.value;
10468
10553
  const tableBodyElem = tableBody ? tableBody.$el : null;
10469
10554
  if (tableBodyElem) {
10470
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
10471
- const tableFooterElem = tableFooter ? tableFooter.$el : null;
10472
- const headerElem = tableHeaderElem ? tableHeaderElem.querySelector('.vxe-table--header') : null;
10473
- const bodyElem = tableBodyElem.querySelector('.vxe-table--body');
10474
- const footerElem = tableFooterElem ? tableFooterElem.querySelector('.vxe-table--footer') : null;
10475
- const leftSpaceWidth = visibleColumn.slice(0, scrollXStore.startIndex).reduce((previous, column) => previous + column.renderWidth, 0);
10555
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
10556
+ const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
10557
+ const headerTableElem = (0, _util.getRefElem)(elemStore['main-header-table']);
10558
+ const footerTableElem = (0, _util.getRefElem)(elemStore['main-footer-table']);
10559
+ let xSpaceLeft = 0;
10560
+ const firstColumn = visibleColumn[scrollXStore.startIndex];
10561
+ if (firstColumn) {
10562
+ const colRest = fullColumnIdData[firstColumn.id] || {};
10563
+ xSpaceLeft = colRest.oLeft;
10564
+ }
10565
+ let clientWidth = 0;
10566
+ if (bodyScrollElem) {
10567
+ clientWidth = bodyScrollElem.clientWidth;
10568
+ }
10569
+ // 虚拟渲染
10570
+ let isScrollXBig = false;
10571
+ let ySpaceWidth = scrollXWidth;
10572
+ if (scrollXWidth > maxXWidth) {
10573
+ // 触右
10574
+ if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
10575
+ xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
10576
+ } else {
10577
+ xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
10578
+ }
10579
+ ySpaceWidth = maxXWidth;
10580
+ isScrollXBig = true;
10581
+ }
10476
10582
  let marginLeft = '';
10477
10583
  if (scrollXLoad && overflowX) {
10478
- marginLeft = `${leftSpaceWidth}px`;
10584
+ marginLeft = `${xSpaceLeft}px`;
10585
+ }
10586
+ if (headerTableElem) {
10587
+ headerTableElem.style.marginLeft = isGroup ? '' : marginLeft;
10479
10588
  }
10480
- if (headerElem) {
10481
- headerElem.style.marginLeft = isGroup ? '' : marginLeft;
10589
+ if (bodyTableElem) {
10590
+ bodyTableElem.style.marginLeft = marginLeft;
10482
10591
  }
10483
- bodyElem.style.marginLeft = marginLeft;
10484
- if (footerElem) {
10485
- footerElem.style.marginLeft = marginLeft;
10592
+ if (footerTableElem) {
10593
+ footerTableElem.style.marginLeft = marginLeft;
10486
10594
  }
10595
+ reactData.isScrollXBig = isScrollXBig;
10487
10596
  const containerList = ['main'];
10488
10597
  containerList.forEach(name => {
10489
10598
  const layoutList = ['header', 'body', 'footer'];
10490
10599
  layoutList.forEach(layout => {
10491
10600
  const xSpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);
10492
10601
  if (xSpaceElem) {
10493
- xSpaceElem.style.width = scrollXLoad ? `${tableWidth}px` : '';
10602
+ xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
10494
10603
  }
10495
10604
  });
10496
10605
  });
10497
10606
  const scrollXSpaceEl = refScrollXSpaceElem.value;
10498
10607
  if (scrollXSpaceEl) {
10499
- scrollXSpaceEl.style.width = `${tableWidth}px`;
10608
+ scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
10500
10609
  }
10501
10610
  (0, _vue.nextTick)(() => {
10502
10611
  updateStyle();
@@ -10525,47 +10634,63 @@ var _default = exports.default = (0, _vue.defineComponent)({
10525
10634
  const rowOpts = computeRowOpts.value;
10526
10635
  const cellOpts = computeCellOpts.value;
10527
10636
  const defaultRowHeight = computeDefaultRowHeight.value;
10637
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
10528
10638
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
10529
10639
  const containerList = ['main', 'left', 'right'];
10530
- let topSpaceHeight = 0;
10531
- let ySpaceHeight = 0;
10640
+ let ySpaceTop = 0;
10641
+ let scrollYHeight = 0;
10642
+ let isScrollYBig = false;
10532
10643
  if (scrollYLoad) {
10533
10644
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
10534
10645
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
10535
- ySpaceHeight = afterFullData.length * defaultRowHeight;
10536
- topSpaceHeight = Math.max(0, startIndex * defaultRowHeight);
10646
+ scrollYHeight = afterFullData.length * defaultRowHeight;
10647
+ if (scrollYHeight > maxYHeight) {
10648
+ isScrollYBig = true;
10649
+ }
10650
+ ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
10537
10651
  } else {
10538
- for (let i = 0; i < afterFullData.length; i++) {
10539
- const row = afterFullData[i];
10540
- const rowid = (0, _util.getRowid)($xeTable, row);
10541
- const rowRest = fullAllDataRowIdData[rowid] || {};
10542
- ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
10543
- // 是否展开行
10544
- if (expandColumn && rowExpandedMaps[rowid]) {
10545
- ySpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
10546
- }
10652
+ const firstRow = afterFullData[startIndex];
10653
+ let rowid = (0, _util.getRowid)($xeTable, firstRow);
10654
+ let rowRest = fullAllDataRowIdData[rowid] || {};
10655
+ ySpaceTop = rowRest.oTop;
10656
+ const lastRow = afterFullData[afterFullData.length - 1];
10657
+ rowid = (0, _util.getRowid)($xeTable, lastRow);
10658
+ rowRest = fullAllDataRowIdData[rowid] || {};
10659
+ scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
10660
+ // 是否展开行
10661
+ if (expandColumn && rowExpandedMaps[rowid]) {
10662
+ scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
10547
10663
  }
10548
- for (let i = 0; i < startIndex; i++) {
10549
- const row = afterFullData[i];
10550
- const rowid = (0, _util.getRowid)($xeTable, row);
10551
- const rowRest = fullAllDataRowIdData[rowid] || {};
10552
- topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
10553
- // 是否展开行
10554
- if (expandColumn && rowExpandedMaps[rowid]) {
10555
- topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
10556
- }
10664
+ if (scrollYHeight > maxYHeight) {
10665
+ isScrollYBig = true;
10557
10666
  }
10558
10667
  }
10559
10668
  } else {
10560
10669
  if (bodyTableElem) {
10561
- ySpaceHeight = bodyTableElem.clientHeight;
10670
+ scrollYHeight = bodyTableElem.clientHeight;
10671
+ }
10672
+ }
10673
+ let clientHeight = 0;
10674
+ if (bodyScrollElem) {
10675
+ clientHeight = bodyScrollElem.clientHeight;
10676
+ }
10677
+ // 虚拟渲染
10678
+ let ySpaceHeight = scrollYHeight;
10679
+ let scrollYTop = ySpaceTop;
10680
+ if (isScrollYBig) {
10681
+ // 触底
10682
+ if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
10683
+ scrollYTop = maxYHeight - bodyTableElem.clientHeight;
10684
+ } else {
10685
+ scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
10562
10686
  }
10687
+ ySpaceHeight = maxYHeight;
10563
10688
  }
10564
10689
  containerList.forEach(name => {
10565
10690
  const layoutList = ['header', 'body', 'footer'];
10566
10691
  const tableElem = (0, _util.getRefElem)(elemStore[`${name}-body-table`]);
10567
10692
  if (tableElem) {
10568
- tableElem.style.marginTop = topSpaceHeight ? `${topSpaceHeight}px` : '';
10693
+ tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
10569
10694
  }
10570
10695
  layoutList.forEach(layout => {
10571
10696
  const ySpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-ySpace`]);
@@ -10582,6 +10707,9 @@ var _default = exports.default = (0, _vue.defineComponent)({
10582
10707
  if (rowExpandYSpaceEl) {
10583
10708
  rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
10584
10709
  }
10710
+ reactData.scrollYTop = scrollYTop;
10711
+ reactData.scrollYHeight = scrollYHeight;
10712
+ reactData.isScrollYBig = isScrollYBig;
10585
10713
  return (0, _vue.nextTick)().then(() => {
10586
10714
  updateStyle();
10587
10715
  });
@@ -11540,7 +11668,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
11540
11668
  if (rowOpts.height && !props.showOverflow) {
11541
11669
  (0, _log.warnLog)('vxe.error.notProp', ['table.show-overflow']);
11542
11670
  }
11543
- if (!$xeTable.handleMousedownCellAreaEvent) {
11671
+ if (!$xeTable.handleCellAreaMousedownEvent) {
11544
11672
  if (props.areaConfig) {
11545
11673
  (0, _log.warnLog)('vxe.error.notProp', ['area-config']);
11546
11674
  }
@@ -11556,7 +11684,7 @@ var _default = exports.default = (0, _vue.defineComponent)({
11556
11684
  }
11557
11685
  }
11558
11686
  if (treeConfig && rowOpts.drag && !treeOpts.transform) {
11559
- (0, _log.warnLog)('vxe.error.notSupportProp', ['column-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
11687
+ (0, _log.errLog)('vxe.error.notSupportProp', ['column-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
11560
11688
  }
11561
11689
  if (props.dragConfig) {
11562
11690
  (0, _log.warnLog)('vxe.error.delProp', ['drag-config', 'row-drag-config']);