vxe-table 3.4.14-beta.2 → 3.4.14-beta.3
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/lib/filter/src/mixin.js +24 -17
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/index.umd.js +307 -243
- package/lib/index.umd.min.js +1 -1
- package/lib/table/src/body.js +36 -10
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +234 -215
- package/lib/table/src/methods.min.js +1 -1
- package/lib/tools/src/dom.js +14 -1
- package/lib/tools/src/dom.min.js +1 -1
- package/package.json +1 -1
- package/packages/filter/src/mixin.js +15 -11
- package/packages/table/src/body.js +32 -11
- package/packages/table/src/methods.js +28 -14
- package/packages/tools/src/dom.js +13 -1
|
@@ -3,7 +3,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
|
3
3
|
import VXETable from '../../v-x-e-table'
|
|
4
4
|
import { UtilTools, DomTools, isEnableConf } from '../../tools'
|
|
5
5
|
import { getOffsetSize, calcTreeLine, mergeBodyMethod, removeScrollListener, restoreScrollListener } from './util'
|
|
6
|
-
import { browse } from '../../tools/src/dom'
|
|
6
|
+
import { browse, setScrollLeftAndTop } from '../../tools/src/dom'
|
|
7
7
|
|
|
8
8
|
const renderType = 'body'
|
|
9
9
|
|
|
@@ -401,7 +401,7 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
401
401
|
* 同步滚动条
|
|
402
402
|
*/
|
|
403
403
|
let scrollProcessTimeout
|
|
404
|
-
function syncBodyScroll (scrollTop, elem1, elem2) {
|
|
404
|
+
function syncBodyScroll (_vm, fixedType, scrollTop, elem1, elem2) {
|
|
405
405
|
if (elem1 || elem2) {
|
|
406
406
|
if (elem1) {
|
|
407
407
|
removeScrollListener(elem1)
|
|
@@ -412,9 +412,30 @@ function syncBodyScroll (scrollTop, elem1, elem2) {
|
|
|
412
412
|
elem2.scrollTop = scrollTop
|
|
413
413
|
}
|
|
414
414
|
clearTimeout(scrollProcessTimeout)
|
|
415
|
-
scrollProcessTimeout = setTimeout(
|
|
415
|
+
scrollProcessTimeout = setTimeout(() => {
|
|
416
|
+
const { tableBody, leftBody, rightBody } = _vm.$refs
|
|
417
|
+
const bodyElem = tableBody.$el
|
|
418
|
+
const leftElem = leftBody ? leftBody.$el : null
|
|
419
|
+
const rightElem = rightBody ? rightBody.$el : null
|
|
416
420
|
restoreScrollListener(elem1)
|
|
417
421
|
restoreScrollListener(elem2)
|
|
422
|
+
// 检查滚动条是的同步
|
|
423
|
+
let targetTop = bodyElem.scrollTop
|
|
424
|
+
let targetLeft = bodyElem.scrollLeft
|
|
425
|
+
if (fixedType === 'left') {
|
|
426
|
+
if (leftElem) {
|
|
427
|
+
targetTop = leftElem.scrollTop
|
|
428
|
+
targetLeft = leftElem.scrollLeft
|
|
429
|
+
}
|
|
430
|
+
} else if (fixedType === 'right') {
|
|
431
|
+
if (rightElem) {
|
|
432
|
+
targetTop = rightElem.scrollTop
|
|
433
|
+
targetLeft = rightElem.scrollLeft
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
setScrollLeftAndTop(bodyElem, targetLeft, targetTop)
|
|
437
|
+
setScrollLeftAndTop(leftElem, targetLeft, targetTop)
|
|
438
|
+
setScrollLeftAndTop(rightElem, targetLeft, targetTop)
|
|
418
439
|
}, 300)
|
|
419
440
|
}
|
|
420
441
|
}
|
|
@@ -621,10 +642,10 @@ export default {
|
|
|
621
642
|
}
|
|
622
643
|
if (leftElem && fixedType === 'left') {
|
|
623
644
|
scrollTop = leftElem.scrollTop
|
|
624
|
-
syncBodyScroll(scrollTop, bodyElem, rightElem)
|
|
645
|
+
syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, rightElem)
|
|
625
646
|
} else if (rightElem && fixedType === 'right') {
|
|
626
647
|
scrollTop = rightElem.scrollTop
|
|
627
|
-
syncBodyScroll(scrollTop, bodyElem, leftElem)
|
|
648
|
+
syncBodyScroll($xetable, fixedType, scrollTop, bodyElem, leftElem)
|
|
628
649
|
} else {
|
|
629
650
|
if (isRollX) {
|
|
630
651
|
if (headerElem) {
|
|
@@ -637,7 +658,7 @@ export default {
|
|
|
637
658
|
if (leftElem || rightElem) {
|
|
638
659
|
$xetable.checkScrolling()
|
|
639
660
|
if (isRollY) {
|
|
640
|
-
syncBodyScroll(scrollTop, leftElem, rightElem)
|
|
661
|
+
syncBodyScroll($xetable, fixedType, scrollTop, leftElem, rightElem)
|
|
641
662
|
}
|
|
642
663
|
}
|
|
643
664
|
}
|
|
@@ -689,15 +710,15 @@ export default {
|
|
|
689
710
|
wheelYInterval = wheelYInterval - (wheelYTotal - wheelYSize)
|
|
690
711
|
}
|
|
691
712
|
const { scrollTop, clientHeight, scrollHeight } = bodyElem
|
|
692
|
-
const
|
|
693
|
-
bodyElem.scrollTop =
|
|
713
|
+
const targetTop = scrollTop + (wheelYInterval * (isTopWheel ? -1 : 1))
|
|
714
|
+
bodyElem.scrollTop = targetTop
|
|
694
715
|
if (leftElem) {
|
|
695
|
-
leftElem.scrollTop =
|
|
716
|
+
leftElem.scrollTop = targetTop
|
|
696
717
|
}
|
|
697
718
|
if (rightElem) {
|
|
698
|
-
rightElem.scrollTop =
|
|
719
|
+
rightElem.scrollTop = targetTop
|
|
699
720
|
}
|
|
700
|
-
if (isTopWheel ?
|
|
721
|
+
if (isTopWheel ? targetTop < scrollHeight - clientHeight : targetTop >= 0) {
|
|
701
722
|
this.wheelTime = setTimeout(handleSmooth, 10)
|
|
702
723
|
}
|
|
703
724
|
this.wheelYTotal = wheelYTotal
|
|
@@ -9,7 +9,7 @@ import { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '..
|
|
|
9
9
|
import { formats } from '../../v-x-e-table/src/formats'
|
|
10
10
|
|
|
11
11
|
const { getRowid, getRowkey, setCellValue, hasChildrenList, getColumnList } = UtilTools
|
|
12
|
-
const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode } = DomTools
|
|
12
|
+
const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
|
|
13
13
|
|
|
14
14
|
const isWebkit = browse['-webkit'] && !browse.edge
|
|
15
15
|
const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
@@ -301,6 +301,7 @@ const Methods = {
|
|
|
301
301
|
const { scrollXLoad, scrollYLoad } = this
|
|
302
302
|
return this.handleTableData(true).then(() => {
|
|
303
303
|
this.updateFooter()
|
|
304
|
+
this.checkSelectionStatus()
|
|
304
305
|
if (scrollXLoad || scrollYLoad) {
|
|
305
306
|
if (scrollXLoad) {
|
|
306
307
|
this.updateScrollXSpace()
|
|
@@ -310,7 +311,13 @@ const Methods = {
|
|
|
310
311
|
}
|
|
311
312
|
return this.refreshScroll()
|
|
312
313
|
}
|
|
313
|
-
}).then(() =>
|
|
314
|
+
}).then(() => {
|
|
315
|
+
this.updateCellAreas()
|
|
316
|
+
return this.recalculate(true)
|
|
317
|
+
}).then(() => {
|
|
318
|
+
// 存在滚动行为未结束情况
|
|
319
|
+
setTimeout(() => this.recalculate(), 50)
|
|
320
|
+
})
|
|
314
321
|
},
|
|
315
322
|
handleTableData (force) {
|
|
316
323
|
const { scrollYLoad, scrollYStore, fullDataRowIdData, afterFullData } = this
|
|
@@ -1700,15 +1707,22 @@ const Methods = {
|
|
|
1700
1707
|
const leftBodyElem = leftBody ? leftBody.$el : null
|
|
1701
1708
|
const rightBodyElem = rightBody ? rightBody.$el : null
|
|
1702
1709
|
const tableFooterElem = tableFooter ? tableFooter.$el : null
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
return new Promise(resolve => {
|
|
1711
|
+
// 还原滚动条位置
|
|
1712
|
+
if (lastScrollLeft || lastScrollTop) {
|
|
1713
|
+
return restoreScrollLocation(this, lastScrollLeft, lastScrollTop).then(() => {
|
|
1714
|
+
// 存在滚动行为未结束情况
|
|
1715
|
+
setTimeout(resolve, 30)
|
|
1716
|
+
})
|
|
1717
|
+
}
|
|
1718
|
+
// 重置
|
|
1719
|
+
setScrollTop(tableBodyElem, lastScrollTop)
|
|
1720
|
+
setScrollTop(leftBodyElem, lastScrollTop)
|
|
1721
|
+
setScrollTop(rightBodyElem, lastScrollTop)
|
|
1722
|
+
setScrollLeft(tableFooterElem, lastScrollLeft)
|
|
1723
|
+
// 存在滚动行为未结束情况
|
|
1724
|
+
setTimeout(resolve, 30)
|
|
1725
|
+
})
|
|
1712
1726
|
},
|
|
1713
1727
|
/**
|
|
1714
1728
|
* 计算单元格列宽,动态分配可用剩余空间
|
|
@@ -1977,7 +1991,7 @@ const Methods = {
|
|
|
1977
1991
|
}
|
|
1978
1992
|
} else if (layout === 'body') {
|
|
1979
1993
|
const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
|
|
1980
|
-
if (wrapperElem) {
|
|
1994
|
+
if (isNodeElement(wrapperElem)) {
|
|
1981
1995
|
if (customMaxHeight) {
|
|
1982
1996
|
wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight}px`
|
|
1983
1997
|
} else {
|
|
@@ -1993,7 +2007,7 @@ const Methods = {
|
|
|
1993
2007
|
if (fixedWrapperElem) {
|
|
1994
2008
|
const isRightFixed = fixedType === 'right'
|
|
1995
2009
|
const fixedColumn = columnStore[`${fixedType}List`]
|
|
1996
|
-
if (wrapperElem) {
|
|
2010
|
+
if (isNodeElement(wrapperElem)) {
|
|
1997
2011
|
wrapperElem.style.top = `${headerHeight}px`
|
|
1998
2012
|
}
|
|
1999
2013
|
fixedWrapperElem.style.height = `${(customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) + headerHeight + footerHeight - scrollbarHeight * (showFooter ? 2 : 1)}px`
|
|
@@ -2057,7 +2071,7 @@ const Methods = {
|
|
|
2057
2071
|
}
|
|
2058
2072
|
tWidth = tableColumn.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
2059
2073
|
|
|
2060
|
-
if (wrapperElem) {
|
|
2074
|
+
if (isNodeElement(wrapperElem)) {
|
|
2061
2075
|
// 如果是固定列
|
|
2062
2076
|
if (fixedWrapperElem) {
|
|
2063
2077
|
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight : tableHeight + headerHeight}px`
|
|
@@ -80,6 +80,17 @@ export function setScrollLeft (elem, scrollLeft) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
export function setScrollLeftAndTop (elem, scrollLeft, scrollTop) {
|
|
84
|
+
if (elem) {
|
|
85
|
+
elem.scrollLeft = scrollLeft
|
|
86
|
+
elem.scrollTop = scrollTop
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isNodeElement (elem) {
|
|
91
|
+
return elem && elem.nodeType === 1
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
export const DomTools = {
|
|
84
95
|
browse,
|
|
85
96
|
isPx (val) {
|
|
@@ -225,7 +236,8 @@ export const DomTools = {
|
|
|
225
236
|
}
|
|
226
237
|
}
|
|
227
238
|
return num
|
|
228
|
-
}
|
|
239
|
+
},
|
|
240
|
+
isNodeElement
|
|
229
241
|
}
|
|
230
242
|
|
|
231
243
|
export default DomTools
|