vxe-table 3.10.8 → 3.10.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/src/body.js +4 -8
- package/es/table/src/footer.js +2 -4
- package/es/table/src/methods.js +152 -63
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +157 -79
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/body.js +4 -8
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +2 -4
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/methods.js +150 -66
- package/lib/table/src/methods.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/src/body.ts +4 -8
- package/packages/table/src/footer.ts +2 -4
- package/packages/table/src/methods.ts +154 -61
- /package/es/{iconfont.1731060585164.ttf → iconfont.1731143527990.ttf} +0 -0
- /package/es/{iconfont.1731060585164.woff → iconfont.1731143527990.woff} +0 -0
- /package/es/{iconfont.1731060585164.woff2 → iconfont.1731143527990.woff2} +0 -0
- /package/lib/{iconfont.1731060585164.ttf → iconfont.1731143527990.ttf} +0 -0
- /package/lib/{iconfont.1731060585164.woff → iconfont.1731143527990.woff} +0 -0
- /package/lib/{iconfont.1731060585164.woff2 → iconfont.1731143527990.woff2} +0 -0
|
@@ -692,11 +692,9 @@ export default {
|
|
|
692
692
|
setScrollTop(leftElem, scrollTop)
|
|
693
693
|
setScrollTop(rightElem, scrollTop)
|
|
694
694
|
}
|
|
695
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
695
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
696
696
|
type: renderType,
|
|
697
|
-
fixed: fixedType
|
|
698
|
-
scrollTop,
|
|
699
|
-
scrollLeft
|
|
697
|
+
fixed: fixedType
|
|
700
698
|
})
|
|
701
699
|
}
|
|
702
700
|
if (xHandleEl) {
|
|
@@ -706,11 +704,9 @@ export default {
|
|
|
706
704
|
$xeTable.lastScrollLeft = scrollLeft
|
|
707
705
|
setScrollLeft(headerElem, scrollLeft)
|
|
708
706
|
setScrollLeft(footerElem, scrollLeft)
|
|
709
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
707
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
710
708
|
type: renderType,
|
|
711
|
-
fixed: fixedType
|
|
712
|
-
scrollTop,
|
|
713
|
-
scrollLeft
|
|
709
|
+
fixed: fixedType
|
|
714
710
|
})
|
|
715
711
|
}
|
|
716
712
|
},
|
|
@@ -295,11 +295,9 @@ export default {
|
|
|
295
295
|
$xeTable.lastScrollTime = Date.now()
|
|
296
296
|
setScrollLeft(headerElem, scrollLeft)
|
|
297
297
|
setScrollLeft(bodyElem, scrollLeft)
|
|
298
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
298
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
299
299
|
type: renderType,
|
|
300
|
-
fixed: fixedType
|
|
301
|
-
scrollTop,
|
|
302
|
-
scrollLeft
|
|
300
|
+
fixed: fixedType
|
|
303
301
|
})
|
|
304
302
|
}
|
|
305
303
|
}
|
|
@@ -1808,80 +1808,137 @@ const Methods = {
|
|
|
1808
1808
|
* 设置为固定列
|
|
1809
1809
|
*/
|
|
1810
1810
|
setColumnFixed (fieldOrColumn: any, fixed: any) {
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1811
|
+
const $xeTable = this
|
|
1812
|
+
|
|
1813
|
+
let status = false
|
|
1814
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
1815
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
1816
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
|
|
1817
|
+
for (let i = 0; i < cols.length; i++) {
|
|
1818
|
+
const item = cols[i]
|
|
1819
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
1820
|
+
const targetColumn = getRootColumn($xeTable, column as any)
|
|
1821
|
+
if (targetColumn && targetColumn.fixed !== fixed) {
|
|
1822
|
+
// 是否超过最大固定列数量
|
|
1823
|
+
if (!targetColumn.fixed && isMaxFixedColumn) {
|
|
1824
|
+
if (VxeUI.modal) {
|
|
1825
|
+
VxeUI.modal.message({
|
|
1826
|
+
status: 'error',
|
|
1827
|
+
content: getI18n('vxe.table.maxFixedCol', [columnOpts.maxFixedSize])
|
|
1828
|
+
})
|
|
1829
|
+
}
|
|
1830
|
+
return $xeTable.$nextTick()
|
|
1831
|
+
}
|
|
1832
|
+
XEUtils.eachTree([targetColumn], (column) => {
|
|
1833
|
+
column.fixed = fixed
|
|
1834
|
+
})
|
|
1835
|
+
$xeTable.saveCustomStore('update:fixed')
|
|
1836
|
+
if (!status) {
|
|
1837
|
+
status = true
|
|
1822
1838
|
}
|
|
1823
|
-
return this.$nextTick()
|
|
1824
1839
|
}
|
|
1825
|
-
XEUtils.eachTree([targetColumn], (column) => {
|
|
1826
|
-
column.fixed = fixed
|
|
1827
|
-
})
|
|
1828
|
-
this.saveCustomStore('update:fixed')
|
|
1829
|
-
return this.refreshColumn()
|
|
1830
1840
|
}
|
|
1831
|
-
|
|
1841
|
+
if (status) {
|
|
1842
|
+
return $xeTable.refreshColumn()
|
|
1843
|
+
}
|
|
1844
|
+
return $xeTable.$nextTick()
|
|
1832
1845
|
},
|
|
1833
1846
|
/**
|
|
1834
1847
|
* 取消指定固定列
|
|
1835
1848
|
*/
|
|
1836
1849
|
clearColumnFixed (fieldOrColumn: any) {
|
|
1837
|
-
const
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1850
|
+
const $xeTable = this
|
|
1851
|
+
|
|
1852
|
+
let status = false
|
|
1853
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
1854
|
+
cols.forEach(item => {
|
|
1855
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
1856
|
+
const targetColumn = getRootColumn($xeTable, column as any)
|
|
1857
|
+
if (targetColumn && targetColumn.fixed) {
|
|
1858
|
+
XEUtils.eachTree([targetColumn], (column) => {
|
|
1859
|
+
column.fixed = null
|
|
1860
|
+
})
|
|
1861
|
+
$xeTable.saveCustomStore('update:fixed')
|
|
1862
|
+
if (!status) {
|
|
1863
|
+
status = true
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
})
|
|
1867
|
+
if (status) {
|
|
1868
|
+
return $xeTable.refreshColumn()
|
|
1845
1869
|
}
|
|
1846
|
-
return
|
|
1870
|
+
return $xeTable.$nextTick()
|
|
1847
1871
|
},
|
|
1848
1872
|
/**
|
|
1849
1873
|
* 隐藏指定列
|
|
1850
1874
|
*/
|
|
1851
1875
|
hideColumn (fieldOrColumn: any) {
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1876
|
+
const $xeTable = this
|
|
1877
|
+
|
|
1878
|
+
let status = false
|
|
1879
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
1880
|
+
cols.forEach(item => {
|
|
1881
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
1882
|
+
if (column && column.visible) {
|
|
1883
|
+
column.visible = false
|
|
1884
|
+
if (!status) {
|
|
1885
|
+
status = true
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
})
|
|
1889
|
+
if (status) {
|
|
1890
|
+
return $xeTable.handleCustom()
|
|
1856
1891
|
}
|
|
1857
|
-
return
|
|
1892
|
+
return $xeTable.$nextTick()
|
|
1858
1893
|
},
|
|
1859
1894
|
/**
|
|
1860
1895
|
* 显示指定列
|
|
1861
1896
|
*/
|
|
1862
1897
|
showColumn (fieldOrColumn: any) {
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1898
|
+
const $xeTable = this
|
|
1899
|
+
|
|
1900
|
+
let status = false
|
|
1901
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
1902
|
+
cols.forEach(item => {
|
|
1903
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
1904
|
+
if (column && !column.visible) {
|
|
1905
|
+
column.visible = true
|
|
1906
|
+
if (!status) {
|
|
1907
|
+
status = true
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
})
|
|
1911
|
+
if (status) {
|
|
1912
|
+
return $xeTable.handleCustom()
|
|
1867
1913
|
}
|
|
1868
|
-
return
|
|
1914
|
+
return $xeTable.$nextTick()
|
|
1869
1915
|
},
|
|
1870
1916
|
setColumnWidth (fieldOrColumn: any, width: any) {
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
const
|
|
1879
|
-
rdWidth =
|
|
1917
|
+
const $xeTable = this
|
|
1918
|
+
|
|
1919
|
+
let status = false
|
|
1920
|
+
const cols = XEUtils.isArray(fieldOrColumn) ? fieldOrColumn : [fieldOrColumn]
|
|
1921
|
+
cols.forEach(item => {
|
|
1922
|
+
const column = handleFieldOrColumn($xeTable, item)
|
|
1923
|
+
if (column) {
|
|
1924
|
+
const colWidth = XEUtils.toInteger(width)
|
|
1925
|
+
let rdWidth = colWidth
|
|
1926
|
+
if (isScale(width)) {
|
|
1927
|
+
const tableBody = $xeTable.$refs.tableBody
|
|
1928
|
+
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
1929
|
+
const bodyWidth = bodyElem ? bodyElem.clientWidth - 1 : 0
|
|
1930
|
+
rdWidth = Math.floor(colWidth * bodyWidth)
|
|
1931
|
+
}
|
|
1932
|
+
column.resizeWidth = rdWidth
|
|
1933
|
+
if (!status) {
|
|
1934
|
+
status = true
|
|
1935
|
+
}
|
|
1880
1936
|
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1937
|
+
})
|
|
1938
|
+
if (status) {
|
|
1939
|
+
return $xeTable.refreshColumn()
|
|
1883
1940
|
}
|
|
1884
|
-
return
|
|
1941
|
+
return $xeTable.$nextTick()
|
|
1885
1942
|
},
|
|
1886
1943
|
getColumnWidth (fieldOrColumn: any) {
|
|
1887
1944
|
const column = handleFieldOrColumn(this, fieldOrColumn)
|
|
@@ -5594,7 +5651,7 @@ const Methods = {
|
|
|
5594
5651
|
}
|
|
5595
5652
|
this.closeTooltip()
|
|
5596
5653
|
},
|
|
5597
|
-
handleScrollEvent (evnt: Event, isRollY: boolean, isRollX: boolean, params: any) {
|
|
5654
|
+
handleScrollEvent (evnt: Event, isRollY: boolean, isRollX: boolean, scrollTop: number, scrollLeft: number, params: any) {
|
|
5598
5655
|
const $xeTable = this
|
|
5599
5656
|
const props = $xeTable
|
|
5600
5657
|
|
|
@@ -5620,13 +5677,35 @@ const Methods = {
|
|
|
5620
5677
|
const bodyWidth = bodyElem ? bodyElem.clientWidth : 0
|
|
5621
5678
|
const scrollHeight = bodyElem ? bodyElem.scrollHeight : 0
|
|
5622
5679
|
const scrollWidth = bodyElem ? bodyElem.scrollWidth : 0
|
|
5680
|
+
let isTop = false
|
|
5681
|
+
let isBottom = false
|
|
5682
|
+
let isLeft = false
|
|
5683
|
+
let isRight = false
|
|
5684
|
+
if (isRollX) {
|
|
5685
|
+
isLeft = scrollLeft <= 0
|
|
5686
|
+
if (!isTop) {
|
|
5687
|
+
isRight = scrollLeft + bodyWidth >= scrollWidth
|
|
5688
|
+
}
|
|
5689
|
+
$xeTable.checkScrolling()
|
|
5690
|
+
} else {
|
|
5691
|
+
isTop = scrollTop <= 0
|
|
5692
|
+
if (!isTop) {
|
|
5693
|
+
isBottom = scrollTop + bodyHeight >= scrollHeight
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5623
5696
|
const evntParams = {
|
|
5697
|
+
scrollTop,
|
|
5698
|
+
scrollLeft,
|
|
5624
5699
|
bodyHeight,
|
|
5625
5700
|
bodyWidth,
|
|
5626
5701
|
scrollHeight,
|
|
5627
5702
|
scrollWidth,
|
|
5628
5703
|
isX: isRollX,
|
|
5629
5704
|
isY: isRollY,
|
|
5705
|
+
isTop,
|
|
5706
|
+
isBottom,
|
|
5707
|
+
isLeft,
|
|
5708
|
+
isRight,
|
|
5630
5709
|
...params
|
|
5631
5710
|
}
|
|
5632
5711
|
$xeTable.dispatchEvent('scroll', evntParams, evnt)
|
|
@@ -5674,11 +5753,9 @@ const Methods = {
|
|
|
5674
5753
|
$xeTable.lastScrollTime = Date.now()
|
|
5675
5754
|
$xeTable.handleSyncScrollX(scrollLeft)
|
|
5676
5755
|
$xeTable.triggerScrollXEvent(evnt)
|
|
5677
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
5756
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
5678
5757
|
type: 'table',
|
|
5679
|
-
fixed: ''
|
|
5680
|
-
scrollTop,
|
|
5681
|
-
scrollLeft
|
|
5758
|
+
fixed: ''
|
|
5682
5759
|
})
|
|
5683
5760
|
},
|
|
5684
5761
|
debounceScrollYCalculate: XEUtils.debounce(function () {
|
|
@@ -5710,11 +5787,9 @@ const Methods = {
|
|
|
5710
5787
|
$xeTable.lastScrollTime = Date.now()
|
|
5711
5788
|
$xeTable.handleSyncScrollY(scrollTop)
|
|
5712
5789
|
$xeTable.triggerScrollYEvent(evnt)
|
|
5713
|
-
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, {
|
|
5790
|
+
$xeTable.handleScrollEvent(evnt, isRollY, isRollX, scrollTop, scrollLeft, {
|
|
5714
5791
|
type: 'table',
|
|
5715
|
-
fixed: ''
|
|
5716
|
-
scrollTop,
|
|
5717
|
-
scrollLeft
|
|
5792
|
+
fixed: ''
|
|
5718
5793
|
})
|
|
5719
5794
|
},
|
|
5720
5795
|
/**
|
|
@@ -5911,16 +5986,34 @@ const Methods = {
|
|
|
5911
5986
|
* @param {Number} scrollTop 上距离
|
|
5912
5987
|
*/
|
|
5913
5988
|
scrollTo (scrollLeft: any, scrollTop: any) {
|
|
5989
|
+
const $xeTable = this
|
|
5990
|
+
|
|
5914
5991
|
const { $refs } = this
|
|
5915
|
-
const { tableBody, rightBody, tableFooter } = $refs
|
|
5992
|
+
const { tableBody, tableHeader, leftBody, rightBody, tableFooter } = $refs
|
|
5916
5993
|
const tableBodyElem = tableBody ? tableBody.$el : null
|
|
5994
|
+
const leftBodyElem = leftBody ? leftBody.$el : null
|
|
5917
5995
|
const rightBodyElem = rightBody ? rightBody.$el : null
|
|
5996
|
+
const tableHeaderElem = tableHeader ? tableHeader.$el : null
|
|
5918
5997
|
const tableFooterElem = tableFooter ? tableFooter.$el : null
|
|
5919
5998
|
if (XEUtils.isNumber(scrollLeft)) {
|
|
5920
|
-
|
|
5999
|
+
const xHandleEl = $xeTable.$refs.refScrollXHandleElem
|
|
6000
|
+
if (xHandleEl) {
|
|
6001
|
+
setScrollLeft(xHandleEl, scrollLeft)
|
|
6002
|
+
} else {
|
|
6003
|
+
setScrollLeft(tableBodyElem, scrollLeft)
|
|
6004
|
+
setScrollLeft(tableHeaderElem, scrollLeft)
|
|
6005
|
+
setScrollLeft(tableFooterElem, scrollLeft)
|
|
6006
|
+
}
|
|
5921
6007
|
}
|
|
5922
6008
|
if (XEUtils.isNumber(scrollTop)) {
|
|
5923
|
-
|
|
6009
|
+
const yHandleEl = $xeTable.$refs.refScrollYHandleElem
|
|
6010
|
+
if (yHandleEl) {
|
|
6011
|
+
setScrollTop(yHandleEl, scrollTop)
|
|
6012
|
+
} else {
|
|
6013
|
+
setScrollTop(tableBodyElem, scrollTop)
|
|
6014
|
+
setScrollTop(leftBodyElem, scrollTop)
|
|
6015
|
+
setScrollTop(rightBodyElem, scrollTop)
|
|
6016
|
+
}
|
|
5924
6017
|
}
|
|
5925
6018
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
5926
6019
|
return new Promise(resolve => setTimeout(() => resolve(this.$nextTick()), 50))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|