vxe-table 3.16.0-beta.0 → 3.16.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +864 -690
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +0 -4
- package/es/table/module/custom/panel.js +0 -1
- package/es/table/module/keyboard/mixin.js +2 -2
- package/es/table/src/anime.js +46 -0
- package/es/table/src/body.js +15 -40
- package/es/table/src/columnInfo.js +6 -1
- package/es/table/src/footer.js +1 -19
- package/es/table/src/header.js +1 -19
- package/es/table/src/methods.js +532 -346
- package/es/table/src/table.js +22 -3
- 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 +969 -808
- 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 +1595 -1245
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/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/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 +3 -28
- package/lib/table/src/body.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 +1 -19
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +1 -19
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +539 -355
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +22 -2
- package/lib/table/src/table.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 +1 -1
- package/packages/grid/src/grid.ts +1005 -777
- package/packages/table/module/custom/mixin.ts +0 -4
- package/packages/table/module/custom/panel.ts +0 -1
- package/packages/table/module/keyboard/mixin.ts +2 -2
- package/packages/table/src/anime.ts +52 -0
- package/packages/table/src/body.ts +15 -40
- package/packages/table/src/columnInfo.ts +6 -1
- package/packages/table/src/footer.ts +1 -19
- package/packages/table/src/header.ts +1 -20
- package/packages/table/src/methods.ts +554 -360
- package/packages/table/src/props.ts +4 -4
- package/packages/table/src/table.ts +22 -3
- package/packages/ui/index.ts +2 -1
- package/styles/components/table.scss +9 -9
- /package/es/{iconfont.1750770351840.ttf → iconfont.1751194972120.ttf} +0 -0
- /package/es/{iconfont.1750770351840.woff → iconfont.1751194972120.woff} +0 -0
- /package/es/{iconfont.1750770351840.woff2 → iconfont.1751194972120.woff2} +0 -0
- /package/lib/{iconfont.1750770351840.ttf → iconfont.1751194972120.ttf} +0 -0
- /package/lib/{iconfont.1750770351840.woff → iconfont.1751194972120.woff} +0 -0
- /package/lib/{iconfont.1750770351840.woff2 → iconfont.1751194972120.woff2} +0 -0
|
@@ -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
|
|
|
10
11
|
import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeGridConstructor, GridPrivateMethods, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
|
|
@@ -445,7 +446,7 @@ function handleVirtualTreeExpand ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
445
446
|
updateAfterDataIndex($xeTable)
|
|
446
447
|
return $xeTable.$nextTick()
|
|
447
448
|
}).then(() => {
|
|
448
|
-
return $xeTable
|
|
449
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
449
450
|
}).then(() => {
|
|
450
451
|
setTimeout(() => {
|
|
451
452
|
$xeTable.updateCellAreas()
|
|
@@ -523,7 +524,7 @@ function handleRowGroupVirtualExpand ($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
523
524
|
updateAfterDataIndex($xeTable)
|
|
524
525
|
return $xeTable.$nextTick()
|
|
525
526
|
}).then(() => {
|
|
526
|
-
return $xeTable
|
|
527
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
527
528
|
}).then(() => {
|
|
528
529
|
setTimeout(() => {
|
|
529
530
|
$xeTable.updateCellAreas()
|
|
@@ -2313,8 +2314,6 @@ function clearDragStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2313
2314
|
hideDropTip($xeTable)
|
|
2314
2315
|
reactData.dragRow = null
|
|
2315
2316
|
reactData.dragCol = null
|
|
2316
|
-
reactData.isDragColMove = false
|
|
2317
|
-
reactData.isDragRowMove = false
|
|
2318
2317
|
}
|
|
2319
2318
|
}
|
|
2320
2319
|
|
|
@@ -2677,7 +2676,7 @@ function calcScrollbar ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2677
2676
|
}
|
|
2678
2677
|
}
|
|
2679
2678
|
|
|
2680
|
-
function
|
|
2679
|
+
function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean) {
|
|
2681
2680
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2682
2681
|
|
|
2683
2682
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
@@ -2693,19 +2692,28 @@ function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
2693
2692
|
calcVarRowHeightConfig($xeTable, 'small', smallEl)
|
|
2694
2693
|
calcVarRowHeightConfig($xeTable, 'mini', miniEl)
|
|
2695
2694
|
}
|
|
2696
|
-
|
|
2697
|
-
|
|
2695
|
+
if (reWidth) {
|
|
2696
|
+
calcCellWidth($xeTable)
|
|
2697
|
+
}
|
|
2698
|
+
if (reFull) {
|
|
2699
|
+
autoCellWidth($xeTable)
|
|
2700
|
+
}
|
|
2698
2701
|
calcScrollbar($xeTable)
|
|
2699
2702
|
updateStyle($xeTable)
|
|
2700
2703
|
updateRowExpandStyle($xeTable)
|
|
2701
2704
|
return computeScrollLoad($xeTable).then(() => {
|
|
2702
2705
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2703
|
-
|
|
2706
|
+
if (reWidth) {
|
|
2707
|
+
calcCellWidth($xeTable)
|
|
2708
|
+
}
|
|
2704
2709
|
if (reFull) {
|
|
2705
2710
|
autoCellWidth($xeTable)
|
|
2706
2711
|
}
|
|
2707
|
-
|
|
2712
|
+
if (reHeight) {
|
|
2713
|
+
calcCellHeight($xeTable)
|
|
2714
|
+
}
|
|
2708
2715
|
updateStyle($xeTable)
|
|
2716
|
+
calcScrollbar($xeTable)
|
|
2709
2717
|
if (reFull) {
|
|
2710
2718
|
updateRowOffsetTop($xeTable)
|
|
2711
2719
|
}
|
|
@@ -2716,6 +2724,41 @@ function handleRecalculateLayout ($xeTable: VxeTableConstructor & VxeTablePrivat
|
|
|
2716
2724
|
})
|
|
2717
2725
|
}
|
|
2718
2726
|
|
|
2727
|
+
function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean) {
|
|
2728
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2729
|
+
|
|
2730
|
+
return new Promise<void>(resolve => {
|
|
2731
|
+
const { rceTimeout, rceRunTime } = internalData
|
|
2732
|
+
const resizeOpts = $xeTable.computeResizeOpts
|
|
2733
|
+
const refreshDelay = resizeOpts.refreshDelay || 20
|
|
2734
|
+
const el = $xeTable.$refs.refElem as HTMLElement
|
|
2735
|
+
if (el && el.clientWidth) {
|
|
2736
|
+
autoCellWidth($xeTable)
|
|
2737
|
+
updateRowExpandStyle($xeTable)
|
|
2738
|
+
}
|
|
2739
|
+
if (rceTimeout) {
|
|
2740
|
+
clearTimeout(rceTimeout)
|
|
2741
|
+
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
2742
|
+
resolve(
|
|
2743
|
+
handleRecalculateStyle($xeTable, !!reFull, reWidth, reHeight)
|
|
2744
|
+
)
|
|
2745
|
+
} else {
|
|
2746
|
+
$xeTable.$nextTick(() => {
|
|
2747
|
+
resolve()
|
|
2748
|
+
})
|
|
2749
|
+
}
|
|
2750
|
+
} else {
|
|
2751
|
+
resolve(
|
|
2752
|
+
handleRecalculateStyle($xeTable, !!reFull, reWidth, reHeight)
|
|
2753
|
+
)
|
|
2754
|
+
}
|
|
2755
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
2756
|
+
internalData.rceTimeout = undefined
|
|
2757
|
+
handleRecalculateStyle($xeTable, !!reFull, reWidth, reHeight)
|
|
2758
|
+
}, refreshDelay)
|
|
2759
|
+
})
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2719
2762
|
function handleUpdateAggValues ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
2720
2763
|
const reactData = $xeTable as unknown as TableReactData
|
|
2721
2764
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -2944,8 +2987,6 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2944
2987
|
internalData.removeRowMaps = {}
|
|
2945
2988
|
reactData.removeRowFlag++
|
|
2946
2989
|
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
2947
|
-
reactData.isDragColMove = false
|
|
2948
|
-
reactData.isDragRowMove = false
|
|
2949
2990
|
// 全量数据
|
|
2950
2991
|
internalData.tableFullData = fullData
|
|
2951
2992
|
internalData.tableFullTreeData = isRGroup ? [] : treeData
|
|
@@ -3009,11 +3050,11 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3009
3050
|
$xeTable.checkSelectionStatus()
|
|
3010
3051
|
return new Promise<void>(resolve => {
|
|
3011
3052
|
$xeTable.$nextTick()
|
|
3012
|
-
.then(() =>
|
|
3053
|
+
.then(() => handleRecalculateStyle($xeTable, false, false, false))
|
|
3013
3054
|
.then(() => {
|
|
3014
3055
|
calcCellHeight($xeTable)
|
|
3015
3056
|
updateRowOffsetTop($xeTable)
|
|
3016
|
-
return
|
|
3057
|
+
return handleRecalculateStyle($xeTable, false, false, false)
|
|
3017
3058
|
})
|
|
3018
3059
|
.then(() => {
|
|
3019
3060
|
let targetScrollLeft = lastScrollLeft
|
|
@@ -3028,7 +3069,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3028
3069
|
targetScrollTop = 0
|
|
3029
3070
|
}
|
|
3030
3071
|
reactData.isRowLoading = false
|
|
3031
|
-
|
|
3072
|
+
handleRecalculateStyle($xeTable, false, false, false)
|
|
3032
3073
|
// 是否变更虚拟滚动
|
|
3033
3074
|
if (oldScrollYLoad === sYLoad) {
|
|
3034
3075
|
restoreScrollLocation($xeTable, targetScrollLeft, targetScrollTop)
|
|
@@ -3283,7 +3324,6 @@ function handleColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
3283
3324
|
const tableFullColumn = getColumnList(collectColumn)
|
|
3284
3325
|
internalData.tableFullColumn = tableFullColumn
|
|
3285
3326
|
reactData.isColLoading = true
|
|
3286
|
-
reactData.isDragColMove = false
|
|
3287
3327
|
initColumnSort($xeTable)
|
|
3288
3328
|
return Promise.resolve(
|
|
3289
3329
|
restoreCustomStorage($xeTable)
|
|
@@ -3810,10 +3850,10 @@ const Methods = {
|
|
|
3810
3850
|
}
|
|
3811
3851
|
}).then(() => {
|
|
3812
3852
|
$xeTable.updateCellAreas()
|
|
3813
|
-
return $xeTable
|
|
3853
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
3814
3854
|
}).then(() => {
|
|
3815
3855
|
// 存在滚动行为未结束情况
|
|
3816
|
-
setTimeout(() => $xeTable
|
|
3856
|
+
setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50)
|
|
3817
3857
|
})
|
|
3818
3858
|
},
|
|
3819
3859
|
handleTableData (force: any) {
|
|
@@ -3868,7 +3908,7 @@ const Methods = {
|
|
|
3868
3908
|
if (!initStatus) {
|
|
3869
3909
|
handleLoadDefaults($xeTable)
|
|
3870
3910
|
}
|
|
3871
|
-
return
|
|
3911
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
3872
3912
|
})
|
|
3873
3913
|
},
|
|
3874
3914
|
/**
|
|
@@ -3886,7 +3926,7 @@ const Methods = {
|
|
|
3886
3926
|
})
|
|
3887
3927
|
.then(() => {
|
|
3888
3928
|
handleLoadDefaults($xeTable)
|
|
3889
|
-
return
|
|
3929
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
3890
3930
|
})
|
|
3891
3931
|
},
|
|
3892
3932
|
/**
|
|
@@ -4388,7 +4428,7 @@ const Methods = {
|
|
|
4388
4428
|
}
|
|
4389
4429
|
return $xeTable.$nextTick().then(() => {
|
|
4390
4430
|
$xeTable.updateCellAreas()
|
|
4391
|
-
return $xeTable
|
|
4431
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4392
4432
|
})
|
|
4393
4433
|
}
|
|
4394
4434
|
return $xeTable.reloadData(tableSourceData)
|
|
@@ -5319,7 +5359,7 @@ const Methods = {
|
|
|
5319
5359
|
return parseColumns($xeTable, true).then(() => {
|
|
5320
5360
|
return this.refreshScroll()
|
|
5321
5361
|
}).then(() => {
|
|
5322
|
-
return
|
|
5362
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
5323
5363
|
})
|
|
5324
5364
|
},
|
|
5325
5365
|
/**
|
|
@@ -5860,38 +5900,9 @@ const Methods = {
|
|
|
5860
5900
|
*/
|
|
5861
5901
|
recalculate (reFull?: boolean) {
|
|
5862
5902
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5863
|
-
const internalData = $xeTable as unknown as TableInternalData
|
|
5864
5903
|
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
const resizeOpts = $xeTable.computeResizeOpts
|
|
5868
|
-
const refreshDelay = resizeOpts.refreshDelay || 20
|
|
5869
|
-
const el = $xeTable.$refs.refElem as HTMLElement
|
|
5870
|
-
if (el && el.clientWidth) {
|
|
5871
|
-
autoCellWidth($xeTable)
|
|
5872
|
-
updateRowExpandStyle($xeTable)
|
|
5873
|
-
}
|
|
5874
|
-
if (rceTimeout) {
|
|
5875
|
-
clearTimeout(rceTimeout)
|
|
5876
|
-
if (rceRunTime && rceRunTime + (refreshDelay - 5) < Date.now()) {
|
|
5877
|
-
resolve(
|
|
5878
|
-
handleRecalculateLayout($xeTable, !!reFull)
|
|
5879
|
-
)
|
|
5880
|
-
} else {
|
|
5881
|
-
$xeTable.$nextTick(() => {
|
|
5882
|
-
resolve()
|
|
5883
|
-
})
|
|
5884
|
-
}
|
|
5885
|
-
} else {
|
|
5886
|
-
resolve(
|
|
5887
|
-
handleRecalculateLayout($xeTable, !!reFull)
|
|
5888
|
-
)
|
|
5889
|
-
}
|
|
5890
|
-
internalData.rceTimeout = setTimeout(() => {
|
|
5891
|
-
internalData.rceTimeout = undefined
|
|
5892
|
-
handleRecalculateLayout($xeTable, !!reFull)
|
|
5893
|
-
}, refreshDelay)
|
|
5894
|
-
})
|
|
5904
|
+
const isForce = !!reFull
|
|
5905
|
+
return handleLazyRecalculate($xeTable, isForce, isForce, isForce)
|
|
5895
5906
|
},
|
|
5896
5907
|
updateStyle () {
|
|
5897
5908
|
const $xeTable = this
|
|
@@ -6475,9 +6486,12 @@ const Methods = {
|
|
|
6475
6486
|
}
|
|
6476
6487
|
},
|
|
6477
6488
|
handleGlobalResizeEvent () {
|
|
6478
|
-
this
|
|
6479
|
-
|
|
6480
|
-
|
|
6489
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6490
|
+
|
|
6491
|
+
$xeTable.closeMenu()
|
|
6492
|
+
$xeTable.updateCellAreas()
|
|
6493
|
+
handleLazyRecalculate($xeTable, true, true, true)
|
|
6494
|
+
$xeTable.updateCellAreas()
|
|
6481
6495
|
},
|
|
6482
6496
|
/**
|
|
6483
6497
|
* 处理合并
|
|
@@ -7063,7 +7077,8 @@ const Methods = {
|
|
|
7063
7077
|
const childList: any[] = vals[2]
|
|
7064
7078
|
let sLen = 0 // 已选
|
|
7065
7079
|
let hLen = 0 // 半选
|
|
7066
|
-
let vLen = 0 //
|
|
7080
|
+
let vLen = 0 // 有效子行
|
|
7081
|
+
const cLen = childList.length // 有效子行
|
|
7067
7082
|
childList.forEach(
|
|
7068
7083
|
checkMethod
|
|
7069
7084
|
? (item) => {
|
|
@@ -7096,15 +7111,25 @@ const Methods = {
|
|
|
7096
7111
|
}
|
|
7097
7112
|
)
|
|
7098
7113
|
|
|
7099
|
-
let isSelected =
|
|
7100
|
-
if (
|
|
7101
|
-
if (
|
|
7102
|
-
isSelected = sLen >= vLen
|
|
7114
|
+
let isSelected = false
|
|
7115
|
+
if (cLen > 0) {
|
|
7116
|
+
if (vLen > 0) {
|
|
7117
|
+
isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen
|
|
7103
7118
|
} else {
|
|
7104
|
-
|
|
7119
|
+
// 如果存在子项禁用
|
|
7120
|
+
if ((sLen > 0 && sLen >= vLen)) {
|
|
7121
|
+
isSelected = true
|
|
7122
|
+
} else if (selectCheckboxMaps[rowid]) {
|
|
7123
|
+
isSelected = true
|
|
7124
|
+
} else {
|
|
7125
|
+
isSelected = false
|
|
7126
|
+
}
|
|
7105
7127
|
}
|
|
7128
|
+
} else {
|
|
7129
|
+
// 如果无子项
|
|
7130
|
+
isSelected = selectCheckboxMaps[rowid]
|
|
7106
7131
|
}
|
|
7107
|
-
const halfSelect = !isSelected && (sLen
|
|
7132
|
+
const halfSelect = !isSelected && (sLen > 0 || hLen > 0)
|
|
7108
7133
|
|
|
7109
7134
|
if (checkField) {
|
|
7110
7135
|
XEUtils.set(row, checkField, isSelected)
|
|
@@ -7148,7 +7173,9 @@ const Methods = {
|
|
|
7148
7173
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
7149
7174
|
|
|
7150
7175
|
let sLen = 0 // 已选
|
|
7176
|
+
let dsLen = 0 // 禁用的已选
|
|
7151
7177
|
let hLen = 0 // 半选
|
|
7178
|
+
let dhLen = 0 // 禁用的半选
|
|
7152
7179
|
let vLen = 0 // 有效行
|
|
7153
7180
|
|
|
7154
7181
|
const rootList = (treeConfig ? afterTreeFullData : (isRowGroupStatus ? afterGroupFullData : afterFullData))
|
|
@@ -7165,9 +7192,9 @@ const Methods = {
|
|
|
7165
7192
|
vLen++
|
|
7166
7193
|
} else {
|
|
7167
7194
|
if (selected) {
|
|
7168
|
-
|
|
7195
|
+
dsLen++
|
|
7169
7196
|
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
7170
|
-
|
|
7197
|
+
dhLen++
|
|
7171
7198
|
}
|
|
7172
7199
|
}
|
|
7173
7200
|
}
|
|
@@ -7183,7 +7210,7 @@ const Methods = {
|
|
|
7183
7210
|
})
|
|
7184
7211
|
|
|
7185
7212
|
const isSelected = rootList.length > 0 ? (vLen > 0 ? (sLen >= vLen) : (sLen >= rootList.length)) : false
|
|
7186
|
-
let halfSelect = !isSelected && (sLen
|
|
7213
|
+
let halfSelect = !isSelected && (sLen > 0 || hLen > 0 || dsLen > 0 || dhLen > 0)
|
|
7187
7214
|
|
|
7188
7215
|
// 如果复选框启用保留记录,当保留数据存在时显示半选
|
|
7189
7216
|
if (!isSelected && !halfSelect && showReserveStatus) {
|
|
@@ -7953,88 +7980,81 @@ const Methods = {
|
|
|
7953
7980
|
const { treeConfig, dragConfig } = props
|
|
7954
7981
|
const rowDragOpts = $xeTable.computeRowDragOpts
|
|
7955
7982
|
const { afterFullData, tableFullData, fullAllDataRowIdData } = internalData
|
|
7956
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts
|
|
7983
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, dragEndMethod, dragToChildMethod } = rowDragOpts
|
|
7957
7984
|
const treeOpts = $xeTable.computeTreeOpts
|
|
7985
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
7986
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
7987
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
7958
7988
|
const { transform, rowField, mapChildrenField, parentField } = treeOpts
|
|
7959
7989
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
7960
7990
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null)
|
|
7961
7991
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
7992
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
7962
7993
|
const errRest = {
|
|
7963
7994
|
status: false
|
|
7964
7995
|
}
|
|
7965
|
-
if (prevDragRow && dragRow) {
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7996
|
+
if (!(el && prevDragRow && dragRow)) {
|
|
7997
|
+
return Promise.resolve(errRest)
|
|
7998
|
+
}
|
|
7999
|
+
// 判断是否有拖动
|
|
8000
|
+
if (prevDragRow !== dragRow) {
|
|
8001
|
+
const dragParams = {
|
|
8002
|
+
oldRow: dragRow,
|
|
8003
|
+
newRow: prevDragRow,
|
|
8004
|
+
dragRow,
|
|
8005
|
+
dragPos: prevDragPos as 'top' | 'bottom',
|
|
8006
|
+
dragToChild: !!prevDragToChild,
|
|
8007
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
8008
|
+
}
|
|
8009
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8010
|
+
return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
|
|
8011
|
+
if (!status) {
|
|
8012
|
+
return errRest
|
|
8013
|
+
}
|
|
8014
|
+
|
|
8015
|
+
const dragRowid = getRowid($xeTable, dragRow)
|
|
8016
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid] || {}
|
|
8017
|
+
const _dragRowIndex = dragRowRest._index
|
|
8018
|
+
let dragRowHeight = 0
|
|
8019
|
+
let dragOffsetTop = -1
|
|
8020
|
+
if (animation) {
|
|
8021
|
+
dragRowHeight = getCellRestHeight(dragRowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
8022
|
+
const oldTrEl = el.querySelector<HTMLElement>(`.vxe-body--row[rowid="${dragRowid}"]`)
|
|
8023
|
+
if (oldTrEl) {
|
|
8024
|
+
dragOffsetTop = oldTrEl.offsetTop
|
|
7980
8025
|
}
|
|
8026
|
+
}
|
|
7981
8027
|
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
const newRest = fullAllDataRowIdData[newRowid]
|
|
7992
|
-
|
|
7993
|
-
if (oldRest && newRest) {
|
|
7994
|
-
const { level: oldLevel } = oldRest
|
|
7995
|
-
const { level: newLevel } = newRest
|
|
7996
|
-
|
|
7997
|
-
const oldAllMaps: Record<string, any> = {}
|
|
7998
|
-
XEUtils.eachTree([dragRow], item => {
|
|
7999
|
-
oldAllMaps[getRowid($xeTable, item)] = item
|
|
8000
|
-
}, { children: mapChildrenField })
|
|
8001
|
-
|
|
8002
|
-
let isSelfToChildStatus = false
|
|
8003
|
-
|
|
8004
|
-
if (oldLevel && newLevel) {
|
|
8005
|
-
// 子到子
|
|
8006
|
-
|
|
8007
|
-
if (isPeerDrag && !isCrossDrag) {
|
|
8008
|
-
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8009
|
-
// 非同级
|
|
8010
|
-
return errRest
|
|
8011
|
-
}
|
|
8012
|
-
} else {
|
|
8013
|
-
if (!isCrossDrag) {
|
|
8014
|
-
return errRest
|
|
8015
|
-
}
|
|
8016
|
-
if (oldAllMaps[newRowid]) {
|
|
8017
|
-
isSelfToChildStatus = true
|
|
8018
|
-
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8019
|
-
if (VxeUI.modal) {
|
|
8020
|
-
VxeUI.modal.message({
|
|
8021
|
-
status: 'error',
|
|
8022
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
8023
|
-
})
|
|
8024
|
-
}
|
|
8025
|
-
return errRest
|
|
8026
|
-
}
|
|
8027
|
-
}
|
|
8028
|
-
}
|
|
8029
|
-
} else if (oldLevel) {
|
|
8030
|
-
// 子到根
|
|
8028
|
+
let oafIndex = -1
|
|
8029
|
+
let nafIndex = -1
|
|
8030
|
+
// 如果为树结构
|
|
8031
|
+
if (treeConfig) {
|
|
8032
|
+
if (transform) {
|
|
8033
|
+
// 移出源位置
|
|
8034
|
+
const oldRest = dragRowRest
|
|
8035
|
+
const newRowid = getRowid($xeTable, prevDragRow)
|
|
8036
|
+
const newRest = fullAllDataRowIdData[newRowid]
|
|
8031
8037
|
|
|
8032
|
-
|
|
8038
|
+
if (oldRest && newRest) {
|
|
8039
|
+
const { level: oldLevel } = oldRest
|
|
8040
|
+
const { level: newLevel } = newRest
|
|
8041
|
+
|
|
8042
|
+
const oldAllMaps: Record<string, any> = {}
|
|
8043
|
+
XEUtils.eachTree([dragRow], item => {
|
|
8044
|
+
oldAllMaps[getRowid($xeTable, item)] = item
|
|
8045
|
+
}, { children: mapChildrenField })
|
|
8046
|
+
|
|
8047
|
+
let isSelfToChildStatus = false
|
|
8048
|
+
|
|
8049
|
+
if (oldLevel && newLevel) {
|
|
8050
|
+
// 子到子
|
|
8051
|
+
|
|
8052
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
8053
|
+
if (oldRest.row[parentField] !== newRest.row[parentField]) {
|
|
8054
|
+
// 非同级
|
|
8033
8055
|
return errRest
|
|
8034
8056
|
}
|
|
8035
|
-
} else
|
|
8036
|
-
// 根到子
|
|
8037
|
-
|
|
8057
|
+
} else {
|
|
8038
8058
|
if (!isCrossDrag) {
|
|
8039
8059
|
return errRest
|
|
8040
8060
|
}
|
|
@@ -8050,95 +8070,169 @@ const Methods = {
|
|
|
8050
8070
|
return errRest
|
|
8051
8071
|
}
|
|
8052
8072
|
}
|
|
8053
|
-
} else {
|
|
8054
|
-
// 根到根
|
|
8055
8073
|
}
|
|
8074
|
+
} else if (oldLevel) {
|
|
8075
|
+
// 子到根
|
|
8056
8076
|
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8077
|
+
if (!isCrossDrag) {
|
|
8078
|
+
return errRest
|
|
8079
|
+
}
|
|
8080
|
+
} else if (newLevel) {
|
|
8081
|
+
// 根到子
|
|
8082
|
+
|
|
8083
|
+
if (!isCrossDrag) {
|
|
8084
|
+
return errRest
|
|
8085
|
+
}
|
|
8086
|
+
if (oldAllMaps[newRowid]) {
|
|
8087
|
+
isSelfToChildStatus = true
|
|
8088
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8089
|
+
if (VxeUI.modal) {
|
|
8090
|
+
VxeUI.modal.message({
|
|
8091
|
+
status: 'error',
|
|
8092
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
8093
|
+
})
|
|
8094
|
+
}
|
|
8095
|
+
return errRest
|
|
8096
|
+
}
|
|
8097
|
+
}
|
|
8098
|
+
} else {
|
|
8099
|
+
// 根到根
|
|
8100
|
+
}
|
|
8062
8101
|
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8102
|
+
const fullList = XEUtils.toTreeArray(internalData.afterTreeFullData, {
|
|
8103
|
+
key: rowField,
|
|
8104
|
+
parentKey: parentField,
|
|
8105
|
+
children: mapChildrenField
|
|
8106
|
+
})
|
|
8066
8107
|
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
fullList.splice(ntfIndex, 0, dragRow)
|
|
8108
|
+
// 移出
|
|
8109
|
+
const otfIndex = $xeTable.findRowIndexOf(fullList, dragRow)
|
|
8110
|
+
fullList.splice(otfIndex, 1)
|
|
8071
8111
|
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
})
|
|
8077
|
-
}
|
|
8078
|
-
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField]
|
|
8112
|
+
// 插入
|
|
8113
|
+
const ptfIndex = $xeTable.findRowIndexOf(fullList, prevDragRow)
|
|
8114
|
+
const ntfIndex = ptfIndex + dragOffsetIndex
|
|
8115
|
+
fullList.splice(ntfIndex, 0, dragRow)
|
|
8079
8116
|
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
mapChildren: mapChildrenField
|
|
8117
|
+
// 改变层级
|
|
8118
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
8119
|
+
XEUtils.each(dragRow[childrenField], childRow => {
|
|
8120
|
+
childRow[parentField] = dragRow[parentField]
|
|
8085
8121
|
})
|
|
8086
8122
|
}
|
|
8123
|
+
dragRow[parentField] = isDragToChildFlag ? prevDragRow[rowField] : prevDragRow[parentField]
|
|
8124
|
+
|
|
8125
|
+
internalData.tableFullTreeData = XEUtils.toArrayTree(fullList, {
|
|
8126
|
+
key: rowField,
|
|
8127
|
+
parentKey: parentField,
|
|
8128
|
+
children: childrenField,
|
|
8129
|
+
mapChildren: mapChildrenField
|
|
8130
|
+
})
|
|
8087
8131
|
}
|
|
8088
|
-
} else {
|
|
8089
|
-
// 移出
|
|
8090
|
-
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow)
|
|
8091
|
-
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow)
|
|
8092
|
-
afterFullData.splice(oafIndex, 1)
|
|
8093
|
-
tableFullData.splice(otfIndex, 1)
|
|
8094
|
-
// 插入
|
|
8095
|
-
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow)
|
|
8096
|
-
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow)
|
|
8097
|
-
nafIndex = pafIndex + dragOffsetIndex
|
|
8098
|
-
const ntfIndex = ptfIndex + dragOffsetIndex
|
|
8099
|
-
afterFullData.splice(nafIndex, 0, dragRow)
|
|
8100
|
-
tableFullData.splice(ntfIndex, 0, dragRow)
|
|
8101
8132
|
}
|
|
8133
|
+
} else {
|
|
8134
|
+
// 移出
|
|
8135
|
+
oafIndex = $xeTable.findRowIndexOf(afterFullData, dragRow)
|
|
8136
|
+
const otfIndex = $xeTable.findRowIndexOf(tableFullData, dragRow)
|
|
8137
|
+
afterFullData.splice(oafIndex, 1)
|
|
8138
|
+
tableFullData.splice(otfIndex, 1)
|
|
8139
|
+
// 插入
|
|
8140
|
+
const pafIndex = $xeTable.findRowIndexOf(afterFullData, prevDragRow)
|
|
8141
|
+
const ptfIndex = $xeTable.findRowIndexOf(tableFullData, prevDragRow)
|
|
8142
|
+
nafIndex = pafIndex + dragOffsetIndex
|
|
8143
|
+
const ntfIndex = ptfIndex + dragOffsetIndex
|
|
8144
|
+
afterFullData.splice(nafIndex, 0, dragRow)
|
|
8145
|
+
tableFullData.splice(ntfIndex, 0, dragRow)
|
|
8146
|
+
}
|
|
8102
8147
|
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
}
|
|
8148
|
+
$xeTable.handleTableData(treeConfig && transform)
|
|
8149
|
+
$xeTable.cacheRowMap(false)
|
|
8150
|
+
updateScrollYStatus($xeTable)
|
|
8151
|
+
if (!(treeConfig && transform)) {
|
|
8152
|
+
updateAfterDataIndex($xeTable)
|
|
8153
|
+
}
|
|
8154
|
+
$xeTable.checkSelectionStatus()
|
|
8155
|
+
if (reactData.scrollYLoad) {
|
|
8156
|
+
$xeTable.updateScrollYSpace()
|
|
8157
|
+
}
|
|
8114
8158
|
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8159
|
+
if (evnt) {
|
|
8160
|
+
$xeTable.dispatchEvent('row-dragend', {
|
|
8161
|
+
oldRow: dragRow,
|
|
8162
|
+
newRow: prevDragRow,
|
|
8163
|
+
dragRow,
|
|
8164
|
+
dragPos: prevDragPos as any,
|
|
8165
|
+
dragToChild: isDragToChildFlag,
|
|
8166
|
+
offsetIndex: dragOffsetIndex,
|
|
8167
|
+
_index: {
|
|
8168
|
+
newIndex: nafIndex,
|
|
8169
|
+
oldIndex: oafIndex
|
|
8170
|
+
}
|
|
8171
|
+
}, evnt)
|
|
8172
|
+
}
|
|
8173
|
+
|
|
8174
|
+
return $xeTable.$nextTick().then(() => {
|
|
8175
|
+
if (animation) {
|
|
8176
|
+
const { tableData } = reactData
|
|
8177
|
+
const dragRowRest = fullAllDataRowIdData[dragRowid]
|
|
8178
|
+
const _newRowIndex = dragRowRest._index
|
|
8179
|
+
const firstRow = tableData[0]
|
|
8180
|
+
const firstRowRest = fullAllDataRowIdData[getRowid($xeTable, firstRow)]
|
|
8181
|
+
|
|
8182
|
+
if (firstRowRest) {
|
|
8183
|
+
const _firstRowIndex = firstRowRest._index
|
|
8184
|
+
const _lastRowIndex = _firstRowIndex + tableData.length
|
|
8185
|
+
|
|
8186
|
+
let rsIndex = -1
|
|
8187
|
+
let reIndex = -1
|
|
8188
|
+
let offsetRate = 1
|
|
8189
|
+
if (_dragRowIndex < _firstRowIndex) {
|
|
8190
|
+
// 从上往下虚拟拖拽
|
|
8191
|
+
rsIndex = 0
|
|
8192
|
+
reIndex = _newRowIndex - _firstRowIndex
|
|
8193
|
+
} else if (_dragRowIndex > _lastRowIndex) {
|
|
8194
|
+
// 从下往上虚拟拖拽
|
|
8195
|
+
const $newRowIndex = dragRowRest.$index
|
|
8196
|
+
rsIndex = $newRowIndex + 1
|
|
8197
|
+
reIndex = tableData.length
|
|
8198
|
+
offsetRate = -1
|
|
8199
|
+
} else {
|
|
8200
|
+
if (_newRowIndex > _dragRowIndex) {
|
|
8201
|
+
// 从上往下拖拽
|
|
8202
|
+
rsIndex = _dragRowIndex - _firstRowIndex
|
|
8203
|
+
reIndex = rsIndex + _newRowIndex - _dragRowIndex
|
|
8204
|
+
} else {
|
|
8205
|
+
// 从下往上拖拽
|
|
8206
|
+
rsIndex = _newRowIndex - _firstRowIndex
|
|
8207
|
+
reIndex = rsIndex + _dragRowIndex - _newRowIndex + 1
|
|
8208
|
+
offsetRate = -1
|
|
8209
|
+
}
|
|
8126
8210
|
}
|
|
8127
|
-
}, evnt)
|
|
8128
|
-
}
|
|
8129
8211
|
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
status: true
|
|
8212
|
+
const dragRangeList = tableData.slice(rsIndex, reIndex)
|
|
8213
|
+
if (dragRangeList.length) {
|
|
8214
|
+
const dtTrList = el.querySelectorAll<HTMLElement>(dragRangeList.map(row => `.vxe-body--row[rowid="${getRowid($xeTable, row)}"]`).join(','))
|
|
8215
|
+
moveRowAnimateToTb(dtTrList, offsetRate * dragRowHeight)
|
|
8216
|
+
}
|
|
8136
8217
|
}
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8218
|
+
|
|
8219
|
+
const newTrList = el.querySelectorAll<HTMLElement>(`.vxe-body--row[rowid="${dragRowid}"]`)
|
|
8220
|
+
const newTrEl = newTrList[0]
|
|
8221
|
+
if (dragOffsetTop > -1 && newTrEl) {
|
|
8222
|
+
moveRowAnimateToTb(newTrList, dragOffsetTop - newTrEl.offsetTop)
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
|
|
8226
|
+
$xeTable.updateCellAreas()
|
|
8227
|
+
$xeTable.recalculate()
|
|
8228
|
+
}).then(() => {
|
|
8229
|
+
return {
|
|
8230
|
+
status: true
|
|
8231
|
+
}
|
|
8140
8232
|
})
|
|
8141
|
-
}
|
|
8233
|
+
}).catch(() => {
|
|
8234
|
+
return errRest
|
|
8235
|
+
})
|
|
8142
8236
|
}
|
|
8143
8237
|
return Promise.resolve(errRest)
|
|
8144
8238
|
},
|
|
@@ -8155,6 +8249,7 @@ const Methods = {
|
|
|
8155
8249
|
const { lazy } = treeOpts
|
|
8156
8250
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
8157
8251
|
const { prevDragRow, prevDragPos } = internalData
|
|
8252
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
8158
8253
|
|
|
8159
8254
|
if (treeConfig && lazy && prevDragToChild) {
|
|
8160
8255
|
// 懒加载
|
|
@@ -8172,18 +8267,16 @@ const Methods = {
|
|
|
8172
8267
|
}
|
|
8173
8268
|
hideDropTip($xeTable)
|
|
8174
8269
|
clearRowDropOrigin($xeTable)
|
|
8270
|
+
clearRowAnimate(el)
|
|
8175
8271
|
internalData.prevDragToChild = false
|
|
8176
8272
|
reactData.dragRow = null
|
|
8177
8273
|
reactData.dragCol = null
|
|
8178
|
-
setTimeout(() => {
|
|
8179
|
-
reactData.isDragRowMove = false
|
|
8180
|
-
}, 500)
|
|
8181
8274
|
},
|
|
8182
8275
|
handleRowDragDragoverEvent (evnt: DragEvent) {
|
|
8183
|
-
const $xeTable = this
|
|
8276
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8184
8277
|
const props = $xeTable
|
|
8185
|
-
const
|
|
8186
|
-
const
|
|
8278
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8279
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8187
8280
|
|
|
8188
8281
|
const { treeConfig } = props
|
|
8189
8282
|
const { fullAllDataRowIdData } = internalData
|
|
@@ -8228,9 +8321,9 @@ const Methods = {
|
|
|
8228
8321
|
}
|
|
8229
8322
|
},
|
|
8230
8323
|
handleCellDragMousedownEvent (evnt: MouseEvent, params: any) {
|
|
8231
|
-
const $xeTable = this
|
|
8324
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8232
8325
|
const props = $xeTable
|
|
8233
|
-
const reactData = $xeTable
|
|
8326
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8234
8327
|
|
|
8235
8328
|
evnt.stopPropagation()
|
|
8236
8329
|
const { dragConfig } = props
|
|
@@ -8241,7 +8334,6 @@ const Methods = {
|
|
|
8241
8334
|
const tdEl = trigger === 'cell' || trigger === 'row' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
8242
8335
|
const trEl = tdEl.parentElement as HTMLElement
|
|
8243
8336
|
const dStartMethod = dragStartMethod || (dragConfig ? dragConfig.dragStartMethod : null)
|
|
8244
|
-
reactData.isDragRowMove = false
|
|
8245
8337
|
clearRowDropOrigin($xeTable)
|
|
8246
8338
|
if (dStartMethod && !dStartMethod(params)) {
|
|
8247
8339
|
trEl.draggable = false
|
|
@@ -8258,7 +8350,7 @@ const Methods = {
|
|
|
8258
8350
|
$xeTable.dispatchEvent('row-dragstart', params, evnt)
|
|
8259
8351
|
},
|
|
8260
8352
|
handleCellDragMouseupEvent () {
|
|
8261
|
-
const $xeTable = this
|
|
8353
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8262
8354
|
|
|
8263
8355
|
clearDragStatus($xeTable)
|
|
8264
8356
|
},
|
|
@@ -8274,7 +8366,7 @@ const Methods = {
|
|
|
8274
8366
|
const $xeTable = this
|
|
8275
8367
|
|
|
8276
8368
|
handleUpdateColumn($xeTable)
|
|
8277
|
-
parseColumns($xeTable, false).then(() => {
|
|
8369
|
+
return parseColumns($xeTable, false).then(() => {
|
|
8278
8370
|
$xeTable.updateCellAreas()
|
|
8279
8371
|
$xeTable.saveCustomStore('update:sort')
|
|
8280
8372
|
})
|
|
@@ -8287,79 +8379,84 @@ const Methods = {
|
|
|
8287
8379
|
|
|
8288
8380
|
const { mouseConfig } = props
|
|
8289
8381
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
8290
|
-
const { isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8291
|
-
const { collectColumn } = internalData
|
|
8382
|
+
const { animation, isPeerDrag, isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod, dragToChildMethod } = columnDragOpts
|
|
8383
|
+
const { collectColumn, fullColumnIdData } = internalData
|
|
8384
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
8292
8385
|
const dragOffsetIndex = prevDragPos === 'right' ? 1 : 0
|
|
8293
8386
|
const errRest = {
|
|
8294
8387
|
status: false
|
|
8295
8388
|
}
|
|
8296
|
-
if (prevDragCol && dragCol) {
|
|
8297
|
-
// 判断是否有拖动
|
|
8298
|
-
if (prevDragCol !== dragCol) {
|
|
8299
|
-
const dragColumn = dragCol
|
|
8300
|
-
const newColumn = prevDragCol
|
|
8301
|
-
const dragParams = {
|
|
8302
|
-
oldColumn: dragColumn,
|
|
8303
|
-
newColumn,
|
|
8304
|
-
dragColumn,
|
|
8305
|
-
dragPos: prevDragPos as 'left' | 'right',
|
|
8306
|
-
dragToChild: !!prevDragToChild,
|
|
8307
|
-
offsetIndex: dragOffsetIndex as 0 | 1
|
|
8308
|
-
}
|
|
8309
|
-
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8310
|
-
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8311
|
-
if (!status) {
|
|
8312
|
-
return errRest
|
|
8313
|
-
}
|
|
8314
8389
|
|
|
8315
|
-
|
|
8316
|
-
|
|
8390
|
+
if (!(el && prevDragCol && dragCol)) {
|
|
8391
|
+
return Promise.resolve(errRest)
|
|
8392
|
+
}
|
|
8393
|
+
// 判断是否有拖动
|
|
8394
|
+
if (prevDragCol !== dragCol) {
|
|
8395
|
+
const dragColumn = dragCol
|
|
8396
|
+
const newColumn = prevDragCol
|
|
8397
|
+
const dragParams = {
|
|
8398
|
+
oldColumn: dragColumn,
|
|
8399
|
+
newColumn,
|
|
8400
|
+
dragColumn,
|
|
8401
|
+
dragPos: prevDragPos as 'left' | 'right',
|
|
8402
|
+
dragToChild: !!prevDragToChild,
|
|
8403
|
+
offsetIndex: dragOffsetIndex as 0 | 1
|
|
8404
|
+
}
|
|
8405
|
+
const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
|
|
8406
|
+
return Promise.resolve(dragEndMethod ? dragEndMethod(dragParams) : true).then((status) => {
|
|
8407
|
+
if (!status) {
|
|
8408
|
+
return errRest
|
|
8409
|
+
}
|
|
8317
8410
|
|
|
8318
|
-
|
|
8411
|
+
let dragTargetColumn: VxeTableDefines.ColumnInfo | null = null
|
|
8412
|
+
const dragAllTargetCols: VxeTableDefines.ColumnInfo[] = []
|
|
8413
|
+
let dragColWidth = 0
|
|
8414
|
+
if (animation) {
|
|
8319
8415
|
XEUtils.eachTree([dragColumn], column => {
|
|
8320
|
-
|
|
8416
|
+
if (!dragTargetColumn && (!column.children || !column.children.length)) {
|
|
8417
|
+
dragTargetColumn = column
|
|
8418
|
+
dragColWidth += column.renderWidth
|
|
8419
|
+
}
|
|
8420
|
+
dragAllTargetCols.push(column)
|
|
8321
8421
|
})
|
|
8422
|
+
}
|
|
8423
|
+
if (!dragTargetColumn) {
|
|
8424
|
+
dragTargetColumn = dragColumn
|
|
8425
|
+
}
|
|
8426
|
+
const dragColRest = fullColumnIdData[dragTargetColumn.id] || {}
|
|
8427
|
+
const _dragColIndex = dragColRest._index
|
|
8322
8428
|
|
|
8323
|
-
|
|
8429
|
+
let dragOffsetLeft = -1
|
|
8430
|
+
if (animation) {
|
|
8431
|
+
const oldTrEl = el.querySelector<HTMLElement>(`.vxe-table--column[colid="${dragTargetColumn.id}"]`)
|
|
8432
|
+
if (oldTrEl) {
|
|
8433
|
+
dragOffsetLeft = oldTrEl.offsetLeft
|
|
8434
|
+
}
|
|
8435
|
+
}
|
|
8324
8436
|
|
|
8325
|
-
|
|
8326
|
-
|
|
8437
|
+
let oafIndex = -1
|
|
8438
|
+
let nafIndex = -1
|
|
8327
8439
|
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
}
|
|
8333
|
-
} else {
|
|
8334
|
-
if (!isCrossDrag) {
|
|
8335
|
-
return errRest
|
|
8336
|
-
}
|
|
8440
|
+
const oldAllMaps: Record<string, any> = {}
|
|
8441
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
8442
|
+
oldAllMaps[column.id] = column
|
|
8443
|
+
})
|
|
8337
8444
|
|
|
8338
|
-
|
|
8339
|
-
isSelfToChildStatus = true
|
|
8340
|
-
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8341
|
-
if (VxeUI.modal) {
|
|
8342
|
-
VxeUI.modal.message({
|
|
8343
|
-
status: 'error',
|
|
8344
|
-
content: getI18n('vxe.error.treeDragChild')
|
|
8345
|
-
})
|
|
8346
|
-
}
|
|
8347
|
-
return errRest
|
|
8348
|
-
}
|
|
8349
|
-
}
|
|
8350
|
-
}
|
|
8351
|
-
} else if (dragColumn.parentId) {
|
|
8352
|
-
// 子到根
|
|
8445
|
+
let isSelfToChildStatus = false
|
|
8353
8446
|
|
|
8354
|
-
|
|
8447
|
+
if (dragColumn.parentId && newColumn.parentId) {
|
|
8448
|
+
// 子到子
|
|
8449
|
+
|
|
8450
|
+
if (isPeerDrag && !isCrossDrag) {
|
|
8451
|
+
if (dragColumn.parentId !== newColumn.parentId) {
|
|
8452
|
+
// 非同级
|
|
8355
8453
|
return errRest
|
|
8356
8454
|
}
|
|
8357
|
-
} else
|
|
8358
|
-
// 根到子
|
|
8359
|
-
|
|
8455
|
+
} else {
|
|
8360
8456
|
if (!isCrossDrag) {
|
|
8361
8457
|
return errRest
|
|
8362
8458
|
}
|
|
8459
|
+
|
|
8363
8460
|
if (oldAllMaps[newColumn.id]) {
|
|
8364
8461
|
isSelfToChildStatus = true
|
|
8365
8462
|
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
@@ -8372,120 +8469,221 @@ const Methods = {
|
|
|
8372
8469
|
return errRest
|
|
8373
8470
|
}
|
|
8374
8471
|
}
|
|
8375
|
-
} else {
|
|
8376
|
-
// 根到根
|
|
8377
8472
|
}
|
|
8473
|
+
} else if (dragColumn.parentId) {
|
|
8474
|
+
// 子到根
|
|
8378
8475
|
|
|
8379
|
-
|
|
8476
|
+
if (!isCrossDrag) {
|
|
8477
|
+
return errRest
|
|
8478
|
+
}
|
|
8479
|
+
} else if (newColumn.parentId) {
|
|
8480
|
+
// 根到子
|
|
8380
8481
|
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
} else {
|
|
8393
|
-
if (oldewMatchRest) {
|
|
8394
|
-
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest
|
|
8395
|
-
oCols.splice(oIndex, 1)
|
|
8396
|
-
if (!oParent) {
|
|
8397
|
-
oafIndex = oIndex
|
|
8482
|
+
if (!isCrossDrag) {
|
|
8483
|
+
return errRest
|
|
8484
|
+
}
|
|
8485
|
+
if (oldAllMaps[newColumn.id]) {
|
|
8486
|
+
isSelfToChildStatus = true
|
|
8487
|
+
if (!(isCrossDrag && isSelfToChildDrag)) {
|
|
8488
|
+
if (VxeUI.modal) {
|
|
8489
|
+
VxeUI.modal.message({
|
|
8490
|
+
status: 'error',
|
|
8491
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
8492
|
+
})
|
|
8398
8493
|
}
|
|
8494
|
+
return errRest
|
|
8399
8495
|
}
|
|
8400
8496
|
}
|
|
8497
|
+
} else {
|
|
8498
|
+
// 根到根
|
|
8499
|
+
}
|
|
8401
8500
|
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8501
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === dragColumn.id)
|
|
8502
|
+
|
|
8503
|
+
// 改变层级
|
|
8504
|
+
if (isSelfToChildStatus && (isCrossDrag && isSelfToChildDrag)) {
|
|
8505
|
+
if (oldewMatchRest) {
|
|
8506
|
+
const { items: oCols, index: oIndex } = oldewMatchRest
|
|
8507
|
+
const childList = dragColumn.children || []
|
|
8508
|
+
childList.forEach(column => {
|
|
8509
|
+
column.parentId = dragColumn.parentId
|
|
8510
|
+
})
|
|
8511
|
+
oCols.splice(oIndex, 1, ...childList)
|
|
8512
|
+
dragColumn.children = []
|
|
8513
|
+
}
|
|
8514
|
+
} else {
|
|
8515
|
+
if (oldewMatchRest) {
|
|
8516
|
+
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest
|
|
8517
|
+
oCols.splice(oIndex, 1)
|
|
8518
|
+
if (!oParent) {
|
|
8519
|
+
oafIndex = oIndex
|
|
8415
8520
|
}
|
|
8416
8521
|
}
|
|
8522
|
+
}
|
|
8417
8523
|
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8421
|
-
|
|
8422
|
-
|
|
8423
|
-
|
|
8524
|
+
const newMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === newColumn.id)
|
|
8525
|
+
if (newMatchRest) {
|
|
8526
|
+
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
|
|
8527
|
+
// 转子级
|
|
8528
|
+
if ((isCrossDrag && isToChildDrag) && isDragToChildFlag) {
|
|
8529
|
+
dragColumn.parentId = newColumn.id
|
|
8530
|
+
newColumn.children = (newColumn.children || []).concat([dragColumn])
|
|
8531
|
+
} else {
|
|
8532
|
+
dragColumn.parentId = newColumn.parentId
|
|
8533
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, dragColumn)
|
|
8534
|
+
}
|
|
8535
|
+
if (!nParent) {
|
|
8536
|
+
nafIndex = nIndex
|
|
8537
|
+
}
|
|
8538
|
+
}
|
|
8424
8539
|
|
|
8425
|
-
|
|
8426
|
-
if (
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
}
|
|
8430
|
-
if ($xeTable.clearCellAreas) {
|
|
8431
|
-
$xeTable.clearCellAreas()
|
|
8432
|
-
$xeTable.clearCopyCellArea()
|
|
8433
|
-
}
|
|
8540
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
8541
|
+
if (!parentColumn) {
|
|
8542
|
+
const sortIndex = index + 1
|
|
8543
|
+
column.renderSortNumber = sortIndex
|
|
8434
8544
|
}
|
|
8545
|
+
})
|
|
8435
8546
|
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
offsetIndex: dragOffsetIndex,
|
|
8444
|
-
_index: {
|
|
8445
|
-
newIndex: nafIndex,
|
|
8446
|
-
oldIndex: oafIndex
|
|
8447
|
-
}
|
|
8448
|
-
}, evnt)
|
|
8547
|
+
if (mouseConfig) {
|
|
8548
|
+
if ($xeTable.clearSelected) {
|
|
8549
|
+
$xeTable.clearSelected()
|
|
8550
|
+
}
|
|
8551
|
+
if ($xeTable.clearCellAreas) {
|
|
8552
|
+
$xeTable.clearCellAreas()
|
|
8553
|
+
$xeTable.clearCopyCellArea()
|
|
8449
8554
|
}
|
|
8555
|
+
}
|
|
8556
|
+
|
|
8557
|
+
if (evnt) {
|
|
8558
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
8559
|
+
oldColumn: dragColumn,
|
|
8560
|
+
newColumn,
|
|
8561
|
+
dragColumn,
|
|
8562
|
+
dragPos: prevDragPos,
|
|
8563
|
+
dragToChild: isDragToChildFlag,
|
|
8564
|
+
offsetIndex: dragOffsetIndex,
|
|
8565
|
+
_index: {
|
|
8566
|
+
newIndex: nafIndex,
|
|
8567
|
+
oldIndex: oafIndex
|
|
8568
|
+
}
|
|
8569
|
+
}, evnt)
|
|
8570
|
+
}
|
|
8450
8571
|
|
|
8572
|
+
return $xeTable.$nextTick().then(() => {
|
|
8451
8573
|
if (isSyncColumn) {
|
|
8452
|
-
$xeTable.handleColDragSwapColumn()
|
|
8574
|
+
return $xeTable.handleColDragSwapColumn()
|
|
8575
|
+
}
|
|
8576
|
+
}).then(() => {
|
|
8577
|
+
if (animation) {
|
|
8578
|
+
const { tableColumn } = reactData
|
|
8579
|
+
const { visibleColumn, fullColumnIdData } = internalData
|
|
8580
|
+
let dragNewColumn: VxeTableDefines.ColumnInfo | null = null
|
|
8581
|
+
const dragNewColMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
8582
|
+
XEUtils.eachTree([dragColumn], column => {
|
|
8583
|
+
if (!dragNewColumn && (!column.children || !column.children.length)) {
|
|
8584
|
+
dragNewColumn = column
|
|
8585
|
+
}
|
|
8586
|
+
dragNewColMaps[column.id] = column
|
|
8587
|
+
})
|
|
8588
|
+
if (!dragNewColumn) {
|
|
8589
|
+
dragNewColumn = dragColumn
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
if (dragColWidth && dragAllTargetCols.length) {
|
|
8593
|
+
const _newColIndex = XEUtils.findIndexOf(visibleColumn, column => !!dragNewColumn && column.id === dragNewColumn.id)
|
|
8594
|
+
const firstCol = tableColumn[0]
|
|
8595
|
+
const firstColRest = fullColumnIdData[firstCol.id]
|
|
8596
|
+
|
|
8597
|
+
if (firstColRest) {
|
|
8598
|
+
const _firstColIndex = firstColRest._index
|
|
8599
|
+
const _lastColIndex = _firstColIndex + tableColumn.length
|
|
8600
|
+
let csIndex = -1
|
|
8601
|
+
let ceIndex = -1
|
|
8602
|
+
let offsetRate = 1
|
|
8603
|
+
if (_dragColIndex < _firstColIndex) {
|
|
8604
|
+
// 从左往右虚拟拖拽
|
|
8605
|
+
csIndex = 0
|
|
8606
|
+
ceIndex = _newColIndex - _firstColIndex
|
|
8607
|
+
} else if (_dragColIndex > _lastColIndex) {
|
|
8608
|
+
// 从右往左虚拟拖拽
|
|
8609
|
+
const $newRowIndex = dragColRest.$index
|
|
8610
|
+
csIndex = $newRowIndex + 1
|
|
8611
|
+
ceIndex = tableColumn.length
|
|
8612
|
+
offsetRate = -1
|
|
8613
|
+
} else {
|
|
8614
|
+
if (_newColIndex > _dragColIndex) {
|
|
8615
|
+
// 从左往右拖拽
|
|
8616
|
+
csIndex = _dragColIndex - _firstColIndex
|
|
8617
|
+
ceIndex = csIndex + _newColIndex - _dragColIndex
|
|
8618
|
+
} else {
|
|
8619
|
+
// 从右往左拖拽
|
|
8620
|
+
csIndex = _newColIndex - _firstColIndex + 1
|
|
8621
|
+
ceIndex = csIndex + _dragColIndex - _newColIndex
|
|
8622
|
+
offsetRate = -1
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8625
|
+
|
|
8626
|
+
const dragRangeList: VxeTableDefines.ColumnInfo[] = []
|
|
8627
|
+
const dragRangeMaps: Record<string, VxeTableDefines.ColumnInfo> = {}
|
|
8628
|
+
for (let i = csIndex; i < ceIndex; i++) {
|
|
8629
|
+
const column = tableColumn[i]
|
|
8630
|
+
if (!dragRangeMaps[column.id] && !dragNewColMaps[column.id]) {
|
|
8631
|
+
dragRangeMaps[column.id] = column
|
|
8632
|
+
dragRangeList.push(column)
|
|
8633
|
+
}
|
|
8634
|
+
}
|
|
8635
|
+
XEUtils.eachTree([newColumn], column => {
|
|
8636
|
+
if (!dragRangeMaps[column.id]) {
|
|
8637
|
+
dragRangeMaps[column.id] = column
|
|
8638
|
+
dragRangeList.push(column)
|
|
8639
|
+
}
|
|
8640
|
+
})
|
|
8641
|
+
if (dragRangeList.length) {
|
|
8642
|
+
const dtTrList = el.querySelectorAll<HTMLElement>(dragRangeList.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','))
|
|
8643
|
+
moveColAnimateToLr(dtTrList, offsetRate * dragColWidth)
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
|
|
8647
|
+
const newTrList = el.querySelectorAll<HTMLElement>(dragAllTargetCols.map(column => `.vxe-table--column[colid="${column.id}"]`).join(','))
|
|
8648
|
+
const newTdEl = newTrList[0]
|
|
8649
|
+
if (dragOffsetLeft > -1 && newTdEl) {
|
|
8650
|
+
moveColAnimateToLr(newTrList, dragOffsetLeft - newTdEl.offsetLeft)
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8453
8653
|
}
|
|
8454
8654
|
|
|
8655
|
+
loadScrollXData($xeTable)
|
|
8656
|
+
|
|
8455
8657
|
return {
|
|
8456
8658
|
status: true
|
|
8457
8659
|
}
|
|
8458
|
-
}).catch(() => {
|
|
8459
|
-
return errRest
|
|
8460
8660
|
})
|
|
8461
|
-
}
|
|
8661
|
+
}).catch(() => {
|
|
8662
|
+
return errRest
|
|
8663
|
+
})
|
|
8462
8664
|
}
|
|
8463
8665
|
return Promise.resolve(errRest)
|
|
8464
8666
|
},
|
|
8465
8667
|
handleHeaderCellDragDragendEvent (evnt: DragEvent) {
|
|
8466
|
-
const $xeTable = this
|
|
8467
|
-
const reactData = $xeTable
|
|
8468
|
-
const internalData = $xeTable
|
|
8668
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8669
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8670
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8469
8671
|
|
|
8470
8672
|
const { dragCol } = reactData
|
|
8471
8673
|
const { prevDragCol, prevDragPos, prevDragToChild } = internalData
|
|
8674
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
8472
8675
|
$xeTable.handleColDragSwapEvent(evnt, true, dragCol, prevDragCol, prevDragPos, prevDragToChild)
|
|
8473
8676
|
hideDropTip($xeTable)
|
|
8474
8677
|
clearColDropOrigin($xeTable)
|
|
8678
|
+
clearColAnimate(el)
|
|
8475
8679
|
internalData.prevDragToChild = false
|
|
8476
8680
|
reactData.dragRow = null
|
|
8477
8681
|
reactData.dragCol = null
|
|
8478
|
-
setTimeout(() => {
|
|
8479
|
-
reactData.isDragColMove = false
|
|
8480
|
-
$xeTable.recalculate().then(() => {
|
|
8481
|
-
loadScrollXData($xeTable)
|
|
8482
|
-
})
|
|
8483
|
-
}, 500)
|
|
8484
8682
|
},
|
|
8485
8683
|
handleHeaderCellDragDragoverEvent (evnt: DragEvent) {
|
|
8486
|
-
const $xeTable = this
|
|
8487
|
-
const reactData = $xeTable
|
|
8488
|
-
const internalData = $xeTable
|
|
8684
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8685
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8686
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8489
8687
|
|
|
8490
8688
|
const { dragCol } = reactData
|
|
8491
8689
|
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
@@ -8527,7 +8725,7 @@ const Methods = {
|
|
|
8527
8725
|
}
|
|
8528
8726
|
const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
|
|
8529
8727
|
const refTableBody = $xeTable.$refs.refTableBody
|
|
8530
|
-
const tableBodyElem = refTableBody ? refTableBody.$el as HTMLDivElement : null
|
|
8728
|
+
const tableBodyElem = refTableBody ? (refTableBody as any).$el as HTMLDivElement : null
|
|
8531
8729
|
const scrollTargetEl = xHandleEl || tableBodyElem
|
|
8532
8730
|
if (scrollTargetEl) {
|
|
8533
8731
|
const wrapperRect = el.getBoundingClientRect()
|
|
@@ -8561,7 +8759,6 @@ const Methods = {
|
|
|
8561
8759
|
const { column } = params
|
|
8562
8760
|
const dragEl = evnt.currentTarget as HTMLElement
|
|
8563
8761
|
const thEl = trigger === 'cell' ? dragEl : dragEl.parentElement?.parentElement as HTMLElement
|
|
8564
|
-
reactData.isDragColMove = false
|
|
8565
8762
|
clearColDropOrigin($xeTable)
|
|
8566
8763
|
if (dragStartMethod && !dragStartMethod(params)) {
|
|
8567
8764
|
thEl.draggable = false
|
|
@@ -8585,7 +8782,6 @@ const Methods = {
|
|
|
8585
8782
|
hideDropTip($xeTable)
|
|
8586
8783
|
reactData.dragRow = null
|
|
8587
8784
|
reactData.dragCol = null
|
|
8588
|
-
reactData.isDragColMove = false
|
|
8589
8785
|
},
|
|
8590
8786
|
setPendingRow (rows: any, status: any) {
|
|
8591
8787
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -9087,7 +9283,7 @@ const Methods = {
|
|
|
9087
9283
|
reactData.rowExpandedFlag++
|
|
9088
9284
|
return Promise.all(lazyRests)
|
|
9089
9285
|
.then(() => $xeTable.$nextTick())
|
|
9090
|
-
.then(() => $xeTable
|
|
9286
|
+
.then(() => handleLazyRecalculate($xeTable, true, true, true))
|
|
9091
9287
|
.then(() => {
|
|
9092
9288
|
updateRowOffsetTop($xeTable)
|
|
9093
9289
|
updateRowExpandStyle($xeTable)
|
|
@@ -9133,7 +9329,7 @@ const Methods = {
|
|
|
9133
9329
|
}
|
|
9134
9330
|
return $xeTable.$nextTick().then(() => {
|
|
9135
9331
|
if (expList.length) {
|
|
9136
|
-
return $xeTable
|
|
9332
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
9137
9333
|
}
|
|
9138
9334
|
}).then(() => {
|
|
9139
9335
|
updateRowOffsetTop($xeTable)
|
|
@@ -9278,7 +9474,7 @@ const Methods = {
|
|
|
9278
9474
|
$xeTable.handleTableData()
|
|
9279
9475
|
updateAfterDataIndex($xeTable)
|
|
9280
9476
|
reactData.rowGroupExpandedFlag++
|
|
9281
|
-
return $xeTable
|
|
9477
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
9282
9478
|
},
|
|
9283
9479
|
clearRowGroupExpand () {
|
|
9284
9480
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -9290,7 +9486,7 @@ const Methods = {
|
|
|
9290
9486
|
$xeTable.handleTableData()
|
|
9291
9487
|
updateAfterDataIndex($xeTable)
|
|
9292
9488
|
reactData.rowGroupExpandedFlag++
|
|
9293
|
-
return $xeTable
|
|
9489
|
+
return handleLazyRecalculate($xeTable, true, true, true)
|
|
9294
9490
|
},
|
|
9295
9491
|
getTreeExpandRecords () {
|
|
9296
9492
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -9649,8 +9845,6 @@ const Methods = {
|
|
|
9649
9845
|
}
|
|
9650
9846
|
internalData.lastScrollTop = scrollTop
|
|
9651
9847
|
}
|
|
9652
|
-
reactData.isDragColMove = false
|
|
9653
|
-
reactData.isDragRowMove = false
|
|
9654
9848
|
reactData.lastScrollTime = Date.now()
|
|
9655
9849
|
const evntParams = {
|
|
9656
9850
|
scrollTop,
|