vxe-table 4.14.0-beta.1 → 4.14.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.en.md +1 -70
- package/README.ja-JP.md +1 -70
- package/README.md +9 -18
- package/README.zh-TW.md +1 -69
- package/es/grid/src/grid.js +30 -21
- package/es/index.css +1 -1
- package/es/index.esm.js +2 -2
- 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/hook.js +0 -4
- package/es/table/module/custom/panel.js +0 -1
- package/es/table/module/edit/hook.js +31 -1
- package/es/table/module/filter/hook.js +1 -1
- package/es/table/src/anime.js +46 -0
- package/es/table/src/body.js +13 -27
- package/es/table/src/cell.js +1 -1
- package/es/table/src/columnInfo.js +5 -0
- package/es/table/src/footer.js +8 -25
- package/es/table/src/header.js +5 -22
- package/es/table/src/table.js +609 -381
- package/es/table/src/util.js +6 -2
- package/es/table/style.css +8 -8
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +7 -1
- 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 +35 -23
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.common.js +5 -5
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +211 -153
- 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/hook.js +0 -4
- package/lib/table/module/custom/hook.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/hook.js +30 -1
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/filter/hook.js +1 -1
- package/lib/table/module/filter/hook.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 +6 -29
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +1 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +5 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +6 -23
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +3 -20
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +56 -45
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +11 -3
- 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 +7 -1
- 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 +32 -22
- package/packages/index.ts +2 -2
- 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/hook.ts +0 -4
- package/packages/table/module/custom/panel.ts +0 -1
- package/packages/table/module/edit/hook.ts +29 -1
- package/packages/table/module/filter/hook.ts +1 -1
- package/packages/table/src/anime.ts +52 -0
- package/packages/table/src/body.ts +20 -41
- package/packages/table/src/cell.ts +1 -1
- package/packages/table/src/columnInfo.ts +5 -0
- package/packages/table/src/footer.ts +8 -25
- package/packages/table/src/header.ts +5 -22
- package/packages/table/src/table.ts +620 -384
- package/packages/table/src/util.ts +6 -2
- package/packages/ui/index.ts +6 -0
- package/styles/components/table.scss +9 -9
- package/types/all.d.ts +3 -18
- /package/es/{iconfont.1750910518778.ttf → iconfont.1751970630744.ttf} +0 -0
- /package/es/{iconfont.1750910518778.woff → iconfont.1751970630744.woff} +0 -0
- /package/es/{iconfont.1750910518778.woff2 → iconfont.1751970630744.woff2} +0 -0
- /package/lib/{iconfont.1750910518778.ttf → iconfont.1751970630744.ttf} +0 -0
- /package/lib/{iconfont.1750910518778.woff → iconfont.1751970630744.woff} +0 -0
- /package/lib/{iconfont.1750910518778.woff2 → iconfont.1751970630744.woff2} +0 -0
package/es/table/src/table.js
CHANGED
|
@@ -4,15 +4,16 @@ import XEUtils from 'xe-utils';
|
|
|
4
4
|
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey } from '../../ui/src/dom';
|
|
5
5
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
6
6
|
import { VxeUI } from '../../ui';
|
|
7
|
+
import { getRowUniqueId, clearTableAllStatus, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight } from './util';
|
|
8
|
+
import { getSlotVNs } from '../../ui/src/vn';
|
|
9
|
+
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from './anime';
|
|
10
|
+
import { warnLog, errLog } from '../../ui/src/log';
|
|
7
11
|
import Cell from './cell';
|
|
8
12
|
import TableBodyComponent from './body';
|
|
9
13
|
import TableHeaderComponent from './header';
|
|
10
14
|
import TableFooterComponent from './footer';
|
|
11
15
|
import tableProps from './props';
|
|
12
16
|
import tableEmits from './emits';
|
|
13
|
-
import { getRowUniqueId, clearTableAllStatus, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCellHeight } from './util';
|
|
14
|
-
import { getSlotVNs } from '../../ui/src/vn';
|
|
15
|
-
import { warnLog, errLog } from '../../ui/src/log';
|
|
16
17
|
import TableCustomPanelComponent from '../module/custom/panel';
|
|
17
18
|
import TableFilterPanelComponent from '../module/filter/panel';
|
|
18
19
|
import TableImportPanelComponent from '../module/export/import-panel';
|
|
@@ -259,6 +260,7 @@ export default defineVxeComponent({
|
|
|
259
260
|
scrollXLeft: 0,
|
|
260
261
|
scrollXWidth: 0,
|
|
261
262
|
isScrollXBig: false,
|
|
263
|
+
lazScrollLoading: false,
|
|
262
264
|
rowExpandHeightFlag: 1,
|
|
263
265
|
calcCellHeightFlag: 1,
|
|
264
266
|
resizeHeightFlag: 1,
|
|
@@ -519,13 +521,13 @@ export default defineVxeComponent({
|
|
|
519
521
|
const computeHeaderCellOpts = computed(() => {
|
|
520
522
|
const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig);
|
|
521
523
|
const cellOpts = computeCellOpts.value;
|
|
522
|
-
headerCellOpts.height = XEUtils.toNumber(
|
|
524
|
+
headerCellOpts.height = XEUtils.toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height));
|
|
523
525
|
return headerCellOpts;
|
|
524
526
|
});
|
|
525
527
|
const computeFooterCellOpts = computed(() => {
|
|
526
528
|
const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig);
|
|
527
529
|
const cellOpts = computeCellOpts.value;
|
|
528
|
-
footerCellOpts.height = XEUtils.toNumber(
|
|
530
|
+
footerCellOpts.height = XEUtils.toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height));
|
|
529
531
|
return footerCellOpts;
|
|
530
532
|
});
|
|
531
533
|
const computeRowOpts = computed(() => {
|
|
@@ -680,10 +682,10 @@ export default defineVxeComponent({
|
|
|
680
682
|
return Object.assign({}, getConfig().table.customConfig, props.customConfig);
|
|
681
683
|
});
|
|
682
684
|
const computeTableRowExpandedList = computed(() => {
|
|
683
|
-
const { rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData;
|
|
685
|
+
const { tableData, rowExpandedFlag, expandColumn, rowGroupExpandedFlag, treeExpandedFlag } = reactData;
|
|
684
686
|
const { visibleDataRowIdData, rowExpandedMaps } = internalData;
|
|
685
687
|
const expandList = [];
|
|
686
|
-
if (expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
|
|
688
|
+
if (tableData.length && expandColumn && rowExpandedFlag && rowGroupExpandedFlag && treeExpandedFlag) {
|
|
687
689
|
XEUtils.each(rowExpandedMaps, (row, rowid) => {
|
|
688
690
|
if (visibleDataRowIdData[rowid]) {
|
|
689
691
|
expandList.push(row);
|
|
@@ -1107,6 +1109,12 @@ export default defineVxeComponent({
|
|
|
1107
1109
|
}
|
|
1108
1110
|
return mergeMaps;
|
|
1109
1111
|
}
|
|
1112
|
+
const handleUpdateMergeBodyCells = (merges) => {
|
|
1113
|
+
internalData.mergeBodyList = [];
|
|
1114
|
+
internalData.mergeBodyMaps = {};
|
|
1115
|
+
internalData.mergeBodyCellMaps = {};
|
|
1116
|
+
$xeTable.setMergeCells(merges);
|
|
1117
|
+
};
|
|
1110
1118
|
const handleBodyMerge = (merges) => {
|
|
1111
1119
|
const { fullAllDataRowIdData, fullColumnIdData, visibleColumn, afterFullData, mergeBodyList, mergeBodyMaps } = internalData;
|
|
1112
1120
|
if (merges) {
|
|
@@ -1170,6 +1178,12 @@ export default defineVxeComponent({
|
|
|
1170
1178
|
});
|
|
1171
1179
|
}
|
|
1172
1180
|
};
|
|
1181
|
+
const handleUpdateMergeFooterCells = (merges) => {
|
|
1182
|
+
internalData.mergeFooterList = [];
|
|
1183
|
+
internalData.mergeFooterMaps = {};
|
|
1184
|
+
internalData.mergeFooterCellMaps = {};
|
|
1185
|
+
$xeTable.setMergeFooterItems(merges);
|
|
1186
|
+
};
|
|
1173
1187
|
const handleFooterMerge = (merges) => {
|
|
1174
1188
|
const { footerTableData } = reactData;
|
|
1175
1189
|
const { mergeFooterList, mergeFooterMaps, fullColumnIdData } = internalData;
|
|
@@ -1585,7 +1599,20 @@ export default defineVxeComponent({
|
|
|
1585
1599
|
}
|
|
1586
1600
|
};
|
|
1587
1601
|
const calcColumnAutoWidth = (column, wrapperEl) => {
|
|
1588
|
-
const
|
|
1602
|
+
const columnOpts = computeColumnOpts.value;
|
|
1603
|
+
const { autoOptions } = columnOpts;
|
|
1604
|
+
const { isCalcHeader, isCalcBody, isCalcFooter } = autoOptions || {};
|
|
1605
|
+
const querySelections = [];
|
|
1606
|
+
if (isCalcHeader) {
|
|
1607
|
+
querySelections.push(`.vxe-header-cell--wrapper[colid="${column.id}"]`);
|
|
1608
|
+
}
|
|
1609
|
+
if (isCalcBody) {
|
|
1610
|
+
querySelections.push(`.vxe-body-cell--wrapper[colid="${column.id}"]`);
|
|
1611
|
+
}
|
|
1612
|
+
if (isCalcFooter) {
|
|
1613
|
+
querySelections.push(`.vxe-footer-cell--wrapper[colid="${column.id}"]`);
|
|
1614
|
+
}
|
|
1615
|
+
const cellElemList = querySelections.length ? wrapperEl.querySelectorAll(querySelections.join(',')) : [];
|
|
1589
1616
|
let leftRightPadding = 0;
|
|
1590
1617
|
const firstCellEl = cellElemList[0];
|
|
1591
1618
|
if (firstCellEl && firstCellEl.parentElement) {
|
|
@@ -2968,7 +2995,7 @@ export default defineVxeComponent({
|
|
|
2968
2995
|
$xeTable.checkScrolling();
|
|
2969
2996
|
}
|
|
2970
2997
|
};
|
|
2971
|
-
const
|
|
2998
|
+
const handleRecalculateStyle = (reFull, reWidth, reHeight) => {
|
|
2972
2999
|
const el = refElem.value;
|
|
2973
3000
|
internalData.rceRunTime = Date.now();
|
|
2974
3001
|
if (!el || !el.clientWidth) {
|
|
@@ -2982,19 +3009,28 @@ export default defineVxeComponent({
|
|
|
2982
3009
|
calcVarRowHeightConfig('small', smallEl);
|
|
2983
3010
|
calcVarRowHeightConfig('mini', miniEl);
|
|
2984
3011
|
}
|
|
2985
|
-
|
|
2986
|
-
|
|
3012
|
+
if (reWidth) {
|
|
3013
|
+
calcCellWidth();
|
|
3014
|
+
}
|
|
3015
|
+
if (reFull) {
|
|
3016
|
+
autoCellWidth();
|
|
3017
|
+
}
|
|
2987
3018
|
calcScrollbar();
|
|
2988
3019
|
updateStyle();
|
|
2989
3020
|
updateRowExpandStyle();
|
|
2990
3021
|
return computeScrollLoad().then(() => {
|
|
2991
3022
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2992
|
-
|
|
3023
|
+
if (reWidth) {
|
|
3024
|
+
calcCellWidth();
|
|
3025
|
+
}
|
|
2993
3026
|
if (reFull) {
|
|
2994
3027
|
autoCellWidth();
|
|
2995
3028
|
}
|
|
2996
|
-
|
|
3029
|
+
if (reHeight) {
|
|
3030
|
+
calcCellHeight();
|
|
3031
|
+
}
|
|
2997
3032
|
updateStyle();
|
|
3033
|
+
calcScrollbar();
|
|
2998
3034
|
if (reFull) {
|
|
2999
3035
|
updateRowOffsetTop();
|
|
3000
3036
|
}
|
|
@@ -3004,6 +3040,36 @@ export default defineVxeComponent({
|
|
|
3004
3040
|
}
|
|
3005
3041
|
});
|
|
3006
3042
|
};
|
|
3043
|
+
const handleLazyRecalculate = (reFull, reWidth, reHeight) => {
|
|
3044
|
+
return new Promise(resolve => {
|
|
3045
|
+
const { rceTimeout, rceRunTime } = internalData;
|
|
3046
|
+
const resizeOpts = computeResizeOpts.value;
|
|
3047
|
+
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
3048
|
+
const el = refElem.value;
|
|
3049
|
+
if (el && el.clientWidth) {
|
|
3050
|
+
autoCellWidth();
|
|
3051
|
+
updateRowExpandStyle();
|
|
3052
|
+
}
|
|
3053
|
+
if (rceTimeout) {
|
|
3054
|
+
clearTimeout(rceTimeout);
|
|
3055
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
3056
|
+
resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
|
|
3057
|
+
}
|
|
3058
|
+
else {
|
|
3059
|
+
nextTick(() => {
|
|
3060
|
+
resolve();
|
|
3061
|
+
});
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
else {
|
|
3065
|
+
resolve(handleRecalculateStyle(reFull, reWidth, reHeight));
|
|
3066
|
+
}
|
|
3067
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
3068
|
+
internalData.rceTimeout = undefined;
|
|
3069
|
+
handleRecalculateStyle(reFull, reWidth, reHeight);
|
|
3070
|
+
}, refreshDelay);
|
|
3071
|
+
});
|
|
3072
|
+
};
|
|
3007
3073
|
const handleUpdateAggValues = () => {
|
|
3008
3074
|
const { visibleColumn } = internalData;
|
|
3009
3075
|
const aggCols = [];
|
|
@@ -3217,8 +3283,6 @@ export default defineVxeComponent({
|
|
|
3217
3283
|
internalData.removeRowMaps = {};
|
|
3218
3284
|
reactData.removeRowFlag++;
|
|
3219
3285
|
const sYLoad = updateScrollYStatus(fullData);
|
|
3220
|
-
reactData.isDragColMove = false;
|
|
3221
|
-
reactData.isDragRowMove = false;
|
|
3222
3286
|
// 全量数据
|
|
3223
3287
|
internalData.tableFullData = fullData;
|
|
3224
3288
|
internalData.tableFullTreeData = isRGroup ? [] : treeData;
|
|
@@ -3279,11 +3343,10 @@ export default defineVxeComponent({
|
|
|
3279
3343
|
$xeTable.checkSelectionStatus();
|
|
3280
3344
|
return new Promise(resolve => {
|
|
3281
3345
|
nextTick()
|
|
3282
|
-
.then(() =>
|
|
3346
|
+
.then(() => handleRecalculateStyle(false, false, false))
|
|
3283
3347
|
.then(() => {
|
|
3284
|
-
|
|
3348
|
+
handleRecalculateStyle(false, true, true);
|
|
3285
3349
|
updateRowOffsetTop();
|
|
3286
|
-
return handleRecalculateLayout(false);
|
|
3287
3350
|
})
|
|
3288
3351
|
.then(() => {
|
|
3289
3352
|
let targetScrollLeft = lastScrollLeft;
|
|
@@ -3298,12 +3361,12 @@ export default defineVxeComponent({
|
|
|
3298
3361
|
targetScrollTop = 0;
|
|
3299
3362
|
}
|
|
3300
3363
|
reactData.isRowLoading = false;
|
|
3301
|
-
|
|
3364
|
+
handleRecalculateStyle(false, false, false);
|
|
3302
3365
|
// 是否变更虚拟滚动
|
|
3303
3366
|
if (oldScrollYLoad === sYLoad) {
|
|
3304
3367
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3305
3368
|
.then(() => {
|
|
3306
|
-
|
|
3369
|
+
handleRecalculateStyle(false, true, true);
|
|
3307
3370
|
updateRowOffsetTop();
|
|
3308
3371
|
resolve();
|
|
3309
3372
|
});
|
|
@@ -3312,7 +3375,7 @@ export default defineVxeComponent({
|
|
|
3312
3375
|
setTimeout(() => {
|
|
3313
3376
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
3314
3377
|
.then(() => {
|
|
3315
|
-
|
|
3378
|
+
handleRecalculateStyle(false, true, true);
|
|
3316
3379
|
updateRowOffsetTop();
|
|
3317
3380
|
resolve();
|
|
3318
3381
|
});
|
|
@@ -3536,7 +3599,6 @@ export default defineVxeComponent({
|
|
|
3536
3599
|
const tableFullColumn = getColumnList(collectColumn);
|
|
3537
3600
|
internalData.tableFullColumn = tableFullColumn;
|
|
3538
3601
|
reactData.isColLoading = true;
|
|
3539
|
-
reactData.isDragColMove = false;
|
|
3540
3602
|
initColumnSort();
|
|
3541
3603
|
return Promise.resolve(restoreCustomStorage()).then(() => {
|
|
3542
3604
|
const { scrollXLoad, scrollYLoad, expandColumn } = reactData;
|
|
@@ -3564,7 +3626,7 @@ export default defineVxeComponent({
|
|
|
3564
3626
|
$xeTable.handleUpdateCustomColumn();
|
|
3565
3627
|
}
|
|
3566
3628
|
reactData.isColLoading = false;
|
|
3567
|
-
return
|
|
3629
|
+
return handleLazyRecalculate(false, true, true);
|
|
3568
3630
|
});
|
|
3569
3631
|
});
|
|
3570
3632
|
};
|
|
@@ -3668,7 +3730,7 @@ export default defineVxeComponent({
|
|
|
3668
3730
|
updateAfterDataIndex();
|
|
3669
3731
|
return nextTick();
|
|
3670
3732
|
}).then(() => {
|
|
3671
|
-
return
|
|
3733
|
+
return handleLazyRecalculate(true, true, true);
|
|
3672
3734
|
}).then(() => {
|
|
3673
3735
|
setTimeout(() => {
|
|
3674
3736
|
$xeTable.updateCellAreas();
|
|
@@ -3740,7 +3802,7 @@ export default defineVxeComponent({
|
|
|
3740
3802
|
updateAfterDataIndex();
|
|
3741
3803
|
return nextTick();
|
|
3742
3804
|
}).then(() => {
|
|
3743
|
-
return
|
|
3805
|
+
return handleLazyRecalculate(true, true, true);
|
|
3744
3806
|
}).then(() => {
|
|
3745
3807
|
setTimeout(() => {
|
|
3746
3808
|
$xeTable.updateCellAreas();
|
|
@@ -3845,6 +3907,7 @@ export default defineVxeComponent({
|
|
|
3845
3907
|
const checkLastSyncScroll = (isRollX, isRollY) => {
|
|
3846
3908
|
const { scrollXLoad, scrollYLoad, isAllOverflow } = reactData;
|
|
3847
3909
|
const { lcsTimeout } = internalData;
|
|
3910
|
+
reactData.lazScrollLoading = true;
|
|
3848
3911
|
if (lcsTimeout) {
|
|
3849
3912
|
clearTimeout(lcsTimeout);
|
|
3850
3913
|
}
|
|
@@ -3857,6 +3920,7 @@ export default defineVxeComponent({
|
|
|
3857
3920
|
internalData.inHeaderScroll = false;
|
|
3858
3921
|
internalData.inBodyScroll = false;
|
|
3859
3922
|
internalData.inFooterScroll = false;
|
|
3923
|
+
reactData.lazScrollLoading = false;
|
|
3860
3924
|
internalData.scrollRenderType = '';
|
|
3861
3925
|
if (!isAllOverflow) {
|
|
3862
3926
|
calcCellHeight();
|
|
@@ -4088,23 +4152,23 @@ export default defineVxeComponent({
|
|
|
4088
4152
|
*/
|
|
4089
4153
|
updateData() {
|
|
4090
4154
|
const { scrollXLoad, scrollYLoad } = reactData;
|
|
4091
|
-
return
|
|
4092
|
-
|
|
4155
|
+
return $xeTable.handleTableData(true).then(() => {
|
|
4156
|
+
$xeTable.updateFooter();
|
|
4093
4157
|
if (scrollXLoad || scrollYLoad) {
|
|
4094
4158
|
if (scrollXLoad) {
|
|
4095
|
-
|
|
4159
|
+
$xeTable.updateScrollXSpace();
|
|
4096
4160
|
}
|
|
4097
4161
|
if (scrollYLoad) {
|
|
4098
|
-
|
|
4162
|
+
$xeTable.updateScrollYSpace();
|
|
4099
4163
|
}
|
|
4100
|
-
return
|
|
4164
|
+
return $xeTable.refreshScroll();
|
|
4101
4165
|
}
|
|
4102
4166
|
}).then(() => {
|
|
4103
|
-
|
|
4104
|
-
return
|
|
4167
|
+
$xeTable.updateCellAreas();
|
|
4168
|
+
return handleLazyRecalculate(true, true, true);
|
|
4105
4169
|
}).then(() => {
|
|
4106
4170
|
// 存在滚动行为未结束情况
|
|
4107
|
-
setTimeout(() =>
|
|
4171
|
+
setTimeout(() => handleLazyRecalculate(false, true, true), 50);
|
|
4108
4172
|
});
|
|
4109
4173
|
},
|
|
4110
4174
|
/**
|
|
@@ -4119,7 +4183,7 @@ export default defineVxeComponent({
|
|
|
4119
4183
|
if (!initStatus) {
|
|
4120
4184
|
handleLoadDefaults();
|
|
4121
4185
|
}
|
|
4122
|
-
return
|
|
4186
|
+
return handleLazyRecalculate(false, true, true);
|
|
4123
4187
|
});
|
|
4124
4188
|
},
|
|
4125
4189
|
/**
|
|
@@ -4127,14 +4191,14 @@ export default defineVxeComponent({
|
|
|
4127
4191
|
* @param {Array} datas 数据
|
|
4128
4192
|
*/
|
|
4129
4193
|
reloadData(datas) {
|
|
4130
|
-
return
|
|
4194
|
+
return $xeTable.clearAll()
|
|
4131
4195
|
.then(() => {
|
|
4132
4196
|
internalData.inited = true;
|
|
4133
4197
|
internalData.initStatus = true;
|
|
4134
4198
|
return loadTableData(datas, true);
|
|
4135
4199
|
}).then(() => {
|
|
4136
4200
|
handleLoadDefaults();
|
|
4137
|
-
return
|
|
4201
|
+
return handleLazyRecalculate(false, true, true);
|
|
4138
4202
|
});
|
|
4139
4203
|
},
|
|
4140
4204
|
/**
|
|
@@ -4441,7 +4505,7 @@ export default defineVxeComponent({
|
|
|
4441
4505
|
}
|
|
4442
4506
|
return nextTick().then(() => {
|
|
4443
4507
|
$xeTable.updateCellAreas();
|
|
4444
|
-
return
|
|
4508
|
+
return handleLazyRecalculate(false, true, true);
|
|
4445
4509
|
});
|
|
4446
4510
|
}
|
|
4447
4511
|
return $xeTable.reloadData(tableSourceData);
|
|
@@ -5054,9 +5118,9 @@ export default defineVxeComponent({
|
|
|
5054
5118
|
handleUpdateColumn();
|
|
5055
5119
|
}
|
|
5056
5120
|
return parseColumns(true).then(() => {
|
|
5057
|
-
return
|
|
5121
|
+
return $xeTable.refreshScroll();
|
|
5058
5122
|
}).then(() => {
|
|
5059
|
-
return
|
|
5123
|
+
return handleLazyRecalculate(false, true, true);
|
|
5060
5124
|
});
|
|
5061
5125
|
},
|
|
5062
5126
|
setRowHeightConf(heightConf) {
|
|
@@ -5191,34 +5255,8 @@ export default defineVxeComponent({
|
|
|
5191
5255
|
* 刷新布局
|
|
5192
5256
|
*/
|
|
5193
5257
|
recalculate(reFull) {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
const resizeOpts = computeResizeOpts.value;
|
|
5197
|
-
const refreshDelay = resizeOpts.refreshDelay || 20;
|
|
5198
|
-
const el = refElem.value;
|
|
5199
|
-
if (el && el.clientWidth) {
|
|
5200
|
-
autoCellWidth();
|
|
5201
|
-
updateRowExpandStyle();
|
|
5202
|
-
}
|
|
5203
|
-
if (rceTimeout) {
|
|
5204
|
-
clearTimeout(rceTimeout);
|
|
5205
|
-
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
5206
|
-
resolve(handleRecalculateLayout(!!reFull));
|
|
5207
|
-
}
|
|
5208
|
-
else {
|
|
5209
|
-
nextTick(() => {
|
|
5210
|
-
resolve();
|
|
5211
|
-
});
|
|
5212
|
-
}
|
|
5213
|
-
}
|
|
5214
|
-
else {
|
|
5215
|
-
resolve(handleRecalculateLayout(!!reFull));
|
|
5216
|
-
}
|
|
5217
|
-
internalData.rceTimeout = setTimeout(() => {
|
|
5218
|
-
internalData.rceTimeout = undefined;
|
|
5219
|
-
handleRecalculateLayout(!!reFull);
|
|
5220
|
-
}, refreshDelay);
|
|
5221
|
-
});
|
|
5258
|
+
const isForce = !!reFull;
|
|
5259
|
+
return handleLazyRecalculate(isForce, isForce, isForce);
|
|
5222
5260
|
},
|
|
5223
5261
|
openTooltip(target, content) {
|
|
5224
5262
|
const $commTip = refCommTooltip.value;
|
|
@@ -6031,7 +6069,7 @@ export default defineVxeComponent({
|
|
|
6031
6069
|
reactData.rowExpandedFlag++;
|
|
6032
6070
|
return Promise.all(lazyRests)
|
|
6033
6071
|
.then(() => nextTick())
|
|
6034
|
-
.then(() =>
|
|
6072
|
+
.then(() => handleLazyRecalculate(true, true, true))
|
|
6035
6073
|
.then(() => {
|
|
6036
6074
|
updateRowOffsetTop();
|
|
6037
6075
|
updateRowExpandStyle();
|
|
@@ -6069,7 +6107,7 @@ export default defineVxeComponent({
|
|
|
6069
6107
|
}
|
|
6070
6108
|
return nextTick().then(() => {
|
|
6071
6109
|
if (expList.length) {
|
|
6072
|
-
return
|
|
6110
|
+
return handleLazyRecalculate(true, true, true);
|
|
6073
6111
|
}
|
|
6074
6112
|
}).then(() => {
|
|
6075
6113
|
updateRowOffsetTop();
|
|
@@ -6179,7 +6217,7 @@ export default defineVxeComponent({
|
|
|
6179
6217
|
$xeTable.handleTableData();
|
|
6180
6218
|
updateAfterDataIndex();
|
|
6181
6219
|
reactData.rowGroupExpandedFlag++;
|
|
6182
|
-
return
|
|
6220
|
+
return handleLazyRecalculate(true, true, true);
|
|
6183
6221
|
},
|
|
6184
6222
|
clearRowGroupExpand() {
|
|
6185
6223
|
internalData.rowGroupExpandedMaps = {};
|
|
@@ -6187,7 +6225,7 @@ export default defineVxeComponent({
|
|
|
6187
6225
|
$xeTable.handleTableData();
|
|
6188
6226
|
updateAfterDataIndex();
|
|
6189
6227
|
reactData.rowGroupExpandedFlag++;
|
|
6190
|
-
return
|
|
6228
|
+
return handleLazyRecalculate(true, true, true);
|
|
6191
6229
|
},
|
|
6192
6230
|
getTreeExpandRecords() {
|
|
6193
6231
|
const rest = [];
|
|
@@ -6524,8 +6562,7 @@ export default defineVxeComponent({
|
|
|
6524
6562
|
});
|
|
6525
6563
|
},
|
|
6526
6564
|
/**
|
|
6527
|
-
* 设置合并单元格
|
|
6528
|
-
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
6565
|
+
* 设置合并单元格 [{ row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }]
|
|
6529
6566
|
*/
|
|
6530
6567
|
setMergeCells(merges) {
|
|
6531
6568
|
if (props.spanMethod) {
|
|
@@ -6534,13 +6571,17 @@ export default defineVxeComponent({
|
|
|
6534
6571
|
handleBodyMerge(merges);
|
|
6535
6572
|
$xeTable.handleUpdateBodyMerge();
|
|
6536
6573
|
return nextTick().then(() => {
|
|
6574
|
+
const { expandColumn } = reactData;
|
|
6575
|
+
const { mergeBodyList } = internalData;
|
|
6576
|
+
if (expandColumn && mergeBodyList.length) {
|
|
6577
|
+
warnLog('vxe.error.errConflicts', ['type=expand', 'merge-cells | span-method']);
|
|
6578
|
+
}
|
|
6537
6579
|
$xeTable.updateCellAreas();
|
|
6538
6580
|
return updateStyle();
|
|
6539
6581
|
});
|
|
6540
6582
|
},
|
|
6541
6583
|
/**
|
|
6542
|
-
* 移除单元格合并
|
|
6543
|
-
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
6584
|
+
* 移除单元格合并 [{row:Row|number, col:ColumnInfo|number}]
|
|
6544
6585
|
*/
|
|
6545
6586
|
removeMergeCells(merges) {
|
|
6546
6587
|
if (props.spanMethod) {
|
|
@@ -6579,7 +6620,7 @@ export default defineVxeComponent({
|
|
|
6579
6620
|
handleFooterMerge(merges);
|
|
6580
6621
|
$xeTable.handleUpdateFooterMerge();
|
|
6581
6622
|
return nextTick().then(() => {
|
|
6582
|
-
|
|
6623
|
+
$xeTable.updateCellAreas();
|
|
6583
6624
|
return updateStyle();
|
|
6584
6625
|
});
|
|
6585
6626
|
},
|
|
@@ -6590,7 +6631,7 @@ export default defineVxeComponent({
|
|
|
6590
6631
|
const rest = removeFooterMerges(merges);
|
|
6591
6632
|
$xeTable.handleUpdateFooterMerge();
|
|
6592
6633
|
return nextTick().then(() => {
|
|
6593
|
-
|
|
6634
|
+
$xeTable.updateCellAreas();
|
|
6594
6635
|
updateStyle();
|
|
6595
6636
|
return rest;
|
|
6596
6637
|
});
|
|
@@ -7299,10 +7340,10 @@ export default defineVxeComponent({
|
|
|
7299
7340
|
}
|
|
7300
7341
|
const el = refElem.value;
|
|
7301
7342
|
if (!el || !el.clientWidth) {
|
|
7302
|
-
return
|
|
7343
|
+
return;
|
|
7303
7344
|
}
|
|
7304
|
-
|
|
7305
|
-
|
|
7345
|
+
handleLazyRecalculate(true, true, true);
|
|
7346
|
+
$xeTable.updateCellAreas();
|
|
7306
7347
|
};
|
|
7307
7348
|
const handleTargetEnterEvent = (isClear) => {
|
|
7308
7349
|
const $tooltip = refTooltip.value;
|
|
@@ -7324,8 +7365,6 @@ export default defineVxeComponent({
|
|
|
7324
7365
|
hideDropTip();
|
|
7325
7366
|
reactData.dragRow = null;
|
|
7326
7367
|
reactData.dragCol = null;
|
|
7327
|
-
reactData.isDragColMove = false;
|
|
7328
|
-
reactData.isDragRowMove = false;
|
|
7329
7368
|
}
|
|
7330
7369
|
};
|
|
7331
7370
|
const clearRowDropOrigin = () => {
|
|
@@ -8285,7 +8324,8 @@ export default defineVxeComponent({
|
|
|
8285
8324
|
const childList = vals[2];
|
|
8286
8325
|
let sLen = 0; // 已选
|
|
8287
8326
|
let hLen = 0; // 半选
|
|
8288
|
-
let vLen = 0; //
|
|
8327
|
+
let vLen = 0; // 有效子行
|
|
8328
|
+
const cLen = childList.length; // 有效子行
|
|
8289
8329
|
childList.forEach(checkMethod
|
|
8290
8330
|
? (item) => {
|
|
8291
8331
|
const childRowid = handleGetRowId(item);
|
|
@@ -8319,16 +8359,29 @@ export default defineVxeComponent({
|
|
|
8319
8359
|
}
|
|
8320
8360
|
vLen++;
|
|
8321
8361
|
});
|
|
8322
|
-
let isSelected =
|
|
8323
|
-
if (
|
|
8324
|
-
if (
|
|
8325
|
-
isSelected = sLen >= vLen;
|
|
8362
|
+
let isSelected = false;
|
|
8363
|
+
if (cLen > 0) {
|
|
8364
|
+
if (vLen > 0) {
|
|
8365
|
+
isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
|
|
8326
8366
|
}
|
|
8327
8367
|
else {
|
|
8328
|
-
|
|
8368
|
+
// 如果存在子项禁用
|
|
8369
|
+
if ((sLen > 0 && sLen >= vLen)) {
|
|
8370
|
+
isSelected = true;
|
|
8371
|
+
}
|
|
8372
|
+
else if (selectCheckboxMaps[rowid]) {
|
|
8373
|
+
isSelected = true;
|
|
8374
|
+
}
|
|
8375
|
+
else {
|
|
8376
|
+
isSelected = false;
|
|
8377
|
+
}
|
|
8329
8378
|
}
|
|
8330
8379
|
}
|
|
8331
|
-
|
|
8380
|
+
else {
|
|
8381
|
+
// 如果无子项
|
|
8382
|
+
isSelected = selectCheckboxMaps[rowid];
|
|
8383
|
+
}
|
|
8384
|
+
const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
|
|
8332
8385
|
if (checkField) {
|
|
8333
8386
|
XEUtils.set(row, checkField, isSelected);
|
|
8334
8387
|
}
|
|
@@ -8367,7 +8420,9 @@ export default defineVxeComponent({
|
|
|
8367
8420
|
const { checkField, checkMethod, showReserveStatus } = checkboxOpts;
|
|
8368
8421
|
const { handleGetRowId } = createHandleGetRowId($xeTable);
|
|
8369
8422
|
let sLen = 0; // 已选
|
|
8423
|
+
let dsLen = 0; // 禁用的已选
|
|
8370
8424
|
let hLen = 0; // 半选
|
|
8425
|
+
let dhLen = 0; // 禁用的半选
|
|
8371
8426
|
let vLen = 0; // 有效行
|
|
8372
8427
|
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData));
|
|
8373
8428
|
rootList.forEach(checkMethod
|
|
@@ -8385,10 +8440,10 @@ export default defineVxeComponent({
|
|
|
8385
8440
|
}
|
|
8386
8441
|
else {
|
|
8387
8442
|
if (selected) {
|
|
8388
|
-
|
|
8443
|
+
dsLen++;
|
|
8389
8444
|
}
|
|
8390
8445
|
else if (treeIndeterminateRowMaps[childRowid]) {
|
|
8391
|
-
|
|
8446
|
+
dhLen++;
|
|
8392
8447
|
}
|
|
8393
8448
|
}
|
|
8394
8449
|
}
|
|
@@ -8404,7 +8459,7 @@ export default defineVxeComponent({
|
|
|
8404
8459
|
vLen++;
|
|
8405
8460
|
});
|
|
8406
8461
|
const isSelected = rootList.length > 0 ? (vLen > 0 ? (sLen >= vLen) : (sLen >= rootList.length)) : false;
|
|
8407
|
-
let halfSelect = !isSelected && (sLen
|
|
8462
|
+
let halfSelect = !isSelected && (sLen > 0 || hLen > 0 || dsLen > 0 || dhLen > 0);
|
|
8408
8463
|
// 如果复选框启用保留记录,当保留数据存在时显示半选
|
|
8409
8464
|
if (!isSelected && !halfSelect && showReserveStatus) {
|
|
8410
8465
|
halfSelect = !XEUtils.isEmpty(checkboxReserveRowMap);
|
|
@@ -9207,83 +9262,75 @@ export default defineVxeComponent({
|
|
|
9207
9262
|
const { treeConfig, dragConfig } = props;
|
|
9208
9263
|
const rowDragOpts = computeRowDragOpts.value;
|
|
9209
9264
|
const { afterFullData, tableFullData, fullAllDataRowIdData } = internalData;
|
|
9210
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
9265
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts;
|
|
9211
9266
|
const treeOpts = computeTreeOpts.value;
|
|
9267
|
+
const cellOpts = computeCellOpts.value;
|
|
9268
|
+
const rowOpts = computeRowOpts.value;
|
|
9269
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
9212
9270
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts;
|
|
9213
9271
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9214
9272
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
9215
9273
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
9274
|
+
const el = refElem.value;
|
|
9216
9275
|
const errRest = {
|
|
9217
9276
|
status: false
|
|
9218
9277
|
};
|
|
9219
|
-
if (prevDragRow && dragRow) {
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
9272
|
-
});
|
|
9273
|
-
}
|
|
9274
|
-
return errRest;
|
|
9275
|
-
}
|
|
9276
|
-
}
|
|
9277
|
-
}
|
|
9278
|
-
}
|
|
9279
|
-
else if (oldLevel) {
|
|
9280
|
-
// 子到根
|
|
9281
|
-
if (!isCrossDrag) {
|
|
9278
|
+
if (!(el && prevDragRow && dragRow)) {
|
|
9279
|
+
return Promise.resolve(errRest);
|
|
9280
|
+
}
|
|
9281
|
+
// 判断是否有拖动
|
|
9282
|
+
if (prevDragRow !== dragRow) {
|
|
9283
|
+
const dragParams = {
|
|
9284
|
+
oldRow: dragRow,
|
|
9285
|
+
newRow: prevDragRow,
|
|
9286
|
+
dragRow,
|
|
9287
|
+
dragPos: prevDragPos,
|
|
9288
|
+
dragToChild: !!prevDragToChild,
|
|
9289
|
+
offsetIndex: dragOffsetIndex
|
|
9290
|
+
};
|
|
9291
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
9292
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
9293
|
+
if (!status) {
|
|
9294
|
+
return errRest;
|
|
9295
|
+
}
|
|
9296
|
+
const dragRowid = getRowid($xeTable, dragRow);
|
|
9297
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid] || {};
|
|
9298
|
+
const _dragRowIndex = dragRowRest._index;
|
|
9299
|
+
let dragRowHeight = 0;
|
|
9300
|
+
let dragOffsetTop = -1;
|
|
9301
|
+
if (animation) {
|
|
9302
|
+
dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight);
|
|
9303
|
+
const oldTrEl = el.querySelector(`.vxe-body--row[rowid="${dragRowid}"]`);
|
|
9304
|
+
if (oldTrEl) {
|
|
9305
|
+
dragOffsetTop = oldTrEl.offsetTop;
|
|
9306
|
+
}
|
|
9307
|
+
}
|
|
9308
|
+
let oafIndex = -1;
|
|
9309
|
+
let nafIndex = -1;
|
|
9310
|
+
// 如果为树结构
|
|
9311
|
+
if (treeConfig) {
|
|
9312
|
+
if (transform) {
|
|
9313
|
+
// 移出源位置
|
|
9314
|
+
const oldRest = dragRowRest;
|
|
9315
|
+
const newRowid = getRowid($xeTable, prevDragRow);
|
|
9316
|
+
const newRest = fullAllDataRowIdData[newRowid];
|
|
9317
|
+
if (oldRest && newRest) {
|
|
9318
|
+
const { level: oldLevel } = oldRest;
|
|
9319
|
+
const { level: newLevel } = newRest;
|
|
9320
|
+
const oldAllMaps = {};
|
|
9321
|
+
XEUtils.eachTree([dragRow], item => {
|
|
9322
|
+
oldAllMaps[getRowid($xeTable, item)] = item;
|
|
9323
|
+
}, { children: mapChildrenField });
|
|
9324
|
+
let isSelfToChildStatus = false;
|
|
9325
|
+
if (oldLevel && newLevel) {
|
|
9326
|
+
// 子到子
|
|
9327
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
9328
|
+
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
9329
|
+
// 非同级
|
|
9282
9330
|
return errRest;
|
|
9283
9331
|
}
|
|
9284
9332
|
}
|
|
9285
|
-
else
|
|
9286
|
-
// 根到子
|
|
9333
|
+
else {
|
|
9287
9334
|
if (!isCrossDrag) {
|
|
9288
9335
|
return errRest;
|
|
9289
9336
|
}
|
|
@@ -9300,88 +9347,162 @@ export default defineVxeComponent({
|
|
|
9300
9347
|
}
|
|
9301
9348
|
}
|
|
9302
9349
|
}
|
|
9303
|
-
|
|
9304
|
-
|
|
9350
|
+
}
|
|
9351
|
+
else if (oldLevel) {
|
|
9352
|
+
// 子到根
|
|
9353
|
+
if (!isCrossDrag) {
|
|
9354
|
+
return errRest;
|
|
9305
9355
|
}
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
// 移出
|
|
9312
|
-
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
9313
|
-
fullList.splice(otfIndex, 1);
|
|
9314
|
-
// 插入
|
|
9315
|
-
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
|
|
9316
|
-
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
9317
|
-
fullList.splice(ntfIndex, 0, dragRow);
|
|
9318
|
-
// 改变层级
|
|
9319
|
-
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
9320
|
-
XEUtils.each(dragRow[childrenField], childRow => {
|
|
9321
|
-
childRow[parentField] = dragRow[parentField];
|
|
9322
|
-
});
|
|
9356
|
+
}
|
|
9357
|
+
else if (newLevel) {
|
|
9358
|
+
// 根到子
|
|
9359
|
+
if (!isCrossDrag) {
|
|
9360
|
+
return errRest;
|
|
9323
9361
|
}
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9362
|
+
if (oldAllMaps[newRowid]) {
|
|
9363
|
+
isSelfToChildStatus = true;
|
|
9364
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
9365
|
+
if (VxeUI.modal) {
|
|
9366
|
+
VxeUI.modal.message({
|
|
9367
|
+
status: 'error',
|
|
9368
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
9369
|
+
});
|
|
9370
|
+
}
|
|
9371
|
+
return errRest;
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
}
|
|
9375
|
+
else {
|
|
9376
|
+
// 根到根
|
|
9377
|
+
}
|
|
9378
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
9379
|
+
key: rowField,
|
|
9380
|
+
parentKey: parentField,
|
|
9381
|
+
children: mapChildrenField
|
|
9382
|
+
});
|
|
9383
|
+
// 移出
|
|
9384
|
+
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow);
|
|
9385
|
+
fullList.splice(otfIndex, 1);
|
|
9386
|
+
// 插入
|
|
9387
|
+
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow);
|
|
9388
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
9389
|
+
fullList.splice(ntfIndex, 0, dragRow);
|
|
9390
|
+
// 改变层级
|
|
9391
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
9392
|
+
XEUtils.each(dragRow[childrenField], childRow => {
|
|
9393
|
+
childRow[parentField] = dragRow[parentField];
|
|
9330
9394
|
});
|
|
9331
9395
|
}
|
|
9396
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField];
|
|
9397
|
+
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
9398
|
+
key: rowField,
|
|
9399
|
+
parentKey: parentField,
|
|
9400
|
+
children: childrenField,
|
|
9401
|
+
mapChildren: mapChildrenField
|
|
9402
|
+
});
|
|
9332
9403
|
}
|
|
9333
9404
|
}
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9405
|
+
}
|
|
9406
|
+
else {
|
|
9407
|
+
// 移出
|
|
9408
|
+
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow);
|
|
9409
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow);
|
|
9410
|
+
afterFullData.splice(oafIndex, 1);
|
|
9411
|
+
tableFullData.splice(otfIndex, 1);
|
|
9412
|
+
// 插入
|
|
9413
|
+
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow);
|
|
9414
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow);
|
|
9415
|
+
nafIndex = pafIndex + dragOffsetIndex;
|
|
9416
|
+
const ntfIndex = ptfIndex + dragOffsetIndex;
|
|
9417
|
+
afterFullData.splice(nafIndex, 0, dragRow);
|
|
9418
|
+
tableFullData.splice(ntfIndex, 0, dragRow);
|
|
9419
|
+
}
|
|
9420
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
9421
|
+
$xeTable.cacheRowMap(false);
|
|
9422
|
+
updateScrollYStatus();
|
|
9423
|
+
if (!(treeConfig && transform)) {
|
|
9424
|
+
$xeTable.updateAfterDataIndex();
|
|
9425
|
+
}
|
|
9426
|
+
$xeTable.checkSelectionStatus();
|
|
9427
|
+
if (reactData.scrollYLoad) {
|
|
9428
|
+
$xeTable.updateScrollYSpace();
|
|
9429
|
+
}
|
|
9430
|
+
if (evnt) {
|
|
9431
|
+
dispatchEvent('row-dragend', {
|
|
9432
|
+
oldRow: dragRow,
|
|
9433
|
+
newRow: prevDragRow,
|
|
9434
|
+
dragRow,
|
|
9435
|
+
dragPos: prevDragPos,
|
|
9436
|
+
dragToChild: isDragToChildFlag,
|
|
9437
|
+
offsetIndex: dragOffsetIndex,
|
|
9438
|
+
_index: {
|
|
9439
|
+
newIndex: nafIndex,
|
|
9440
|
+
oldIndex: oafIndex
|
|
9441
|
+
}
|
|
9442
|
+
}, evnt);
|
|
9443
|
+
}
|
|
9444
|
+
return nextTick().then(() => {
|
|
9445
|
+
if (animation) {
|
|
9446
|
+
const { tableData } = reactData;
|
|
9447
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid];
|
|
9448
|
+
const _newRowIndex = dragRowRest._index;
|
|
9449
|
+
const firstRow = tableData[0];
|
|
9450
|
+
const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)];
|
|
9451
|
+
if (firstRowRest) {
|
|
9452
|
+
const _firstRowIndex = firstRowRest._index;
|
|
9453
|
+
const _lastRowIndex = _firstRowIndex + tableData.length;
|
|
9454
|
+
let rsIndex = -1;
|
|
9455
|
+
let reIndex = -1;
|
|
9456
|
+
let offsetRate = 1;
|
|
9457
|
+
if (_dragRowIndex < _firstRowIndex) {
|
|
9458
|
+
// 从上往下虚拟拖拽
|
|
9459
|
+
rsIndex = 0;
|
|
9460
|
+
reIndex = _newRowIndex - _firstRowIndex;
|
|
9370
9461
|
}
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9462
|
+
else if (_dragRowIndex > _lastRowIndex) {
|
|
9463
|
+
// 从下往上虚拟拖拽
|
|
9464
|
+
const $newRowIndex = dragRowRest.$index;
|
|
9465
|
+
rsIndex = $newRowIndex + 1;
|
|
9466
|
+
reIndex = tableData.length;
|
|
9467
|
+
offsetRate = -1;
|
|
9468
|
+
}
|
|
9469
|
+
else {
|
|
9470
|
+
if (_newRowIndex > _dragRowIndex) {
|
|
9471
|
+
// 从上往下拖拽
|
|
9472
|
+
rsIndex = _dragRowIndex - _firstRowIndex;
|
|
9473
|
+
reIndex = rsIndex + _newRowIndex - _dragRowIndex;
|
|
9474
|
+
}
|
|
9475
|
+
else {
|
|
9476
|
+
// 从下往上拖拽
|
|
9477
|
+
rsIndex = _newRowIndex - _firstRowIndex;
|
|
9478
|
+
reIndex = rsIndex + _dragRowIndex - _newRowIndex + 1;
|
|
9479
|
+
offsetRate = -1;
|
|
9480
|
+
}
|
|
9481
|
+
}
|
|
9482
|
+
const dragRangeList = tableData.slice(rsIndex, reIndex);
|
|
9483
|
+
if (dragRangeList.length) {
|
|
9484
|
+
const dtTrList = el.querySelectorAll(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','));
|
|
9485
|
+
moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight);
|
|
9486
|
+
}
|
|
9487
|
+
}
|
|
9488
|
+
const newTrList = el.querySelectorAll(`.vxe-body--row[rowid="${dragRowid}"]`);
|
|
9489
|
+
const newTrEl = newTrList[0];
|
|
9490
|
+
if (dragOffsetTop > -1 && newTrEl) {
|
|
9491
|
+
moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop);
|
|
9492
|
+
}
|
|
9493
|
+
}
|
|
9494
|
+
updateRowOffsetTop();
|
|
9495
|
+
updateRowExpandStyle();
|
|
9496
|
+
$xeTable.updateCellAreas();
|
|
9497
|
+
$xeTable.recalculate();
|
|
9498
|
+
}).then(() => {
|
|
9499
|
+
return {
|
|
9500
|
+
status: true
|
|
9501
|
+
};
|
|
9383
9502
|
});
|
|
9384
|
-
}
|
|
9503
|
+
}).catch(() => {
|
|
9504
|
+
return errRest;
|
|
9505
|
+
});
|
|
9385
9506
|
}
|
|
9386
9507
|
return Promise.resolve(errRest);
|
|
9387
9508
|
},
|
|
@@ -9393,6 +9514,7 @@ export default defineVxeComponent({
|
|
|
9393
9514
|
const { lazy } = treeOpts;
|
|
9394
9515
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
9395
9516
|
const { prevDragRow, prevDragPos } = internalData;
|
|
9517
|
+
const el = refElem.value;
|
|
9396
9518
|
if (treeConfig && lazy && prevDragToChild) {
|
|
9397
9519
|
// 懒加载
|
|
9398
9520
|
const newRowid = getRowid($xeTable, prevDragRow);
|
|
@@ -9411,12 +9533,10 @@ export default defineVxeComponent({
|
|
|
9411
9533
|
}
|
|
9412
9534
|
hideDropTip();
|
|
9413
9535
|
clearRowDropOrigin();
|
|
9536
|
+
clearRowAnimate(el);
|
|
9414
9537
|
internalData.prevDragToChild = false;
|
|
9415
9538
|
reactData.dragRow = null;
|
|
9416
9539
|
reactData.dragCol = null;
|
|
9417
|
-
setTimeout(() => {
|
|
9418
|
-
reactData.isDragRowMove = false;
|
|
9419
|
-
}, 500);
|
|
9420
9540
|
},
|
|
9421
9541
|
handleRowDragDragoverEvent(evnt) {
|
|
9422
9542
|
const { treeConfig } = props;
|
|
@@ -9499,7 +9619,7 @@ export default defineVxeComponent({
|
|
|
9499
9619
|
},
|
|
9500
9620
|
handleColDragSwapColumn() {
|
|
9501
9621
|
handleUpdateColumn();
|
|
9502
|
-
parseColumns(false).then(() => {
|
|
9622
|
+
return parseColumns(false).then(() => {
|
|
9503
9623
|
$xeTable.updateCellAreas();
|
|
9504
9624
|
$xeTable.saveCustomStore('update:sort');
|
|
9505
9625
|
});
|
|
@@ -9507,71 +9627,73 @@ export default defineVxeComponent({
|
|
|
9507
9627
|
handleColDragSwapEvent(evnt, isSyncColumn, dragCol, prevDragCol, prevDragPos, prevDragToChild) {
|
|
9508
9628
|
const { mouseConfig } = props;
|
|
9509
9629
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
9510
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
9511
|
-
const { collectColumn } = internalData;
|
|
9630
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts;
|
|
9631
|
+
const { collectColumn, fullColumnIdData } = internalData;
|
|
9632
|
+
const el = refElem.value;
|
|
9512
9633
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0;
|
|
9513
9634
|
const errRest = {
|
|
9514
9635
|
status: false
|
|
9515
9636
|
};
|
|
9516
|
-
if (prevDragCol && dragCol) {
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9637
|
+
if (!(el && prevDragCol && dragCol)) {
|
|
9638
|
+
return Promise.resolve(errRest);
|
|
9639
|
+
}
|
|
9640
|
+
// 判断是否有拖动
|
|
9641
|
+
if (prevDragCol !== dragCol) {
|
|
9642
|
+
const dragColumn = dragCol;
|
|
9643
|
+
const newColumn = prevDragCol;
|
|
9644
|
+
const dragParams = {
|
|
9645
|
+
oldColumn: dragColumn,
|
|
9646
|
+
newColumn,
|
|
9647
|
+
dragColumn,
|
|
9648
|
+
dragPos: prevDragPos,
|
|
9649
|
+
dragToChild: !!prevDragToChild,
|
|
9650
|
+
offsetIndex: dragOffsetIndex
|
|
9651
|
+
};
|
|
9652
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild;
|
|
9653
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
9654
|
+
if (!status) {
|
|
9655
|
+
return errRest;
|
|
9656
|
+
}
|
|
9657
|
+
let dragTargetColumn = null;
|
|
9658
|
+
const dragAllTargetCols = [];
|
|
9659
|
+
let dragColWidth = 0;
|
|
9660
|
+
if (animation) {
|
|
9537
9661
|
XEUtils.eachTree([dragColumn], column => {
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
if (dragColumn.parentId && newColumn.parentId) {
|
|
9542
|
-
// 子到子
|
|
9543
|
-
if (isPeerDrag && !isCrossDrag) {
|
|
9544
|
-
if (dragColumn.parentId !== newColumn.parentId) {
|
|
9545
|
-
// 非同级
|
|
9546
|
-
return errRest;
|
|
9547
|
-
}
|
|
9548
|
-
}
|
|
9549
|
-
else {
|
|
9550
|
-
if (!isCrossDrag) {
|
|
9551
|
-
return errRest;
|
|
9552
|
-
}
|
|
9553
|
-
if (oldAllMaps[newColumn.id]) {
|
|
9554
|
-
isSelfToChildStatus = true;
|
|
9555
|
-
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
9556
|
-
if (VxeUI.modal) {
|
|
9557
|
-
VxeUI.modal.message({
|
|
9558
|
-
status: 'error',
|
|
9559
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
9560
|
-
});
|
|
9561
|
-
}
|
|
9562
|
-
return errRest;
|
|
9563
|
-
}
|
|
9564
|
-
}
|
|
9662
|
+
if (!dragTargetColumn && (!column.children || !column.children.length)) {
|
|
9663
|
+
dragTargetColumn = column;
|
|
9664
|
+
dragColWidth += column.renderWidth;
|
|
9565
9665
|
}
|
|
9666
|
+
dragAllTargetCols.push(column);
|
|
9667
|
+
});
|
|
9668
|
+
}
|
|
9669
|
+
if (!dragTargetColumn) {
|
|
9670
|
+
dragTargetColumn = dragColumn;
|
|
9671
|
+
}
|
|
9672
|
+
const dragColRest = fullColumnIdData[dragTargetColumn.id] || {};
|
|
9673
|
+
const _dragColIndex = dragColRest._index;
|
|
9674
|
+
let dragOffsetLeft = -1;
|
|
9675
|
+
if (animation) {
|
|
9676
|
+
const oldTrEl = el.querySelector(`.vxe-table--column[colid="${dragTargetColumn.id}"]`);
|
|
9677
|
+
if (oldTrEl) {
|
|
9678
|
+
dragOffsetLeft = oldTrEl.offsetLeft;
|
|
9566
9679
|
}
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9680
|
+
}
|
|
9681
|
+
let oafIndex = -1;
|
|
9682
|
+
let nafIndex = -1;
|
|
9683
|
+
const oldAllMaps = {};
|
|
9684
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
9685
|
+
oldAllMaps[column.id] = column;
|
|
9686
|
+
});
|
|
9687
|
+
let isSelfToChildStatus = false;
|
|
9688
|
+
if (dragColumn.parentId && newColumn.parentId) {
|
|
9689
|
+
// 子到子
|
|
9690
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
9691
|
+
if (dragColumn.parentId !== newColumn.parentId) {
|
|
9692
|
+
// 非同级
|
|
9570
9693
|
return errRest;
|
|
9571
9694
|
}
|
|
9572
9695
|
}
|
|
9573
|
-
else
|
|
9574
|
-
// 根到子
|
|
9696
|
+
else {
|
|
9575
9697
|
if (!isCrossDrag) {
|
|
9576
9698
|
return errRest;
|
|
9577
9699
|
}
|
|
@@ -9588,105 +9710,206 @@ export default defineVxeComponent({
|
|
|
9588
9710
|
}
|
|
9589
9711
|
}
|
|
9590
9712
|
}
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
9597
|
-
if (oldewMatchRest) {
|
|
9598
|
-
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
9599
|
-
const childList = dragColumn.children || [];
|
|
9600
|
-
childList.forEach(column => {
|
|
9601
|
-
column.parentId = dragColumn.parentId;
|
|
9602
|
-
});
|
|
9603
|
-
oCols.splice(oIndex, 1, ...childList);
|
|
9604
|
-
dragColumn.children = [];
|
|
9605
|
-
}
|
|
9713
|
+
}
|
|
9714
|
+
else if (dragColumn.parentId) {
|
|
9715
|
+
// 子到根
|
|
9716
|
+
if (!isCrossDrag) {
|
|
9717
|
+
return errRest;
|
|
9606
9718
|
}
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9719
|
+
}
|
|
9720
|
+
else if (newColumn.parentId) {
|
|
9721
|
+
// 根到子
|
|
9722
|
+
if (!isCrossDrag) {
|
|
9723
|
+
return errRest;
|
|
9724
|
+
}
|
|
9725
|
+
if (oldAllMaps[newColumn.id]) {
|
|
9726
|
+
isSelfToChildStatus = true;
|
|
9727
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
9728
|
+
if (VxeUI.modal) {
|
|
9729
|
+
VxeUI.modal.message({
|
|
9730
|
+
status: 'error',
|
|
9731
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
9732
|
+
});
|
|
9613
9733
|
}
|
|
9734
|
+
return errRest;
|
|
9614
9735
|
}
|
|
9615
9736
|
}
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9737
|
+
}
|
|
9738
|
+
else {
|
|
9739
|
+
// 根到根
|
|
9740
|
+
}
|
|
9741
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === dragColumn.id);
|
|
9742
|
+
// 改变层级
|
|
9743
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
9744
|
+
if (oldewMatchRest) {
|
|
9745
|
+
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
9746
|
+
const childList = dragColumn.children || [];
|
|
9747
|
+
childList.forEach(column => {
|
|
9748
|
+
column.parentId = dragColumn.parentId;
|
|
9749
|
+
});
|
|
9750
|
+
oCols.splice(oIndex, 1, ...childList);
|
|
9751
|
+
dragColumn.children = [];
|
|
9631
9752
|
}
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
if (mouseConfig) {
|
|
9640
|
-
if ($xeTable.clearSelected) {
|
|
9641
|
-
$xeTable.clearSelected();
|
|
9642
|
-
}
|
|
9643
|
-
if ($xeTable.clearCellAreas) {
|
|
9644
|
-
$xeTable.clearCellAreas();
|
|
9645
|
-
$xeTable.clearCopyCellArea();
|
|
9753
|
+
}
|
|
9754
|
+
else {
|
|
9755
|
+
if (oldewMatchRest) {
|
|
9756
|
+
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
|
|
9757
|
+
oCols.splice(oIndex, 1);
|
|
9758
|
+
if (!oParent) {
|
|
9759
|
+
oafIndex = oIndex;
|
|
9646
9760
|
}
|
|
9647
9761
|
}
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
_index: {
|
|
9657
|
-
newIndex: nafIndex,
|
|
9658
|
-
oldIndex: oafIndex
|
|
9659
|
-
}
|
|
9660
|
-
}, evnt);
|
|
9762
|
+
}
|
|
9763
|
+
const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
|
|
9764
|
+
if (newMatchRest) {
|
|
9765
|
+
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
9766
|
+
// 转子级
|
|
9767
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
9768
|
+
dragColumn.parentId = newColumn.id;
|
|
9769
|
+
newColumn.children = (newColumn.children || []).concat([dragColumn]);
|
|
9661
9770
|
}
|
|
9771
|
+
else {
|
|
9772
|
+
dragColumn.parentId = newColumn.parentId;
|
|
9773
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn);
|
|
9774
|
+
}
|
|
9775
|
+
if (!nParent) {
|
|
9776
|
+
nafIndex = nIndex;
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9779
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
9780
|
+
if (!parentColumn) {
|
|
9781
|
+
const sortIndex = index + 1;
|
|
9782
|
+
column.renderSortNumber = sortIndex;
|
|
9783
|
+
}
|
|
9784
|
+
});
|
|
9785
|
+
if (mouseConfig) {
|
|
9786
|
+
if ($xeTable.clearSelected) {
|
|
9787
|
+
$xeTable.clearSelected();
|
|
9788
|
+
}
|
|
9789
|
+
if ($xeTable.clearCellAreas) {
|
|
9790
|
+
$xeTable.clearCellAreas();
|
|
9791
|
+
$xeTable.clearCopyCellArea();
|
|
9792
|
+
}
|
|
9793
|
+
}
|
|
9794
|
+
if (evnt) {
|
|
9795
|
+
dispatchEvent('column-dragend', {
|
|
9796
|
+
oldColumn: dragColumn,
|
|
9797
|
+
newColumn,
|
|
9798
|
+
dragColumn,
|
|
9799
|
+
dragPos: prevDragPos,
|
|
9800
|
+
dragToChild: isDragToChildFlag,
|
|
9801
|
+
offsetIndex: dragOffsetIndex,
|
|
9802
|
+
_index: {
|
|
9803
|
+
newIndex: nafIndex,
|
|
9804
|
+
oldIndex: oafIndex
|
|
9805
|
+
}
|
|
9806
|
+
}, evnt);
|
|
9807
|
+
}
|
|
9808
|
+
return nextTick().then(() => {
|
|
9662
9809
|
if (isSyncColumn) {
|
|
9663
|
-
$xeTable.handleColDragSwapColumn();
|
|
9810
|
+
return $xeTable.handleColDragSwapColumn();
|
|
9811
|
+
}
|
|
9812
|
+
}).then(() => {
|
|
9813
|
+
if (animation) {
|
|
9814
|
+
const { tableColumn } = reactData;
|
|
9815
|
+
const { visibleColumn, fullColumnIdData } = internalData;
|
|
9816
|
+
let dragNewColumn = null;
|
|
9817
|
+
const dragNewColMaps = {};
|
|
9818
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
9819
|
+
if (!dragNewColumn && (!column.children || !column.children.length)) {
|
|
9820
|
+
dragNewColumn = column;
|
|
9821
|
+
}
|
|
9822
|
+
dragNewColMaps[column.id] = column;
|
|
9823
|
+
});
|
|
9824
|
+
if (!dragNewColumn) {
|
|
9825
|
+
dragNewColumn = dragColumn;
|
|
9826
|
+
}
|
|
9827
|
+
if (dragColWidth && dragAllTargetCols.length) {
|
|
9828
|
+
const _newColIndex = XEUtils.findIndexOf(visibleColumn, column => !!dragNewColumn && column.id === dragNewColumn.id);
|
|
9829
|
+
const firstCol = tableColumn[0];
|
|
9830
|
+
const firstColRest = fullColumnIdData[firstCol.id];
|
|
9831
|
+
if (firstColRest) {
|
|
9832
|
+
const _firstColIndex = firstColRest._index;
|
|
9833
|
+
const _lastColIndex = _firstColIndex + tableColumn.length;
|
|
9834
|
+
let csIndex = -1;
|
|
9835
|
+
let ceIndex = -1;
|
|
9836
|
+
let offsetRate = 1;
|
|
9837
|
+
if (_dragColIndex < _firstColIndex) {
|
|
9838
|
+
// 从左往右虚拟拖拽
|
|
9839
|
+
csIndex = 0;
|
|
9840
|
+
ceIndex = _newColIndex - _firstColIndex;
|
|
9841
|
+
}
|
|
9842
|
+
else if (_dragColIndex > _lastColIndex) {
|
|
9843
|
+
// 从右往左虚拟拖拽
|
|
9844
|
+
const $newRowIndex = dragColRest.$index;
|
|
9845
|
+
csIndex = $newRowIndex + 1;
|
|
9846
|
+
ceIndex = tableColumn.length;
|
|
9847
|
+
offsetRate = -1;
|
|
9848
|
+
}
|
|
9849
|
+
else {
|
|
9850
|
+
if (_newColIndex > _dragColIndex) {
|
|
9851
|
+
// 从左往右拖拽
|
|
9852
|
+
csIndex = _dragColIndex - _firstColIndex;
|
|
9853
|
+
ceIndex = csIndex + _newColIndex - _dragColIndex;
|
|
9854
|
+
}
|
|
9855
|
+
else {
|
|
9856
|
+
// 从右往左拖拽
|
|
9857
|
+
csIndex = _newColIndex - _firstColIndex + 1;
|
|
9858
|
+
ceIndex = csIndex + _dragColIndex - _newColIndex;
|
|
9859
|
+
offsetRate = -1;
|
|
9860
|
+
}
|
|
9861
|
+
}
|
|
9862
|
+
const dragRangeList = [];
|
|
9863
|
+
const dragRangeMaps = {};
|
|
9864
|
+
for (let i = csIndex; i < ceIndex; i++) {
|
|
9865
|
+
const column = tableColumn[i];
|
|
9866
|
+
if (!dragRangeMaps[column.id] && !dragNewColMaps[column.id]) {
|
|
9867
|
+
dragRangeMaps[column.id] = column;
|
|
9868
|
+
dragRangeList.push(column);
|
|
9869
|
+
}
|
|
9870
|
+
}
|
|
9871
|
+
XEUtils.eachTree([newColumn], column => {
|
|
9872
|
+
if (!dragRangeMaps[column.id]) {
|
|
9873
|
+
dragRangeMaps[column.id] = column;
|
|
9874
|
+
dragRangeList.push(column);
|
|
9875
|
+
}
|
|
9876
|
+
});
|
|
9877
|
+
if (dragRangeList.length) {
|
|
9878
|
+
const dtTrList = el.querySelectorAll(dragRangeList.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
|
|
9879
|
+
moveColAnimateToLr(dtTrList, offsetRate * dragColWidth);
|
|
9880
|
+
}
|
|
9881
|
+
}
|
|
9882
|
+
const newTrList = el.querySelectorAll(dragAllTargetCols.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','));
|
|
9883
|
+
const newTdEl = newTrList[0];
|
|
9884
|
+
if (dragOffsetLeft > -1 && newTdEl) {
|
|
9885
|
+
moveColAnimateToLr(newTrList, dragOffsetLeft - newTdEl.offsetLeft);
|
|
9886
|
+
}
|
|
9887
|
+
}
|
|
9664
9888
|
}
|
|
9889
|
+
updateColumnOffsetLeft();
|
|
9890
|
+
loadScrollXData();
|
|
9891
|
+
$xeTable.updateCellAreas();
|
|
9665
9892
|
return {
|
|
9666
9893
|
status: true
|
|
9667
9894
|
};
|
|
9668
|
-
}).catch(() => {
|
|
9669
|
-
return errRest;
|
|
9670
9895
|
});
|
|
9671
|
-
}
|
|
9896
|
+
}).catch(() => {
|
|
9897
|
+
return errRest;
|
|
9898
|
+
});
|
|
9672
9899
|
}
|
|
9673
9900
|
return Promise.resolve(errRest);
|
|
9674
9901
|
},
|
|
9675
9902
|
handleHeaderCellDragDragendEvent(evnt) {
|
|
9676
9903
|
const { dragCol } = reactData;
|
|
9677
9904
|
const { prevDragCol, prevDragPos, prevDragToChild } = internalData;
|
|
9905
|
+
const el = refElem.value;
|
|
9678
9906
|
$xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild);
|
|
9679
9907
|
hideDropTip();
|
|
9680
9908
|
clearColDropOrigin();
|
|
9909
|
+
clearColAnimate(el);
|
|
9681
9910
|
internalData.prevDragToChild = false;
|
|
9682
9911
|
reactData.dragRow = null;
|
|
9683
9912
|
reactData.dragCol = null;
|
|
9684
|
-
setTimeout(() => {
|
|
9685
|
-
reactData.isDragColMove = false;
|
|
9686
|
-
$xeTable.recalculate().then(() => {
|
|
9687
|
-
loadScrollXData();
|
|
9688
|
-
});
|
|
9689
|
-
}, 500);
|
|
9690
9913
|
},
|
|
9691
9914
|
handleHeaderCellDragDragoverEvent(evnt) {
|
|
9692
9915
|
const { dragCol } = reactData;
|
|
@@ -9760,7 +9983,6 @@ export default defineVxeComponent({
|
|
|
9760
9983
|
const { column } = params;
|
|
9761
9984
|
const dragEl = evnt.currentTarget;
|
|
9762
9985
|
const thEl = trigger === 'cell' ? dragEl : (_a = dragEl.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
9763
|
-
reactData.isDragColMove = false;
|
|
9764
9986
|
clearColDropOrigin();
|
|
9765
9987
|
if (dragStartMethod && !dragStartMethod(params)) {
|
|
9766
9988
|
thEl.draggable = false;
|
|
@@ -9781,7 +10003,6 @@ export default defineVxeComponent({
|
|
|
9781
10003
|
hideDropTip();
|
|
9782
10004
|
reactData.dragRow = null;
|
|
9783
10005
|
reactData.dragCol = null;
|
|
9784
|
-
reactData.isDragColMove = false;
|
|
9785
10006
|
},
|
|
9786
10007
|
handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, params) {
|
|
9787
10008
|
const { highlightHoverRow } = props;
|
|
@@ -9848,8 +10069,6 @@ export default defineVxeComponent({
|
|
|
9848
10069
|
}
|
|
9849
10070
|
internalData.lastScrollTop = scrollTop;
|
|
9850
10071
|
}
|
|
9851
|
-
reactData.isDragColMove = false;
|
|
9852
|
-
reactData.isDragRowMove = false;
|
|
9853
10072
|
reactData.lastScrollTime = Date.now();
|
|
9854
10073
|
const evntParams = Object.assign({ scrollTop,
|
|
9855
10074
|
scrollLeft,
|
|
@@ -11318,12 +11537,7 @@ export default defineVxeComponent({
|
|
|
11318
11537
|
mergeCellFlag.value++;
|
|
11319
11538
|
});
|
|
11320
11539
|
watch(mergeCellFlag, () => {
|
|
11321
|
-
|
|
11322
|
-
nextTick(() => {
|
|
11323
|
-
if (props.mergeCells) {
|
|
11324
|
-
tableMethods.setMergeCells(props.mergeCells);
|
|
11325
|
-
}
|
|
11326
|
-
});
|
|
11540
|
+
handleUpdateMergeBodyCells(props.mergeCells || []);
|
|
11327
11541
|
});
|
|
11328
11542
|
const mergeFooterItemFlag = ref(0);
|
|
11329
11543
|
watch(() => props.mergeFooterItems ? props.mergeFooterItems.length : -1, () => {
|
|
@@ -11333,12 +11547,7 @@ export default defineVxeComponent({
|
|
|
11333
11547
|
mergeFooterItemFlag.value++;
|
|
11334
11548
|
});
|
|
11335
11549
|
watch(mergeFooterItemFlag, () => {
|
|
11336
|
-
|
|
11337
|
-
nextTick(() => {
|
|
11338
|
-
if (props.mergeFooterItems) {
|
|
11339
|
-
tableMethods.setMergeFooterItems(props.mergeFooterItems);
|
|
11340
|
-
}
|
|
11341
|
-
});
|
|
11550
|
+
handleUpdateMergeFooterCells(props.mergeFooterItems || []);
|
|
11342
11551
|
});
|
|
11343
11552
|
watch(computeRowGroupFields, (val) => {
|
|
11344
11553
|
handleUpdateRowGroup(val);
|
|
@@ -11623,7 +11832,7 @@ export default defineVxeComponent({
|
|
|
11623
11832
|
globalEvents.on($xeTable, 'keydown', handleGlobalKeydownEvent);
|
|
11624
11833
|
globalEvents.on($xeTable, 'resize', handleGlobalResizeEvent);
|
|
11625
11834
|
globalEvents.on($xeTable, 'contextmenu', $xeTable.handleGlobalContextmenuEvent);
|
|
11626
|
-
|
|
11835
|
+
$xeTable.preventEvent(null, 'mounted', { $table: $xeTable });
|
|
11627
11836
|
});
|
|
11628
11837
|
onBeforeUnmount(() => {
|
|
11629
11838
|
const tableViewportEl = refTableViewportElem.value;
|
|
@@ -11657,6 +11866,7 @@ export default defineVxeComponent({
|
|
|
11657
11866
|
nextTick(() => {
|
|
11658
11867
|
if (props.loading) {
|
|
11659
11868
|
if (!VxeUILoadingComponent && !slots.loading) {
|
|
11869
|
+
errLog('vxe.error.errProp', ['loading=true', 'loading=false | <template #loading>...</template>']);
|
|
11660
11870
|
errLog('vxe.error.reqComp', ['vxe-loading']);
|
|
11661
11871
|
}
|
|
11662
11872
|
}
|
|
@@ -11665,6 +11875,24 @@ export default defineVxeComponent({
|
|
|
11665
11875
|
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
11666
11876
|
props.tooltipConfig || props.editRules) {
|
|
11667
11877
|
if (!VxeUITooltipComponent) {
|
|
11878
|
+
if (props.showOverflow === true) {
|
|
11879
|
+
errLog('vxe.error.errProp', ['show-overflow=true', 'show-overflow=title']);
|
|
11880
|
+
}
|
|
11881
|
+
if (props.showOverflow === 'tooltip') {
|
|
11882
|
+
errLog('vxe.error.errProp', ['show-overflow=tooltip', 'show-overflow=title']);
|
|
11883
|
+
}
|
|
11884
|
+
if (props.showHeaderOverflow === true) {
|
|
11885
|
+
errLog('vxe.error.errProp', ['show-header-overflow=true', 'show-header-overflow=title']);
|
|
11886
|
+
}
|
|
11887
|
+
if (props.showHeaderOverflow === 'tooltip') {
|
|
11888
|
+
errLog('vxe.error.errProp', ['show-header-overflow=tooltip', 'show-header-overflow=title']);
|
|
11889
|
+
}
|
|
11890
|
+
if (props.showFooterOverflow === true) {
|
|
11891
|
+
errLog('vxe.error.errProp', ['show-footer-overflow=true', 'show-footer-overflow=title']);
|
|
11892
|
+
}
|
|
11893
|
+
if (props.showFooterOverflow === 'tooltip') {
|
|
11894
|
+
errLog('vxe.error.errProp', ['show-footer-overflow=tooltip', 'show-footer-overflow=title']);
|
|
11895
|
+
}
|
|
11668
11896
|
errLog('vxe.error.reqComp', ['vxe-tooltip']);
|
|
11669
11897
|
}
|
|
11670
11898
|
}
|