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