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.
- package/es/grid/src/grid.js +41 -31
- package/es/locale/lang/ar-EG.js +1 -0
- package/es/locale/lang/de-DE.js +1 -0
- package/es/locale/lang/en-US.js +3 -2
- package/es/locale/lang/es-ES.js +1 -0
- package/es/locale/lang/fr-FR.js +1 -0
- package/es/locale/lang/hu-HU.js +1 -0
- package/es/locale/lang/hy-AM.js +1 -0
- package/es/locale/lang/id-ID.js +1 -0
- package/es/locale/lang/it-IT.js +1 -0
- package/es/locale/lang/ja-JP.js +1 -0
- package/es/locale/lang/ko-KR.js +1 -0
- package/es/locale/lang/nb-NO.js +1 -0
- package/es/locale/lang/pt-BR.js +1 -0
- package/es/locale/lang/ru-RU.js +1 -0
- package/es/locale/lang/th-TH.js +1 -0
- package/es/locale/lang/ug-CN.js +1 -0
- package/es/locale/lang/uk-UA.js +1 -0
- package/es/locale/lang/vi-VN.js +1 -0
- package/es/locale/lang/zh-CHT.js +1 -0
- package/es/locale/lang/zh-CN.js +1 -0
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +18 -16
- package/es/table/module/edit/mixin.js +3 -1
- package/es/table/src/cell.js +2 -1
- package/es/table/src/methods.js +297 -178
- package/es/table/src/table.js +170 -165
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +41 -32
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1743 -2683
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +1 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +1 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -2
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -2
- package/lib/locale/lang/es-ES.js +1 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +1 -0
- package/lib/locale/lang/fr-FR.js +1 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +1 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +1 -0
- package/lib/locale/lang/hy-AM.js +1 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +1 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +1 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +1 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +1 -0
- package/lib/locale/lang/ko-KR.js +1 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +1 -0
- package/lib/locale/lang/nb-NO.js +1 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +1 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +1 -0
- package/lib/locale/lang/ru-RU.js +1 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +1 -0
- package/lib/locale/lang/th-TH.js +1 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +1 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +1 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +1 -0
- package/lib/locale/lang/vi-VN.js +1 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +1 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +1 -0
- package/lib/locale/lang/zh-CN.js +1 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +1 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +18 -16
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +3 -1
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/cell.js +2 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +312 -184
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +179 -180
- package/lib/table/src/table.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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 +2 -2
- package/packages/grid/src/grid.ts +41 -31
- package/packages/locale/lang/ar-EG.ts +1 -0
- package/packages/locale/lang/de-DE.ts +1 -0
- package/packages/locale/lang/en-US.ts +3 -2
- package/packages/locale/lang/es-ES.ts +1 -0
- package/packages/locale/lang/fr-FR.ts +1 -0
- package/packages/locale/lang/hu-HU.ts +1 -0
- package/packages/locale/lang/hy-AM.ts +1 -0
- package/packages/locale/lang/id-ID.ts +1 -0
- package/packages/locale/lang/it-IT.ts +1 -0
- package/packages/locale/lang/ja-JP.ts +1 -0
- package/packages/locale/lang/ko-KR.ts +1 -0
- package/packages/locale/lang/nb-NO.ts +1 -0
- package/packages/locale/lang/pt-BR.ts +1 -0
- package/packages/locale/lang/ru-RU.ts +1 -0
- package/packages/locale/lang/th-TH.ts +1 -0
- package/packages/locale/lang/ug-CN.ts +1 -0
- package/packages/locale/lang/uk-UA.ts +1 -0
- package/packages/locale/lang/vi-VN.ts +1 -0
- package/packages/locale/lang/zh-CHT.ts +1 -0
- package/packages/locale/lang/zh-CN.ts +1 -0
- package/packages/table/module/custom/panel.ts +22 -20
- package/packages/table/module/edit/mixin.ts +3 -1
- package/packages/table/src/cell.ts +2 -1
- package/packages/table/src/methods.ts +308 -182
- package/packages/table/src/table.ts +172 -165
- /package/es/{iconfont.1740640529071.ttf → iconfont.1740732119954.ttf} +0 -0
- /package/es/{iconfont.1740640529071.woff → iconfont.1740732119954.woff} +0 -0
- /package/es/{iconfont.1740640529071.woff2 → iconfont.1740732119954.woff2} +0 -0
- /package/lib/{iconfont.1740640529071.ttf → iconfont.1740732119954.ttf} +0 -0
- /package/lib/{iconfont.1740640529071.woff → iconfont.1740732119954.woff} +0 -0
- /package/lib/{iconfont.1740640529071.woff2 → iconfont.1740732119954.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -8,6 +8,8 @@ import { getSlotVNs } from '../../ui/src/vn';
|
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
9
9
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
|
|
10
10
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
11
|
+
const maxYHeight = 5e6;
|
|
12
|
+
const maxXWidth = 5e6;
|
|
11
13
|
function eqCellValue(row1, row2, field) {
|
|
12
14
|
const val1 = XEUtils.get(row1, field);
|
|
13
15
|
const val2 = XEUtils.get(row2, field);
|
|
@@ -61,28 +63,44 @@ function handleReserveRow($xeTable, reserveRowMap) {
|
|
|
61
63
|
return reserveList;
|
|
62
64
|
}
|
|
63
65
|
function handleVirtualXVisible($xeTable) {
|
|
66
|
+
const reactData = $xeTable;
|
|
64
67
|
const internalData = $xeTable;
|
|
65
|
-
const {
|
|
68
|
+
const { isScrollXBig, scrollXWidth } = reactData;
|
|
69
|
+
const { elemStore, visibleColumn, fullColumnIdData } = internalData;
|
|
66
70
|
const leftFixedWidth = $xeTable.computeLeftFixedWidth;
|
|
67
71
|
const rightFixedWidth = $xeTable.computeRightFixedWidth;
|
|
68
72
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
69
73
|
if (bodyScrollElem) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const clientWidth = bodyScrollElem.clientWidth;
|
|
75
|
+
let scrollLeft = bodyScrollElem.scrollLeft;
|
|
76
|
+
if (isScrollXBig) {
|
|
77
|
+
scrollLeft = Math.ceil((scrollXWidth - clientWidth) * Math.min(1, (scrollLeft / (maxXWidth - clientWidth))));
|
|
78
|
+
}
|
|
79
|
+
const startLeft = scrollLeft + leftFixedWidth;
|
|
80
|
+
const endLeft = scrollLeft + clientWidth - rightFixedWidth;
|
|
81
|
+
let leftIndex = 0;
|
|
82
|
+
let rightIndex = visibleColumn.length;
|
|
83
|
+
while (leftIndex < rightIndex) {
|
|
84
|
+
const cIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
85
|
+
const column = visibleColumn[cIndex];
|
|
86
|
+
const colid = column.id;
|
|
87
|
+
const colRest = fullColumnIdData[colid] || {};
|
|
88
|
+
if (colRest.oLeft <= startLeft) {
|
|
89
|
+
leftIndex = cIndex + 1;
|
|
80
90
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
else {
|
|
92
|
+
rightIndex = cIndex;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
let visibleSize = 0;
|
|
96
|
+
const toVisibleIndex = Math.max(0, leftIndex < visibleColumn.length ? leftIndex - 2 : 0);
|
|
97
|
+
for (let cIndex = toVisibleIndex, cLen = visibleColumn.length; cIndex < cLen; cIndex++) {
|
|
98
|
+
const column = visibleColumn[cIndex];
|
|
99
|
+
const colid = column.id;
|
|
100
|
+
const colRest = fullColumnIdData[colid] || {};
|
|
101
|
+
visibleSize++;
|
|
102
|
+
if (colRest.oLeft > endLeft || visibleSize >= 60) {
|
|
103
|
+
break;
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
return { toVisibleIndex: Math.max(0, toVisibleIndex), visibleSize: Math.max(1, visibleSize) };
|
|
@@ -396,8 +414,8 @@ function updateStyle($xeTable) {
|
|
|
396
414
|
const reactData = $xeTable;
|
|
397
415
|
const internalData = $xeTable;
|
|
398
416
|
const { border, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, mouseConfig, spanMethod, footerSpanMethod } = props;
|
|
399
|
-
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
400
|
-
const { visibleColumn, fullColumnIdData, tableHeight,
|
|
417
|
+
const { isGroup, currentRow, tableColumn, scrollXLoad, scrollYLoad, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isAllOverflow, expandColumn } = reactData;
|
|
418
|
+
const { visibleColumn, fullColumnIdData, tableHeight, headerHeight, footerHeight, elemStore, customHeight, customMinHeight, customMaxHeight } = internalData;
|
|
401
419
|
const el = $xeTable.$refs.refElem;
|
|
402
420
|
if (!el) {
|
|
403
421
|
return;
|
|
@@ -435,9 +453,9 @@ function updateStyle($xeTable) {
|
|
|
435
453
|
}
|
|
436
454
|
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
437
455
|
}
|
|
456
|
+
const scrollbarXToTop = $xeTable.$refs.computeScrollbarXToTop;
|
|
438
457
|
const xLeftCornerEl = $xeTable.$refs.refScrollXLeftCornerElem;
|
|
439
458
|
const xRightCornerEl = $xeTable.$refs.refScrollXRightCornerElem;
|
|
440
|
-
const scrollbarXToTop = $xeTable.computeScrollbarXToTop;
|
|
441
459
|
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
442
460
|
if (scrollXVirtualEl) {
|
|
443
461
|
scrollXVirtualEl.style.height = `${osbHeight}px`;
|
|
@@ -527,7 +545,7 @@ function updateStyle($xeTable) {
|
|
|
527
545
|
if (fixedType) {
|
|
528
546
|
if (isGroup) {
|
|
529
547
|
if (wrapperElem) {
|
|
530
|
-
wrapperElem.style.width =
|
|
548
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
531
549
|
}
|
|
532
550
|
}
|
|
533
551
|
else {
|
|
@@ -538,7 +556,7 @@ function updateStyle($xeTable) {
|
|
|
538
556
|
}
|
|
539
557
|
else {
|
|
540
558
|
if (wrapperElem) {
|
|
541
|
-
wrapperElem.style.width =
|
|
559
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
542
560
|
}
|
|
543
561
|
}
|
|
544
562
|
}
|
|
@@ -549,10 +567,6 @@ function updateStyle($xeTable) {
|
|
|
549
567
|
if (tableElem) {
|
|
550
568
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
551
569
|
}
|
|
552
|
-
const repairElem = getRefElem(elemStore[`${name}-${layout}-repair`]);
|
|
553
|
-
if (repairElem) {
|
|
554
|
-
repairElem.style.width = `${tableWidth}px`;
|
|
555
|
-
}
|
|
556
570
|
const listElem = getRefElem(elemStore[`${name}-${layout}-list`]);
|
|
557
571
|
if (isGroup && listElem) {
|
|
558
572
|
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem) => {
|
|
@@ -620,7 +634,7 @@ function updateStyle($xeTable) {
|
|
|
620
634
|
}
|
|
621
635
|
else {
|
|
622
636
|
if (wrapperElem) {
|
|
623
|
-
wrapperElem.style.width =
|
|
637
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
624
638
|
}
|
|
625
639
|
}
|
|
626
640
|
}
|
|
@@ -661,7 +675,7 @@ function updateStyle($xeTable) {
|
|
|
661
675
|
}
|
|
662
676
|
else {
|
|
663
677
|
if (wrapperElem) {
|
|
664
|
-
wrapperElem.style.width =
|
|
678
|
+
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : '';
|
|
665
679
|
}
|
|
666
680
|
}
|
|
667
681
|
}
|
|
@@ -984,46 +998,53 @@ function computeRowHeight($xeTable) {
|
|
|
984
998
|
// 最低支持 18px 行高
|
|
985
999
|
return Math.max(18, rowHeight);
|
|
986
1000
|
}
|
|
987
|
-
function handleVirtualYVisible($xeTable
|
|
1001
|
+
function handleVirtualYVisible($xeTable) {
|
|
988
1002
|
const reactData = $xeTable;
|
|
989
1003
|
const internalData = $xeTable;
|
|
990
|
-
const { isAllOverflow, expandColumn,
|
|
1004
|
+
const { isAllOverflow, expandColumn, isScrollYBig, scrollYHeight } = reactData;
|
|
991
1005
|
const { elemStore, isResizeCellHeight, afterFullData, fullAllDataRowIdData } = internalData;
|
|
992
|
-
const expandOpts = $xeTable.computeExpandOpts;
|
|
993
1006
|
const rowOpts = $xeTable.computeRowOpts;
|
|
994
1007
|
const cellOpts = $xeTable.computeCellOpts;
|
|
995
1008
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
996
1009
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
997
1010
|
if (bodyScrollElem) {
|
|
998
1011
|
const clientHeight = bodyScrollElem.clientHeight;
|
|
999
|
-
|
|
1000
|
-
|
|
1012
|
+
let scrollTop = bodyScrollElem.scrollTop;
|
|
1013
|
+
if (isScrollYBig) {
|
|
1014
|
+
scrollTop = Math.ceil((scrollYHeight - clientHeight) * Math.min(1, (scrollTop / (maxYHeight - clientHeight))));
|
|
1015
|
+
}
|
|
1016
|
+
const startTop = scrollTop;
|
|
1017
|
+
const endTop = scrollTop + clientHeight;
|
|
1001
1018
|
let toVisibleIndex = -1;
|
|
1002
|
-
let offsetTop = 0;
|
|
1003
1019
|
let visibleSize = 0;
|
|
1004
1020
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
1005
1021
|
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
1006
|
-
toVisibleIndex = Math.floor(
|
|
1022
|
+
toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
|
|
1007
1023
|
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
1008
1024
|
}
|
|
1009
1025
|
else {
|
|
1010
|
-
|
|
1026
|
+
let leftIndex = 0;
|
|
1027
|
+
let rightIndex = afterFullData.length;
|
|
1028
|
+
while (leftIndex < rightIndex) {
|
|
1029
|
+
const rIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
1011
1030
|
const row = afterFullData[rIndex];
|
|
1012
1031
|
const rowid = getRowid($xeTable, row);
|
|
1013
1032
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
toVisibleIndex = rIndex;
|
|
1033
|
+
if (rowRest.oTop <= startTop) {
|
|
1034
|
+
leftIndex = rIndex + 1;
|
|
1017
1035
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
if (offsetTop > endHeight) {
|
|
1021
|
-
break;
|
|
1022
|
-
}
|
|
1036
|
+
else {
|
|
1037
|
+
rightIndex = rIndex;
|
|
1023
1038
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1039
|
+
}
|
|
1040
|
+
toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
|
|
1041
|
+
for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
1042
|
+
const row = afterFullData[rIndex];
|
|
1043
|
+
const rowid = getRowid($xeTable, row);
|
|
1044
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1045
|
+
visibleSize++;
|
|
1046
|
+
if (rowRest.oTop > endTop || visibleSize >= 100) {
|
|
1047
|
+
break;
|
|
1027
1048
|
}
|
|
1028
1049
|
}
|
|
1029
1050
|
}
|
|
@@ -1178,7 +1199,7 @@ function autoCellWidth($xeTable) {
|
|
|
1178
1199
|
if (!xHandleEl) {
|
|
1179
1200
|
return;
|
|
1180
1201
|
}
|
|
1181
|
-
let
|
|
1202
|
+
let tWidth = 0;
|
|
1182
1203
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
1183
1204
|
const bodyWidth = bodyElem.clientWidth;
|
|
1184
1205
|
let remainWidth = bodyWidth;
|
|
@@ -1189,51 +1210,51 @@ function autoCellWidth($xeTable) {
|
|
|
1189
1210
|
// 最小宽
|
|
1190
1211
|
pxMinList.forEach((column) => {
|
|
1191
1212
|
const minWidth = XEUtils.toInteger(column.minWidth);
|
|
1192
|
-
|
|
1213
|
+
tWidth += minWidth;
|
|
1193
1214
|
column.renderWidth = minWidth;
|
|
1194
1215
|
});
|
|
1195
1216
|
// 最小自适应
|
|
1196
1217
|
autoMinList.forEach((column) => {
|
|
1197
1218
|
const scaleWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1198
|
-
|
|
1219
|
+
tWidth += scaleWidth;
|
|
1199
1220
|
column.renderWidth = scaleWidth;
|
|
1200
1221
|
});
|
|
1201
1222
|
// 最小百分比
|
|
1202
1223
|
scaleMinList.forEach((column) => {
|
|
1203
1224
|
const scaleWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
1204
|
-
|
|
1225
|
+
tWidth += scaleWidth;
|
|
1205
1226
|
column.renderWidth = scaleWidth;
|
|
1206
1227
|
});
|
|
1207
1228
|
// 固定百分比
|
|
1208
1229
|
scaleList.forEach((column) => {
|
|
1209
1230
|
const scaleWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
1210
|
-
|
|
1231
|
+
tWidth += scaleWidth;
|
|
1211
1232
|
column.renderWidth = scaleWidth;
|
|
1212
1233
|
});
|
|
1213
1234
|
// 固定宽
|
|
1214
1235
|
pxList.forEach((column) => {
|
|
1215
1236
|
const width = XEUtils.toInteger(column.width);
|
|
1216
|
-
|
|
1237
|
+
tWidth += width;
|
|
1217
1238
|
column.renderWidth = width;
|
|
1218
1239
|
});
|
|
1219
1240
|
// 自适应宽
|
|
1220
1241
|
autoList.forEach((column) => {
|
|
1221
1242
|
const width = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1222
|
-
|
|
1243
|
+
tWidth += width;
|
|
1223
1244
|
column.renderWidth = width;
|
|
1224
1245
|
});
|
|
1225
1246
|
// 调整了列宽
|
|
1226
1247
|
resizeList.forEach((column) => {
|
|
1227
1248
|
const width = XEUtils.toInteger(column.resizeWidth);
|
|
1228
|
-
|
|
1249
|
+
tWidth += width;
|
|
1229
1250
|
column.renderWidth = width;
|
|
1230
1251
|
});
|
|
1231
|
-
remainWidth -=
|
|
1252
|
+
remainWidth -= tWidth;
|
|
1232
1253
|
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (scaleMinList.length + pxMinList.length + autoMinList.length + remainList.length)) : 0;
|
|
1233
1254
|
if (fit) {
|
|
1234
1255
|
if (remainWidth > 0) {
|
|
1235
1256
|
scaleMinList.concat(pxMinList).concat(autoMinList).forEach((column) => {
|
|
1236
|
-
|
|
1257
|
+
tWidth += meanWidth;
|
|
1237
1258
|
column.renderWidth += meanWidth;
|
|
1238
1259
|
});
|
|
1239
1260
|
}
|
|
@@ -1245,7 +1266,7 @@ function autoCellWidth($xeTable) {
|
|
|
1245
1266
|
remainList.forEach((column) => {
|
|
1246
1267
|
const width = Math.max(meanWidth, minCellWidth);
|
|
1247
1268
|
column.renderWidth = width;
|
|
1248
|
-
|
|
1269
|
+
tWidth += width;
|
|
1249
1270
|
});
|
|
1250
1271
|
if (fit) {
|
|
1251
1272
|
/**
|
|
@@ -1255,13 +1276,13 @@ function autoCellWidth($xeTable) {
|
|
|
1255
1276
|
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
1256
1277
|
let dynamicSize = dynamicList.length - 1;
|
|
1257
1278
|
if (dynamicSize > 0) {
|
|
1258
|
-
let i = bodyWidth -
|
|
1279
|
+
let i = bodyWidth - tWidth;
|
|
1259
1280
|
if (i > 0) {
|
|
1260
1281
|
while (i > 0 && dynamicSize >= 0) {
|
|
1261
1282
|
i--;
|
|
1262
1283
|
dynamicList[dynamicSize--].renderWidth++;
|
|
1263
1284
|
}
|
|
1264
|
-
|
|
1285
|
+
tWidth = bodyWidth;
|
|
1265
1286
|
}
|
|
1266
1287
|
}
|
|
1267
1288
|
}
|
|
@@ -1269,17 +1290,18 @@ function autoCellWidth($xeTable) {
|
|
|
1269
1290
|
const overflowY = yHandleEl.scrollHeight > yHandleEl.clientHeight;
|
|
1270
1291
|
reactData.scrollbarWidth = Math.max(scrollbarOpts.width || 0, yHandleEl.offsetWidth - yHandleEl.clientWidth);
|
|
1271
1292
|
reactData.overflowY = overflowY;
|
|
1272
|
-
|
|
1293
|
+
reactData.scrollXWidth = tWidth;
|
|
1273
1294
|
internalData.tableHeight = tableHeight;
|
|
1274
1295
|
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
1275
1296
|
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
1276
1297
|
const headerHeight = headerTableElem ? headerTableElem.clientHeight : 0;
|
|
1277
|
-
const overflowX =
|
|
1298
|
+
const overflowX = tWidth > bodyWidth;
|
|
1278
1299
|
const footerHeight = footerTableElem ? footerTableElem.clientHeight : 0;
|
|
1279
1300
|
reactData.scrollbarHeight = Math.max(scrollbarOpts.height || 0, xHandleEl.offsetHeight - xHandleEl.clientHeight);
|
|
1280
1301
|
internalData.headerHeight = headerHeight;
|
|
1281
1302
|
internalData.footerHeight = footerHeight;
|
|
1282
1303
|
reactData.overflowX = overflowX;
|
|
1304
|
+
updateColumnOffsetLeft($xeTable);
|
|
1283
1305
|
updateHeight($xeTable);
|
|
1284
1306
|
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
1285
1307
|
if (overflowX) {
|
|
@@ -1455,8 +1477,8 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1455
1477
|
const wrapperRect = el.getBoundingClientRect();
|
|
1456
1478
|
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
1457
1479
|
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
1458
|
-
const
|
|
1459
|
-
const
|
|
1480
|
+
const tableWrapperWidth = el.clientWidth;
|
|
1481
|
+
const tableWrapperHeight = el.clientHeight;
|
|
1460
1482
|
if (trEl) {
|
|
1461
1483
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem;
|
|
1462
1484
|
if (rdLineEl) {
|
|
@@ -1465,14 +1487,14 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1465
1487
|
const trRect = trEl.getBoundingClientRect();
|
|
1466
1488
|
let trHeight = trEl.clientHeight;
|
|
1467
1489
|
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
1468
|
-
if (offsetTop + trHeight >
|
|
1469
|
-
trHeight =
|
|
1490
|
+
if (offsetTop + trHeight > tableWrapperHeight - osbHeight) {
|
|
1491
|
+
trHeight = tableWrapperHeight - offsetTop - osbHeight;
|
|
1470
1492
|
}
|
|
1471
1493
|
rdLineEl.style.display = 'block';
|
|
1472
1494
|
rdLineEl.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
1473
1495
|
rdLineEl.style.top = `${offsetTop}px`;
|
|
1474
1496
|
rdLineEl.style.height = `${trHeight}px`;
|
|
1475
|
-
rdLineEl.style.width = `${
|
|
1497
|
+
rdLineEl.style.width = `${tableWrapperWidth - osbWidth}px`;
|
|
1476
1498
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
1477
1499
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
1478
1500
|
}
|
|
@@ -1499,7 +1521,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1499
1521
|
thWidth -= startX - offsetLeft;
|
|
1500
1522
|
offsetLeft = startX;
|
|
1501
1523
|
}
|
|
1502
|
-
const endX =
|
|
1524
|
+
const endX = tableWrapperWidth - rightContainerWidth - (rightContainerWidth ? 0 : osbWidth);
|
|
1503
1525
|
if (offsetLeft + thWidth > endX) {
|
|
1504
1526
|
thWidth = endX - offsetLeft;
|
|
1505
1527
|
}
|
|
@@ -1511,7 +1533,7 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
1511
1533
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
1512
1534
|
}
|
|
1513
1535
|
else {
|
|
1514
|
-
cdLineEl.style.height = `${
|
|
1536
|
+
cdLineEl.style.height = `${tableWrapperHeight - offsetTop - (scrollbarXToTop ? 0 : osbHeight)}px`;
|
|
1515
1537
|
}
|
|
1516
1538
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
1517
1539
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -1587,6 +1609,20 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
|
1587
1609
|
}
|
|
1588
1610
|
return $xeTable.$nextTick();
|
|
1589
1611
|
}
|
|
1612
|
+
const handleRowExpandReserve = ($xeTable, row, expanded) => {
|
|
1613
|
+
const internalData = $xeTable;
|
|
1614
|
+
const { rowExpandedReserveRowMap } = internalData;
|
|
1615
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
1616
|
+
if (expandOpts.reserve) {
|
|
1617
|
+
const rowid = getRowid($xeTable, row);
|
|
1618
|
+
if (expanded) {
|
|
1619
|
+
rowExpandedReserveRowMap[rowid] = row;
|
|
1620
|
+
}
|
|
1621
|
+
else if (rowExpandedReserveRowMap[rowid]) {
|
|
1622
|
+
delete rowExpandedReserveRowMap[rowid];
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1590
1626
|
// 计算可视渲染相关数据
|
|
1591
1627
|
function computeScrollLoad($xeTable) {
|
|
1592
1628
|
const reactData = $xeTable;
|
|
@@ -1656,14 +1692,19 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
1656
1692
|
calcCellWidth($xeTable);
|
|
1657
1693
|
autoCellWidth($xeTable);
|
|
1658
1694
|
updateStyle($xeTable);
|
|
1695
|
+
if (reFull) {
|
|
1696
|
+
updateRowOffsetTop($xeTable);
|
|
1697
|
+
}
|
|
1659
1698
|
updateRowExpandStyle($xeTable);
|
|
1660
1699
|
return computeScrollLoad($xeTable).then(() => {
|
|
1661
1700
|
if (reFull === true) {
|
|
1662
1701
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
1663
|
-
calcCellHeight($xeTable);
|
|
1664
1702
|
calcCellWidth($xeTable);
|
|
1665
1703
|
autoCellWidth($xeTable);
|
|
1666
1704
|
updateStyle($xeTable);
|
|
1705
|
+
if (reFull) {
|
|
1706
|
+
updateRowOffsetTop($xeTable);
|
|
1707
|
+
}
|
|
1667
1708
|
updateRowExpandStyle($xeTable);
|
|
1668
1709
|
return computeScrollLoad($xeTable);
|
|
1669
1710
|
}
|
|
@@ -1695,16 +1736,16 @@ function handleUpdateColumn($xeTable) {
|
|
|
1695
1736
|
function loadScrollXData($xeTable) {
|
|
1696
1737
|
const reactData = $xeTable;
|
|
1697
1738
|
const internalData = $xeTable;
|
|
1698
|
-
const { mergeList, mergeFooterList } = reactData;
|
|
1739
|
+
const { mergeList, mergeFooterList, isScrollXBig } = reactData;
|
|
1699
1740
|
const { scrollXStore } = internalData;
|
|
1700
1741
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore;
|
|
1701
1742
|
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable);
|
|
1702
1743
|
const offsetItem = {
|
|
1703
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1704
|
-
endIndex: toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
1744
|
+
startIndex: Math.max(0, isScrollXBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1745
|
+
endIndex: isScrollXBig ? toVisibleIndex + visibleSize : toVisibleIndex + visibleSize + offsetSize + preloadSize
|
|
1705
1746
|
};
|
|
1706
|
-
scrollXStore.visibleStartIndex = toVisibleIndex;
|
|
1707
|
-
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
1747
|
+
scrollXStore.visibleStartIndex = toVisibleIndex - 1;
|
|
1748
|
+
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
1708
1749
|
calculateMergerOffsetIndex(mergeList.concat(mergeFooterList), offsetItem, 'col');
|
|
1709
1750
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
1710
1751
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
@@ -1911,20 +1952,20 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
1911
1952
|
/**
|
|
1912
1953
|
* 纵向 Y 可视渲染处理
|
|
1913
1954
|
*/
|
|
1914
|
-
function loadScrollYData($xeTable
|
|
1955
|
+
function loadScrollYData($xeTable) {
|
|
1915
1956
|
const reactData = $xeTable;
|
|
1916
1957
|
const internalData = $xeTable;
|
|
1917
|
-
const { mergeList, isAllOverflow } = reactData;
|
|
1958
|
+
const { mergeList, isAllOverflow, isScrollYBig } = reactData;
|
|
1918
1959
|
const { scrollYStore } = internalData;
|
|
1919
1960
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore;
|
|
1920
1961
|
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1;
|
|
1921
|
-
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable
|
|
1962
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
1922
1963
|
const offsetItem = {
|
|
1923
|
-
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1924
|
-
endIndex: toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize
|
|
1964
|
+
startIndex: Math.max(0, isScrollYBig ? toVisibleIndex - 1 : toVisibleIndex - 1 - offsetSize - preloadSize),
|
|
1965
|
+
endIndex: isScrollYBig ? (toVisibleIndex + visibleSize) : (toVisibleIndex + visibleSize + autoOffsetYSize + preloadSize)
|
|
1925
1966
|
};
|
|
1926
|
-
scrollYStore.visibleStartIndex = toVisibleIndex;
|
|
1927
|
-
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize;
|
|
1967
|
+
scrollYStore.visibleStartIndex = toVisibleIndex - 1;
|
|
1968
|
+
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1;
|
|
1928
1969
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
1929
1970
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
1930
1971
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
@@ -2110,6 +2151,40 @@ function handleUpdateRowResize($xeTable, evnt, params) {
|
|
|
2110
2151
|
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
2111
2152
|
});
|
|
2112
2153
|
}
|
|
2154
|
+
function updateColumnOffsetLeft($xeTable) {
|
|
2155
|
+
const internalData = $xeTable;
|
|
2156
|
+
const { visibleColumn, fullColumnIdData } = internalData;
|
|
2157
|
+
let offsetLeft = 0;
|
|
2158
|
+
for (let cIndex = 0, rLen = visibleColumn.length; cIndex < rLen; cIndex++) {
|
|
2159
|
+
const column = visibleColumn[cIndex];
|
|
2160
|
+
const colid = column.id;
|
|
2161
|
+
const colRest = fullColumnIdData[colid];
|
|
2162
|
+
colRest.oLeft = offsetLeft;
|
|
2163
|
+
offsetLeft += column.renderWidth;
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
function updateRowOffsetTop($xeTable) {
|
|
2167
|
+
const reactData = $xeTable;
|
|
2168
|
+
const internalData = $xeTable;
|
|
2169
|
+
const { expandColumn, rowExpandedMaps } = reactData;
|
|
2170
|
+
const { afterFullData, fullAllDataRowIdData } = internalData;
|
|
2171
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
2172
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
2173
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
2174
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
2175
|
+
let offsetTop = 0;
|
|
2176
|
+
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
2177
|
+
const row = afterFullData[rIndex];
|
|
2178
|
+
const rowid = getRowid($xeTable, row);
|
|
2179
|
+
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
2180
|
+
rowRest.oTop = offsetTop;
|
|
2181
|
+
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
2182
|
+
// 是否展开行
|
|
2183
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
2184
|
+
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2113
2188
|
function updateRowExpandStyle($xeTable) {
|
|
2114
2189
|
const reactData = $xeTable;
|
|
2115
2190
|
const internalData = $xeTable;
|
|
@@ -4060,7 +4135,7 @@ const Methods = {
|
|
|
4060
4135
|
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - osbHeight : tableHeight}px`;
|
|
4061
4136
|
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
4062
4137
|
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
4063
|
-
const
|
|
4138
|
+
const tableWrapperWidth = tableEl.clientWidth;
|
|
4064
4139
|
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
4065
4140
|
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
4066
4141
|
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
@@ -4069,8 +4144,8 @@ const Methods = {
|
|
|
4069
4144
|
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
4070
4145
|
resizeTipLeft = 0;
|
|
4071
4146
|
}
|
|
4072
|
-
else if (resizeBarLeft >
|
|
4073
|
-
resizeTipLeft +=
|
|
4147
|
+
else if (resizeBarLeft > tableWrapperWidth) {
|
|
4148
|
+
resizeTipLeft += tableWrapperWidth - resizeBarLeft;
|
|
4074
4149
|
}
|
|
4075
4150
|
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
4076
4151
|
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
@@ -4208,7 +4283,7 @@ const Methods = {
|
|
|
4208
4283
|
const updateEvent = (evnt) => {
|
|
4209
4284
|
evnt.stopPropagation();
|
|
4210
4285
|
evnt.preventDefault();
|
|
4211
|
-
const
|
|
4286
|
+
const rtWidth = tableEl.clientWidth - osbWidth;
|
|
4212
4287
|
const tableHeight = tableEl.clientHeight - osbHeight;
|
|
4213
4288
|
let dragTop = evnt.clientY - tableRect.y - targetOffsetY;
|
|
4214
4289
|
if (dragTop < minTop) {
|
|
@@ -4219,15 +4294,15 @@ const Methods = {
|
|
|
4219
4294
|
}
|
|
4220
4295
|
resizeBarElem.style.left = `${scrollbarYToLeft ? osbWidth : 0}px`;
|
|
4221
4296
|
resizeBarElem.style.top = `${dragTop}px`;
|
|
4222
|
-
resizeBarElem.style.width = `${
|
|
4297
|
+
resizeBarElem.style.width = `${rtWidth}px`;
|
|
4223
4298
|
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
4224
4299
|
resizeTipElem.textContent = getI18n('vxe.table.resizeRowTip', [resizeHeight]);
|
|
4225
4300
|
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
4226
4301
|
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
4227
4302
|
let resizeBarLeft = Math.max(2, evnt.clientX - tableRect.x);
|
|
4228
4303
|
let resizeBarTop = 0;
|
|
4229
|
-
if (resizeBarLeft + resizeTipWidth >=
|
|
4230
|
-
resizeBarLeft =
|
|
4304
|
+
if (resizeBarLeft + resizeTipWidth >= rtWidth - 2) {
|
|
4305
|
+
resizeBarLeft = rtWidth - resizeTipWidth - 2;
|
|
4231
4306
|
}
|
|
4232
4307
|
if (dragTop + resizeTipHeight >= tableHeight) {
|
|
4233
4308
|
resizeBarTop = tableHeight - (dragTop + resizeTipHeight);
|
|
@@ -4258,6 +4333,7 @@ const Methods = {
|
|
|
4258
4333
|
else {
|
|
4259
4334
|
rowRest.resizeHeight = resizeHeight;
|
|
4260
4335
|
handleUpdateRowResize($xeTable, evnt, resizeParams);
|
|
4336
|
+
updateRowOffsetTop($xeTable);
|
|
4261
4337
|
}
|
|
4262
4338
|
}
|
|
4263
4339
|
removeClass(tableEl, 'row-drag--resize');
|
|
@@ -6378,6 +6454,7 @@ const Methods = {
|
|
|
6378
6454
|
const dragParams = {
|
|
6379
6455
|
oldRow: dragRow,
|
|
6380
6456
|
newRow: prevDragRow,
|
|
6457
|
+
dragRow,
|
|
6381
6458
|
dragPos: prevDragPos,
|
|
6382
6459
|
dragToChild: !!prevDragToChild,
|
|
6383
6460
|
offsetIndex: dragOffsetIndex
|
|
@@ -6518,6 +6595,7 @@ const Methods = {
|
|
|
6518
6595
|
$xeTable.dispatchEvent('row-dragend', {
|
|
6519
6596
|
oldRow: dragRow,
|
|
6520
6597
|
newRow: prevDragRow,
|
|
6598
|
+
dragRow,
|
|
6521
6599
|
dragPos: prevDragPos,
|
|
6522
6600
|
dragToChild: isDragToChildFlag,
|
|
6523
6601
|
offsetIndex: dragOffsetIndex,
|
|
@@ -6678,11 +6756,12 @@ const Methods = {
|
|
|
6678
6756
|
if (prevDragCol && dragCol) {
|
|
6679
6757
|
// 判断是否有拖动
|
|
6680
6758
|
if (prevDragCol !== dragCol) {
|
|
6681
|
-
const
|
|
6759
|
+
const dragColumn = dragCol;
|
|
6682
6760
|
const newColumn = prevDragCol;
|
|
6683
6761
|
const dragParams = {
|
|
6684
|
-
oldColumn,
|
|
6762
|
+
oldColumn: dragColumn,
|
|
6685
6763
|
newColumn,
|
|
6764
|
+
dragColumn,
|
|
6686
6765
|
dragPos: prevDragPos,
|
|
6687
6766
|
dragToChild: !!prevDragToChild,
|
|
6688
6767
|
offsetIndex: dragOffsetIndex
|
|
@@ -6695,14 +6774,14 @@ const Methods = {
|
|
|
6695
6774
|
let oafIndex = -1;
|
|
6696
6775
|
let nafIndex = -1;
|
|
6697
6776
|
const oldAllMaps = {};
|
|
6698
|
-
XEUtils.eachTree([
|
|
6777
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
6699
6778
|
oldAllMaps[column.id] = column;
|
|
6700
6779
|
});
|
|
6701
6780
|
let isSelfToChildStatus = false;
|
|
6702
|
-
if (
|
|
6781
|
+
if (dragColumn.parentId && newColumn.parentId) {
|
|
6703
6782
|
// 子到子
|
|
6704
6783
|
if (isPeerDrag && !isCrossDrag) {
|
|
6705
|
-
if (
|
|
6784
|
+
if (dragColumn.parentId !== newColumn.parentId) {
|
|
6706
6785
|
// 非同级
|
|
6707
6786
|
return;
|
|
6708
6787
|
}
|
|
@@ -6725,7 +6804,7 @@ const Methods = {
|
|
|
6725
6804
|
}
|
|
6726
6805
|
}
|
|
6727
6806
|
}
|
|
6728
|
-
else if (
|
|
6807
|
+
else if (dragColumn.parentId) {
|
|
6729
6808
|
// 子到根
|
|
6730
6809
|
if (!isCrossDrag) {
|
|
6731
6810
|
return;
|
|
@@ -6752,17 +6831,17 @@ const Methods = {
|
|
|
6752
6831
|
else {
|
|
6753
6832
|
// 根到根
|
|
6754
6833
|
}
|
|
6755
|
-
const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id ===
|
|
6834
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === dragColumn.id);
|
|
6756
6835
|
// 改变层级
|
|
6757
6836
|
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
6758
6837
|
if (oldewMatchRest) {
|
|
6759
6838
|
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
6760
|
-
const childList =
|
|
6839
|
+
const childList = dragColumn.children || [];
|
|
6761
6840
|
childList.forEach(column => {
|
|
6762
|
-
column.parentId =
|
|
6841
|
+
column.parentId = dragColumn.parentId;
|
|
6763
6842
|
});
|
|
6764
6843
|
oCols.splice(oIndex, 1, ...childList);
|
|
6765
|
-
|
|
6844
|
+
dragColumn.children = [];
|
|
6766
6845
|
}
|
|
6767
6846
|
}
|
|
6768
6847
|
else {
|
|
@@ -6779,12 +6858,12 @@ const Methods = {
|
|
|
6779
6858
|
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
6780
6859
|
// 转子级
|
|
6781
6860
|
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
6782
|
-
|
|
6783
|
-
newColumn.children = (newColumn.children || []).concat([
|
|
6861
|
+
dragColumn.parentId = newColumn.id;
|
|
6862
|
+
newColumn.children = (newColumn.children || []).concat([dragColumn]);
|
|
6784
6863
|
}
|
|
6785
6864
|
else {
|
|
6786
|
-
|
|
6787
|
-
nCols.splice(nIndex + dragOffsetIndex, 0,
|
|
6865
|
+
dragColumn.parentId = newColumn.parentId;
|
|
6866
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
|
|
6788
6867
|
}
|
|
6789
6868
|
if (!nParent) {
|
|
6790
6869
|
nafIndex = nIndex;
|
|
@@ -6807,8 +6886,9 @@ const Methods = {
|
|
|
6807
6886
|
}
|
|
6808
6887
|
}
|
|
6809
6888
|
$xeTable.dispatchEvent('column-dragend', {
|
|
6810
|
-
oldColumn,
|
|
6889
|
+
oldColumn: dragColumn,
|
|
6811
6890
|
newColumn,
|
|
6891
|
+
dragColumn,
|
|
6812
6892
|
dragPos: prevDragPos,
|
|
6813
6893
|
dragToChild: isDragToChildFlag,
|
|
6814
6894
|
offsetIndex: dragOffsetIndex,
|
|
@@ -6891,22 +6971,22 @@ const Methods = {
|
|
|
6891
6971
|
const scrollTargetEl = xHandleEl || tableBodyElem;
|
|
6892
6972
|
if (scrollTargetEl) {
|
|
6893
6973
|
const wrapperRect = el.getBoundingClientRect();
|
|
6894
|
-
const
|
|
6974
|
+
const tableWrapperWidth = el.clientWidth;
|
|
6895
6975
|
const leftContainerElem = $xeTable.$refs.refLeftContainer;
|
|
6896
6976
|
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
6897
6977
|
const rightContainerElem = $xeTable.$refs.refRightContainer;
|
|
6898
6978
|
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
6899
6979
|
const srartX = wrapperRect.x + leftContainerWidth;
|
|
6900
|
-
const endX = wrapperRect.x +
|
|
6980
|
+
const endX = wrapperRect.x + tableWrapperWidth - rightContainerWidth;
|
|
6901
6981
|
const distSize = 28;
|
|
6902
6982
|
const startDistSize = clientX - srartX;
|
|
6903
6983
|
const endDistSize = endX - clientX;
|
|
6904
6984
|
if (startDistSize > 0 && startDistSize <= distSize) {
|
|
6905
|
-
const scrollRatio = Math.floor(
|
|
6985
|
+
const scrollRatio = Math.floor(tableWrapperWidth / (startDistSize > distSize / 2 ? 240 : 120));
|
|
6906
6986
|
scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
|
|
6907
6987
|
}
|
|
6908
6988
|
else if (endDistSize > 0 && endDistSize <= distSize) {
|
|
6909
|
-
const scrollRatio = Math.floor(
|
|
6989
|
+
const scrollRatio = Math.floor(tableWrapperWidth / (endDistSize > distSize / 2 ? 240 : 120));
|
|
6910
6990
|
scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
|
|
6911
6991
|
}
|
|
6912
6992
|
}
|
|
@@ -7402,17 +7482,17 @@ const Methods = {
|
|
|
7402
7482
|
});
|
|
7403
7483
|
}
|
|
7404
7484
|
if (reserve) {
|
|
7405
|
-
validRows.forEach((row) =>
|
|
7485
|
+
validRows.forEach((row) => handleRowExpandReserve($xeTable, row, expanded));
|
|
7406
7486
|
}
|
|
7407
7487
|
}
|
|
7408
7488
|
this.rowExpandedMaps = rExpandedMaps;
|
|
7409
7489
|
return Promise.all(lazyRests)
|
|
7410
|
-
.then(() => $xeTable
|
|
7490
|
+
.then(() => $xeTable.$nextTick())
|
|
7491
|
+
.then(() => $xeTable.recalculate(true))
|
|
7411
7492
|
.then(() => {
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
}
|
|
7493
|
+
updateRowOffsetTop($xeTable);
|
|
7494
|
+
updateRowExpandStyle($xeTable);
|
|
7495
|
+
handleRowExpandScroll($xeTable);
|
|
7416
7496
|
return $xeTable.updateCellAreas();
|
|
7417
7497
|
});
|
|
7418
7498
|
},
|
|
@@ -7437,35 +7517,31 @@ const Methods = {
|
|
|
7437
7517
|
*/
|
|
7438
7518
|
clearRowExpand() {
|
|
7439
7519
|
const $xeTable = this;
|
|
7440
|
-
const
|
|
7520
|
+
const reactData = $xeTable;
|
|
7521
|
+
const internalData = $xeTable;
|
|
7522
|
+
const { tableFullData } = internalData;
|
|
7523
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
7441
7524
|
const { reserve } = expandOpts;
|
|
7442
|
-
const expList =
|
|
7443
|
-
|
|
7525
|
+
const expList = $xeTable.getRowExpandRecords();
|
|
7526
|
+
reactData.rowExpandedMaps = {};
|
|
7444
7527
|
if (reserve) {
|
|
7445
|
-
tableFullData.forEach((row) =>
|
|
7528
|
+
tableFullData.forEach((row) => handleRowExpandReserve($xeTable, row, false));
|
|
7446
7529
|
}
|
|
7447
|
-
return
|
|
7530
|
+
return $xeTable.$nextTick().then(() => {
|
|
7448
7531
|
if (expList.length) {
|
|
7449
|
-
|
|
7532
|
+
return $xeTable.recalculate(true);
|
|
7450
7533
|
}
|
|
7451
|
-
}).then(() =>
|
|
7534
|
+
}).then(() => {
|
|
7535
|
+
updateRowOffsetTop($xeTable);
|
|
7536
|
+
updateRowExpandStyle($xeTable);
|
|
7537
|
+
handleRowExpandScroll($xeTable);
|
|
7538
|
+
return $xeTable.updateCellAreas();
|
|
7539
|
+
});
|
|
7452
7540
|
},
|
|
7453
7541
|
clearRowExpandReserve() {
|
|
7454
7542
|
this.rowExpandedReserveRowMap = {};
|
|
7455
7543
|
return this.$nextTick();
|
|
7456
7544
|
},
|
|
7457
|
-
handleRowExpandReserve(row, expanded) {
|
|
7458
|
-
const { rowExpandedReserveRowMap, expandOpts } = this;
|
|
7459
|
-
if (expandOpts.reserve) {
|
|
7460
|
-
const rowid = getRowid(this, row);
|
|
7461
|
-
if (expanded) {
|
|
7462
|
-
rowExpandedReserveRowMap[rowid] = row;
|
|
7463
|
-
}
|
|
7464
|
-
else if (rowExpandedReserveRowMap[rowid]) {
|
|
7465
|
-
delete rowExpandedReserveRowMap[rowid];
|
|
7466
|
-
}
|
|
7467
|
-
}
|
|
7468
|
-
},
|
|
7469
7545
|
getRowExpandRecords() {
|
|
7470
7546
|
const rest = [];
|
|
7471
7547
|
XEUtils.each(this.rowExpandedMaps, item => {
|
|
@@ -8168,7 +8244,7 @@ const Methods = {
|
|
|
8168
8244
|
const tableProps = $xeTable;
|
|
8169
8245
|
const reactData = $xeTable;
|
|
8170
8246
|
const internalData = $xeTable;
|
|
8171
|
-
const { target, deltaY, deltaX } = evnt;
|
|
8247
|
+
const { target, deltaY, deltaX, shiftKey } = evnt;
|
|
8172
8248
|
if (target && /^textarea$/i.test(target.tagName)) {
|
|
8173
8249
|
return;
|
|
8174
8250
|
}
|
|
@@ -8199,8 +8275,8 @@ const Methods = {
|
|
|
8199
8275
|
return;
|
|
8200
8276
|
}
|
|
8201
8277
|
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
8202
|
-
const deltaTop = Math.ceil(deltaY * wheelSpeed);
|
|
8203
|
-
const deltaLeft = Math.ceil(deltaX * wheelSpeed);
|
|
8278
|
+
const deltaTop = Math.ceil((shiftKey ? deltaX : deltaY) * wheelSpeed);
|
|
8279
|
+
const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
|
|
8204
8280
|
const isTopWheel = deltaTop < 0;
|
|
8205
8281
|
const currScrollTop = bodyScrollElem.scrollTop;
|
|
8206
8282
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
@@ -8348,43 +8424,66 @@ const Methods = {
|
|
|
8348
8424
|
const $xeTable = this;
|
|
8349
8425
|
const reactData = $xeTable;
|
|
8350
8426
|
const internalData = $xeTable;
|
|
8351
|
-
const { isGroup, scrollXLoad } = reactData;
|
|
8352
|
-
const { visibleColumn, scrollXStore, elemStore,
|
|
8353
|
-
const tableHeader = $xeTable.$refs.refTableHeader;
|
|
8427
|
+
const { isGroup, scrollXLoad, overflowX, scrollXWidth } = reactData;
|
|
8428
|
+
const { visibleColumn, scrollXStore, elemStore, fullColumnIdData } = internalData;
|
|
8354
8429
|
const tableBody = $xeTable.$refs.refTableBody;
|
|
8355
|
-
const tableFooter = $xeTable.$refs.refTableFooter;
|
|
8356
8430
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
8357
8431
|
if (tableBodyElem) {
|
|
8358
|
-
const
|
|
8359
|
-
const
|
|
8360
|
-
const
|
|
8361
|
-
const
|
|
8362
|
-
|
|
8363
|
-
const
|
|
8432
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8433
|
+
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
8434
|
+
const headerTableElem = getRefElem(elemStore['main-header-table']);
|
|
8435
|
+
const footerTableElem = getRefElem(elemStore['main-footer-table']);
|
|
8436
|
+
let xSpaceLeft = 0;
|
|
8437
|
+
const firstColumn = visibleColumn[scrollXStore.startIndex];
|
|
8438
|
+
if (firstColumn) {
|
|
8439
|
+
const colRest = fullColumnIdData[firstColumn.id] || {};
|
|
8440
|
+
xSpaceLeft = colRest.oLeft;
|
|
8441
|
+
}
|
|
8442
|
+
let clientWidth = 0;
|
|
8443
|
+
if (bodyScrollElem) {
|
|
8444
|
+
clientWidth = bodyScrollElem.clientWidth;
|
|
8445
|
+
}
|
|
8446
|
+
// 虚拟渲染
|
|
8447
|
+
let isScrollXBig = false;
|
|
8448
|
+
let ySpaceWidth = scrollXWidth;
|
|
8449
|
+
if (scrollXWidth > maxXWidth) {
|
|
8450
|
+
// 触右
|
|
8451
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollLeft + clientWidth >= maxXWidth) {
|
|
8452
|
+
xSpaceLeft = maxXWidth - bodyTableElem.clientWidth;
|
|
8453
|
+
}
|
|
8454
|
+
else {
|
|
8455
|
+
xSpaceLeft = (maxXWidth - clientWidth) * (xSpaceLeft / (scrollXWidth - clientWidth));
|
|
8456
|
+
}
|
|
8457
|
+
ySpaceWidth = maxXWidth;
|
|
8458
|
+
isScrollXBig = true;
|
|
8459
|
+
}
|
|
8364
8460
|
let marginLeft = '';
|
|
8365
|
-
if (scrollXLoad) {
|
|
8366
|
-
marginLeft = `${
|
|
8461
|
+
if (scrollXLoad && overflowX) {
|
|
8462
|
+
marginLeft = `${xSpaceLeft}px`;
|
|
8367
8463
|
}
|
|
8368
|
-
if (
|
|
8369
|
-
|
|
8464
|
+
if (headerTableElem) {
|
|
8465
|
+
headerTableElem.style.marginLeft = isGroup ? '' : marginLeft;
|
|
8370
8466
|
}
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8467
|
+
if (bodyTableElem) {
|
|
8468
|
+
bodyTableElem.style.marginLeft = marginLeft;
|
|
8469
|
+
}
|
|
8470
|
+
if (footerTableElem) {
|
|
8471
|
+
footerTableElem.style.marginLeft = marginLeft;
|
|
8374
8472
|
}
|
|
8473
|
+
reactData.isScrollXBig = isScrollXBig;
|
|
8375
8474
|
const containerList = ['main'];
|
|
8376
8475
|
containerList.forEach(name => {
|
|
8377
8476
|
const layoutList = ['header', 'body', 'footer'];
|
|
8378
8477
|
layoutList.forEach(layout => {
|
|
8379
8478
|
const xSpaceElem = getRefElem(elemStore[`${name}-${layout}-xSpace`]);
|
|
8380
8479
|
if (xSpaceElem) {
|
|
8381
|
-
xSpaceElem.style.width = scrollXLoad ? `${
|
|
8480
|
+
xSpaceElem.style.width = scrollXLoad ? `${ySpaceWidth}px` : '';
|
|
8382
8481
|
}
|
|
8383
8482
|
});
|
|
8384
8483
|
});
|
|
8385
8484
|
const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
|
|
8386
8485
|
if (scrollXSpaceEl) {
|
|
8387
|
-
scrollXSpaceEl.style.width = `${
|
|
8486
|
+
scrollXSpaceEl.style.width = `${ySpaceWidth}px`;
|
|
8388
8487
|
}
|
|
8389
8488
|
$xeTable.$nextTick(() => {
|
|
8390
8489
|
updateStyle($xeTable);
|
|
@@ -8412,49 +8511,66 @@ const Methods = {
|
|
|
8412
8511
|
const rowOpts = $xeTable.computeRowOpts;
|
|
8413
8512
|
const cellOpts = $xeTable.computeCellOpts;
|
|
8414
8513
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
8514
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
8415
8515
|
const bodyTableElem = getRefElem(elemStore['main-body-table']);
|
|
8416
8516
|
const containerList = ['main', 'left', 'right'];
|
|
8417
|
-
let
|
|
8418
|
-
let
|
|
8517
|
+
let ySpaceTop = 0;
|
|
8518
|
+
let scrollYHeight = 0;
|
|
8519
|
+
let isScrollYBig = false;
|
|
8419
8520
|
if (scrollYLoad) {
|
|
8420
8521
|
const isCustomCellHeight = isResizeCellHeight || cellOpts.height || rowOpts.height;
|
|
8421
8522
|
if (!isCustomCellHeight && !expandColumn && isAllOverflow) {
|
|
8422
|
-
|
|
8423
|
-
|
|
8523
|
+
scrollYHeight = afterFullData.length * defaultRowHeight;
|
|
8524
|
+
if (scrollYHeight > maxYHeight) {
|
|
8525
|
+
isScrollYBig = true;
|
|
8526
|
+
}
|
|
8527
|
+
ySpaceTop = Math.max(0, startIndex * defaultRowHeight);
|
|
8424
8528
|
}
|
|
8425
8529
|
else {
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8530
|
+
const firstRow = afterFullData[startIndex];
|
|
8531
|
+
let rowid = getRowid($xeTable, firstRow);
|
|
8532
|
+
let rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8533
|
+
ySpaceTop = rowRest.oTop;
|
|
8534
|
+
const lastRow = afterFullData[afterFullData.length - 1];
|
|
8535
|
+
rowid = getRowid($xeTable, lastRow);
|
|
8536
|
+
rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8537
|
+
scrollYHeight = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
|
|
8538
|
+
// 是否展开行
|
|
8539
|
+
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
8540
|
+
scrollYHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
8435
8541
|
}
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
const rowid = getRowid($xeTable, row);
|
|
8439
|
-
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
8440
|
-
topSpaceHeight += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
8441
|
-
// 是否展开行
|
|
8442
|
-
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
8443
|
-
topSpaceHeight += rowRest.expandHeight || expandOpts.height || 0;
|
|
8444
|
-
}
|
|
8542
|
+
if (scrollYHeight > maxYHeight) {
|
|
8543
|
+
isScrollYBig = true;
|
|
8445
8544
|
}
|
|
8446
8545
|
}
|
|
8447
8546
|
}
|
|
8448
8547
|
else {
|
|
8449
8548
|
if (bodyTableElem) {
|
|
8450
|
-
|
|
8549
|
+
scrollYHeight = bodyTableElem.clientHeight;
|
|
8550
|
+
}
|
|
8551
|
+
}
|
|
8552
|
+
let clientHeight = 0;
|
|
8553
|
+
if (bodyScrollElem) {
|
|
8554
|
+
clientHeight = bodyScrollElem.clientHeight;
|
|
8555
|
+
}
|
|
8556
|
+
// 虚拟渲染
|
|
8557
|
+
let ySpaceHeight = scrollYHeight;
|
|
8558
|
+
let scrollYTop = ySpaceTop;
|
|
8559
|
+
if (isScrollYBig) {
|
|
8560
|
+
// 触底
|
|
8561
|
+
if (bodyScrollElem && bodyTableElem && bodyScrollElem.scrollTop + clientHeight >= maxYHeight) {
|
|
8562
|
+
scrollYTop = maxYHeight - bodyTableElem.clientHeight;
|
|
8563
|
+
}
|
|
8564
|
+
else {
|
|
8565
|
+
scrollYTop = (maxYHeight - clientHeight) * (ySpaceTop / (scrollYHeight - clientHeight));
|
|
8451
8566
|
}
|
|
8567
|
+
ySpaceHeight = maxYHeight;
|
|
8452
8568
|
}
|
|
8453
8569
|
containerList.forEach(name => {
|
|
8454
8570
|
const layoutList = ['header', 'body', 'footer'];
|
|
8455
8571
|
const tableElem = getRefElem(elemStore[`${name}-body-table`]);
|
|
8456
8572
|
if (tableElem) {
|
|
8457
|
-
tableElem.style.marginTop =
|
|
8573
|
+
tableElem.style.marginTop = scrollYTop ? `${scrollYTop}px` : '';
|
|
8458
8574
|
}
|
|
8459
8575
|
layoutList.forEach(layout => {
|
|
8460
8576
|
const ySpaceElem = getRefElem(elemStore[`${name}-${layout}-ySpace`]);
|
|
@@ -8471,6 +8587,9 @@ const Methods = {
|
|
|
8471
8587
|
if (rowExpandYSpaceEl) {
|
|
8472
8588
|
rowExpandYSpaceEl.style.height = ySpaceHeight ? `${ySpaceHeight}px` : '';
|
|
8473
8589
|
}
|
|
8590
|
+
reactData.scrollYTop = scrollYTop;
|
|
8591
|
+
reactData.scrollYHeight = scrollYHeight;
|
|
8592
|
+
reactData.isScrollYBig = isScrollYBig;
|
|
8474
8593
|
return $xeTable.$nextTick().then(() => {
|
|
8475
8594
|
updateStyle($xeTable);
|
|
8476
8595
|
});
|