vxe-table 3.11.4 → 3.11.6-beta.0
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/index.css +1 -0
- package/es/index.min.css +1 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/filter/mixin.js +23 -2
- package/es/table/module/filter/panel.js +3 -6
- package/es/table/src/body.js +55 -30
- package/es/table/src/footer.js +30 -22
- package/es/table/src/methods.js +253 -109
- package/es/table/src/table.js +11 -3
- package/es/table/style.css +48 -3
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +48 -3
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -0
- package/lib/index.min.css +1 -0
- package/lib/index.umd.js +436 -196
- 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/filter/mixin.js +25 -2
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +3 -7
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/src/body.js +65 -32
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +32 -23
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/methods.js +293 -127
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +16 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +48 -3
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +2 -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 +48 -3
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/filter/mixin.ts +26 -2
- package/packages/table/module/filter/panel.ts +3 -6
- package/packages/table/src/body.ts +66 -27
- package/packages/table/src/footer.ts +33 -21
- package/packages/table/src/methods.ts +266 -112
- package/packages/table/src/table.ts +11 -3
- package/packages/ui/index.ts +1 -1
- package/packages/ui/src/dom.ts +2 -2
- package/styles/components/table.scss +38 -3
- /package/es/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
- /package/es/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
- /package/es/{iconfont.1732091003142.woff2 → iconfont.1732505453169.woff2} +0 -0
- /package/lib/{iconfont.1732091003142.ttf → iconfont.1732505453169.ttf} +0 -0
- /package/lib/{iconfont.1732091003142.woff → iconfont.1732505453169.woff} +0 -0
- /package/lib/{iconfont.1732091003142.woff2 → iconfont.1732505453169.woff2} +0 -0
|
@@ -11,8 +11,8 @@ import type { VxeTableDefines, VxeTableEmits, ValueOf } from '../../../types'
|
|
|
11
11
|
|
|
12
12
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI
|
|
13
13
|
|
|
14
|
-
const isWebkit = browse['-webkit'] && !browse.edge
|
|
15
|
-
const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
14
|
+
// const isWebkit = browse['-webkit'] && !browse.edge
|
|
15
|
+
// const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
16
16
|
|
|
17
17
|
const customStorageKey = 'VXE_CUSTOM_STORE'
|
|
18
18
|
|
|
@@ -109,25 +109,29 @@ function handleVirtualXVisible (_vm: any) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const computeRowHeight = ($xeTable: any) => {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const
|
|
112
|
+
const props = $xeTable
|
|
113
|
+
|
|
114
|
+
const { showOverflow } = props
|
|
115
|
+
const tableHeader = $xeTable.$refs.tableHeader
|
|
116
|
+
const tableBody = $xeTable.$refs.tableBody
|
|
115
117
|
const tableBodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
116
|
-
const vSize = computeSize
|
|
118
|
+
const vSize = $xeTable.computeSize
|
|
117
119
|
const rowHeightMaps = $xeTable.rowHeightMaps
|
|
118
120
|
let rowHeight = 0
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
firstTrElem
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
rowHeight
|
|
121
|
+
if (showOverflow) {
|
|
122
|
+
if (tableBodyElem) {
|
|
123
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
124
|
+
let firstTrElem
|
|
125
|
+
firstTrElem = tableBodyElem.querySelector('tr')
|
|
126
|
+
if (!firstTrElem && tableHeaderElem) {
|
|
127
|
+
firstTrElem = tableHeaderElem.querySelector('tr')
|
|
128
|
+
}
|
|
129
|
+
if (firstTrElem) {
|
|
130
|
+
rowHeight = firstTrElem.clientHeight
|
|
131
|
+
}
|
|
132
|
+
if (!rowHeight) {
|
|
133
|
+
rowHeight = rowHeightMaps[vSize || 'default']
|
|
134
|
+
}
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
return rowHeight
|
|
@@ -289,20 +293,43 @@ function calcTableHeight (_vm: any, key: 'height' | 'minHeight' | 'maxHeight') {
|
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
const calcCellHeight = ($xeTable: any) => {
|
|
292
|
-
const
|
|
296
|
+
const props = $xeTable
|
|
297
|
+
const reactData = $xeTable
|
|
298
|
+
const internalData = $xeTable
|
|
299
|
+
|
|
300
|
+
const { showOverflow } = props
|
|
301
|
+
const { tableData, scrollXLoad, scrollYLoad } = reactData
|
|
302
|
+
const { fullAllDataRowIdData } = internalData
|
|
293
303
|
const el = $xeTable.$el
|
|
294
|
-
if (scrollYLoad && el) {
|
|
304
|
+
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
305
|
+
let paddingTop = 0
|
|
306
|
+
let paddingBottom = 0
|
|
307
|
+
let calcPadding = false
|
|
295
308
|
tableData.forEach((row: any) => {
|
|
296
309
|
const rowid = getRowid($xeTable, row)
|
|
297
|
-
const
|
|
310
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
298
311
|
const trList = el.querySelectorAll(`.vxe-body--row[rowid="${rowid}"]`)
|
|
299
|
-
if (
|
|
312
|
+
if (rowRest && trList.length) {
|
|
300
313
|
let height = 0
|
|
301
314
|
for (let i = 0; i < trList.length; i++) {
|
|
302
315
|
const trEl = trList[i] as HTMLTableRowElement
|
|
303
|
-
|
|
316
|
+
const tdList = trEl.children
|
|
317
|
+
for (let j = 0; j < tdList.length; j++) {
|
|
318
|
+
const tdEl = tdList[j]
|
|
319
|
+
const cellElem = tdEl.querySelector('.vxe-cell') as HTMLDivElement
|
|
320
|
+
if (!calcPadding) {
|
|
321
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop)
|
|
322
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom)
|
|
323
|
+
calcPadding = true
|
|
324
|
+
}
|
|
325
|
+
let cellHeight = paddingTop + paddingBottom
|
|
326
|
+
if (cellElem) {
|
|
327
|
+
cellHeight += cellElem.offsetHeight
|
|
328
|
+
}
|
|
329
|
+
height = Math.max(height, cellHeight)
|
|
330
|
+
}
|
|
304
331
|
}
|
|
305
|
-
|
|
332
|
+
rowRest.height = height
|
|
306
333
|
}
|
|
307
334
|
})
|
|
308
335
|
}
|
|
@@ -476,6 +503,51 @@ const handleScrollToRowColumn = ($xeTable: any, fieldOrColumn: string | VxeTable
|
|
|
476
503
|
return $xeTable.$nextTick()
|
|
477
504
|
}
|
|
478
505
|
|
|
506
|
+
function handleRecalculateLayout ($xeTable: any, reFull: boolean) {
|
|
507
|
+
const el = $xeTable.$refs.refElem
|
|
508
|
+
if (!el || !el.clientWidth) {
|
|
509
|
+
return $xeTable.$nextTick()
|
|
510
|
+
}
|
|
511
|
+
calcCellHeight($xeTable)
|
|
512
|
+
$xeTable.calcCellWidth()
|
|
513
|
+
$xeTable.autoCellWidth()
|
|
514
|
+
if (reFull === true) {
|
|
515
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
516
|
+
return $xeTable.computeScrollLoad().then(() => {
|
|
517
|
+
calcCellHeight($xeTable)
|
|
518
|
+
$xeTable.calcCellWidth()
|
|
519
|
+
$xeTable.autoCellWidth()
|
|
520
|
+
return $xeTable.computeScrollLoad()
|
|
521
|
+
})
|
|
522
|
+
}
|
|
523
|
+
return $xeTable.computeScrollLoad()
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function checkLastSyncScroll ($xeTable: any, isRollX: boolean, isRollY: boolean) {
|
|
527
|
+
const reactData = $xeTable
|
|
528
|
+
const internalData = $xeTable
|
|
529
|
+
|
|
530
|
+
const { scrollXLoad, scrollYLoad } = reactData
|
|
531
|
+
const { lcsTimeout } = internalData
|
|
532
|
+
if (lcsTimeout) {
|
|
533
|
+
clearTimeout(lcsTimeout)
|
|
534
|
+
}
|
|
535
|
+
internalData.lcsTimeout = setTimeout(() => {
|
|
536
|
+
internalData.lcsTimeout = undefined
|
|
537
|
+
internalData.inVirtualScroll = false
|
|
538
|
+
internalData.inBodyScroll = false
|
|
539
|
+
internalData.bodyScrollType = ''
|
|
540
|
+
internalData.inFooterScroll = false
|
|
541
|
+
if (isRollX && scrollXLoad) {
|
|
542
|
+
$xeTable.updateScrollXData()
|
|
543
|
+
}
|
|
544
|
+
if (isRollY && scrollYLoad) {
|
|
545
|
+
$xeTable.updateScrollYData()
|
|
546
|
+
}
|
|
547
|
+
$xeTable.updateCellAreas()
|
|
548
|
+
}, 200)
|
|
549
|
+
}
|
|
550
|
+
|
|
479
551
|
const Methods = {
|
|
480
552
|
callSlot (slotFunc: any, params: any, h: any, vNodes: any) {
|
|
481
553
|
if (slotFunc) {
|
|
@@ -2435,22 +2507,21 @@ const Methods = {
|
|
|
2435
2507
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2436
2508
|
*/
|
|
2437
2509
|
recalculate (reFull?: boolean) {
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2447
|
-
return this.computeScrollLoad().then(() => {
|
|
2448
|
-
calcCellHeight(this)
|
|
2449
|
-
this.autoCellWidth()
|
|
2450
|
-
return this.computeScrollLoad()
|
|
2451
|
-
})
|
|
2510
|
+
const $xeTable = this
|
|
2511
|
+
const internalData = $xeTable
|
|
2512
|
+
|
|
2513
|
+
const { rceTimeout } = internalData
|
|
2514
|
+
if (rceTimeout) {
|
|
2515
|
+
clearTimeout(rceTimeout)
|
|
2516
|
+
} else {
|
|
2517
|
+
handleRecalculateLayout($xeTable, !!reFull)
|
|
2452
2518
|
}
|
|
2453
|
-
return
|
|
2519
|
+
return new Promise(resolve => {
|
|
2520
|
+
internalData.rceTimeout = setTimeout(() => {
|
|
2521
|
+
internalData.rceTimeout = undefined
|
|
2522
|
+
resolve(handleRecalculateLayout($xeTable, !!reFull))
|
|
2523
|
+
}, 20)
|
|
2524
|
+
})
|
|
2454
2525
|
},
|
|
2455
2526
|
calcCellWidth () {
|
|
2456
2527
|
const $xeTable = this
|
|
@@ -2643,13 +2714,18 @@ const Methods = {
|
|
|
2643
2714
|
},
|
|
2644
2715
|
calcCellHeight () {
|
|
2645
2716
|
const $xeTable = this
|
|
2717
|
+
const props = $xeTable
|
|
2646
2718
|
const reactData = $xeTable
|
|
2647
2719
|
const internalData = $xeTable
|
|
2648
2720
|
|
|
2649
|
-
const {
|
|
2721
|
+
const { showOverflow } = props
|
|
2722
|
+
const { tableData, scrollXLoad, scrollYLoad } = reactData
|
|
2650
2723
|
const { fullAllDataRowIdData } = internalData
|
|
2651
2724
|
const el = $xeTable.$el
|
|
2652
|
-
if (scrollYLoad && el) {
|
|
2725
|
+
if (!showOverflow && (scrollXLoad || scrollYLoad) && el) {
|
|
2726
|
+
let paddingTop = 0
|
|
2727
|
+
let paddingBottom = 0
|
|
2728
|
+
let calcPadding = false
|
|
2653
2729
|
tableData.forEach((row: any) => {
|
|
2654
2730
|
const rowid = getRowid($xeTable, row)
|
|
2655
2731
|
const rowRest = fullAllDataRowIdData[rowid]
|
|
@@ -2658,7 +2734,21 @@ const Methods = {
|
|
|
2658
2734
|
let height = 0
|
|
2659
2735
|
for (let i = 0; i < trList.length; i++) {
|
|
2660
2736
|
const trEl = trList[i] as HTMLTableRowElement
|
|
2661
|
-
|
|
2737
|
+
const tdList = trEl.children
|
|
2738
|
+
for (let j = 0; j < tdList.length; j++) {
|
|
2739
|
+
const tdEl = tdList[j]
|
|
2740
|
+
const cellElem = tdEl.querySelector('.vxe-cell') as HTMLDivElement
|
|
2741
|
+
if (!calcPadding) {
|
|
2742
|
+
paddingTop = XEUtils.toNumber(getComputedStyle(tdEl).paddingTop)
|
|
2743
|
+
paddingBottom = XEUtils.toNumber(getComputedStyle(tdEl).paddingBottom)
|
|
2744
|
+
calcPadding = true
|
|
2745
|
+
}
|
|
2746
|
+
let cellHeight = paddingTop + paddingBottom
|
|
2747
|
+
if (cellElem) {
|
|
2748
|
+
cellHeight += cellElem.offsetHeight
|
|
2749
|
+
}
|
|
2750
|
+
height = Math.max(height, cellHeight)
|
|
2751
|
+
}
|
|
2662
2752
|
}
|
|
2663
2753
|
rowRest.height = height
|
|
2664
2754
|
}
|
|
@@ -5890,16 +5980,15 @@ const Methods = {
|
|
|
5890
5980
|
scrollLeft: bodyElem.scrollLeft
|
|
5891
5981
|
}
|
|
5892
5982
|
},
|
|
5893
|
-
/**
|
|
5894
|
-
* 横向 X 可视渲染事件处理
|
|
5895
|
-
*/
|
|
5896
|
-
triggerScrollXEvent () {
|
|
5897
|
-
this.loadScrollXData()
|
|
5898
|
-
},
|
|
5899
5983
|
loadScrollXData () {
|
|
5900
|
-
const
|
|
5984
|
+
const $xeTable = this
|
|
5985
|
+
const reactData = $xeTable
|
|
5986
|
+
const internalData = $xeTable
|
|
5987
|
+
|
|
5988
|
+
const { mergeList, mergeFooterList } = reactData
|
|
5989
|
+
const { scrollXStore } = internalData
|
|
5901
5990
|
const { startIndex, endIndex, offsetSize } = scrollXStore
|
|
5902
|
-
const { toVisibleIndex, visibleSize } = handleVirtualXVisible(
|
|
5991
|
+
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable)
|
|
5903
5992
|
const offsetItem = {
|
|
5904
5993
|
startIndex: Math.max(0, toVisibleIndex - 1 - offsetSize),
|
|
5905
5994
|
endIndex: toVisibleIndex + visibleSize + offsetSize
|
|
@@ -5910,10 +5999,10 @@ const Methods = {
|
|
|
5910
5999
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
5911
6000
|
scrollXStore.startIndex = offsetStartIndex
|
|
5912
6001
|
scrollXStore.endIndex = offsetEndIndex
|
|
5913
|
-
|
|
6002
|
+
$xeTable.updateScrollXData()
|
|
5914
6003
|
}
|
|
5915
6004
|
}
|
|
5916
|
-
|
|
6005
|
+
$xeTable.closeTooltip()
|
|
5917
6006
|
},
|
|
5918
6007
|
handleScrollEvent (evnt: Event, isRollY: boolean, isRollX: boolean, scrollTop: number, scrollLeft: number, params: any) {
|
|
5919
6008
|
const $xeTable = this
|
|
@@ -5960,7 +6049,6 @@ const Methods = {
|
|
|
5960
6049
|
}
|
|
5961
6050
|
$xeTable.checkScrolling()
|
|
5962
6051
|
internalData.lastScrollLeft = scrollLeft
|
|
5963
|
-
reactData.lastScrollTime = Date.now()
|
|
5964
6052
|
} else {
|
|
5965
6053
|
const yThreshold = $xeTable.computeScrollYThreshold
|
|
5966
6054
|
isTop = scrollTop <= 0
|
|
@@ -5979,8 +6067,8 @@ const Methods = {
|
|
|
5979
6067
|
}
|
|
5980
6068
|
}
|
|
5981
6069
|
internalData.lastScrollTop = scrollTop
|
|
5982
|
-
reactData.lastScrollTime = Date.now()
|
|
5983
6070
|
}
|
|
6071
|
+
reactData.lastScrollTime = Date.now()
|
|
5984
6072
|
const evntParams = {
|
|
5985
6073
|
scrollTop,
|
|
5986
6074
|
scrollLeft,
|
|
@@ -5997,6 +6085,7 @@ const Methods = {
|
|
|
5997
6085
|
direction,
|
|
5998
6086
|
...params
|
|
5999
6087
|
}
|
|
6088
|
+
checkLastSyncScroll($xeTable, isRollX, isRollY)
|
|
6000
6089
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
6001
6090
|
$xeTable.clearHoverRow()
|
|
6002
6091
|
}
|
|
@@ -6012,74 +6101,129 @@ const Methods = {
|
|
|
6012
6101
|
}
|
|
6013
6102
|
$xeTable.dispatchEvent('scroll', evntParams, evnt)
|
|
6014
6103
|
},
|
|
6104
|
+
lazyScrollXData () {
|
|
6105
|
+
const $xeTable = this
|
|
6106
|
+
const internalData = $xeTable
|
|
6107
|
+
|
|
6108
|
+
const { lxTimeout, lxRunTime, scrollXStore } = internalData
|
|
6109
|
+
const { visibleSize } = scrollXStore
|
|
6110
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 3))
|
|
6111
|
+
if (lxTimeout) {
|
|
6112
|
+
clearTimeout(lxTimeout)
|
|
6113
|
+
}
|
|
6114
|
+
if (!lxRunTime || lxRunTime + fpsTime < Date.now()) {
|
|
6115
|
+
internalData.lxRunTime = Date.now()
|
|
6116
|
+
$xeTable.loadScrollXData()
|
|
6117
|
+
}
|
|
6118
|
+
internalData.lxTimeout = setTimeout(() => {
|
|
6119
|
+
internalData.lxRunTime = undefined
|
|
6120
|
+
internalData.lxRunTime = undefined
|
|
6121
|
+
$xeTable.loadScrollXData()
|
|
6122
|
+
}, fpsTime)
|
|
6123
|
+
},
|
|
6124
|
+
lazyScrollYData () {
|
|
6125
|
+
const $xeTable = this
|
|
6126
|
+
const internalData = $xeTable
|
|
6127
|
+
|
|
6128
|
+
const { lyTimeout, lyRunTime, scrollYStore } = internalData
|
|
6129
|
+
const { visibleSize } = scrollYStore
|
|
6130
|
+
const fpsTime = Math.min(80, Math.floor(visibleSize * 2))
|
|
6131
|
+
if (lyTimeout) {
|
|
6132
|
+
clearTimeout(lyTimeout)
|
|
6133
|
+
}
|
|
6134
|
+
if (!lyRunTime || lyRunTime + fpsTime < Date.now()) {
|
|
6135
|
+
internalData.lyRunTime = Date.now()
|
|
6136
|
+
$xeTable.loadScrollYData()
|
|
6137
|
+
}
|
|
6138
|
+
internalData.lyTimeout = setTimeout(() => {
|
|
6139
|
+
internalData.lyTimeout = undefined
|
|
6140
|
+
internalData.lyRunTime = undefined
|
|
6141
|
+
$xeTable.loadScrollYData()
|
|
6142
|
+
}, fpsTime)
|
|
6143
|
+
},
|
|
6144
|
+
/**
|
|
6145
|
+
* 横向 X 可视渲染事件处理
|
|
6146
|
+
*/
|
|
6147
|
+
triggerScrollXEvent () {
|
|
6148
|
+
const $xeTable = this
|
|
6149
|
+
|
|
6150
|
+
const sXOpts = $xeTable.computeSXOpts
|
|
6151
|
+
if (sXOpts.immediate) {
|
|
6152
|
+
$xeTable.loadScrollXData()
|
|
6153
|
+
} else {
|
|
6154
|
+
$xeTable.lazyScrollXData()
|
|
6155
|
+
}
|
|
6156
|
+
},
|
|
6015
6157
|
/**
|
|
6016
6158
|
* 纵向 Y 可视渲染事件处理
|
|
6017
6159
|
*/
|
|
6018
6160
|
triggerScrollYEvent () {
|
|
6019
|
-
const
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
if (
|
|
6023
|
-
|
|
6161
|
+
const $xeTable = this
|
|
6162
|
+
|
|
6163
|
+
const sYOpts = $xeTable.computeSYOpts
|
|
6164
|
+
if (sYOpts.immediate) {
|
|
6165
|
+
$xeTable.loadScrollYData()
|
|
6024
6166
|
} else {
|
|
6025
|
-
|
|
6167
|
+
$xeTable.lazyScrollYData()
|
|
6026
6168
|
}
|
|
6027
|
-
this.debounceScrollYCalculate()
|
|
6028
6169
|
},
|
|
6029
|
-
|
|
6030
|
-
this.loadScrollYData()
|
|
6031
|
-
}, debounceScrollYDuration, { leading: false, trailing: true }),
|
|
6032
|
-
handleSyncScrollX (scrollLeft: number) {
|
|
6170
|
+
scrollXEvent (evnt: Event) {
|
|
6033
6171
|
const $xeTable = this
|
|
6172
|
+
const internalData = $xeTable
|
|
6034
6173
|
|
|
6174
|
+
const { inFooterScroll, inBodyScroll } = internalData
|
|
6175
|
+
if (inFooterScroll) {
|
|
6176
|
+
return
|
|
6177
|
+
}
|
|
6178
|
+
if (inBodyScroll) {
|
|
6179
|
+
return
|
|
6180
|
+
}
|
|
6035
6181
|
const tableHeader = $xeTable.$refs.tableHeader
|
|
6036
6182
|
const tableBody = $xeTable.$refs.tableBody
|
|
6037
6183
|
const tableFooter = $xeTable.$refs.tableFooter
|
|
6038
6184
|
const bodyElem = tableBody.$el as HTMLDivElement
|
|
6039
6185
|
const headerElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
6040
6186
|
const footerElem = tableFooter ? tableFooter.$el as HTMLDivElement : null
|
|
6041
|
-
setScrollLeft(bodyElem, scrollLeft)
|
|
6042
|
-
setScrollLeft(headerElem, scrollLeft)
|
|
6043
|
-
setScrollLeft(footerElem, scrollLeft)
|
|
6044
|
-
},
|
|
6045
|
-
scrollXEvent (evnt: Event) {
|
|
6046
|
-
const $xeTable = this
|
|
6047
|
-
|
|
6048
6187
|
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
6049
6188
|
const { scrollTop, scrollLeft } = wrapperEl
|
|
6050
6189
|
const isRollX = true
|
|
6051
6190
|
const isRollY = false
|
|
6052
|
-
|
|
6191
|
+
internalData.inVirtualScroll = true
|
|
6192
|
+
setScrollLeft(bodyElem, scrollLeft)
|
|
6193
|
+
setScrollLeft(headerElem, scrollLeft)
|
|
6194
|
+
setScrollLeft(footerElem, scrollLeft)
|
|
6053
6195
|
$xeTable.triggerScrollXEvent(evnt)
|
|
6054
6196
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6055
6197
|
type: 'table',
|
|
6056
6198
|
fixed: ''
|
|
6057
6199
|
})
|
|
6058
6200
|
},
|
|
6059
|
-
|
|
6060
|
-
this.updateScrollYSpace()
|
|
6061
|
-
}, 1000, { leading: false, trailing: true }),
|
|
6062
|
-
handleSyncScrollY (scrollTop: number) {
|
|
6201
|
+
scrollYEvent (evnt: Event) {
|
|
6063
6202
|
const $xeTable = this
|
|
6203
|
+
const internalData = $xeTable
|
|
6064
6204
|
|
|
6205
|
+
const { inFooterScroll, inBodyScroll } = internalData
|
|
6206
|
+
if (inFooterScroll) {
|
|
6207
|
+
return
|
|
6208
|
+
}
|
|
6209
|
+
if (inBodyScroll) {
|
|
6210
|
+
return
|
|
6211
|
+
}
|
|
6065
6212
|
const tableBody = $xeTable.$refs.tableBody
|
|
6066
6213
|
const leftBody = $xeTable.$refs.leftBody
|
|
6067
6214
|
const rightBody = $xeTable.$refs.rightBody
|
|
6068
6215
|
const bodyElem = tableBody.$el as HTMLDivElement
|
|
6069
6216
|
const leftElem = leftBody ? leftBody.$el as HTMLDivElement : null
|
|
6070
6217
|
const rightElem = rightBody ? rightBody.$el as HTMLDivElement : null
|
|
6071
|
-
setScrollTop(bodyElem, scrollTop)
|
|
6072
|
-
setScrollTop(leftElem, scrollTop)
|
|
6073
|
-
setScrollTop(rightElem, scrollTop)
|
|
6074
|
-
},
|
|
6075
|
-
scrollYEvent (evnt: Event) {
|
|
6076
|
-
const $xeTable = this
|
|
6077
|
-
|
|
6078
6218
|
const wrapperEl = evnt.currentTarget as HTMLDivElement
|
|
6079
6219
|
const { scrollTop, scrollLeft } = wrapperEl
|
|
6080
6220
|
const isRollX = false
|
|
6081
6221
|
const isRollY = true
|
|
6082
|
-
|
|
6222
|
+
|
|
6223
|
+
internalData.inVirtualScroll = true
|
|
6224
|
+
setScrollTop(bodyElem, scrollTop)
|
|
6225
|
+
setScrollTop(leftElem, scrollTop)
|
|
6226
|
+
setScrollTop(rightElem, scrollTop)
|
|
6083
6227
|
$xeTable.triggerScrollYEvent(evnt)
|
|
6084
6228
|
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
6085
6229
|
type: 'table',
|
|
@@ -6090,12 +6234,20 @@ const Methods = {
|
|
|
6090
6234
|
* 纵向 Y 可视渲染处理
|
|
6091
6235
|
*/
|
|
6092
6236
|
loadScrollYData () {
|
|
6093
|
-
const
|
|
6237
|
+
const $xeTable = this
|
|
6238
|
+
const props = $xeTable
|
|
6239
|
+
const reactData = $xeTable
|
|
6240
|
+
const internalData = $xeTable
|
|
6241
|
+
|
|
6242
|
+
const { showOverflow } = props
|
|
6243
|
+
const { mergeList } = reactData
|
|
6244
|
+
const { tableHeight, scrollYStore } = internalData
|
|
6094
6245
|
const { startIndex, endIndex, offsetSize } = scrollYStore
|
|
6095
|
-
const
|
|
6246
|
+
const offsetYSize = showOverflow ? offsetSize : offsetSize + Math.min(8, Math.ceil(tableHeight / 200))
|
|
6247
|
+
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable)
|
|
6096
6248
|
const offsetItem = {
|
|
6097
|
-
startIndex: Math.max(0, toVisibleIndex - 1 -
|
|
6098
|
-
endIndex: toVisibleIndex + visibleSize +
|
|
6249
|
+
startIndex: Math.max(0, toVisibleIndex - 1 - offsetYSize),
|
|
6250
|
+
endIndex: toVisibleIndex + visibleSize + offsetYSize
|
|
6099
6251
|
}
|
|
6100
6252
|
calculateMergerOffsetIndex(mergeList, offsetItem, 'row')
|
|
6101
6253
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
|
|
@@ -6103,49 +6255,43 @@ const Methods = {
|
|
|
6103
6255
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6104
6256
|
scrollYStore.startIndex = offsetStartIndex
|
|
6105
6257
|
scrollYStore.endIndex = offsetEndIndex
|
|
6106
|
-
|
|
6258
|
+
$xeTable.updateScrollYData()
|
|
6107
6259
|
}
|
|
6108
6260
|
}
|
|
6109
6261
|
},
|
|
6110
6262
|
// 计算可视渲染相关数据
|
|
6111
6263
|
computeScrollLoad () {
|
|
6112
6264
|
const $xeTable = this
|
|
6113
|
-
const props = $xeTable
|
|
6114
6265
|
|
|
6115
6266
|
return this.$nextTick().then(() => {
|
|
6116
|
-
const { showOverflow } = props
|
|
6117
6267
|
const { sYOpts, sXOpts, scrollXLoad, scrollYLoad, scrollXStore, scrollYStore } = this
|
|
6118
6268
|
// 计算 X 逻辑
|
|
6119
6269
|
if (scrollXLoad) {
|
|
6120
|
-
const { visibleSize: visibleXSize } = handleVirtualXVisible(
|
|
6121
|
-
|
|
6122
|
-
const bufferSize = showOverflow ? 0 : 2
|
|
6123
|
-
const offsetXSize = Math.max(bufferSize, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : browse.msie ? 10 : (browse.edge ? 5 : 0))
|
|
6270
|
+
const { visibleSize: visibleXSize } = handleVirtualXVisible($xeTable)
|
|
6271
|
+
const offsetXSize = Math.max(0, sXOpts.oSize ? XEUtils.toNumber(sXOpts.oSize) : (browse.edge ? 5 : 0))
|
|
6124
6272
|
scrollXStore.offsetSize = offsetXSize
|
|
6125
6273
|
scrollXStore.visibleSize = visibleXSize
|
|
6126
6274
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex)
|
|
6127
|
-
|
|
6275
|
+
$xeTable.updateScrollXData()
|
|
6128
6276
|
} else {
|
|
6129
|
-
|
|
6277
|
+
$xeTable.updateScrollXSpace()
|
|
6130
6278
|
}
|
|
6131
6279
|
calcCellHeight(this)
|
|
6132
6280
|
// 计算 Y 逻辑
|
|
6133
6281
|
const rowHeight = computeRowHeight(this)
|
|
6134
6282
|
scrollYStore.rowHeight = rowHeight
|
|
6135
6283
|
this.rowHeight = rowHeight
|
|
6136
|
-
const { visibleSize: visibleYSize } = handleVirtualYVisible(
|
|
6284
|
+
const { visibleSize: visibleYSize } = handleVirtualYVisible($xeTable)
|
|
6137
6285
|
if (scrollYLoad) {
|
|
6138
|
-
|
|
6139
|
-
const bufferSize = showOverflow ? 0 : 2
|
|
6140
|
-
const offsetYSize = Math.max(bufferSize, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0))
|
|
6286
|
+
const offsetYSize = Math.max(0, sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0))
|
|
6141
6287
|
scrollYStore.offsetSize = offsetYSize
|
|
6142
6288
|
scrollYStore.visibleSize = visibleYSize
|
|
6143
6289
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex)
|
|
6144
|
-
|
|
6290
|
+
$xeTable.updateScrollYData()
|
|
6145
6291
|
} else {
|
|
6146
|
-
|
|
6292
|
+
$xeTable.updateScrollYSpace()
|
|
6147
6293
|
}
|
|
6148
|
-
|
|
6294
|
+
$xeTable.$nextTick(this.updateStyle)
|
|
6149
6295
|
})
|
|
6150
6296
|
},
|
|
6151
6297
|
handleTableColumn () {
|
|
@@ -6161,10 +6307,18 @@ const Methods = {
|
|
|
6161
6307
|
this.tableColumn = tableColumn
|
|
6162
6308
|
},
|
|
6163
6309
|
updateScrollXData () {
|
|
6310
|
+
const $xeTable = this
|
|
6311
|
+
const props = $xeTable
|
|
6312
|
+
|
|
6313
|
+
const { showOverflow } = props
|
|
6164
6314
|
// this.tableColumn = []
|
|
6165
|
-
return
|
|
6166
|
-
|
|
6167
|
-
|
|
6315
|
+
return $xeTable.$nextTick().then(() => {
|
|
6316
|
+
$xeTable.handleTableColumn()
|
|
6317
|
+
calcCellHeight($xeTable)
|
|
6318
|
+
$xeTable.updateScrollXSpace()
|
|
6319
|
+
if (!showOverflow) {
|
|
6320
|
+
$xeTable.updateScrollYSpace()
|
|
6321
|
+
}
|
|
6168
6322
|
})
|
|
6169
6323
|
},
|
|
6170
6324
|
// 更新横向 X 可视渲染上下剩余空间大小
|
|
@@ -6213,10 +6367,10 @@ const Methods = {
|
|
|
6213
6367
|
const $xeTable = this
|
|
6214
6368
|
|
|
6215
6369
|
// this.tableData = []
|
|
6216
|
-
return
|
|
6217
|
-
|
|
6370
|
+
return $xeTable.$nextTick().then(() => {
|
|
6371
|
+
$xeTable.handleTableData()
|
|
6218
6372
|
calcCellHeight($xeTable)
|
|
6219
|
-
|
|
6373
|
+
$xeTable.updateScrollYSpace()
|
|
6220
6374
|
})
|
|
6221
6375
|
},
|
|
6222
6376
|
// 更新纵向 Y 可视渲染上下剩余空间大小
|
|
@@ -6617,7 +6771,7 @@ const Methods = {
|
|
|
6617
6771
|
} as any
|
|
6618
6772
|
|
|
6619
6773
|
// Module methods
|
|
6620
|
-
const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',')
|
|
6774
|
+
const funcs = 'setFilter,openFilter,clearFilter,saveFilterPanel,resetFilterPanel,getCheckedFilters,updateFilterOptionStatus,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFNR,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,insertNextAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,fullValidateField,validateField,openExport,closeExport,openPrint,closePrint,getPrintHtml,exportData,openImport,closeImport,importData,saveFile,readFile,importByFile,print,openCustom,closeCustom,saveCustom,cancelCustom,resetCustom,toggleCustomAllCheckbox,setCustomAllCheckbox'.split(',')
|
|
6621
6775
|
|
|
6622
6776
|
funcs.forEach(name => {
|
|
6623
6777
|
Methods[name] = function (...args: any[]) {
|
|
@@ -1123,6 +1123,7 @@ export default {
|
|
|
1123
1123
|
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')
|
|
1124
1124
|
|
|
1125
1125
|
const $xeTable = this
|
|
1126
|
+
const $xeGrid = $xeTable.$xeGrid
|
|
1126
1127
|
|
|
1127
1128
|
const {
|
|
1128
1129
|
_e,
|
|
@@ -1170,6 +1171,7 @@ export default {
|
|
|
1170
1171
|
editRules
|
|
1171
1172
|
} = $xeTable
|
|
1172
1173
|
const { leftList, rightList } = columnStore
|
|
1174
|
+
const loadingSlot = $scopedSlots.loading
|
|
1173
1175
|
const currLoading = this._isLoading || loading
|
|
1174
1176
|
const vSize = computeSize
|
|
1175
1177
|
const virtualScrollBars = $xeTable.computeVirtualScrollBars
|
|
@@ -1357,8 +1359,14 @@ export default {
|
|
|
1357
1359
|
icon: loadingOpts.icon,
|
|
1358
1360
|
text: loadingOpts.text
|
|
1359
1361
|
}
|
|
1360
|
-
},
|
|
1361
|
-
:
|
|
1362
|
+
}, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, loading: currLoading }, h))
|
|
1363
|
+
: loadingSlot
|
|
1364
|
+
? h('div', {
|
|
1365
|
+
class: ['vxe-loading--custom-wrapper', {
|
|
1366
|
+
'is--visible': currLoading
|
|
1367
|
+
}]
|
|
1368
|
+
}, $xeTable.callSlot(loadingSlot, { $table: $xeTable, $grid: $xeGrid, loading: currLoading }, h))
|
|
1369
|
+
: renderEmptyElement($xeTable),
|
|
1362
1370
|
/**
|
|
1363
1371
|
* 自定义列
|
|
1364
1372
|
*/
|
|
@@ -1370,7 +1378,7 @@ export default {
|
|
|
1370
1378
|
customStore
|
|
1371
1379
|
}
|
|
1372
1380
|
})
|
|
1373
|
-
:
|
|
1381
|
+
: renderEmptyElement($xeTable),
|
|
1374
1382
|
/**
|
|
1375
1383
|
* 筛选
|
|
1376
1384
|
*/
|
package/packages/ui/index.ts
CHANGED
package/packages/ui/src/dom.ts
CHANGED
|
@@ -81,13 +81,13 @@ export function getPaddingTopBottomSize (elem: HTMLElement) {
|
|
|
81
81
|
return 0
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export function setScrollTop (elem: HTMLElement | null, scrollTop: number) {
|
|
84
|
+
export function setScrollTop (elem: HTMLElement | null | undefined, scrollTop: number) {
|
|
85
85
|
if (elem) {
|
|
86
86
|
elem.scrollTop = scrollTop
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
export function setScrollLeft (elem: HTMLElement | null, scrollLeft: number) {
|
|
90
|
+
export function setScrollLeft (elem: HTMLElement | null | undefined, scrollLeft: number) {
|
|
91
91
|
if (elem) {
|
|
92
92
|
elem.scrollLeft = scrollLeft
|
|
93
93
|
}
|