vxe-table 3.9.21 → 3.10.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/locale/lang/ja-JP.js +5 -5
- package/es/locale/lang/ko-KR.js +5 -5
- package/es/locale/lang/uk-UA.js +5 -5
- package/es/locale/lang/vi-VN.js +5 -5
- package/es/locale/lang/zh-CHT.js +5 -5
- package/es/locale/lang/zh-CN.js +5 -5
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/mixin.js +3 -3
- package/es/table/src/body.js +50 -115
- package/es/table/src/footer.js +24 -21
- package/es/table/src/methods.js +392 -123
- package/es/table/src/table.js +68 -10
- package/es/table/src/util.js +58 -33
- package/es/table/style.css +46 -3
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +46 -3
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.umd.js +672 -361
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +5 -5
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +5 -5
- package/lib/locale/lang/ko-KR.js +5 -5
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +5 -5
- package/lib/locale/lang/uk-UA.js +5 -5
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +5 -5
- package/lib/locale/lang/vi-VN.js +5 -5
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +5 -5
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +5 -5
- package/lib/locale/lang/zh-CN.js +5 -5
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +5 -5
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/mixin.js +6 -3
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/body.js +49 -118
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +24 -33
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/methods.js +449 -148
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +61 -13
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +72 -38
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +46 -3
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +2 -2
- 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/lib/vxe-table/style/style.css +46 -3
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ja-JP.ts +5 -5
- package/packages/locale/lang/ko-KR.ts +5 -5
- package/packages/locale/lang/uk-UA.ts +5 -5
- package/packages/locale/lang/vi-VN.ts +5 -5
- package/packages/locale/lang/zh-CHT.ts +5 -5
- package/packages/locale/lang/zh-CN.ts +5 -5
- package/packages/table/module/edit/mixin.ts +3 -3
- package/packages/table/src/body.ts +50 -118
- package/packages/table/src/footer.ts +24 -22
- package/packages/table/src/methods.ts +418 -127
- package/packages/table/src/props.ts +8 -8
- package/packages/table/src/table.ts +70 -10
- package/packages/table/src/util.ts +61 -36
- package/packages/ui/index.ts +1 -1
- package/styles/components/table-module/filter.scss +1 -1
- package/styles/components/table.scss +45 -6
- package/styles/modules.scss +0 -2
- package/styles/theme/base.scss +1 -1
- package/styles/theme/dark.scss +7 -4
- package/styles/variable.scss +5 -1
- /package/es/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
- /package/es/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
- /package/es/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
- /package/lib/{iconfont.1729992873866.ttf → iconfont.1730347297462.ttf} +0 -0
- /package/lib/{iconfont.1729992873866.woff → iconfont.1730347297462.woff} +0 -0
- /package/lib/{iconfont.1729992873866.woff2 → iconfont.1730347297462.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -18,7 +18,8 @@ const {
|
|
|
18
18
|
getI18n,
|
|
19
19
|
renderer,
|
|
20
20
|
formats,
|
|
21
|
-
interceptor
|
|
21
|
+
interceptor,
|
|
22
|
+
createEvent
|
|
22
23
|
} = _ui.VxeUI;
|
|
23
24
|
const isWebkit = _dom.browse['-webkit'] && !_dom.browse.edge;
|
|
24
25
|
const debounceScrollYDuration = _dom.browse.msie ? 80 : 20;
|
|
@@ -87,7 +88,7 @@ function handleReserveRow(_vm, reserveRowMap) {
|
|
|
87
88
|
});
|
|
88
89
|
return reserveList;
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function handleVirtualXVisible(_vm) {
|
|
91
92
|
const {
|
|
92
93
|
$refs,
|
|
93
94
|
visibleColumn
|
|
@@ -127,21 +128,19 @@ function computeVirtualX(_vm) {
|
|
|
127
128
|
visibleSize: 6
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
const computeRowHeight = $xeTable => {
|
|
131
132
|
const {
|
|
132
133
|
$refs,
|
|
133
|
-
computeSize
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
tableHeader,
|
|
138
|
-
tableBody
|
|
139
|
-
} = $refs;
|
|
134
|
+
computeSize
|
|
135
|
+
} = $xeTable;
|
|
136
|
+
const tableHeader = $refs.tableHeader;
|
|
137
|
+
const tableBody = $refs.tableBody;
|
|
140
138
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
141
139
|
const vSize = computeSize;
|
|
140
|
+
const rowHeightMaps = $xeTable.rowHeightMaps;
|
|
141
|
+
let rowHeight = 0;
|
|
142
142
|
if (tableBodyElem) {
|
|
143
143
|
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
144
|
-
let rowHeight = 0;
|
|
145
144
|
let firstTrElem;
|
|
146
145
|
firstTrElem = tableBodyElem.querySelector('tr');
|
|
147
146
|
if (!firstTrElem && tableHeaderElem) {
|
|
@@ -153,14 +152,55 @@ function computeVirtualY(_vm) {
|
|
|
153
152
|
if (!rowHeight) {
|
|
154
153
|
rowHeight = rowHeightMaps[vSize || 'default'];
|
|
155
154
|
}
|
|
156
|
-
|
|
155
|
+
}
|
|
156
|
+
return rowHeight;
|
|
157
|
+
};
|
|
158
|
+
function handleVirtualYVisible($xeTable) {
|
|
159
|
+
const {
|
|
160
|
+
$refs,
|
|
161
|
+
scrollYStore,
|
|
162
|
+
afterFullData,
|
|
163
|
+
fullAllDataRowIdData
|
|
164
|
+
} = $xeTable;
|
|
165
|
+
const tableBody = $refs.tableBody;
|
|
166
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
167
|
+
const {
|
|
168
|
+
rowHeight
|
|
169
|
+
} = scrollYStore;
|
|
170
|
+
if (tableBodyElem) {
|
|
171
|
+
const {
|
|
172
|
+
scrollTop,
|
|
173
|
+
clientHeight
|
|
174
|
+
} = tableBodyElem;
|
|
175
|
+
const endHeight = scrollTop + clientHeight;
|
|
176
|
+
let toVisibleIndex = -1;
|
|
177
|
+
let offsetTop = 0;
|
|
178
|
+
let visibleSize = 0;
|
|
179
|
+
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
180
|
+
const row = afterFullData[rIndex];
|
|
181
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
182
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
183
|
+
if (!rest) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
offsetTop += rest.height || rowHeight;
|
|
187
|
+
if (toVisibleIndex === -1 && scrollTop < offsetTop) {
|
|
188
|
+
toVisibleIndex = rIndex;
|
|
189
|
+
}
|
|
190
|
+
if (toVisibleIndex >= 0) {
|
|
191
|
+
visibleSize++;
|
|
192
|
+
if (offsetTop > endHeight) {
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
157
197
|
return {
|
|
158
|
-
|
|
159
|
-
visibleSize
|
|
198
|
+
toVisibleIndex: Math.max(0, toVisibleIndex),
|
|
199
|
+
visibleSize: Math.max(8, visibleSize)
|
|
160
200
|
};
|
|
161
201
|
}
|
|
162
202
|
return {
|
|
163
|
-
|
|
203
|
+
toVisibleIndex: 0,
|
|
164
204
|
visibleSize: 8
|
|
165
205
|
};
|
|
166
206
|
}
|
|
@@ -278,7 +318,7 @@ function clearAllSort(_vm) {
|
|
|
278
318
|
column.order = null;
|
|
279
319
|
});
|
|
280
320
|
}
|
|
281
|
-
function
|
|
321
|
+
function calcTableHeight(_vm, key) {
|
|
282
322
|
const {
|
|
283
323
|
parentHeight
|
|
284
324
|
} = _vm;
|
|
@@ -299,6 +339,29 @@ function calcHeight(_vm, key) {
|
|
|
299
339
|
}
|
|
300
340
|
return num;
|
|
301
341
|
}
|
|
342
|
+
const calcCellHeight = $xeTable => {
|
|
343
|
+
const {
|
|
344
|
+
tableData,
|
|
345
|
+
scrollYLoad,
|
|
346
|
+
fullAllDataRowIdData
|
|
347
|
+
} = $xeTable;
|
|
348
|
+
const el = $xeTable.$el;
|
|
349
|
+
if (scrollYLoad && el) {
|
|
350
|
+
tableData.forEach(row => {
|
|
351
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
352
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
353
|
+
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
|
|
354
|
+
if (rest && trList.length) {
|
|
355
|
+
let height = 0;
|
|
356
|
+
for (let i = 0; i < trList.length; i++) {
|
|
357
|
+
const trEl = trList[i];
|
|
358
|
+
height = Math.max(height, trEl.offsetHeight);
|
|
359
|
+
}
|
|
360
|
+
rest.height = height;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
};
|
|
302
365
|
function getOrderField(_vm, column) {
|
|
303
366
|
const {
|
|
304
367
|
sortBy,
|
|
@@ -543,9 +606,9 @@ const Methods = {
|
|
|
543
606
|
if (!(this.height || this.maxHeight)) {
|
|
544
607
|
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
545
608
|
}
|
|
546
|
-
if (!this.showOverflow) {
|
|
547
|
-
|
|
548
|
-
}
|
|
609
|
+
// if (!this.showOverflow) {
|
|
610
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
611
|
+
// }
|
|
549
612
|
if (this.spanMethod) {
|
|
550
613
|
(0, _log.warnLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
551
614
|
}
|
|
@@ -784,7 +847,8 @@ const Methods = {
|
|
|
784
847
|
$index: -1,
|
|
785
848
|
items,
|
|
786
849
|
parent,
|
|
787
|
-
level
|
|
850
|
+
level,
|
|
851
|
+
height: 0
|
|
788
852
|
};
|
|
789
853
|
}
|
|
790
854
|
if (isSource) {
|
|
@@ -882,7 +946,8 @@ const Methods = {
|
|
|
882
946
|
$index: -1,
|
|
883
947
|
items,
|
|
884
948
|
parent: parentRow,
|
|
885
|
-
level: parentLevel + nodes.length
|
|
949
|
+
level: parentLevel + nodes.length,
|
|
950
|
+
height: 0
|
|
886
951
|
};
|
|
887
952
|
fullDataRowIdData[rowid] = rest;
|
|
888
953
|
fullAllDataRowIdData[rowid] = rest;
|
|
@@ -933,7 +998,8 @@ const Methods = {
|
|
|
933
998
|
colid,
|
|
934
999
|
index,
|
|
935
1000
|
items,
|
|
936
|
-
parent
|
|
1001
|
+
parent: parent || null,
|
|
1002
|
+
width: 0
|
|
937
1003
|
};
|
|
938
1004
|
if (field) {
|
|
939
1005
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -1044,14 +1110,14 @@ const Methods = {
|
|
|
1044
1110
|
fullAllDataRowIdData
|
|
1045
1111
|
} = this;
|
|
1046
1112
|
const rowid = tr.getAttribute('rowid');
|
|
1047
|
-
const
|
|
1048
|
-
if (
|
|
1113
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1114
|
+
if (rowRest) {
|
|
1049
1115
|
return {
|
|
1050
|
-
rowid:
|
|
1051
|
-
item:
|
|
1052
|
-
index:
|
|
1053
|
-
items:
|
|
1054
|
-
parent:
|
|
1116
|
+
rowid: rowRest.rowid,
|
|
1117
|
+
item: rowRest.row,
|
|
1118
|
+
index: rowRest.index,
|
|
1119
|
+
items: rowRest.items,
|
|
1120
|
+
parent: rowRest.parent
|
|
1055
1121
|
};
|
|
1056
1122
|
}
|
|
1057
1123
|
}
|
|
@@ -1067,15 +1133,17 @@ const Methods = {
|
|
|
1067
1133
|
fullColumnIdData
|
|
1068
1134
|
} = this;
|
|
1069
1135
|
const colid = cell.getAttribute('colid');
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1136
|
+
if (colid) {
|
|
1137
|
+
const colRest = fullColumnIdData[colid];
|
|
1138
|
+
if (colRest) {
|
|
1139
|
+
return {
|
|
1140
|
+
colid: colRest.colid,
|
|
1141
|
+
item: colRest.column,
|
|
1142
|
+
index: colRest.index,
|
|
1143
|
+
items: colRest.items,
|
|
1144
|
+
parent: colRest.parent
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1079
1147
|
}
|
|
1080
1148
|
}
|
|
1081
1149
|
return null;
|
|
@@ -1425,13 +1493,13 @@ const Methods = {
|
|
|
1425
1493
|
} = $xeTable;
|
|
1426
1494
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1427
1495
|
const colid = column.id;
|
|
1428
|
-
const
|
|
1429
|
-
if (
|
|
1430
|
-
formatData =
|
|
1496
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1497
|
+
if (rowRest) {
|
|
1498
|
+
formatData = rowRest.formatData;
|
|
1431
1499
|
if (!formatData) {
|
|
1432
1500
|
formatData = fullAllDataRowIdData[rowid].formatData = {};
|
|
1433
1501
|
}
|
|
1434
|
-
if (
|
|
1502
|
+
if (rowRest && formatData[colid]) {
|
|
1435
1503
|
if (formatData[colid].value === cellValue) {
|
|
1436
1504
|
return formatData[colid].label;
|
|
1437
1505
|
}
|
|
@@ -1883,11 +1951,11 @@ const Methods = {
|
|
|
1883
1951
|
if (treeConfig) {
|
|
1884
1952
|
_xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
1885
1953
|
const rowid = (0, _util.getRowid)(this, row);
|
|
1886
|
-
const
|
|
1954
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1887
1955
|
const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
|
|
1888
|
-
if (
|
|
1889
|
-
|
|
1890
|
-
|
|
1956
|
+
if (rowRest) {
|
|
1957
|
+
rowRest.seq = seq;
|
|
1958
|
+
rowRest._index = index;
|
|
1891
1959
|
} else {
|
|
1892
1960
|
const rest = {
|
|
1893
1961
|
row,
|
|
@@ -1898,7 +1966,8 @@ const Methods = {
|
|
|
1898
1966
|
_index: index,
|
|
1899
1967
|
items: [],
|
|
1900
1968
|
parent: null,
|
|
1901
|
-
level: 0
|
|
1969
|
+
level: 0,
|
|
1970
|
+
height: 0
|
|
1902
1971
|
};
|
|
1903
1972
|
fullAllDataRowIdData[rowid] = rest;
|
|
1904
1973
|
fullDataRowIdData[rowid] = rest;
|
|
@@ -1910,11 +1979,11 @@ const Methods = {
|
|
|
1910
1979
|
} else {
|
|
1911
1980
|
afterFullData.forEach((row, index) => {
|
|
1912
1981
|
const rowid = (0, _util.getRowid)(this, row);
|
|
1913
|
-
const
|
|
1982
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1914
1983
|
const seq = index + 1;
|
|
1915
|
-
if (
|
|
1916
|
-
|
|
1917
|
-
|
|
1984
|
+
if (rowRest) {
|
|
1985
|
+
rowRest.seq = seq;
|
|
1986
|
+
rowRest._index = index;
|
|
1918
1987
|
} else {
|
|
1919
1988
|
const rest = {
|
|
1920
1989
|
row,
|
|
@@ -1925,7 +1994,8 @@ const Methods = {
|
|
|
1925
1994
|
_index: index,
|
|
1926
1995
|
items: [],
|
|
1927
1996
|
parent: null,
|
|
1928
|
-
level: 0
|
|
1997
|
+
level: 0,
|
|
1998
|
+
height: 0
|
|
1929
1999
|
};
|
|
1930
2000
|
fullAllDataRowIdData[rowid] = rest;
|
|
1931
2001
|
fullDataRowIdData[rowid] = rest;
|
|
@@ -2500,7 +2570,7 @@ const Methods = {
|
|
|
2500
2570
|
}
|
|
2501
2571
|
const {
|
|
2502
2572
|
visibleSize
|
|
2503
|
-
} =
|
|
2573
|
+
} = handleVirtualXVisible(this);
|
|
2504
2574
|
scrollXStore.startIndex = 0;
|
|
2505
2575
|
scrollXStore.endIndex = visibleSize;
|
|
2506
2576
|
scrollXStore.visibleSize = visibleSize;
|
|
@@ -2514,9 +2584,9 @@ const Methods = {
|
|
|
2514
2584
|
this.scrollXLoad = scrollXLoad;
|
|
2515
2585
|
visibleColumn.forEach((column, index) => {
|
|
2516
2586
|
const colid = column.id;
|
|
2517
|
-
const
|
|
2518
|
-
if (
|
|
2519
|
-
|
|
2587
|
+
const colRest = fullColumnIdData[colid];
|
|
2588
|
+
if (colRest) {
|
|
2589
|
+
colRest._index = index;
|
|
2520
2590
|
}
|
|
2521
2591
|
});
|
|
2522
2592
|
this.visibleColumn = visibleColumn;
|
|
@@ -2627,36 +2697,26 @@ const Methods = {
|
|
|
2627
2697
|
* 计算单元格列宽,动态分配可用剩余空间
|
|
2628
2698
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2629
2699
|
*/
|
|
2630
|
-
recalculate(
|
|
2631
|
-
const {
|
|
2632
|
-
$refs
|
|
2633
|
-
} = this;
|
|
2634
|
-
const {
|
|
2635
|
-
tableBody,
|
|
2636
|
-
tableHeader,
|
|
2637
|
-
tableFooter
|
|
2638
|
-
} = $refs;
|
|
2639
|
-
const bodyElem = tableBody ? tableBody.$el : null;
|
|
2640
|
-
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
2641
|
-
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
2700
|
+
recalculate(reFull) {
|
|
2642
2701
|
const el = this.$el;
|
|
2643
2702
|
if (!el || !el.clientWidth) {
|
|
2644
2703
|
return this.$nextTick();
|
|
2645
2704
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
}
|
|
2705
|
+
calcCellHeight(this);
|
|
2706
|
+
this.calcCellWidth();
|
|
2707
|
+
this.autoCellWidth();
|
|
2708
|
+
if (reFull === true) {
|
|
2709
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2710
|
+
return this.computeScrollLoad().then(() => {
|
|
2711
|
+
calcCellHeight(this);
|
|
2712
|
+
this.autoCellWidth();
|
|
2713
|
+
return this.computeScrollLoad();
|
|
2714
|
+
});
|
|
2656
2715
|
}
|
|
2657
2716
|
return this.computeScrollLoad();
|
|
2658
2717
|
},
|
|
2659
2718
|
calcCellWidth() {
|
|
2719
|
+
const $xeTable = this;
|
|
2660
2720
|
const {
|
|
2661
2721
|
autoWidthColumnList,
|
|
2662
2722
|
tableData
|
|
@@ -2667,9 +2727,15 @@ const Methods = {
|
|
|
2667
2727
|
}
|
|
2668
2728
|
this.isCalcColumn = true;
|
|
2669
2729
|
return this.$nextTick().then(() => {
|
|
2730
|
+
const internalData = $xeTable;
|
|
2731
|
+
const {
|
|
2732
|
+
fullColumnIdData
|
|
2733
|
+
} = internalData;
|
|
2670
2734
|
const el = this.$el;
|
|
2671
2735
|
if (el) {
|
|
2672
2736
|
autoWidthColumnList.forEach(column => {
|
|
2737
|
+
const colid = column.id;
|
|
2738
|
+
const colRest = fullColumnIdData[colid];
|
|
2673
2739
|
const cellElList = el.querySelectorAll(`.vxe-header--column.${column.id}>.vxe-cell,.vxe-body--column.${column.id}>.vxe-cell,.vxe-footer--column.${column.id}>.vxe-cell`);
|
|
2674
2740
|
const firstCellEl = cellElList[0];
|
|
2675
2741
|
let paddingSize = 0;
|
|
@@ -2696,6 +2762,9 @@ const Methods = {
|
|
|
2696
2762
|
colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4);
|
|
2697
2763
|
}
|
|
2698
2764
|
});
|
|
2765
|
+
if (colRest) {
|
|
2766
|
+
colRest.width = Math.max(colWidth, colRest.width);
|
|
2767
|
+
}
|
|
2699
2768
|
column.renderAutoWidth = colWidth + paddingSize;
|
|
2700
2769
|
});
|
|
2701
2770
|
this.analyColumnWidth();
|
|
@@ -2708,12 +2777,19 @@ const Methods = {
|
|
|
2708
2777
|
* 支持 px、%、固定 混合分配
|
|
2709
2778
|
* 支持动态列表调整分配
|
|
2710
2779
|
* 支持自动分配偏移量
|
|
2711
|
-
* @param {Element} headerElem
|
|
2712
|
-
* @param {Element} bodyElem
|
|
2713
|
-
* @param {Element} footerElem
|
|
2714
|
-
* @param {Number} bodyWidth
|
|
2715
2780
|
*/
|
|
2716
|
-
autoCellWidth(
|
|
2781
|
+
autoCellWidth() {
|
|
2782
|
+
const {
|
|
2783
|
+
$refs
|
|
2784
|
+
} = this;
|
|
2785
|
+
const {
|
|
2786
|
+
tableBody,
|
|
2787
|
+
tableHeader,
|
|
2788
|
+
tableFooter
|
|
2789
|
+
} = $refs;
|
|
2790
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
2791
|
+
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
2792
|
+
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
2717
2793
|
let tableWidth = 0;
|
|
2718
2794
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
2719
2795
|
const bodyWidth = bodyElem.clientWidth - 1;
|
|
@@ -2848,12 +2924,41 @@ const Methods = {
|
|
|
2848
2924
|
this.checkScrolling();
|
|
2849
2925
|
}
|
|
2850
2926
|
},
|
|
2927
|
+
calcCellHeight() {
|
|
2928
|
+
const $xeTable = this;
|
|
2929
|
+
const reactData = $xeTable;
|
|
2930
|
+
const internalData = $xeTable;
|
|
2931
|
+
const {
|
|
2932
|
+
tableData,
|
|
2933
|
+
scrollYLoad
|
|
2934
|
+
} = reactData;
|
|
2935
|
+
const {
|
|
2936
|
+
fullAllDataRowIdData
|
|
2937
|
+
} = internalData;
|
|
2938
|
+
const el = $xeTable.$el;
|
|
2939
|
+
if (scrollYLoad && el) {
|
|
2940
|
+
tableData.forEach(row => {
|
|
2941
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
2942
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
2943
|
+
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2944
|
+
if (rowRest && trList.length) {
|
|
2945
|
+
let height = 0;
|
|
2946
|
+
for (let i = 0; i < trList.length; i++) {
|
|
2947
|
+
const trEl = trList[i];
|
|
2948
|
+
height = Math.max(height, trEl.offsetHeight);
|
|
2949
|
+
}
|
|
2950
|
+
rowRest.height = height;
|
|
2951
|
+
}
|
|
2952
|
+
});
|
|
2953
|
+
}
|
|
2954
|
+
},
|
|
2851
2955
|
updateHeight() {
|
|
2852
|
-
this.customHeight =
|
|
2853
|
-
this.customMinHeight =
|
|
2854
|
-
this.customMaxHeight =
|
|
2956
|
+
this.customHeight = calcTableHeight(this, 'height');
|
|
2957
|
+
this.customMinHeight = calcTableHeight(this, 'minHeight');
|
|
2958
|
+
this.customMaxHeight = calcTableHeight(this, 'maxHeight');
|
|
2855
2959
|
},
|
|
2856
2960
|
updateStyle() {
|
|
2961
|
+
const $xeTable = this;
|
|
2857
2962
|
let {
|
|
2858
2963
|
$refs,
|
|
2859
2964
|
isGroup,
|
|
@@ -2875,6 +2980,7 @@ const Methods = {
|
|
|
2875
2980
|
scrollbarWidth,
|
|
2876
2981
|
scrollXLoad,
|
|
2877
2982
|
scrollYLoad,
|
|
2983
|
+
overflowX,
|
|
2878
2984
|
cellOffsetWidth,
|
|
2879
2985
|
columnStore,
|
|
2880
2986
|
elemStore,
|
|
@@ -2889,7 +2995,7 @@ const Methods = {
|
|
|
2889
2995
|
footerSpanMethod,
|
|
2890
2996
|
isAllOverflow,
|
|
2891
2997
|
visibleColumn
|
|
2892
|
-
} =
|
|
2998
|
+
} = $xeTable;
|
|
2893
2999
|
const containerList = ['main', 'left', 'right'];
|
|
2894
3000
|
const emptyPlaceholderElem = $refs.emptyPlaceholder;
|
|
2895
3001
|
const bodyWrapperElem = elemStore['main-body-wrapper'];
|
|
@@ -2902,6 +3008,30 @@ const Methods = {
|
|
|
2902
3008
|
customHeight += scrollbarHeight;
|
|
2903
3009
|
}
|
|
2904
3010
|
}
|
|
3011
|
+
const scrollXVirtualEl = $xeTable.$refs.refScrollXVirtualElem;
|
|
3012
|
+
if (scrollXVirtualEl) {
|
|
3013
|
+
scrollXVirtualEl.style.height = `${scrollbarHeight}px`;
|
|
3014
|
+
}
|
|
3015
|
+
const scrollYVirtualEl = $xeTable.$refs.refScrollYVirtualElem;
|
|
3016
|
+
if (scrollYVirtualEl) {
|
|
3017
|
+
let bodyHeight = 0;
|
|
3018
|
+
let bodyMaxHeight = 0;
|
|
3019
|
+
const bodyMinHeight = customMinHeight - headerHeight - footerHeight;
|
|
3020
|
+
if (customMaxHeight) {
|
|
3021
|
+
bodyMaxHeight = customMaxHeight - headerHeight - footerHeight;
|
|
3022
|
+
bodyMaxHeight = Math.max(bodyMinHeight, bodyMaxHeight);
|
|
3023
|
+
}
|
|
3024
|
+
if (customHeight) {
|
|
3025
|
+
bodyHeight = customHeight - headerHeight - footerHeight;
|
|
3026
|
+
if (bodyMaxHeight) {
|
|
3027
|
+
bodyHeight = Math.min(bodyMaxHeight, bodyHeight);
|
|
3028
|
+
}
|
|
3029
|
+
bodyHeight = Math.max(bodyMinHeight, bodyHeight);
|
|
3030
|
+
}
|
|
3031
|
+
scrollYVirtualEl.style.top = `${headerHeight}px`;
|
|
3032
|
+
scrollYVirtualEl.style.width = `${scrollbarWidth}px`;
|
|
3033
|
+
scrollYVirtualEl.style.height = `${bodyHeight + (overflowX ? -Math.max(1, scrollbarHeight) : 0)}px`;
|
|
3034
|
+
}
|
|
2905
3035
|
containerList.forEach((name, index) => {
|
|
2906
3036
|
const fixedType = index > 0 ? name : '';
|
|
2907
3037
|
const layoutList = ['header', 'body', 'footer'];
|
|
@@ -3066,7 +3196,8 @@ const Methods = {
|
|
|
3066
3196
|
colElem.style.width = `${scrollbarWidth}px`;
|
|
3067
3197
|
}
|
|
3068
3198
|
if (fullColumnIdData[colid]) {
|
|
3069
|
-
const
|
|
3199
|
+
const colRest = fullColumnIdData[colid];
|
|
3200
|
+
const column = colRest.column;
|
|
3070
3201
|
const {
|
|
3071
3202
|
showHeaderOverflow,
|
|
3072
3203
|
showFooterOverflow,
|
|
@@ -3132,22 +3263,25 @@ const Methods = {
|
|
|
3132
3263
|
* 处理固定列的显示状态
|
|
3133
3264
|
*/
|
|
3134
3265
|
checkScrolling() {
|
|
3266
|
+
const $xeTable = this;
|
|
3135
3267
|
const {
|
|
3136
3268
|
tableBody,
|
|
3137
3269
|
leftContainer,
|
|
3138
3270
|
rightContainer
|
|
3139
|
-
} =
|
|
3271
|
+
} = $xeTable.$refs;
|
|
3140
3272
|
const bodyElem = tableBody ? tableBody.$el : null;
|
|
3141
|
-
|
|
3273
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
3274
|
+
const bodtTargetEl = xHandleEl || bodyElem;
|
|
3275
|
+
if (bodtTargetEl) {
|
|
3142
3276
|
if (leftContainer) {
|
|
3143
|
-
if (
|
|
3277
|
+
if (bodtTargetEl.scrollLeft > 0) {
|
|
3144
3278
|
(0, _dom.addClass)(leftContainer, 'scrolling--middle');
|
|
3145
3279
|
} else {
|
|
3146
3280
|
(0, _dom.removeClass)(leftContainer, 'scrolling--middle');
|
|
3147
3281
|
}
|
|
3148
3282
|
}
|
|
3149
3283
|
if (rightContainer) {
|
|
3150
|
-
if (
|
|
3284
|
+
if (bodtTargetEl.clientWidth < bodtTargetEl.scrollWidth - Math.ceil(bodtTargetEl.scrollLeft)) {
|
|
3151
3285
|
(0, _dom.addClass)(rightContainer, 'scrolling--middle');
|
|
3152
3286
|
} else {
|
|
3153
3287
|
(0, _dom.removeClass)(rightContainer, 'scrolling--middle');
|
|
@@ -5548,8 +5682,8 @@ const Methods = {
|
|
|
5548
5682
|
const {
|
|
5549
5683
|
fullAllDataRowIdData
|
|
5550
5684
|
} = this;
|
|
5551
|
-
const
|
|
5552
|
-
return
|
|
5685
|
+
const rowRest = fullAllDataRowIdData[(0, _util.getRowid)($xeTable, row)];
|
|
5686
|
+
return rowRest && !!rowRest.expandLoaded;
|
|
5553
5687
|
},
|
|
5554
5688
|
clearRowExpandLoaded(row) {
|
|
5555
5689
|
const $xeTable = this;
|
|
@@ -5562,9 +5696,9 @@ const Methods = {
|
|
|
5562
5696
|
lazy
|
|
5563
5697
|
} = expandOpts;
|
|
5564
5698
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
5565
|
-
const
|
|
5566
|
-
if (lazy &&
|
|
5567
|
-
|
|
5699
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
5700
|
+
if (lazy && rowRest) {
|
|
5701
|
+
rowRest.expandLoaded = false;
|
|
5568
5702
|
const rowTempExpandLazyLoadedMaps = Object.assign({}, rowExpandLazyLoadedMaps);
|
|
5569
5703
|
if (rowTempExpandLazyLoadedMaps[rowid]) {
|
|
5570
5704
|
delete rowTempExpandLazyLoadedMaps[rowid];
|
|
@@ -5704,7 +5838,7 @@ const Methods = {
|
|
|
5704
5838
|
fullAllDataRowIdData
|
|
5705
5839
|
} = this;
|
|
5706
5840
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
5707
|
-
const
|
|
5841
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
5708
5842
|
rowExpandLazyLoadedMaps[rowid] = row;
|
|
5709
5843
|
loadMethod({
|
|
5710
5844
|
$table: $xeTable,
|
|
@@ -5715,10 +5849,10 @@ const Methods = {
|
|
|
5715
5849
|
const {
|
|
5716
5850
|
rowExpandedMaps
|
|
5717
5851
|
} = this;
|
|
5718
|
-
|
|
5852
|
+
rowRest.expandLoaded = true;
|
|
5719
5853
|
rowExpandedMaps[rowid] = row;
|
|
5720
5854
|
}).catch(() => {
|
|
5721
|
-
|
|
5855
|
+
rowRest.expandLoaded = false;
|
|
5722
5856
|
}).finally(() => {
|
|
5723
5857
|
const {
|
|
5724
5858
|
rowExpandLazyLoadedMaps
|
|
@@ -5780,8 +5914,8 @@ const Methods = {
|
|
|
5780
5914
|
validRows.forEach(row => {
|
|
5781
5915
|
const rowid = (0, _util.getRowid)(this, row);
|
|
5782
5916
|
if (!rExpandedMaps[rowid]) {
|
|
5783
|
-
const
|
|
5784
|
-
const isLoad = lazy && !
|
|
5917
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
5918
|
+
const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
|
|
5785
5919
|
if (isLoad) {
|
|
5786
5920
|
lazyRests.push(this.handleAsyncRowExpand(row));
|
|
5787
5921
|
} else {
|
|
@@ -5901,8 +6035,8 @@ const Methods = {
|
|
|
5901
6035
|
const {
|
|
5902
6036
|
fullAllDataRowIdData
|
|
5903
6037
|
} = this;
|
|
5904
|
-
const
|
|
5905
|
-
return
|
|
6038
|
+
const rowRest = fullAllDataRowIdData[(0, _util.getRowid)($xeTable, row)];
|
|
6039
|
+
return rowRest && !!rowRest.treeLoaded;
|
|
5906
6040
|
},
|
|
5907
6041
|
clearTreeExpandLoaded(row) {
|
|
5908
6042
|
const $xeTable = this;
|
|
@@ -5916,9 +6050,9 @@ const Methods = {
|
|
|
5916
6050
|
lazy
|
|
5917
6051
|
} = treeOpts;
|
|
5918
6052
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
5919
|
-
const
|
|
5920
|
-
if (lazy &&
|
|
5921
|
-
|
|
6053
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6054
|
+
if (lazy && rowRest) {
|
|
6055
|
+
rowRest.treeLoaded = false;
|
|
5922
6056
|
if (treeExpandedMaps[rowid]) {
|
|
5923
6057
|
delete treeExpandedMaps[rowid];
|
|
5924
6058
|
}
|
|
@@ -6058,13 +6192,13 @@ const Methods = {
|
|
|
6058
6192
|
fullAllDataRowIdData
|
|
6059
6193
|
} = this;
|
|
6060
6194
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
6061
|
-
const
|
|
6195
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6062
6196
|
treeExpandLazyLoadedMaps[rowid] = row;
|
|
6063
6197
|
Promise.resolve(loadMethod({
|
|
6064
6198
|
$table: $xeTable,
|
|
6065
6199
|
row
|
|
6066
6200
|
})).then(childRecords => {
|
|
6067
|
-
|
|
6201
|
+
rowRest.treeLoaded = true;
|
|
6068
6202
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
6069
6203
|
delete treeExpandLazyLoadedMaps[rowid];
|
|
6070
6204
|
}
|
|
@@ -6094,7 +6228,7 @@ const Methods = {
|
|
|
6094
6228
|
const {
|
|
6095
6229
|
treeExpandLazyLoadedMaps
|
|
6096
6230
|
} = this;
|
|
6097
|
-
|
|
6231
|
+
rowRest.treeLoaded = false;
|
|
6098
6232
|
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
6099
6233
|
delete treeExpandLazyLoadedMaps[rowid];
|
|
6100
6234
|
}
|
|
@@ -6183,8 +6317,8 @@ const Methods = {
|
|
|
6183
6317
|
validRows.forEach(row => {
|
|
6184
6318
|
const rowid = (0, _util.getRowid)(this, row);
|
|
6185
6319
|
if (!treeTempExpandedMaps[rowid]) {
|
|
6186
|
-
const
|
|
6187
|
-
const isLoad = lazy && row[hasChildField] && !
|
|
6320
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6321
|
+
const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
|
|
6188
6322
|
// 是否使用懒加载
|
|
6189
6323
|
if (isLoad) {
|
|
6190
6324
|
result.push(this.handleAsyncTreeExpandChilds(row));
|
|
@@ -6348,7 +6482,7 @@ const Methods = {
|
|
|
6348
6482
|
const {
|
|
6349
6483
|
toVisibleIndex,
|
|
6350
6484
|
visibleSize
|
|
6351
|
-
} =
|
|
6485
|
+
} = handleVirtualXVisible(this);
|
|
6352
6486
|
const offsetItem = {
|
|
6353
6487
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
6354
6488
|
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
@@ -6367,10 +6501,46 @@ const Methods = {
|
|
|
6367
6501
|
}
|
|
6368
6502
|
this.closeTooltip();
|
|
6369
6503
|
},
|
|
6504
|
+
handleScrollEvent(evnt, isRollY, isRollX, params) {
|
|
6505
|
+
const $xeTable = this;
|
|
6506
|
+
const props = $xeTable;
|
|
6507
|
+
const {
|
|
6508
|
+
highlightHoverRow
|
|
6509
|
+
} = props;
|
|
6510
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
6511
|
+
const bodyElem = tableBody ? tableBody.$el : null;
|
|
6512
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
6513
|
+
const validTip = $xeTable.$refs.validTip;
|
|
6514
|
+
const tooltip = $xeTable.$refs.tooltip;
|
|
6515
|
+
if (rowOpts.isHover || highlightHoverRow) {
|
|
6516
|
+
$xeTable.clearHoverRow();
|
|
6517
|
+
}
|
|
6518
|
+
if (validTip && validTip.visible) {
|
|
6519
|
+
validTip.close();
|
|
6520
|
+
}
|
|
6521
|
+
if (tooltip && tooltip.visible) {
|
|
6522
|
+
tooltip.close();
|
|
6523
|
+
}
|
|
6524
|
+
if (isRollX) {
|
|
6525
|
+
$xeTable.checkScrolling();
|
|
6526
|
+
}
|
|
6527
|
+
const bodyHeight = bodyElem ? bodyElem.clientHeight : 0;
|
|
6528
|
+
const bodyWidth = bodyElem ? bodyElem.clientWidth : 0;
|
|
6529
|
+
const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0;
|
|
6530
|
+
const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0;
|
|
6531
|
+
$xeTable.dispatchEvent('scroll', Object.assign({
|
|
6532
|
+
bodyHeight,
|
|
6533
|
+
bodyWidth,
|
|
6534
|
+
scrollHeight,
|
|
6535
|
+
scrollWidth,
|
|
6536
|
+
isX: isRollX,
|
|
6537
|
+
isY: isRollY
|
|
6538
|
+
}, params), evnt);
|
|
6539
|
+
},
|
|
6370
6540
|
/**
|
|
6371
6541
|
* 纵向 Y 可视渲染事件处理
|
|
6372
6542
|
*/
|
|
6373
|
-
triggerScrollYEvent(
|
|
6543
|
+
triggerScrollYEvent() {
|
|
6374
6544
|
const {
|
|
6375
6545
|
scrollYStore
|
|
6376
6546
|
} = this;
|
|
@@ -6381,21 +6551,84 @@ const Methods = {
|
|
|
6381
6551
|
} = scrollYStore;
|
|
6382
6552
|
// webkit 浏览器使用最佳的渲染方式,且最高渲染量不能大于 40 条
|
|
6383
6553
|
if (isWebkit && adaptive && offsetSize * 2 + visibleSize <= 40) {
|
|
6384
|
-
this.loadScrollYData(
|
|
6554
|
+
this.loadScrollYData();
|
|
6385
6555
|
} else {
|
|
6386
|
-
this.
|
|
6556
|
+
this.debounceScrollYData();
|
|
6387
6557
|
}
|
|
6558
|
+
this.debounceScrollYCalculate();
|
|
6388
6559
|
},
|
|
6389
|
-
|
|
6390
|
-
this.loadScrollYData(
|
|
6560
|
+
debounceScrollYData: _xeUtils.default.debounce(function () {
|
|
6561
|
+
this.loadScrollYData();
|
|
6391
6562
|
}, debounceScrollYDuration, {
|
|
6392
6563
|
leading: false,
|
|
6393
6564
|
trailing: true
|
|
6394
6565
|
}),
|
|
6566
|
+
scrollXEvent(evnt) {
|
|
6567
|
+
const $xeTable = this;
|
|
6568
|
+
const wrapperEl = evnt.currentTarget;
|
|
6569
|
+
const tableHeader = $xeTable.$refs.tableHeader;
|
|
6570
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
6571
|
+
const tableFooter = $xeTable.$refs.tableFooter;
|
|
6572
|
+
const bodyElem = tableBody.$el;
|
|
6573
|
+
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
6574
|
+
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
6575
|
+
const {
|
|
6576
|
+
scrollTop,
|
|
6577
|
+
scrollLeft
|
|
6578
|
+
} = wrapperEl;
|
|
6579
|
+
const isRollX = true;
|
|
6580
|
+
const isRollY = false;
|
|
6581
|
+
$xeTable.lastScrollLeft = scrollLeft;
|
|
6582
|
+
$xeTable.lastScrollTime = Date.now();
|
|
6583
|
+
(0, _dom.setScrollLeft)(bodyElem, scrollLeft);
|
|
6584
|
+
(0, _dom.setScrollLeft)(headerElem, scrollLeft);
|
|
6585
|
+
(0, _dom.setScrollLeft)(footerElem, scrollLeft);
|
|
6586
|
+
$xeTable.triggerScrollXEvent(evnt);
|
|
6587
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
6588
|
+
type: 'table',
|
|
6589
|
+
fixed: '',
|
|
6590
|
+
scrollTop,
|
|
6591
|
+
scrollLeft
|
|
6592
|
+
});
|
|
6593
|
+
},
|
|
6594
|
+
debounceScrollYCalculate: _xeUtils.default.debounce(function () {
|
|
6595
|
+
this.updateScrollYSpace();
|
|
6596
|
+
}, 1000, {
|
|
6597
|
+
leading: false,
|
|
6598
|
+
trailing: true
|
|
6599
|
+
}),
|
|
6600
|
+
scrollYEvent(evnt) {
|
|
6601
|
+
const $xeTable = this;
|
|
6602
|
+
const wrapperEl = evnt.currentTarget;
|
|
6603
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
6604
|
+
const leftBody = $xeTable.$refs.leftBody;
|
|
6605
|
+
const rightBody = $xeTable.$refs.rightBody;
|
|
6606
|
+
const bodyElem = tableBody.$el;
|
|
6607
|
+
const leftElem = leftBody ? leftBody.$el : null;
|
|
6608
|
+
const rightElem = rightBody ? rightBody.$el : null;
|
|
6609
|
+
const {
|
|
6610
|
+
scrollTop,
|
|
6611
|
+
scrollLeft
|
|
6612
|
+
} = wrapperEl;
|
|
6613
|
+
const isRollX = false;
|
|
6614
|
+
const isRollY = true;
|
|
6615
|
+
$xeTable.lastScrollTop = scrollTop;
|
|
6616
|
+
$xeTable.lastScrollTime = Date.now();
|
|
6617
|
+
(0, _dom.setScrollTop)(bodyElem, scrollTop);
|
|
6618
|
+
(0, _dom.setScrollTop)(leftElem, scrollTop);
|
|
6619
|
+
(0, _dom.setScrollTop)(rightElem, scrollTop);
|
|
6620
|
+
$xeTable.triggerScrollYEvent(evnt);
|
|
6621
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
6622
|
+
type: 'table',
|
|
6623
|
+
fixed: '',
|
|
6624
|
+
scrollTop,
|
|
6625
|
+
scrollLeft
|
|
6626
|
+
});
|
|
6627
|
+
},
|
|
6395
6628
|
/**
|
|
6396
6629
|
* 纵向 Y 可视渲染处理
|
|
6397
6630
|
*/
|
|
6398
|
-
loadScrollYData(
|
|
6631
|
+
loadScrollYData() {
|
|
6399
6632
|
const {
|
|
6400
6633
|
mergeList,
|
|
6401
6634
|
scrollYStore
|
|
@@ -6403,13 +6636,12 @@ const Methods = {
|
|
|
6403
6636
|
const {
|
|
6404
6637
|
startIndex,
|
|
6405
6638
|
endIndex,
|
|
6406
|
-
|
|
6407
|
-
offsetSize,
|
|
6408
|
-
rowHeight
|
|
6639
|
+
offsetSize
|
|
6409
6640
|
} = scrollYStore;
|
|
6410
|
-
const
|
|
6411
|
-
|
|
6412
|
-
|
|
6641
|
+
const {
|
|
6642
|
+
toVisibleIndex,
|
|
6643
|
+
visibleSize
|
|
6644
|
+
} = handleVirtualYVisible(this);
|
|
6413
6645
|
const offsetItem = {
|
|
6414
6646
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
6415
6647
|
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
@@ -6442,7 +6674,7 @@ const Methods = {
|
|
|
6442
6674
|
if (scrollXLoad) {
|
|
6443
6675
|
const {
|
|
6444
6676
|
visibleSize: visibleXSize
|
|
6445
|
-
} =
|
|
6677
|
+
} = handleVirtualXVisible(this);
|
|
6446
6678
|
const offsetXSize = sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
|
|
6447
6679
|
scrollXStore.offsetSize = offsetXSize;
|
|
6448
6680
|
scrollXStore.visibleSize = visibleXSize;
|
|
@@ -6451,12 +6683,14 @@ const Methods = {
|
|
|
6451
6683
|
} else {
|
|
6452
6684
|
this.updateScrollXSpace();
|
|
6453
6685
|
}
|
|
6686
|
+
calcCellHeight(this);
|
|
6454
6687
|
// 计算 Y 逻辑
|
|
6688
|
+
const rowHeight = computeRowHeight(this);
|
|
6689
|
+
scrollYStore.rowHeight = rowHeight;
|
|
6690
|
+
this.rowHeight = rowHeight;
|
|
6455
6691
|
const {
|
|
6456
|
-
rowHeight,
|
|
6457
6692
|
visibleSize: visibleYSize
|
|
6458
|
-
} =
|
|
6459
|
-
scrollYStore.rowHeight = rowHeight;
|
|
6693
|
+
} = handleVirtualYVisible(this);
|
|
6460
6694
|
if (scrollYLoad) {
|
|
6461
6695
|
const offsetYSize = sYOpts.oSize ? _xeUtils.default.toNumber(sYOpts.oSize) : _dom.browse.msie ? 20 : _dom.browse.edge ? 10 : 0;
|
|
6462
6696
|
scrollYStore.offsetSize = offsetYSize;
|
|
@@ -6466,7 +6700,6 @@ const Methods = {
|
|
|
6466
6700
|
} else {
|
|
6467
6701
|
this.updateScrollYSpace();
|
|
6468
6702
|
}
|
|
6469
|
-
this.rowHeight = rowHeight;
|
|
6470
6703
|
this.$nextTick(this.updateStyle);
|
|
6471
6704
|
});
|
|
6472
6705
|
},
|
|
@@ -6474,9 +6707,18 @@ const Methods = {
|
|
|
6474
6707
|
const {
|
|
6475
6708
|
scrollXLoad,
|
|
6476
6709
|
visibleColumn,
|
|
6477
|
-
scrollXStore
|
|
6710
|
+
scrollXStore,
|
|
6711
|
+
fullColumnIdData
|
|
6478
6712
|
} = this;
|
|
6479
|
-
|
|
6713
|
+
const tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0);
|
|
6714
|
+
tableColumn.forEach((column, $index) => {
|
|
6715
|
+
const colid = column.id;
|
|
6716
|
+
const colRest = fullColumnIdData[colid];
|
|
6717
|
+
if (colRest) {
|
|
6718
|
+
colRest.$index = $index;
|
|
6719
|
+
}
|
|
6720
|
+
});
|
|
6721
|
+
this.tableColumn = tableColumn;
|
|
6480
6722
|
},
|
|
6481
6723
|
updateScrollXData() {
|
|
6482
6724
|
// this.tableColumn = []
|
|
@@ -6487,6 +6729,7 @@ const Methods = {
|
|
|
6487
6729
|
},
|
|
6488
6730
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
6489
6731
|
updateScrollXSpace() {
|
|
6732
|
+
const $xeTable = this;
|
|
6490
6733
|
const {
|
|
6491
6734
|
$refs,
|
|
6492
6735
|
isGroup,
|
|
@@ -6496,7 +6739,7 @@ const Methods = {
|
|
|
6496
6739
|
scrollXLoad,
|
|
6497
6740
|
tableWidth,
|
|
6498
6741
|
scrollbarWidth
|
|
6499
|
-
} =
|
|
6742
|
+
} = $xeTable;
|
|
6500
6743
|
const {
|
|
6501
6744
|
tableHeader,
|
|
6502
6745
|
tableBody,
|
|
@@ -6531,34 +6774,64 @@ const Methods = {
|
|
|
6531
6774
|
}
|
|
6532
6775
|
});
|
|
6533
6776
|
});
|
|
6777
|
+
const scrollXSpaceEl = $xeTable.$refs.refScrollXSpaceElem;
|
|
6778
|
+
if (scrollXSpaceEl) {
|
|
6779
|
+
scrollXSpaceEl.style.width = `${tableWidth + scrollbarWidth}px`;
|
|
6780
|
+
}
|
|
6534
6781
|
this.$nextTick(this.updateStyle);
|
|
6535
6782
|
}
|
|
6536
6783
|
},
|
|
6537
6784
|
updateScrollYData() {
|
|
6785
|
+
const $xeTable = this;
|
|
6538
6786
|
// this.tableData = []
|
|
6539
6787
|
this.$nextTick(() => {
|
|
6540
6788
|
this.handleTableData();
|
|
6789
|
+
calcCellHeight($xeTable);
|
|
6541
6790
|
this.updateScrollYSpace();
|
|
6542
6791
|
});
|
|
6543
6792
|
},
|
|
6544
6793
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
6545
6794
|
updateScrollYSpace() {
|
|
6795
|
+
const $xeTable = this;
|
|
6546
6796
|
const {
|
|
6797
|
+
showOverflow,
|
|
6547
6798
|
elemStore,
|
|
6548
6799
|
scrollYStore,
|
|
6549
6800
|
scrollYLoad,
|
|
6550
|
-
afterFullData
|
|
6801
|
+
afterFullData,
|
|
6802
|
+
fullAllDataRowIdData
|
|
6551
6803
|
} = this;
|
|
6552
6804
|
const {
|
|
6553
6805
|
startIndex,
|
|
6554
6806
|
rowHeight
|
|
6555
6807
|
} = scrollYStore;
|
|
6556
|
-
|
|
6557
|
-
|
|
6808
|
+
let bodyHeight = 0;
|
|
6809
|
+
let topSpaceHeight = 0;
|
|
6558
6810
|
const containerList = ['main', 'left', 'right'];
|
|
6559
6811
|
let marginTop = '';
|
|
6560
6812
|
let ySpaceHeight = '';
|
|
6561
6813
|
if (scrollYLoad) {
|
|
6814
|
+
if (showOverflow) {
|
|
6815
|
+
bodyHeight = afterFullData.length * rowHeight;
|
|
6816
|
+
topSpaceHeight = Math.max(0, startIndex * rowHeight);
|
|
6817
|
+
} else {
|
|
6818
|
+
for (let i = 0; i < afterFullData.length; i++) {
|
|
6819
|
+
const row = afterFullData[i];
|
|
6820
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
6821
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6822
|
+
if (rowRest) {
|
|
6823
|
+
bodyHeight += rowRest.height || rowHeight;
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
for (let i = 0; i < startIndex; i++) {
|
|
6827
|
+
const row = afterFullData[i];
|
|
6828
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
6829
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
6830
|
+
if (rowRest) {
|
|
6831
|
+
topSpaceHeight += rowRest.height || rowHeight;
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
}
|
|
6562
6835
|
marginTop = `${topSpaceHeight}px`;
|
|
6563
6836
|
ySpaceHeight = `${bodyHeight}px`;
|
|
6564
6837
|
}
|
|
@@ -6575,6 +6848,10 @@ const Methods = {
|
|
|
6575
6848
|
}
|
|
6576
6849
|
});
|
|
6577
6850
|
});
|
|
6851
|
+
const scrollYSpaceEl = $xeTable.$refs.refScrollYSpaceElem;
|
|
6852
|
+
if (scrollYSpaceEl) {
|
|
6853
|
+
scrollYSpaceEl.style.height = ySpaceHeight;
|
|
6854
|
+
}
|
|
6578
6855
|
this.$nextTick(this.updateStyle);
|
|
6579
6856
|
},
|
|
6580
6857
|
/**
|
|
@@ -6667,36 +6944,52 @@ const Methods = {
|
|
|
6667
6944
|
* 手动清除滚动相关信息,还原到初始状态
|
|
6668
6945
|
*/
|
|
6669
6946
|
clearScroll() {
|
|
6947
|
+
const $xeTable = this;
|
|
6670
6948
|
const {
|
|
6671
6949
|
$refs,
|
|
6672
6950
|
scrollXStore,
|
|
6673
6951
|
scrollYStore
|
|
6674
|
-
} =
|
|
6952
|
+
} = $xeTable;
|
|
6675
6953
|
const {
|
|
6676
6954
|
tableBody,
|
|
6955
|
+
tableHeader,
|
|
6956
|
+
leftBody,
|
|
6677
6957
|
rightBody,
|
|
6678
6958
|
tableFooter
|
|
6679
6959
|
} = $refs;
|
|
6680
6960
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
6961
|
+
const leftBodyElem = leftBody ? leftBody.$el : null;
|
|
6681
6962
|
const rightBodyElem = rightBody ? rightBody.$el : null;
|
|
6963
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
6682
6964
|
const tableFooterElem = tableFooter ? tableFooter.$el : null;
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
}
|
|
6687
|
-
|
|
6688
|
-
|
|
6965
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
6966
|
+
if (xHandleEl) {
|
|
6967
|
+
(0, _dom.setScrollLeft)(xHandleEl, 0);
|
|
6968
|
+
} else {
|
|
6969
|
+
(0, _dom.setScrollLeft)(tableBodyElem, 0);
|
|
6970
|
+
(0, _dom.setScrollLeft)(tableHeaderElem, 0);
|
|
6971
|
+
(0, _dom.setScrollLeft)(tableFooterElem, 0);
|
|
6689
6972
|
}
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6973
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem;
|
|
6974
|
+
if (yHandleEl) {
|
|
6975
|
+
(0, _dom.setScrollTop)(yHandleEl, 0);
|
|
6976
|
+
} else {
|
|
6977
|
+
(0, _dom.setScrollTop)(tableBodyElem, 0);
|
|
6978
|
+
(0, _dom.setScrollTop)(leftBodyElem, 0);
|
|
6979
|
+
(0, _dom.setScrollTop)(rightBodyElem, 0);
|
|
6694
6980
|
}
|
|
6695
6981
|
scrollXStore.startIndex = 0;
|
|
6696
6982
|
scrollXStore.endIndex = scrollXStore.visibleSize;
|
|
6697
6983
|
scrollYStore.startIndex = 0;
|
|
6698
6984
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
6699
|
-
return
|
|
6985
|
+
return $xeTable.$nextTick().then(() => {
|
|
6986
|
+
(0, _dom.setScrollLeft)(tableBodyElem, 0);
|
|
6987
|
+
(0, _dom.setScrollLeft)(tableHeaderElem, 0);
|
|
6988
|
+
(0, _dom.setScrollLeft)(tableFooterElem, 0);
|
|
6989
|
+
(0, _dom.setScrollTop)(tableBodyElem, 0);
|
|
6990
|
+
(0, _dom.setScrollTop)(leftBodyElem, 0);
|
|
6991
|
+
(0, _dom.setScrollTop)(rightBodyElem, 0);
|
|
6992
|
+
});
|
|
6700
6993
|
},
|
|
6701
6994
|
/**
|
|
6702
6995
|
* 更新表尾合计
|
|
@@ -6869,6 +7162,14 @@ const Methods = {
|
|
|
6869
7162
|
}
|
|
6870
7163
|
return this.$nextTick();
|
|
6871
7164
|
},
|
|
7165
|
+
dispatchEvent(type, params, evnt) {
|
|
7166
|
+
const $xeTable = this;
|
|
7167
|
+
$xeTable.$emit(type, createEvent(evnt, {
|
|
7168
|
+
$table: $xeTable,
|
|
7169
|
+
$grid: $xeTable.$xegrid
|
|
7170
|
+
}, params));
|
|
7171
|
+
},
|
|
7172
|
+
// 已废弃,使用 dispatchEvent
|
|
6872
7173
|
emitEvent(type, params, evnt) {
|
|
6873
7174
|
this.$emit(type, Object.assign({
|
|
6874
7175
|
$table: this,
|