vxe-table 3.25.0-beta.1 → 3.25.0-beta.2
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 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/methods.js +246 -44
- package/es/table/src/props.js +2 -1
- package/es/table/src/scrollbar.js +54 -0
- package/es/table/src/table.js +266 -64
- package/es/table/src/util.js +11 -2
- package/es/table/style.css +30 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +30 -0
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +337 -66
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/methods.js +21 -11
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +2 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/scrollbar.js +63 -0
- package/lib/table/src/scrollbar.min.js +1 -0
- package/lib/table/src/table.js +249 -52
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +11 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +30 -0
- package/lib/table/style/style.min.css +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/lib/vxe-table/style/style.css +30 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/src/methods.ts +258 -44
- package/packages/table/src/props.ts +2 -1
- package/packages/table/src/scrollbar.ts +57 -0
- package/packages/table/src/table.ts +300 -69
- package/packages/table/src/util.ts +15 -2
- package/styles/components/table.scss +65 -0
- /package/es/{iconfont.1791954189007.ttf → iconfont.1792035018941.ttf} +0 -0
- /package/es/{iconfont.1791954189007.woff → iconfont.1792035018941.woff} +0 -0
- /package/es/{iconfont.1791954189007.woff2 → iconfont.1792035018941.woff2} +0 -0
- /package/lib/{iconfont.1791954189007.ttf → iconfont.1792035018941.ttf} +0 -0
- /package/lib/{iconfont.1791954189007.woff → iconfont.1792035018941.woff} +0 -0
- /package/lib/{iconfont.1791954189007.woff2 → iconfont.1792035018941.woff2} +0 -0
|
@@ -2,7 +2,7 @@ import { CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getDefaultConfig, getFuncText, hasEnableConf, isEnableConf } from '../../ui/src/utils'
|
|
4
4
|
import { initTpImg, toCssUnit } from '../../ui/src/dom'
|
|
5
|
-
import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
|
|
5
|
+
import { createReactData, createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey, getRefElem } from './util'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
7
|
import methods from './methods'
|
|
8
8
|
import TableBodyComponent from './body'
|
|
@@ -26,12 +26,12 @@ import keyboardMixin from '../module/keyboard/mixin'
|
|
|
26
26
|
import validatorMixin from '../module/validator/mixin'
|
|
27
27
|
import customMixin from '../module/custom/mixin'
|
|
28
28
|
|
|
29
|
-
import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType, VxeModalConstructor, VxeModalMethods
|
|
29
|
+
import type { VxeTabsConstructor, VxeTabsPrivateMethods, VxeComponentStyleType, VxeModalConstructor, VxeModalMethods } from 'vxe-pc-ui'
|
|
30
30
|
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTablePropTypes, TableInternalData, TableReactData, VxeTableDefines } from '../../../types'
|
|
31
31
|
|
|
32
32
|
const { warnLog, errLog } = createComponentLog('table')
|
|
33
33
|
|
|
34
|
-
const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, globalMixins, renderEmptyElement } = VxeUI
|
|
34
|
+
const { getConfig, getIcon, getI18n, renderer, globalResize, globalEvents, domUtils, globalMixins, renderEmptyElement } = VxeUI
|
|
35
35
|
|
|
36
36
|
function handleUpdateMergeBodyCells ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) {
|
|
37
37
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -113,6 +113,8 @@ function renderViewFixed (h: CreateElement, $xeTable: VxeTableConstructor & VxeT
|
|
|
113
113
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
114
114
|
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
115
115
|
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
116
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
117
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
116
118
|
const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
|
|
117
119
|
const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
|
|
118
120
|
const isFixedLeft = fixedType === 'left'
|
|
@@ -123,8 +125,8 @@ function renderViewFixed (h: CreateElement, $xeTable: VxeTableConstructor & VxeT
|
|
|
123
125
|
ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
|
|
124
126
|
class: [
|
|
125
127
|
`vxe-table--fixed-${fixedType}-wrapper`,
|
|
126
|
-
`sx--${(
|
|
127
|
-
`sy--${(
|
|
128
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
129
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
128
130
|
{
|
|
129
131
|
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
130
132
|
[`y-ob--${osYBehavior}`]: osYBehavior
|
|
@@ -435,6 +437,7 @@ function renderScrollX (h: CreateElement, $xeTable: VxeTableConstructor & VxeTab
|
|
|
435
437
|
|
|
436
438
|
function renderScrollY (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
437
439
|
return h('div', {
|
|
440
|
+
key: 'vsy',
|
|
438
441
|
ref: 'refScrollYVirtualElem',
|
|
439
442
|
class: 'vxe-table--scroll-y-virtual'
|
|
440
443
|
}, [
|
|
@@ -475,6 +478,8 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
475
478
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
476
479
|
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
477
480
|
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
481
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
482
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
478
483
|
const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
|
|
479
484
|
const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
|
|
480
485
|
const { leftList, rightList } = columnStore
|
|
@@ -482,6 +487,7 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
482
487
|
const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
|
|
483
488
|
|
|
484
489
|
return h('div', {
|
|
490
|
+
key: 'tvw',
|
|
485
491
|
ref: 'refTableViewportElem',
|
|
486
492
|
class: ['vxe-table--viewport-wrapper', {
|
|
487
493
|
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
@@ -491,8 +497,8 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
491
497
|
h('div', {
|
|
492
498
|
class: [
|
|
493
499
|
'vxe-table--main-wrapper',
|
|
494
|
-
`sx--${(
|
|
495
|
-
`sy--${(
|
|
500
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
501
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`
|
|
496
502
|
]
|
|
497
503
|
}, [
|
|
498
504
|
/**
|
|
@@ -541,9 +547,10 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
541
547
|
])
|
|
542
548
|
}
|
|
543
549
|
|
|
544
|
-
function
|
|
550
|
+
function renderNativeBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
545
551
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
546
552
|
return h('div', {
|
|
553
|
+
key: 'lnb',
|
|
547
554
|
class: 'vxe-table--layout-wrapper'
|
|
548
555
|
}, scrollbarYToLeft
|
|
549
556
|
? [
|
|
@@ -556,6 +563,87 @@ function renderBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableP
|
|
|
556
563
|
])
|
|
557
564
|
}
|
|
558
565
|
|
|
566
|
+
function renderVirtualBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
567
|
+
const props = $xeTable
|
|
568
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
569
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
570
|
+
const $xeGantt = $xeTable.$xeGantt
|
|
571
|
+
const $xeGanttView = internalData.xeGanttView
|
|
572
|
+
|
|
573
|
+
const { useScrollbar } = props
|
|
574
|
+
const { xThumbWidth, yThumbHeight } = reactData
|
|
575
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
576
|
+
const scrollXAutoHide = $xeTable.computeScrollXAutoHide
|
|
577
|
+
const scrollYAutoHide = $xeTable.computeScrollYAutoHide
|
|
578
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
579
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
580
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
581
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
582
|
+
const scrollbarWrapperClss = $xeTable.computeScrollbarWrapperClss
|
|
583
|
+
const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden'
|
|
584
|
+
const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden'
|
|
585
|
+
|
|
586
|
+
return h('div', {
|
|
587
|
+
key: 'lvb',
|
|
588
|
+
class: ['vxe-table--layout-wrapper', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
589
|
+
'is--virtual-scrollbar': useScrollbar,
|
|
590
|
+
'ov-padding': useScrollbar && scrollbarOpts.padding,
|
|
591
|
+
'ov-x--auto-hide': useScrollbar && scrollXAutoHide,
|
|
592
|
+
'ov-y--auto-hide': useScrollbar && scrollYAutoHide,
|
|
593
|
+
'overflow-y': yThumbHeight,
|
|
594
|
+
'overflow-x': xThumbWidth
|
|
595
|
+
}]
|
|
596
|
+
}, [
|
|
597
|
+
renderViewport(h, $xeTable),
|
|
598
|
+
h('div', {
|
|
599
|
+
class: scrollbarWrapperClss
|
|
600
|
+
}, [
|
|
601
|
+
hideXScroll
|
|
602
|
+
? renderEmptyElement($xeTable)
|
|
603
|
+
: h('div', {
|
|
604
|
+
ref: 'refTrackXElem',
|
|
605
|
+
class: 'vxe-scrollbar--track-x',
|
|
606
|
+
on: {
|
|
607
|
+
click: ($xeTable as any).clickTrackXEvent
|
|
608
|
+
}
|
|
609
|
+
}, [
|
|
610
|
+
h('div', {
|
|
611
|
+
ref: 'refThumbXElem',
|
|
612
|
+
class: 'vxe-scrollbar--thumb-x',
|
|
613
|
+
on: {
|
|
614
|
+
pointerdown: ($xeTable as any).pointerdownThumbXEvent,
|
|
615
|
+
pointermove: ($xeTable as any).pointermoveThumbXEvent,
|
|
616
|
+
pointerup: ($xeTable as any).cleatPointerThumbEvent,
|
|
617
|
+
pointercancel: ($xeTable as any).cleatPointerThumbEvent,
|
|
618
|
+
lostpointercapture: ($xeTable as any).cleatPointerThumbEvent
|
|
619
|
+
}
|
|
620
|
+
})
|
|
621
|
+
]),
|
|
622
|
+
hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)
|
|
623
|
+
? renderEmptyElement($xeTable)
|
|
624
|
+
: h('div', {
|
|
625
|
+
ref: 'refTrackYElem',
|
|
626
|
+
class: 'vxe-scrollbar--track-y',
|
|
627
|
+
on: {
|
|
628
|
+
click: ($xeTable as any).clickTrackYEvent
|
|
629
|
+
}
|
|
630
|
+
}, [
|
|
631
|
+
h('div', {
|
|
632
|
+
ref: 'refThumbYElem',
|
|
633
|
+
class: 'vxe-scrollbar--thumb-y',
|
|
634
|
+
on: {
|
|
635
|
+
pointerdown: ($xeTable as any).pointerdownThumbYEvent,
|
|
636
|
+
pointermove: ($xeTable as any).pointermoveThumbYEvent,
|
|
637
|
+
pointerup: ($xeTable as any).cleatPointerThumbEvent,
|
|
638
|
+
pointercancel: ($xeTable as any).cleatPointerThumbEvent,
|
|
639
|
+
lostpointercapture: ($xeTable as any).cleatPointerThumbEvent
|
|
640
|
+
}
|
|
641
|
+
})
|
|
642
|
+
])
|
|
643
|
+
])
|
|
644
|
+
])
|
|
645
|
+
}
|
|
646
|
+
|
|
559
647
|
export default {
|
|
560
648
|
name: 'VxeTable',
|
|
561
649
|
mixins: [
|
|
@@ -600,9 +688,6 @@ export default {
|
|
|
600
688
|
const reactData = createReactData()
|
|
601
689
|
|
|
602
690
|
return {
|
|
603
|
-
...({} as {
|
|
604
|
-
scrollDefaultConf: VxeScrollbarProps
|
|
605
|
-
}),
|
|
606
691
|
xID,
|
|
607
692
|
...reactData,
|
|
608
693
|
|
|
@@ -613,7 +698,8 @@ export default {
|
|
|
613
698
|
kfFlag: 0,
|
|
614
699
|
layoutReFlag: 0,
|
|
615
700
|
mergeFooteCellFlag: 0,
|
|
616
|
-
crossTableDragRowInfo: crossTableDragRowGlobal
|
|
701
|
+
crossTableDragRowInfo: crossTableDragRowGlobal,
|
|
702
|
+
scrollDefaultConf: Object.assign({}, getConfig().scrollbar)
|
|
617
703
|
}
|
|
618
704
|
},
|
|
619
705
|
computed: {
|
|
@@ -740,6 +826,52 @@ export default {
|
|
|
740
826
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
741
827
|
return scrollbarOpts.y ? Object.assign({}, scrollbarOpts.y, scrollbarOpts.yConfig) : (scrollbarOpts.yConfig || {})
|
|
742
828
|
},
|
|
829
|
+
computeScrollXHeight () {
|
|
830
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
831
|
+
const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
|
|
832
|
+
|
|
833
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
834
|
+
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
835
|
+
return XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarXOpts.height, scrollbarOpts.height), scrollDefaultConf.height))
|
|
836
|
+
},
|
|
837
|
+
computeScrollYWidth () {
|
|
838
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
839
|
+
const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
|
|
840
|
+
|
|
841
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
842
|
+
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
843
|
+
return XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarYOpts.width, scrollbarOpts.width), scrollDefaultConf.width))
|
|
844
|
+
},
|
|
845
|
+
computeScrollXVisible () {
|
|
846
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
847
|
+
|
|
848
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
849
|
+
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
850
|
+
return getDefaultConfig(scrollbarXOpts.visible, scrollbarOpts.visible)
|
|
851
|
+
},
|
|
852
|
+
computeScrollYVisible () {
|
|
853
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
854
|
+
|
|
855
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
856
|
+
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
857
|
+
return getDefaultConfig(scrollbarYOpts.visible, scrollbarOpts.visible)
|
|
858
|
+
},
|
|
859
|
+
computeScrollXAutoHide () {
|
|
860
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
861
|
+
const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
|
|
862
|
+
|
|
863
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
864
|
+
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
865
|
+
return getDefaultConfig(getDefaultConfig(scrollbarXOpts.autoHide, scrollbarOpts.autoHide), scrollDefaultConf.autoHide)
|
|
866
|
+
},
|
|
867
|
+
computeScrollYAutoHide () {
|
|
868
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
869
|
+
const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
|
|
870
|
+
|
|
871
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
872
|
+
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
873
|
+
return getDefaultConfig(getDefaultConfig(scrollbarYOpts.autoHide, scrollbarOpts.autoHide), scrollDefaultConf.autoHide)
|
|
874
|
+
},
|
|
743
875
|
computeScrollbarXToTop () {
|
|
744
876
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
745
877
|
|
|
@@ -752,6 +884,26 @@ export default {
|
|
|
752
884
|
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
753
885
|
return scrollbarYOpts.position === 'left'
|
|
754
886
|
},
|
|
887
|
+
computeScrollbarWrapperClss () {
|
|
888
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
889
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
890
|
+
|
|
891
|
+
const { yThumbHeight, xThumbWidth } = reactData
|
|
892
|
+
const scrollbarXToTop = $xeTable.computeScrollbarXToTop
|
|
893
|
+
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
894
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
895
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
896
|
+
return domUtils.buildClass([
|
|
897
|
+
'vxe-scrollbar is--virtual',
|
|
898
|
+
`ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`,
|
|
899
|
+
`ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`,
|
|
900
|
+
`sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
|
|
901
|
+
`sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`
|
|
902
|
+
], {
|
|
903
|
+
'overflow-y': yThumbHeight,
|
|
904
|
+
'overflow-x': xThumbWidth
|
|
905
|
+
})
|
|
906
|
+
},
|
|
755
907
|
computeScrollYThreshold () {
|
|
756
908
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
757
909
|
|
|
@@ -803,6 +955,12 @@ export default {
|
|
|
803
955
|
}
|
|
804
956
|
return cellOpts
|
|
805
957
|
},
|
|
958
|
+
computeCellHeitht () {
|
|
959
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
960
|
+
|
|
961
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
962
|
+
return cellOpts.height
|
|
963
|
+
},
|
|
806
964
|
computeHeaderCellOpts () {
|
|
807
965
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
808
966
|
const $xeGantt = $xeTable.$xeGantt
|
|
@@ -1299,13 +1457,9 @@ export default {
|
|
|
1299
1457
|
},
|
|
1300
1458
|
computeTableStyle () {
|
|
1301
1459
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1302
|
-
const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
|
|
1303
1460
|
|
|
1304
|
-
const
|
|
1305
|
-
const
|
|
1306
|
-
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
1307
|
-
const barWidth = getDefaultConfig(getDefaultConfig(scrollbarYOpts.width, scrollbarOpts.width), scrollDefaultConf.width)
|
|
1308
|
-
const barHeight = getDefaultConfig(getDefaultConfig(scrollbarXOpts.height, scrollbarOpts.height), scrollDefaultConf.height)
|
|
1461
|
+
const barWidth = $xeTable.computeScrollYWidth
|
|
1462
|
+
const barHeight = $xeTable.computeScrollXHeight
|
|
1309
1463
|
const stys: VxeComponentStyleType = {}
|
|
1310
1464
|
if (barWidth || barHeight) {
|
|
1311
1465
|
stys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(barWidth || barHeight)
|
|
@@ -1530,19 +1684,6 @@ export default {
|
|
|
1530
1684
|
},
|
|
1531
1685
|
computeVxeLanguage () {
|
|
1532
1686
|
return VxeUI.getLanguage()
|
|
1533
|
-
},
|
|
1534
|
-
computeScrollbarVisible () {
|
|
1535
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1536
|
-
|
|
1537
|
-
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
1538
|
-
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
1539
|
-
return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`
|
|
1540
|
-
},
|
|
1541
|
-
computeCellConfHeitht () {
|
|
1542
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1543
|
-
|
|
1544
|
-
const cellOpts = $xeTable.computeCellOpts
|
|
1545
|
-
return cellOpts.height
|
|
1546
1687
|
}
|
|
1547
1688
|
} as any,
|
|
1548
1689
|
watch: {
|
|
@@ -1586,57 +1727,118 @@ export default {
|
|
|
1586
1727
|
},
|
|
1587
1728
|
|
|
1588
1729
|
computeSize () {
|
|
1589
|
-
this
|
|
1730
|
+
const $xeTable = this
|
|
1731
|
+
|
|
1732
|
+
$xeTable.reLayoutFlag++
|
|
1590
1733
|
},
|
|
1591
1734
|
showHeader () {
|
|
1592
|
-
this
|
|
1735
|
+
const $xeTable = this
|
|
1736
|
+
|
|
1737
|
+
$xeTable.reLayoutFlag++
|
|
1593
1738
|
},
|
|
1594
1739
|
showFooter () {
|
|
1595
|
-
this
|
|
1740
|
+
const $xeTable = this
|
|
1741
|
+
|
|
1742
|
+
$xeTable.reLayoutFlag++
|
|
1596
1743
|
},
|
|
1597
1744
|
showHeaderOverflow () {
|
|
1598
|
-
this
|
|
1745
|
+
const $xeTable = this
|
|
1746
|
+
|
|
1747
|
+
$xeTable.reLayoutFlag++
|
|
1599
1748
|
},
|
|
1600
1749
|
showOverflow () {
|
|
1601
1750
|
const $xeTable = this
|
|
1602
1751
|
|
|
1603
1752
|
updateColumnAllOverflow($xeTable)
|
|
1604
|
-
|
|
1753
|
+
$xeTable.reLayoutFlag++
|
|
1605
1754
|
},
|
|
1606
1755
|
showFooterOverflow () {
|
|
1607
|
-
this
|
|
1756
|
+
const $xeTable = this
|
|
1757
|
+
|
|
1758
|
+
$xeTable.reLayoutFlag++
|
|
1608
1759
|
},
|
|
1609
1760
|
overflowX () {
|
|
1610
|
-
this
|
|
1761
|
+
const $xeTable = this
|
|
1762
|
+
|
|
1763
|
+
$xeTable.reLayoutFlag++
|
|
1611
1764
|
},
|
|
1612
1765
|
overflowY () {
|
|
1613
|
-
this
|
|
1766
|
+
const $xeTable = this
|
|
1767
|
+
|
|
1768
|
+
$xeTable.reLayoutFlag++
|
|
1614
1769
|
},
|
|
1615
1770
|
height () {
|
|
1616
|
-
this
|
|
1771
|
+
const $xeTable = this
|
|
1772
|
+
|
|
1773
|
+
$xeTable.reLayoutFlag++
|
|
1617
1774
|
},
|
|
1618
1775
|
maxHeight () {
|
|
1619
|
-
this
|
|
1776
|
+
const $xeTable = this
|
|
1777
|
+
|
|
1778
|
+
$xeTable.reLayoutFlag++
|
|
1779
|
+
},
|
|
1780
|
+
computeVxeLanguage () {
|
|
1781
|
+
const $xeTable = this
|
|
1782
|
+
|
|
1783
|
+
$xeTable.reLayoutFlag++
|
|
1620
1784
|
},
|
|
1621
1785
|
computeScrollbarXToTop () {
|
|
1622
|
-
this
|
|
1786
|
+
const $xeTable = this
|
|
1787
|
+
|
|
1788
|
+
$xeTable.reScrollFlag++
|
|
1789
|
+
$xeTable.reLayoutFlag++
|
|
1623
1790
|
},
|
|
1624
1791
|
computeScrollbarYToLeft () {
|
|
1625
|
-
this
|
|
1792
|
+
const $xeTable = this
|
|
1793
|
+
|
|
1794
|
+
$xeTable.reScrollFlag++
|
|
1795
|
+
$xeTable.reLayoutFlag++
|
|
1626
1796
|
},
|
|
1627
|
-
|
|
1628
|
-
this
|
|
1797
|
+
computeScrollXVisible () {
|
|
1798
|
+
const $xeTable = this
|
|
1799
|
+
|
|
1800
|
+
$xeTable.reScrollFlag++
|
|
1801
|
+
$xeTable.reLayoutFlag++
|
|
1802
|
+
},
|
|
1803
|
+
computeScrollYVisible () {
|
|
1804
|
+
const $xeTable = this
|
|
1805
|
+
|
|
1806
|
+
$xeTable.reScrollFlag++
|
|
1807
|
+
$xeTable.reLayoutFlag++
|
|
1629
1808
|
},
|
|
1630
|
-
|
|
1631
|
-
this
|
|
1809
|
+
computeScrollXHeight () {
|
|
1810
|
+
const $xeTable = this
|
|
1811
|
+
|
|
1812
|
+
$xeTable.reScrollFlag++
|
|
1813
|
+
$xeTable.reLayoutFlag++
|
|
1632
1814
|
},
|
|
1633
|
-
|
|
1634
|
-
this
|
|
1815
|
+
computeScrollYWidth () {
|
|
1816
|
+
const $xeTable = this
|
|
1817
|
+
|
|
1818
|
+
$xeTable.reScrollFlag++
|
|
1819
|
+
$xeTable.reLayoutFlag++
|
|
1820
|
+
},
|
|
1821
|
+
computeCellHeitht () {
|
|
1822
|
+
const $xeTable = this
|
|
1823
|
+
|
|
1824
|
+
$xeTable.reLayoutFlag++
|
|
1635
1825
|
},
|
|
1636
1826
|
reLayoutFlag () {
|
|
1637
1827
|
const $xeTable = this
|
|
1638
1828
|
|
|
1639
|
-
$xeTable.$nextTick(() =>
|
|
1829
|
+
$xeTable.$nextTick(() => {
|
|
1830
|
+
$xeTable.recalculate(true)
|
|
1831
|
+
})
|
|
1832
|
+
},
|
|
1833
|
+
reScrollFlag () {
|
|
1834
|
+
const $xeTable = this
|
|
1835
|
+
|
|
1836
|
+
$xeTable.$nextTick(() => {
|
|
1837
|
+
$xeTable.updateScrollbar()
|
|
1838
|
+
$xeTable.$nextTick(() => {
|
|
1839
|
+
$xeTable.updateScrollbar()
|
|
1840
|
+
})
|
|
1841
|
+
})
|
|
1640
1842
|
},
|
|
1641
1843
|
|
|
1642
1844
|
footerData () {
|
|
@@ -1752,7 +1954,6 @@ export default {
|
|
|
1752
1954
|
const props = $xeTable
|
|
1753
1955
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1754
1956
|
|
|
1755
|
-
($xeTable as any).scrollDefaultConf = Object.assign({}, getConfig().scrollbar)
|
|
1756
1957
|
XEUtils.assign(internalData, createInternalData())
|
|
1757
1958
|
|
|
1758
1959
|
handleKeyField($xeTable)
|
|
@@ -2117,6 +2318,9 @@ export default {
|
|
|
2117
2318
|
}
|
|
2118
2319
|
|
|
2119
2320
|
$xeTable.$nextTick(() => {
|
|
2321
|
+
const { useScrollbar, autoResize } = props
|
|
2322
|
+
const { elemStore } = internalData
|
|
2323
|
+
|
|
2120
2324
|
// 使用已安装的组件,如果未安装则不渲染
|
|
2121
2325
|
const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
|
|
2122
2326
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
@@ -2162,15 +2366,34 @@ export default {
|
|
|
2162
2366
|
}
|
|
2163
2367
|
}
|
|
2164
2368
|
|
|
2165
|
-
|
|
2369
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
2370
|
+
if (useScrollbar) {
|
|
2371
|
+
const viewInnerEl = getRefElem(elemStore['main-body-table'])
|
|
2372
|
+
const scrollObserver = globalResize.create(() => {
|
|
2373
|
+
$xeTable.reScrollFlag++
|
|
2374
|
+
})
|
|
2375
|
+
if (el) {
|
|
2376
|
+
scrollObserver.observe(el)
|
|
2377
|
+
}
|
|
2378
|
+
if (viewInnerEl) {
|
|
2379
|
+
scrollObserver.observe(viewInnerEl)
|
|
2380
|
+
}
|
|
2381
|
+
internalData.scrollObserver = scrollObserver
|
|
2382
|
+
}
|
|
2383
|
+
if (autoResize) {
|
|
2384
|
+
const parentEl = $xeTable.getParentElem()
|
|
2166
2385
|
const resizeObserver = globalResize.create(() => {
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2386
|
+
if (props.autoResize) {
|
|
2387
|
+
$xeTable.handleResizeEvent()
|
|
2169
2388
|
}
|
|
2170
2389
|
})
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2390
|
+
if (el) {
|
|
2391
|
+
resizeObserver.observe(el)
|
|
2392
|
+
}
|
|
2393
|
+
if (parentEl) {
|
|
2394
|
+
resizeObserver.observe(parentEl)
|
|
2395
|
+
}
|
|
2396
|
+
internalData.resizeObserver = resizeObserver
|
|
2174
2397
|
}
|
|
2175
2398
|
})
|
|
2176
2399
|
|
|
@@ -2205,7 +2428,7 @@ export default {
|
|
|
2205
2428
|
const reactData = $xeTable as unknown as TableReactData
|
|
2206
2429
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2207
2430
|
|
|
2208
|
-
const { _sToTime } = internalData
|
|
2431
|
+
const { scrollObserver, resizeObserver, _sToTime } = internalData
|
|
2209
2432
|
if (_sToTime) {
|
|
2210
2433
|
clearTimeout(_sToTime)
|
|
2211
2434
|
}
|
|
@@ -2228,8 +2451,11 @@ export default {
|
|
|
2228
2451
|
tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent)
|
|
2229
2452
|
}
|
|
2230
2453
|
|
|
2231
|
-
if (
|
|
2232
|
-
|
|
2454
|
+
if (scrollObserver) {
|
|
2455
|
+
scrollObserver.disconnect()
|
|
2456
|
+
}
|
|
2457
|
+
if (resizeObserver) {
|
|
2458
|
+
resizeObserver.disconnect()
|
|
2233
2459
|
}
|
|
2234
2460
|
|
|
2235
2461
|
$xeTable.closeTooltip()
|
|
@@ -2387,15 +2613,20 @@ export default {
|
|
|
2387
2613
|
h('div', {
|
|
2388
2614
|
key: 'tw',
|
|
2389
2615
|
class: 'vxe-table--render-wrapper'
|
|
2390
|
-
},
|
|
2391
|
-
? [
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2616
|
+
}, useScrollbar
|
|
2617
|
+
? [renderVirtualBody(h, $xeTable)]
|
|
2618
|
+
: (
|
|
2619
|
+
scrollbarXToTop
|
|
2620
|
+
? [
|
|
2621
|
+
renderScrollX(h, $xeTable),
|
|
2622
|
+
renderNativeBody(h, $xeTable)
|
|
2623
|
+
]
|
|
2624
|
+
: [
|
|
2625
|
+
renderNativeBody(h, $xeTable),
|
|
2626
|
+
renderScrollX(h, $xeTable)
|
|
2627
|
+
]
|
|
2628
|
+
)
|
|
2629
|
+
),
|
|
2399
2630
|
/**
|
|
2400
2631
|
* 空数据
|
|
2401
2632
|
*/
|
|
@@ -49,9 +49,17 @@ export function createInternalData (): TableInternalData {
|
|
|
49
49
|
currentRow: null,
|
|
50
50
|
currentCol: null,
|
|
51
51
|
|
|
52
|
-
//
|
|
53
|
-
|
|
52
|
+
// resizeObserver: undefined,
|
|
53
|
+
|
|
54
|
+
// 滚动条
|
|
55
|
+
// scrollObserver: undefined,
|
|
56
|
+
// isThumbDrag: false,
|
|
57
|
+
thumbDragOffset: 0,
|
|
58
|
+
yThumbTop: 0,
|
|
59
|
+
xThumbLeft: 0,
|
|
54
60
|
lastScrollTop: 0,
|
|
61
|
+
lastScrollLeft: 0,
|
|
62
|
+
|
|
55
63
|
// 单选框属性,已选中保留的行
|
|
56
64
|
radioReserveRow: null,
|
|
57
65
|
// 复选框属性,已选中保留的行集合
|
|
@@ -199,6 +207,11 @@ export function createReactData (): TableReactData {
|
|
|
199
207
|
scrollbarWidth: 0,
|
|
200
208
|
// 横向滚动条的高度
|
|
201
209
|
scrollbarHeight: 0,
|
|
210
|
+
|
|
211
|
+
// 滚动条
|
|
212
|
+
yThumbHeight: 0,
|
|
213
|
+
xThumbWidth: 0,
|
|
214
|
+
|
|
202
215
|
// 行高
|
|
203
216
|
rowHeight: 0,
|
|
204
217
|
// 表格父容器的高度
|
|
@@ -2718,3 +2718,68 @@ div.vxe-table--tooltip-wrapper {
|
|
|
2718
2718
|
outline: 0;
|
|
2719
2719
|
}
|
|
2720
2720
|
}
|
|
2721
|
+
|
|
2722
|
+
// 滚动条
|
|
2723
|
+
.vxe-table--layout-wrapper {
|
|
2724
|
+
&.is--virtual-scrollbar {
|
|
2725
|
+
&.ov-padding {
|
|
2726
|
+
&.overflow-x {
|
|
2727
|
+
&.sx-pos--top {
|
|
2728
|
+
& > .vxe-table--viewport-wrapper {
|
|
2729
|
+
padding-top: var(--vxe-ui-scrollbar-x-height);
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
&.sx-pos--bottom {
|
|
2733
|
+
& > .vxe-table--viewport-wrapper {
|
|
2734
|
+
padding-bottom: var(--vxe-ui-scrollbar-x-height);
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
&.overflow-y {
|
|
2739
|
+
&.sy-pos--left {
|
|
2740
|
+
& > .vxe-table--viewport-wrapper {
|
|
2741
|
+
padding-left: var(--vxe-ui-scrollbar-y-width);
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
&.sy-pos--right {
|
|
2745
|
+
& > .vxe-table--viewport-wrapper {
|
|
2746
|
+
padding-right: var(--vxe-ui-scrollbar-y-width);
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
&.ov-x--auto-hide {
|
|
2752
|
+
&:hover {
|
|
2753
|
+
& > .vxe-scrollbar {
|
|
2754
|
+
& > .vxe-scrollbar--track-x {
|
|
2755
|
+
opacity: 1;
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
& > .vxe-scrollbar {
|
|
2760
|
+
& > .vxe-scrollbar--track-x {
|
|
2761
|
+
opacity: 0;
|
|
2762
|
+
@include baseMixin.createAnimationTransition(opacity, 0.8s);
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
&.ov-y--auto-hide {
|
|
2767
|
+
&:hover {
|
|
2768
|
+
& > .vxe-scrollbar {
|
|
2769
|
+
& > .vxe-scrollbar--track-y {
|
|
2770
|
+
opacity: 1;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
& > .vxe-scrollbar {
|
|
2775
|
+
& > .vxe-scrollbar--track-y {
|
|
2776
|
+
opacity: 0;
|
|
2777
|
+
@include baseMixin.createAnimationTransition(opacity, 0.8s);
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2782
|
+
& > .vxe-scrollbar {
|
|
2783
|
+
position: unset;
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|