vxe-table 3.16.0-beta.0 → 3.16.0-beta.10
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/README.md +3 -1
- package/es/grid/src/grid.js +866 -692
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +4 -1
- package/es/locale/lang/de-DE.js +4 -1
- package/es/locale/lang/en-US.js +4 -1
- package/es/locale/lang/es-ES.js +4 -1
- package/es/locale/lang/fr-FR.js +4 -1
- package/es/locale/lang/hu-HU.js +4 -1
- package/es/locale/lang/hy-AM.js +4 -1
- package/es/locale/lang/id-ID.js +4 -1
- package/es/locale/lang/it-IT.js +4 -1
- package/es/locale/lang/ja-JP.js +4 -1
- package/es/locale/lang/ko-KR.js +4 -1
- package/es/locale/lang/ms-MY.js +4 -1
- package/es/locale/lang/nb-NO.js +4 -1
- package/es/locale/lang/pt-BR.js +4 -1
- package/es/locale/lang/ru-RU.js +4 -1
- package/es/locale/lang/th-TH.js +4 -1
- package/es/locale/lang/ug-CN.js +4 -1
- package/es/locale/lang/uk-UA.js +4 -1
- package/es/locale/lang/uz-UZ.js +4 -1
- package/es/locale/lang/vi-VN.js +4 -1
- package/es/locale/lang/zh-CHT.js +4 -1
- package/es/locale/lang/zh-CN.js +4 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +0 -4
- package/es/table/module/custom/panel.js +0 -1
- package/es/table/module/edit/mixin.js +31 -1
- package/es/table/module/keyboard/mixin.js +2 -2
- package/es/table/src/anime.js +46 -0
- package/es/table/src/body.js +18 -43
- package/es/table/src/cell.js +6 -3
- package/es/table/src/columnInfo.js +6 -1
- package/es/table/src/footer.js +4 -22
- package/es/table/src/header.js +2 -20
- package/es/table/src/methods.js +569 -362
- package/es/table/src/table.js +49 -18
- package/es/table/src/util.js +5 -1
- package/es/table/style.css +8 -8
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +3 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +8 -8
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +971 -810
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1725 -1292
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +4 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +4 -1
- package/lib/locale/lang/de-DE.js +4 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +4 -1
- package/lib/locale/lang/en-US.js +4 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +4 -1
- package/lib/locale/lang/es-ES.js +4 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +4 -1
- package/lib/locale/lang/fr-FR.js +4 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +4 -1
- package/lib/locale/lang/hu-HU.js +4 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +4 -1
- package/lib/locale/lang/hy-AM.js +4 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +4 -1
- package/lib/locale/lang/id-ID.js +4 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +4 -1
- package/lib/locale/lang/it-IT.js +4 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +4 -1
- package/lib/locale/lang/ja-JP.js +4 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +4 -1
- package/lib/locale/lang/ko-KR.js +4 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +4 -1
- package/lib/locale/lang/ms-MY.js +4 -1
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +4 -1
- package/lib/locale/lang/nb-NO.js +4 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +4 -1
- package/lib/locale/lang/pt-BR.js +4 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +4 -1
- package/lib/locale/lang/ru-RU.js +4 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +4 -1
- package/lib/locale/lang/th-TH.js +4 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +4 -1
- package/lib/locale/lang/ug-CN.js +4 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +4 -1
- package/lib/locale/lang/uk-UA.js +4 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +4 -1
- package/lib/locale/lang/uz-UZ.js +4 -1
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +4 -1
- package/lib/locale/lang/vi-VN.js +4 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +4 -1
- package/lib/locale/lang/zh-CHT.js +4 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +4 -1
- package/lib/locale/lang/zh-CN.js +4 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +4 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +0 -4
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +0 -1
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +30 -1
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +2 -2
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/src/anime.js +56 -0
- package/lib/table/src/anime.min.js +1 -0
- package/lib/table/src/body.js +5 -31
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +8 -7
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -1
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +5 -22
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -20
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +586 -371
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +49 -17
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +9 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +8 -8
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +3 -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 +8 -8
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1007 -779
- package/packages/locale/lang/ar-EG.ts +4 -1
- package/packages/locale/lang/de-DE.ts +4 -1
- package/packages/locale/lang/en-US.ts +4 -1
- package/packages/locale/lang/es-ES.ts +4 -1
- package/packages/locale/lang/fr-FR.ts +4 -1
- package/packages/locale/lang/hu-HU.ts +4 -1
- package/packages/locale/lang/hy-AM.ts +4 -1
- package/packages/locale/lang/id-ID.ts +4 -1
- package/packages/locale/lang/it-IT.ts +4 -1
- package/packages/locale/lang/ja-JP.ts +4 -1
- package/packages/locale/lang/ko-KR.ts +4 -1
- package/packages/locale/lang/ms-MY.ts +4 -1
- package/packages/locale/lang/nb-NO.ts +4 -1
- package/packages/locale/lang/pt-BR.ts +4 -1
- package/packages/locale/lang/ru-RU.ts +4 -1
- package/packages/locale/lang/th-TH.ts +4 -1
- package/packages/locale/lang/ug-CN.ts +4 -1
- package/packages/locale/lang/uk-UA.ts +4 -1
- package/packages/locale/lang/uz-UZ.ts +4 -1
- package/packages/locale/lang/vi-VN.ts +4 -1
- package/packages/locale/lang/zh-CHT.ts +4 -1
- package/packages/locale/lang/zh-CN.ts +4 -1
- package/packages/table/module/custom/mixin.ts +0 -4
- package/packages/table/module/custom/panel.ts +0 -1
- package/packages/table/module/edit/mixin.ts +30 -2
- package/packages/table/module/keyboard/mixin.ts +2 -2
- package/packages/table/src/anime.ts +52 -0
- package/packages/table/src/body.ts +18 -43
- package/packages/table/src/cell.ts +3 -3
- package/packages/table/src/columnInfo.ts +6 -1
- package/packages/table/src/footer.ts +4 -22
- package/packages/table/src/header.ts +2 -21
- package/packages/table/src/methods.ts +589 -374
- package/packages/table/src/props.ts +4 -4
- package/packages/table/src/table.ts +55 -18
- package/packages/table/src/util.ts +5 -1
- package/packages/ui/index.ts +2 -1
- package/styles/components/table.scss +9 -9
- package/types/all.d.ts +3 -2
- /package/es/{iconfont.1750770351840.ttf → iconfont.1751970594233.ttf} +0 -0
- /package/es/{iconfont.1750770351840.woff → iconfont.1751970594233.woff} +0 -0
- /package/es/{iconfont.1750770351840.woff2 → iconfont.1751970594233.woff2} +0 -0
- /package/lib/{iconfont.1750770351840.ttf → iconfont.1751970594233.ttf} +0 -0
- /package/lib/{iconfont.1750770351840.woff → iconfont.1751970594233.woff} +0 -0
- /package/lib/{iconfont.1750770351840.woff2 → iconfont.1751970594233.woff2} +0 -0
package/es/table/src/methods.js
CHANGED
|
@@ -3,8 +3,9 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTarge
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
6
|
-
import { getRowUniqueId, clearTableAllStatus, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem } from './util';
|
|
6
|
+
import { getRowUniqueId, clearTableAllStatus, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight } from './util';
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
|
+
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime';
|
|
8
9
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
9
10
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI;
|
|
10
11
|
const browseObj = XEUtils.browse();
|
|
@@ -417,7 +418,7 @@ function handleVirtualTreeExpand($xeTable, rows, expanded) {
|
|
|
417
418
|
updateAfterDataIndex($xeTable);
|
|
418
419
|
return $xeTable.$nextTick();
|
|
419
420
|
}).then(() => {
|
|
420
|
-
return $xeTable
|
|
421
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
421
422
|
}).then(() => {
|
|
422
423
|
setTimeout(() => {
|
|
423
424
|
$xeTable.updateCellAreas();
|
|
@@ -492,7 +493,7 @@ function handleRowGroupVirtualExpand($xeTable, rows, expanded) {
|
|
|
492
493
|
updateAfterDataIndex($xeTable);
|
|
493
494
|
return $xeTable.$nextTick();
|
|
494
495
|
}).then(() => {
|
|
495
|
-
return $xeTable
|
|
496
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
496
497
|
}).then(() => {
|
|
497
498
|
setTimeout(() => {
|
|
498
499
|
$xeTable.updateCellAreas();
|
|
@@ -1759,7 +1760,7 @@ function buildMergeData(mergeConfigs) {
|
|
|
1759
1760
|
}
|
|
1760
1761
|
return mergeMaps;
|
|
1761
1762
|
}
|
|
1762
|
-
|
|
1763
|
+
function handleBodyMerge($xeTable, merges) {
|
|
1763
1764
|
const internalData = $xeTable;
|
|
1764
1765
|
const { fullAllDataRowIdData, fullColumnIdData, visibleColumn, afterFullData, mergeBodyList, mergeBodyMaps } = internalData;
|
|
1765
1766
|
if (merges) {
|
|
@@ -1822,8 +1823,8 @@ const handleBodyMerge = ($xeTable, merges) => {
|
|
|
1822
1823
|
}
|
|
1823
1824
|
});
|
|
1824
1825
|
}
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1826
|
+
}
|
|
1827
|
+
function handleFooterMerge($xeTable, merges) {
|
|
1827
1828
|
const reactData = $xeTable;
|
|
1828
1829
|
const internalData = $xeTable;
|
|
1829
1830
|
const { footerTableData } = reactData;
|
|
@@ -1878,7 +1879,7 @@ const handleFooterMerge = ($xeTable, merges) => {
|
|
|
1878
1879
|
}
|
|
1879
1880
|
});
|
|
1880
1881
|
}
|
|
1881
|
-
}
|
|
1882
|
+
}
|
|
1882
1883
|
function removeBodyMerges($xeTable, merges) {
|
|
1883
1884
|
const internalData = $xeTable;
|
|
1884
1885
|
const { mergeBodyList, fullColumnIdData, fullAllDataRowIdData, mergeBodyMaps } = internalData;
|
|
@@ -2233,8 +2234,6 @@ function clearDragStatus($xeTable) {
|
|
|
2233
2234
|
hideDropTip($xeTable);
|
|
2234
2235
|
reactData.dragRow = null;
|
|
2235
2236
|
reactData.dragCol = null;
|
|
2236
|
-
reactData.isDragColMove = false;
|
|
2237
|
-
reactData.isDragRowMove = false;
|
|
2238
2237
|
}
|
|
2239
2238
|
}
|
|
2240
2239
|
function clearRowDropOrigin($xeTable) {
|
|
@@ -2575,7 +2574,7 @@ function calcScrollbar($xeTable) {
|
|
|
2575
2574
|
$xeTable.checkScrolling();
|
|
2576
2575
|
}
|
|
2577
2576
|
}
|
|
2578
|
-
function
|
|
2577
|
+
function handleRecalculateStyle($xeTable, reFull, reWidth, reHeight) {
|
|
2579
2578
|
const internalData = $xeTable;
|
|
2580
2579
|
const el = $xeTable.$refs.refElem;
|
|
2581
2580
|
internalData.rceRunTime = Date.now();
|
|
@@ -2590,19 +2589,28 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
2590
2589
|
calcVarRowHeightConfig($xeTable, 'small', smallEl);
|
|
2591
2590
|
calcVarRowHeightConfig($xeTable, 'mini', miniEl);
|
|
2592
2591
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2592
|
+
if (reWidth) {
|
|
2593
|
+
calcCellWidth($xeTable);
|
|
2594
|
+
}
|
|
2595
|
+
if (reFull) {
|
|
2596
|
+
autoCellWidth($xeTable);
|
|
2597
|
+
}
|
|
2595
2598
|
calcScrollbar($xeTable);
|
|
2596
2599
|
updateStyle($xeTable);
|
|
2597
2600
|
updateRowExpandStyle($xeTable);
|
|
2598
2601
|
return computeScrollLoad($xeTable).then(() => {
|
|
2599
2602
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2600
|
-
|
|
2603
|
+
if (reWidth) {
|
|
2604
|
+
calcCellWidth($xeTable);
|
|
2605
|
+
}
|
|
2601
2606
|
if (reFull) {
|
|
2602
2607
|
autoCellWidth($xeTable);
|
|
2603
2608
|
}
|
|
2604
|
-
|
|
2609
|
+
if (reHeight) {
|
|
2610
|
+
calcCellHeight($xeTable);
|
|
2611
|
+
}
|
|
2605
2612
|
updateStyle($xeTable);
|
|
2613
|
+
calcScrollbar($xeTable);
|
|
2606
2614
|
if (reFull) {
|
|
2607
2615
|
updateRowOffsetTop($xeTable);
|
|
2608
2616
|
}
|
|
@@ -2612,6 +2620,37 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
2612
2620
|
}
|
|
2613
2621
|
});
|
|
2614
2622
|
}
|
|
2623
|
+
function handleLazyRecalculate($xeTable, reFull, reWidth, reHeight) {
|
|
2624
|
+
const internalData = $xeTable;
|
|
2625
|
+
return new Promise(resolve => {
|
|
2626
|
+
const { rceTimeout, rceRunTime } = internalData;
|
|
2627
|
+
const resizeOpts = $xeTable.computeResizeOpts;
|
|
2628
|
+
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
2629
|
+
const el = $xeTable.$refs.refElem;
|
|
2630
|
+
if (el && el.clientWidth) {
|
|
2631
|
+
autoCellWidth($xeTable);
|
|
2632
|
+
updateRowExpandStyle($xeTable);
|
|
2633
|
+
}
|
|
2634
|
+
if (rceTimeout) {
|
|
2635
|
+
clearTimeout(rceTimeout);
|
|
2636
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
2637
|
+
resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
|
|
2638
|
+
}
|
|
2639
|
+
else {
|
|
2640
|
+
$xeTable.$nextTick(() => {
|
|
2641
|
+
resolve();
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
else {
|
|
2646
|
+
resolve(handleRecalculateStyle($xeTable, reFull, reWidth, reHeight));
|
|
2647
|
+
}
|
|
2648
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
2649
|
+
internalData.rceTimeout = undefined;
|
|
2650
|
+
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight);
|
|
2651
|
+
}, refreshDelay);
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2615
2654
|
function handleUpdateAggValues($xeTable) {
|
|
2616
2655
|
const reactData = $xeTable;
|
|
2617
2656
|
const internalData = $xeTable;
|
|
@@ -2834,8 +2873,6 @@ function loadTableData($xeTable, datas, isReset) {
|
|
|
2834
2873
|
internalData.removeRowMaps = {};
|
|
2835
2874
|
reactData.removeRowFlag++;
|
|
2836
2875
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
2837
|
-
reactData.isDragColMove = false;
|
|
2838
|
-
reactData.isDragRowMove = false;
|
|
2839
2876
|
// 全量数据
|
|
2840
2877
|
internalData.tableFullData = fullData;
|
|
2841
2878
|
internalData.tableFullTreeData = isRGroup ? [] : treeData;
|
|
@@ -2896,11 +2933,10 @@ function loadTableData($xeTable, datas, isReset) {
|
|
|
2896
2933
|
$xeTable.checkSelectionStatus();
|
|
2897
2934
|
return new Promise(resolve => {
|
|
2898
2935
|
$xeTable.$nextTick()
|
|
2899
|
-
.then(() =>
|
|
2936
|
+
.then(() => handleRecalculateStyle($xeTable, false, false, false))
|
|
2900
2937
|
.then(() => {
|
|
2901
|
-
|
|
2938
|
+
handleRecalculateStyle($xeTable, false, true, true);
|
|
2902
2939
|
updateRowOffsetTop($xeTable);
|
|
2903
|
-
return handleRecalculateLayout($xeTable, false);
|
|
2904
2940
|
})
|
|
2905
2941
|
.then(() => {
|
|
2906
2942
|
let targetScrollLeft = lastScrollLeft;
|
|
@@ -2915,12 +2951,12 @@ function loadTableData($xeTable, datas, isReset) {
|
|
|
2915
2951
|
targetScrollTop = 0;
|
|
2916
2952
|
}
|
|
2917
2953
|
reactData.isRowLoading = false;
|
|
2918
|
-
|
|
2954
|
+
handleRecalculateStyle($xeTable, false, false, false);
|
|
2919
2955
|
// 是否变更虚拟滚动
|
|
2920
2956
|
if (oldScrollYLoad === sYLoad) {
|
|
2921
2957
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2922
2958
|
.then(() => {
|
|
2923
|
-
|
|
2959
|
+
handleRecalculateStyle($xeTable, false, true, true);
|
|
2924
2960
|
updateRowOffsetTop($xeTable);
|
|
2925
2961
|
resolve();
|
|
2926
2962
|
});
|
|
@@ -2929,7 +2965,7 @@ function loadTableData($xeTable, datas, isReset) {
|
|
|
2929
2965
|
setTimeout(() => {
|
|
2930
2966
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
2931
2967
|
.then(() => {
|
|
2932
|
-
|
|
2968
|
+
handleRecalculateStyle($xeTable, false, true, true);
|
|
2933
2969
|
updateRowOffsetTop($xeTable);
|
|
2934
2970
|
resolve();
|
|
2935
2971
|
});
|
|
@@ -3164,7 +3200,6 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
3164
3200
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3165
3201
|
internalData.tableFullColumn = tableFullColumn;
|
|
3166
3202
|
reactData.isColLoading = true;
|
|
3167
|
-
reactData.isDragColMove = false;
|
|
3168
3203
|
initColumnSort($xeTable);
|
|
3169
3204
|
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
3170
3205
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
@@ -3192,7 +3227,7 @@ function handleColumn($xeTable, collectColumn) {
|
|
|
3192
3227
|
$xeTable.handleUpdateCustomColumn();
|
|
3193
3228
|
}
|
|
3194
3229
|
reactData.isColLoading = false;
|
|
3195
|
-
return $xeTable
|
|
3230
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
3196
3231
|
});
|
|
3197
3232
|
});
|
|
3198
3233
|
}
|
|
@@ -3383,8 +3418,21 @@ function updateHeight($xeTable) {
|
|
|
3383
3418
|
internalData.customHeight = 300;
|
|
3384
3419
|
}
|
|
3385
3420
|
}
|
|
3386
|
-
function calcColumnAutoWidth(column, wrapperEl) {
|
|
3387
|
-
const
|
|
3421
|
+
function calcColumnAutoWidth($xeTable, column, wrapperEl) {
|
|
3422
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
3423
|
+
const { autoOptions } = columnOpts;
|
|
3424
|
+
const { isCalcHeader, isCalcBody, isCalcFooter } = autoOptions || {};
|
|
3425
|
+
const querySelections = [];
|
|
3426
|
+
if (isCalcHeader) {
|
|
3427
|
+
querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);
|
|
3428
|
+
}
|
|
3429
|
+
if (isCalcBody) {
|
|
3430
|
+
querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);
|
|
3431
|
+
}
|
|
3432
|
+
if (isCalcFooter) {
|
|
3433
|
+
querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);
|
|
3434
|
+
}
|
|
3435
|
+
const cellElemList = querySelections.length ? wrapperEl.querySelectorAll(querySelections.join(',')) : [];
|
|
3388
3436
|
let leftRightPadding = 0;
|
|
3389
3437
|
const firstCellEl = cellElemList[0];
|
|
3390
3438
|
if (firstCellEl && firstCellEl.parentElement) {
|
|
@@ -3408,7 +3456,7 @@ function calcCellWidth($xeTable) {
|
|
|
3408
3456
|
autoWidthColumnList.forEach(column => {
|
|
3409
3457
|
const colid = column.id;
|
|
3410
3458
|
const colRest = fullColumnIdData[colid];
|
|
3411
|
-
const colWidth = calcColumnAutoWidth(column, el);
|
|
3459
|
+
const colWidth = calcColumnAutoWidth($xeTable, column, el);
|
|
3412
3460
|
if (colRest) {
|
|
3413
3461
|
colRest.width = Math.max(colWidth, colRest.width);
|
|
3414
3462
|
}
|
|
@@ -3653,10 +3701,10 @@ const Methods = {
|
|
|
3653
3701
|
}
|
|
3654
3702
|
}).then(() => {
|
|
3655
3703
|
$xeTable.updateCellAreas();
|
|
3656
|
-
return $xeTable
|
|
3704
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
3657
3705
|
}).then(() => {
|
|
3658
3706
|
// 存在滚动行为未结束情况
|
|
3659
|
-
setTimeout(() => $xeTable
|
|
3707
|
+
setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50);
|
|
3660
3708
|
});
|
|
3661
3709
|
},
|
|
3662
3710
|
handleTableData(force) {
|
|
@@ -3708,7 +3756,7 @@ const Methods = {
|
|
|
3708
3756
|
if (!initStatus) {
|
|
3709
3757
|
handleLoadDefaults($xeTable);
|
|
3710
3758
|
}
|
|
3711
|
-
return
|
|
3759
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
3712
3760
|
});
|
|
3713
3761
|
},
|
|
3714
3762
|
/**
|
|
@@ -3725,7 +3773,7 @@ const Methods = {
|
|
|
3725
3773
|
})
|
|
3726
3774
|
.then(() => {
|
|
3727
3775
|
handleLoadDefaults($xeTable);
|
|
3728
|
-
return
|
|
3776
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
3729
3777
|
});
|
|
3730
3778
|
},
|
|
3731
3779
|
/**
|
|
@@ -4217,7 +4265,7 @@ const Methods = {
|
|
|
4217
4265
|
}
|
|
4218
4266
|
return $xeTable.$nextTick().then(() => {
|
|
4219
4267
|
$xeTable.updateCellAreas();
|
|
4220
|
-
return $xeTable
|
|
4268
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
4221
4269
|
});
|
|
4222
4270
|
}
|
|
4223
4271
|
return $xeTable.reloadData(tableSourceData);
|
|
@@ -5108,7 +5156,7 @@ const Methods = {
|
|
|
5108
5156
|
return parseColumns($xeTable, true).then(() => {
|
|
5109
5157
|
return this.refreshScroll();
|
|
5110
5158
|
}).then(() => {
|
|
5111
|
-
return
|
|
5159
|
+
return handleLazyRecalculate($xeTable, false, true, true);
|
|
5112
5160
|
});
|
|
5113
5161
|
},
|
|
5114
5162
|
/**
|
|
@@ -5330,7 +5378,7 @@ const Methods = {
|
|
|
5330
5378
|
const cellParams = Object.assign(params, { cell });
|
|
5331
5379
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
5332
5380
|
el.setAttribute('data-calc-col', 'Y');
|
|
5333
|
-
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
5381
|
+
let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
|
|
5334
5382
|
el.removeAttribute('data-calc-col');
|
|
5335
5383
|
if (colRest) {
|
|
5336
5384
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
@@ -5639,35 +5687,8 @@ const Methods = {
|
|
|
5639
5687
|
*/
|
|
5640
5688
|
recalculate(reFull) {
|
|
5641
5689
|
const $xeTable = this;
|
|
5642
|
-
const
|
|
5643
|
-
return
|
|
5644
|
-
const { rceTimeout, rceRunTime } = internalData;
|
|
5645
|
-
const resizeOpts = $xeTable.computeResizeOpts;
|
|
5646
|
-
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
5647
|
-
const el = $xeTable.$refs.refElem;
|
|
5648
|
-
if (el && el.clientWidth) {
|
|
5649
|
-
autoCellWidth($xeTable);
|
|
5650
|
-
updateRowExpandStyle($xeTable);
|
|
5651
|
-
}
|
|
5652
|
-
if (rceTimeout) {
|
|
5653
|
-
clearTimeout(rceTimeout);
|
|
5654
|
-
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
5655
|
-
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
5656
|
-
}
|
|
5657
|
-
else {
|
|
5658
|
-
$xeTable.$nextTick(() => {
|
|
5659
|
-
resolve();
|
|
5660
|
-
});
|
|
5661
|
-
}
|
|
5662
|
-
}
|
|
5663
|
-
else {
|
|
5664
|
-
resolve(handleRecalculateLayout($xeTable, !!reFull));
|
|
5665
|
-
}
|
|
5666
|
-
internalData.rceTimeout = setTimeout(() => {
|
|
5667
|
-
internalData.rceTimeout = undefined;
|
|
5668
|
-
handleRecalculateLayout($xeTable, !!reFull);
|
|
5669
|
-
}, refreshDelay);
|
|
5670
|
-
});
|
|
5690
|
+
const isForce = !!reFull;
|
|
5691
|
+
return handleLazyRecalculate($xeTable, isForce, isForce, isForce);
|
|
5671
5692
|
},
|
|
5672
5693
|
updateStyle() {
|
|
5673
5694
|
const $xeTable = this;
|
|
@@ -6276,9 +6297,11 @@ const Methods = {
|
|
|
6276
6297
|
}
|
|
6277
6298
|
},
|
|
6278
6299
|
handleGlobalResizeEvent() {
|
|
6279
|
-
this
|
|
6280
|
-
|
|
6281
|
-
|
|
6300
|
+
const $xeTable = this;
|
|
6301
|
+
$xeTable.closeMenu();
|
|
6302
|
+
$xeTable.updateCellAreas();
|
|
6303
|
+
handleLazyRecalculate($xeTable, true, true, true);
|
|
6304
|
+
$xeTable.updateCellAreas();
|
|
6282
6305
|
},
|
|
6283
6306
|
/**
|
|
6284
6307
|
* 处理合并
|
|
@@ -6844,7 +6867,8 @@ const Methods = {
|
|
|
6844
6867
|
const childList = vals[2];
|
|
6845
6868
|
let sLen = 0; // 已选
|
|
6846
6869
|
let hLen = 0; // 半选
|
|
6847
|
-
let vLen = 0; //
|
|
6870
|
+
let vLen = 0; // 有效子行
|
|
6871
|
+
const cLen = childList.length; // 有效子行
|
|
6848
6872
|
childList.forEach(checkMethod
|
|
6849
6873
|
? (item) => {
|
|
6850
6874
|
const childRowid = handleGetRowId(item);
|
|
@@ -6878,16 +6902,29 @@ const Methods = {
|
|
|
6878
6902
|
}
|
|
6879
6903
|
vLen++;
|
|
6880
6904
|
});
|
|
6881
|
-
let isSelected =
|
|
6882
|
-
if (
|
|
6883
|
-
if (
|
|
6884
|
-
isSelected = sLen >= vLen;
|
|
6905
|
+
let isSelected = false;
|
|
6906
|
+
if (cLen > 0) {
|
|
6907
|
+
if (vLen > 0) {
|
|
6908
|
+
isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
|
|
6885
6909
|
}
|
|
6886
6910
|
else {
|
|
6887
|
-
|
|
6911
|
+
// 如果存在子项禁用
|
|
6912
|
+
if ((sLen > 0 && sLen >= vLen)) {
|
|
6913
|
+
isSelected = true;
|
|
6914
|
+
}
|
|
6915
|
+
else if (selectCheckboxMaps[rowid]) {
|
|
6916
|
+
isSelected = true;
|
|
6917
|
+
}
|
|
6918
|
+
else {
|
|
6919
|
+
isSelected = false;
|
|
6920
|
+
}
|
|
6888
6921
|
}
|
|
6889
6922
|
}
|
|
6890
|
-
|
|
6923
|
+
else {
|
|
6924
|
+
// 如果无子项
|
|
6925
|
+
isSelected = selectCheckboxMaps[rowid];
|
|
6926
|
+
}
|
|
6927
|
+
const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
|
|
6891
6928
|
if (checkField) {
|
|
6892
6929
|
XEUtils.set(row, checkField, isSelected);
|
|
6893
6930
|
}
|
|
@@ -6930,7 +6967,9 @@ const Methods = {
|
|
|
6930
6967
|
const { checkField, checkMethod, showReserveStatus } = checkboxOpts;
|
|
6931
6968
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
6932
6969
|
let sLen = 0; // 已选
|
|
6970
|
+
let dsLen = 0; // 禁用的已选
|
|
6933
6971
|
let hLen = 0; // 半选
|
|
6972
|
+
let dhLen = 0; // 禁用的半选
|
|
6934
6973
|
let vLen = 0; // 有效行
|
|
6935
6974
|
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData));
|
|
6936
6975
|
rootList.forEach(checkMethod
|
|
@@ -6948,10 +6987,10 @@ const Methods = {
|
|
|
6948
6987
|
}
|
|
6949
6988
|
else {
|
|
6950
6989
|
if (selected) {
|
|
6951
|
-
|
|
6990
|
+
dsLen++;
|
|
6952
6991
|
}
|
|
6953
6992
|
else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6954
|
-
|
|
6993
|
+
dhLen++;
|
|
6955
6994
|
}
|
|
6956
6995
|
}
|
|
6957
6996
|
}
|
|
@@ -6967,7 +7006,7 @@ const Methods = {
|
|
|
6967
7006
|
vLen++;
|
|
6968
7007
|
});
|
|
6969
7008
|
const isSelected = rootList.length > 0 ? (vLen > 0 ? (sLen >= vLen) : (sLen >= rootList.length)) : false;
|
|
6970
|
-
let halfSelect = !isSelected && (sLen
|
|
7009
|
+
let halfSelect = !isSelected && (sLen > 0 || hLen > 0 || dsLen > 0 || dhLen > 0);
|
|
6971
7010
|
// 如果复选框启用保留记录,当保留数据存在时显示半选
|
|
6972
7011
|
if (!isSelected && !halfSelect && showReserveStatus) {
|
|
6973
7012
|
halfSelect = !XEUtils.isEmpty(checkboxReserveRowMap);
|
|
@@ -7720,83 +7759,75 @@ const Methods = {
|
|
|
7720
7759
|
const { treeConfig, dragConfig } = props;
|
|
7721
7760
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
7722
7761
|
const { afterFullData, tableFullData, fullAllDataRowIdData } = internalData;
|
|
7723
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
7762
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
7724
7763
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
7764
|
+
const cellOpts = $xeTable.computeCellOpts;
|
|
7765
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
7766
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
7725
7767
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts;
|
|
7726
7768
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7727
7769
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
7728
7770
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
7771
|
+
const el = $xeTable.$refs.refElem;
|
|
7729
7772
|
const errRest = {
|
|
7730
7773
|
status: false
|
|
7731
7774
|
};
|
|
7732
|
-
if (prevDragRow && dragRow) {
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
7785
|
-
});
|
|
7786
|
-
}
|
|
7787
|
-
return errRest;
|
|
7788
|
-
}
|
|
7789
|
-
}
|
|
7790
|
-
}
|
|
7791
|
-
}
|
|
7792
|
-
else if (oldLevel) {
|
|
7793
|
-
// 子到根
|
|
7794
|
-
if (!isCrossDrag) {
|
|
7775
|
+
if (!(el && prevDragRow && dragRow)) {
|
|
7776
|
+
return Promise.resolve(errRest);
|
|
7777
|
+
}
|
|
7778
|
+
// 判断是否有拖动
|
|
7779
|
+
if (prevDragRow !== dragRow) {
|
|
7780
|
+
const dragParams = {
|
|
7781
|
+
oldRow: dragRow,
|
|
7782
|
+
newRow: prevDragRow,
|
|
7783
|
+
dragRow,
|
|
7784
|
+
dragPos: prevDragPos,
|
|
7785
|
+
dragToChild: !!prevDragToChild,
|
|
7786
|
+
offsetIndex: dragOffsetIndex
|
|
7787
|
+
};
|
|
7788
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
7789
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
7790
|
+
if (!status) {
|
|
7791
|
+
return errRest;
|
|
7792
|
+
}
|
|
7793
|
+
const dragRowid = getRowid($xeTable, dragRow);
|
|
7794
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid] || {};
|
|
7795
|
+
const _dragRowIndex = dragRowRest._index;
|
|
7796
|
+
let dragRowHeight = 0;
|
|
7797
|
+
let dragOffsetTop = -1;
|
|
7798
|
+
if (animation) {
|
|
7799
|
+
dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
|
|
7800
|
+
const oldTrEl = el.querySelector(`.vxe-body--row[rowid="${dragRowid}"]`);
|
|
7801
|
+
if (oldTrEl) {
|
|
7802
|
+
dragOffsetTop = oldTrEl.offsetTop;
|
|
7803
|
+
}
|
|
7804
|
+
}
|
|
7805
|
+
let oafIndex = -1;
|
|
7806
|
+
let nafIndex = -1;
|
|
7807
|
+
// 如果为树结构
|
|
7808
|
+
if (treeConfig) {
|
|
7809
|
+
if (transform) {
|
|
7810
|
+
// 移出源位置
|
|
7811
|
+
const oldRest = dragRowRest;
|
|
7812
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
7813
|
+
const newRest = fullAllDataRowIdData[newRowid];
|
|
7814
|
+
if (oldRest && newRest) {
|
|
7815
|
+
const { level: oldLevel } = oldRest;
|
|
7816
|
+
const { level: newLevel } = newRest;
|
|
7817
|
+
const oldAllMaps = {};
|
|
7818
|
+
XEUtils.eachTree([dragRow], item => {
|
|
7819
|
+
oldAllMaps[getRowid($xeTable, item)] = item;
|
|
7820
|
+
}, { children: mapChildrenField });
|
|
7821
|
+
let isSelfToChildStatus = false;
|
|
7822
|
+
if (oldLevel && newLevel) {
|
|
7823
|
+
// 子到子
|
|
7824
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
7825
|
+
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
7826
|
+
// 非同级
|
|
7795
7827
|
return errRest;
|
|
7796
7828
|
}
|
|
7797
7829
|
}
|
|
7798
|
-
else
|
|
7799
|
-
// 根到子
|
|
7830
|
+
else {
|
|
7800
7831
|
if (!isCrossDrag) {
|
|
7801
7832
|
return errRest;
|
|
7802
7833
|
}
|
|
@@ -7813,88 +7844,162 @@ const Methods = {
|
|
|
7813
7844
|
}
|
|
7814
7845
|
}
|
|
7815
7846
|
}
|
|
7816
|
-
|
|
7817
|
-
|
|
7847
|
+
}
|
|
7848
|
+
else if (oldLevel) {
|
|
7849
|
+
// 子到根
|
|
7850
|
+
if (!isCrossDrag) {
|
|
7851
|
+
return errRest;
|
|
7818
7852
|
}
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
// 移出
|
|
7825
|
-
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
7826
|
-
fullList.splice(otfIndex, 1);
|
|
7827
|
-
// 插入
|
|
7828
|
-
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
|
|
7829
|
-
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
7830
|
-
fullList.splice(ntfIndex, 0, dragRow);
|
|
7831
|
-
// 改变层级
|
|
7832
|
-
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
7833
|
-
XEUtils.each(dragRow[childrenField], childRow => {
|
|
7834
|
-
childRow[parentField] = dragRow[parentField];
|
|
7835
|
-
});
|
|
7853
|
+
}
|
|
7854
|
+
else if (newLevel) {
|
|
7855
|
+
// 根到子
|
|
7856
|
+
if (!isCrossDrag) {
|
|
7857
|
+
return errRest;
|
|
7836
7858
|
}
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7859
|
+
if (oldAllMaps[newRowid]) {
|
|
7860
|
+
isSelfToChildStatus = true;
|
|
7861
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
7862
|
+
if (VxeUI.modal) {
|
|
7863
|
+
VxeUI.modal.message({
|
|
7864
|
+
status: 'error',
|
|
7865
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
7866
|
+
});
|
|
7867
|
+
}
|
|
7868
|
+
return errRest;
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
}
|
|
7872
|
+
else {
|
|
7873
|
+
// 根到根
|
|
7874
|
+
}
|
|
7875
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
7876
|
+
key: rowField,
|
|
7877
|
+
parentKey: parentField,
|
|
7878
|
+
children: mapChildrenField
|
|
7879
|
+
});
|
|
7880
|
+
// 移出
|
|
7881
|
+
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
7882
|
+
fullList.splice(otfIndex, 1);
|
|
7883
|
+
// 插入
|
|
7884
|
+
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
|
|
7885
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
7886
|
+
fullList.splice(ntfIndex, 0, dragRow);
|
|
7887
|
+
// 改变层级
|
|
7888
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
7889
|
+
XEUtils.each(dragRow[childrenField], childRow => {
|
|
7890
|
+
childRow[parentField] = dragRow[parentField];
|
|
7843
7891
|
});
|
|
7844
7892
|
}
|
|
7893
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
7894
|
+
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
7895
|
+
key: rowField,
|
|
7896
|
+
parentKey: parentField,
|
|
7897
|
+
children: childrenField,
|
|
7898
|
+
mapChildren: mapChildrenField
|
|
7899
|
+
});
|
|
7845
7900
|
}
|
|
7846
7901
|
}
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7902
|
+
}
|
|
7903
|
+
else {
|
|
7904
|
+
// 移出
|
|
7905
|
+
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
|
|
7906
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
7907
|
+
afterFullData.splice(oafIndex, 1);
|
|
7908
|
+
tableFullData.splice(otfIndex, 1);
|
|
7909
|
+
// 插入
|
|
7910
|
+
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
7911
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
7912
|
+
nafIndex = pafIndex + dragOffsetIndex;
|
|
7913
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
7914
|
+
afterFullData.splice(nafIndex, 0, dragRow);
|
|
7915
|
+
tableFullData.splice(ntfIndex, 0, dragRow);
|
|
7916
|
+
}
|
|
7917
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
7918
|
+
$xeTable.cacheRowMap(false);
|
|
7919
|
+
updateScrollYStatus($xeTable);
|
|
7920
|
+
if (!(treeConfig && transform)) {
|
|
7921
|
+
updateAfterDataIndex($xeTable);
|
|
7922
|
+
}
|
|
7923
|
+
$xeTable.checkSelectionStatus();
|
|
7924
|
+
if (reactData.scrollYLoad) {
|
|
7925
|
+
$xeTable.updateScrollYSpace();
|
|
7926
|
+
}
|
|
7927
|
+
if (evnt) {
|
|
7928
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
7929
|
+
oldRow: dragRow,
|
|
7930
|
+
newRow: prevDragRow,
|
|
7931
|
+
dragRow,
|
|
7932
|
+
dragPos: prevDragPos,
|
|
7933
|
+
dragToChild: isDragToChildFlag,
|
|
7934
|
+
offsetIndex: dragOffsetIndex,
|
|
7935
|
+
_index: {
|
|
7936
|
+
newIndex: nafIndex,
|
|
7937
|
+
oldIndex: oafIndex
|
|
7938
|
+
}
|
|
7939
|
+
}, evnt);
|
|
7940
|
+
}
|
|
7941
|
+
return $xeTable.$nextTick().then(() => {
|
|
7942
|
+
if (animation) {
|
|
7943
|
+
const { tableData } = reactData;
|
|
7944
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid];
|
|
7945
|
+
const _newRowIndex = dragRowRest._index;
|
|
7946
|
+
const firstRow = tableData[0];
|
|
7947
|
+
const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
|
|
7948
|
+
if (firstRowRest) {
|
|
7949
|
+
const _firstRowIndex = firstRowRest._index;
|
|
7950
|
+
const _lastRowIndex = _firstRowIndex + tableData.length;
|
|
7951
|
+
let rsIndex = -1;
|
|
7952
|
+
let reIndex = -1;
|
|
7953
|
+
let offsetRate = 1;
|
|
7954
|
+
if (_dragRowIndex < _firstRowIndex) {
|
|
7955
|
+
// 从上往下虚拟拖拽
|
|
7956
|
+
rsIndex = 0;
|
|
7957
|
+
reIndex = _newRowIndex - _firstRowIndex;
|
|
7883
7958
|
}
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7959
|
+
else if (_dragRowIndex > _lastRowIndex) {
|
|
7960
|
+
// 从下往上虚拟拖拽
|
|
7961
|
+
const $newRowIndex = dragRowRest.$index;
|
|
7962
|
+
rsIndex = $newRowIndex + 1;
|
|
7963
|
+
reIndex = tableData.length;
|
|
7964
|
+
offsetRate = -1;
|
|
7965
|
+
}
|
|
7966
|
+
else {
|
|
7967
|
+
if (_newRowIndex > _dragRowIndex) {
|
|
7968
|
+
// 从上往下拖拽
|
|
7969
|
+
rsIndex = _dragRowIndex - _firstRowIndex;
|
|
7970
|
+
reIndex = rsIndex + _newRowIndex - _dragRowIndex;
|
|
7971
|
+
}
|
|
7972
|
+
else {
|
|
7973
|
+
// 从下往上拖拽
|
|
7974
|
+
rsIndex = _newRowIndex - _firstRowIndex;
|
|
7975
|
+
reIndex = rsIndex + _dragRowIndex - _newRowIndex + 1;
|
|
7976
|
+
offsetRate = -1;
|
|
7977
|
+
}
|
|
7978
|
+
}
|
|
7979
|
+
const dragRangeList = tableData.slice(rsIndex, reIndex);
|
|
7980
|
+
if (dragRangeList.length) {
|
|
7981
|
+
const dtTrList = el.querySelectorAll(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','));
|
|
7982
|
+
moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
|
|
7983
|
+
}
|
|
7984
|
+
}
|
|
7985
|
+
const newTrList = el.querySelectorAll(`.vxe-body--row[rowid="${dragRowid}"]`);
|
|
7986
|
+
const newTrEl = newTrList[0];
|
|
7987
|
+
if (dragOffsetTop > -1 && newTrEl) {
|
|
7988
|
+
moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop);
|
|
7989
|
+
}
|
|
7990
|
+
}
|
|
7991
|
+
updateRowOffsetTop($xeTable);
|
|
7992
|
+
updateRowExpandStyle($xeTable);
|
|
7993
|
+
$xeTable.updateCellAreas();
|
|
7994
|
+
$xeTable.recalculate();
|
|
7995
|
+
}).then(() => {
|
|
7996
|
+
return {
|
|
7997
|
+
status: true
|
|
7998
|
+
};
|
|
7896
7999
|
});
|
|
7897
|
-
}
|
|
8000
|
+
}).catch(() => {
|
|
8001
|
+
return errRest;
|
|
8002
|
+
});
|
|
7898
8003
|
}
|
|
7899
8004
|
return Promise.resolve(errRest);
|
|
7900
8005
|
},
|
|
@@ -7910,6 +8015,7 @@ const Methods = {
|
|
|
7910
8015
|
const { lazy } = treeOpts;
|
|
7911
8016
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
7912
8017
|
const { prevDragRow, prevDragPos } = internalData;
|
|
8018
|
+
const el = $xeTable.$refs.refElem;
|
|
7913
8019
|
if (treeConfig && lazy && prevDragToChild) {
|
|
7914
8020
|
// 懒加载
|
|
7915
8021
|
const newRowid = getRowid($xeTable, prevDragRow);
|
|
@@ -7928,18 +8034,16 @@ const Methods = {
|
|
|
7928
8034
|
}
|
|
7929
8035
|
hideDropTip($xeTable);
|
|
7930
8036
|
clearRowDropOrigin($xeTable);
|
|
8037
|
+
clearRowAnimate(el);
|
|
7931
8038
|
internalData.prevDragToChild = false;
|
|
7932
8039
|
reactData.dragRow = null;
|
|
7933
8040
|
reactData.dragCol = null;
|
|
7934
|
-
setTimeout(() => {
|
|
7935
|
-
reactData.isDragRowMove = false;
|
|
7936
|
-
}, 500);
|
|
7937
8041
|
},
|
|
7938
8042
|
handleRowDragDragoverEvent(evnt) {
|
|
7939
8043
|
const $xeTable = this;
|
|
7940
8044
|
const props = $xeTable;
|
|
7941
|
-
const internalData = $xeTable;
|
|
7942
8045
|
const reactData = $xeTable;
|
|
8046
|
+
const internalData = $xeTable;
|
|
7943
8047
|
const { treeConfig } = props;
|
|
7944
8048
|
const { fullAllDataRowIdData } = internalData;
|
|
7945
8049
|
const { dragRow } = reactData;
|
|
@@ -7995,7 +8099,6 @@ const Methods = {
|
|
|
7995
8099
|
const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
7996
8100
|
const trEl = tdEl.parentElement;
|
|
7997
8101
|
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null);
|
|
7998
|
-
reactData.isDragRowMove = false;
|
|
7999
8102
|
clearRowDropOrigin($xeTable);
|
|
8000
8103
|
if (dStartMethod && !dStartMethod(params)) {
|
|
8001
8104
|
trEl.draggable = false;
|
|
@@ -8026,7 +8129,7 @@ const Methods = {
|
|
|
8026
8129
|
handleColDragSwapColumn() {
|
|
8027
8130
|
const $xeTable = this;
|
|
8028
8131
|
handleUpdateColumn($xeTable);
|
|
8029
|
-
parseColumns($xeTable, false).then(() => {
|
|
8132
|
+
return parseColumns($xeTable, false).then(() => {
|
|
8030
8133
|
$xeTable.updateCellAreas();
|
|
8031
8134
|
$xeTable.saveCustomStore('update:sort');
|
|
8032
8135
|
});
|
|
@@ -8038,71 +8141,73 @@ const Methods = {
|
|
|
8038
8141
|
const internalData = $xeTable;
|
|
8039
8142
|
const { mouseConfig } = props;
|
|
8040
8143
|
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
8041
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8042
|
-
const { collectColumn } = internalData;
|
|
8144
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
8145
|
+
const { collectColumn, fullColumnIdData } = internalData;
|
|
8146
|
+
const el = $xeTable.$refs.refElem;
|
|
8043
8147
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
8044
8148
|
const errRest = {
|
|
8045
8149
|
status: false
|
|
8046
8150
|
};
|
|
8047
|
-
if (prevDragCol && dragCol) {
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8151
|
+
if (!(el && prevDragCol && dragCol)) {
|
|
8152
|
+
return Promise.resolve(errRest);
|
|
8153
|
+
}
|
|
8154
|
+
// 判断是否有拖动
|
|
8155
|
+
if (prevDragCol !== dragCol) {
|
|
8156
|
+
const dragColumn = dragCol;
|
|
8157
|
+
const newColumn = prevDragCol;
|
|
8158
|
+
const dragParams = {
|
|
8159
|
+
oldColumn: dragColumn,
|
|
8160
|
+
newColumn,
|
|
8161
|
+
dragColumn,
|
|
8162
|
+
dragPos: prevDragPos,
|
|
8163
|
+
dragToChild: !!prevDragToChild,
|
|
8164
|
+
offsetIndex: dragOffsetIndex
|
|
8165
|
+
};
|
|
8166
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
8167
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8168
|
+
if (!status) {
|
|
8169
|
+
return errRest;
|
|
8170
|
+
}
|
|
8171
|
+
let dragTargetColumn = null;
|
|
8172
|
+
const dragAllTargetCols = [];
|
|
8173
|
+
let dragColWidth = 0;
|
|
8174
|
+
if (animation) {
|
|
8068
8175
|
XEUtils.eachTree([dragColumn], column => {
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
if (dragColumn.parentId && newColumn.parentId) {
|
|
8073
|
-
// 子到子
|
|
8074
|
-
if (isPeerDrag && !isCrossDrag) {
|
|
8075
|
-
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8076
|
-
// 非同级
|
|
8077
|
-
return errRest;
|
|
8078
|
-
}
|
|
8079
|
-
}
|
|
8080
|
-
else {
|
|
8081
|
-
if (!isCrossDrag) {
|
|
8082
|
-
return errRest;
|
|
8083
|
-
}
|
|
8084
|
-
if (oldAllMaps[newColumn.id]) {
|
|
8085
|
-
isSelfToChildStatus = true;
|
|
8086
|
-
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8087
|
-
if (VxeUI.modal) {
|
|
8088
|
-
VxeUI.modal.message({
|
|
8089
|
-
status: 'error',
|
|
8090
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
8091
|
-
});
|
|
8092
|
-
}
|
|
8093
|
-
return errRest;
|
|
8094
|
-
}
|
|
8095
|
-
}
|
|
8176
|
+
if (!dragTargetColumn && (!column.children || !column.children.length)) {
|
|
8177
|
+
dragTargetColumn = column;
|
|
8178
|
+
dragColWidth += column.renderWidth;
|
|
8096
8179
|
}
|
|
8180
|
+
dragAllTargetCols.push(column);
|
|
8181
|
+
});
|
|
8182
|
+
}
|
|
8183
|
+
if (!dragTargetColumn) {
|
|
8184
|
+
dragTargetColumn = dragColumn;
|
|
8185
|
+
}
|
|
8186
|
+
const dragColRest = fullColumnIdData[dragTargetColumn.id] || {};
|
|
8187
|
+
const _dragColIndex = dragColRest._index;
|
|
8188
|
+
let dragOffsetLeft = -1;
|
|
8189
|
+
if (animation) {
|
|
8190
|
+
const oldTrEl = el.querySelector(`.vxe-table--column[colid="${dragTargetColumn.id}"]`);
|
|
8191
|
+
if (oldTrEl) {
|
|
8192
|
+
dragOffsetLeft = oldTrEl.offsetLeft;
|
|
8097
8193
|
}
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8194
|
+
}
|
|
8195
|
+
let oafIndex = -1;
|
|
8196
|
+
let nafIndex = -1;
|
|
8197
|
+
const oldAllMaps = {};
|
|
8198
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
8199
|
+
oldAllMaps[column.id] = column;
|
|
8200
|
+
});
|
|
8201
|
+
let isSelfToChildStatus = false;
|
|
8202
|
+
if (dragColumn.parentId && newColumn.parentId) {
|
|
8203
|
+
// 子到子
|
|
8204
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
8205
|
+
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8206
|
+
// 非同级
|
|
8101
8207
|
return errRest;
|
|
8102
8208
|
}
|
|
8103
8209
|
}
|
|
8104
|
-
else
|
|
8105
|
-
// 根到子
|
|
8210
|
+
else {
|
|
8106
8211
|
if (!isCrossDrag) {
|
|
8107
8212
|
return errRest;
|
|
8108
8213
|
}
|
|
@@ -8119,87 +8224,192 @@ const Methods = {
|
|
|
8119
8224
|
}
|
|
8120
8225
|
}
|
|
8121
8226
|
}
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
8128
|
-
if (oldewMatchRest) {
|
|
8129
|
-
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
8130
|
-
const childList = dragColumn.children || [];
|
|
8131
|
-
childList.forEach(column => {
|
|
8132
|
-
column.parentId = dragColumn.parentId;
|
|
8133
|
-
});
|
|
8134
|
-
oCols.splice(oIndex, 1, ...childList);
|
|
8135
|
-
dragColumn.children = [];
|
|
8136
|
-
}
|
|
8227
|
+
}
|
|
8228
|
+
else if (dragColumn.parentId) {
|
|
8229
|
+
// 子到根
|
|
8230
|
+
if (!isCrossDrag) {
|
|
8231
|
+
return errRest;
|
|
8137
8232
|
}
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8233
|
+
}
|
|
8234
|
+
else if (newColumn.parentId) {
|
|
8235
|
+
// 根到子
|
|
8236
|
+
if (!isCrossDrag) {
|
|
8237
|
+
return errRest;
|
|
8238
|
+
}
|
|
8239
|
+
if (oldAllMaps[newColumn.id]) {
|
|
8240
|
+
isSelfToChildStatus = true;
|
|
8241
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8242
|
+
if (VxeUI.modal) {
|
|
8243
|
+
VxeUI.modal.message({
|
|
8244
|
+
status: 'error',
|
|
8245
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
8246
|
+
});
|
|
8144
8247
|
}
|
|
8248
|
+
return errRest;
|
|
8145
8249
|
}
|
|
8146
8250
|
}
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8251
|
+
}
|
|
8252
|
+
else {
|
|
8253
|
+
// 根到根
|
|
8254
|
+
}
|
|
8255
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === dragColumn.id);
|
|
8256
|
+
// 改变层级
|
|
8257
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
8258
|
+
if (oldewMatchRest) {
|
|
8259
|
+
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
8260
|
+
const childList = dragColumn.children || [];
|
|
8261
|
+
childList.forEach(column => {
|
|
8262
|
+
column.parentId = dragColumn.parentId;
|
|
8263
|
+
});
|
|
8264
|
+
oCols.splice(oIndex, 1, ...childList);
|
|
8265
|
+
dragColumn.children = [];
|
|
8162
8266
|
}
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
if (mouseConfig) {
|
|
8171
|
-
if ($xeTable.clearSelected) {
|
|
8172
|
-
$xeTable.clearSelected();
|
|
8173
|
-
}
|
|
8174
|
-
if ($xeTable.clearCellAreas) {
|
|
8175
|
-
$xeTable.clearCellAreas();
|
|
8176
|
-
$xeTable.clearCopyCellArea();
|
|
8267
|
+
}
|
|
8268
|
+
else {
|
|
8269
|
+
if (oldewMatchRest) {
|
|
8270
|
+
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
|
|
8271
|
+
oCols.splice(oIndex, 1);
|
|
8272
|
+
if (!oParent) {
|
|
8273
|
+
oafIndex = oIndex;
|
|
8177
8274
|
}
|
|
8178
8275
|
}
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8276
|
+
}
|
|
8277
|
+
const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
|
|
8278
|
+
if (newMatchRest) {
|
|
8279
|
+
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
8280
|
+
// 转子级
|
|
8281
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
8282
|
+
dragColumn.parentId = newColumn.id;
|
|
8283
|
+
newColumn.children = (newColumn.children || []).concat([dragColumn]);
|
|
8284
|
+
}
|
|
8285
|
+
else {
|
|
8286
|
+
dragColumn.parentId = newColumn.parentId;
|
|
8287
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
|
|
8288
|
+
}
|
|
8289
|
+
if (!nParent) {
|
|
8290
|
+
nafIndex = nIndex;
|
|
8291
|
+
}
|
|
8292
|
+
}
|
|
8293
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
8294
|
+
if (!parentColumn) {
|
|
8295
|
+
const sortIndex = index + 1;
|
|
8296
|
+
column.renderSortNumber = sortIndex;
|
|
8192
8297
|
}
|
|
8298
|
+
});
|
|
8299
|
+
if (mouseConfig) {
|
|
8300
|
+
if ($xeTable.clearSelected) {
|
|
8301
|
+
$xeTable.clearSelected();
|
|
8302
|
+
}
|
|
8303
|
+
if ($xeTable.clearCellAreas) {
|
|
8304
|
+
$xeTable.clearCellAreas();
|
|
8305
|
+
$xeTable.clearCopyCellArea();
|
|
8306
|
+
}
|
|
8307
|
+
}
|
|
8308
|
+
if (evnt) {
|
|
8309
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
8310
|
+
oldColumn: dragColumn,
|
|
8311
|
+
newColumn,
|
|
8312
|
+
dragColumn,
|
|
8313
|
+
dragPos: prevDragPos,
|
|
8314
|
+
dragToChild: isDragToChildFlag,
|
|
8315
|
+
offsetIndex: dragOffsetIndex,
|
|
8316
|
+
_index: {
|
|
8317
|
+
newIndex: nafIndex,
|
|
8318
|
+
oldIndex: oafIndex
|
|
8319
|
+
}
|
|
8320
|
+
}, evnt);
|
|
8321
|
+
}
|
|
8322
|
+
return $xeTable.$nextTick().then(() => {
|
|
8193
8323
|
if (isSyncColumn) {
|
|
8194
|
-
$xeTable.handleColDragSwapColumn();
|
|
8324
|
+
return $xeTable.handleColDragSwapColumn();
|
|
8325
|
+
}
|
|
8326
|
+
}).then(() => {
|
|
8327
|
+
if (animation) {
|
|
8328
|
+
const { tableColumn } = reactData;
|
|
8329
|
+
const { visibleColumn, fullColumnIdData } = internalData;
|
|
8330
|
+
let dragNewColumn = null;
|
|
8331
|
+
const dragNewColMaps = {};
|
|
8332
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
8333
|
+
if (!dragNewColumn && (!column.children || !column.children.length)) {
|
|
8334
|
+
dragNewColumn = column;
|
|
8335
|
+
}
|
|
8336
|
+
dragNewColMaps[column.id] = column;
|
|
8337
|
+
});
|
|
8338
|
+
if (!dragNewColumn) {
|
|
8339
|
+
dragNewColumn = dragColumn;
|
|
8340
|
+
}
|
|
8341
|
+
if (dragColWidth && dragAllTargetCols.length) {
|
|
8342
|
+
const _newColIndex = XEUtils.findIndexOf(visibleColumn, column => !!dragNewColumn && column.id === dragNewColumn.id);
|
|
8343
|
+
const firstCol = tableColumn[0];
|
|
8344
|
+
const firstColRest = fullColumnIdData[firstCol.id];
|
|
8345
|
+
if (firstColRest) {
|
|
8346
|
+
const _firstColIndex = firstColRest._index;
|
|
8347
|
+
const _lastColIndex = _firstColIndex + tableColumn.length;
|
|
8348
|
+
let csIndex = -1;
|
|
8349
|
+
let ceIndex = -1;
|
|
8350
|
+
let offsetRate = 1;
|
|
8351
|
+
if (_dragColIndex < _firstColIndex) {
|
|
8352
|
+
// 从左往右虚拟拖拽
|
|
8353
|
+
csIndex = 0;
|
|
8354
|
+
ceIndex = _newColIndex - _firstColIndex;
|
|
8355
|
+
}
|
|
8356
|
+
else if (_dragColIndex > _lastColIndex) {
|
|
8357
|
+
// 从右往左虚拟拖拽
|
|
8358
|
+
const $newRowIndex = dragColRest.$index;
|
|
8359
|
+
csIndex = $newRowIndex + 1;
|
|
8360
|
+
ceIndex = tableColumn.length;
|
|
8361
|
+
offsetRate = -1;
|
|
8362
|
+
}
|
|
8363
|
+
else {
|
|
8364
|
+
if (_newColIndex > _dragColIndex) {
|
|
8365
|
+
// 从左往右拖拽
|
|
8366
|
+
csIndex = _dragColIndex - _firstColIndex;
|
|
8367
|
+
ceIndex = csIndex + _newColIndex - _dragColIndex;
|
|
8368
|
+
}
|
|
8369
|
+
else {
|
|
8370
|
+
// 从右往左拖拽
|
|
8371
|
+
csIndex = _newColIndex - _firstColIndex + 1;
|
|
8372
|
+
ceIndex = csIndex + _dragColIndex - _newColIndex;
|
|
8373
|
+
offsetRate = -1;
|
|
8374
|
+
}
|
|
8375
|
+
}
|
|
8376
|
+
const dragRangeList = [];
|
|
8377
|
+
const dragRangeMaps = {};
|
|
8378
|
+
for (let i = csIndex; i < ceIndex; i++) {
|
|
8379
|
+
const column = tableColumn[i];
|
|
8380
|
+
if (!dragRangeMaps[column.id] && !dragNewColMaps[column.id]) {
|
|
8381
|
+
dragRangeMaps[column.id] = column;
|
|
8382
|
+
dragRangeList.push(column);
|
|
8383
|
+
}
|
|
8384
|
+
}
|
|
8385
|
+
XEUtils.eachTree([newColumn], column => {
|
|
8386
|
+
if (!dragRangeMaps[column.id]) {
|
|
8387
|
+
dragRangeMaps[column.id] = column;
|
|
8388
|
+
dragRangeList.push(column);
|
|
8389
|
+
}
|
|
8390
|
+
});
|
|
8391
|
+
if (dragRangeList.length) {
|
|
8392
|
+
const dtTrList = el.querySelectorAll(dragRangeList.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
|
|
8393
|
+
moveColAnimateToLr(dtTrList, offsetRate * dragColWidth);
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8396
|
+
const newTrList = el.querySelectorAll(dragAllTargetCols.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
|
|
8397
|
+
const newTdEl = newTrList[0];
|
|
8398
|
+
if (dragOffsetLeft > -1 && newTdEl) {
|
|
8399
|
+
moveColAnimateToLr(newTrList, dragOffsetLeft - newTdEl.offsetLeft);
|
|
8400
|
+
}
|
|
8401
|
+
}
|
|
8195
8402
|
}
|
|
8403
|
+
updateColumnOffsetLeft($xeTable);
|
|
8404
|
+
loadScrollXData($xeTable);
|
|
8405
|
+
$xeTable.updateCellAreas();
|
|
8196
8406
|
return {
|
|
8197
8407
|
status: true
|
|
8198
8408
|
};
|
|
8199
|
-
}).catch(() => {
|
|
8200
|
-
return errRest;
|
|
8201
8409
|
});
|
|
8202
|
-
}
|
|
8410
|
+
}).catch(() => {
|
|
8411
|
+
return errRest;
|
|
8412
|
+
});
|
|
8203
8413
|
}
|
|
8204
8414
|
return Promise.resolve(errRest);
|
|
8205
8415
|
},
|
|
@@ -8209,18 +8419,14 @@ const Methods = {
|
|
|
8209
8419
|
const internalData = $xeTable;
|
|
8210
8420
|
const { dragCol } = reactData;
|
|
8211
8421
|
const { prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
8422
|
+
const el = $xeTable.$refs.refElem;
|
|
8212
8423
|
$xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
|
|
8213
8424
|
hideDropTip($xeTable);
|
|
8214
8425
|
clearColDropOrigin($xeTable);
|
|
8426
|
+
clearColAnimate(el);
|
|
8215
8427
|
internalData.prevDragToChild = false;
|
|
8216
8428
|
reactData.dragRow = null;
|
|
8217
8429
|
reactData.dragCol = null;
|
|
8218
|
-
setTimeout(() => {
|
|
8219
|
-
reactData.isDragColMove = false;
|
|
8220
|
-
$xeTable.recalculate().then(() => {
|
|
8221
|
-
loadScrollXData($xeTable);
|
|
8222
|
-
});
|
|
8223
|
-
}, 500);
|
|
8224
8430
|
},
|
|
8225
8431
|
handleHeaderCellDragDragoverEvent(evnt) {
|
|
8226
8432
|
const $xeTable = this;
|
|
@@ -8299,7 +8505,6 @@ const Methods = {
|
|
|
8299
8505
|
const { column } = params;
|
|
8300
8506
|
const dragEl = evnt.currentTarget;
|
|
8301
8507
|
const thEl = trigger === 'cell' ? dragEl : (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
8302
|
-
reactData.isDragColMove = false;
|
|
8303
8508
|
clearColDropOrigin($xeTable);
|
|
8304
8509
|
if (dragStartMethod && !dragStartMethod(params)) {
|
|
8305
8510
|
thEl.draggable = false;
|
|
@@ -8322,7 +8527,6 @@ const Methods = {
|
|
|
8322
8527
|
hideDropTip($xeTable);
|
|
8323
8528
|
reactData.dragRow = null;
|
|
8324
8529
|
reactData.dragCol = null;
|
|
8325
|
-
reactData.isDragColMove = false;
|
|
8326
8530
|
},
|
|
8327
8531
|
setPendingRow(rows, status) {
|
|
8328
8532
|
const $xeTable = this;
|
|
@@ -8815,7 +9019,7 @@ const Methods = {
|
|
|
8815
9019
|
reactData.rowExpandedFlag++;
|
|
8816
9020
|
return Promise.all(lazyRests)
|
|
8817
9021
|
.then(() => $xeTable.$nextTick())
|
|
8818
|
-
.then(() => $xeTable
|
|
9022
|
+
.then(() => handleLazyRecalculate($xeTable, true, true, true))
|
|
8819
9023
|
.then(() => {
|
|
8820
9024
|
updateRowOffsetTop($xeTable);
|
|
8821
9025
|
updateRowExpandStyle($xeTable);
|
|
@@ -8859,7 +9063,7 @@ const Methods = {
|
|
|
8859
9063
|
}
|
|
8860
9064
|
return $xeTable.$nextTick().then(() => {
|
|
8861
9065
|
if (expList.length) {
|
|
8862
|
-
return $xeTable
|
|
9066
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
8863
9067
|
}
|
|
8864
9068
|
}).then(() => {
|
|
8865
9069
|
updateRowOffsetTop($xeTable);
|
|
@@ -8992,7 +9196,7 @@ const Methods = {
|
|
|
8992
9196
|
$xeTable.handleTableData();
|
|
8993
9197
|
updateAfterDataIndex($xeTable);
|
|
8994
9198
|
reactData.rowGroupExpandedFlag++;
|
|
8995
|
-
return $xeTable
|
|
9199
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
8996
9200
|
},
|
|
8997
9201
|
clearRowGroupExpand() {
|
|
8998
9202
|
const $xeTable = this;
|
|
@@ -9003,7 +9207,7 @@ const Methods = {
|
|
|
9003
9207
|
$xeTable.handleTableData();
|
|
9004
9208
|
updateAfterDataIndex($xeTable);
|
|
9005
9209
|
reactData.rowGroupExpandedFlag++;
|
|
9006
|
-
return $xeTable
|
|
9210
|
+
return handleLazyRecalculate($xeTable, true, true, true);
|
|
9007
9211
|
},
|
|
9008
9212
|
getTreeExpandRecords() {
|
|
9009
9213
|
const $xeTable = this;
|
|
@@ -9353,8 +9557,6 @@ const Methods = {
|
|
|
9353
9557
|
}
|
|
9354
9558
|
internalData.lastScrollTop = scrollTop;
|
|
9355
9559
|
}
|
|
9356
|
-
reactData.isDragColMove = false;
|
|
9357
|
-
reactData.isDragRowMove = false;
|
|
9358
9560
|
reactData.lastScrollTime = Date.now();
|
|
9359
9561
|
const evntParams = Object.assign({ scrollTop,
|
|
9360
9562
|
scrollLeft,
|
|
@@ -10176,25 +10378,30 @@ const Methods = {
|
|
|
10176
10378
|
});
|
|
10177
10379
|
},
|
|
10178
10380
|
/**
|
|
10179
|
-
* 设置合并单元格
|
|
10180
|
-
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
10381
|
+
* 设置合并单元格 [{ row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }]
|
|
10181
10382
|
*/
|
|
10182
10383
|
setMergeCells(merges) {
|
|
10183
10384
|
const $xeTable = this;
|
|
10184
10385
|
const props = $xeTable;
|
|
10386
|
+
const reactData = $xeTable;
|
|
10387
|
+
const internalData = $xeTable;
|
|
10185
10388
|
if (props.spanMethod) {
|
|
10186
10389
|
errLog('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
10187
10390
|
}
|
|
10188
10391
|
handleBodyMerge($xeTable, merges);
|
|
10189
10392
|
$xeTable.handleUpdateBodyMerge();
|
|
10190
10393
|
return $xeTable.$nextTick().then(() => {
|
|
10394
|
+
const { expandColumn } = reactData;
|
|
10395
|
+
const { mergeBodyList } = internalData;
|
|
10396
|
+
if (expandColumn && mergeBodyList.length) {
|
|
10397
|
+
warnLog('vxe.error.errConflicts', ['type=expand', 'merge-cells | span-method']);
|
|
10398
|
+
}
|
|
10191
10399
|
$xeTable.updateCellAreas();
|
|
10192
10400
|
return updateStyle($xeTable);
|
|
10193
10401
|
});
|
|
10194
10402
|
},
|
|
10195
10403
|
/**
|
|
10196
|
-
* 移除单元格合并
|
|
10197
|
-
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
10404
|
+
* 移除单元格合并 [{row:Row|number, col:ColumnInfo|number}]
|
|
10198
10405
|
*/
|
|
10199
10406
|
removeMergeCells(merges) {
|
|
10200
10407
|
const $xeTable = this;
|