vxe-table 3.11.38 → 3.12.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/render/index.js +47 -12
- package/es/table/src/body.js +81 -35
- package/es/table/src/footer.js +54 -18
- package/es/table/src/header.js +58 -10
- package/es/table/src/methods.js +159 -118
- package/es/table/src/table.js +5 -13
- package/es/table/style.css +3 -5
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +3 -5
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +464 -272
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/render/index.js +47 -12
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +101 -56
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +67 -30
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +71 -18
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +167 -137
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +5 -15
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +3 -5
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +5 -3
- 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 +3 -5
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/render/index.ts +48 -12
- package/packages/table/src/body.ts +84 -35
- package/packages/table/src/footer.ts +58 -18
- package/packages/table/src/header.ts +62 -11
- package/packages/table/src/methods.ts +163 -126
- package/packages/table/src/table.ts +6 -15
- package/packages/ui/index.ts +4 -2
- package/styles/components/table.scss +1 -3
- /package/es/{iconfont.1735003904481.ttf → iconfont.1735106128767.ttf} +0 -0
- /package/es/{iconfont.1735003904481.woff → iconfont.1735106128767.woff} +0 -0
- /package/es/{iconfont.1735003904481.woff2 → iconfont.1735106128767.woff2} +0 -0
- /package/lib/{iconfont.1735003904481.ttf → iconfont.1735106128767.ttf} +0 -0
- /package/lib/{iconfont.1735003904481.woff → iconfont.1735106128767.woff} +0 -0
- /package/lib/{iconfont.1735003904481.woff2 → iconfont.1735106128767.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -7,8 +7,6 @@ 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
|
|
12
10
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
13
11
|
// 获取所有的列,排除分组
|
|
14
12
|
const getColumnList = (columns) => {
|
|
@@ -280,7 +278,7 @@ const calcCellHeight = ($xeTable) => {
|
|
|
280
278
|
const { showOverflow } = props;
|
|
281
279
|
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
282
280
|
const { fullAllDataRowIdData } = internalData;
|
|
283
|
-
const el = $xeTable.$
|
|
281
|
+
const el = $xeTable.$refs.refElem;
|
|
284
282
|
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
285
283
|
let paddingTop = 0;
|
|
286
284
|
let paddingBottom = 0;
|
|
@@ -288,28 +286,27 @@ const calcCellHeight = ($xeTable) => {
|
|
|
288
286
|
tableData.forEach((row) => {
|
|
289
287
|
const rowid = getRowid($xeTable, row);
|
|
290
288
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
291
|
-
const
|
|
292
|
-
if (rowRest &&
|
|
289
|
+
const cellList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]>.vxe-body--column>.vxe-cell`);
|
|
290
|
+
if (rowRest && cellList.length) {
|
|
293
291
|
let height = 0;
|
|
294
|
-
for (let i = 0; i <
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
306
|
-
if (cellElem) {
|
|
307
|
-
cellHeight += cellElem.offsetHeight;
|
|
308
|
-
}
|
|
309
|
-
height = Math.max(height, cellHeight);
|
|
292
|
+
for (let i = 0; i < cellList.length; i++) {
|
|
293
|
+
const cellElem = cellList[i];
|
|
294
|
+
const tdEl = cellElem.parentElement;
|
|
295
|
+
if (!tdEl || !tdEl.clientWidth) {
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
if (!calcPadding) {
|
|
299
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
300
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
301
|
+
calcPadding = true;
|
|
310
302
|
}
|
|
303
|
+
let cellHeight = paddingTop + paddingBottom;
|
|
304
|
+
if (cellElem) {
|
|
305
|
+
cellHeight += cellElem.clientHeight;
|
|
306
|
+
}
|
|
307
|
+
height = Math.max(height, cellHeight);
|
|
311
308
|
}
|
|
312
|
-
rowRest.height = height;
|
|
309
|
+
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
313
310
|
}
|
|
314
311
|
});
|
|
315
312
|
}
|
|
@@ -424,15 +421,22 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
424
421
|
const { scrollbarWidth, scrollbarHeight } = reactData;
|
|
425
422
|
const { prevDragToChild } = internalData;
|
|
426
423
|
const wrapperRect = el.getBoundingClientRect();
|
|
424
|
+
const tableWidth = el.clientWidth;
|
|
425
|
+
const tableHeight = el.clientHeight;
|
|
427
426
|
if (trEl) {
|
|
428
427
|
const rdLineEl = $xeTable.$refs.refDragRowLineElem;
|
|
429
428
|
if (rdLineEl) {
|
|
430
429
|
if (showLine) {
|
|
431
430
|
const trRect = trEl.getBoundingClientRect();
|
|
431
|
+
let trHeight = trEl.clientHeight;
|
|
432
|
+
const offsetTop = Math.max(1, trRect.y - wrapperRect.y);
|
|
433
|
+
if (offsetTop + trHeight > tableHeight - scrollbarHeight) {
|
|
434
|
+
trHeight = tableHeight - offsetTop - scrollbarHeight;
|
|
435
|
+
}
|
|
432
436
|
rdLineEl.style.display = 'block';
|
|
433
|
-
rdLineEl.style.top = `${
|
|
434
|
-
rdLineEl.style.height = `${
|
|
435
|
-
rdLineEl.style.width = `${
|
|
437
|
+
rdLineEl.style.top = `${offsetTop}px`;
|
|
438
|
+
rdLineEl.style.height = `${trHeight}px`;
|
|
439
|
+
rdLineEl.style.width = `${tableWidth - scrollbarWidth}px`;
|
|
436
440
|
rdLineEl.setAttribute('drag-pos', dragPos);
|
|
437
441
|
rdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
438
442
|
}
|
|
@@ -445,17 +449,32 @@ function showDropTip($xeTable, evnt, trEl, thEl, showLine, dragPos) {
|
|
|
445
449
|
const cdLineEl = $xeTable.$refs.refDragColLineElem;
|
|
446
450
|
if (cdLineEl) {
|
|
447
451
|
if (showLine) {
|
|
452
|
+
const leftContainerElem = $xeTable.$refs.leftContainer;
|
|
453
|
+
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
454
|
+
const rightContainerElem = $xeTable.$refs.rightContainer;
|
|
455
|
+
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
448
456
|
const thRect = thEl.getBoundingClientRect();
|
|
457
|
+
let thWidth = thEl.clientWidth;
|
|
449
458
|
const offsetTop = Math.max(0, thRect.y - wrapperRect.y);
|
|
459
|
+
const startX = leftContainerWidth;
|
|
460
|
+
let offsetLeft = thRect.x - wrapperRect.x;
|
|
461
|
+
if (offsetLeft < startX) {
|
|
462
|
+
thWidth -= startX - offsetLeft;
|
|
463
|
+
offsetLeft = startX;
|
|
464
|
+
}
|
|
465
|
+
const endX = tableWidth - rightContainerWidth - (rightContainerWidth ? 0 : scrollbarWidth);
|
|
466
|
+
if (offsetLeft + thWidth > endX) {
|
|
467
|
+
thWidth = endX - offsetLeft;
|
|
468
|
+
}
|
|
450
469
|
cdLineEl.style.display = 'block';
|
|
451
470
|
cdLineEl.style.top = `${offsetTop}px`;
|
|
452
|
-
cdLineEl.style.left = `${
|
|
453
|
-
cdLineEl.style.width = `${
|
|
471
|
+
cdLineEl.style.left = `${offsetLeft}px`;
|
|
472
|
+
cdLineEl.style.width = `${thWidth}px`;
|
|
454
473
|
if (prevDragToChild) {
|
|
455
474
|
cdLineEl.style.height = `${thRect.height}px`;
|
|
456
475
|
}
|
|
457
476
|
else {
|
|
458
|
-
cdLineEl.style.height = `${
|
|
477
|
+
cdLineEl.style.height = `${tableHeight - offsetTop - scrollbarHeight}px`;
|
|
459
478
|
}
|
|
460
479
|
cdLineEl.setAttribute('drag-pos', dragPos);
|
|
461
480
|
cdLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
@@ -895,7 +914,7 @@ const Methods = {
|
|
|
895
914
|
return Promise.resolve(this.restoreCustomStorage()).then(() => {
|
|
896
915
|
this._isLoading = false;
|
|
897
916
|
this.cacheColumnMap();
|
|
898
|
-
this.parseColumns().then(() => {
|
|
917
|
+
this.parseColumns(true).then(() => {
|
|
899
918
|
if (this.scrollXLoad) {
|
|
900
919
|
this.loadScrollXData(true);
|
|
901
920
|
}
|
|
@@ -2444,15 +2463,11 @@ const Methods = {
|
|
|
2444
2463
|
/**
|
|
2445
2464
|
* 刷新列配置
|
|
2446
2465
|
*/
|
|
2447
|
-
refreshColumn(
|
|
2448
|
-
if (
|
|
2449
|
-
|
|
2450
|
-
this.collectColumn = columnList;
|
|
2451
|
-
const tableFullColumn = getColumnList(columnList);
|
|
2452
|
-
this.tableFullColumn = tableFullColumn;
|
|
2453
|
-
this.cacheColumnMap();
|
|
2466
|
+
refreshColumn(initSort) {
|
|
2467
|
+
if (initSort) {
|
|
2468
|
+
this.handleUpdateColumn();
|
|
2454
2469
|
}
|
|
2455
|
-
return this.parseColumns().then(() => {
|
|
2470
|
+
return this.parseColumns(true).then(() => {
|
|
2456
2471
|
return this.refreshScroll();
|
|
2457
2472
|
}).then(() => {
|
|
2458
2473
|
return this.recalculate();
|
|
@@ -2462,7 +2477,7 @@ const Methods = {
|
|
|
2462
2477
|
* 刷新列信息
|
|
2463
2478
|
* 将固定的列左边、右边分别靠边
|
|
2464
2479
|
*/
|
|
2465
|
-
parseColumns() {
|
|
2480
|
+
parseColumns(isReset) {
|
|
2466
2481
|
const $xeTable = this;
|
|
2467
2482
|
const props = $xeTable;
|
|
2468
2483
|
const internalData = $xeTable;
|
|
@@ -2560,10 +2575,12 @@ const Methods = {
|
|
|
2560
2575
|
warnLog('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
2561
2576
|
}
|
|
2562
2577
|
}
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2578
|
+
if (isReset) {
|
|
2579
|
+
const { visibleSize } = handleVirtualXVisible(this);
|
|
2580
|
+
scrollXStore.startIndex = 0;
|
|
2581
|
+
scrollXStore.endIndex = visibleSize;
|
|
2582
|
+
scrollXStore.visibleSize = visibleSize;
|
|
2583
|
+
}
|
|
2567
2584
|
}
|
|
2568
2585
|
// 如果列被显示/隐藏,则清除合并状态
|
|
2569
2586
|
// 如果列被设置为固定,则清除合并状态
|
|
@@ -2581,12 +2598,15 @@ const Methods = {
|
|
|
2581
2598
|
});
|
|
2582
2599
|
this.visibleColumn = visibleColumn;
|
|
2583
2600
|
this.handleTableColumn();
|
|
2584
|
-
|
|
2585
|
-
return this.
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2601
|
+
if (isReset) {
|
|
2602
|
+
return this.updateFooter().then(() => {
|
|
2603
|
+
return this.recalculate();
|
|
2604
|
+
}).then(() => {
|
|
2605
|
+
this.updateCellAreas();
|
|
2606
|
+
return this.recalculate();
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
return this.updateFooter();
|
|
2590
2610
|
},
|
|
2591
2611
|
/**
|
|
2592
2612
|
* 指定列宽的列进行拆分
|
|
@@ -2881,48 +2901,6 @@ const Methods = {
|
|
|
2881
2901
|
this.checkScrolling();
|
|
2882
2902
|
}
|
|
2883
2903
|
},
|
|
2884
|
-
calcCellHeight() {
|
|
2885
|
-
const $xeTable = this;
|
|
2886
|
-
const props = $xeTable;
|
|
2887
|
-
const reactData = $xeTable;
|
|
2888
|
-
const internalData = $xeTable;
|
|
2889
|
-
const { showOverflow } = props;
|
|
2890
|
-
const { tableData, scrollXLoad, scrollYLoad } = reactData;
|
|
2891
|
-
const { fullAllDataRowIdData } = internalData;
|
|
2892
|
-
const el = $xeTable.$el;
|
|
2893
|
-
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
2894
|
-
let paddingTop = 0;
|
|
2895
|
-
let paddingBottom = 0;
|
|
2896
|
-
let calcPadding = false;
|
|
2897
|
-
tableData.forEach((row) => {
|
|
2898
|
-
const rowid = getRowid($xeTable, row);
|
|
2899
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
2900
|
-
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2901
|
-
if (rowRest && trList.length) {
|
|
2902
|
-
let height = 0;
|
|
2903
|
-
for (let i = 0; i < trList.length; i++) {
|
|
2904
|
-
const trEl = trList[i];
|
|
2905
|
-
const tdList = trEl.children;
|
|
2906
|
-
for (let j = 0; j < tdList.length; j++) {
|
|
2907
|
-
const tdEl = tdList[j];
|
|
2908
|
-
const cellElem = tdEl.querySelector('.vxe-cell');
|
|
2909
|
-
if (!calcPadding) {
|
|
2910
|
-
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop);
|
|
2911
|
-
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom);
|
|
2912
|
-
calcPadding = true;
|
|
2913
|
-
}
|
|
2914
|
-
let cellHeight = paddingTop + paddingBottom;
|
|
2915
|
-
if (cellElem) {
|
|
2916
|
-
cellHeight += cellElem.offsetHeight;
|
|
2917
|
-
}
|
|
2918
|
-
height = Math.max(height, cellHeight);
|
|
2919
|
-
}
|
|
2920
|
-
}
|
|
2921
|
-
rowRest.height = scrollXLoad ? Math.max(rowRest.height, height) : height;
|
|
2922
|
-
}
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
},
|
|
2926
2904
|
updateHeight() {
|
|
2927
2905
|
this.customHeight = calcTableHeight(this, 'height');
|
|
2928
2906
|
this.customMinHeight = calcTableHeight(this, 'minHeight');
|
|
@@ -2930,7 +2908,7 @@ const Methods = {
|
|
|
2930
2908
|
},
|
|
2931
2909
|
updateStyle() {
|
|
2932
2910
|
const $xeTable = this;
|
|
2933
|
-
let { $refs, isGroup, fullColumnIdData, tableColumn, customHeight, customMinHeight, customMaxHeight, border, headerHeight, showFooter, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, footerHeight, tableHeight, tableWidth, scrollbarHeight, scrollbarWidth, scrollXLoad, scrollYLoad, overflowX, cellOffsetWidth, columnStore, elemStore, editStore, currentRow, mouseConfig,
|
|
2911
|
+
let { $refs, isGroup, fullColumnIdData, tableColumn, customHeight, customMinHeight, customMaxHeight, border, headerHeight, showFooter, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow, showFooterOverflow: allColumnFooterOverflow, footerHeight, tableHeight, tableWidth, scrollbarHeight, scrollbarWidth, scrollXLoad, scrollYLoad, overflowX, cellOffsetWidth, columnStore, elemStore, editStore, currentRow, mouseConfig, spanMethod, expandColumn, footerSpanMethod, isAllOverflow, visibleColumn } = $xeTable;
|
|
2934
2912
|
const containerList = ['main', 'left', 'right'];
|
|
2935
2913
|
const emptyPlaceholderElem = $refs.emptyPlaceholder;
|
|
2936
2914
|
const bodyWrapperElem = elemStore['main-body-wrapper'];
|
|
@@ -2984,10 +2962,19 @@ const Methods = {
|
|
|
2984
2962
|
renderColumnList = visibleColumn;
|
|
2985
2963
|
}
|
|
2986
2964
|
else {
|
|
2987
|
-
// 如果是使用优化模式
|
|
2988
2965
|
if (fixedType) {
|
|
2989
|
-
|
|
2990
|
-
|
|
2966
|
+
// 如果是使用优化模式
|
|
2967
|
+
if (scrollXLoad || scrollYLoad || allColumnHeaderOverflow) {
|
|
2968
|
+
// 如果不支持优化模式
|
|
2969
|
+
if (spanMethod || footerSpanMethod) {
|
|
2970
|
+
renderColumnList = visibleColumn;
|
|
2971
|
+
}
|
|
2972
|
+
else {
|
|
2973
|
+
renderColumnList = fixedColumn || [];
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
else {
|
|
2977
|
+
renderColumnList = visibleColumn;
|
|
2991
2978
|
}
|
|
2992
2979
|
}
|
|
2993
2980
|
}
|
|
@@ -3074,15 +3061,15 @@ const Methods = {
|
|
|
3074
3061
|
}
|
|
3075
3062
|
let tWidth = tableWidth;
|
|
3076
3063
|
let renderColumnList = tableColumn;
|
|
3077
|
-
// 如果是使用优化模式
|
|
3078
3064
|
if (fixedType) {
|
|
3079
|
-
//
|
|
3080
|
-
if (
|
|
3081
|
-
|
|
3082
|
-
|
|
3065
|
+
// 如果是使用优化模式
|
|
3066
|
+
if (scrollXLoad || scrollYLoad || (allColumnOverflow && isAllOverflow)) {
|
|
3067
|
+
// 如果不支持优化模式
|
|
3068
|
+
if (expandColumn || spanMethod || footerSpanMethod) {
|
|
3069
|
+
renderColumnList = visibleColumn;
|
|
3083
3070
|
}
|
|
3084
3071
|
else {
|
|
3085
|
-
renderColumnList =
|
|
3072
|
+
renderColumnList = fixedColumn || [];
|
|
3086
3073
|
}
|
|
3087
3074
|
}
|
|
3088
3075
|
else {
|
|
@@ -3102,15 +3089,15 @@ const Methods = {
|
|
|
3102
3089
|
else if (layout === 'footer') {
|
|
3103
3090
|
let tWidth = tableWidth;
|
|
3104
3091
|
let renderColumnList = tableColumn;
|
|
3105
|
-
// 如果是使用优化模式
|
|
3106
3092
|
if (fixedType) {
|
|
3107
|
-
//
|
|
3108
|
-
if (
|
|
3109
|
-
|
|
3110
|
-
|
|
3093
|
+
// 如果是使用优化模式
|
|
3094
|
+
if (scrollXLoad || scrollYLoad || allColumnFooterOverflow) {
|
|
3095
|
+
// 如果不支持优化模式
|
|
3096
|
+
if (spanMethod || footerSpanMethod) {
|
|
3097
|
+
renderColumnList = visibleColumn;
|
|
3111
3098
|
}
|
|
3112
3099
|
else {
|
|
3113
|
-
renderColumnList =
|
|
3100
|
+
renderColumnList = fixedColumn || [];
|
|
3114
3101
|
}
|
|
3115
3102
|
}
|
|
3116
3103
|
else {
|
|
@@ -5155,7 +5142,8 @@ const Methods = {
|
|
|
5155
5142
|
const triggerFilter = getEventTargetNode(evnt, cell, 'vxe-cell--filter').flag;
|
|
5156
5143
|
let triggerDrag = false;
|
|
5157
5144
|
if (!(triggerInput || triggerCheckbox || triggerSort || triggerFilter)) {
|
|
5158
|
-
|
|
5145
|
+
const { column } = params;
|
|
5146
|
+
if (columnOpts.drag && !column.fixed && trigger === 'cell' && !(disabledMethod && disabledMethod(params))) {
|
|
5159
5147
|
triggerDrag = true;
|
|
5160
5148
|
$xeTable.handleHeaderCellDragMousedownEvent(evnt, params);
|
|
5161
5149
|
}
|
|
@@ -5477,7 +5465,7 @@ const Methods = {
|
|
|
5477
5465
|
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
5478
5466
|
}
|
|
5479
5467
|
},
|
|
5480
|
-
|
|
5468
|
+
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
5481
5469
|
const $xeTable = this;
|
|
5482
5470
|
const props = $xeTable;
|
|
5483
5471
|
const reactData = $xeTable;
|
|
@@ -5485,15 +5473,14 @@ const Methods = {
|
|
|
5485
5473
|
const { mouseConfig } = props;
|
|
5486
5474
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
5487
5475
|
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
5488
|
-
const {
|
|
5489
|
-
const { collectColumn, prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
5476
|
+
const { collectColumn } = internalData;
|
|
5490
5477
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
5491
5478
|
if (prevDragCol && dragCol) {
|
|
5492
5479
|
// 判断是否有拖动
|
|
5493
5480
|
if (prevDragCol !== dragCol) {
|
|
5494
5481
|
const oldColumn = dragCol;
|
|
5495
5482
|
const newColumn = prevDragCol;
|
|
5496
|
-
Promise.resolve(dragEndMethod
|
|
5483
|
+
return Promise.resolve(dragEndMethod
|
|
5497
5484
|
? dragEndMethod({
|
|
5498
5485
|
oldColumn,
|
|
5499
5486
|
newColumn,
|
|
@@ -5610,9 +5597,6 @@ const Methods = {
|
|
|
5610
5597
|
$xeTable.clearCopyCellArea();
|
|
5611
5598
|
}
|
|
5612
5599
|
}
|
|
5613
|
-
$xeTable.refreshColumn(true).then(() => {
|
|
5614
|
-
$xeTable.updateCellAreas();
|
|
5615
|
-
});
|
|
5616
5600
|
$xeTable.dispatchEvent('column-dragend', {
|
|
5617
5601
|
oldColumn,
|
|
5618
5602
|
newColumn,
|
|
@@ -5623,11 +5607,26 @@ const Methods = {
|
|
|
5623
5607
|
oldIndex: oafIndex
|
|
5624
5608
|
}
|
|
5625
5609
|
}, evnt);
|
|
5626
|
-
|
|
5610
|
+
if (isSyncColumn) {
|
|
5611
|
+
$xeTable.handleUpdateColumn();
|
|
5612
|
+
$xeTable.parseColumns(false).then(() => {
|
|
5613
|
+
$xeTable.updateCellAreas();
|
|
5614
|
+
return $xeTable.saveCustomStore('update:sort');
|
|
5615
|
+
});
|
|
5616
|
+
}
|
|
5627
5617
|
}).catch(() => {
|
|
5628
5618
|
});
|
|
5629
5619
|
}
|
|
5630
5620
|
}
|
|
5621
|
+
return Promise.resolve();
|
|
5622
|
+
},
|
|
5623
|
+
handleHeaderCellDragDragendEvent(evnt) {
|
|
5624
|
+
const $xeTable = this;
|
|
5625
|
+
const reactData = $xeTable;
|
|
5626
|
+
const internalData = $xeTable;
|
|
5627
|
+
const { dragCol } = reactData;
|
|
5628
|
+
const { prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
5629
|
+
$xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
|
|
5631
5630
|
hideDropTip($xeTable);
|
|
5632
5631
|
clearColDropOrigin($xeTable);
|
|
5633
5632
|
internalData.prevDragToChild = false;
|
|
@@ -5635,6 +5634,9 @@ const Methods = {
|
|
|
5635
5634
|
reactData.dragCol = null;
|
|
5636
5635
|
setTimeout(() => {
|
|
5637
5636
|
reactData.isDragColMove = false;
|
|
5637
|
+
$xeTable.recalculate().then(() => {
|
|
5638
|
+
$xeTable.loadScrollXData();
|
|
5639
|
+
});
|
|
5638
5640
|
}, 500);
|
|
5639
5641
|
},
|
|
5640
5642
|
handleHeaderCellDragDragoverEvent(evnt) {
|
|
@@ -5654,10 +5656,10 @@ const Methods = {
|
|
|
5654
5656
|
const column = $xeTable.getColumnById(colid);
|
|
5655
5657
|
if (column) {
|
|
5656
5658
|
evnt.preventDefault();
|
|
5657
|
-
const {
|
|
5658
|
-
const offsetX =
|
|
5659
|
+
const { clientX } = evnt;
|
|
5660
|
+
const offsetX = clientX - thEl.getBoundingClientRect().x;
|
|
5659
5661
|
const dragPos = offsetX < thEl.clientWidth / 2 ? 'left' : 'right';
|
|
5660
|
-
if ((dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
|
|
5662
|
+
if (column.fixed || (dragCol && dragCol.id === column.id) || (!isCrossDrag && column.parentId)) {
|
|
5661
5663
|
showDropTip($xeTable, evnt, null, thEl, false, dragPos);
|
|
5662
5664
|
return;
|
|
5663
5665
|
}
|
|
@@ -5670,6 +5672,36 @@ const Methods = {
|
|
|
5670
5672
|
targetColumn: column,
|
|
5671
5673
|
dragPos
|
|
5672
5674
|
}, evnt);
|
|
5675
|
+
// 边缘滚动
|
|
5676
|
+
const el = $xeTable.$refs.refElem;
|
|
5677
|
+
if (!el) {
|
|
5678
|
+
return;
|
|
5679
|
+
}
|
|
5680
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem;
|
|
5681
|
+
const tableBody = $xeTable.$refs.tableBody;
|
|
5682
|
+
const tableBodyElem = tableBody ? tableBody.$el : null;
|
|
5683
|
+
const scrollTargetEl = xHandleEl || tableBodyElem;
|
|
5684
|
+
if (scrollTargetEl) {
|
|
5685
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
5686
|
+
const tableWidth = el.clientWidth;
|
|
5687
|
+
const leftContainerElem = $xeTable.$refs.leftContainer;
|
|
5688
|
+
const leftContainerWidth = leftContainerElem ? leftContainerElem.clientWidth : 0;
|
|
5689
|
+
const rightContainerElem = $xeTable.$refs.rightContainer;
|
|
5690
|
+
const rightContainerWidth = rightContainerElem ? rightContainerElem.clientWidth : 0;
|
|
5691
|
+
const srartX = wrapperRect.x + leftContainerWidth;
|
|
5692
|
+
const endX = wrapperRect.x + tableWidth - rightContainerWidth;
|
|
5693
|
+
const distSize = 28;
|
|
5694
|
+
const startDistSize = clientX - srartX;
|
|
5695
|
+
const endDistSize = endX - clientX;
|
|
5696
|
+
if (startDistSize > 0 && startDistSize <= distSize) {
|
|
5697
|
+
const scrollRatio = Math.floor(tableWidth / (startDistSize > distSize / 2 ? 240 : 120));
|
|
5698
|
+
scrollTargetEl.scrollLeft -= scrollRatio * (distSize - startDistSize);
|
|
5699
|
+
}
|
|
5700
|
+
else if (endDistSize > 0 && endDistSize <= distSize) {
|
|
5701
|
+
const scrollRatio = Math.floor(tableWidth / (endDistSize > distSize / 2 ? 240 : 120));
|
|
5702
|
+
scrollTargetEl.scrollLeft += scrollRatio * (distSize - endDistSize);
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5673
5705
|
}
|
|
5674
5706
|
},
|
|
5675
5707
|
handleHeaderCellDragMousedownEvent(evnt, params) {
|
|
@@ -6916,6 +6948,15 @@ const Methods = {
|
|
|
6916
6948
|
});
|
|
6917
6949
|
this.tableColumn = tableColumn;
|
|
6918
6950
|
},
|
|
6951
|
+
handleUpdateColumn() {
|
|
6952
|
+
const $xeTable = this;
|
|
6953
|
+
const internalData = $xeTable;
|
|
6954
|
+
const columnList = XEUtils.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
6955
|
+
internalData.collectColumn = columnList;
|
|
6956
|
+
const tableFullColumn = getColumnList(columnList);
|
|
6957
|
+
internalData.tableFullColumn = tableFullColumn;
|
|
6958
|
+
$xeTable.cacheColumnMap();
|
|
6959
|
+
},
|
|
6919
6960
|
updateScrollXData() {
|
|
6920
6961
|
const $xeTable = this;
|
|
6921
6962
|
const props = $xeTable;
|
package/es/table/src/table.js
CHANGED
|
@@ -750,17 +750,6 @@ export default {
|
|
|
750
750
|
y: overflowY && scrollYLoad
|
|
751
751
|
};
|
|
752
752
|
},
|
|
753
|
-
computeTableStyle() {
|
|
754
|
-
const $xeTable = this;
|
|
755
|
-
const reactData = $xeTable;
|
|
756
|
-
const { tableData } = reactData;
|
|
757
|
-
const columnOpts = $xeTable.computeColumnOpts;
|
|
758
|
-
const stys = {};
|
|
759
|
-
if (columnOpts.drag) {
|
|
760
|
-
stys['--vxe-ui-table-drag-column-move-delay'] = `${Math.max(0.06, Math.min(0.3, tableData.length / 800))}s`;
|
|
761
|
-
}
|
|
762
|
-
return stys;
|
|
763
|
-
},
|
|
764
753
|
tabsResizeFlag() {
|
|
765
754
|
const $xeTable = this;
|
|
766
755
|
const $xeTabs = $xeTable.$xeTabs;
|
|
@@ -813,6 +802,11 @@ export default {
|
|
|
813
802
|
maxHeight() {
|
|
814
803
|
this.$nextTick(() => this.recalculate(true));
|
|
815
804
|
},
|
|
805
|
+
computeSize() {
|
|
806
|
+
this.$nextTick(() => {
|
|
807
|
+
this.recalculate(true).then(() => this.refreshScroll());
|
|
808
|
+
});
|
|
809
|
+
},
|
|
816
810
|
syncResize(value) {
|
|
817
811
|
if (value) {
|
|
818
812
|
handleUupdateResize(this);
|
|
@@ -1170,7 +1164,6 @@ export default {
|
|
|
1170
1164
|
const tableBorder = $xeTable.computeTableBorder;
|
|
1171
1165
|
const virtualScrollBars = $xeTable.computeVirtualScrollBars;
|
|
1172
1166
|
const isArea = mouseConfig && mouseOpts.area;
|
|
1173
|
-
const tableStyle = $xeTable.computeTableStyle;
|
|
1174
1167
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
1175
1168
|
return h('div', {
|
|
1176
1169
|
ref: 'refElem',
|
|
@@ -1205,7 +1198,6 @@ export default {
|
|
|
1205
1198
|
'is--virtual-x': scrollXLoad,
|
|
1206
1199
|
'is--virtual-y': scrollYLoad
|
|
1207
1200
|
}],
|
|
1208
|
-
style: tableStyle,
|
|
1209
1201
|
attrs: {
|
|
1210
1202
|
spellcheck: false
|
|
1211
1203
|
},
|
package/es/table/style.css
CHANGED
|
@@ -2260,13 +2260,13 @@
|
|
|
2260
2260
|
-moz-user-select: none;
|
|
2261
2261
|
user-select: none;
|
|
2262
2262
|
}
|
|
2263
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2263
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active {
|
|
2264
2264
|
cursor: grab;
|
|
2265
2265
|
}
|
|
2266
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2266
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active:active {
|
|
2267
2267
|
cursor: grabbing;
|
|
2268
2268
|
}
|
|
2269
|
-
.vxe-table--render-default.col--drag-cell .vxe-header--column
|
|
2269
|
+
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-active:hover {
|
|
2270
2270
|
color: var(--vxe-ui-font-primary-color);
|
|
2271
2271
|
}
|
|
2272
2272
|
.vxe-table--render-default.col--drag-cell .vxe-header--column.is--drag-disabled {
|
|
@@ -2799,7 +2799,6 @@
|
|
|
2799
2799
|
.vxe-table--render-default .vxe-header--col-list-move {
|
|
2800
2800
|
transition-property: transform;
|
|
2801
2801
|
transition-duration: 0.35s;
|
|
2802
|
-
transition-delay: var(--vxe-ui-table-drag-column-move-delay, 0.3s);
|
|
2803
2802
|
}
|
|
2804
2803
|
.vxe-table--render-default .vxe-table--drag-col-line,
|
|
2805
2804
|
.vxe-table--render-default .vxe-table--drag-row-line {
|
|
@@ -2874,7 +2873,6 @@
|
|
|
2874
2873
|
.vxe-table--render-default .vxe-body--row-list-move {
|
|
2875
2874
|
transition-property: transform;
|
|
2876
2875
|
transition-duration: 0.35s;
|
|
2877
|
-
transition-delay: 0.05s;
|
|
2878
2876
|
}
|
|
2879
2877
|
.vxe-table--render-default .vxe-table--drag-sort-tip {
|
|
2880
2878
|
display: none;
|