tomtaw-vxe-table 3.25.19 → 3.25.21
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/colgroup/index.d.ts +2 -0
- package/es/column/index.d.ts +2 -0
- package/es/grid/index.d.ts +2 -0
- package/es/grid/src/grid.d.ts +1 -0
- package/es/table/src/body.js +84 -36
- package/es/table/src/column.d.ts +2 -0
- package/es/table/src/column.js +2 -0
- package/es/table/src/columnInfo.js +1 -0
- package/es/table/src/group.d.ts +1 -0
- package/es/table/src/header.d.ts +3 -1
- package/es/table/src/header.js +49 -12
- package/es/table/src/methods.js +142 -79
- package/es/table/src/table.js +6 -15
- package/es/table/src/util.d.ts +3 -1
- package/es/table/src/util.js +30 -14
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +315 -164
- package/lib/index.umd.min.js +3 -3
- package/lib/table/src/body.js +84 -36
- package/lib/table/src/column.js +2 -0
- package/lib/table/src/columnInfo.js +1 -0
- package/lib/table/src/header.js +48 -11
- package/lib/table/src/methods.js +147 -86
- package/lib/table/src/table.js +6 -15
- package/lib/table/src/util.js +30 -14
- package/lib/ui/index.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/body.ts +71 -35
- package/packages/table/src/column.ts +2 -0
- package/packages/table/src/columnInfo.ts +1 -0
- package/packages/table/src/header.ts +53 -13
- package/packages/table/src/methods.ts +176 -79
- package/packages/table/src/table.ts +10 -18
- package/packages/table/src/util.ts +32 -15
- package/types/all.d.ts +23 -1
- /package/es/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
- /package/es/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
- /package/es/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
- /package/lib/{iconfont.1795571985819.ttf → iconfont.1795761876277.ttf} +0 -0
- /package/lib/{iconfont.1795571985819.woff → iconfont.1795761876277.woff} +0 -0
- /package/lib/{iconfont.1795571985819.woff2 → iconfont.1795761876277.woff2} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type Vue from 'vue'
|
|
1
2
|
import XEUtils from 'xe-utils'
|
|
2
3
|
import { VxeUI } from '@vxe-ui/core'
|
|
3
4
|
import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, getWheelScrollOffset, wheelScrollLeftTo, wheelScrollTopTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom'
|
|
@@ -26,6 +27,8 @@ import {
|
|
|
26
27
|
createHandleGetRowId,
|
|
27
28
|
getRefElem,
|
|
28
29
|
getCellRestHeight,
|
|
30
|
+
getUniformRowHeight,
|
|
31
|
+
maxYHeight,
|
|
29
32
|
getLastChildColumn,
|
|
30
33
|
getRowMaxHeight,
|
|
31
34
|
handleCustomStoreConfig,
|
|
@@ -54,10 +57,10 @@ const { getConfig, getI18n, renderer, formats, interceptor, createEvent, globalE
|
|
|
54
57
|
|
|
55
58
|
const supportMaxRow = 5e6
|
|
56
59
|
const customStorageKey = 'VXE_CUSTOM_STORE'
|
|
57
|
-
const maxYHeight = 5e6
|
|
58
60
|
const maxXWidth = 5e6
|
|
59
61
|
|
|
60
62
|
const sourceType = 'table'
|
|
63
|
+
const filteredRowModels = new WeakMap<VxeTableConstructor, { source: any[]; length: number; keys: unknown[]; rows: any[] }>()
|
|
61
64
|
const customStorageQueues = new WeakMap<VxeTableConstructor, ReturnType<typeof createCustomStoreQueue>>()
|
|
62
65
|
|
|
63
66
|
// 仅合并等待同一轮 DOM 更新的展开行位置重算,不保留表格实例。
|
|
@@ -80,6 +83,7 @@ const rowOffsetIndexes = new WeakMap<
|
|
|
80
83
|
firstChangedIndex: number
|
|
81
84
|
resizeFlag: number
|
|
82
85
|
hasExpandColumn: boolean
|
|
86
|
+
uniformHeight: number
|
|
83
87
|
}
|
|
84
88
|
>()
|
|
85
89
|
|
|
@@ -914,7 +918,7 @@ function handleVirtualTreeToList($xeTable: VxeTableConstructor & VxeTablePrivate
|
|
|
914
918
|
* 编译处理后全量的表格数据
|
|
915
919
|
* 如果存在筛选条件,继续处理
|
|
916
920
|
*/
|
|
917
|
-
function updateAfterFullData($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
921
|
+
function updateAfterFullData($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reason?: 'sort') {
|
|
918
922
|
const props = $xeTable
|
|
919
923
|
const reactData = $xeTable as unknown as TableReactData
|
|
920
924
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -934,6 +938,9 @@ function updateAfterFullData($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
934
938
|
let tableData: any[] = []
|
|
935
939
|
let tableTree: any[] = []
|
|
936
940
|
|
|
941
|
+
const previousFilter = reason === 'sort' ? filteredRowModels.get($xeTable) : undefined
|
|
942
|
+
filteredRowModels.delete($xeTable)
|
|
943
|
+
|
|
937
944
|
// 处理数据
|
|
938
945
|
if (!allRemoteFilter || !allRemoteSort) {
|
|
939
946
|
const filterColumns: {
|
|
@@ -1006,7 +1013,21 @@ function updateAfterFullData($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
1006
1013
|
})
|
|
1007
1014
|
tableData = tableTree
|
|
1008
1015
|
} else {
|
|
1009
|
-
|
|
1016
|
+
if (!treeConfig && filterOpts.cacheOnSort === true) {
|
|
1017
|
+
const keys: unknown[] = [allFilterMethod, rendererOpts]
|
|
1018
|
+
for (const { column, itemList } of filterColumns) {
|
|
1019
|
+
keys.push(column, column.field, column.filterMethod, column.filterRender, itemList.length)
|
|
1020
|
+
for (const item of itemList) keys.push(item, item.value, item.data)
|
|
1021
|
+
}
|
|
1022
|
+
const reuse = previousFilter && previousFilter.source === tableFullData && previousFilter.length === tableFullData.length &&
|
|
1023
|
+
keys.length === previousFilter.keys.length && keys.every((value, index) => value === previousFilter.keys[index])
|
|
1024
|
+
const rows = reuse ? previousFilter.rows : tableFullData.filter(handleFilter)
|
|
1025
|
+
filteredRowModels.set($xeTable, { source: tableFullData, length: tableFullData.length, keys, rows })
|
|
1026
|
+
// 自定义排序器可能原地排序;缓存保留筛选后的原始顺序。
|
|
1027
|
+
tableData = rows.slice()
|
|
1028
|
+
} else {
|
|
1029
|
+
tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter)
|
|
1030
|
+
}
|
|
1010
1031
|
tableTree = tableData
|
|
1011
1032
|
}
|
|
1012
1033
|
} else {
|
|
@@ -1144,6 +1165,21 @@ function updateAfterFullData($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
1144
1165
|
updateAfterDataIndex($xeTable)
|
|
1145
1166
|
}
|
|
1146
1167
|
|
|
1168
|
+
// 未按 rowid 设置 key 时,Vue 可能将带有手动高亮的 tr 复用于另一行。
|
|
1169
|
+
function syncReusedCurrentRows($xeTable: VxeTableConstructor, root: HTMLElement, currentRow: any) {
|
|
1170
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1171
|
+
const rowid = $xeTable.computeRowOpts.isCurrent || $xeTable.highlightCurrentRow ? getRowid($xeTable, currentRow) : null
|
|
1172
|
+
// setCurrentRow 同时标记 tr 和带 rowid 的单元格容器。只修正实际被复用的节点。
|
|
1173
|
+
const marked = root.querySelectorAll('.row--current[rowid]')
|
|
1174
|
+
for (let i = 0; i < marked.length; i++) {
|
|
1175
|
+
if (marked[i].getAttribute('rowid') !== rowid) removeClass(marked[i], 'row--current')
|
|
1176
|
+
}
|
|
1177
|
+
if (rowid !== null && internalData.visibleDataRowIdData[rowid]) {
|
|
1178
|
+
const matches = root.querySelectorAll(`[rowid="${rowid}"]`)
|
|
1179
|
+
for (let i = 0; i < matches.length; i++) addClass(matches[i], 'row--current')
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1147
1183
|
function updateStyle($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1148
1184
|
const props = $xeTable
|
|
1149
1185
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -1304,7 +1340,7 @@ function updateStyle($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1304
1340
|
let renderColumnList = tableColumn
|
|
1305
1341
|
const isOptimizeMode = isHeaderRenderOptimize
|
|
1306
1342
|
|
|
1307
|
-
if (isGroup) {
|
|
1343
|
+
if (isGroup && !isOptimizeMode) {
|
|
1308
1344
|
renderColumnList = visibleColumn
|
|
1309
1345
|
} else {
|
|
1310
1346
|
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
@@ -1321,22 +1357,9 @@ function updateStyle($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
|
1321
1357
|
|
|
1322
1358
|
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
1323
1359
|
|
|
1324
|
-
if (fixedType) {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : ''
|
|
1328
|
-
}
|
|
1329
|
-
} else {
|
|
1330
|
-
if (isOptimizeMode) {
|
|
1331
|
-
if (wrapperElem) {
|
|
1332
|
-
wrapperElem.style.width = tWidth ? `${tWidth}px` : ''
|
|
1333
|
-
}
|
|
1334
|
-
} else {
|
|
1335
|
-
if (wrapperElem) {
|
|
1336
|
-
wrapperElem.style.width = scrollXWidth ? `${scrollXWidth}px` : ''
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1360
|
+
if (fixedType && wrapperElem) {
|
|
1361
|
+
const width = isOptimizeMode ? tWidth : scrollXWidth
|
|
1362
|
+
wrapperElem.style.width = width ? `${width}px` : ''
|
|
1340
1363
|
}
|
|
1341
1364
|
|
|
1342
1365
|
if (currScrollElem) {
|
|
@@ -1628,7 +1651,7 @@ function updateStyleWithDedupe($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
1628
1651
|
let renderColumnList = tableColumn
|
|
1629
1652
|
const isOptimizeMode = isHeaderRenderOptimize
|
|
1630
1653
|
|
|
1631
|
-
if (isGroup) {
|
|
1654
|
+
if (isGroup && !isOptimizeMode) {
|
|
1632
1655
|
renderColumnList = visibleColumn
|
|
1633
1656
|
} else {
|
|
1634
1657
|
if (!isOptimizeMode || (!isColLoading && (fixedType || !overflowX))) {
|
|
@@ -1645,22 +1668,9 @@ function updateStyleWithDedupe($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
1645
1668
|
|
|
1646
1669
|
const tWidth = renderColumnList.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
1647
1670
|
|
|
1648
|
-
if (fixedType) {
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1652
|
-
}
|
|
1653
|
-
} else {
|
|
1654
|
-
if (isOptimizeMode) {
|
|
1655
|
-
if (wrapperElem) {
|
|
1656
|
-
setLayoutStyle(wrapperElem, 'width', tWidth ? `${tWidth}px` : '')
|
|
1657
|
-
}
|
|
1658
|
-
} else {
|
|
1659
|
-
if (wrapperElem) {
|
|
1660
|
-
setLayoutStyle(wrapperElem, 'width', scrollXWidth ? `${scrollXWidth}px` : '')
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1671
|
+
if (fixedType && wrapperElem) {
|
|
1672
|
+
const width = isOptimizeMode ? tWidth : scrollXWidth
|
|
1673
|
+
setLayoutStyle(wrapperElem, 'width', width ? `${width}px` : '')
|
|
1664
1674
|
}
|
|
1665
1675
|
|
|
1666
1676
|
if (currScrollElem) {
|
|
@@ -1773,7 +1783,7 @@ function updateStyleWithDedupe($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
1773
1783
|
}
|
|
1774
1784
|
return $xeTable.$nextTick()
|
|
1775
1785
|
}
|
|
1776
|
-
function updateScrollXSpaceWithDedupe($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
1786
|
+
function updateScrollXSpaceWithDedupe($xeTable: VxeTableConstructor & VxeTablePrivateMethods, beforeWindowCommit: boolean) {
|
|
1777
1787
|
const reactData = $xeTable as unknown as TableReactData
|
|
1778
1788
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1779
1789
|
|
|
@@ -1860,6 +1870,7 @@ function updateScrollXSpaceWithDedupe($xeTable: VxeTableConstructor & VxeTablePr
|
|
|
1860
1870
|
setLayoutStyle(scrollXSpaceEl, 'width', `${ySpaceWidth}px`)
|
|
1861
1871
|
}
|
|
1862
1872
|
|
|
1873
|
+
if (beforeWindowCommit) return
|
|
1863
1874
|
calcScrollbar($xeTable)
|
|
1864
1875
|
if (isScrollXBig && mouseOpts.area) {
|
|
1865
1876
|
errLog('vxe.error.notProp', ['mouse-config.area'])
|
|
@@ -2514,11 +2525,8 @@ function handleVirtualYVisible($xeTable: VxeTableConstructor) {
|
|
|
2514
2525
|
const reactData = $xeTable as unknown as TableReactData
|
|
2515
2526
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2516
2527
|
|
|
2517
|
-
const {
|
|
2518
|
-
const { elemStore,
|
|
2519
|
-
const rowOpts = $xeTable.computeRowOpts
|
|
2520
|
-
const cellOpts = $xeTable.computeCellOpts
|
|
2521
|
-
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
2528
|
+
const { isScrollYBig, scrollYHeight } = reactData
|
|
2529
|
+
const { elemStore, afterFullData, fullAllDataRowIdData } = internalData
|
|
2522
2530
|
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
2523
2531
|
if (bodyScrollElem) {
|
|
2524
2532
|
const clientHeight = bodyScrollElem.clientHeight
|
|
@@ -2530,10 +2538,13 @@ function handleVirtualYVisible($xeTable: VxeTableConstructor) {
|
|
|
2530
2538
|
const endTop = scrollTop + clientHeight
|
|
2531
2539
|
let toVisibleIndex = -1
|
|
2532
2540
|
let visibleSize = 0
|
|
2533
|
-
const
|
|
2534
|
-
if (
|
|
2535
|
-
toVisibleIndex = Math.floor(startTop /
|
|
2536
|
-
|
|
2541
|
+
const uniformHeight = getUniformRowHeight($xeTable)
|
|
2542
|
+
if (uniformHeight) {
|
|
2543
|
+
toVisibleIndex = Math.max(0, Math.floor(startTop / uniformHeight) - 1)
|
|
2544
|
+
// 包含起点之前一行,以及窗口末端之后的第一行,兼容非整行滚动。
|
|
2545
|
+
visibleSize = $xeTable.computeCellOpts.height || $xeTable.computeRowOpts.height
|
|
2546
|
+
? Math.min(afterFullData.length - toVisibleIndex, Math.floor(endTop / uniformHeight) + 2 - toVisibleIndex)
|
|
2547
|
+
: Math.ceil(clientHeight / uniformHeight) + 1
|
|
2537
2548
|
} else {
|
|
2538
2549
|
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
2539
2550
|
let leftIndex = 0
|
|
@@ -2976,7 +2987,7 @@ function handleSortEvent($xeTable: VxeTableConstructor & VxeTablePrivateMethods,
|
|
|
2976
2987
|
}
|
|
2977
2988
|
if (isUpdate) {
|
|
2978
2989
|
if (!remote) {
|
|
2979
|
-
$xeTable.handleTableData(true)
|
|
2990
|
+
$xeTable.handleTableData(true, false, 'sort')
|
|
2980
2991
|
}
|
|
2981
2992
|
}
|
|
2982
2993
|
if (evnt) {
|
|
@@ -4591,12 +4602,14 @@ function handleInitDefaults($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
4591
4602
|
}
|
|
4592
4603
|
|
|
4593
4604
|
// 二次布局校正时复用未变化的窗口;逐项比较,不能只比较窗口范围或源数组引用。
|
|
4594
|
-
function
|
|
4605
|
+
function matchesVirtualWindow<T>(source: T[], previous: T[], start: number, end: number) {
|
|
4595
4606
|
const size = Math.max(0, Math.min(end, source.length) - start)
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4607
|
+
return start >= 0 && end >= 0 && Number.isInteger(start) && Number.isInteger(end) &&
|
|
4608
|
+
previous.length === size && previous.every((item, index) => item === source[start + index])
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
function getVirtualWindowSlice<T>(source: T[], previous: T[], start: number, end: number) {
|
|
4612
|
+
return matchesVirtualWindow(source, previous, start, end) ? previous : source.slice(start, end)
|
|
4600
4613
|
}
|
|
4601
4614
|
|
|
4602
4615
|
function handleTableColumn($xeTable: VxeTableConstructor & VxeTablePrivateMethods, reuseWindow = false) {
|
|
@@ -4651,7 +4664,7 @@ function loadScrollXData($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
4651
4664
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
4652
4665
|
scrollXStore.startIndex = offsetStartIndex
|
|
4653
4666
|
scrollXStore.endIndex = offsetEndIndex
|
|
4654
|
-
$xeTable.updateScrollXData()
|
|
4667
|
+
$xeTable.updateScrollXData(true)
|
|
4655
4668
|
}
|
|
4656
4669
|
}
|
|
4657
4670
|
$xeTable.closeTooltip()
|
|
@@ -4853,6 +4866,16 @@ function buildColumnInfo($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
|
|
|
4853
4866
|
if (props.showCustomHeader && reactData.isGroup && (columnOpts.resizable || props.resizable)) {
|
|
4854
4867
|
warnLog('vxe.error.notConflictProp', ['show-custom-header & colgroup', 'column-config.resizable=false'])
|
|
4855
4868
|
}
|
|
4869
|
+
if (reactData.scrollXLoad && !reactData.overflowX && reactData.tableColumn.length < internalData.visibleColumn.length &&
|
|
4870
|
+
!$xeTable.computeAutoWidthColumnList.length) {
|
|
4871
|
+
const body = getRefElem(internalData.elemStore['main-body-wrapper'])
|
|
4872
|
+
if (body && body.clientWidth) {
|
|
4873
|
+
// 列窗已选出,先按实际容器确认溢出,结束加载时就不会短暂渲染全部列。
|
|
4874
|
+
$xeTable.analyColumnWidth()
|
|
4875
|
+
autoCellWidth($xeTable)
|
|
4876
|
+
reactData.overflowX = reactData.scrollXWidth > body.clientWidth
|
|
4877
|
+
}
|
|
4878
|
+
}
|
|
4856
4879
|
reactData.isColLoading = false
|
|
4857
4880
|
return handleLazyRecalculate($xeTable, false, true, true)
|
|
4858
4881
|
})
|
|
@@ -5027,10 +5050,15 @@ function handleSyncScroll($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
5027
5050
|
|
|
5028
5051
|
let xRest = null
|
|
5029
5052
|
let yRest = null
|
|
5030
|
-
|
|
5053
|
+
const { startIndex, endIndex } = internalData.scrollYStore
|
|
5054
|
+
// 纯纵向收尾如果仍是同一批行,只在 DOM 提交后测一次,保留内容异步变化后的真实高度。
|
|
5055
|
+
const measureAfterCommit = !isAllOverflow && !!syncGuard && isRollY && !isRollX && scrollYLoad &&
|
|
5056
|
+
!reactData.expandColumn && !autoWidthColumnList.length &&
|
|
5057
|
+
matchesVirtualWindow(internalData.afterFullData, reactData.tableData, startIndex, endIndex)
|
|
5058
|
+
if (!isAllOverflow && !measureAfterCommit) {
|
|
5031
5059
|
measureScrollRowOffsets($xeTable)
|
|
5032
5060
|
}
|
|
5033
|
-
if (syncGuard) syncGuard.markMeasured()
|
|
5061
|
+
if (syncGuard && !measureAfterCommit) syncGuard.markMeasured()
|
|
5034
5062
|
if (isRollX && scrollXLoad) {
|
|
5035
5063
|
xRest = $xeTable.updateScrollXData()
|
|
5036
5064
|
}
|
|
@@ -5046,8 +5074,8 @@ function handleSyncScroll($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
5046
5074
|
}
|
|
5047
5075
|
if (!isAllOverflow) {
|
|
5048
5076
|
measureScrollRowOffsets($xeTable)
|
|
5077
|
+
if (syncGuard) syncGuard.markMeasured()
|
|
5049
5078
|
}
|
|
5050
|
-
if (syncGuard) syncGuard.markMeasured()
|
|
5051
5079
|
return $xeTable.updateScrollYSpace()
|
|
5052
5080
|
})
|
|
5053
5081
|
}
|
|
@@ -5293,7 +5321,22 @@ function handleUpdateColResize($xeTable: VxeTableConstructor & VxeTablePrivateMe
|
|
|
5293
5321
|
$xeTable.dispatchEvent('column-resizable-change', params, evnt)
|
|
5294
5322
|
// 已废弃 resizable-change
|
|
5295
5323
|
$xeTable.dispatchEvent('resizable-change', params, evnt)
|
|
5296
|
-
|
|
5324
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5325
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5326
|
+
const fixedGeometry = getUniformRowHeight($xeTable) && ($xeTable.computeCellOpts.height || $xeTable.computeRowOpts.height) &&
|
|
5327
|
+
!$xeTable.treeConfig && !internalData.xeGanttView && !$xeTable.computeAutoWidthColumnList.length &&
|
|
5328
|
+
!reactData.isGroup && !reactData.isRowGroupStatus && !$xeTable.headerRowStyle && !$xeTable.headerCellStyle &&
|
|
5329
|
+
!$xeTable.showFooter && $xeTable.showHeaderOverflow && !internalData.visibleColumn.some(column => column.showHeaderOverflow === false)
|
|
5330
|
+
const root = $xeTable.$refs.refElem as HTMLElement
|
|
5331
|
+
const width = fixedGeometry && root ? root.clientWidth : 0
|
|
5332
|
+
const height = fixedGeometry && root ? root.clientHeight : 0
|
|
5333
|
+
setTimeout(() => {
|
|
5334
|
+
if (isTableDestroyed($xeTable)) return
|
|
5335
|
+
// 容器可能在业务事件之后改变尺寸,包括关闭 autoResize 的表格。
|
|
5336
|
+
if (!fixedGeometry || !root || root.clientWidth !== width || root.clientHeight !== height) {
|
|
5337
|
+
$xeTable.recalculate(true)
|
|
5338
|
+
}
|
|
5339
|
+
}, 300)
|
|
5297
5340
|
})
|
|
5298
5341
|
}
|
|
5299
5342
|
|
|
@@ -5343,8 +5386,15 @@ function updateRowOffsetTop($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
5343
5386
|
const rowOpts = $xeTable.computeRowOpts
|
|
5344
5387
|
const cellOpts = $xeTable.computeCellOpts
|
|
5345
5388
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
5346
|
-
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
5347
5389
|
const previous = rowOffsetIndexes.get($xeTable)
|
|
5390
|
+
// oTop 也供合并单元格和外部定位读取。同一份定高行序只写一次。
|
|
5391
|
+
const uniformHeight = cellOpts.height || rowOpts.height ? getUniformRowHeight($xeTable) : 0
|
|
5392
|
+
if (uniformHeight && previous && previous.uniformHeight === uniformHeight &&
|
|
5393
|
+
previous.rows === afterFullData && previous.rowOrder === internalData.afterFullRowMaps &&
|
|
5394
|
+
previous.cache === fullAllDataRowIdData && previous.length === afterFullData.length) {
|
|
5395
|
+
return
|
|
5396
|
+
}
|
|
5397
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
5348
5398
|
let startIndex = previous && previous.rows === afterFullData && previous.cache === fullAllDataRowIdData ? Math.max(0, Math.min(dirtyIndex, afterFullData.length)) : 0
|
|
5349
5399
|
const firstRow = afterFullData[startIndex]
|
|
5350
5400
|
const firstRest = firstRow ? fullAllDataRowIdData[handleGetRowId(firstRow)] : null
|
|
@@ -5373,6 +5423,7 @@ function updateRowOffsetTop($xeTable: VxeTableConstructor & VxeTablePrivateMetho
|
|
|
5373
5423
|
cellOpts,
|
|
5374
5424
|
defaultRowHeight,
|
|
5375
5425
|
hasExpandColumn: !!expandColumn,
|
|
5426
|
+
uniformHeight,
|
|
5376
5427
|
heightFlag: reactData.calcCellHeightFlag,
|
|
5377
5428
|
firstChangedIndex: Infinity,
|
|
5378
5429
|
resizeFlag: reactData.resizeHeightFlag
|
|
@@ -5928,6 +5979,49 @@ const tableMethods: any = {
|
|
|
5928
5979
|
return $xeTable.$nextTick().then(() => loadTableData($xeTable, internalData.tableFullData, true, true))
|
|
5929
5980
|
})
|
|
5930
5981
|
},
|
|
5982
|
+
/** 只改变现有行的展示内容。数据模型或尺寸依赖行值时,沿用完整更新。 */
|
|
5983
|
+
refreshRowContent(rows: any[]) {
|
|
5984
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5985
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5986
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5987
|
+
if (!rows.length) return $xeTable.$nextTick()
|
|
5988
|
+
|
|
5989
|
+
const { fullDataRowIdData, visibleDataRowIdData, tableFullColumn } = internalData
|
|
5990
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
5991
|
+
let hasVisibleRow = false
|
|
5992
|
+
let staleRow = false
|
|
5993
|
+
for (const row of rows) {
|
|
5994
|
+
const id = handleGetRowId(row)
|
|
5995
|
+
const rest = fullDataRowIdData[id]
|
|
5996
|
+
if (rest && rest.row === row) {
|
|
5997
|
+
// formatter 可以读取同一行的其它字段。
|
|
5998
|
+
rest.formatData = undefined
|
|
5999
|
+
if (visibleDataRowIdData[id] === row) {
|
|
6000
|
+
rest.contentVersion = (rest.contentVersion || 0) + 1
|
|
6001
|
+
hasVisibleRow = true
|
|
6002
|
+
}
|
|
6003
|
+
} else {
|
|
6004
|
+
staleRow = true
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
const remoteFilter = $xeTable.computeFilterOpts.remote
|
|
6008
|
+
const remoteSort = $xeTable.computeSortOpts.remote
|
|
6009
|
+
if (staleRow || !reactData.isAllOverflow || internalData.isResizeCellHeight || $xeTable.treeConfig ||
|
|
6010
|
+
reactData.isRowGroupStatus || reactData.expandColumn || $xeTable.showFooter || $xeTable.spanMethod ||
|
|
6011
|
+
internalData.mergeBodyList.length || internalData.xeGanttView || $xeTable.computeAutoWidthColumnList.length ||
|
|
6012
|
+
tableFullColumn.some(column => (!remoteSort && column.sortable && column.order) ||
|
|
6013
|
+
(!remoteFilter && column.filters && column.filters.some(item => item.checked)))) {
|
|
6014
|
+
return $xeTable.updateData()
|
|
6015
|
+
}
|
|
6016
|
+
if (hasVisibleRow) {
|
|
6017
|
+
// 通知使用原始行对象的正文插槽,保持表头、窗口数组和滚动空间稳定。
|
|
6018
|
+
for (const ref of ['refTableBody', 'leftBody', 'rightBody']) {
|
|
6019
|
+
const body = $xeTable.$refs[ref] as Vue | undefined
|
|
6020
|
+
if (body) body.$forceUpdate()
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
return $xeTable.$nextTick()
|
|
6024
|
+
},
|
|
5931
6025
|
/**
|
|
5932
6026
|
* 手动处理数据,用于手动排序与筛选
|
|
5933
6027
|
* 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
|
|
@@ -5960,7 +6054,7 @@ const tableMethods: any = {
|
|
|
5960
6054
|
setTimeout(() => handleLazyRecalculate($xeTable, false, true, true), 50)
|
|
5961
6055
|
})
|
|
5962
6056
|
},
|
|
5963
|
-
handleTableData(force?: boolean, reuseWindow = false) {
|
|
6057
|
+
handleTableData(force?: boolean, reuseWindow = false, reason?: 'sort') {
|
|
5964
6058
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5965
6059
|
const reactData = $xeTable as unknown as TableReactData
|
|
5966
6060
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -5972,7 +6066,7 @@ const tableMethods: any = {
|
|
|
5972
6066
|
// 是否进行数据处理
|
|
5973
6067
|
if (force) {
|
|
5974
6068
|
// 更新数据,处理筛选和排序
|
|
5975
|
-
updateAfterFullData($xeTable)
|
|
6069
|
+
updateAfterFullData($xeTable, reason)
|
|
5976
6070
|
// 如果为虚拟树,将树结构拍平
|
|
5977
6071
|
fullList = handleVirtualTreeToList($xeTable)
|
|
5978
6072
|
// 更新数据后清除合并缓存,涉及分组、筛选、排序等
|
|
@@ -8301,12 +8395,7 @@ const tableMethods: any = {
|
|
|
8301
8395
|
evnt.preventDefault()
|
|
8302
8396
|
const { fullColumnIdData } = internalData
|
|
8303
8397
|
const { column } = params
|
|
8304
|
-
|
|
8305
|
-
if (column.children && column.children.length) {
|
|
8306
|
-
XEUtils.eachTree(column.children, (childColumn) => {
|
|
8307
|
-
resizeColumn = childColumn
|
|
8308
|
-
})
|
|
8309
|
-
}
|
|
8398
|
+
const resizeColumn = getLastChildColumn(column)
|
|
8310
8399
|
const colid = resizeColumn.id
|
|
8311
8400
|
const colRest = fullColumnIdData[colid]
|
|
8312
8401
|
const dragBtnElem = evnt.target as HTMLDivElement
|
|
@@ -12739,7 +12828,7 @@ const tableMethods: any = {
|
|
|
12739
12828
|
})
|
|
12740
12829
|
// 如果是服务端排序,则跳过本地排序处理
|
|
12741
12830
|
if (!remote || (firstSortColumn && firstSortColumn.remoteSort)) {
|
|
12742
|
-
$xeTable.handleTableData(true)
|
|
12831
|
+
$xeTable.handleTableData(true, false, 'sort')
|
|
12743
12832
|
}
|
|
12744
12833
|
return $xeTable.$nextTick().then(() => {
|
|
12745
12834
|
updateRowOffsetTop($xeTable)
|
|
@@ -12777,7 +12866,7 @@ const tableMethods: any = {
|
|
|
12777
12866
|
clearAllSort($xeTable)
|
|
12778
12867
|
}
|
|
12779
12868
|
if (!sortOpts.remote) {
|
|
12780
|
-
$xeTable.handleTableData(true)
|
|
12869
|
+
$xeTable.handleTableData(true, false, 'sort')
|
|
12781
12870
|
}
|
|
12782
12871
|
return $xeTable.$nextTick().then(() => {
|
|
12783
12872
|
updateRowOffsetTop($xeTable)
|
|
@@ -12808,7 +12897,7 @@ const tableMethods: any = {
|
|
|
12808
12897
|
})
|
|
12809
12898
|
}
|
|
12810
12899
|
if (!sortOpts.remote) {
|
|
12811
|
-
$xeTable.handleTableData(true)
|
|
12900
|
+
$xeTable.handleTableData(true, false, 'sort')
|
|
12812
12901
|
}
|
|
12813
12902
|
|
|
12814
12903
|
if (!multiple) {
|
|
@@ -14311,13 +14400,17 @@ const tableMethods: any = {
|
|
|
14311
14400
|
fixed: ''
|
|
14312
14401
|
})
|
|
14313
14402
|
},
|
|
14314
|
-
updateScrollXData() {
|
|
14403
|
+
updateScrollXData(fromScroll = false) {
|
|
14315
14404
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
14316
14405
|
const reactData = $xeTable as unknown as TableReactData
|
|
14317
14406
|
|
|
14318
14407
|
const { isAllOverflow } = reactData
|
|
14408
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
14409
|
+
// 先移动占位和表体,等新列提交后再量 DOM、同步滚动条和固定区。
|
|
14410
|
+
const deferLayout = fromScroll && isAllOverflow && reactData.overflowX && reactData.scrollXWidth < maxXWidth &&
|
|
14411
|
+
!reactData.expandColumn && !internalData.xeGanttView && !$xeTable.computeAutoWidthColumnList.length
|
|
14319
14412
|
handleTableColumn($xeTable)
|
|
14320
|
-
$xeTable.updateScrollXSpace()
|
|
14413
|
+
$xeTable.updateScrollXSpace(deferLayout)
|
|
14321
14414
|
return $xeTable.$nextTick().then(() => {
|
|
14322
14415
|
handleTableColumn($xeTable, true)
|
|
14323
14416
|
$xeTable.updateScrollXSpace()
|
|
@@ -14327,10 +14420,10 @@ const tableMethods: any = {
|
|
|
14327
14420
|
})
|
|
14328
14421
|
},
|
|
14329
14422
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
14330
|
-
updateScrollXSpace() {
|
|
14423
|
+
updateScrollXSpace(beforeWindowCommit = false) {
|
|
14331
14424
|
// 入口只分流一次;关闭时不经过去重函数或逐项样式比较。
|
|
14332
14425
|
if (this.computeVirtualXOpts.experimentalSkipUnchangedStyle === true) {
|
|
14333
|
-
return updateScrollXSpaceWithDedupe(this as VxeTableConstructor & VxeTablePrivateMethods)
|
|
14426
|
+
return updateScrollXSpaceWithDedupe(this as VxeTableConstructor & VxeTablePrivateMethods, beforeWindowCommit)
|
|
14334
14427
|
}
|
|
14335
14428
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
14336
14429
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -14419,6 +14512,7 @@ const tableMethods: any = {
|
|
|
14419
14512
|
scrollXSpaceEl.style.width = `${ySpaceWidth}px`
|
|
14420
14513
|
}
|
|
14421
14514
|
|
|
14515
|
+
if (beforeWindowCommit) return
|
|
14422
14516
|
calcScrollbar($xeTable)
|
|
14423
14517
|
if (isScrollXBig && mouseOpts.area) {
|
|
14424
14518
|
errLog('vxe.error.notProp', ['mouse-config.area'])
|
|
@@ -14476,13 +14570,13 @@ const tableMethods: any = {
|
|
|
14476
14570
|
let sYHeight = scrollYHeight
|
|
14477
14571
|
let isScrollYBig = false
|
|
14478
14572
|
if (scrollYLoad) {
|
|
14479
|
-
const
|
|
14480
|
-
if (
|
|
14481
|
-
sYHeight = afterFullData.length *
|
|
14573
|
+
const uniformHeight = getUniformRowHeight($xeTable)
|
|
14574
|
+
if (uniformHeight) {
|
|
14575
|
+
sYHeight = afterFullData.length * uniformHeight
|
|
14482
14576
|
if (sYHeight > maxYHeight) {
|
|
14483
14577
|
isScrollYBig = true
|
|
14484
14578
|
}
|
|
14485
|
-
ySpaceTop = Math.max(0, startIndex *
|
|
14579
|
+
ySpaceTop = Math.max(0, startIndex * uniformHeight)
|
|
14486
14580
|
} else {
|
|
14487
14581
|
const firstRow = afterFullData[startIndex]
|
|
14488
14582
|
if (firstRow) {
|
|
@@ -14569,7 +14663,7 @@ const tableMethods: any = {
|
|
|
14569
14663
|
const root = $xeTable.$refs.refElem as HTMLDivElement
|
|
14570
14664
|
if (stableSpace && fromScroll && root && bodyScrollElem && (cellOpts.height || rowOpts.height) && internalData.customHeight > 0 &&
|
|
14571
14665
|
!$xeTable.computeAutoWidthColumnList.length && !$xeTable.spanMethod && !internalData.mergeBodyList.length &&
|
|
14572
|
-
!
|
|
14666
|
+
!($xeTable.mouseConfig && mouseOpts.selected)) {
|
|
14573
14667
|
const header = getRefElem(elemStore['main-header-table'])
|
|
14574
14668
|
const footer = getRefElem(elemStore['main-footer-table'])
|
|
14575
14669
|
// 连续滚动中仅复用同一份数据、列和视口对应的布局。换窗后的表体高度随可见行数变化,不参与比较。
|
|
@@ -14582,6 +14676,9 @@ const tableMethods: any = {
|
|
|
14582
14676
|
]
|
|
14583
14677
|
const previous = scrollYWindowLayouts.get($xeTable)
|
|
14584
14678
|
if (previous && layout.every((value, index) => value === previous[index])) {
|
|
14679
|
+
if (internalData.currentRow && !$xeTable.rowKey && !rowOpts.useKey) {
|
|
14680
|
+
syncReusedCurrentRows($xeTable, root, internalData.currentRow)
|
|
14681
|
+
}
|
|
14585
14682
|
reactData.scrollYTop = scrollYTop
|
|
14586
14683
|
return
|
|
14587
14684
|
}
|
|
@@ -1461,29 +1461,21 @@ export default {
|
|
|
1461
1461
|
const props = $xeTable
|
|
1462
1462
|
const reactData = $xeTable as unknown as TableReactData
|
|
1463
1463
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
if (spanMethod || footerSpanMethod) {
|
|
1473
|
-
// 如果不支持优化模式
|
|
1474
|
-
} else {
|
|
1475
|
-
isOptimizeMode = true
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
return isOptimizeMode
|
|
1464
|
+
if (!reactData.scrollXLoad || !props.showHeaderOverflow || props.spanMethod || props.footerSpanMethod) return false
|
|
1465
|
+
if (!reactData.isGroup) return true
|
|
1466
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1467
|
+
return !!(reactData.overflowX && !props.showCustomHeader && !props.headerRowStyle && !props.headerCellStyle &&
|
|
1468
|
+
!$xeTable.computeColumnOpts.drag && !$xeTable.computeMouseOpts.area &&
|
|
1469
|
+
!(reactData.mergeHeadFlag && internalData.mergeHeaderList.length) &&
|
|
1470
|
+
!XEUtils.findTree(reactData.tableGroupColumn, column => column.visible &&
|
|
1471
|
+
(column.showHeaderOverflow === false || column.width === 'auto' || column.minWidth === 'auto')))
|
|
1480
1472
|
},
|
|
1481
1473
|
computeIsBodyRenderOptimize() {
|
|
1482
1474
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1483
1475
|
const props = $xeTable
|
|
1484
1476
|
const reactData = $xeTable as unknown as TableReactData
|
|
1485
1477
|
|
|
1486
|
-
const { spanMethod
|
|
1478
|
+
const { spanMethod } = props
|
|
1487
1479
|
const { scrollXLoad, scrollYLoad, isAllOverflow, expandColumn } = reactData
|
|
1488
1480
|
const bodyMergeCoverFixed = $xeTable.computeBodyMergeCoverFixed
|
|
1489
1481
|
const expandOpts = $xeTable.computeExpandOpts
|
|
@@ -1493,7 +1485,7 @@ export default {
|
|
|
1493
1485
|
// 如果是展开行,内联模式,不支持优化
|
|
1494
1486
|
// 如果是方法合并,不支持优化
|
|
1495
1487
|
// 如果固定列且配置式合并,不支持优化
|
|
1496
|
-
if ((expandColumn && expandOpts.mode !== 'fixed') || bodyMergeCoverFixed || spanMethod
|
|
1488
|
+
if ((expandColumn && expandOpts.mode !== 'fixed') || bodyMergeCoverFixed || spanMethod) {
|
|
1497
1489
|
// 如果不支持优化模式
|
|
1498
1490
|
} else {
|
|
1499
1491
|
isOptimizeMode = true
|
|
@@ -782,7 +782,7 @@ export function handleRowidOrRow($xeTable: VxeTableConstructor, rowidOrRow: any)
|
|
|
782
782
|
return null
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
export function getCellRestHeight(rowRest: VxeTableDefines.RowCacheItem, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
785
|
+
export function getCellRestHeight(rowRest: Pick<VxeTableDefines.RowCacheItem, 'height' | 'resizeHeight'>, cellOpts: VxeTablePropTypes.CellConfig, rowOpts: VxeTablePropTypes.RowConfig, defaultRowHeight: number) {
|
|
786
786
|
const { height, minHeight, maxHeight } = cellOpts
|
|
787
787
|
let cellHeight = rowRest.resizeHeight || height || rowOpts.height || rowRest.height || defaultRowHeight
|
|
788
788
|
if (maxHeight && maxHeight <= cellHeight) {
|
|
@@ -794,6 +794,17 @@ export function getCellRestHeight(rowRest: VxeTableDefines.RowCacheItem, cellOpt
|
|
|
794
794
|
return cellHeight
|
|
795
795
|
}
|
|
796
796
|
|
|
797
|
+
// 浏览器滚动条超过该高度时按比例映射到逻辑行坐标。
|
|
798
|
+
export const maxYHeight = 5e6
|
|
799
|
+
|
|
800
|
+
export function getUniformRowHeight($xeTable: VxeTableConstructor) {
|
|
801
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
802
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
803
|
+
if (!reactData.isAllOverflow || reactData.expandColumn || internalData.isResizeCellHeight) return 0
|
|
804
|
+
const height = getCellRestHeight({ height: 0, resizeHeight: 0 }, $xeTable.computeCellOpts, $xeTable.computeRowOpts, $xeTable.computeDefaultRowHeight)
|
|
805
|
+
return Number.isFinite(height) && height > 0 ? height : 0
|
|
806
|
+
}
|
|
807
|
+
|
|
797
808
|
// 组装列配置
|
|
798
809
|
export function assembleColumn(_vm: any) {
|
|
799
810
|
const $xeTable = _vm.$xeTable as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -965,8 +976,10 @@ export function getFirstChildColumn(column: VxeTableDefines.ColumnInfo): VxeTabl
|
|
|
965
976
|
|
|
966
977
|
export function getLastChildColumn(column: VxeTableDefines.ColumnInfo): VxeTableDefines.ColumnInfo {
|
|
967
978
|
const { children } = column
|
|
968
|
-
if (children
|
|
969
|
-
|
|
979
|
+
if (children) {
|
|
980
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
981
|
+
if (children[i].visible !== false) return getLastChildColumn(children[i])
|
|
982
|
+
}
|
|
970
983
|
}
|
|
971
984
|
return column
|
|
972
985
|
}
|
|
@@ -1054,8 +1067,8 @@ export function rowToVisible($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
1054
1067
|
const reactData = $xeTable as unknown as TableReactData
|
|
1055
1068
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1056
1069
|
|
|
1057
|
-
const { scrollYLoad, scrollYTop,
|
|
1058
|
-
const { elemStore, afterFullData, fullAllDataRowIdData
|
|
1070
|
+
const { scrollYLoad, scrollYTop, isScrollYBig, scrollYHeight } = reactData
|
|
1071
|
+
const { elemStore, afterFullData, fullAllDataRowIdData } = internalData
|
|
1059
1072
|
const rowOpts = $xeTable.computeRowOpts
|
|
1060
1073
|
const cellOpts = $xeTable.computeCellOpts
|
|
1061
1074
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
@@ -1079,17 +1092,21 @@ export function rowToVisible($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
1079
1092
|
} else {
|
|
1080
1093
|
// 如果是虚拟渲染滚动
|
|
1081
1094
|
if (scrollYLoad) {
|
|
1082
|
-
const
|
|
1083
|
-
if (!
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1095
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
1096
|
+
if (!rowRest) return Promise.resolve()
|
|
1097
|
+
const uniformHeight = getUniformRowHeight($xeTable)
|
|
1098
|
+
const rHeight = uniformHeight || getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight)
|
|
1099
|
+
const index = rowRest._index
|
|
1100
|
+
if (uniformHeight && afterFullData[index] !== rowRest.row) return Promise.resolve()
|
|
1101
|
+
const rowTop = uniformHeight ? index * rHeight : rowRest.oTop
|
|
1102
|
+
const scale = isScrollYBig ? (maxYHeight - bodyHeight) / (scrollYHeight - bodyHeight) : 1
|
|
1103
|
+
let target = rowTop + rHeight - (bodyHeight - rightFixedWidth - 1)
|
|
1104
|
+
if (uniformHeight && !cellOpts.height && !rowOpts.height) {
|
|
1105
|
+
target = rowTop - rHeight
|
|
1106
|
+
} else if (rowTop < bodyScrollTop / scale) {
|
|
1107
|
+
target = rowTop - leftFixedWidth - 1
|
|
1091
1108
|
}
|
|
1092
|
-
return $xeTable.scrollTo(null,
|
|
1109
|
+
return $xeTable.scrollTo(null, isScrollYBig ? Math.round(target * scale) : target)
|
|
1093
1110
|
}
|
|
1094
1111
|
}
|
|
1095
1112
|
}
|