vxe-table 3.21.7 → 3.21.9
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/render/index.js +166 -24
- package/es/table/src/methods.js +205 -56
- package/es/table/src/util.js +19 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +324 -40
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/render/index.js +272 -25
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/methods.js +31 -12
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +20 -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/render/index.ts +166 -24
- package/packages/table/src/methods.ts +214 -58
- package/packages/table/src/util.ts +23 -1
- /package/es/{iconfont.1780638727189.ttf → iconfont.1780878069088.ttf} +0 -0
- /package/es/{iconfont.1780638727189.woff → iconfont.1780878069088.woff} +0 -0
- /package/es/{iconfont.1780638727189.woff2 → iconfont.1780878069088.woff2} +0 -0
- /package/lib/{iconfont.1780638727189.ttf → iconfont.1780878069088.ttf} +0 -0
- /package/lib/{iconfont.1780638727189.woff → iconfont.1780878069088.woff} +0 -0
- /package/lib/{iconfont.1780638727189.woff2 → iconfont.1780878069088.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'
|
|
@@ -2562,36 +2562,40 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
2562
2562
|
/**
|
|
2563
2563
|
* 计算自适应行高
|
|
2564
2564
|
*/
|
|
2565
|
-
const calcCellAutoHeight = ($xeTable: VxeTableConstructor, rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
2566
|
-
const
|
|
2565
|
+
const calcCellAutoHeight = ($xeTable: VxeTableConstructor, rowid: string | number, rowRest: VxeTableDefines.RowCacheItem, wrapperEl: HTMLDivElement) => {
|
|
2566
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2567
2567
|
|
|
2568
|
-
const {
|
|
2568
|
+
const { fullCellHeightMaps } = internalData
|
|
2569
|
+
let chRest = fullCellHeightMaps[rowid]
|
|
2570
|
+
if (!chRest) {
|
|
2571
|
+
chRest = {}
|
|
2572
|
+
fullCellHeightMaps[rowid] = chRest
|
|
2573
|
+
}
|
|
2569
2574
|
const wrapperElemList = wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`)
|
|
2570
|
-
let colHeight = 0
|
|
2571
2575
|
let firstCellStyle: CSSStyleDeclaration | null = null
|
|
2572
2576
|
let topBottomPadding = 0
|
|
2577
|
+
let changeCH = false
|
|
2573
2578
|
for (let i = 0; i < wrapperElemList.length; i++) {
|
|
2574
2579
|
const wrapperElem = wrapperElemList[i] as HTMLElement
|
|
2575
2580
|
const cellElem = wrapperElem.parentElement as HTMLTableCellElement
|
|
2576
2581
|
const cellStyle = cellElem.style
|
|
2577
2582
|
const orHeight = cellStyle.height
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
}
|
|
2583
|
+
const colid = wrapperElem.getAttribute('colid') || ''
|
|
2584
|
+
cellStyle.height = ''
|
|
2581
2585
|
if (!firstCellStyle) {
|
|
2582
2586
|
firstCellStyle = getComputedStyle(cellElem)
|
|
2583
2587
|
topBottomPadding = firstCellStyle ? Math.ceil(XEUtils.toNumber(firstCellStyle.paddingTop) + XEUtils.toNumber(firstCellStyle.paddingBottom)) : 0
|
|
2584
2588
|
}
|
|
2585
|
-
if (!scrollXLoad) {
|
|
2586
|
-
cellStyle.height = orHeight
|
|
2587
|
-
}
|
|
2588
2589
|
const cellHeight = wrapperElem ? wrapperElem.clientHeight : 0
|
|
2589
|
-
colHeight = Math.
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2590
|
+
const colHeight = Math.ceil(cellHeight + topBottomPadding)
|
|
2591
|
+
if (chRest[colid] !== colHeight) {
|
|
2592
|
+
changeCH = true
|
|
2593
|
+
chRest[colid] = colHeight
|
|
2594
|
+
}
|
|
2595
|
+
cellStyle.height = orHeight
|
|
2593
2596
|
}
|
|
2594
|
-
|
|
2597
|
+
const cellMaxHeight = getRowMaxHeight(chRest, changeCH)
|
|
2598
|
+
return cellMaxHeight
|
|
2595
2599
|
}
|
|
2596
2600
|
|
|
2597
2601
|
/**
|
|
@@ -2618,7 +2622,7 @@ const calcCellHeight = ($xeTable: VxeTableConstructor) => {
|
|
|
2618
2622
|
const rowid = handleGetRowId(row)
|
|
2619
2623
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
2620
2624
|
if (rowRest) {
|
|
2621
|
-
const height = calcCellAutoHeight($xeTable, rowRest, el)
|
|
2625
|
+
const height = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
2622
2626
|
rowRest.height = Math.max(defaultRowHeight, height)
|
|
2623
2627
|
}
|
|
2624
2628
|
el.removeAttribute('data-calc-row')
|
|
@@ -3140,7 +3144,6 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3140
3144
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3141
3145
|
|
|
3142
3146
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
3143
|
-
internalData.rceRunTime = Date.now()
|
|
3144
3147
|
if (!el || !el.clientWidth) {
|
|
3145
3148
|
return $xeTable.$nextTick()
|
|
3146
3149
|
}
|
|
@@ -3164,6 +3167,7 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3164
3167
|
if (reFull) {
|
|
3165
3168
|
updateTreeLineStyle($xeTable)
|
|
3166
3169
|
}
|
|
3170
|
+
internalData.rceRunTime = Date.now()
|
|
3167
3171
|
return computeScrollLoad($xeTable).then(() => {
|
|
3168
3172
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
3169
3173
|
if (reWidth) {
|
|
@@ -3184,12 +3188,15 @@ function handleRecalculateStyle ($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
3184
3188
|
if (reFull) {
|
|
3185
3189
|
updateTreeLineStyle($xeTable)
|
|
3186
3190
|
}
|
|
3191
|
+
internalData.rceRunTime = Date.now()
|
|
3187
3192
|
if (reFull) {
|
|
3188
3193
|
return computeScrollLoad($xeTable)
|
|
3189
3194
|
}
|
|
3190
3195
|
})
|
|
3191
3196
|
}
|
|
3192
3197
|
|
|
3198
|
+
const minRunDelay = 50
|
|
3199
|
+
|
|
3193
3200
|
function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reFull: boolean, reWidth: boolean, reHeight: boolean) {
|
|
3194
3201
|
const reactData = $xeTable as unknown as TableReactData
|
|
3195
3202
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -3199,7 +3206,16 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3199
3206
|
const { rceTimeout, rceRunTime } = internalData
|
|
3200
3207
|
const $xeGanttView = internalData.xeGanttView
|
|
3201
3208
|
const resizeOpts = $xeTable.computeResizeOpts
|
|
3202
|
-
|
|
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
|
|
3203
3219
|
const el = $xeTable.$refs.refElem as HTMLElement
|
|
3204
3220
|
if (el && el.clientWidth) {
|
|
3205
3221
|
autoCellWidth($xeTable)
|
|
@@ -3210,7 +3226,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3210
3226
|
}
|
|
3211
3227
|
if (rceTimeout) {
|
|
3212
3228
|
clearTimeout(rceTimeout)
|
|
3213
|
-
if (rceRunTime && rceRunTime +
|
|
3229
|
+
if (rceRunTime && rceRunTime + minRunDelay < Date.now()) {
|
|
3214
3230
|
resolve(
|
|
3215
3231
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
|
|
3216
3232
|
)
|
|
@@ -3230,7 +3246,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
|
|
|
3230
3246
|
internalData.rceTimeout = setTimeout(() => {
|
|
3231
3247
|
internalData.rceTimeout = undefined
|
|
3232
3248
|
handleRecalculateStyle($xeTable, reFull, reWidth, reHeight)
|
|
3233
|
-
},
|
|
3249
|
+
}, reDelay)
|
|
3234
3250
|
})
|
|
3235
3251
|
}
|
|
3236
3252
|
|
|
@@ -3579,6 +3595,8 @@ function loadTableData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
3579
3595
|
reactData.insertRowFlag++
|
|
3580
3596
|
internalData.removeRowMaps = {}
|
|
3581
3597
|
reactData.removeRowFlag++
|
|
3598
|
+
internalData.fullCellHeightMaps = {}
|
|
3599
|
+
internalData.fullCellStoreMaps = {}
|
|
3582
3600
|
const sYLoad = updateScrollYStatus($xeTable, fullData)
|
|
3583
3601
|
// 全量数据
|
|
3584
3602
|
internalData.tableFullData = fullData
|
|
@@ -3959,13 +3977,53 @@ function initColumnHierarchy ($xeTable: VxeTableConstructor & VxeTablePrivateMet
|
|
|
3959
3977
|
internalData.fullColumnFieldData = fullColFieldData
|
|
3960
3978
|
}
|
|
3961
3979
|
|
|
3962
|
-
function
|
|
3980
|
+
function buildColumnInfo ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
3963
3981
|
const props = $xeTable
|
|
3964
3982
|
const $xeToolbar = $xeTable.$refs.$xeToolbar as VxeToolbarConstructor
|
|
3965
3983
|
const reactData = $xeTable as unknown as TableReactData
|
|
3966
3984
|
const internalData = $xeTable as unknown as TableInternalData
|
|
3967
3985
|
|
|
3986
|
+
const { scrollXLoad, scrollYLoad, expandColumn } = reactData
|
|
3968
3987
|
const expandOpts = $xeTable.computeExpandOpts
|
|
3988
|
+
cacheColumnMap($xeTable)
|
|
3989
|
+
parseColumns($xeTable, true).then(() => {
|
|
3990
|
+
if (reactData.scrollXLoad) {
|
|
3991
|
+
loadScrollXData($xeTable)
|
|
3992
|
+
}
|
|
3993
|
+
})
|
|
3994
|
+
$xeTable.clearHeaderFormatterCache()
|
|
3995
|
+
$xeTable.clearMergeCells()
|
|
3996
|
+
$xeTable.clearMergeFooterItems()
|
|
3997
|
+
$xeTable.handleTableData(true)
|
|
3998
|
+
$xeTable.handleAggregateSummaryData()
|
|
3999
|
+
|
|
4000
|
+
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
4001
|
+
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
4002
|
+
}
|
|
4003
|
+
|
|
4004
|
+
return $xeTable.$nextTick().then(() => {
|
|
4005
|
+
if ($xeToolbar) {
|
|
4006
|
+
$xeToolbar.syncUpdate({
|
|
4007
|
+
collectColumn: internalData.collectColumn,
|
|
4008
|
+
$table: $xeTable
|
|
4009
|
+
})
|
|
4010
|
+
}
|
|
4011
|
+
if ($xeTable.handleUpdateCustomColumn) {
|
|
4012
|
+
$xeTable.handleUpdateCustomColumn()
|
|
4013
|
+
}
|
|
4014
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
4015
|
+
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
4016
|
+
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false'])
|
|
4017
|
+
}
|
|
4018
|
+
reactData.isColLoading = false
|
|
4019
|
+
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4020
|
+
})
|
|
4021
|
+
}
|
|
4022
|
+
|
|
4023
|
+
function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, collectColumn: VxeTableDefines.ColumnInfo[]) {
|
|
4024
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
4025
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
4026
|
+
|
|
3969
4027
|
internalData.collectColumn = collectColumn
|
|
3970
4028
|
const tFullColumn = getColumnList(collectColumn)
|
|
3971
4029
|
internalData.tableFullColumn = tFullColumn
|
|
@@ -3975,40 +4033,7 @@ function handleInitColumn ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
|
|
|
3975
4033
|
return Promise.resolve(
|
|
3976
4034
|
restoreCustomStorage($xeTable)
|
|
3977
4035
|
).then(() => {
|
|
3978
|
-
|
|
3979
|
-
cacheColumnMap($xeTable)
|
|
3980
|
-
parseColumns($xeTable, true).then(() => {
|
|
3981
|
-
if (reactData.scrollXLoad) {
|
|
3982
|
-
loadScrollXData($xeTable)
|
|
3983
|
-
}
|
|
3984
|
-
})
|
|
3985
|
-
$xeTable.clearHeaderFormatterCache()
|
|
3986
|
-
$xeTable.clearMergeCells()
|
|
3987
|
-
$xeTable.clearMergeFooterItems()
|
|
3988
|
-
$xeTable.handleTableData(true)
|
|
3989
|
-
$xeTable.handleAggregateSummaryData()
|
|
3990
|
-
|
|
3991
|
-
if ((scrollXLoad || scrollYLoad) && (expandColumn && expandOpts.mode !== 'fixed')) {
|
|
3992
|
-
warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
3993
|
-
}
|
|
3994
|
-
|
|
3995
|
-
return $xeTable.$nextTick().then(() => {
|
|
3996
|
-
if ($xeToolbar) {
|
|
3997
|
-
$xeToolbar.syncUpdate({
|
|
3998
|
-
collectColumn: internalData.collectColumn,
|
|
3999
|
-
$table: $xeTable
|
|
4000
|
-
})
|
|
4001
|
-
}
|
|
4002
|
-
if ($xeTable.handleUpdateCustomColumn) {
|
|
4003
|
-
$xeTable.handleUpdateCustomColumn()
|
|
4004
|
-
}
|
|
4005
|
-
const columnOpts = $xeTable.computeColumnOpts
|
|
4006
|
-
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
4007
|
-
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false'])
|
|
4008
|
-
}
|
|
4009
|
-
reactData.isColLoading = false
|
|
4010
|
-
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4011
|
-
})
|
|
4036
|
+
return buildColumnInfo($xeTable)
|
|
4012
4037
|
})
|
|
4013
4038
|
}
|
|
4014
4039
|
|
|
@@ -5536,6 +5561,61 @@ const tableMethods: any = {
|
|
|
5536
5561
|
}
|
|
5537
5562
|
return $xeTable.$nextTick()
|
|
5538
5563
|
},
|
|
5564
|
+
effectCellData (row: any, column: VxeTableDefines.ColumnInfo, options: VxeTableDefines.CellCacheHandleOptions) {
|
|
5565
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5566
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5567
|
+
|
|
5568
|
+
const { fullCellStoreMaps } = internalData
|
|
5569
|
+
const editOpts = $xeTable.computeEditOpts
|
|
5570
|
+
const { key, isChanged, setValue, getResult } = options
|
|
5571
|
+
const rowid = getRowid($xeTable, row)
|
|
5572
|
+
const colid = column.id
|
|
5573
|
+
let rowStore = fullCellStoreMaps[rowid]
|
|
5574
|
+
const cellValue = XEUtils.get(row, column.field)
|
|
5575
|
+
const restParams: VxeTableDefines.CellCacheHandleParams = {
|
|
5576
|
+
$table: $xeTable,
|
|
5577
|
+
row,
|
|
5578
|
+
rowid,
|
|
5579
|
+
column,
|
|
5580
|
+
colid,
|
|
5581
|
+
cellValue,
|
|
5582
|
+
oldValue: null
|
|
5583
|
+
}
|
|
5584
|
+
|
|
5585
|
+
if (editOpts.cache === false && key === 'render_table_cell') {
|
|
5586
|
+
const rest = restParams as VxeTableDefines.CellCacheResultObj
|
|
5587
|
+
rest.cellResult = getResult ? getResult(restParams) : cellValue
|
|
5588
|
+
return rest
|
|
5589
|
+
}
|
|
5590
|
+
|
|
5591
|
+
if (!rowStore) {
|
|
5592
|
+
rowStore = {}
|
|
5593
|
+
fullCellStoreMaps[rowid] = rowStore
|
|
5594
|
+
}
|
|
5595
|
+
let cellStore = rowStore[colid]
|
|
5596
|
+
if (!cellStore) {
|
|
5597
|
+
cellStore = {
|
|
5598
|
+
value: undefined,
|
|
5599
|
+
result: {}
|
|
5600
|
+
}
|
|
5601
|
+
rowStore[colid] = cellStore
|
|
5602
|
+
}
|
|
5603
|
+
const restData = rowStore[colid]
|
|
5604
|
+
const oldValue = restData.value
|
|
5605
|
+
restParams.oldValue = oldValue
|
|
5606
|
+
if (isChanged ? !isChanged(restParams) : oldValue !== cellValue) {
|
|
5607
|
+
restData.value = setValue ? setValue(restParams) : cellValue
|
|
5608
|
+
restData.result = {}
|
|
5609
|
+
}
|
|
5610
|
+
const storeData = restData.result
|
|
5611
|
+
if (XEUtils.isUndefined(storeData[key])) {
|
|
5612
|
+
storeData[key] = getResult ? getResult(restParams) : cellValue
|
|
5613
|
+
}
|
|
5614
|
+
const cellResult = storeData[key]
|
|
5615
|
+
const rest = restParams as VxeTableDefines.CellCacheResultObj
|
|
5616
|
+
rest.cellResult = cellResult
|
|
5617
|
+
return rest
|
|
5618
|
+
},
|
|
5539
5619
|
getCellElement (row: any, fieldOrColumn: any) {
|
|
5540
5620
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5541
5621
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -6455,6 +6535,9 @@ const tableMethods: any = {
|
|
|
6455
6535
|
warnLog('vxe.error.delFunc', ['resetColumn', 'resetCustom'])
|
|
6456
6536
|
return this.resetCustom(options)
|
|
6457
6537
|
},
|
|
6538
|
+
/**
|
|
6539
|
+
* @private
|
|
6540
|
+
*/
|
|
6458
6541
|
handleCustom () {
|
|
6459
6542
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6460
6543
|
const props = $xeTable
|
|
@@ -6510,6 +6593,70 @@ const tableMethods: any = {
|
|
|
6510
6593
|
}
|
|
6511
6594
|
}
|
|
6512
6595
|
},
|
|
6596
|
+
/**
|
|
6597
|
+
* 用于 custom-config,用于手动恢复自定义列设置信息,恢复表格重置为初始状态
|
|
6598
|
+
* @param storeData
|
|
6599
|
+
* @returns
|
|
6600
|
+
*/
|
|
6601
|
+
setCustomStoreData (storeData: VxeTableDefines.CustomStoreData | null) {
|
|
6602
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6603
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
6604
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
6605
|
+
|
|
6606
|
+
if (!storeData) {
|
|
6607
|
+
return $xeTable.$nextTick()
|
|
6608
|
+
}
|
|
6609
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
6610
|
+
const { checkMethod } = customOpts
|
|
6611
|
+
// 重置状态
|
|
6612
|
+
clearTableAllStatus($xeTable)
|
|
6613
|
+
// 恢复列
|
|
6614
|
+
const allCols: VxeTableDefines.ColumnInfo[] = []
|
|
6615
|
+
XEUtils.eachTree(internalData.collectColumn, (column) => {
|
|
6616
|
+
column.resizeWidth = 0
|
|
6617
|
+
column.fixed = column.defaultFixed
|
|
6618
|
+
column.renderSortNumber = column.sortNumber
|
|
6619
|
+
column.parentId = column.defaultParentId
|
|
6620
|
+
if (!checkMethod || checkMethod({ $table: $xeTable, column })) {
|
|
6621
|
+
column.visible = column.defaultVisible
|
|
6622
|
+
}
|
|
6623
|
+
column.aggFunc = column.defaultAggFunc
|
|
6624
|
+
column.renderAggFn = column.defaultAggFunc
|
|
6625
|
+
column.renderResizeWidth = column.renderWidth
|
|
6626
|
+
allCols.push(column)
|
|
6627
|
+
})
|
|
6628
|
+
const newCollectCols = XEUtils.toArrayTree(XEUtils.orderBy(allCols, 'renderSortNumber'), { key: 'id', parentKey: 'parentId', children: 'children' })
|
|
6629
|
+
internalData.collectColumn = newCollectCols
|
|
6630
|
+
internalData.tableFullColumn = getColumnList(newCollectCols)
|
|
6631
|
+
|
|
6632
|
+
reactData.updateColFlag++
|
|
6633
|
+
reactData.isColLoading = true
|
|
6634
|
+
initColumnHierarchy($xeTable)
|
|
6635
|
+
return Promise.resolve(
|
|
6636
|
+
handleCustomRestore($xeTable, storeData)
|
|
6637
|
+
).then(() => {
|
|
6638
|
+
return buildColumnInfo($xeTable)
|
|
6639
|
+
}).then(() => {
|
|
6640
|
+
// 恢复数据聚合分组
|
|
6641
|
+
const { isRowGroupStatus, rowGroupList } = reactData
|
|
6642
|
+
if (isRowGroupStatus && !!$xeTable.handlePivotTableAggData) {
|
|
6643
|
+
const rowGroupFields = $xeTable.computeRowGroupFields
|
|
6644
|
+
if (rowGroupFields ? rowGroupFields.length : rowGroupList.length) {
|
|
6645
|
+
if (rowGroupFields && rowGroupFields.length) {
|
|
6646
|
+
$xeTable.setRowGroups(rowGroupFields)
|
|
6647
|
+
} else {
|
|
6648
|
+
$xeTable.clearRowGroups()
|
|
6649
|
+
}
|
|
6650
|
+
} else {
|
|
6651
|
+
$xeTable.handleUpdateAggData()
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
})
|
|
6655
|
+
},
|
|
6656
|
+
/**
|
|
6657
|
+
* 用于 custom-config,用于获取自定义列设置信息,用于自定义保持
|
|
6658
|
+
* @returns
|
|
6659
|
+
*/
|
|
6513
6660
|
getCustomStoreData () {
|
|
6514
6661
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6515
6662
|
const props = $xeTable
|
|
@@ -6632,6 +6779,9 @@ const tableMethods: any = {
|
|
|
6632
6779
|
}
|
|
6633
6780
|
return storeData
|
|
6634
6781
|
},
|
|
6782
|
+
/**
|
|
6783
|
+
* @private
|
|
6784
|
+
*/
|
|
6635
6785
|
saveCustomStore (type: any) {
|
|
6636
6786
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6637
6787
|
const props = $xeTable
|
|
@@ -6981,6 +7131,9 @@ const tableMethods: any = {
|
|
|
6981
7131
|
}
|
|
6982
7132
|
}
|
|
6983
7133
|
},
|
|
7134
|
+
/**
|
|
7135
|
+
* @private
|
|
7136
|
+
*/
|
|
6984
7137
|
handleRowResizeMousedownEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
6985
7138
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
6986
7139
|
const props = $xeTable
|
|
@@ -7103,6 +7256,9 @@ const tableMethods: any = {
|
|
|
7103
7256
|
}
|
|
7104
7257
|
updateEvent(evnt)
|
|
7105
7258
|
},
|
|
7259
|
+
/**
|
|
7260
|
+
* @private
|
|
7261
|
+
*/
|
|
7106
7262
|
handleRowResizeDblclickEvent (evnt: MouseEvent, params: VxeTableDefines.CellRenderBodyParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
7107
7263
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
7108
7264
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -7125,7 +7281,7 @@ const tableMethods: any = {
|
|
|
7125
7281
|
}
|
|
7126
7282
|
const handleRsHeight = () => {
|
|
7127
7283
|
el.setAttribute('data-calc-row', 'Y')
|
|
7128
|
-
const resizeHeight = calcCellAutoHeight($xeTable, rowRest, el)
|
|
7284
|
+
const resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
7129
7285
|
el.removeAttribute('data-calc-row')
|
|
7130
7286
|
const resizeParams = { ...params, resizeHeight, resizeRow: row }
|
|
7131
7287
|
reactData.isDragResize = false
|
|
@@ -7212,7 +7368,7 @@ const tableMethods: any = {
|
|
|
7212
7368
|
const rowid = XEUtils.isString(row) || XEUtils.isNumber(row) ? row : handleGetRowId(row)
|
|
7213
7369
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
7214
7370
|
if (rowRest) {
|
|
7215
|
-
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowRest, el)
|
|
7371
|
+
rowRest.resizeHeight = calcCellAutoHeight($xeTable, rowid, rowRest, el)
|
|
7216
7372
|
}
|
|
7217
7373
|
el.removeAttribute('data-calc-row')
|
|
7218
7374
|
})
|
|
@@ -90,6 +90,9 @@ export function createInternalData (): TableInternalData {
|
|
|
90
90
|
sourceDataRowIdData: {},
|
|
91
91
|
fullColumnIdData: {},
|
|
92
92
|
fullColumnFieldData: {},
|
|
93
|
+
fullCellHeightMaps: {},
|
|
94
|
+
|
|
95
|
+
fullCellStoreMaps: {},
|
|
93
96
|
|
|
94
97
|
// 当前行
|
|
95
98
|
currentRow: null,
|
|
@@ -158,7 +161,9 @@ export function createInternalData (): TableInternalData {
|
|
|
158
161
|
inited: false,
|
|
159
162
|
tooltipTimeout: null,
|
|
160
163
|
initStatus: false,
|
|
161
|
-
isActivated: false
|
|
164
|
+
isActivated: false,
|
|
165
|
+
|
|
166
|
+
rceDelay: 0
|
|
162
167
|
|
|
163
168
|
// _sToTime: null
|
|
164
169
|
}
|
|
@@ -420,6 +425,23 @@ export function createReactData (): TableReactData {
|
|
|
420
425
|
}
|
|
421
426
|
}
|
|
422
427
|
|
|
428
|
+
const maxKey = '__max'
|
|
429
|
+
|
|
430
|
+
export function getRowMaxHeight (chRest: Record<string, number>, isForce: boolean) {
|
|
431
|
+
if (isForce || !chRest[maxKey]) {
|
|
432
|
+
let max = 0
|
|
433
|
+
for (const key in chRest) {
|
|
434
|
+
const val = chRest[key]
|
|
435
|
+
if (key !== maxKey && XEUtils.isNumber(val) && val > max) {
|
|
436
|
+
max = val
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
chRest[maxKey] = max
|
|
440
|
+
return max
|
|
441
|
+
}
|
|
442
|
+
return chRest[maxKey]
|
|
443
|
+
}
|
|
444
|
+
|
|
423
445
|
const getAllConvertColumns = (columns: any, parentColumn?: any) => {
|
|
424
446
|
const result: any[] = []
|
|
425
447
|
columns.forEach((column: any) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|