vxe-table 3.25.0-beta.0 → 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/locale/lang/fr-FR.js +29 -29
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/methods.js +248 -40
- package/es/table/src/props.js +5 -0
- package/es/table/src/scrollbar.js +54 -0
- package/es/table/src/table.js +292 -73
- 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 +9 -11
- 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 +366 -84
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/fr-FR.js +29 -29
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +29 -29
- 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 +5 -0
- 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 +265 -62
- 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 +9 -11
- 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/locale/lang/fr-FR.ts +903 -903
- package/packages/table/src/methods.ts +260 -40
- package/packages/table/src/props.ts +5 -0
- package/packages/table/src/scrollbar.ts +57 -0
- package/packages/table/src/table.ts +329 -75
- package/packages/table/src/util.ts +15 -2
- package/packages/ui/index.ts +8 -10
- package/styles/components/table.scss +65 -0
- /package/es/{iconfont.1791880417274.ttf → iconfont.1792035018941.ttf} +0 -0
- /package/es/{iconfont.1791880417274.woff → iconfont.1792035018941.woff} +0 -0
- /package/es/{iconfont.1791880417274.woff2 → iconfont.1792035018941.woff2} +0 -0
- /package/lib/{iconfont.1791880417274.ttf → iconfont.1792035018941.ttf} +0 -0
- /package/lib/{iconfont.1791880417274.woff → iconfont.1792035018941.woff} +0 -0
- /package/lib/{iconfont.1791880417274.woff2 → iconfont.1792035018941.woff2} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CreateElement } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import { getFuncText, hasEnableConf, isEnableConf } from '../../ui/src/utils'
|
|
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'
|
|
@@ -31,7 +31,7 @@ import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTablePropTypes, Ta
|
|
|
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'
|
|
@@ -121,10 +123,15 @@ function renderViewFixed (h: CreateElement, $xeTable: VxeTableConstructor & VxeT
|
|
|
121
123
|
const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
|
|
122
124
|
return h('div', {
|
|
123
125
|
ref: isFixedLeft ? 'refLeftContainer' : 'refRightContainer',
|
|
124
|
-
class: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
class: [
|
|
127
|
+
`vxe-table--fixed-${fixedType}-wrapper`,
|
|
128
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
129
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
130
|
+
{
|
|
131
|
+
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
132
|
+
[`y-ob--${osYBehavior}`]: osYBehavior
|
|
133
|
+
}
|
|
134
|
+
]
|
|
128
135
|
}, [
|
|
129
136
|
showHeader
|
|
130
137
|
? h(TableHeaderComponent, {
|
|
@@ -430,6 +437,7 @@ function renderScrollX (h: CreateElement, $xeTable: VxeTableConstructor & VxeTab
|
|
|
430
437
|
|
|
431
438
|
function renderScrollY (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
432
439
|
return h('div', {
|
|
440
|
+
key: 'vsy',
|
|
433
441
|
ref: 'refScrollYVirtualElem',
|
|
434
442
|
class: 'vxe-table--scroll-y-virtual'
|
|
435
443
|
}, [
|
|
@@ -470,6 +478,8 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
470
478
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
471
479
|
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
472
480
|
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
481
|
+
const scrollXVisible = $xeTable.computeScrollXVisible
|
|
482
|
+
const scrollYVisible = $xeTable.computeScrollYVisible
|
|
473
483
|
const { overscrollBehavior: overscrollXBehavior } = scrollbarXOpts
|
|
474
484
|
const { overscrollBehavior: overscrollYBehavior } = scrollbarYOpts
|
|
475
485
|
const { leftList, rightList } = columnStore
|
|
@@ -477,6 +487,7 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
477
487
|
const osYBehavior = XEUtils.eqNull(overscrollYBehavior) ? scrollbarOpts.overscrollBehavior : overscrollYBehavior
|
|
478
488
|
|
|
479
489
|
return h('div', {
|
|
490
|
+
key: 'tvw',
|
|
480
491
|
ref: 'refTableViewportElem',
|
|
481
492
|
class: ['vxe-table--viewport-wrapper', {
|
|
482
493
|
[`x-ob--${osXBehavior}`]: osXBehavior,
|
|
@@ -484,7 +495,11 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
484
495
|
}]
|
|
485
496
|
}, [
|
|
486
497
|
h('div', {
|
|
487
|
-
class: [
|
|
498
|
+
class: [
|
|
499
|
+
'vxe-table--main-wrapper',
|
|
500
|
+
`sx--${(scrollXVisible === false || scrollXVisible === 'hidden') ? 'hidden' : 'visible'}`,
|
|
501
|
+
`sy--${(scrollYVisible === false || scrollYVisible === 'hidden') ? 'hidden' : 'visible'}`
|
|
502
|
+
]
|
|
488
503
|
}, [
|
|
489
504
|
/**
|
|
490
505
|
* 表头
|
|
@@ -532,9 +547,10 @@ function renderViewport (h: CreateElement, $xeTable: VxeTableConstructor & VxeTa
|
|
|
532
547
|
])
|
|
533
548
|
}
|
|
534
549
|
|
|
535
|
-
function
|
|
550
|
+
function renderNativeBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
|
|
536
551
|
const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
|
|
537
552
|
return h('div', {
|
|
553
|
+
key: 'lnb',
|
|
538
554
|
class: 'vxe-table--layout-wrapper'
|
|
539
555
|
}, scrollbarYToLeft
|
|
540
556
|
? [
|
|
@@ -547,6 +563,87 @@ function renderBody (h: CreateElement, $xeTable: VxeTableConstructor & VxeTableP
|
|
|
547
563
|
])
|
|
548
564
|
}
|
|
549
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
|
+
|
|
550
647
|
export default {
|
|
551
648
|
name: 'VxeTable',
|
|
552
649
|
mixins: [
|
|
@@ -601,7 +698,8 @@ export default {
|
|
|
601
698
|
kfFlag: 0,
|
|
602
699
|
layoutReFlag: 0,
|
|
603
700
|
mergeFooteCellFlag: 0,
|
|
604
|
-
crossTableDragRowInfo: crossTableDragRowGlobal
|
|
701
|
+
crossTableDragRowInfo: crossTableDragRowGlobal,
|
|
702
|
+
scrollDefaultConf: Object.assign({}, getConfig().scrollbar)
|
|
605
703
|
}
|
|
606
704
|
},
|
|
607
705
|
computed: {
|
|
@@ -718,17 +816,61 @@ export default {
|
|
|
718
816
|
},
|
|
719
817
|
computeScrollbarXOpts () {
|
|
720
818
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
721
|
-
const props = $xeTable
|
|
722
819
|
|
|
723
820
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
724
|
-
return Object.assign({}, scrollbarOpts.x,
|
|
821
|
+
return scrollbarOpts.x ? Object.assign({}, scrollbarOpts.x, scrollbarOpts.xConfig) : (scrollbarOpts.xConfig || {})
|
|
725
822
|
},
|
|
726
823
|
computeScrollbarYOpts () {
|
|
727
824
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
728
|
-
const props = $xeTable
|
|
729
825
|
|
|
730
826
|
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
731
|
-
return Object.assign({}, scrollbarOpts.y,
|
|
827
|
+
return scrollbarOpts.y ? Object.assign({}, scrollbarOpts.y, scrollbarOpts.yConfig) : (scrollbarOpts.yConfig || {})
|
|
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)
|
|
732
874
|
},
|
|
733
875
|
computeScrollbarXToTop () {
|
|
734
876
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -742,6 +884,26 @@ export default {
|
|
|
742
884
|
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
743
885
|
return scrollbarYOpts.position === 'left'
|
|
744
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
|
+
},
|
|
745
907
|
computeScrollYThreshold () {
|
|
746
908
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
747
909
|
|
|
@@ -793,6 +955,12 @@ export default {
|
|
|
793
955
|
}
|
|
794
956
|
return cellOpts
|
|
795
957
|
},
|
|
958
|
+
computeCellHeitht () {
|
|
959
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
960
|
+
|
|
961
|
+
const cellOpts = $xeTable.computeCellOpts
|
|
962
|
+
return cellOpts.height
|
|
963
|
+
},
|
|
796
964
|
computeHeaderCellOpts () {
|
|
797
965
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
798
966
|
const $xeGantt = $xeTable.$xeGantt
|
|
@@ -1290,16 +1458,16 @@ export default {
|
|
|
1290
1458
|
computeTableStyle () {
|
|
1291
1459
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1292
1460
|
|
|
1293
|
-
const
|
|
1294
|
-
const
|
|
1295
|
-
const
|
|
1296
|
-
if (
|
|
1297
|
-
|
|
1461
|
+
const barWidth = $xeTable.computeScrollYWidth
|
|
1462
|
+
const barHeight = $xeTable.computeScrollXHeight
|
|
1463
|
+
const stys: VxeComponentStyleType = {}
|
|
1464
|
+
if (barWidth || barHeight) {
|
|
1465
|
+
stys['--vxe-ui-table-view-scrollbar-width'] = toCssUnit(barWidth || barHeight)
|
|
1466
|
+
stys['--vxe-ui-scrollbar-y-width'] = toCssUnit(barWidth || barHeight)
|
|
1467
|
+
stys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(barHeight || barWidth)
|
|
1468
|
+
stys['--vxe-ui-scrollbar-x-height'] = toCssUnit(barHeight || barWidth)
|
|
1298
1469
|
}
|
|
1299
|
-
|
|
1300
|
-
tStys['--vxe-ui-table-view-scrollbar-height'] = toCssUnit(height)
|
|
1301
|
-
}
|
|
1302
|
-
return tStys
|
|
1470
|
+
return stys
|
|
1303
1471
|
},
|
|
1304
1472
|
computeTableRowExpandedList () {
|
|
1305
1473
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -1516,19 +1684,6 @@ export default {
|
|
|
1516
1684
|
},
|
|
1517
1685
|
computeVxeLanguage () {
|
|
1518
1686
|
return VxeUI.getLanguage()
|
|
1519
|
-
},
|
|
1520
|
-
computeScrollbarVisible () {
|
|
1521
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1522
|
-
|
|
1523
|
-
const scrollbarXOpts = $xeTable.computeScrollbarXOpts
|
|
1524
|
-
const scrollbarYOpts = $xeTable.computeScrollbarYOpts
|
|
1525
|
-
return `${scrollbarXOpts.visible}${scrollbarYOpts.visible}`
|
|
1526
|
-
},
|
|
1527
|
-
computeCellConfHeitht () {
|
|
1528
|
-
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1529
|
-
|
|
1530
|
-
const cellOpts = $xeTable.computeCellOpts
|
|
1531
|
-
return cellOpts.height
|
|
1532
1687
|
}
|
|
1533
1688
|
} as any,
|
|
1534
1689
|
watch: {
|
|
@@ -1572,57 +1727,118 @@ export default {
|
|
|
1572
1727
|
},
|
|
1573
1728
|
|
|
1574
1729
|
computeSize () {
|
|
1575
|
-
this
|
|
1730
|
+
const $xeTable = this
|
|
1731
|
+
|
|
1732
|
+
$xeTable.reLayoutFlag++
|
|
1576
1733
|
},
|
|
1577
1734
|
showHeader () {
|
|
1578
|
-
this
|
|
1735
|
+
const $xeTable = this
|
|
1736
|
+
|
|
1737
|
+
$xeTable.reLayoutFlag++
|
|
1579
1738
|
},
|
|
1580
1739
|
showFooter () {
|
|
1581
|
-
this
|
|
1740
|
+
const $xeTable = this
|
|
1741
|
+
|
|
1742
|
+
$xeTable.reLayoutFlag++
|
|
1582
1743
|
},
|
|
1583
1744
|
showHeaderOverflow () {
|
|
1584
|
-
this
|
|
1745
|
+
const $xeTable = this
|
|
1746
|
+
|
|
1747
|
+
$xeTable.reLayoutFlag++
|
|
1585
1748
|
},
|
|
1586
1749
|
showOverflow () {
|
|
1587
1750
|
const $xeTable = this
|
|
1588
1751
|
|
|
1589
1752
|
updateColumnAllOverflow($xeTable)
|
|
1590
|
-
|
|
1753
|
+
$xeTable.reLayoutFlag++
|
|
1591
1754
|
},
|
|
1592
1755
|
showFooterOverflow () {
|
|
1593
|
-
this
|
|
1756
|
+
const $xeTable = this
|
|
1757
|
+
|
|
1758
|
+
$xeTable.reLayoutFlag++
|
|
1594
1759
|
},
|
|
1595
1760
|
overflowX () {
|
|
1596
|
-
this
|
|
1761
|
+
const $xeTable = this
|
|
1762
|
+
|
|
1763
|
+
$xeTable.reLayoutFlag++
|
|
1597
1764
|
},
|
|
1598
1765
|
overflowY () {
|
|
1599
|
-
this
|
|
1766
|
+
const $xeTable = this
|
|
1767
|
+
|
|
1768
|
+
$xeTable.reLayoutFlag++
|
|
1600
1769
|
},
|
|
1601
1770
|
height () {
|
|
1602
|
-
this
|
|
1771
|
+
const $xeTable = this
|
|
1772
|
+
|
|
1773
|
+
$xeTable.reLayoutFlag++
|
|
1603
1774
|
},
|
|
1604
1775
|
maxHeight () {
|
|
1605
|
-
this
|
|
1776
|
+
const $xeTable = this
|
|
1777
|
+
|
|
1778
|
+
$xeTable.reLayoutFlag++
|
|
1779
|
+
},
|
|
1780
|
+
computeVxeLanguage () {
|
|
1781
|
+
const $xeTable = this
|
|
1782
|
+
|
|
1783
|
+
$xeTable.reLayoutFlag++
|
|
1606
1784
|
},
|
|
1607
1785
|
computeScrollbarXToTop () {
|
|
1608
|
-
this
|
|
1786
|
+
const $xeTable = this
|
|
1787
|
+
|
|
1788
|
+
$xeTable.reScrollFlag++
|
|
1789
|
+
$xeTable.reLayoutFlag++
|
|
1609
1790
|
},
|
|
1610
1791
|
computeScrollbarYToLeft () {
|
|
1611
|
-
this
|
|
1792
|
+
const $xeTable = this
|
|
1793
|
+
|
|
1794
|
+
$xeTable.reScrollFlag++
|
|
1795
|
+
$xeTable.reLayoutFlag++
|
|
1612
1796
|
},
|
|
1613
|
-
|
|
1614
|
-
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++
|
|
1615
1808
|
},
|
|
1616
|
-
|
|
1617
|
-
this
|
|
1809
|
+
computeScrollXHeight () {
|
|
1810
|
+
const $xeTable = this
|
|
1811
|
+
|
|
1812
|
+
$xeTable.reScrollFlag++
|
|
1813
|
+
$xeTable.reLayoutFlag++
|
|
1618
1814
|
},
|
|
1619
|
-
|
|
1620
|
-
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++
|
|
1621
1825
|
},
|
|
1622
1826
|
reLayoutFlag () {
|
|
1623
1827
|
const $xeTable = this
|
|
1624
1828
|
|
|
1625
|
-
$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
|
+
})
|
|
1626
1842
|
},
|
|
1627
1843
|
|
|
1628
1844
|
footerData () {
|
|
@@ -1764,6 +1980,7 @@ export default {
|
|
|
1764
1980
|
const areaOpts = $xeTable.computeAreaOpts
|
|
1765
1981
|
const sortOpts = $xeTable.computeSortOpts
|
|
1766
1982
|
const filterOpts = $xeTable.computeFilterOpts
|
|
1983
|
+
const scrollbarOpts = $xeTable.computeScrollbarOpts
|
|
1767
1984
|
const { groupFields } = aggregateOpts
|
|
1768
1985
|
|
|
1769
1986
|
if (props.rowId) {
|
|
@@ -2020,6 +2237,13 @@ export default {
|
|
|
2020
2237
|
// errLog('vxe.error.reqModule', ['Export'])
|
|
2021
2238
|
// }
|
|
2022
2239
|
|
|
2240
|
+
if (scrollbarOpts.x) {
|
|
2241
|
+
warnLog('vxe.error.delProp', ['scrollbar-config.x', 'scrollbar-config.xConfig'])
|
|
2242
|
+
}
|
|
2243
|
+
if (scrollbarOpts.y) {
|
|
2244
|
+
warnLog('vxe.error.delProp', ['scrollbar-config.y', 'scrollbar-config.yConfig'])
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2023
2247
|
Object.assign(scrollYStore, {
|
|
2024
2248
|
startIndex: 0,
|
|
2025
2249
|
endIndex: 1,
|
|
@@ -2094,6 +2318,9 @@ export default {
|
|
|
2094
2318
|
}
|
|
2095
2319
|
|
|
2096
2320
|
$xeTable.$nextTick(() => {
|
|
2321
|
+
const { useScrollbar, autoResize } = props
|
|
2322
|
+
const { elemStore } = internalData
|
|
2323
|
+
|
|
2097
2324
|
// 使用已安装的组件,如果未安装则不渲染
|
|
2098
2325
|
const VxeUILoadingComponent = VxeUI.getComponent('VxeLoading')
|
|
2099
2326
|
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip')
|
|
@@ -2139,15 +2366,34 @@ export default {
|
|
|
2139
2366
|
}
|
|
2140
2367
|
}
|
|
2141
2368
|
|
|
2142
|
-
|
|
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()
|
|
2143
2385
|
const resizeObserver = globalResize.create(() => {
|
|
2144
|
-
if (
|
|
2145
|
-
|
|
2386
|
+
if (props.autoResize) {
|
|
2387
|
+
$xeTable.handleResizeEvent()
|
|
2146
2388
|
}
|
|
2147
2389
|
})
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2390
|
+
if (el) {
|
|
2391
|
+
resizeObserver.observe(el)
|
|
2392
|
+
}
|
|
2393
|
+
if (parentEl) {
|
|
2394
|
+
resizeObserver.observe(parentEl)
|
|
2395
|
+
}
|
|
2396
|
+
internalData.resizeObserver = resizeObserver
|
|
2151
2397
|
}
|
|
2152
2398
|
})
|
|
2153
2399
|
|
|
@@ -2182,7 +2428,7 @@ export default {
|
|
|
2182
2428
|
const reactData = $xeTable as unknown as TableReactData
|
|
2183
2429
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2184
2430
|
|
|
2185
|
-
const { _sToTime } = internalData
|
|
2431
|
+
const { scrollObserver, resizeObserver, _sToTime } = internalData
|
|
2186
2432
|
if (_sToTime) {
|
|
2187
2433
|
clearTimeout(_sToTime)
|
|
2188
2434
|
}
|
|
@@ -2205,8 +2451,11 @@ export default {
|
|
|
2205
2451
|
tableViewportEl.removeEventListener('wheel', $xeTable.triggerBodyWheelEvent)
|
|
2206
2452
|
}
|
|
2207
2453
|
|
|
2208
|
-
if (
|
|
2209
|
-
|
|
2454
|
+
if (scrollObserver) {
|
|
2455
|
+
scrollObserver.disconnect()
|
|
2456
|
+
}
|
|
2457
|
+
if (resizeObserver) {
|
|
2458
|
+
resizeObserver.disconnect()
|
|
2210
2459
|
}
|
|
2211
2460
|
|
|
2212
2461
|
$xeTable.closeTooltip()
|
|
@@ -2248,7 +2497,7 @@ export default {
|
|
|
2248
2497
|
|
|
2249
2498
|
const { xID } = $xeTable
|
|
2250
2499
|
|
|
2251
|
-
const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props
|
|
2500
|
+
const { loading, stripe, useScrollbar, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules, importConfig, exportConfig, printConfig } = props
|
|
2252
2501
|
const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData
|
|
2253
2502
|
const { leftList, rightList } = columnStore
|
|
2254
2503
|
const loadingSlot = slots.loading
|
|
@@ -2296,7 +2545,7 @@ export default {
|
|
|
2296
2545
|
}
|
|
2297
2546
|
return h('div', {
|
|
2298
2547
|
ref: 'refElem',
|
|
2299
|
-
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
2548
|
+
class: ['vxe-table', 'vxe-table--render-default', `tid_${xID}`, `border--${tableBorder}`, useScrollbar ? 'is--virtual-scrollbar' : 'is--native-scrollbar', `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`, `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`, {
|
|
2300
2549
|
[`size--${vSize}`]: vSize,
|
|
2301
2550
|
[`valid-msg--${validOpts.msgMode}`]: !!editRules,
|
|
2302
2551
|
'vxe-editable': !!editConfig,
|
|
@@ -2364,15 +2613,20 @@ export default {
|
|
|
2364
2613
|
h('div', {
|
|
2365
2614
|
key: 'tw',
|
|
2366
2615
|
class: 'vxe-table--render-wrapper'
|
|
2367
|
-
},
|
|
2368
|
-
? [
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
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
|
+
),
|
|
2376
2630
|
/**
|
|
2377
2631
|
* 空数据
|
|
2378
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
|
// 表格父容器的高度
|
package/packages/ui/index.ts
CHANGED
|
@@ -270,16 +270,14 @@ VxeUI.setConfig({
|
|
|
270
270
|
oSize: 0
|
|
271
271
|
},
|
|
272
272
|
scrollbarConfig: {
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
visible: true
|
|
282
|
-
}
|
|
273
|
+
// xConfig: {
|
|
274
|
+
// // position: 'bottom',
|
|
275
|
+
// // visible: true
|
|
276
|
+
// },
|
|
277
|
+
// yConfig: {
|
|
278
|
+
// // position: 'right',
|
|
279
|
+
// // visible: true
|
|
280
|
+
// }
|
|
283
281
|
},
|
|
284
282
|
undoRedoHistoryConfig: {
|
|
285
283
|
stackSize: 50
|