@@ -1078,7 +1078,7 @@ export default defineComponent({
1078
1078
const isCustomVisible = isAllCustom || storageOpts . visible
1079
1079
const isCustomFixed = isAllCustom || storageOpts . fixed
1080
1080
const isCustomSort = isAllCustom || storageOpts . sort
1081
- if ( customConfig && ( isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort ) ) {
1081
+ if ( ( customConfig ? isEnableConf ( customOpts ) : customOpts . enabled ) && ( isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort ) ) {
1082
1082
if ( ! tableId ) {
1083
1083
errLog ( 'vxe.error.reqProp' , [ 'id' ] )
1084
1084
return
@@ -1218,12 +1218,7 @@ export default defineComponent({
1218
1218
}
1219
1219
1220
1220
const calcCellWidth = ( ) => {
1221
- const { tableData } = reactData
1222
1221
const autoWidthColumnList = computeAutoWidthColumnList . value
1223
- if ( ! tableData . length || ! autoWidthColumnList . length ) {
1224
- reactData . isCalcColumn = false
1225
- return nextTick ( )
1226
- }
1227
1222
reactData . isCalcColumn = true
1228
1223
return nextTick ( ) . then ( ( ) => {
1229
1224
const { fullColumnIdData } = internalData
@@ -2523,6 +2518,7 @@ export default defineComponent({
2523
2518
const { editStore, scrollYLoad : oldScrollYLoad } = reactData
2524
2519
const { scrollYStore, scrollXStore, lastScrollLeft, lastScrollTop } = internalData
2525
2520
const treeOpts = computeTreeOpts . value
2521
+ const rowOpts = computeRowOpts . value
2526
2522
const { transform } = treeOpts
2527
2523
const childrenField = treeOpts . children || treeOpts . childrenField
2528
2524
let treeData = [ ]
@@ -2586,9 +2582,11 @@ export default defineComponent({
2586
2582
}
2587
2583
if ( sYLoad ) {
2588
2584
if ( showOverflow ) {
2589
- const errColumn = internalData . tableFullColumn . find ( column => column . showOverflow === false )
2590
- if ( errColumn ) {
2591
- errLog ( 'vxe.error.errProp' , [ `column[field="${ errColumn . field } "].show-overflow=false` , 'show-overflow=true' ] )
2585
+ if ( ! rowOpts . height ) {
2586
+ const errColumn = internalData . tableFullColumn . find ( column => column . showOverflow === false )
2587
+ if ( errColumn ) {
2588
+ errLog ( 'vxe.error.errProp' , [ `column[field="${ errColumn . field } "].show-overflow=false` , 'show-overflow=true' ] )
2589
+ }
2592
2590
}
2593
2591
}
2594
2592
@@ -2717,6 +2715,8 @@ export default defineComponent({
2717
2715
}
2718
2716
2719
2717
const parseColumns = ( ) => {
2718
+ const { showOverflow } = props
2719
+ const rowOpts = computeRowOpts . value
2720
2720
const leftList : VxeTableDefines . ColumnInfo [ ] = [ ]
2721
2721
const centerList : VxeTableDefines . ColumnInfo [ ] = [ ]
2722
2722
const rightList : VxeTableDefines . ColumnInfo [ ] = [ ]
@@ -2781,6 +2781,14 @@ export default defineComponent({
2781
2781
reactData . hasFixedColumn = leftList . length > 0 || rightList . length > 0
2782
2782
Object . assign ( columnStore , { leftList, centerList, rightList } )
2783
2783
if ( scrollXLoad ) {
2784
+ if ( showOverflow ) {
2785
+ if ( ! rowOpts . height ) {
2786
+ const errColumn = internalData . tableFullColumn . find ( column => column . showOverflow === false )
2787
+ if ( errColumn ) {
2788
+ errLog ( 'vxe.error.errProp' , [ `column[field="${ errColumn . field } "].show-overflow=false` , 'show-overflow=true' ] )
2789
+ }
2790
+ }
2791
+ }
2784
2792
if ( process . env . VUE_APP_VXE_ENV === 'development' ) {
2785
2793
// if (props.showHeader && !props.showHeaderOverflow) {
2786
2794
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
@@ -3066,7 +3074,7 @@ export default defineComponent({
3066
3074
}
3067
3075
3068
3076
const scrollXEvent = ( evnt : Event ) => {
3069
- const { inFooterScroll, inBodyScroll } = internalData
3077
+ const { inFooterScroll, inBodyScroll, lastScrollTop } = internalData
3070
3078
if ( inFooterScroll ) {
3071
3079
return
3072
3080
}
@@ -3079,10 +3087,17 @@ export default defineComponent({
3079
3087
const bodyElem = tableBody . $el as HTMLDivElement
3080
3088
const headerElem = tableHeader ? tableHeader . $el as HTMLDivElement : null
3081
3089
const footerElem = tableFooter ? tableFooter . $el as HTMLDivElement : null
3090
+ const yHandleEl = refScrollYHandleElem . value
3082
3091
const wrapperEl = evnt . currentTarget as HTMLDivElement
3083
- const { scrollTop, scrollLeft } = wrapperEl
3092
+ const { scrollLeft } = wrapperEl
3093
+ const yBodyEl = yHandleEl || bodyElem
3094
+ let scrollTop = 0
3095
+ if ( yBodyEl ) {
3096
+ scrollTop = yBodyEl . scrollTop
3097
+ }
3084
3098
const isRollX = true
3085
- const isRollY = false
3099
+ const isRollY = scrollTop !== lastScrollTop
3100
+
3086
3101
internalData . inVirtualScroll = true
3087
3102
setScrollLeft ( bodyElem , scrollLeft )
3088
3103
setScrollLeft ( headerElem , scrollLeft )
@@ -3095,7 +3110,7 @@ export default defineComponent({
3095
3110
}
3096
3111
3097
3112
const scrollYEvent = ( evnt : Event ) => {
3098
- const { inFooterScroll, inBodyScroll } = internalData
3113
+ const { inFooterScroll, inBodyScroll, lastScrollLeft } = internalData
3099
3114
if ( inFooterScroll ) {
3100
3115
return
3101
3116
}
@@ -3109,9 +3124,15 @@ export default defineComponent({
3109
3124
const bodyElem = tableBody . $el as HTMLDivElement
3110
3125
const leftElem = leftBody ? leftBody . $el as HTMLDivElement : null
3111
3126
const rightElem = rightBody ? rightBody . $el as HTMLDivElement : null
3127
+ const xHandleEl = refScrollXHandleElem . value
3112
3128
const wrapperEl = evnt . currentTarget as HTMLDivElement
3113
- const { scrollTop, scrollLeft } = wrapperEl
3114
- const isRollX = false
3129
+ const { scrollTop } = wrapperEl
3130
+ const xBodyEl = xHandleEl || bodyElem
3131
+ let scrollLeft = 0
3132
+ if ( xBodyEl ) {
3133
+ scrollLeft = xBodyEl . scrollLeft
3134
+ }
3135
+ const isRollX = scrollLeft !== lastScrollLeft
3115
3136
const isRollY = true
3116
3137
3117
3138
internalData . inVirtualScroll = true
@@ -4957,7 +4978,7 @@ export default defineComponent({
4957
4978
nextTick ( ( ) => {
4958
4979
resolve ( )
4959
4980
} )
4960
- } , 50 )
4981
+ } , 30 )
4961
4982
} )
4962
4983
}
4963
4984
return nextTick ( )
@@ -5574,48 +5595,52 @@ export default defineComponent({
5574
5595
$xeTable . handleClearEdit ( evnt )
5575
5596
// 如果配置了选中功能,则为选中状态
5576
5597
if ( mouseOpts . selected ) {
5577
- nextTick ( ( ) => $xeTable . handleSelected ( params , evnt ) )
5598
+ nextTick ( ( ) => {
5599
+ $xeTable . handleSelected ( params , evnt )
5600
+ } )
5578
5601
}
5579
5602
}
5580
5603
} else {
5581
5604
// 如果是激活状态,退则出到上一行/下一行
5582
5605
if ( selected . row || actived . row ) {
5583
- const targetArgs = selected . row ? selected . args : actived . args
5606
+ const activeParams = selected . row ? selected . args : actived . args
5584
5607
if ( hasShiftKey ) {
5585
5608
if ( keyboardOpts . enterToTab ) {
5586
- $xeTable . moveTabSelected ( targetArgs , hasShiftKey , evnt )
5609
+ $xeTable . moveTabSelected ( activeParams , hasShiftKey , evnt )
5587
5610
} else {
5588
- $xeTable . moveSelected ( targetArgs , isLeftArrow , true , isRightArrow , false , evnt )
5611
+ $xeTable . moveSelected ( activeParams , isLeftArrow , true , isRightArrow , false , evnt )
5589
5612
}
5590
5613
} else {
5591
5614
if ( keyboardOpts . enterToTab ) {
5592
- $xeTable . moveTabSelected ( targetArgs , hasShiftKey , evnt )
5615
+ $xeTable . moveTabSelected ( activeParams , hasShiftKey , evnt )
5593
5616
} else {
5594
- const _rowIndex = $xeTable . getVTRowIndex ( selected . row )
5617
+ const activeRow = selected . row || actived . row
5618
+ const activeColumn = selected . column || actived . column
5619
+ const _rowIndex = $xeTable . getVTRowIndex ( activeRow )
5595
5620
const etrParams = {
5596
- row : selected . row ,
5597
- rowIndex : $xeTable . getRowIndex ( selected . row ) ,
5598
- $rowIndex : $xeTable . getVMRowIndex ( selected . row ) ,
5621
+ row : activeRow ,
5622
+ rowIndex : $xeTable . getRowIndex ( activeRow ) ,
5623
+ $rowIndex : $xeTable . getVMRowIndex ( activeRow ) ,
5599
5624
_rowIndex,
5600
- column : selected . column ,
5601
- columnIndex : $xeTable . getColumnIndex ( selected . column ) ,
5602
- $columnIndex : $xeTable . getVMColumnIndex ( selected . column ) ,
5603
- _columnIndex : $xeTable . getVTColumnIndex ( selected . column ) ,
5625
+ column : activeColumn ,
5626
+ columnIndex : $xeTable . getColumnIndex ( activeColumn ) ,
5627
+ $columnIndex : $xeTable . getVMColumnIndex ( activeColumn ) ,
5628
+ _columnIndex : $xeTable . getVTColumnIndex ( activeColumn ) ,
5604
5629
$table : $xeTable
5605
5630
}
5606
5631
if ( ! beforeEnterMethod || beforeEnterMethod ( etrParams ) !== false ) {
5607
5632
// 最后一行按下回车键,自动追加一行
5608
5633
if ( isLastEnterAppendRow ) {
5609
5634
if ( _rowIndex >= afterFullData . length - 1 ) {
5610
5635
$xeTable . insertAt ( { } , - 1 ) . then ( ( { row : newRow } ) => {
5611
- $xeTable . scrollToRow ( newRow , selected . column )
5612
- $xeTable . setSelectCell ( newRow , selected . column )
5636
+ $xeTable . scrollToRow ( newRow , activeColumn )
5637
+ $xeTable . handleSelected ( { ... activeParams , row : newRow } , evnt )
5613
5638
} )
5614
5639
$xeTable . dispatchEvent ( 'enter-append-row' , etrParams , evnt )
5615
5640
return
5616
5641
}
5617
5642
}
5618
- $xeTable . moveSelected ( targetArgs , isLeftArrow , false , isRightArrow , true , evnt )
5643
+ $xeTable . moveSelected ( activeParams , isLeftArrow , false , isRightArrow , true , evnt )
5619
5644
if ( enterMethod ) {
5620
5645
enterMethod ( etrParams )
5621
5646
}
@@ -6234,6 +6259,7 @@ export default defineComponent({
6234
6259
Object . assign ( reactData . columnStore , { resizeList, pxList, pxMinList, autoMinList, scaleList, scaleMinList, autoList, remainList } )
6235
6260
} ,
6236
6261
saveCustomStore ( type ) {
6262
+ const { customConfig } = props
6237
6263
const tableId = computeTableId . value
6238
6264
const customOpts = computeCustomOpts . value
6239
6265
const { updateStore, storage } = customOpts
@@ -6243,7 +6269,7 @@ export default defineComponent({
6243
6269
const isCustomVisible = isAllCustom || storageOpts . visible
6244
6270
const isCustomFixed = isAllCustom || storageOpts . fixed
6245
6271
const isCustomSort = isAllCustom || storageOpts . sort
6246
- if ( isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort ) {
6272
+ if ( ( customConfig ? isEnableConf ( customOpts ) : customOpts . enabled ) && ( isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort ) ) {
6247
6273
if ( ! tableId ) {
6248
6274
errLog ( 'vxe.error.reqProp' , [ 'id' ] )
6249
6275
return nextTick ( )
@@ -7133,7 +7159,6 @@ export default defineComponent({
7133
7159
const trEl = evnt . currentTarget as HTMLElement
7134
7160
const rowid = trEl . getAttribute ( 'rowid' )
7135
7161
const row = $xeTable . getRowById ( rowid )
7136
- console . log ( rowid )
7137
7162
if ( row ) {
7138
7163
evnt . preventDefault ( )
7139
7164
evnt . preventDefault ( )
@@ -7370,7 +7395,8 @@ export default defineComponent({
7370
7395
}
7371
7396
tablePrivateMethods . checkScrolling ( )
7372
7397
internalData . lastScrollLeft = scrollLeft
7373
- } else {
7398
+ }
7399
+ if ( isRollY ) {
7374
7400
const yThreshold = computeScrollYThreshold . value
7375
7401
isTop = scrollTop <= 0
7376
7402
if ( ! isTop ) {
@@ -8322,8 +8348,10 @@ export default defineComponent({
8322
8348
const customOpts = computeCustomOpts . value
8323
8349
const mouseOpts = computeMouseOpts . value
8324
8350
const rowOpts = computeRowOpts . value
8325
- if ( ! props . id && props . customConfig && ( customOpts . storage === true || ( customOpts . storage && customOpts . storage . resizable ) || ( customOpts . storage && customOpts . storage . visible ) ) ) {
8326
- errLog ( 'vxe.error.reqProp' , [ 'id' ] )
8351
+ if ( ! props . id ) {
8352
+ if ( ( props . customConfig ? isEnableConf ( customOpts ) : customOpts . enabled ) && customOpts . storage ) {
8353
+ errLog ( 'vxe.error.reqProp' , [ 'id' ] )
8354
+ }
8327
8355
}
8328
8356
if ( props . treeConfig && checkboxOpts . range ) {
8329
8357
errLog ( 'vxe.error.noTree' , [ 'checkbox-config.range' ] )
0 commit comments