vxe-table 4.11.15 → 4.12.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.
- package/README.md +4 -3
- package/es/grid/src/grid.js +20 -13
- package/es/style.css +1 -1
- package/es/table/module/edit/hook.js +3 -1
- package/es/table/src/table.js +272 -158
- package/es/ui/index.js +5 -5
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +20 -14
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +2170 -1954
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/hook.js +3 -1
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/src/table.js +282 -160
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +5 -5
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/grid/src/grid.ts +20 -13
- package/packages/table/module/edit/hook.ts +3 -1
- package/packages/table/src/table.ts +279 -161
- package/packages/ui/index.ts +4 -4
- /package/es/{iconfont.1740723830079.ttf → iconfont.1740732137800.ttf} +0 -0
- /package/es/{iconfont.1740723830079.woff → iconfont.1740732137800.woff} +0 -0
- /package/es/{iconfont.1740723830079.woff2 → iconfont.1740732137800.woff2} +0 -0
- /package/lib/{iconfont.1740723830079.ttf → iconfont.1740732137800.ttf} +0 -0
- /package/lib/{iconfont.1740723830079.woff → iconfont.1740732137800.woff} +0 -0
- /package/lib/{iconfont.1740723830079.woff2 → iconfont.1740732137800.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -19,6 +19,8 @@ import TableExportPanelComponent from '../module/export/export-panel';
|
|
|
19
19
|
import TableMenuPanelComponent from '../module/menu/panel';
|
|
20
20
|
const { getConfig, getIcon, getI18n, renderer, formats, createEvent, globalResize, interceptor, hooks, globalEvents, GLOBAL_EVENT_KEYS, useFns, renderEmptyElement } = VxeUI;
|
|
21
21
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
22
|
+
const maxYHeight = 5e6;
|
|
23
|
+
const maxXWidth = 5e6;
|
|
22
24
|
export default defineComponent({
|
|
23
25
|
name: 'VxeTable',
|
|
24
26
|
props: tableProps,
|
|
@@ -840,27 +842,42 @@ export default defineComponent({
|
|
|
840
842
|
return reserveList;
|
|
841
843
|
};
|
|
842
844
|
const handleVirtualXVisible = () => {
|
|
843
|
-
const {
|
|
845
|
+
const { isScrollXBig, scrollXWidth } = reactData;
|
|
846
|
+
const { elemStore, visibleColumn, fullColumnIdData } = internalData;
|
|
844
847
|
const leftFixedWidth = computeLeftFixedWidth.value;
|
|
845
848
|
const rightFixedWidth = computeRightFixedWidth.value;
|
|
846
849
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
847
850
|
if (bodyScrollElem) {
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
851
|
+
const clientWidth = bodyScrollElem.clientWidth;
|
|
852
|
+
let scrollLeft = bodyScrollElem.scrollLeft;
|
|
853
|
+
if (isScrollXBig) {
|
|
854
|
+
scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, (scrollLeft / (maxXWidth - clientWidth))));
|
|
855
|
+
}
|
|
856
|
+
const startLeft = scrollLeft + leftFixedWidth;
|
|
857
|
+
const endLeft = scrollLeft + clientWidth - rightFixedWidth;
|
|
858
|
+
let leftIndex = 0;
|
|
859
|
+
let rightIndex = visibleColumn.length;
|
|
860
|
+
while (leftIndex < rightIndex) {
|
|
861
|
+
const cIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
862
|
+
const column = visibleColumn[cIndex];
|
|
863
|
+
const colid = column.id;
|
|
864
|
+
const colRest = fullColumnIdData[colid] || {};
|
|
865
|
+
if (colRest.oLeft <= startLeft) {
|
|
866
|
+
leftIndex = cIndex + 1;
|
|
858
867
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
868
|
+
else {
|
|
869
|
+
rightIndex = cIndex;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
let visibleSize = 0;
|
|
873
|
+
const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
|
|
874
|
+
for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
|
|
875
|
+
const column = visibleColumn[cIndex];
|
|
876
|
+
const colid = column.id;
|
|
877
|
+
const colRest = fullColumnIdData[colid] || {};
|
|
878
|
+
visibleSize++;
|
|
879
|
+
if (colRest.oLeft > endLeft || visibleSize >= 60) {
|
|
880
|
+
break;
|
|
864
881
|
}
|
|
865
882
|
}
|
|
866
883
|
return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) };
|
|
@@ -902,44 +919,51 @@ export default defineComponent({
|
|
|
902
919
|
// 最低支持 18px 行高
|
|
903
920
|
return Math.max(18, rowHeight);
|
|
904
921
|
};
|
|
905
|
-
const handleVirtualYVisible = (
|
|
906
|
-
const { isAllOverflow, expandColumn,
|
|
922
|
+
const handleVirtualYVisible = () => {
|
|
923
|
+
const { isAllOverflow, expandColumn, isScrollYBig, scrollYHeight } = reactData;
|
|
907
924
|
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
908
|
-
const expandOpts = computeExpandOpts.value;
|
|
909
925
|
const rowOpts = computeRowOpts.value;
|
|
910
926
|
const cellOpts = computeCellOpts.value;
|
|
911
927
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
912
928
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
913
929
|
if (bodyScrollElem) {
|
|
914
930
|
const clientHeight = bodyScrollElem.clientHeight;
|
|
915
|
-
|
|
916
|
-
|
|
931
|
+
let scrollTop = bodyScrollElem.scrollTop;
|
|
932
|
+
if (isScrollYBig) {
|
|
933
|
+
scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, (scrollTop / (maxYHeight - clientHeight))));
|
|
934
|
+
}
|
|
935
|
+
const startTop = scrollTop;
|
|
936
|
+
const endTop = scrollTop + clientHeight;
|
|
917
937
|
let toVisibleIndex = -1;
|
|
918
|
-
let offsetTop = 0;
|
|
919
938
|
let visibleSize = 0;
|
|
920
939
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
921
940
|
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
922
|
-
toVisibleIndex = Math.floor(
|
|
941
|
+
toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
|
|
923
942
|
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
924
943
|
}
|
|
925
944
|
else {
|
|
926
|
-
|
|
945
|
+
let leftIndex = 0;
|
|
946
|
+
let rightIndex = afterFullData.length;
|
|
947
|
+
while (leftIndex < rightIndex) {
|
|
948
|
+
const rIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
927
949
|
const row = afterFullData[rIndex];
|
|
928
950
|
const rowid = getRowid($xeTable, row);
|
|
929
951
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
toVisibleIndex = rIndex;
|
|
933
|
-
}
|
|
934
|
-
if (toVisibleIndex >= 0) {
|
|
935
|
-
visibleSize++;
|
|
936
|
-
if (offsetTop > endHeight) {
|
|
937
|
-
break;
|
|
938
|
-
}
|
|
952
|
+
if (rowRest.oTop <= startTop) {
|
|
953
|
+
leftIndex = rIndex + 1;
|
|
939
954
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
955
|
+
else {
|
|
956
|
+
rightIndex = rIndex;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
|
|
960
|
+
for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
961
|
+
const row = afterFullData[rIndex];
|
|
962
|
+
const rowid = getRowid($xeTable, row);
|
|
963
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
964
|
+
visibleSize++;
|
|
965
|
+
if (rowRest.oTop > endTop || visibleSize >= 100) {
|
|
966
|
+
break;
|
|
943
967
|
}
|
|
944
968
|
}
|
|
945
969
|
}
|
|
@@ -1318,7 +1342,7 @@ export default defineComponent({
|
|
|
1318
1342
|
if (!xHandleEl) {
|
|
1319
1343
|
return;
|
|
1320
1344
|
}
|
|
1321
|
-
let
|
|
1345
|
+
let tWidth = 0;
|
|
1322
1346
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
1323
1347
|
const bodyWidth = bodyElem.clientWidth;
|
|
1324
1348
|
let remainWidth = bodyWidth;
|
|
@@ -1329,51 +1353,51 @@ export default defineComponent({
|
|
|
1329
1353
|
// 最小宽
|
|
1330
1354
|
pxMinList.forEach((column) => {
|
|
1331
1355
|
const minWidth = XEUtils.toInteger(column.minWidth);
|
|
1332
|
-
|
|
1356
|
+
tWidth += minWidth;
|
|
1333
1357
|
column.renderWidth = minWidth;
|
|
1334
1358
|
});
|
|
1335
1359
|
// 最小自适应
|
|
1336
1360
|
autoMinList.forEach((column) => {
|
|
1337
1361
|
const caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1338
|
-
|
|
1362
|
+
tWidth += caWidth;
|
|
1339
1363
|
column.renderWidth = caWidth;
|
|
1340
1364
|
});
|
|
1341
1365
|
// 最小百分比
|
|
1342
1366
|
scaleMinList.forEach((column) => {
|
|
1343
1367
|
const smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
1344
|
-
|
|
1368
|
+
tWidth += smWidth;
|
|
1345
1369
|
column.renderWidth = smWidth;
|
|
1346
1370
|
});
|
|
1347
1371
|
// 固定百分比
|
|
1348
1372
|
scaleList.forEach((column) => {
|
|
1349
1373
|
const sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
1350
|
-
|
|
1374
|
+
tWidth += sfWidth;
|
|
1351
1375
|
column.renderWidth = sfWidth;
|
|
1352
1376
|
});
|
|
1353
1377
|
// 固定宽
|
|
1354
1378
|
pxList.forEach((column) => {
|
|
1355
1379
|
const pWidth = XEUtils.toInteger(column.width);
|
|
1356
|
-
|
|
1380
|
+
tWidth += pWidth;
|
|
1357
1381
|
column.renderWidth = pWidth;
|
|
1358
1382
|
});
|
|
1359
1383
|
// 自适应宽
|
|
1360
1384
|
autoList.forEach((column) => {
|
|
1361
1385
|
const aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1362
|
-
|
|
1386
|
+
tWidth += aWidth;
|
|
1363
1387
|
column.renderWidth = aWidth;
|
|
1364
1388
|
});
|
|
1365
1389
|
// 调整了列宽
|
|
1366
1390
|
resizeList.forEach((column) => {
|
|
1367
1391
|
const reWidth = XEUtils.toInteger(column.resizeWidth);
|
|
1368
|
-
|
|
1392
|
+
tWidth += reWidth;
|
|
1369
1393
|
column.renderWidth = reWidth;
|
|
1370
1394
|
});
|
|
1371
|
-
remainWidth -=
|
|
1395
|
+
remainWidth -= tWidth;
|
|
1372
1396
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
1373
1397
|
if (fit) {
|
|
1374
1398
|
if (remainWidth > 0) {
|
|
1375
1399
|
scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
|
|
1376
|
-
|
|
1400
|
+
tWidth += meanWidth;
|
|
1377
1401
|
column.renderWidth += meanWidth;
|
|
1378
1402
|
});
|
|
1379
1403
|
}
|
|
@@ -1385,7 +1409,7 @@ export default defineComponent({
|
|
|
1385
1409
|
remainList.forEach((column) => {
|
|
1386
1410
|
const width = Math.max(meanWidth, minCellWidth);
|
|
1387
1411
|
column.renderWidth = width;
|
|
1388
|
-
|
|
1412
|
+
tWidth += width;
|
|
1389
1413
|
});
|
|
1390
1414
|
if (fit) {
|
|
1391
1415
|
/**
|
|
@@ -1395,13 +1419,13 @@ export default defineComponent({
|
|
|
1395
1419
|
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
1396
1420
|
let dynamicSize = dynamicList.length - 1;
|
|
1397
1421
|
if (dynamicSize > 0) {
|
|
1398
|
-
let i = bodyWidth -
|
|
1422
|
+
let i = bodyWidth - tWidth;
|
|
1399
1423
|
if (i > 0) {
|
|
1400
1424
|
while (i > 0 && dynamicSize >= 0) {
|
|
1401
1425
|
i--;
|
|
1402
1426
|
dynamicList[dynamicSize--].renderWidth++;
|
|
1403
1427
|
}
|
|
1404
|
-
|
|
1428
|
+
tWidth = bodyWidth;
|
|
1405
1429
|
}
|
|
1406
1430
|
}
|
|
1407
1431
|
}
|
|
@@ -1409,17 +1433,18 @@ export default defineComponent({
|
|
|
1409
1433
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1410
1434
|
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
|
|
1411
1435
|
reactData.overflowY = overflowY;
|
|
1412
|
-
|
|
1436
|
+
reactData.scrollXWidth = tWidth;
|
|
1413
1437
|
internalData.tableHeight = tableHeight;
|
|
1414
1438
|
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
1415
1439
|
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
1416
1440
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1417
|
-
const overflowX =
|
|
1441
|
+
const overflowX = tWidth > bodyWidth;
|
|
1418
1442
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1419
1443
|
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
|
|
1420
1444
|
internalData.headerHeight = headerHeight;
|
|
1421
1445
|
internalData.footerHeight = footerHeight;
|
|
1422
1446
|
reactData.overflowX = overflowX;
|
|
1447
|
+
updateColumnOffsetLeft();
|
|
1423
1448
|
updateHeight();
|
|
1424
1449
|
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
1425
1450
|
if (overflowX) {
|
|
@@ -1721,8 +1746,8 @@ export default defineComponent({
|
|
|
1721
1746
|
};
|
|
1722
1747
|
const updateStyle = () => {
|
|
1723
1748
|
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
|
|
1724
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
1725
|
-
const { visibleColumn, fullColumnIdData, tableHeight,
|
|
1749
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
1750
|
+
const { visibleColumn, fullColumnIdData, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
|
|
1726
1751
|
const el = refElem.value;
|
|
1727
1752
|
if (!el) {
|
|
1728
1753
|
return;
|
|
@@ -1760,9 +1785,9 @@ export default defineComponent({
|
|
|
1760
1785
|
}
|
|
1761
1786
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
1762
1787
|
}
|
|
1788
|
+
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
1763
1789
|
const xLeftCornerEl = refScrollXLeftCornerElem.value;
|
|
1764
1790
|
const xRightCornerEl = refScrollXRightCornerElem.value;
|
|
1765
|
-
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
1766
1791
|
const scrollXVirtualEl = refScrollXVirtualElem.value;
|
|
1767
1792
|
if (scrollXVirtualEl) {
|
|
1768
1793
|
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
@@ -1852,7 +1877,7 @@ export default defineComponent({
|
|
|
1852
1877
|
if (fixedType) {
|
|
1853
1878
|
if (isGroup) {
|
|
1854
1879
|
if (wrapperElem) {
|
|
1855
|
-
wrapperElem.style.width =
|
|
1880
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
1856
1881
|
}
|
|
1857
1882
|
}
|
|
1858
1883
|
else {
|
|
@@ -1863,7 +1888,7 @@ export default defineComponent({
|
|
|
1863
1888
|
}
|
|
1864
1889
|
else {
|
|
1865
1890
|
if (wrapperElem) {
|
|
1866
|
-
wrapperElem.style.width =
|
|
1891
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
1867
1892
|
}
|
|
1868
1893
|
}
|
|
1869
1894
|
}
|
|
@@ -1941,7 +1966,7 @@ export default defineComponent({
|
|
|
1941
1966
|
}
|
|
1942
1967
|
else {
|
|
1943
1968
|
if (wrapperElem) {
|
|
1944
|
-
wrapperElem.style.width =
|
|
1969
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
1945
1970
|
}
|
|
1946
1971
|
}
|
|
1947
1972
|
}
|
|
@@ -1982,7 +2007,7 @@ export default defineComponent({
|
|
|
1982
2007
|
}
|
|
1983
2008
|
else {
|
|
1984
2009
|
if (wrapperElem) {
|
|
1985
|
-
wrapperElem.style.width =
|
|
2010
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
1986
2011
|
}
|
|
1987
2012
|
}
|
|
1988
2013
|
}
|
|
@@ -2598,6 +2623,9 @@ export default defineComponent({
|
|
|
2598
2623
|
calcCellWidth();
|
|
2599
2624
|
autoCellWidth();
|
|
2600
2625
|
updateStyle();
|
|
2626
|
+
if (reFull) {
|
|
2627
|
+
updateRowOffsetTop();
|
|
2628
|
+
}
|
|
2601
2629
|
updateRowExpandStyle();
|
|
2602
2630
|
return computeScrollLoad().then(() => {
|
|
2603
2631
|
if (reFull === true) {
|
|
@@ -2605,6 +2633,9 @@ export default defineComponent({
|
|
|
2605
2633
|
calcCellWidth();
|
|
2606
2634
|
autoCellWidth();
|
|
2607
2635
|
updateStyle();
|
|
2636
|
+
if (reFull) {
|
|
2637
|
+
updateRowOffsetTop();
|
|
2638
|
+
}
|
|
2608
2639
|
updateRowExpandStyle();
|
|
2609
2640
|
return computeScrollLoad();
|
|
2610
2641
|
}
|
|
@@ -2743,6 +2774,7 @@ export default defineComponent({
|
|
|
2743
2774
|
}
|
|
2744
2775
|
reactData.isRowLoading = false;
|
|
2745
2776
|
calcCellHeight();
|
|
2777
|
+
updateRowOffsetTop();
|
|
2746
2778
|
// 是否变更虚拟滚动
|
|
2747
2779
|
if (oldScrollYLoad === sYLoad) {
|
|
2748
2780
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
@@ -2803,16 +2835,16 @@ export default defineComponent({
|
|
|
2803
2835
|
cacheColumnMap();
|
|
2804
2836
|
};
|
|
2805
2837
|
const loadScrollXData = () => {
|
|
2806
|
-
const { mergeList, mergeFooterList } = reactData;
|
|
2838
|
+
const { mergeList, mergeFooterList, isScrollXBig } = reactData;
|
|
2807
2839
|
const { scrollXStore } = internalData;
|
|
2808
2840
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore;
|
|
2809
2841
|
const { toVisibleIndex, visibleSize } = handleVirtualXVisible();
|
|
2810
2842
|
const offsetItem = {
|
|
2811
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
2812
|
-
endIndex: toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
2843
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
2844
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
2813
2845
|
};
|
|
2814
|
-
scrollXStore.visibleStartIndex = toVisibleIndex;
|
|
2815
|
-
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
2846
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1;
|
|
2847
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
2816
2848
|
calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
|
|
2817
2849
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
2818
2850
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
@@ -2955,6 +2987,7 @@ export default defineComponent({
|
|
|
2955
2987
|
internalData.visibleColumn = visibleColumn;
|
|
2956
2988
|
handleTableColumn();
|
|
2957
2989
|
if (isReset) {
|
|
2990
|
+
updateColumnOffsetLeft();
|
|
2958
2991
|
return $xeTable.updateFooter().then(() => {
|
|
2959
2992
|
return $xeTable.recalculate();
|
|
2960
2993
|
}).then(() => {
|
|
@@ -3121,18 +3154,18 @@ export default defineComponent({
|
|
|
3121
3154
|
/**
|
|
3122
3155
|
* 纵向 Y 可视渲染处理
|
|
3123
3156
|
*/
|
|
3124
|
-
const loadScrollYData = (
|
|
3125
|
-
const { mergeList, isAllOverflow } = reactData;
|
|
3157
|
+
const loadScrollYData = () => {
|
|
3158
|
+
const { mergeList, isAllOverflow, isScrollYBig } = reactData;
|
|
3126
3159
|
const { scrollYStore } = internalData;
|
|
3127
3160
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore;
|
|
3128
3161
|
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
|
|
3129
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible(
|
|
3162
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible();
|
|
3130
3163
|
const offsetItem = {
|
|
3131
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
3132
|
-
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
3164
|
+
startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
3165
|
+
endIndex: isScrollYBig ? (toVisibleIndex + visibleSize) : (toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize)
|
|
3133
3166
|
};
|
|
3134
|
-
scrollYStore.visibleStartIndex = toVisibleIndex;
|
|
3135
|
-
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
3167
|
+
scrollYStore.visibleStartIndex = toVisibleIndex - 1;
|
|
3168
|
+
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
3136
3169
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
3137
3170
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
3138
3171
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
@@ -3228,6 +3261,7 @@ export default defineComponent({
|
|
|
3228
3261
|
$xeTable.updateScrollYSpace();
|
|
3229
3262
|
});
|
|
3230
3263
|
}
|
|
3264
|
+
updateRowExpandStyle();
|
|
3231
3265
|
$xeTable.updateCellAreas();
|
|
3232
3266
|
}, 200);
|
|
3233
3267
|
};
|
|
@@ -3314,48 +3348,75 @@ export default defineComponent({
|
|
|
3314
3348
|
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
3315
3349
|
});
|
|
3316
3350
|
};
|
|
3351
|
+
const updateColumnOffsetLeft = () => {
|
|
3352
|
+
const { visibleColumn, fullColumnIdData } = internalData;
|
|
3353
|
+
let offsetLeft = 0;
|
|
3354
|
+
for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
|
|
3355
|
+
const column = visibleColumn[cIndex];
|
|
3356
|
+
const colid = column.id;
|
|
3357
|
+
const colRest = fullColumnIdData[colid];
|
|
3358
|
+
colRest.oLeft = offsetLeft;
|
|
3359
|
+
offsetLeft += column.renderWidth;
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3362
|
+
const updateRowOffsetTop = () => {
|
|
3363
|
+
const { expandColumn, rowExpandedMaps } = reactData;
|
|
3364
|
+
const { afterFullData, fullAllDataRowIdData } = internalData;
|
|
3365
|
+
const expandOpts = computeExpandOpts.value;
|
|
3366
|
+
const rowOpts = computeRowOpts.value;
|
|
3367
|
+
const cellOpts = computeCellOpts.value;
|
|
3368
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
3369
|
+
let offsetTop = 0;
|
|
3370
|
+
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
3371
|
+
const row = afterFullData[rIndex];
|
|
3372
|
+
const rowid = getRowid($xeTable, row);
|
|
3373
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
3374
|
+
rowRest.oTop = offsetTop;
|
|
3375
|
+
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
3376
|
+
// 是否展开行
|
|
3377
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
3378
|
+
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3317
3382
|
const updateRowExpandStyle = () => {
|
|
3318
|
-
const { expandColumn, scrollYLoad,
|
|
3383
|
+
const { expandColumn, scrollYLoad, scrollYTop, isScrollYBig } = reactData;
|
|
3319
3384
|
const expandOpts = computeExpandOpts.value;
|
|
3320
3385
|
const rowOpts = computeRowOpts.value;
|
|
3321
3386
|
const cellOpts = computeCellOpts.value;
|
|
3322
3387
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
3323
3388
|
const { mode } = expandOpts;
|
|
3324
3389
|
if (expandColumn && mode === 'fixed') {
|
|
3325
|
-
const { elemStore,
|
|
3390
|
+
const { elemStore, fullAllDataRowIdData } = internalData;
|
|
3326
3391
|
const rowExpandEl = refRowExpandElem.value;
|
|
3327
3392
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
3328
3393
|
if (rowExpandEl && bodyScrollElem) {
|
|
3329
3394
|
let isUpdateHeight = false;
|
|
3330
|
-
if (scrollYLoad) {
|
|
3331
|
-
let offsetTop = 0;
|
|
3332
|
-
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
3333
|
-
const row = afterFullData[rIndex];
|
|
3334
|
-
const rowid = getRowid($xeTable, row);
|
|
3335
|
-
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
3336
|
-
rowRest.oTop = offsetTop;
|
|
3337
|
-
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
3338
|
-
// 是否展开行
|
|
3339
|
-
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
3340
|
-
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
3395
|
XEUtils.arrayEach(rowExpandEl.children, reEl => {
|
|
3345
3396
|
const expandEl = reEl;
|
|
3346
3397
|
const rowid = expandEl.getAttribute('rowid') || '';
|
|
3347
3398
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
3348
3399
|
if (rowRest) {
|
|
3349
3400
|
const expandHeight = expandEl.offsetHeight + 1;
|
|
3401
|
+
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
3402
|
+
let offsetTop = 0;
|
|
3350
3403
|
if (scrollYLoad) {
|
|
3351
|
-
|
|
3404
|
+
if (isScrollYBig && trEl) {
|
|
3405
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
3406
|
+
}
|
|
3407
|
+
else {
|
|
3408
|
+
offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
|
|
3409
|
+
}
|
|
3352
3410
|
}
|
|
3353
3411
|
else {
|
|
3354
|
-
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
3355
3412
|
if (trEl) {
|
|
3356
|
-
|
|
3413
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
3357
3414
|
}
|
|
3358
3415
|
}
|
|
3416
|
+
if (isScrollYBig) {
|
|
3417
|
+
offsetTop += scrollYTop;
|
|
3418
|
+
}
|
|
3419
|
+
expandEl.style.top = toCssUnit(offsetTop);
|
|
3359
3420
|
if (!isUpdateHeight) {
|
|
3360
3421
|
if (rowRest.expandHeight !== expandHeight) {
|
|
3361
3422
|
isUpdateHeight = true;
|
|
@@ -3366,6 +3427,9 @@ export default defineComponent({
|
|
|
3366
3427
|
});
|
|
3367
3428
|
if (isUpdateHeight) {
|
|
3368
3429
|
reactData.rowExpandHeightFlag++;
|
|
3430
|
+
nextTick(() => {
|
|
3431
|
+
updateRowOffsetTop();
|
|
3432
|
+
});
|
|
3369
3433
|
}
|
|
3370
3434
|
}
|
|
3371
3435
|
}
|
|
@@ -4283,6 +4347,7 @@ export default defineComponent({
|
|
|
4283
4347
|
}
|
|
4284
4348
|
}
|
|
4285
4349
|
return nextTick().then(() => {
|
|
4350
|
+
updateRowOffsetTop();
|
|
4286
4351
|
return { status };
|
|
4287
4352
|
});
|
|
4288
4353
|
},
|
|
@@ -5159,12 +5224,12 @@ export default defineComponent({
|
|
|
5159
5224
|
}
|
|
5160
5225
|
reactData.rowExpandedMaps = rExpandedMaps;
|
|
5161
5226
|
return Promise.all(lazyRests)
|
|
5162
|
-
.then(() =>
|
|
5227
|
+
.then(() => nextTick())
|
|
5228
|
+
.then(() => $xeTable.recalculate(true))
|
|
5163
5229
|
.then(() => {
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
}
|
|
5230
|
+
updateRowOffsetTop();
|
|
5231
|
+
updateRowExpandStyle();
|
|
5232
|
+
handleRowExpandScroll();
|
|
5168
5233
|
return $xeTable.updateCellAreas();
|
|
5169
5234
|
});
|
|
5170
5235
|
},
|
|
@@ -5191,16 +5256,21 @@ export default defineComponent({
|
|
|
5191
5256
|
const { tableFullData } = internalData;
|
|
5192
5257
|
const expandOpts = computeExpandOpts.value;
|
|
5193
5258
|
const { reserve } = expandOpts;
|
|
5194
|
-
const expList =
|
|
5259
|
+
const expList = $xeTable.getRowExpandRecords();
|
|
5195
5260
|
reactData.rowExpandedMaps = {};
|
|
5196
5261
|
if (reserve) {
|
|
5197
5262
|
tableFullData.forEach((row) => handleRowExpandReserve(row, false));
|
|
5198
5263
|
}
|
|
5199
5264
|
return nextTick().then(() => {
|
|
5200
5265
|
if (expList.length) {
|
|
5201
|
-
|
|
5266
|
+
return $xeTable.recalculate(true);
|
|
5202
5267
|
}
|
|
5203
|
-
}).then(() =>
|
|
5268
|
+
}).then(() => {
|
|
5269
|
+
updateRowOffsetTop();
|
|
5270
|
+
updateRowExpandStyle();
|
|
5271
|
+
handleRowExpandScroll();
|
|
5272
|
+
return $xeTable.updateCellAreas();
|
|
5273
|
+
});
|
|
5204
5274
|
},
|
|
5205
5275
|
clearRowExpandReserve() {
|
|
5206
5276
|
internalData.rowExpandedReserveRowMap = {};
|
|
@@ -6408,8 +6478,8 @@ export default defineComponent({
|
|
|
6408
6478
|
const wrapperRect = el.getBoundingClientRect();
|
|
6409
6479
|
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
6410
6480
|
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
6411
|
-
const
|
|
6412
|
-
const
|
|
6481
|
+
const tableWrapperWidth = el.clientWidth;
|
|
6482
|
+
const tableWrapperHeight = el.clientHeight;
|
|
6413
6483
|
if (trEl) {
|
|
6414
6484
|
const rdLineEl = refDragRowLineElem.value;
|
|
6415
6485
|
if (rdLineEl) {
|
|
@@ -6418,14 +6488,14 @@ export default defineComponent({
|
|
|
6418
6488
|
const trRect = trEl.getBoundingClientRect();
|
|
6419
6489
|
let trHeight = trEl.clientHeight;
|
|
6420
6490
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
6421
|
-
if (offsetTop + trHeight >
|
|
6422
|
-
trHeight =
|
|
6491
|
+
if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
|
|
6492
|
+
trHeight = tableWrapperHeight - offsetTop - osbHeight;
|
|
6423
6493
|
}
|
|
6424
6494
|
rdLineEl.style.display = 'block';
|
|
6425
6495
|
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
6426
6496
|
rdLineEl.style.top = `${offsetTop}px`;
|
|
6427
6497
|
rdLineEl.style.height = `${trHeight}px`;
|
|
6428
|
-
rdLineEl.style.width = `${
|
|
6498
|
+
rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
|
|
6429
6499
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
6430
6500
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
6431
6501
|
}
|
|
@@ -6452,7 +6522,7 @@ export default defineComponent({
|
|
|
6452
6522
|
thWidth -= startX - offsetLeft;
|
|
6453
6523
|
offsetLeft = startX;
|
|
6454
6524
|
}
|
|
6455
|
-
const endX =
|
|
6525
|
+
const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
|
|
6456
6526
|
if (offsetLeft + thWidth > endX) {
|
|
6457
6527
|
thWidth = endX - offsetLeft;
|
|
6458
6528
|
}
|
|
@@ -6464,7 +6534,7 @@ export default defineComponent({
|
|
|
6464
6534
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
6465
6535
|
}
|
|
6466
6536
|
else {
|
|
6467
|
-
cdLineEl.style.height = `${
|
|
6537
|
+
cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
|
|
6468
6538
|
}
|
|
6469
6539
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
6470
6540
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -6860,7 +6930,7 @@ export default defineComponent({
|
|
|
6860
6930
|
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
|
|
6861
6931
|
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
6862
6932
|
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
6863
|
-
const
|
|
6933
|
+
const tableWrapperWidth = tableEl.clientWidth;
|
|
6864
6934
|
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
6865
6935
|
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
6866
6936
|
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
@@ -6869,8 +6939,8 @@ export default defineComponent({
|
|
|
6869
6939
|
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
6870
6940
|
resizeTipLeft = 0;
|
|
6871
6941
|
}
|
|
6872
|
-
else if (resizeBarLeft >
|
|
6873
|
-
resizeTipLeft +=
|
|
6942
|
+
else if (resizeBarLeft > tableWrapperWidth) {
|
|
6943
|
+
resizeTipLeft += tableWrapperWidth - resizeBarLeft;
|
|
6874
6944
|
}
|
|
6875
6945
|
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
6876
6946
|
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
@@ -7002,7 +7072,7 @@ export default defineComponent({
|
|
|
7002
7072
|
const updateEvent = (evnt) => {
|
|
7003
7073
|
evnt.stopPropagation();
|
|
7004
7074
|
evnt.preventDefault();
|
|
7005
|
-
const
|
|
7075
|
+
const rtWidth = tableEl.clientWidth - osbWidth;
|
|
7006
7076
|
const tableHeight = tableEl.clientHeight - osbHeight;
|
|
7007
7077
|
let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
|
|
7008
7078
|
if (dragTop < minTop) {
|
|
@@ -7013,15 +7083,15 @@ export default defineComponent({
|
|
|
7013
7083
|
}
|
|
7014
7084
|
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
7015
7085
|
resizeBarElem.style.top = `${dragTop}px`;
|
|
7016
|
-
resizeBarElem.style.width = `${
|
|
7086
|
+
resizeBarElem.style.width = `${rtWidth}px`;
|
|
7017
7087
|
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
7018
7088
|
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
|
|
7019
7089
|
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
7020
7090
|
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
7021
7091
|
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
|
|
7022
7092
|
let resizeBarTop = 0;
|
|
7023
|
-
if (resizeBarLeft + resizeTipWidth >=
|
|
7024
|
-
resizeBarLeft =
|
|
7093
|
+
if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
|
|
7094
|
+
resizeBarLeft = rtWidth - resizeTipWidth - 2;
|
|
7025
7095
|
}
|
|
7026
7096
|
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
7027
7097
|
resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
|
|
@@ -7052,6 +7122,7 @@ export default defineComponent({
|
|
|
7052
7122
|
else {
|
|
7053
7123
|
rowRest.resizeHeight = resizeHeight;
|
|
7054
7124
|
handleUpdateRowResize(evnt, resizeParams);
|
|
7125
|
+
updateRowOffsetTop();
|
|
7055
7126
|
}
|
|
7056
7127
|
}
|
|
7057
7128
|
removeClass(tableEl, 'row-drag--resize');
|
|
@@ -8491,22 +8562,22 @@ export default defineComponent({
|
|
|
8491
8562
|
const scrollTargetEl = xHandleEl || tableBodyElem;
|
|
8492
8563
|
if (scrollTargetEl) {
|
|
8493
8564
|
const wrapperRect = el.getBoundingClientRect();
|
|
8494
|
-
const
|
|
8565
|
+
const tableWrapperWidth = el.clientWidth;
|
|
8495
8566
|
const leftContainerElem = refLeftContainer.value;
|
|
8496
8567
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
8497
8568
|
const rightContainerElem = refRightContainer.value;
|
|
8498
8569
|
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
8499
8570
|
const srartX = wrapperRect.x + leftContainerWidth;
|
|
8500
|
-
const endX = wrapperRect.x +
|
|
8571
|
+
const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
|
|
8501
8572
|
const distSize = 28;
|
|
8502
8573
|
const startDistSize = clientX - srartX;
|
|
8503
8574
|
const endDistSize = endX - clientX;
|
|
8504
8575
|
if (startDistSize > 0 && startDistSize <= distSize) {
|
|
8505
|
-
const scrollRatio = Math.floor(
|
|
8576
|
+
const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
|
|
8506
8577
|
scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
|
|
8507
8578
|
}
|
|
8508
8579
|
else if (endDistSize > 0 && endDistSize <= distSize) {
|
|
8509
|
-
const scrollRatio = Math.floor(
|
|
8580
|
+
const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
|
|
8510
8581
|
scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
|
|
8511
8582
|
}
|
|
8512
8583
|
}
|
|
@@ -9001,43 +9072,66 @@ export default defineComponent({
|
|
|
9001
9072
|
updateScrollYStatus,
|
|
9002
9073
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
9003
9074
|
updateScrollXSpace() {
|
|
9004
|
-
const { isGroup, scrollXLoad, overflowX } = reactData;
|
|
9005
|
-
const { visibleColumn, scrollXStore, elemStore,
|
|
9006
|
-
const tableHeader = refTableHeader.value;
|
|
9075
|
+
const { isGroup, scrollXLoad, overflowX, scrollXWidth } = reactData;
|
|
9076
|
+
const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData;
|
|
9007
9077
|
const tableBody = refTableBody.value;
|
|
9008
|
-
const tableFooter = refTableFooter.value;
|
|
9009
9078
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
9010
9079
|
if (tableBodyElem) {
|
|
9011
|
-
const
|
|
9012
|
-
const
|
|
9013
|
-
const
|
|
9014
|
-
const
|
|
9015
|
-
|
|
9016
|
-
const
|
|
9080
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
9081
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
9082
|
+
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
9083
|
+
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
9084
|
+
let xSpaceLeft = 0;
|
|
9085
|
+
const firstColumn = visibleColumn[scrollXStore.startIndex];
|
|
9086
|
+
if (firstColumn) {
|
|
9087
|
+
const colRest = fullColumnIdData[firstColumn.id] || {};
|
|
9088
|
+
xSpaceLeft = colRest.oLeft;
|
|
9089
|
+
}
|
|
9090
|
+
let clientWidth = 0;
|
|
9091
|
+
if (bodyScrollElem) {
|
|
9092
|
+
clientWidth = bodyScrollElem.clientWidth;
|
|
9093
|
+
}
|
|
9094
|
+
// 虚拟渲染
|
|
9095
|
+
let isScrollXBig = false;
|
|
9096
|
+
let ySpaceWidth = scrollXWidth;
|
|
9097
|
+
if (scrollXWidth > maxXWidth) {
|
|
9098
|
+
// 触右
|
|
9099
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
|
|
9100
|
+
xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
|
|
9101
|
+
}
|
|
9102
|
+
else {
|
|
9103
|
+
xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
|
|
9104
|
+
}
|
|
9105
|
+
ySpaceWidth = maxXWidth;
|
|
9106
|
+
isScrollXBig = true;
|
|
9107
|
+
}
|
|
9017
9108
|
let marginLeft = '';
|
|
9018
9109
|
if (scrollXLoad && overflowX) {
|
|
9019
|
-
marginLeft = `${
|
|
9110
|
+
marginLeft = `${xSpaceLeft}px`;
|
|
9020
9111
|
}
|
|
9021
|
-
if (
|
|
9022
|
-
|
|
9112
|
+
if (headerTableElem) {
|
|
9113
|
+
headerTableElem.style.marginLeft = isGroup ? '' : marginLeft;
|
|
9023
9114
|
}
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9115
|
+
if (bodyTableElem) {
|
|
9116
|
+
bodyTableElem.style.marginLeft = marginLeft;
|
|
9117
|
+
}
|
|
9118
|
+
if (footerTableElem) {
|
|
9119
|
+
footerTableElem.style.marginLeft = marginLeft;
|
|
9027
9120
|
}
|
|
9121
|
+
reactData.isScrollXBig = isScrollXBig;
|
|
9028
9122
|
const containerList = ['main'];
|
|
9029
9123
|
containerList.forEach(name => {
|
|
9030
9124
|
const layoutList = ['header', 'body', 'footer'];
|
|
9031
9125
|
layoutList.forEach(layout => {
|
|
9032
9126
|
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
|
|
9033
9127
|
if (xSpaceElem) {
|
|
9034
|
-
xSpaceElem.style.width = scrollXLoad ? `${
|
|
9128
|
+
xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
|
|
9035
9129
|
}
|
|
9036
9130
|
});
|
|
9037
9131
|
});
|
|
9038
9132
|
const scrollXSpaceEl = refScrollXSpaceElem.value;
|
|
9039
9133
|
if (scrollXSpaceEl) {
|
|
9040
|
-
scrollXSpaceEl.style.width = `${
|
|
9134
|
+
scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
|
|
9041
9135
|
}
|
|
9042
9136
|
nextTick(() => {
|
|
9043
9137
|
updateStyle();
|
|
@@ -9053,49 +9147,66 @@ export default defineComponent({
|
|
|
9053
9147
|
const rowOpts = computeRowOpts.value;
|
|
9054
9148
|
const cellOpts = computeCellOpts.value;
|
|
9055
9149
|
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
9150
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
9056
9151
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
9057
9152
|
const containerList = ['main', 'left', 'right'];
|
|
9058
|
-
let
|
|
9059
|
-
let
|
|
9153
|
+
let ySpaceTop = 0;
|
|
9154
|
+
let scrollYHeight = 0;
|
|
9155
|
+
let isScrollYBig = false;
|
|
9060
9156
|
if (scrollYLoad) {
|
|
9061
9157
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
9062
9158
|
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
9063
|
-
|
|
9064
|
-
|
|
9159
|
+
scrollYHeight = afterFullData.length * defaultRowHeight;
|
|
9160
|
+
if (scrollYHeight > maxYHeight) {
|
|
9161
|
+
isScrollYBig = true;
|
|
9162
|
+
}
|
|
9163
|
+
ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
|
|
9065
9164
|
}
|
|
9066
9165
|
else {
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9166
|
+
const firstRow = afterFullData[startIndex];
|
|
9167
|
+
let rowid = getRowid($xeTable, firstRow);
|
|
9168
|
+
let rowRest = fullAllDataRowIdData[rowid] || {};
|
|
9169
|
+
ySpaceTop = rowRest.oTop;
|
|
9170
|
+
const lastRow = afterFullData[afterFullData.length - 1];
|
|
9171
|
+
rowid = getRowid($xeTable, lastRow);
|
|
9172
|
+
rowRest = fullAllDataRowIdData[rowid] || {};
|
|
9173
|
+
scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
|
|
9174
|
+
// 是否展开行
|
|
9175
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
9176
|
+
scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
9076
9177
|
}
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
const rowid = getRowid($xeTable, row);
|
|
9080
|
-
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
9081
|
-
topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
9082
|
-
// 是否展开行
|
|
9083
|
-
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
9084
|
-
topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
9085
|
-
}
|
|
9178
|
+
if (scrollYHeight > maxYHeight) {
|
|
9179
|
+
isScrollYBig = true;
|
|
9086
9180
|
}
|
|
9087
9181
|
}
|
|
9088
9182
|
}
|
|
9089
9183
|
else {
|
|
9090
9184
|
if (bodyTableElem) {
|
|
9091
|
-
|
|
9185
|
+
scrollYHeight = bodyTableElem.clientHeight;
|
|
9186
|
+
}
|
|
9187
|
+
}
|
|
9188
|
+
let clientHeight = 0;
|
|
9189
|
+
if (bodyScrollElem) {
|
|
9190
|
+
clientHeight = bodyScrollElem.clientHeight;
|
|
9191
|
+
}
|
|
9192
|
+
// 虚拟渲染
|
|
9193
|
+
let ySpaceHeight = scrollYHeight;
|
|
9194
|
+
let scrollYTop = ySpaceTop;
|
|
9195
|
+
if (isScrollYBig) {
|
|
9196
|
+
// 触底
|
|
9197
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
|
|
9198
|
+
scrollYTop = maxYHeight - bodyTableElem.clientHeight;
|
|
9199
|
+
}
|
|
9200
|
+
else {
|
|
9201
|
+
scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
|
|
9092
9202
|
}
|
|
9203
|
+
ySpaceHeight = maxYHeight;
|
|
9093
9204
|
}
|
|
9094
9205
|
containerList.forEach(name => {
|
|
9095
9206
|
const layoutList = ['header', 'body', 'footer'];
|
|
9096
9207
|
const tableElem = getRefElem(elemStore[`${name}-body-table`]);
|
|
9097
9208
|
if (tableElem) {
|
|
9098
|
-
tableElem.style.marginTop =
|
|
9209
|
+
tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
|
|
9099
9210
|
}
|
|
9100
9211
|
layoutList.forEach(layout => {
|
|
9101
9212
|
const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
|
|
@@ -9112,6 +9223,9 @@ export default defineComponent({
|
|
|
9112
9223
|
if (rowExpandYSpaceEl) {
|
|
9113
9224
|
rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
9114
9225
|
}
|
|
9226
|
+
reactData.scrollYTop = scrollYTop;
|
|
9227
|
+
reactData.scrollYHeight = scrollYHeight;
|
|
9228
|
+
reactData.isScrollYBig = isScrollYBig;
|
|
9115
9229
|
return nextTick().then(() => {
|
|
9116
9230
|
updateStyle();
|
|
9117
9231
|
});
|
|
@@ -10073,7 +10187,7 @@ export default defineComponent({
|
|
|
10073
10187
|
}
|
|
10074
10188
|
}
|
|
10075
10189
|
if (treeConfig && rowOpts.drag && !treeOpts.transform) {
|
|
10076
|
-
|
|
10190
|
+
errLog('vxe.error.notSupportProp', ['column-config.drag', 'tree-config.transform=false', 'tree-config.transform=true']);
|
|
10077
10191
|
}
|
|
10078
10192
|
if (props.dragConfig) {
|
|
10079
10193
|
warnLog('vxe.error.delProp', ['drag-config', 'row-drag-config']);
|