vxe-table 3.21.6 → 3.21.8
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/style.css +1 -1
- package/es/table/src/body.js +13 -13
- package/es/table/src/group.js +3 -0
- package/es/table/src/methods.js +191 -66
- package/es/table/src/util.js +18 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +73 -34
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +13 -13
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/group.js +3 -0
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/methods.js +37 -18
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +19 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -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/package.json +2 -2
- package/packages/table/src/body.ts +15 -15
- package/packages/table/src/group.ts +4 -0
- package/packages/table/src/methods.ts +199 -68
- package/packages/table/src/util.ts +21 -1
- /package/es/{iconfont.1780293000244.ttf → iconfont.1780726754772.ttf} +0 -0
- /package/es/{iconfont.1780293000244.woff → iconfont.1780726754772.woff} +0 -0
- /package/es/{iconfont.1780293000244.woff2 → iconfont.1780726754772.woff2} +0 -0
- /package/lib/{iconfont.1780293000244.ttf → iconfont.1780726754772.ttf} +0 -0
- /package/lib/{iconfont.1780293000244.woff → iconfont.1780726754772.woff} +0 -0
- /package/lib/{iconfont.1780293000244.woff2 → iconfont.1780726754772.woff2} +0 -0
|
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLe
|
|
|
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, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util'
|
|
6
|
+
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn, getRowMaxHeight } from './util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime'
|
|
9
9
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
@@ -432,13 +432,22 @@ function updateScrollXStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
432
432
|
return scrollXLoad
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
+
function syncGanttScrollYStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
436
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
437
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
438
|
+
|
|
439
|
+
const $xeGanttView = internalData.xeGanttView
|
|
440
|
+
if ($xeGanttView && $xeGanttView.handleUpdateSYStatus) {
|
|
441
|
+
$xeGanttView.handleUpdateSYStatus(reactData.scrollYLoad)
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
435
445
|
function updateScrollYStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, fullData?: any[]) {
|
|
436
446
|
const props = $xeTable
|
|
437
447
|
const reactData = $xeTable as unknown as TableReactData
|
|
438
448
|
const internalData = $xeTable as unknown as TableInternalData
|
|
439
449
|
|
|
440
450
|
const { treeConfig } = props
|
|
441
|
-
const $xeGanttView = internalData.xeGanttView
|
|
442
451
|
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
443
452
|
const treeOpts = $xeTable.computeTreeOpts
|
|
444
453
|
const { transform } = treeOpts
|
|
@@ -446,9 +455,7 @@ function updateScrollYStatus ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
446
455
|
// 如果gt为0,则总是启用
|
|
447
456
|
const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length)
|
|
448
457
|
reactData.scrollYLoad = scrollYLoad
|
|
449
|
-
|
|
450
|
-
$xeGanttView.handleUpdateSYStatus(scrollYLoad)
|
|
451
|
-
}
|
|
458
|
+
syncGanttScrollYStatus($xeTable)
|
|
452
459
|
return scrollYLoad
|
|
453
460
|
}
|
|
454
461
|
|
|
@@ -1004,6 +1011,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1004
1011
|
const props = $xeTable
|
|
1005
1012
|
const reactData = $xeTable as unknown as TableReactData
|
|
1006
1013
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1014
|
+
const $xeGantt = $xeTable.$xeGantt
|
|
1007
1015
|
|
|
1008
1016
|
const { mouseConfig } = props
|
|
1009
1017
|
const { isGroup, tableColumn, overflowX, scrollbarWidth, overflowY, scrollbarHeight, scrollXWidth, columnStore, editStore, isColLoading } = reactData
|
|
@@ -1044,7 +1052,7 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1044
1052
|
}
|
|
1045
1053
|
|
|
1046
1054
|
let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
|
|
1047
|
-
if ((scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false) || ($xeGanttView && !scrollbarYToLeft)) {
|
|
1055
|
+
if ((scrollbarYConf.visible === 'hidden' || scrollbarYConf.visible === false) || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
|
|
1048
1056
|
osbWidth = 0
|
|
1049
1057
|
yScrollbarVisible = 'hidden'
|
|
1050
1058
|
} else if (scrollbarYConf.visible === 'visible') {
|
|
@@ -2554,36 +2562,40 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2554
2562
|
/**
|
|
2555
2563
|
* 计算自适应行高
|
|
2556
2564
|
*/
|
|
2557
|
-
const calcCellAutoHeight = ($xeTable: VxeTableConstructor, rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
2558
|
-
const
|
|
2565
|
+
const calcCellAutoHeight = ($xeTable: VxeTableConstructor, rowid: string | number, rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
2566
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2559
2567
|
|
|
2560
|
-
const {
|
|
2568
|
+
const { fullCellHeightMaps } = internalData
|
|
2569
|
+
let chRest = fullCellHeightMaps[rowid]
|
|
2570
|
+
if (!chRest) {
|
|
2571
|
+
chRest = {}
|
|
2572
|
+
fullCellHeightMaps[rowid] = chRest
|
|
2573
|
+
}
|
|
2561
2574
|
const wrapperElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
|
|
2562
|
-
let colHeight = 0
|
|
2563
2575
|
let firstCellStyle: CSSStyleDeclaration | null = null
|
|
2564
2576
|
let topBottomPadding = 0
|
|
2577
|
+
let changeCH = false
|
|
2565
2578
|
for (let i = 0; i < wrapperElemList.length; i++) {
|
|
2566
2579
|
const wrapperElem = wrapperElemList[i] as HTMLElement
|
|
2567
2580
|
const cellElem = wrapperElem.parentElement as HTMLTableCellElement
|
|
2568
2581
|
const cellStyle = cellElem.style
|
|
2569
2582
|
const orHeight = cellStyle.height
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
}
|
|
2583
|
+
const colid = wrapperElem.getAttribute('colid') || ''
|
|
2584
|
+
cellStyle.height = ''
|
|
2573
2585
|
if (!firstCellStyle) {
|
|
2574
2586
|
firstCellStyle = getComputedStyle(cellElem)
|
|
2575
2587
|
topBottomPadding = firstCellStyle ? Math.ceil(XEUtils.toNumber(firstCellStyle.paddingTop) + XEUtils.toNumber(firstCellStyle.paddingBottom)) : 0
|
|
2576
2588
|
}
|
|
2577
|
-
if (!scrollXLoad) {
|
|
2578
|
-
cellStyle.height = orHeight
|
|
2579
|
-
}
|
|
2580
2589
|
const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0
|
|
2581
|
-
colHeight = Math.
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2590
|
+
const colHeight = Math.ceil(cellHeight + topBottomPadding)
|
|
2591
|
+
if (chRest[colid] !== colHeight) {
|
|
2592
|
+
changeCH = true
|
|
2593
|
+
chRest[colid] = colHeight
|
|
2594
|
+
}
|
|
2595
|
+
cellStyle.height = orHeight
|
|
2585
2596
|
}
|
|
2586
|
-
|
|
2597
|
+
const cellMaxHeight = getRowMaxHeight(chRest, changeCH)
|
|
2598
|
+
return cellMaxHeight
|
|
2587
2599
|
}
|
|
2588
2600
|
|
|
2589
2601
|
/**
|
|
@@ -2610,7 +2622,7 @@ const calcCellHeight = ($xeTable: VxeTableConstructor) => {
|
|
|
2610
2622
|
const rowid = handleGetRowId(row)
|
|
2611
2623
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
2612
2624
|
if (rowRest) {
|
|
2613
|
-
const height = calcCellAutoHeight($xeTable, rowRest, el)
|
|
2625
|
+
const height = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
2614
2626
|
rowRest.height = Math.max(defaultRowHeight, height)
|
|
2615
2627
|
}
|
|
2616
2628
|
el.removeAttribute('data-calc-row')
|
|
@@ -3132,7 +3144,6 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3132
3144
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3133
3145
|
|
|
3134
3146
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
3135
|
-
internalData.rceRunTime = Date.now()
|
|
3136
3147
|
if (!el || !el.clientWidth) {
|
|
3137
3148
|
return $xeTable.$nextTick()
|
|
3138
3149
|
}
|
|
@@ -3156,6 +3167,7 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3156
3167
|
if (reFull) {
|
|
3157
3168
|
updateTreeLineStyle($xeTable)
|
|
3158
3169
|
}
|
|
3170
|
+
internalData.rceRunTime = Date.now()
|
|
3159
3171
|
return computeScrollLoad($xeTable).then(() => {
|
|
3160
3172
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
3161
3173
|
if (reWidth) {
|
|
@@ -3176,12 +3188,15 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3176
3188
|
if (reFull) {
|
|
3177
3189
|
updateTreeLineStyle($xeTable)
|
|
3178
3190
|
}
|
|
3191
|
+
internalData.rceRunTime = Date.now()
|
|
3179
3192
|
if (reFull) {
|
|
3180
3193
|
return computeScrollLoad($xeTable)
|
|
3181
3194
|
}
|
|
3182
3195
|
})
|
|
3183
3196
|
}
|
|
3184
3197
|
|
|
3198
|
+
const minRunDelay = 50
|
|
3199
|
+
|
|
3185
3200
|
function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean) {
|
|
3186
3201
|
const reactData = $xeTable as unknown as TableReactData
|
|
3187
3202
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -3191,7 +3206,16 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3191
3206
|
const { rceTimeout, rceRunTime } = internalData
|
|
3192
3207
|
const $xeGanttView = internalData.xeGanttView
|
|
3193
3208
|
const resizeOpts = $xeTable.computeResizeOpts
|
|
3194
|
-
|
|
3209
|
+
let rceDelay = internalData.rceDelay
|
|
3210
|
+
// 如果在500毫秒内频繁执行,则执行次数减缓
|
|
3211
|
+
if (rceRunTime && rceRunTime > Date.now() - 500) {
|
|
3212
|
+
rceDelay += 50
|
|
3213
|
+
} else {
|
|
3214
|
+
rceDelay = 0
|
|
3215
|
+
}
|
|
3216
|
+
internalData.rceDelay = rceDelay
|
|
3217
|
+
const refreshDelay = resizeOpts.refreshDelay || 30
|
|
3218
|
+
const reDelay = rceDelay + refreshDelay
|
|
3195
3219
|
const el = $xeTable.$refs.refElem as HTMLElement
|
|
3196
3220
|
if (el && el.clientWidth) {
|
|
3197
3221
|
autoCellWidth($xeTable)
|
|
@@ -3202,7 +3226,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3202
3226
|
}
|
|
3203
3227
|
if (rceTimeout) {
|
|
3204
3228
|
clearTimeout(rceTimeout)
|
|
3205
|
-
if (rceRunTime && rceRunTime +
|
|
3229
|
+
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3206
3230
|
resolve(
|
|
3207
3231
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
|
|
3208
3232
|
)
|
|
@@ -3222,7 +3246,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3222
3246
|
internalData.rceTimeout = setTimeout(() => {
|
|
3223
3247
|
internalData.rceTimeout = undefined
|
|
3224
3248
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
|
|
3225
|
-
},
|
|
3249
|
+
}, reDelay)
|
|
3226
3250
|
})
|
|
3227
3251
|
}
|
|
3228
3252
|
|
|
@@ -3571,6 +3595,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3571
3595
|
reactData.insertRowFlag++
|
|
3572
3596
|
internalData.removeRowMaps = {}
|
|
3573
3597
|
reactData.removeRowFlag++
|
|
3598
|
+
internalData.fullCellHeightMaps = {}
|
|
3574
3599
|
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
3575
3600
|
// 全量数据
|
|
3576
3601
|
internalData.tableFullData = fullData
|
|
@@ -3602,6 +3627,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3602
3627
|
updateStyle($xeTable)
|
|
3603
3628
|
}).then(() => {
|
|
3604
3629
|
computeScrollLoad($xeTable)
|
|
3630
|
+
syncGanttScrollYStatus($xeTable)
|
|
3605
3631
|
}).then(() => {
|
|
3606
3632
|
const virtualYOpts = $xeTable.computeVirtualYOpts
|
|
3607
3633
|
// 是否启用了虚拟滚动
|
|
@@ -3664,6 +3690,7 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3664
3690
|
reactData.isRowLoading = false
|
|
3665
3691
|
handleRecalculateStyle($xeTable, false, false, false)
|
|
3666
3692
|
updateTreeLineStyle($xeTable)
|
|
3693
|
+
syncGanttScrollYStatus($xeTable)
|
|
3667
3694
|
// 如果是自动行高,特殊情况需调用 recalculate 手动刷新
|
|
3668
3695
|
if (!props.showOverflow) {
|
|
3669
3696
|
setTimeout(() => {
|
|
@@ -3949,13 +3976,53 @@ function initColumnHierarchy ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
3949
3976
|
internalData.fullColumnFieldData = fullColFieldData
|
|
3950
3977
|
}
|
|
3951
3978
|
|
|
3952
|
-
function
|
|
3979
|
+
function buildColumnInfo ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
3953
3980
|
const props = $xeTable
|
|
3954
3981
|
const $xeToolbar = $xeTable.$refs.$xeToolbar as VxeToolbarConstructor
|
|
3955
3982
|
const reactData = $xeTable as unknown as TableReactData
|
|
3956
3983
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3957
3984
|
|
|
3985
|
+
const { scrollXLoad, scrollYLoad, expandColumn } = reactData
|
|
3958
3986
|
const expandOpts = $xeTable.computeExpandOpts
|
|
3987
|
+
cacheColumnMap($xeTable)
|
|
3988
|
+
parseColumns($xeTable, true).then(() => {
|
|
3989
|
+
if (reactData.scrollXLoad) {
|
|
3990
|
+
loadScrollXData($xeTable)
|
|
3991
|
+
}
|
|
3992
|
+
})
|
|
3993
|
+
$xeTable.clearHeaderFormatterCache()
|
|
3994
|
+
$xeTable.clearMergeCells()
|
|
3995
|
+
$xeTable.clearMergeFooterItems()
|
|
3996
|
+
$xeTable.handleTableData(true)
|
|
3997
|
+
$xeTable.handleAggregateSummaryData()
|
|
3998
|
+
|
|
3999
|
+
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
4000
|
+
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
4001
|
+
}
|
|
4002
|
+
|
|
4003
|
+
return $xeTable.$nextTick().then(() => {
|
|
4004
|
+
if ($xeToolbar) {
|
|
4005
|
+
$xeToolbar.syncUpdate({
|
|
4006
|
+
collectColumn: internalData.collectColumn,
|
|
4007
|
+
$table: $xeTable
|
|
4008
|
+
})
|
|
4009
|
+
}
|
|
4010
|
+
if ($xeTable.handleUpdateCustomColumn) {
|
|
4011
|
+
$xeTable.handleUpdateCustomColumn()
|
|
4012
|
+
}
|
|
4013
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
4014
|
+
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
4015
|
+
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false'])
|
|
4016
|
+
}
|
|
4017
|
+
reactData.isColLoading = false
|
|
4018
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4019
|
+
})
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, collectColumn: VxeTableDefines.ColumnInfo[]) {
|
|
4023
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4024
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4025
|
+
|
|
3959
4026
|
internalData.collectColumn = collectColumn
|
|
3960
4027
|
const tFullColumn = getColumnList(collectColumn)
|
|
3961
4028
|
internalData.tableFullColumn = tFullColumn
|
|
@@ -3965,40 +4032,7 @@ function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
3965
4032
|
return Promise.resolve(
|
|
3966
4033
|
restoreCustomStorage($xeTable)
|
|
3967
4034
|
).then(() => {
|
|
3968
|
-
|
|
3969
|
-
cacheColumnMap($xeTable)
|
|
3970
|
-
parseColumns($xeTable, true).then(() => {
|
|
3971
|
-
if (reactData.scrollXLoad) {
|
|
3972
|
-
loadScrollXData($xeTable)
|
|
3973
|
-
}
|
|
3974
|
-
})
|
|
3975
|
-
$xeTable.clearHeaderFormatterCache()
|
|
3976
|
-
$xeTable.clearMergeCells()
|
|
3977
|
-
$xeTable.clearMergeFooterItems()
|
|
3978
|
-
$xeTable.handleTableData(true)
|
|
3979
|
-
$xeTable.handleAggregateSummaryData()
|
|
3980
|
-
|
|
3981
|
-
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3982
|
-
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
3983
|
-
}
|
|
3984
|
-
|
|
3985
|
-
return $xeTable.$nextTick().then(() => {
|
|
3986
|
-
if ($xeToolbar) {
|
|
3987
|
-
$xeToolbar.syncUpdate({
|
|
3988
|
-
collectColumn: internalData.collectColumn,
|
|
3989
|
-
$table: $xeTable
|
|
3990
|
-
})
|
|
3991
|
-
}
|
|
3992
|
-
if ($xeTable.handleUpdateCustomColumn) {
|
|
3993
|
-
$xeTable.handleUpdateCustomColumn()
|
|
3994
|
-
}
|
|
3995
|
-
const columnOpts = $xeTable.computeColumnOpts
|
|
3996
|
-
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
3997
|
-
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false'])
|
|
3998
|
-
}
|
|
3999
|
-
reactData.isColLoading = false
|
|
4000
|
-
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4001
|
-
})
|
|
4035
|
+
return buildColumnInfo($xeTable)
|
|
4002
4036
|
})
|
|
4003
4037
|
}
|
|
4004
4038
|
|
|
@@ -6445,6 +6479,9 @@ const tableMethods: any = {
|
|
|
6445
6479
|
warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom'])
|
|
6446
6480
|
return this.resetCustom(options)
|
|
6447
6481
|
},
|
|
6482
|
+
/**
|
|
6483
|
+
* @private
|
|
6484
|
+
*/
|
|
6448
6485
|
handleCustom () {
|
|
6449
6486
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6450
6487
|
const props = $xeTable
|
|
@@ -6500,6 +6537,70 @@ const tableMethods: any = {
|
|
|
6500
6537
|
}
|
|
6501
6538
|
}
|
|
6502
6539
|
},
|
|
6540
|
+
/**
|
|
6541
|
+
* 用于 custom-config,用于手动恢复自定义列设置信息,恢复表格重置为初始状态
|
|
6542
|
+
* @param storeData
|
|
6543
|
+
* @returns
|
|
6544
|
+
*/
|
|
6545
|
+
setCustomStoreData (storeData: VxeTableDefines.CustomStoreData | null) {
|
|
6546
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6547
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
6548
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
6549
|
+
|
|
6550
|
+
if (!storeData) {
|
|
6551
|
+
return $xeTable.$nextTick()
|
|
6552
|
+
}
|
|
6553
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
6554
|
+
const { checkMethod } = customOpts
|
|
6555
|
+
// 重置状态
|
|
6556
|
+
clearTableAllStatus($xeTable)
|
|
6557
|
+
// 恢复列
|
|
6558
|
+
const allCols: VxeTableDefines.ColumnInfo[] = []
|
|
6559
|
+
XEUtils.eachTree(internalData.collectColumn, (column) => {
|
|
6560
|
+
column.resizeWidth = 0
|
|
6561
|
+
column.fixed = column.defaultFixed
|
|
6562
|
+
column.renderSortNumber = column.sortNumber
|
|
6563
|
+
column.parentId = column.defaultParentId
|
|
6564
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
|
|
6565
|
+
column.visible = column.defaultVisible
|
|
6566
|
+
}
|
|
6567
|
+
column.aggFunc = column.defaultAggFunc
|
|
6568
|
+
column.renderAggFn = column.defaultAggFunc
|
|
6569
|
+
column.renderResizeWidth = column.renderWidth
|
|
6570
|
+
allCols.push(column)
|
|
6571
|
+
})
|
|
6572
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' })
|
|
6573
|
+
internalData.collectColumn = newCollectCols
|
|
6574
|
+
internalData.tableFullColumn = getColumnList(newCollectCols)
|
|
6575
|
+
|
|
6576
|
+
reactData.updateColFlag++
|
|
6577
|
+
reactData.isColLoading = true
|
|
6578
|
+
initColumnHierarchy($xeTable)
|
|
6579
|
+
return Promise.resolve(
|
|
6580
|
+
handleCustomRestore($xeTable, storeData)
|
|
6581
|
+
).then(() => {
|
|
6582
|
+
return buildColumnInfo($xeTable)
|
|
6583
|
+
}).then(() => {
|
|
6584
|
+
// 恢复数据聚合分组
|
|
6585
|
+
const { isRowGroupStatus, rowGroupList } = reactData
|
|
6586
|
+
if (isRowGroupStatus && !!$xeTable.handlePivotTableAggData) {
|
|
6587
|
+
const rowGroupFields = $xeTable.computeRowGroupFields
|
|
6588
|
+
if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
|
|
6589
|
+
if (rowGroupFields && rowGroupFields.length) {
|
|
6590
|
+
$xeTable.setRowGroups(rowGroupFields)
|
|
6591
|
+
} else {
|
|
6592
|
+
$xeTable.clearRowGroups()
|
|
6593
|
+
}
|
|
6594
|
+
} else {
|
|
6595
|
+
$xeTable.handleUpdateAggData()
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6598
|
+
})
|
|
6599
|
+
},
|
|
6600
|
+
/**
|
|
6601
|
+
* 用于 custom-config,用于获取自定义列设置信息,用于自定义保持
|
|
6602
|
+
* @returns
|
|
6603
|
+
*/
|
|
6503
6604
|
getCustomStoreData () {
|
|
6504
6605
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6505
6606
|
const props = $xeTable
|
|
@@ -6622,6 +6723,9 @@ const tableMethods: any = {
|
|
|
6622
6723
|
}
|
|
6623
6724
|
return storeData
|
|
6624
6725
|
},
|
|
6726
|
+
/**
|
|
6727
|
+
* @private
|
|
6728
|
+
*/
|
|
6625
6729
|
saveCustomStore (type: any) {
|
|
6626
6730
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6627
6731
|
const props = $xeTable
|
|
@@ -6971,6 +7075,9 @@ const tableMethods: any = {
|
|
|
6971
7075
|
}
|
|
6972
7076
|
}
|
|
6973
7077
|
},
|
|
7078
|
+
/**
|
|
7079
|
+
* @private
|
|
7080
|
+
*/
|
|
6974
7081
|
handleRowResizeMousedownEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
6975
7082
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6976
7083
|
const props = $xeTable
|
|
@@ -7093,6 +7200,9 @@ const tableMethods: any = {
|
|
|
7093
7200
|
}
|
|
7094
7201
|
updateEvent(evnt)
|
|
7095
7202
|
},
|
|
7203
|
+
/**
|
|
7204
|
+
* @private
|
|
7205
|
+
*/
|
|
7096
7206
|
handleRowResizeDblclickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
7097
7207
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7098
7208
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -7115,7 +7225,7 @@ const tableMethods: any = {
|
|
|
7115
7225
|
}
|
|
7116
7226
|
const handleRsHeight = () => {
|
|
7117
7227
|
el.setAttribute('data-calc-row', 'Y')
|
|
7118
|
-
const resizeHeight = calcCellAutoHeight($xeTable, rowRest, el)
|
|
7228
|
+
const resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
7119
7229
|
el.removeAttribute('data-calc-row')
|
|
7120
7230
|
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7121
7231
|
reactData.isDragResize = false
|
|
@@ -7202,7 +7312,7 @@ const tableMethods: any = {
|
|
|
7202
7312
|
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : handleGetRowId(row)
|
|
7203
7313
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
7204
7314
|
if (rowRest) {
|
|
7205
|
-
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowRest, el)
|
|
7315
|
+
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
7206
7316
|
}
|
|
7207
7317
|
el.removeAttribute('data-calc-row')
|
|
7208
7318
|
})
|
|
@@ -8006,8 +8116,15 @@ const tableMethods: any = {
|
|
|
8006
8116
|
},
|
|
8007
8117
|
handleGlobalPasteEvent (evnt: any) {
|
|
8008
8118
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8119
|
+
const props = $xeTable
|
|
8120
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8121
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8009
8122
|
|
|
8010
|
-
const {
|
|
8123
|
+
const { keyboardConfig, mouseConfig } = props
|
|
8124
|
+
const { editStore, filterStore } = reactData
|
|
8125
|
+
const { isActivated } = internalData
|
|
8126
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
8127
|
+
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
8011
8128
|
const { actived } = editStore
|
|
8012
8129
|
if (isActivated && !filterStore.visible) {
|
|
8013
8130
|
if (!(actived.row || actived.column)) {
|
|
@@ -8020,8 +8137,15 @@ const tableMethods: any = {
|
|
|
8020
8137
|
},
|
|
8021
8138
|
handleGlobalCopyEvent (evnt: any) {
|
|
8022
8139
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8140
|
+
const props = $xeTable
|
|
8141
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8142
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8023
8143
|
|
|
8024
|
-
const {
|
|
8144
|
+
const { keyboardConfig, mouseConfig } = props
|
|
8145
|
+
const { editStore, filterStore } = reactData
|
|
8146
|
+
const { isActivated } = internalData
|
|
8147
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
8148
|
+
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
8025
8149
|
const { actived } = editStore
|
|
8026
8150
|
if (isActivated && !filterStore.visible) {
|
|
8027
8151
|
if (!(actived.row || actived.column)) {
|
|
@@ -8034,8 +8158,15 @@ const tableMethods: any = {
|
|
|
8034
8158
|
},
|
|
8035
8159
|
handleGlobalCutEvent (evnt: any) {
|
|
8036
8160
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
8161
|
+
const props = $xeTable
|
|
8162
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
8163
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
8037
8164
|
|
|
8038
|
-
const {
|
|
8165
|
+
const { keyboardConfig, mouseConfig } = props
|
|
8166
|
+
const { editStore, filterStore } = reactData
|
|
8167
|
+
const { isActivated } = internalData
|
|
8168
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
8169
|
+
const keyboardOpts = $xeTable.computeKeyboardOpts
|
|
8039
8170
|
const { actived } = editStore
|
|
8040
8171
|
if (isActivated && !filterStore.visible) {
|
|
8041
8172
|
if (!(actived.row || actived.column)) {
|
|
@@ -12751,10 +12882,10 @@ const tableMethods: any = {
|
|
|
12751
12882
|
return updateStyle($xeTable)
|
|
12752
12883
|
})
|
|
12753
12884
|
},
|
|
12754
|
-
updateScrollYStatus () {
|
|
12885
|
+
updateScrollYStatus (fullData: any[]) {
|
|
12755
12886
|
const $xeTable = this
|
|
12756
12887
|
|
|
12757
|
-
return updateScrollYStatus($xeTable)
|
|
12888
|
+
return updateScrollYStatus($xeTable, fullData)
|
|
12758
12889
|
},
|
|
12759
12890
|
/**
|
|
12760
12891
|
* 如果有滚动条,则滚动到对应的位置
|
|
@@ -90,6 +90,7 @@ export function createInternalData (): TableInternalData {
|
|
|
90
90
|
sourceDataRowIdData: {},
|
|
91
91
|
fullColumnIdData: {},
|
|
92
92
|
fullColumnFieldData: {},
|
|
93
|
+
fullCellHeightMaps: {},
|
|
93
94
|
|
|
94
95
|
// 当前行
|
|
95
96
|
currentRow: null,
|
|
@@ -158,7 +159,9 @@ export function createInternalData (): TableInternalData {
|
|
|
158
159
|
inited: false,
|
|
159
160
|
tooltipTimeout: null,
|
|
160
161
|
initStatus: false,
|
|
161
|
-
isActivated: false
|
|
162
|
+
isActivated: false,
|
|
163
|
+
|
|
164
|
+
rceDelay: 0
|
|
162
165
|
|
|
163
166
|
// _sToTime: null
|
|
164
167
|
}
|
|
@@ -420,6 +423,23 @@ export function createReactData (): TableReactData {
|
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
|
|
426
|
+
const maxKey = '__max'
|
|
427
|
+
|
|
428
|
+
export function getRowMaxHeight (chRest: Record<string, number>, isForce: boolean) {
|
|
429
|
+
if (isForce || !chRest[maxKey]) {
|
|
430
|
+
let max = 0
|
|
431
|
+
for (const key in chRest) {
|
|
432
|
+
const val = chRest[key]
|
|
433
|
+
if (key !== maxKey && XEUtils.isNumber(val) && val > max) {
|
|
434
|
+
max = val
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
chRest[maxKey] = max
|
|
438
|
+
return max
|
|
439
|
+
}
|
|
440
|
+
return chRest[maxKey]
|
|
441
|
+
}
|
|
442
|
+
|
|
423
443
|
const getAllConvertColumns = (columns: any, parentColumn?: any) => {
|
|
424
444
|
const result: any[] = []
|
|
425
445
|
columns.forEach((column: any) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|