vxe-table 3.11.5 → 3.11.6-beta.1
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/index.css +1 -0
- package/es/index.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/filter/mixin.js +23 -2
- package/es/table/module/filter/panel.js +3 -6
- package/es/table/src/body.js +55 -30
- package/es/table/src/footer.js +30 -22
- package/es/table/src/methods.js +253 -110
- package/es/table/src/table.js +11 -3
- package/es/table/style.css +48 -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 +48 -3
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -0
- package/lib/index.min.css +1 -0
- package/lib/index.umd.js +436 -197
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/filter/mixin.js +25 -2
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +3 -7
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/src/body.js +65 -32
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +32 -23
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/methods.js +293 -128
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +16 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +48 -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 +48 -3
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/filter/mixin.ts +26 -2
- package/packages/table/module/filter/panel.ts +3 -6
- package/packages/table/src/body.ts +66 -27
- package/packages/table/src/footer.ts +33 -21
- package/packages/table/src/methods.ts +266 -113
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +2 -2
- package/styles/components/table.scss +24 -3
- /package/es/{iconfont.1732091003142.ttf → iconfont.1732506597105.ttf} +0 -0
- /package/es/{iconfont.1732091003142.woff → iconfont.1732506597105.woff} +0 -0
- /package/es/{iconfont.1732091003142.woff2 → iconfont.1732506597105.woff2} +0 -0
- /package/lib/{iconfont.1732091003142.ttf → iconfont.1732506597105.ttf} +0 -0
- /package/lib/{iconfont.1732091003142.woff → iconfont.1732506597105.woff} +0 -0
- /package/lib/{iconfont.1732091003142.woff2 → iconfont.1732506597105.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -7,8 +7,8 @@ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible,
|
|
|
7
7
|
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
|
-
const isWebkit = browse['-webkit'] && !browse.edge
|
|
11
|
-
const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
10
|
+
// const isWebkit = browse['-webkit'] && !browse.edge
|
|
11
|
+
// const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
12
12
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
13
13
|
// 获取所有的列,排除分组
|
|
14
14
|
const getColumnList = (columns) => {
|
|
@@ -95,25 +95,28 @@ function handleVirtualXVisible(_vm) {
|
|
|
95
95
|
return { toVisibleIndex: 0, visibleSize: 6 };
|
|
96
96
|
}
|
|
97
97
|
const computeRowHeight = ($xeTable) => {
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
const
|
|
98
|
+
const props = $xeTable;
|
|
99
|
+
const { showOverflow } = props;
|
|
100
|
+
const tableHeader = $xeTable.$refs.tableHeader;
|
|
101
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
101
102
|
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
102
|
-
const vSize = computeSize;
|
|
103
|
+
const vSize = $xeTable.computeSize;
|
|
103
104
|
const rowHeightMaps = $xeTable.rowHeightMaps;
|
|
104
105
|
let rowHeight = 0;
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
firstTrElem
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
rowHeight
|
|
106
|
+
if (showOverflow) {
|
|
107
|
+
if (tableBodyElem) {
|
|
108
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null;
|
|
109
|
+
let firstTrElem;
|
|
110
|
+
firstTrElem = tableBodyElem.querySelector('tr');
|
|
111
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
112
|
+
firstTrElem = tableHeaderElem.querySelector('tr');
|
|
113
|
+
}
|
|
114
|
+
if (firstTrElem) {
|
|
115
|
+
rowHeight = firstTrElem.clientHeight;
|
|
116
|
+
}
|
|
117
|
+
if (!rowHeight) {
|
|
118
|
+
rowHeight = rowHeightMaps[vSize || 'default'];
|
|
119
|
+
}
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
return rowHeight;
|
|
@@ -271,20 +274,42 @@ function calcTableHeight(_vm, key) {
|
|
|
271
274
|
return num;
|
|
272
275
|
}
|
|
273
276
|
const calcCellHeight = ($xeTable) => {
|
|
274
|
-
const
|
|
277
|
+
const props = $xeTable;
|
|
278
|
+
const reactData = $xeTable;
|
|
279
|
+
const internalData = $xeTable;
|
|
280
|
+
const { showOverflow } = props;
|
|
281
|
+
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
282
|
+
const { fullAllDataRowIdData } = internalData;
|
|
275
283
|
const el = $xeTable.$el;
|
|
276
|
-
if (scrollYLoad && el) {
|
|
284
|
+
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
285
|
+
let paddingTop = 0;
|
|
286
|
+
let paddingBottom = 0;
|
|
287
|
+
let calcPadding = false;
|
|
277
288
|
tableData.forEach((row) => {
|
|
278
289
|
const rowid = getRowid($xeTable, row);
|
|
279
|
-
const
|
|
290
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
280
291
|
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
|
|
281
|
-
if (
|
|
292
|
+
if (rowRest && trList.length) {
|
|
282
293
|
let height = 0;
|
|
283
294
|
for (let i = 0; i < trList.length; i++) {
|
|
284
295
|
const trEl = trList[i];
|
|
285
|
-
|
|
296
|
+
const tdList = trEl.children;
|
|
297
|
+
for (let j = 0; j < tdList.length; j++) {
|
|
298
|
+
const tdEl = tdList[j];
|
|
299
|
+
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
300
|
+
if (!calcPadding) {
|
|
301
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
302
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
303
|
+
calcPadding = true;
|
|
304
|
+
}
|
|
305
|
+
let cellHeight = paddingTop + paddingBottom;
|
|
306
|
+
if (cellElem) {
|
|
307
|
+
cellHeight += cellElem.offsetHeight;
|
|
308
|
+
}
|
|
309
|
+
height = Math.max(height, cellHeight);
|
|
310
|
+
}
|
|
286
311
|
}
|
|
287
|
-
|
|
312
|
+
rowRest.height = height;
|
|
288
313
|
}
|
|
289
314
|
});
|
|
290
315
|
}
|
|
@@ -449,6 +474,47 @@ const handleScrollToRowColumn = ($xeTable, fieldOrColumn, row) => {
|
|
|
449
474
|
}
|
|
450
475
|
return $xeTable.$nextTick();
|
|
451
476
|
};
|
|
477
|
+
function handleRecalculateLayout($xeTable, reFull) {
|
|
478
|
+
const el = $xeTable.$refs.refElem;
|
|
479
|
+
if (!el || !el.clientWidth) {
|
|
480
|
+
return $xeTable.$nextTick();
|
|
481
|
+
}
|
|
482
|
+
$xeTable.calcCellWidth();
|
|
483
|
+
$xeTable.autoCellWidth();
|
|
484
|
+
if (reFull === true) {
|
|
485
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
486
|
+
return $xeTable.computeScrollLoad().then(() => {
|
|
487
|
+
calcCellHeight($xeTable);
|
|
488
|
+
$xeTable.calcCellWidth();
|
|
489
|
+
$xeTable.autoCellWidth();
|
|
490
|
+
return $xeTable.computeScrollLoad();
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
return $xeTable.computeScrollLoad();
|
|
494
|
+
}
|
|
495
|
+
function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
496
|
+
const reactData = $xeTable;
|
|
497
|
+
const internalData = $xeTable;
|
|
498
|
+
const { scrollXLoad, scrollYLoad } = reactData;
|
|
499
|
+
const { lcsTimeout } = internalData;
|
|
500
|
+
if (lcsTimeout) {
|
|
501
|
+
clearTimeout(lcsTimeout);
|
|
502
|
+
}
|
|
503
|
+
internalData.lcsTimeout = setTimeout(() => {
|
|
504
|
+
internalData.lcsTimeout = undefined;
|
|
505
|
+
internalData.inVirtualScroll = false;
|
|
506
|
+
internalData.inBodyScroll = false;
|
|
507
|
+
internalData.bodyScrollType = '';
|
|
508
|
+
internalData.inFooterScroll = false;
|
|
509
|
+
if (isRollX && scrollXLoad) {
|
|
510
|
+
$xeTable.updateScrollXData();
|
|
511
|
+
}
|
|
512
|
+
if (isRollY && scrollYLoad) {
|
|
513
|
+
$xeTable.updateScrollYData();
|
|
514
|
+
}
|
|
515
|
+
$xeTable.updateCellAreas();
|
|
516
|
+
}, 200);
|
|
517
|
+
}
|
|
452
518
|
const Methods = {
|
|
453
519
|
callSlot(slotFunc, params, h, vNodes) {
|
|
454
520
|
if (slotFunc) {
|
|
@@ -2441,22 +2507,21 @@ const Methods = {
|
|
|
2441
2507
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2442
2508
|
*/
|
|
2443
2509
|
recalculate(reFull) {
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2510
|
+
const $xeTable = this;
|
|
2511
|
+
const internalData = $xeTable;
|
|
2512
|
+
const { rceTimeout } = internalData;
|
|
2513
|
+
if (rceTimeout) {
|
|
2514
|
+
clearTimeout(rceTimeout);
|
|
2447
2515
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
this.autoCellWidth();
|
|
2451
|
-
if (reFull === true) {
|
|
2452
|
-
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2453
|
-
return this.computeScrollLoad().then(() => {
|
|
2454
|
-
calcCellHeight(this);
|
|
2455
|
-
this.autoCellWidth();
|
|
2456
|
-
return this.computeScrollLoad();
|
|
2457
|
-
});
|
|
2516
|
+
else {
|
|
2517
|
+
handleRecalculateLayout($xeTable, !!reFull);
|
|
2458
2518
|
}
|
|
2459
|
-
return
|
|
2519
|
+
return new Promise(resolve => {
|
|
2520
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
2521
|
+
internalData.rceTimeout = undefined;
|
|
2522
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
2523
|
+
}, 20);
|
|
2524
|
+
});
|
|
2460
2525
|
},
|
|
2461
2526
|
calcCellWidth() {
|
|
2462
2527
|
const $xeTable = this;
|
|
@@ -2650,12 +2715,17 @@ const Methods = {
|
|
|
2650
2715
|
},
|
|
2651
2716
|
calcCellHeight() {
|
|
2652
2717
|
const $xeTable = this;
|
|
2718
|
+
const props = $xeTable;
|
|
2653
2719
|
const reactData = $xeTable;
|
|
2654
2720
|
const internalData = $xeTable;
|
|
2655
|
-
const {
|
|
2721
|
+
const { showOverflow } = props;
|
|
2722
|
+
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
2656
2723
|
const { fullAllDataRowIdData } = internalData;
|
|
2657
2724
|
const el = $xeTable.$el;
|
|
2658
|
-
if (scrollYLoad && el) {
|
|
2725
|
+
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
2726
|
+
let paddingTop = 0;
|
|
2727
|
+
let paddingBottom = 0;
|
|
2728
|
+
let calcPadding = false;
|
|
2659
2729
|
tableData.forEach((row) => {
|
|
2660
2730
|
const rowid = getRowid($xeTable, row);
|
|
2661
2731
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
@@ -2664,9 +2734,23 @@ const Methods = {
|
|
|
2664
2734
|
let height = 0;
|
|
2665
2735
|
for (let i = 0; i < trList.length; i++) {
|
|
2666
2736
|
const trEl = trList[i];
|
|
2667
|
-
|
|
2737
|
+
const tdList = trEl.children;
|
|
2738
|
+
for (let j = 0; j < tdList.length; j++) {
|
|
2739
|
+
const tdEl = tdList[j];
|
|
2740
|
+
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
2741
|
+
if (!calcPadding) {
|
|
2742
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
2743
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
2744
|
+
calcPadding = true;
|
|
2745
|
+
}
|
|
2746
|
+
let cellHeight = paddingTop + paddingBottom;
|
|
2747
|
+
if (cellElem) {
|
|
2748
|
+
cellHeight += cellElem.offsetHeight;
|
|
2749
|
+
}
|
|
2750
|
+
height = Math.max(height, cellHeight);
|
|
2751
|
+
}
|
|
2668
2752
|
}
|
|
2669
|
-
rowRest.height = height;
|
|
2753
|
+
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
2670
2754
|
}
|
|
2671
2755
|
});
|
|
2672
2756
|
}
|
|
@@ -5911,16 +5995,14 @@ const Methods = {
|
|
|
5911
5995
|
scrollLeft: bodyElem.scrollLeft
|
|
5912
5996
|
};
|
|
5913
5997
|
},
|
|
5914
|
-
/**
|
|
5915
|
-
* 横向 X 可视渲染事件处理
|
|
5916
|
-
*/
|
|
5917
|
-
triggerScrollXEvent() {
|
|
5918
|
-
this.loadScrollXData();
|
|
5919
|
-
},
|
|
5920
5998
|
loadScrollXData() {
|
|
5921
|
-
const
|
|
5999
|
+
const $xeTable = this;
|
|
6000
|
+
const reactData = $xeTable;
|
|
6001
|
+
const internalData = $xeTable;
|
|
6002
|
+
const { mergeList, mergeFooterList } = reactData;
|
|
6003
|
+
const { scrollXStore } = internalData;
|
|
5922
6004
|
const { startIndex, endIndex, offsetSize } = scrollXStore;
|
|
5923
|
-
const { toVisibleIndex, visibleSize } = handleVirtualXVisible(
|
|
6005
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable);
|
|
5924
6006
|
const offsetItem = {
|
|
5925
6007
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
5926
6008
|
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
@@ -5931,10 +6013,10 @@ const Methods = {
|
|
|
5931
6013
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
5932
6014
|
scrollXStore.startIndex = offsetStartIndex;
|
|
5933
6015
|
scrollXStore.endIndex = offsetEndIndex;
|
|
5934
|
-
|
|
6016
|
+
$xeTable.updateScrollXData();
|
|
5935
6017
|
}
|
|
5936
6018
|
}
|
|
5937
|
-
|
|
6019
|
+
$xeTable.closeTooltip();
|
|
5938
6020
|
},
|
|
5939
6021
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
5940
6022
|
const $xeTable = this;
|
|
@@ -5981,7 +6063,6 @@ const Methods = {
|
|
|
5981
6063
|
}
|
|
5982
6064
|
$xeTable.checkScrolling();
|
|
5983
6065
|
internalData.lastScrollLeft = scrollLeft;
|
|
5984
|
-
reactData.lastScrollTime = Date.now();
|
|
5985
6066
|
}
|
|
5986
6067
|
else {
|
|
5987
6068
|
const yThreshold = $xeTable.computeScrollYThreshold;
|
|
@@ -6002,8 +6083,8 @@ const Methods = {
|
|
|
6002
6083
|
}
|
|
6003
6084
|
}
|
|
6004
6085
|
internalData.lastScrollTop = scrollTop;
|
|
6005
|
-
reactData.lastScrollTime = Date.now();
|
|
6006
6086
|
}
|
|
6087
|
+
reactData.lastScrollTime = Date.now();
|
|
6007
6088
|
const evntParams = Object.assign({ scrollTop,
|
|
6008
6089
|
scrollLeft,
|
|
6009
6090
|
bodyHeight,
|
|
@@ -6014,6 +6095,7 @@ const Methods = {
|
|
|
6014
6095
|
isLeft,
|
|
6015
6096
|
isRight,
|
|
6016
6097
|
direction }, params);
|
|
6098
|
+
checkLastSyncScroll($xeTable, isRollX, isRollY);
|
|
6017
6099
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
6018
6100
|
$xeTable.clearHoverRow();
|
|
6019
6101
|
}
|
|
@@ -6028,71 +6110,124 @@ const Methods = {
|
|
|
6028
6110
|
}
|
|
6029
6111
|
$xeTable.dispatchEvent('scroll', evntParams, evnt);
|
|
6030
6112
|
},
|
|
6113
|
+
lazyScrollXData() {
|
|
6114
|
+
const $xeTable = this;
|
|
6115
|
+
const internalData = $xeTable;
|
|
6116
|
+
const { lxTimeout, lxRunTime, scrollXStore } = internalData;
|
|
6117
|
+
const { visibleSize } = scrollXStore;
|
|
6118
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 3));
|
|
6119
|
+
if (lxTimeout) {
|
|
6120
|
+
clearTimeout(lxTimeout);
|
|
6121
|
+
}
|
|
6122
|
+
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
6123
|
+
internalData.lxRunTime = Date.now();
|
|
6124
|
+
$xeTable.loadScrollXData();
|
|
6125
|
+
}
|
|
6126
|
+
internalData.lxTimeout = setTimeout(() => {
|
|
6127
|
+
internalData.lxRunTime = undefined;
|
|
6128
|
+
internalData.lxRunTime = undefined;
|
|
6129
|
+
$xeTable.loadScrollXData();
|
|
6130
|
+
}, fpsTime);
|
|
6131
|
+
},
|
|
6132
|
+
lazyScrollYData() {
|
|
6133
|
+
const $xeTable = this;
|
|
6134
|
+
const internalData = $xeTable;
|
|
6135
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData;
|
|
6136
|
+
const { visibleSize } = scrollYStore;
|
|
6137
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 2));
|
|
6138
|
+
if (lyTimeout) {
|
|
6139
|
+
clearTimeout(lyTimeout);
|
|
6140
|
+
}
|
|
6141
|
+
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
6142
|
+
internalData.lyRunTime = Date.now();
|
|
6143
|
+
$xeTable.loadScrollYData();
|
|
6144
|
+
}
|
|
6145
|
+
internalData.lyTimeout = setTimeout(() => {
|
|
6146
|
+
internalData.lyTimeout = undefined;
|
|
6147
|
+
internalData.lyRunTime = undefined;
|
|
6148
|
+
$xeTable.loadScrollYData();
|
|
6149
|
+
}, fpsTime);
|
|
6150
|
+
},
|
|
6151
|
+
/**
|
|
6152
|
+
* 横向 X 可视渲染事件处理
|
|
6153
|
+
*/
|
|
6154
|
+
triggerScrollXEvent() {
|
|
6155
|
+
const $xeTable = this;
|
|
6156
|
+
const sXOpts = $xeTable.computeSXOpts;
|
|
6157
|
+
if (sXOpts.immediate) {
|
|
6158
|
+
$xeTable.loadScrollXData();
|
|
6159
|
+
}
|
|
6160
|
+
else {
|
|
6161
|
+
$xeTable.lazyScrollXData();
|
|
6162
|
+
}
|
|
6163
|
+
},
|
|
6031
6164
|
/**
|
|
6032
6165
|
* 纵向 Y 可视渲染事件处理
|
|
6033
6166
|
*/
|
|
6034
6167
|
triggerScrollYEvent() {
|
|
6035
|
-
const
|
|
6036
|
-
const
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
this.loadScrollYData();
|
|
6168
|
+
const $xeTable = this;
|
|
6169
|
+
const sYOpts = $xeTable.computeSYOpts;
|
|
6170
|
+
if (sYOpts.immediate) {
|
|
6171
|
+
$xeTable.loadScrollYData();
|
|
6040
6172
|
}
|
|
6041
6173
|
else {
|
|
6042
|
-
|
|
6174
|
+
$xeTable.lazyScrollYData();
|
|
6043
6175
|
}
|
|
6044
|
-
this.debounceScrollYCalculate();
|
|
6045
6176
|
},
|
|
6046
|
-
|
|
6047
|
-
this.loadScrollYData();
|
|
6048
|
-
}, debounceScrollYDuration, { leading: false, trailing: true }),
|
|
6049
|
-
handleSyncScrollX(scrollLeft) {
|
|
6177
|
+
scrollXEvent(evnt) {
|
|
6050
6178
|
const $xeTable = this;
|
|
6179
|
+
const internalData = $xeTable;
|
|
6180
|
+
const { inFooterScroll, inBodyScroll } = internalData;
|
|
6181
|
+
if (inFooterScroll) {
|
|
6182
|
+
return;
|
|
6183
|
+
}
|
|
6184
|
+
if (inBodyScroll) {
|
|
6185
|
+
return;
|
|
6186
|
+
}
|
|
6051
6187
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
6052
6188
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6053
6189
|
const tableFooter = $xeTable.$refs.tableFooter;
|
|
6054
6190
|
const bodyElem = tableBody.$el;
|
|
6055
6191
|
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
6056
6192
|
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
6057
|
-
setScrollLeft(bodyElem, scrollLeft);
|
|
6058
|
-
setScrollLeft(headerElem, scrollLeft);
|
|
6059
|
-
setScrollLeft(footerElem, scrollLeft);
|
|
6060
|
-
},
|
|
6061
|
-
scrollXEvent(evnt) {
|
|
6062
|
-
const $xeTable = this;
|
|
6063
6193
|
const wrapperEl = evnt.currentTarget;
|
|
6064
6194
|
const { scrollTop, scrollLeft } = wrapperEl;
|
|
6065
6195
|
const isRollX = true;
|
|
6066
6196
|
const isRollY = false;
|
|
6067
|
-
|
|
6197
|
+
internalData.inVirtualScroll = true;
|
|
6198
|
+
setScrollLeft(bodyElem, scrollLeft);
|
|
6199
|
+
setScrollLeft(headerElem, scrollLeft);
|
|
6200
|
+
setScrollLeft(footerElem, scrollLeft);
|
|
6068
6201
|
$xeTable.triggerScrollXEvent(evnt);
|
|
6069
6202
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6070
6203
|
type: 'table',
|
|
6071
6204
|
fixed: ''
|
|
6072
6205
|
});
|
|
6073
6206
|
},
|
|
6074
|
-
|
|
6075
|
-
this.updateScrollYSpace();
|
|
6076
|
-
}, 1000, { leading: false, trailing: true }),
|
|
6077
|
-
handleSyncScrollY(scrollTop) {
|
|
6207
|
+
scrollYEvent(evnt) {
|
|
6078
6208
|
const $xeTable = this;
|
|
6209
|
+
const internalData = $xeTable;
|
|
6210
|
+
const { inFooterScroll, inBodyScroll } = internalData;
|
|
6211
|
+
if (inFooterScroll) {
|
|
6212
|
+
return;
|
|
6213
|
+
}
|
|
6214
|
+
if (inBodyScroll) {
|
|
6215
|
+
return;
|
|
6216
|
+
}
|
|
6079
6217
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6080
6218
|
const leftBody = $xeTable.$refs.leftBody;
|
|
6081
6219
|
const rightBody = $xeTable.$refs.rightBody;
|
|
6082
6220
|
const bodyElem = tableBody.$el;
|
|
6083
6221
|
const leftElem = leftBody ? leftBody.$el : null;
|
|
6084
6222
|
const rightElem = rightBody ? rightBody.$el : null;
|
|
6085
|
-
setScrollTop(bodyElem, scrollTop);
|
|
6086
|
-
setScrollTop(leftElem, scrollTop);
|
|
6087
|
-
setScrollTop(rightElem, scrollTop);
|
|
6088
|
-
},
|
|
6089
|
-
scrollYEvent(evnt) {
|
|
6090
|
-
const $xeTable = this;
|
|
6091
6223
|
const wrapperEl = evnt.currentTarget;
|
|
6092
6224
|
const { scrollTop, scrollLeft } = wrapperEl;
|
|
6093
6225
|
const isRollX = false;
|
|
6094
6226
|
const isRollY = true;
|
|
6095
|
-
|
|
6227
|
+
internalData.inVirtualScroll = true;
|
|
6228
|
+
setScrollTop(bodyElem, scrollTop);
|
|
6229
|
+
setScrollTop(leftElem, scrollTop);
|
|
6230
|
+
setScrollTop(rightElem, scrollTop);
|
|
6096
6231
|
$xeTable.triggerScrollYEvent(evnt);
|
|
6097
6232
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6098
6233
|
type: 'table',
|
|
@@ -6103,12 +6238,19 @@ const Methods = {
|
|
|
6103
6238
|
* 纵向 Y 可视渲染处理
|
|
6104
6239
|
*/
|
|
6105
6240
|
loadScrollYData() {
|
|
6106
|
-
const
|
|
6241
|
+
const $xeTable = this;
|
|
6242
|
+
const props = $xeTable;
|
|
6243
|
+
const reactData = $xeTable;
|
|
6244
|
+
const internalData = $xeTable;
|
|
6245
|
+
const { showOverflow } = props;
|
|
6246
|
+
const { mergeList } = reactData;
|
|
6247
|
+
const { tableHeight, scrollYStore } = internalData;
|
|
6107
6248
|
const { startIndex, endIndex, offsetSize } = scrollYStore;
|
|
6108
|
-
const
|
|
6249
|
+
const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
|
|
6250
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
6109
6251
|
const offsetItem = {
|
|
6110
|
-
startIndex: Math.max(0, toVisibleIndex - 1 -
|
|
6111
|
-
endIndex: toVisibleIndex + visibleSize +
|
|
6252
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
|
|
6253
|
+
endIndex: toVisibleIndex + visibleSize + offsetYSize
|
|
6112
6254
|
};
|
|
6113
6255
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
6114
6256
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
@@ -6116,50 +6258,44 @@ const Methods = {
|
|
|
6116
6258
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6117
6259
|
scrollYStore.startIndex = offsetStartIndex;
|
|
6118
6260
|
scrollYStore.endIndex = offsetEndIndex;
|
|
6119
|
-
|
|
6261
|
+
$xeTable.updateScrollYData();
|
|
6120
6262
|
}
|
|
6121
6263
|
}
|
|
6122
6264
|
},
|
|
6123
6265
|
// 计算可视渲染相关数据
|
|
6124
6266
|
computeScrollLoad() {
|
|
6125
6267
|
const $xeTable = this;
|
|
6126
|
-
const props = $xeTable;
|
|
6127
6268
|
return this.$nextTick().then(() => {
|
|
6128
|
-
const { showOverflow } = props;
|
|
6129
6269
|
const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this;
|
|
6130
6270
|
// 计算 X 逻辑
|
|
6131
6271
|
if (scrollXLoad) {
|
|
6132
|
-
const { visibleSize: visibleXSize } = handleVirtualXVisible(
|
|
6133
|
-
|
|
6134
|
-
const bufferSize = showOverflow ? 0 : 2;
|
|
6135
|
-
const offsetXSize = Math.max(bufferSize, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : browse.msie ? 10 : (browse.edge ? 5 : 0));
|
|
6272
|
+
const { visibleSize: visibleXSize } = handleVirtualXVisible($xeTable);
|
|
6273
|
+
const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : (browse.edge ? 5 : 0));
|
|
6136
6274
|
scrollXStore.offsetSize = offsetXSize;
|
|
6137
6275
|
scrollXStore.visibleSize = visibleXSize;
|
|
6138
6276
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
6139
|
-
|
|
6277
|
+
$xeTable.updateScrollXData();
|
|
6140
6278
|
}
|
|
6141
6279
|
else {
|
|
6142
|
-
|
|
6280
|
+
$xeTable.updateScrollXSpace();
|
|
6143
6281
|
}
|
|
6144
6282
|
calcCellHeight(this);
|
|
6145
6283
|
// 计算 Y 逻辑
|
|
6146
6284
|
const rowHeight = computeRowHeight(this);
|
|
6147
6285
|
scrollYStore.rowHeight = rowHeight;
|
|
6148
6286
|
this.rowHeight = rowHeight;
|
|
6149
|
-
const { visibleSize: visibleYSize } = handleVirtualYVisible(
|
|
6287
|
+
const { visibleSize: visibleYSize } = handleVirtualYVisible($xeTable);
|
|
6150
6288
|
if (scrollYLoad) {
|
|
6151
|
-
|
|
6152
|
-
const bufferSize = showOverflow ? 0 : 2;
|
|
6153
|
-
const offsetYSize = Math.max(bufferSize, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0));
|
|
6289
|
+
const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0));
|
|
6154
6290
|
scrollYStore.offsetSize = offsetYSize;
|
|
6155
6291
|
scrollYStore.visibleSize = visibleYSize;
|
|
6156
6292
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
6157
|
-
|
|
6293
|
+
$xeTable.updateScrollYData();
|
|
6158
6294
|
}
|
|
6159
6295
|
else {
|
|
6160
|
-
|
|
6296
|
+
$xeTable.updateScrollYSpace();
|
|
6161
6297
|
}
|
|
6162
|
-
|
|
6298
|
+
$xeTable.$nextTick(this.updateStyle);
|
|
6163
6299
|
});
|
|
6164
6300
|
},
|
|
6165
6301
|
handleTableColumn() {
|
|
@@ -6175,10 +6311,17 @@ const Methods = {
|
|
|
6175
6311
|
this.tableColumn = tableColumn;
|
|
6176
6312
|
},
|
|
6177
6313
|
updateScrollXData() {
|
|
6314
|
+
const $xeTable = this;
|
|
6315
|
+
const props = $xeTable;
|
|
6316
|
+
const { showOverflow } = props;
|
|
6178
6317
|
// this.tableColumn = []
|
|
6179
|
-
return
|
|
6180
|
-
|
|
6181
|
-
|
|
6318
|
+
return $xeTable.$nextTick().then(() => {
|
|
6319
|
+
$xeTable.handleTableColumn();
|
|
6320
|
+
calcCellHeight($xeTable);
|
|
6321
|
+
$xeTable.updateScrollXSpace();
|
|
6322
|
+
if (!showOverflow) {
|
|
6323
|
+
$xeTable.updateScrollYSpace();
|
|
6324
|
+
}
|
|
6182
6325
|
});
|
|
6183
6326
|
},
|
|
6184
6327
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
@@ -6225,10 +6368,10 @@ const Methods = {
|
|
|
6225
6368
|
updateScrollYData() {
|
|
6226
6369
|
const $xeTable = this;
|
|
6227
6370
|
// this.tableData = []
|
|
6228
|
-
return
|
|
6229
|
-
|
|
6371
|
+
return $xeTable.$nextTick().then(() => {
|
|
6372
|
+
$xeTable.handleTableData();
|
|
6230
6373
|
calcCellHeight($xeTable);
|
|
6231
|
-
|
|
6374
|
+
$xeTable.updateScrollYSpace();
|
|
6232
6375
|
});
|
|
6233
6376
|
},
|
|
6234
6377
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
@@ -6629,7 +6772,7 @@ const Methods = {
|
|
|
6629
6772
|
}
|
|
6630
6773
|
};
|
|
6631
6774
|
// Module methods
|
|
6632
|
-
const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
6775
|
+
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,resetFilterPanel,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',');
|
|
6633
6776
|
funcs.forEach(name => {
|
|
6634
6777
|
Methods[name] = function (...args) {
|
|
6635
6778
|
if (process.env.NODE_ENV === 'development') {
|
package/es/table/src/table.js
CHANGED
|
@@ -1091,8 +1091,10 @@ export default {
|
|
|
1091
1091
|
const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading');
|
|
1092
1092
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
1093
1093
|
const $xeTable = this;
|
|
1094
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
1094
1095
|
const { _e, $scopedSlots, tId, isCalcColumn, tableData, tableColumn, tableGroupColumn, isGroup, loading, stripe, showHeader, height, tableBorder, treeOpts, treeConfig, mouseConfig, mouseOpts, areaOpts, computeSize, validOpts, showFooter, overflowX, overflowY, scrollXLoad, scrollYLoad, scrollbarHeight, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, validTipOpts, initStore, columnStore, filterStore, customStore, ctxMenuStore, ctxMenuOpts, footerTableData, columnOpts, rowOpts, checkboxOpts, loadingOpts, editRules } = $xeTable;
|
|
1095
1096
|
const { leftList, rightList } = columnStore;
|
|
1097
|
+
const loadingSlot = $scopedSlots.loading;
|
|
1096
1098
|
const currLoading = this._isLoading || loading;
|
|
1097
1099
|
const vSize = computeSize;
|
|
1098
1100
|
const virtualScrollBars = $xeTable.computeVirtualScrollBars;
|
|
@@ -1280,8 +1282,14 @@ export default {
|
|
|
1280
1282
|
icon: loadingOpts.icon,
|
|
1281
1283
|
text: loadingOpts.text
|
|
1282
1284
|
}
|
|
1283
|
-
},
|
|
1284
|
-
:
|
|
1285
|
+
}, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, loading: currLoading }, h))
|
|
1286
|
+
: loadingSlot
|
|
1287
|
+
? h('div', {
|
|
1288
|
+
class: ['vxe-loading--custom-wrapper', {
|
|
1289
|
+
'is--visible': currLoading
|
|
1290
|
+
}]
|
|
1291
|
+
}, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, loading: currLoading }, h))
|
|
1292
|
+
: renderEmptyElement($xeTable),
|
|
1285
1293
|
/**
|
|
1286
1294
|
* 自定义列
|
|
1287
1295
|
*/
|
|
@@ -1293,7 +1301,7 @@ export default {
|
|
|
1293
1301
|
customStore
|
|
1294
1302
|
}
|
|
1295
1303
|
})
|
|
1296
|
-
:
|
|
1304
|
+
: renderEmptyElement($xeTable),
|
|
1297
1305
|
/**
|
|
1298
1306
|
* 筛选
|
|
1299
1307
|
*/
|