vxe-table 3.13.14 → 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 (131) hide show
  1. package/es/grid/src/grid.js +41 -31
  2. package/es/locale/lang/ar-EG.js +1 -0
  3. package/es/locale/lang/de-DE.js +1 -0
  4. package/es/locale/lang/en-US.js +3 -2
  5. package/es/locale/lang/es-ES.js +1 -0
  6. package/es/locale/lang/fr-FR.js +1 -0
  7. package/es/locale/lang/hu-HU.js +1 -0
  8. package/es/locale/lang/hy-AM.js +1 -0
  9. package/es/locale/lang/id-ID.js +1 -0
  10. package/es/locale/lang/it-IT.js +1 -0
  11. package/es/locale/lang/ja-JP.js +1 -0
  12. package/es/locale/lang/ko-KR.js +1 -0
  13. package/es/locale/lang/nb-NO.js +1 -0
  14. package/es/locale/lang/pt-BR.js +1 -0
  15. package/es/locale/lang/ru-RU.js +1 -0
  16. package/es/locale/lang/th-TH.js +1 -0
  17. package/es/locale/lang/ug-CN.js +1 -0
  18. package/es/locale/lang/uk-UA.js +1 -0
  19. package/es/locale/lang/vi-VN.js +1 -0
  20. package/es/locale/lang/zh-CHT.js +1 -0
  21. package/es/locale/lang/zh-CN.js +1 -0
  22. package/es/style.css +1 -1
  23. package/es/table/module/custom/panel.js +18 -16
  24. package/es/table/module/edit/mixin.js +3 -1
  25. package/es/table/src/cell.js +2 -1
  26. package/es/table/src/methods.js +297 -178
  27. package/es/table/src/table.js +170 -165
  28. package/es/ui/index.js +1 -1
  29. package/es/ui/src/log.js +1 -1
  30. package/lib/grid/src/grid.js +41 -32
  31. package/lib/grid/src/grid.min.js +1 -1
  32. package/lib/index.umd.js +1743 -2683
  33. package/lib/index.umd.min.js +1 -1
  34. package/lib/locale/lang/ar-EG.js +1 -0
  35. package/lib/locale/lang/ar-EG.min.js +1 -1
  36. package/lib/locale/lang/de-DE.js +1 -0
  37. package/lib/locale/lang/de-DE.min.js +1 -1
  38. package/lib/locale/lang/en-US.js +3 -2
  39. package/lib/locale/lang/en-US.min.js +1 -1
  40. package/lib/locale/lang/en-US.umd.js +3 -2
  41. package/lib/locale/lang/es-ES.js +1 -0
  42. package/lib/locale/lang/es-ES.min.js +1 -1
  43. package/lib/locale/lang/es-ES.umd.js +1 -0
  44. package/lib/locale/lang/fr-FR.js +1 -0
  45. package/lib/locale/lang/fr-FR.min.js +1 -1
  46. package/lib/locale/lang/hu-HU.js +1 -0
  47. package/lib/locale/lang/hu-HU.min.js +1 -1
  48. package/lib/locale/lang/hu-HU.umd.js +1 -0
  49. package/lib/locale/lang/hy-AM.js +1 -0
  50. package/lib/locale/lang/hy-AM.min.js +1 -1
  51. package/lib/locale/lang/id-ID.js +1 -0
  52. package/lib/locale/lang/id-ID.min.js +1 -1
  53. package/lib/locale/lang/it-IT.js +1 -0
  54. package/lib/locale/lang/it-IT.min.js +1 -1
  55. package/lib/locale/lang/ja-JP.js +1 -0
  56. package/lib/locale/lang/ja-JP.min.js +1 -1
  57. package/lib/locale/lang/ja-JP.umd.js +1 -0
  58. package/lib/locale/lang/ko-KR.js +1 -0
  59. package/lib/locale/lang/ko-KR.min.js +1 -1
  60. package/lib/locale/lang/ko-KR.umd.js +1 -0
  61. package/lib/locale/lang/nb-NO.js +1 -0
  62. package/lib/locale/lang/nb-NO.min.js +1 -1
  63. package/lib/locale/lang/pt-BR.js +1 -0
  64. package/lib/locale/lang/pt-BR.min.js +1 -1
  65. package/lib/locale/lang/pt-BR.umd.js +1 -0
  66. package/lib/locale/lang/ru-RU.js +1 -0
  67. package/lib/locale/lang/ru-RU.min.js +1 -1
  68. package/lib/locale/lang/ru-RU.umd.js +1 -0
  69. package/lib/locale/lang/th-TH.js +1 -0
  70. package/lib/locale/lang/th-TH.min.js +1 -1
  71. package/lib/locale/lang/ug-CN.js +1 -0
  72. package/lib/locale/lang/ug-CN.min.js +1 -1
  73. package/lib/locale/lang/uk-UA.js +1 -0
  74. package/lib/locale/lang/uk-UA.min.js +1 -1
  75. package/lib/locale/lang/uk-UA.umd.js +1 -0
  76. package/lib/locale/lang/vi-VN.js +1 -0
  77. package/lib/locale/lang/vi-VN.min.js +1 -1
  78. package/lib/locale/lang/zh-CHT.js +1 -0
  79. package/lib/locale/lang/zh-CHT.min.js +1 -1
  80. package/lib/locale/lang/zh-CHT.umd.js +1 -0
  81. package/lib/locale/lang/zh-CN.js +1 -0
  82. package/lib/locale/lang/zh-CN.min.js +1 -1
  83. package/lib/locale/lang/zh-CN.umd.js +1 -0
  84. package/lib/style.css +1 -1
  85. package/lib/table/module/custom/panel.js +18 -16
  86. package/lib/table/module/custom/panel.min.js +1 -1
  87. package/lib/table/module/edit/mixin.js +3 -1
  88. package/lib/table/module/edit/mixin.min.js +1 -1
  89. package/lib/table/src/cell.js +2 -1
  90. package/lib/table/src/cell.min.js +1 -1
  91. package/lib/table/src/methods.js +312 -184
  92. package/lib/table/src/methods.min.js +1 -1
  93. package/lib/table/src/table.js +179 -180
  94. package/lib/table/src/table.min.js +1 -1
  95. package/lib/ui/index.js +1 -1
  96. package/lib/ui/index.min.js +1 -1
  97. package/lib/ui/src/log.js +1 -1
  98. package/lib/ui/src/log.min.js +1 -1
  99. package/package.json +2 -2
  100. package/packages/grid/src/grid.ts +41 -31
  101. package/packages/locale/lang/ar-EG.ts +1 -0
  102. package/packages/locale/lang/de-DE.ts +1 -0
  103. package/packages/locale/lang/en-US.ts +3 -2
  104. package/packages/locale/lang/es-ES.ts +1 -0
  105. package/packages/locale/lang/fr-FR.ts +1 -0
  106. package/packages/locale/lang/hu-HU.ts +1 -0
  107. package/packages/locale/lang/hy-AM.ts +1 -0
  108. package/packages/locale/lang/id-ID.ts +1 -0
  109. package/packages/locale/lang/it-IT.ts +1 -0
  110. package/packages/locale/lang/ja-JP.ts +1 -0
  111. package/packages/locale/lang/ko-KR.ts +1 -0
  112. package/packages/locale/lang/nb-NO.ts +1 -0
  113. package/packages/locale/lang/pt-BR.ts +1 -0
  114. package/packages/locale/lang/ru-RU.ts +1 -0
  115. package/packages/locale/lang/th-TH.ts +1 -0
  116. package/packages/locale/lang/ug-CN.ts +1 -0
  117. package/packages/locale/lang/uk-UA.ts +1 -0
  118. package/packages/locale/lang/vi-VN.ts +1 -0
  119. package/packages/locale/lang/zh-CHT.ts +1 -0
  120. package/packages/locale/lang/zh-CN.ts +1 -0
  121. package/packages/table/module/custom/panel.ts +22 -20
  122. package/packages/table/module/edit/mixin.ts +3 -1
  123. package/packages/table/src/cell.ts +2 -1
  124. package/packages/table/src/methods.ts +308 -182
  125. package/packages/table/src/table.ts +172 -165
  126. /package/es/{iconfont.1740640529071.ttf → iconfont.1740732119954.ttf} +0 -0
  127. /package/es/{iconfont.1740640529071.woff → iconfont.1740732119954.woff} +0 -0
  128. /package/es/{iconfont.1740640529071.woff2 → iconfont.1740732119954.woff2} +0 -0
  129. /package/lib/{iconfont.1740640529071.ttf → iconfont.1740732119954.ttf} +0 -0
  130. /package/lib/{iconfont.1740640529071.woff → iconfont.1740732119954.woff} +0 -0
  131. /package/lib/{iconfont.1740640529071.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');
@@ -7477,6 +7565,7 @@ const Methods = {
7477
7565
  const dragParams = {
7478
7566
  oldRow: dragRow,
7479
7567
  newRow: prevDragRow,
7568
+ dragRow,
7480
7569
  dragPos: prevDragPos,
7481
7570
  dragToChild: !!prevDragToChild,
7482
7571
  offsetIndex: dragOffsetIndex
@@ -7618,6 +7707,7 @@ const Methods = {
7618
7707
  $xeTable.dispatchEvent('row-dragend', {
7619
7708
  oldRow: dragRow,
7620
7709
  newRow: prevDragRow,
7710
+ dragRow,
7621
7711
  dragPos: prevDragPos,
7622
7712
  dragToChild: isDragToChildFlag,
7623
7713
  offsetIndex: dragOffsetIndex,
@@ -7819,11 +7909,12 @@ const Methods = {
7819
7909
  if (prevDragCol && dragCol) {
7820
7910
  // 判断是否有拖动
7821
7911
  if (prevDragCol !== dragCol) {
7822
- const oldColumn = dragCol;
7912
+ const dragColumn = dragCol;
7823
7913
  const newColumn = prevDragCol;
7824
7914
  const dragParams = {
7825
- oldColumn,
7915
+ oldColumn: dragColumn,
7826
7916
  newColumn,
7917
+ dragColumn,
7827
7918
  dragPos: prevDragPos,
7828
7919
  dragToChild: !!prevDragToChild,
7829
7920
  offsetIndex: dragOffsetIndex
@@ -7836,14 +7927,14 @@ const Methods = {
7836
7927
  let oafIndex = -1;
7837
7928
  let nafIndex = -1;
7838
7929
  const oldAllMaps = {};
7839
- _xeUtils.default.eachTree([oldColumn], column => {
7930
+ _xeUtils.default.eachTree([dragColumn], column => {
7840
7931
  oldAllMaps[column.id] = column;
7841
7932
  });
7842
7933
  let isSelfToChildStatus = false;
7843
- if (oldColumn.parentId && newColumn.parentId) {
7934
+ if (dragColumn.parentId && newColumn.parentId) {
7844
7935
  // 子到子
7845
7936
  if (isPeerDrag && !isCrossDrag) {
7846
- if (oldColumn.parentId !== newColumn.parentId) {
7937
+ if (dragColumn.parentId !== newColumn.parentId) {
7847
7938
  // 非同级
7848
7939
  return;
7849
7940
  }
@@ -7864,7 +7955,7 @@ const Methods = {
7864
7955
  }
7865
7956
  }
7866
7957
  }
7867
- } else if (oldColumn.parentId) {
7958
+ } else if (dragColumn.parentId) {
7868
7959
  // 子到根
7869
7960
  if (!isCrossDrag) {
7870
7961
  return;
@@ -7889,7 +7980,7 @@ const Methods = {
7889
7980
  } else {
7890
7981
  // 根到根
7891
7982
  }
7892
- const oldewMatchRest = _xeUtils.default.findTree(collectColumn, item => item.id === oldColumn.id);
7983
+ const oldewMatchRest = _xeUtils.default.findTree(collectColumn, item => item.id === dragColumn.id);
7893
7984
  // 改变层级
7894
7985
  if (isSelfToChildStatus && isCrossDrag && isSelfToChildDrag) {
7895
7986
  if (oldewMatchRest) {
@@ -7897,12 +7988,12 @@ const Methods = {
7897
7988
  items: oCols,
7898
7989
  index: oIndex
7899
7990
  } = oldewMatchRest;
7900
- const childList = oldColumn.children || [];
7991
+ const childList = dragColumn.children || [];
7901
7992
  childList.forEach(column => {
7902
- column.parentId = oldColumn.parentId;
7993
+ column.parentId = dragColumn.parentId;
7903
7994
  });
7904
7995
  oCols.splice(oIndex, 1, ...childList);
7905
- oldColumn.children = [];
7996
+ dragColumn.children = [];
7906
7997
  }
7907
7998
  } else {
7908
7999
  if (oldewMatchRest) {
@@ -7926,11 +8017,11 @@ const Methods = {
7926
8017
  } = newMatchRest;
7927
8018
  // 转子级
7928
8019
  if (isCrossDrag && isToChildDrag && isDragToChildFlag) {
7929
- oldColumn.parentId = newColumn.id;
7930
- newColumn.children = (newColumn.children || []).concat([oldColumn]);
8020
+ dragColumn.parentId = newColumn.id;
8021
+ newColumn.children = (newColumn.children || []).concat([dragColumn]);
7931
8022
  } else {
7932
- oldColumn.parentId = newColumn.parentId;
7933
- nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn);
8023
+ dragColumn.parentId = newColumn.parentId;
8024
+ nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
7934
8025
  }
7935
8026
  if (!nParent) {
7936
8027
  nafIndex = nIndex;
@@ -7953,8 +8044,9 @@ const Methods = {
7953
8044
  }
7954
8045
  }
7955
8046
  $xeTable.dispatchEvent('column-dragend', {
7956
- oldColumn,
8047
+ oldColumn: dragColumn,
7957
8048
  newColumn,
8049
+ dragColumn,
7958
8050
  dragPos: prevDragPos,
7959
8051
  dragToChild: isDragToChildFlag,
7960
8052
  offsetIndex: dragOffsetIndex,
@@ -8048,21 +8140,21 @@ const Methods = {
8048
8140
  const scrollTargetEl = xHandleEl || tableBodyElem;
8049
8141
  if (scrollTargetEl) {
8050
8142
  const wrapperRect = el.getBoundingClientRect();
8051
- const tableWidth = el.clientWidth;
8143
+ const tableWrapperWidth = el.clientWidth;
8052
8144
  const leftContainerElem = $xeTable.$refs.refLeftContainer;
8053
8145
  const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
8054
8146
  const rightContainerElem = $xeTable.$refs.refRightContainer;
8055
8147
  const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
8056
8148
  const srartX = wrapperRect.x + leftContainerWidth;
8057
- const endX = wrapperRect.x + tableWidth - rightContainerWidth;
8149
+ const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
8058
8150
  const distSize = 28;
8059
8151
  const startDistSize = clientX - srartX;
8060
8152
  const endDistSize = endX - clientX;
8061
8153
  if (startDistSize > 0 && startDistSize <= distSize) {
8062
- const scrollRatio = Math.floor(tableWidth / (startDistSize > distSize / 2 ? 240 : 120));
8154
+ const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
8063
8155
  scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
8064
8156
  } else if (endDistSize > 0 && endDistSize <= distSize) {
8065
- const scrollRatio = Math.floor(tableWidth / (endDistSize > distSize / 2 ? 240 : 120));
8157
+ const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
8066
8158
  scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
8067
8159
  }
8068
8160
  }
@@ -8670,15 +8762,14 @@ const Methods = {
8670
8762
  });
8671
8763
  }
8672
8764
  if (reserve) {
8673
- validRows.forEach(row => this.handleRowExpandReserve(row, expanded));
8765
+ validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
8674
8766
  }
8675
8767
  }
8676
8768
  this.rowExpandedMaps = rExpandedMaps;
8677
- return Promise.all(lazyRests).then(() => $xeTable.recalculate()).then(() => {
8678
- if (expandColumn) {
8679
- updateRowExpandStyle($xeTable);
8680
- handleRowExpandScroll($xeTable);
8681
- }
8769
+ return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => $xeTable.recalculate(true)).then(() => {
8770
+ updateRowOffsetTop($xeTable);
8771
+ updateRowExpandStyle($xeTable);
8772
+ handleRowExpandScroll($xeTable);
8682
8773
  return $xeTable.updateCellAreas();
8683
8774
  });
8684
8775
  },
@@ -8705,42 +8796,35 @@ const Methods = {
8705
8796
  */
8706
8797
  clearRowExpand() {
8707
8798
  const $xeTable = this;
8799
+ const reactData = $xeTable;
8800
+ const internalData = $xeTable;
8708
8801
  const {
8709
- expandOpts,
8710
8802
  tableFullData
8711
- } = this;
8803
+ } = internalData;
8804
+ const expandOpts = $xeTable.computeExpandOpts;
8712
8805
  const {
8713
8806
  reserve
8714
8807
  } = expandOpts;
8715
- const expList = this.getRowExpandRecords();
8716
- this.rowExpandedMaps = {};
8808
+ const expList = $xeTable.getRowExpandRecords();
8809
+ reactData.rowExpandedMaps = {};
8717
8810
  if (reserve) {
8718
- tableFullData.forEach(row => this.handleRowExpandReserve(row, false));
8811
+ tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
8719
8812
  }
8720
- return this.$nextTick().then(() => {
8813
+ return $xeTable.$nextTick().then(() => {
8721
8814
  if (expList.length) {
8722
- this.recalculate();
8815
+ return $xeTable.recalculate(true);
8723
8816
  }
8724
- }).then(() => $xeTable.updateCellAreas());
8817
+ }).then(() => {
8818
+ updateRowOffsetTop($xeTable);
8819
+ updateRowExpandStyle($xeTable);
8820
+ handleRowExpandScroll($xeTable);
8821
+ return $xeTable.updateCellAreas();
8822
+ });
8725
8823
  },
8726
8824
  clearRowExpandReserve() {
8727
8825
  this.rowExpandedReserveRowMap = {};
8728
8826
  return this.$nextTick();
8729
8827
  },
8730
- handleRowExpandReserve(row, expanded) {
8731
- const {
8732
- rowExpandedReserveRowMap,
8733
- expandOpts
8734
- } = this;
8735
- if (expandOpts.reserve) {
8736
- const rowid = (0, _util.getRowid)(this, row);
8737
- if (expanded) {
8738
- rowExpandedReserveRowMap[rowid] = row;
8739
- } else if (rowExpandedReserveRowMap[rowid]) {
8740
- delete rowExpandedReserveRowMap[rowid];
8741
- }
8742
- }
8743
- },
8744
8828
  getRowExpandRecords() {
8745
8829
  const rest = [];
8746
8830
  _xeUtils.default.each(this.rowExpandedMaps, item => {
@@ -9576,7 +9660,8 @@ const Methods = {
9576
9660
  const {
9577
9661
  target,
9578
9662
  deltaY,
9579
- deltaX
9663
+ deltaX,
9664
+ shiftKey
9580
9665
  } = evnt;
9581
9666
  if (target && /^textarea$/i.test(target.tagName)) {
9582
9667
  return;
@@ -9617,8 +9702,8 @@ const Methods = {
9617
9702
  return;
9618
9703
  }
9619
9704
  const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
9620
- const deltaTop = Math.ceil(deltaY * wheelSpeed);
9621
- const deltaLeft = Math.ceil(deltaX * wheelSpeed);
9705
+ const deltaTop = Math.ceil((shiftKey ? deltaX : deltaY) * wheelSpeed);
9706
+ const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
9622
9707
  const isTopWheel = deltaTop < 0;
9623
9708
  const currScrollTop = bodyScrollElem.scrollTop;
9624
9709
  // 如果滚动位置已经是顶部或底部,则不需要触发
@@ -9792,49 +9877,73 @@ const Methods = {
9792
9877
  const internalData = $xeTable;
9793
9878
  const {
9794
9879
  isGroup,
9795
- scrollXLoad
9880
+ scrollXLoad,
9881
+ overflowX,
9882
+ scrollXWidth
9796
9883
  } = reactData;
9797
9884
  const {
9798
9885
  visibleColumn,
9799
9886
  scrollXStore,
9800
9887
  elemStore,
9801
- tableWidth
9888
+ fullColumnIdData
9802
9889
  } = internalData;
9803
- const tableHeader = $xeTable.$refs.refTableHeader;
9804
9890
  const tableBody = $xeTable.$refs.refTableBody;
9805
- const tableFooter = $xeTable.$refs.refTableFooter;
9806
9891
  const tableBodyElem = tableBody ? tableBody.$el : null;
9807
9892
  if (tableBodyElem) {
9808
- const tableHeaderElem = tableHeader ? tableHeader.$el : null;
9809
- const tableFooterElem = tableFooter ? tableFooter.$el : null;
9810
- const headerElem = tableHeaderElem ? tableHeaderElem.querySelector('.vxe-table--header') : null;
9811
- const bodyElem = tableBodyElem.querySelector('.vxe-table--body');
9812
- const footerElem = tableFooterElem ? tableFooterElem.querySelector('.vxe-table--footer') : null;
9813
- 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
+ }
9814
9920
  let marginLeft = '';
9815
- if (scrollXLoad) {
9816
- marginLeft = `${leftSpaceWidth}px`;
9921
+ if (scrollXLoad && overflowX) {
9922
+ marginLeft = `${xSpaceLeft}px`;
9923
+ }
9924
+ if (headerTableElem) {
9925
+ headerTableElem.style.marginLeft = isGroup ? '' : marginLeft;
9817
9926
  }
9818
- if (headerElem) {
9819
- headerElem.style.marginLeft = isGroup ? '' : marginLeft;
9927
+ if (bodyTableElem) {
9928
+ bodyTableElem.style.marginLeft = marginLeft;
9820
9929
  }
9821
- bodyElem.style.marginLeft = marginLeft;
9822
- if (footerElem) {
9823
- footerElem.style.marginLeft = marginLeft;
9930
+ if (footerTableElem) {
9931
+ footerTableElem.style.marginLeft = marginLeft;
9824
9932
  }
9933
+ reactData.isScrollXBig = isScrollXBig;
9825
9934
  const containerList = ['main'];
9826
9935
  containerList.forEach(name => {
9827
9936
  const layoutList = ['header', 'body', 'footer'];
9828
9937
  layoutList.forEach(layout => {
9829
9938
  const xSpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-xSpace`]);
9830
9939
  if (xSpaceElem) {
9831
- xSpaceElem.style.width = scrollXLoad ? `${tableWidth}px` : '';
9940
+ xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
9832
9941
  }
9833
9942
  });
9834
9943
  });
9835
9944
  const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
9836
9945
  if (scrollXSpaceEl) {
9837
- scrollXSpaceEl.style.width = `${tableWidth}px`;
9946
+ scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
9838
9947
  }
9839
9948
  $xeTable.$nextTick(() => {
9840
9949
  updateStyle($xeTable);
@@ -9875,47 +9984,63 @@ const Methods = {
9875
9984
  const rowOpts = $xeTable.computeRowOpts;
9876
9985
  const cellOpts = $xeTable.computeCellOpts;
9877
9986
  const defaultRowHeight = $xeTable.computeDefaultRowHeight;
9987
+ const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
9878
9988
  const bodyTableElem = (0, _util.getRefElem)(elemStore['main-body-table']);
9879
9989
  const containerList = ['main', 'left', 'right'];
9880
- let topSpaceHeight = 0;
9881
- let ySpaceHeight = 0;
9990
+ let ySpaceTop = 0;
9991
+ let scrollYHeight = 0;
9992
+ let isScrollYBig = false;
9882
9993
  if (scrollYLoad) {
9883
9994
  const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
9884
9995
  if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
9885
- ySpaceHeight = afterFullData.length * defaultRowHeight;
9886
- 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);
9887
10001
  } else {
9888
- for (let i = 0; i < afterFullData.length; i++) {
9889
- const row = afterFullData[i];
9890
- const rowid = (0, _util.getRowid)($xeTable, row);
9891
- const rowRest = fullAllDataRowIdData[rowid] || {};
9892
- ySpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9893
- // 是否展开行
9894
- if (expandColumn && rowExpandedMaps[rowid]) {
9895
- ySpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
9896
- }
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;
9897
10013
  }
9898
- for (let i = 0; i < startIndex; i++) {
9899
- const row = afterFullData[i];
9900
- const rowid = (0, _util.getRowid)($xeTable, row);
9901
- const rowRest = fullAllDataRowIdData[rowid] || {};
9902
- topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
9903
- // 是否展开行
9904
- if (expandColumn && rowExpandedMaps[rowid]) {
9905
- topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
9906
- }
10014
+ if (scrollYHeight > maxYHeight) {
10015
+ isScrollYBig = true;
9907
10016
  }
9908
10017
  }
9909
10018
  } else {
9910
10019
  if (bodyTableElem) {
9911
- 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));
9912
10036
  }
10037
+ ySpaceHeight = maxYHeight;
9913
10038
  }
9914
10039
  containerList.forEach(name => {
9915
10040
  const layoutList = ['header', 'body', 'footer'];
9916
10041
  const tableElem = (0, _util.getRefElem)(elemStore[`${name}-body-table`]);
9917
10042
  if (tableElem) {
9918
- tableElem.style.marginTop = topSpaceHeight ? `${topSpaceHeight}px` : '';
10043
+ tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
9919
10044
  }
9920
10045
  layoutList.forEach(layout => {
9921
10046
  const ySpaceElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-ySpace`]);
@@ -9932,6 +10057,9 @@ const Methods = {
9932
10057
  if (rowExpandYSpaceEl) {
9933
10058
  rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
9934
10059
  }
10060
+ reactData.scrollYTop = scrollYTop;
10061
+ reactData.scrollYHeight = scrollYHeight;
10062
+ reactData.isScrollYBig = isScrollYBig;
9935
10063
  return $xeTable.$nextTick().then(() => {
9936
10064
  updateStyle($xeTable);
9937
10065
  });