vxe-table 3.11.4 → 3.11.6-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/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 -109
- 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 -196
- 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 -127
- 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 -112
- package/packages/table/src/table.ts +11 -3
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +2 -2
- package/styles/components/table.scss +38 -3
- /package/es/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
- /package/es/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
- /package/es/{iconfont.1732091003142.woff2 → iconfont.1732505453169.woff2} +0 -0
- /package/lib/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
- /package/lib/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
- /package/lib/{iconfont.1732091003142.woff2 → iconfont.1732505453169.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,48 @@ 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
|
+
calcCellHeight($xeTable);
|
|
483
|
+
$xeTable.calcCellWidth();
|
|
484
|
+
$xeTable.autoCellWidth();
|
|
485
|
+
if (reFull === true) {
|
|
486
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
487
|
+
return $xeTable.computeScrollLoad().then(() => {
|
|
488
|
+
calcCellHeight($xeTable);
|
|
489
|
+
$xeTable.calcCellWidth();
|
|
490
|
+
$xeTable.autoCellWidth();
|
|
491
|
+
return $xeTable.computeScrollLoad();
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
return $xeTable.computeScrollLoad();
|
|
495
|
+
}
|
|
496
|
+
function checkLastSyncScroll($xeTable, isRollX, isRollY) {
|
|
497
|
+
const reactData = $xeTable;
|
|
498
|
+
const internalData = $xeTable;
|
|
499
|
+
const { scrollXLoad, scrollYLoad } = reactData;
|
|
500
|
+
const { lcsTimeout } = internalData;
|
|
501
|
+
if (lcsTimeout) {
|
|
502
|
+
clearTimeout(lcsTimeout);
|
|
503
|
+
}
|
|
504
|
+
internalData.lcsTimeout = setTimeout(() => {
|
|
505
|
+
internalData.lcsTimeout = undefined;
|
|
506
|
+
internalData.inVirtualScroll = false;
|
|
507
|
+
internalData.inBodyScroll = false;
|
|
508
|
+
internalData.bodyScrollType = '';
|
|
509
|
+
internalData.inFooterScroll = false;
|
|
510
|
+
if (isRollX && scrollXLoad) {
|
|
511
|
+
$xeTable.updateScrollXData();
|
|
512
|
+
}
|
|
513
|
+
if (isRollY && scrollYLoad) {
|
|
514
|
+
$xeTable.updateScrollYData();
|
|
515
|
+
}
|
|
516
|
+
$xeTable.updateCellAreas();
|
|
517
|
+
}, 200);
|
|
518
|
+
}
|
|
452
519
|
const Methods = {
|
|
453
520
|
callSlot(slotFunc, params, h, vNodes) {
|
|
454
521
|
if (slotFunc) {
|
|
@@ -2441,22 +2508,21 @@ const Methods = {
|
|
|
2441
2508
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2442
2509
|
*/
|
|
2443
2510
|
recalculate(reFull) {
|
|
2444
|
-
const
|
|
2445
|
-
|
|
2446
|
-
|
|
2511
|
+
const $xeTable = this;
|
|
2512
|
+
const internalData = $xeTable;
|
|
2513
|
+
const { rceTimeout } = internalData;
|
|
2514
|
+
if (rceTimeout) {
|
|
2515
|
+
clearTimeout(rceTimeout);
|
|
2447
2516
|
}
|
|
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
|
-
});
|
|
2517
|
+
else {
|
|
2518
|
+
handleRecalculateLayout($xeTable, !!reFull);
|
|
2458
2519
|
}
|
|
2459
|
-
return
|
|
2520
|
+
return new Promise(resolve => {
|
|
2521
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
2522
|
+
internalData.rceTimeout = undefined;
|
|
2523
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
2524
|
+
}, 20);
|
|
2525
|
+
});
|
|
2460
2526
|
},
|
|
2461
2527
|
calcCellWidth() {
|
|
2462
2528
|
const $xeTable = this;
|
|
@@ -2650,12 +2716,17 @@ const Methods = {
|
|
|
2650
2716
|
},
|
|
2651
2717
|
calcCellHeight() {
|
|
2652
2718
|
const $xeTable = this;
|
|
2719
|
+
const props = $xeTable;
|
|
2653
2720
|
const reactData = $xeTable;
|
|
2654
2721
|
const internalData = $xeTable;
|
|
2655
|
-
const {
|
|
2722
|
+
const { showOverflow } = props;
|
|
2723
|
+
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
2656
2724
|
const { fullAllDataRowIdData } = internalData;
|
|
2657
2725
|
const el = $xeTable.$el;
|
|
2658
|
-
if (scrollYLoad && el) {
|
|
2726
|
+
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
2727
|
+
let paddingTop = 0;
|
|
2728
|
+
let paddingBottom = 0;
|
|
2729
|
+
let calcPadding = false;
|
|
2659
2730
|
tableData.forEach((row) => {
|
|
2660
2731
|
const rowid = getRowid($xeTable, row);
|
|
2661
2732
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
@@ -2664,7 +2735,21 @@ const Methods = {
|
|
|
2664
2735
|
let height = 0;
|
|
2665
2736
|
for (let i = 0; i < trList.length; i++) {
|
|
2666
2737
|
const trEl = trList[i];
|
|
2667
|
-
|
|
2738
|
+
const tdList = trEl.children;
|
|
2739
|
+
for (let j = 0; j < tdList.length; j++) {
|
|
2740
|
+
const tdEl = tdList[j];
|
|
2741
|
+
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
2742
|
+
if (!calcPadding) {
|
|
2743
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
2744
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
2745
|
+
calcPadding = true;
|
|
2746
|
+
}
|
|
2747
|
+
let cellHeight = paddingTop + paddingBottom;
|
|
2748
|
+
if (cellElem) {
|
|
2749
|
+
cellHeight += cellElem.offsetHeight;
|
|
2750
|
+
}
|
|
2751
|
+
height = Math.max(height, cellHeight);
|
|
2752
|
+
}
|
|
2668
2753
|
}
|
|
2669
2754
|
rowRest.height = height;
|
|
2670
2755
|
}
|
|
@@ -5911,16 +5996,14 @@ const Methods = {
|
|
|
5911
5996
|
scrollLeft: bodyElem.scrollLeft
|
|
5912
5997
|
};
|
|
5913
5998
|
},
|
|
5914
|
-
/**
|
|
5915
|
-
* 横向 X 可视渲染事件处理
|
|
5916
|
-
*/
|
|
5917
|
-
triggerScrollXEvent() {
|
|
5918
|
-
this.loadScrollXData();
|
|
5919
|
-
},
|
|
5920
5999
|
loadScrollXData() {
|
|
5921
|
-
const
|
|
6000
|
+
const $xeTable = this;
|
|
6001
|
+
const reactData = $xeTable;
|
|
6002
|
+
const internalData = $xeTable;
|
|
6003
|
+
const { mergeList, mergeFooterList } = reactData;
|
|
6004
|
+
const { scrollXStore } = internalData;
|
|
5922
6005
|
const { startIndex, endIndex, offsetSize } = scrollXStore;
|
|
5923
|
-
const { toVisibleIndex, visibleSize } = handleVirtualXVisible(
|
|
6006
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable);
|
|
5924
6007
|
const offsetItem = {
|
|
5925
6008
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
5926
6009
|
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
@@ -5931,10 +6014,10 @@ const Methods = {
|
|
|
5931
6014
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
5932
6015
|
scrollXStore.startIndex = offsetStartIndex;
|
|
5933
6016
|
scrollXStore.endIndex = offsetEndIndex;
|
|
5934
|
-
|
|
6017
|
+
$xeTable.updateScrollXData();
|
|
5935
6018
|
}
|
|
5936
6019
|
}
|
|
5937
|
-
|
|
6020
|
+
$xeTable.closeTooltip();
|
|
5938
6021
|
},
|
|
5939
6022
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
5940
6023
|
const $xeTable = this;
|
|
@@ -5981,7 +6064,6 @@ const Methods = {
|
|
|
5981
6064
|
}
|
|
5982
6065
|
$xeTable.checkScrolling();
|
|
5983
6066
|
internalData.lastScrollLeft = scrollLeft;
|
|
5984
|
-
reactData.lastScrollTime = Date.now();
|
|
5985
6067
|
}
|
|
5986
6068
|
else {
|
|
5987
6069
|
const yThreshold = $xeTable.computeScrollYThreshold;
|
|
@@ -6002,8 +6084,8 @@ const Methods = {
|
|
|
6002
6084
|
}
|
|
6003
6085
|
}
|
|
6004
6086
|
internalData.lastScrollTop = scrollTop;
|
|
6005
|
-
reactData.lastScrollTime = Date.now();
|
|
6006
6087
|
}
|
|
6088
|
+
reactData.lastScrollTime = Date.now();
|
|
6007
6089
|
const evntParams = Object.assign({ scrollTop,
|
|
6008
6090
|
scrollLeft,
|
|
6009
6091
|
bodyHeight,
|
|
@@ -6014,6 +6096,7 @@ const Methods = {
|
|
|
6014
6096
|
isLeft,
|
|
6015
6097
|
isRight,
|
|
6016
6098
|
direction }, params);
|
|
6099
|
+
checkLastSyncScroll($xeTable, isRollX, isRollY);
|
|
6017
6100
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
6018
6101
|
$xeTable.clearHoverRow();
|
|
6019
6102
|
}
|
|
@@ -6028,71 +6111,124 @@ const Methods = {
|
|
|
6028
6111
|
}
|
|
6029
6112
|
$xeTable.dispatchEvent('scroll', evntParams, evnt);
|
|
6030
6113
|
},
|
|
6114
|
+
lazyScrollXData() {
|
|
6115
|
+
const $xeTable = this;
|
|
6116
|
+
const internalData = $xeTable;
|
|
6117
|
+
const { lxTimeout, lxRunTime, scrollXStore } = internalData;
|
|
6118
|
+
const { visibleSize } = scrollXStore;
|
|
6119
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 3));
|
|
6120
|
+
if (lxTimeout) {
|
|
6121
|
+
clearTimeout(lxTimeout);
|
|
6122
|
+
}
|
|
6123
|
+
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
6124
|
+
internalData.lxRunTime = Date.now();
|
|
6125
|
+
$xeTable.loadScrollXData();
|
|
6126
|
+
}
|
|
6127
|
+
internalData.lxTimeout = setTimeout(() => {
|
|
6128
|
+
internalData.lxRunTime = undefined;
|
|
6129
|
+
internalData.lxRunTime = undefined;
|
|
6130
|
+
$xeTable.loadScrollXData();
|
|
6131
|
+
}, fpsTime);
|
|
6132
|
+
},
|
|
6133
|
+
lazyScrollYData() {
|
|
6134
|
+
const $xeTable = this;
|
|
6135
|
+
const internalData = $xeTable;
|
|
6136
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData;
|
|
6137
|
+
const { visibleSize } = scrollYStore;
|
|
6138
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 2));
|
|
6139
|
+
if (lyTimeout) {
|
|
6140
|
+
clearTimeout(lyTimeout);
|
|
6141
|
+
}
|
|
6142
|
+
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
6143
|
+
internalData.lyRunTime = Date.now();
|
|
6144
|
+
$xeTable.loadScrollYData();
|
|
6145
|
+
}
|
|
6146
|
+
internalData.lyTimeout = setTimeout(() => {
|
|
6147
|
+
internalData.lyTimeout = undefined;
|
|
6148
|
+
internalData.lyRunTime = undefined;
|
|
6149
|
+
$xeTable.loadScrollYData();
|
|
6150
|
+
}, fpsTime);
|
|
6151
|
+
},
|
|
6152
|
+
/**
|
|
6153
|
+
* 横向 X 可视渲染事件处理
|
|
6154
|
+
*/
|
|
6155
|
+
triggerScrollXEvent() {
|
|
6156
|
+
const $xeTable = this;
|
|
6157
|
+
const sXOpts = $xeTable.computeSXOpts;
|
|
6158
|
+
if (sXOpts.immediate) {
|
|
6159
|
+
$xeTable.loadScrollXData();
|
|
6160
|
+
}
|
|
6161
|
+
else {
|
|
6162
|
+
$xeTable.lazyScrollXData();
|
|
6163
|
+
}
|
|
6164
|
+
},
|
|
6031
6165
|
/**
|
|
6032
6166
|
* 纵向 Y 可视渲染事件处理
|
|
6033
6167
|
*/
|
|
6034
6168
|
triggerScrollYEvent() {
|
|
6035
|
-
const
|
|
6036
|
-
const
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
this.loadScrollYData();
|
|
6169
|
+
const $xeTable = this;
|
|
6170
|
+
const sYOpts = $xeTable.computeSYOpts;
|
|
6171
|
+
if (sYOpts.immediate) {
|
|
6172
|
+
$xeTable.loadScrollYData();
|
|
6040
6173
|
}
|
|
6041
6174
|
else {
|
|
6042
|
-
|
|
6175
|
+
$xeTable.lazyScrollYData();
|
|
6043
6176
|
}
|
|
6044
|
-
this.debounceScrollYCalculate();
|
|
6045
6177
|
},
|
|
6046
|
-
|
|
6047
|
-
this.loadScrollYData();
|
|
6048
|
-
}, debounceScrollYDuration, { leading: false, trailing: true }),
|
|
6049
|
-
handleSyncScrollX(scrollLeft) {
|
|
6178
|
+
scrollXEvent(evnt) {
|
|
6050
6179
|
const $xeTable = this;
|
|
6180
|
+
const internalData = $xeTable;
|
|
6181
|
+
const { inFooterScroll, inBodyScroll } = internalData;
|
|
6182
|
+
if (inFooterScroll) {
|
|
6183
|
+
return;
|
|
6184
|
+
}
|
|
6185
|
+
if (inBodyScroll) {
|
|
6186
|
+
return;
|
|
6187
|
+
}
|
|
6051
6188
|
const tableHeader = $xeTable.$refs.tableHeader;
|
|
6052
6189
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6053
6190
|
const tableFooter = $xeTable.$refs.tableFooter;
|
|
6054
6191
|
const bodyElem = tableBody.$el;
|
|
6055
6192
|
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
6056
6193
|
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
6194
|
const wrapperEl = evnt.currentTarget;
|
|
6064
6195
|
const { scrollTop, scrollLeft } = wrapperEl;
|
|
6065
6196
|
const isRollX = true;
|
|
6066
6197
|
const isRollY = false;
|
|
6067
|
-
|
|
6198
|
+
internalData.inVirtualScroll = true;
|
|
6199
|
+
setScrollLeft(bodyElem, scrollLeft);
|
|
6200
|
+
setScrollLeft(headerElem, scrollLeft);
|
|
6201
|
+
setScrollLeft(footerElem, scrollLeft);
|
|
6068
6202
|
$xeTable.triggerScrollXEvent(evnt);
|
|
6069
6203
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6070
6204
|
type: 'table',
|
|
6071
6205
|
fixed: ''
|
|
6072
6206
|
});
|
|
6073
6207
|
},
|
|
6074
|
-
|
|
6075
|
-
this.updateScrollYSpace();
|
|
6076
|
-
}, 1000, { leading: false, trailing: true }),
|
|
6077
|
-
handleSyncScrollY(scrollTop) {
|
|
6208
|
+
scrollYEvent(evnt) {
|
|
6078
6209
|
const $xeTable = this;
|
|
6210
|
+
const internalData = $xeTable;
|
|
6211
|
+
const { inFooterScroll, inBodyScroll } = internalData;
|
|
6212
|
+
if (inFooterScroll) {
|
|
6213
|
+
return;
|
|
6214
|
+
}
|
|
6215
|
+
if (inBodyScroll) {
|
|
6216
|
+
return;
|
|
6217
|
+
}
|
|
6079
6218
|
const tableBody = $xeTable.$refs.tableBody;
|
|
6080
6219
|
const leftBody = $xeTable.$refs.leftBody;
|
|
6081
6220
|
const rightBody = $xeTable.$refs.rightBody;
|
|
6082
6221
|
const bodyElem = tableBody.$el;
|
|
6083
6222
|
const leftElem = leftBody ? leftBody.$el : null;
|
|
6084
6223
|
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
6224
|
const wrapperEl = evnt.currentTarget;
|
|
6092
6225
|
const { scrollTop, scrollLeft } = wrapperEl;
|
|
6093
6226
|
const isRollX = false;
|
|
6094
6227
|
const isRollY = true;
|
|
6095
|
-
|
|
6228
|
+
internalData.inVirtualScroll = true;
|
|
6229
|
+
setScrollTop(bodyElem, scrollTop);
|
|
6230
|
+
setScrollTop(leftElem, scrollTop);
|
|
6231
|
+
setScrollTop(rightElem, scrollTop);
|
|
6096
6232
|
$xeTable.triggerScrollYEvent(evnt);
|
|
6097
6233
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6098
6234
|
type: 'table',
|
|
@@ -6103,12 +6239,19 @@ const Methods = {
|
|
|
6103
6239
|
* 纵向 Y 可视渲染处理
|
|
6104
6240
|
*/
|
|
6105
6241
|
loadScrollYData() {
|
|
6106
|
-
const
|
|
6242
|
+
const $xeTable = this;
|
|
6243
|
+
const props = $xeTable;
|
|
6244
|
+
const reactData = $xeTable;
|
|
6245
|
+
const internalData = $xeTable;
|
|
6246
|
+
const { showOverflow } = props;
|
|
6247
|
+
const { mergeList } = reactData;
|
|
6248
|
+
const { tableHeight, scrollYStore } = internalData;
|
|
6107
6249
|
const { startIndex, endIndex, offsetSize } = scrollYStore;
|
|
6108
|
-
const
|
|
6250
|
+
const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200));
|
|
6251
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable);
|
|
6109
6252
|
const offsetItem = {
|
|
6110
|
-
startIndex: Math.max(0, toVisibleIndex - 1 -
|
|
6111
|
-
endIndex: toVisibleIndex + visibleSize +
|
|
6253
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
|
|
6254
|
+
endIndex: toVisibleIndex + visibleSize + offsetYSize
|
|
6112
6255
|
};
|
|
6113
6256
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row');
|
|
6114
6257
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem;
|
|
@@ -6116,50 +6259,44 @@ const Methods = {
|
|
|
6116
6259
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6117
6260
|
scrollYStore.startIndex = offsetStartIndex;
|
|
6118
6261
|
scrollYStore.endIndex = offsetEndIndex;
|
|
6119
|
-
|
|
6262
|
+
$xeTable.updateScrollYData();
|
|
6120
6263
|
}
|
|
6121
6264
|
}
|
|
6122
6265
|
},
|
|
6123
6266
|
// 计算可视渲染相关数据
|
|
6124
6267
|
computeScrollLoad() {
|
|
6125
6268
|
const $xeTable = this;
|
|
6126
|
-
const props = $xeTable;
|
|
6127
6269
|
return this.$nextTick().then(() => {
|
|
6128
|
-
const { showOverflow } = props;
|
|
6129
6270
|
const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this;
|
|
6130
6271
|
// 计算 X 逻辑
|
|
6131
6272
|
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));
|
|
6273
|
+
const { visibleSize: visibleXSize } = handleVirtualXVisible($xeTable);
|
|
6274
|
+
const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : (browse.edge ? 5 : 0));
|
|
6136
6275
|
scrollXStore.offsetSize = offsetXSize;
|
|
6137
6276
|
scrollXStore.visibleSize = visibleXSize;
|
|
6138
6277
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
6139
|
-
|
|
6278
|
+
$xeTable.updateScrollXData();
|
|
6140
6279
|
}
|
|
6141
6280
|
else {
|
|
6142
|
-
|
|
6281
|
+
$xeTable.updateScrollXSpace();
|
|
6143
6282
|
}
|
|
6144
6283
|
calcCellHeight(this);
|
|
6145
6284
|
// 计算 Y 逻辑
|
|
6146
6285
|
const rowHeight = computeRowHeight(this);
|
|
6147
6286
|
scrollYStore.rowHeight = rowHeight;
|
|
6148
6287
|
this.rowHeight = rowHeight;
|
|
6149
|
-
const { visibleSize: visibleYSize } = handleVirtualYVisible(
|
|
6288
|
+
const { visibleSize: visibleYSize } = handleVirtualYVisible($xeTable);
|
|
6150
6289
|
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));
|
|
6290
|
+
const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0));
|
|
6154
6291
|
scrollYStore.offsetSize = offsetYSize;
|
|
6155
6292
|
scrollYStore.visibleSize = visibleYSize;
|
|
6156
6293
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
6157
|
-
|
|
6294
|
+
$xeTable.updateScrollYData();
|
|
6158
6295
|
}
|
|
6159
6296
|
else {
|
|
6160
|
-
|
|
6297
|
+
$xeTable.updateScrollYSpace();
|
|
6161
6298
|
}
|
|
6162
|
-
|
|
6299
|
+
$xeTable.$nextTick(this.updateStyle);
|
|
6163
6300
|
});
|
|
6164
6301
|
},
|
|
6165
6302
|
handleTableColumn() {
|
|
@@ -6175,10 +6312,17 @@ const Methods = {
|
|
|
6175
6312
|
this.tableColumn = tableColumn;
|
|
6176
6313
|
},
|
|
6177
6314
|
updateScrollXData() {
|
|
6315
|
+
const $xeTable = this;
|
|
6316
|
+
const props = $xeTable;
|
|
6317
|
+
const { showOverflow } = props;
|
|
6178
6318
|
// this.tableColumn = []
|
|
6179
|
-
return
|
|
6180
|
-
|
|
6181
|
-
|
|
6319
|
+
return $xeTable.$nextTick().then(() => {
|
|
6320
|
+
$xeTable.handleTableColumn();
|
|
6321
|
+
calcCellHeight($xeTable);
|
|
6322
|
+
$xeTable.updateScrollXSpace();
|
|
6323
|
+
if (!showOverflow) {
|
|
6324
|
+
$xeTable.updateScrollYSpace();
|
|
6325
|
+
}
|
|
6182
6326
|
});
|
|
6183
6327
|
},
|
|
6184
6328
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
@@ -6225,10 +6369,10 @@ const Methods = {
|
|
|
6225
6369
|
updateScrollYData() {
|
|
6226
6370
|
const $xeTable = this;
|
|
6227
6371
|
// this.tableData = []
|
|
6228
|
-
return
|
|
6229
|
-
|
|
6372
|
+
return $xeTable.$nextTick().then(() => {
|
|
6373
|
+
$xeTable.handleTableData();
|
|
6230
6374
|
calcCellHeight($xeTable);
|
|
6231
|
-
|
|
6375
|
+
$xeTable.updateScrollYSpace();
|
|
6232
6376
|
});
|
|
6233
6377
|
},
|
|
6234
6378
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
@@ -6629,7 +6773,7 @@ const Methods = {
|
|
|
6629
6773
|
}
|
|
6630
6774
|
};
|
|
6631
6775
|
// 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(',');
|
|
6776
|
+
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
6777
|
funcs.forEach(name => {
|
|
6634
6778
|
Methods[name] = function (...args) {
|
|
6635
6779
|
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
|
*/
|