vxe-table 3.25.0-beta.1 → 3.25.0-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.
Files changed (60) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/custom/panel.js +2 -2
  6. package/es/table/module/filter/mixin.js +1 -0
  7. package/es/table/src/methods.js +247 -45
  8. package/es/table/src/props.js +2 -1
  9. package/es/table/src/table.js +274 -68
  10. package/es/table/src/util.js +11 -2
  11. package/es/table/style.css +30 -0
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +1 -1
  14. package/es/ui/src/dom.js +11 -8
  15. package/es/ui/src/log.js +1 -1
  16. package/es/vxe-table/style.css +30 -0
  17. package/es/vxe-table/style.min.css +1 -1
  18. package/lib/index.css +1 -1
  19. package/lib/index.min.css +1 -1
  20. package/lib/index.umd.js +311 -83
  21. package/lib/index.umd.min.js +1 -1
  22. package/lib/style.css +1 -1
  23. package/lib/style.min.css +1 -1
  24. package/lib/table/module/custom/panel.js +2 -2
  25. package/lib/table/module/custom/panel.min.js +1 -1
  26. package/lib/table/module/filter/mixin.js +1 -0
  27. package/lib/table/module/filter/mixin.min.js +1 -1
  28. package/lib/table/src/methods.js +21 -11
  29. package/lib/table/src/methods.min.js +1 -1
  30. package/lib/table/src/props.js +2 -1
  31. package/lib/table/src/props.min.js +1 -1
  32. package/lib/table/src/table.js +261 -56
  33. package/lib/table/src/table.min.js +1 -1
  34. package/lib/table/src/util.js +11 -2
  35. package/lib/table/src/util.min.js +1 -1
  36. package/lib/table/style/style.css +30 -0
  37. package/lib/table/style/style.min.css +1 -1
  38. package/lib/ui/index.js +1 -1
  39. package/lib/ui/index.min.js +1 -1
  40. package/lib/ui/src/dom.js +11 -7
  41. package/lib/ui/src/dom.min.js +1 -1
  42. package/lib/ui/src/log.js +1 -1
  43. package/lib/ui/src/log.min.js +1 -1
  44. package/lib/vxe-table/style/style.css +30 -0
  45. package/lib/vxe-table/style/style.min.css +1 -1
  46. package/package.json +2 -2
  47. package/packages/table/module/custom/panel.ts +2 -2
  48. package/packages/table/module/filter/mixin.ts +1 -0
  49. package/packages/table/src/methods.ts +260 -45
  50. package/packages/table/src/props.ts +2 -1
  51. package/packages/table/src/table.ts +308 -73
  52. package/packages/table/src/util.ts +15 -2
  53. package/packages/ui/src/dom.ts +12 -8
  54. package/styles/components/table.scss +65 -0
  55. /package/es/{iconfont.1791954189007.ttf → iconfont.1792117667851.ttf} +0 -0
  56. /package/es/{iconfont.1791954189007.woff → iconfont.1792117667851.woff} +0 -0
  57. /package/es/{iconfont.1791954189007.woff2 → iconfont.1792117667851.woff2} +0 -0
  58. /package/lib/{iconfont.1791954189007.ttf → iconfont.1792117667851.ttf} +0 -0
  59. /package/lib/{iconfont.1791954189007.woff → iconfont.1792117667851.woff} +0 -0
  60. /package/lib/{iconfont.1791954189007.woff2 → iconfont.1792117667851.woff2} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "3.25.0-beta.1",
3
+ "version": "3.25.0-beta.3",
4
4
  "description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -65,7 +65,7 @@
65
65
  "vue-i18n": "^8.15.1",
66
66
  "vue-router": "^3.5.1",
67
67
  "vue-template-compiler": "2.6.14",
68
- "vxe-pc-ui": "3.20.1"
68
+ "vxe-pc-ui": "3.20.8"
69
69
  },
70
70
  "vetur": {
71
71
  "tags": "helper/vetur/tags.json",
@@ -453,8 +453,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
453
453
  const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
454
454
 
455
455
  if (prevDragGroupField || prevDragAggFnColid) {
456
- if ($xeTable.handlePivotTableAggregatePanelDragendEvent) {
457
- $xeTable.handlePivotTableAggregatePanelDragendEvent(evnt)
456
+ if ($xeTable.handlePivotTableAggPanelDragendEvent) {
457
+ $xeTable.handlePivotTableAggPanelDragendEvent(evnt)
458
458
  }
459
459
  } else if (prevDragCol && dragCol) {
460
460
  // 判断是否有拖动
@@ -72,6 +72,7 @@ function updatePopupStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethod
72
72
  if (transfer) {
73
73
  const ppObj = updatePanelPlacement(currEl, filterWrapperElem, {
74
74
  defaultPlacement: 'bottom',
75
+ appendTo: '',
75
76
  isMinWidth: false,
76
77
  teleportTo: transfer
77
78
  })
@@ -1,6 +1,6 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLeftTo, wheelScrollTopTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasAxternalInputTarget } from '../../ui/src/dom'
3
- import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf, getDefaultConfig } from '../../ui/src/utils'
3
+ import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue, hasEnableConf } from '../../ui/src/utils'
4
4
  import { VxeUI } from '../../ui'
5
5
  import Cell from './cell'
6
6
  import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn, getRowMaxHeight, handleCustomStoreConfig, encodeRowid } from './util'
@@ -14,7 +14,9 @@ import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, TableReactData
14
14
 
15
15
  const { warnLog, errLog } = createComponentLog('table')
16
16
 
17
- const { getConfig, getI18n, renderer, formats, interceptor, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
17
+ const { getConfig, getI18n, renderer, scrollbarUtils, formats, interceptor, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
18
+
19
+ const { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } = scrollbarUtils || {}
18
20
 
19
21
  const supportMaxRow = 5e6
20
22
  const customStorageKey = 'VXE_CUSTOM_STORE'
@@ -1055,13 +1057,13 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1055
1057
  emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - osbHeight}px` : ''
1056
1058
  }
1057
1059
 
1058
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
1059
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
1060
+ const scrollXVisible = $xeTable.computeScrollXVisible
1061
+ const scrollYVisible = $xeTable.computeScrollYVisible
1060
1062
  const scrollbarYToLeft = $xeTable.computeScrollbarYToLeft
1061
1063
 
1062
1064
  let xScrollbarVisible = overflowX ? 'visible' : 'hidden'
1063
- const hideXScroll = scrollbarXOpts.visible === false || scrollbarXOpts.visible === 'hidden'
1064
- if (!hideXScroll || $xeGanttView) {
1065
+ const hideXScroll = scrollXVisible === false || scrollXVisible === 'hidden'
1066
+ if (scrollXVisible === 'visible' || $xeGanttView) {
1065
1067
  osbHeight = scrollbarHeight
1066
1068
  xScrollbarVisible = 'visible'
1067
1069
  } else if (hideXScroll) {
@@ -1070,11 +1072,11 @@ function updateStyle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
1070
1072
  }
1071
1073
 
1072
1074
  let yScrollbarVisible = overflowY ? 'visible' : 'hidden'
1073
- const showYScroll = !(scrollbarYOpts.visible === false || scrollbarYOpts.visible === 'hidden')
1074
- if (!showYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
1075
+ const hideYScroll = scrollYVisible === false || scrollYVisible === 'hidden'
1076
+ if (hideYScroll || (($xeGantt && $xeGanttView && $xeGantt.reactData.showRightView) && !scrollbarYToLeft)) {
1075
1077
  osbWidth = 0
1076
1078
  yScrollbarVisible = 'hidden'
1077
- } else if (showYScroll) {
1079
+ } else if (scrollYVisible === 'visible') {
1078
1080
  osbWidth = scrollbarWidth
1079
1081
  yScrollbarVisible = 'visible'
1080
1082
  }
@@ -2441,14 +2443,6 @@ function autoCellWidth ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
2441
2443
  if (!bodyWrapperElem) {
2442
2444
  return
2443
2445
  }
2444
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
2445
- if (!yHandleEl) {
2446
- return
2447
- }
2448
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
2449
- if (!xHandleEl) {
2450
- return
2451
- }
2452
2446
  const columnOpts = $xeTable.computeColumnOpts
2453
2447
  let tWidth = 0
2454
2448
  const minCellWidth = 40 // 列宽最少限制 40px
@@ -3148,13 +3142,11 @@ function computeScrollLoad ($xeTable: VxeTableConstructor & VxeTablePrivateMetho
3148
3142
  }
3149
3143
 
3150
3144
  function calcScrollbar ($xeTable: VxeTableConstructor & VxeTablePrivateMethods) {
3151
- const scrollDefaultConf = ($xeTable as any).scrollDefaultConf
3152
3145
  const reactData = $xeTable as unknown as TableReactData
3153
3146
  const internalData = $xeTable as unknown as TableInternalData
3154
3147
 
3155
3148
  const { scrollXWidth, scrollYHeight } = reactData
3156
3149
  const { elemStore } = internalData
3157
- const scrollbarOpts = $xeTable.computeScrollbarOpts
3158
3150
  const el = $xeTable.$refs.refElem as HTMLDivElement
3159
3151
  if (!el || !el.clientWidth) {
3160
3152
  return
@@ -3164,24 +3156,30 @@ function calcScrollbar ($xeTable: VxeTableConstructor & VxeTablePrivateMethods)
3164
3156
  const footerTableElem = getRefElem(elemStore['main-footer-table'])
3165
3157
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
3166
3158
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
3159
+ const thumbXElem = $xeTable.$refs.refThumbXElem as HTMLDivElement
3160
+ const thumbYElem = $xeTable.$refs.refThumbYElem as HTMLDivElement
3167
3161
  let overflowY = false
3168
3162
  let overflowX = false
3169
3163
  if (bodyWrapperElem) {
3170
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
3171
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
3172
- const barWidth = XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarYOpts.width, scrollbarOpts.width), scrollDefaultConf.width))
3173
- const barHeight = XEUtils.toNumber(getDefaultConfig(getDefaultConfig(scrollbarXOpts.height, scrollbarOpts.height), scrollDefaultConf.height))
3164
+ const scrollbarOpts = $xeTable.computeScrollbarOpts
3165
+ const barWidth = $xeTable.computeScrollYWidth
3166
+ const barHeight = $xeTable.computeScrollXHeight
3174
3167
  overflowY = scrollYHeight > bodyWrapperElem.clientHeight
3175
- if (yHandleEl) {
3168
+ // 如果是虚拟滚动条
3169
+ if (thumbYElem) {
3170
+ reactData.scrollbarHeight = scrollbarOpts.padding ? thumbYElem.offsetWidth : 0
3171
+ } else if (yHandleEl) {
3176
3172
  reactData.scrollbarWidth = (barWidth || barHeight) || (yHandleEl.offsetWidth - yHandleEl.clientWidth) || 14
3177
3173
  }
3178
3174
  reactData.overflowY = overflowY
3179
3175
 
3180
3176
  overflowX = scrollXWidth > bodyWrapperElem.clientWidth
3181
- if (xHandleEl) {
3177
+ // 如果是虚拟滚动条
3178
+ if (thumbXElem) {
3179
+ reactData.scrollbarHeight = scrollbarOpts.padding ? thumbXElem.offsetHeight : 0
3180
+ } else if (xHandleEl) {
3182
3181
  reactData.scrollbarHeight = (barHeight || barWidth) || (xHandleEl.offsetHeight - xHandleEl.clientHeight) || 14
3183
3182
  }
3184
- reactData.overflowX = overflowX
3185
3183
 
3186
3184
  const hHeight = headerTableElem ? headerTableElem.clientHeight : 0
3187
3185
  const fHeight = footerTableElem ? footerTableElem.clientHeight : 0
@@ -3276,6 +3274,7 @@ function handleLazyRecalculate ($xeTable: VxeTableConstructor & VxeTablePrivateM
3276
3274
  const refreshDelay = resizeOpts.refreshDelay || 30
3277
3275
  const reDelay = rceDelay + refreshDelay
3278
3276
  const el = $xeTable.$refs.refElem as HTMLElement
3277
+ $xeTable.updateScrollbar()
3279
3278
  if (el && el.clientWidth) {
3280
3279
  autoCellWidth($xeTable)
3281
3280
  updateRowExpandStyle($xeTable)
@@ -10271,6 +10270,14 @@ const tableMethods: any = {
10271
10270
  }
10272
10271
  return $xeTable.$nextTick()
10273
10272
  },
10273
+ /**
10274
+ * @private
10275
+ */
10276
+ updateScrollbar () {
10277
+ const $xeTable = this
10278
+ $xeTable.updateThumbSize()
10279
+ $xeTable.updateThumbOffset()
10280
+ },
10274
10281
  /**
10275
10282
  * 表头单元格按下事件
10276
10283
  */
@@ -12687,19 +12694,18 @@ const tableMethods: any = {
12687
12694
  const internalData = $xeTable as unknown as TableInternalData
12688
12695
 
12689
12696
  const { highlightHoverRow } = props
12690
- const { lastScrollLeft, lastScrollTop } = internalData
12691
- const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
12692
- const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
12693
- if (!xHandleEl || !yHandleEl) {
12697
+ const { elemStore, lastScrollLeft, lastScrollTop } = internalData
12698
+ const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
12699
+ if (!bodyScrollElem) {
12694
12700
  return
12695
12701
  }
12696
12702
  const rowOpts = $xeTable.computeRowOpts
12697
12703
  const validTip = $xeTable.$refs.refValidTooltip as VxeTooltipInstance
12698
12704
  const tooltip = $xeTable.$refs.refTooltip as VxeTooltipInstance
12699
- const bodyHeight = yHandleEl.clientHeight
12700
- const bodyWidth = xHandleEl.clientWidth
12701
- const scrollHeight = yHandleEl.scrollHeight
12702
- const scrollWidth = xHandleEl.scrollWidth
12705
+ const bodyHeight = bodyScrollElem.clientHeight
12706
+ const bodyWidth = bodyScrollElem.clientWidth
12707
+ const scrollHeight = bodyScrollElem.scrollHeight
12708
+ const scrollWidth = bodyScrollElem.scrollWidth
12703
12709
  let isTop = false
12704
12710
  let isBottom = false
12705
12711
  let isLeft = false
@@ -12766,6 +12772,7 @@ const tableMethods: any = {
12766
12772
  direction,
12767
12773
  ...params
12768
12774
  }
12775
+ $xeTable.updateThumbOffset()
12769
12776
  updateRowExpandStyle($xeTable)
12770
12777
  checkLastSyncScroll($xeTable, isRollX, isRollY)
12771
12778
  if (isRollX) {
@@ -12813,9 +12820,11 @@ const tableMethods: any = {
12813
12820
  },
12814
12821
  triggerBodyScrollEvent (evnt: Event, fixedType: '' | 'left' | 'right') {
12815
12822
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
12823
+ const props = $xeTable
12816
12824
  const reactData = $xeTable as unknown as TableReactData
12817
12825
  const internalData = $xeTable as unknown as TableInternalData
12818
12826
 
12827
+ const { useScrollbar } = props
12819
12828
  const { scrollYLoad, scrollXLoad } = reactData
12820
12829
  const { elemStore, intoRunScroll, lastScrollTop, lastScrollLeft, inWheelScroll, inVirtualScroll, inHeaderScroll, inBodyScroll, scrollRenderType, inFooterScroll } = internalData
12821
12830
  if (inWheelScroll || inVirtualScroll || inHeaderScroll || inFooterScroll) {
@@ -12835,19 +12844,21 @@ const tableMethods: any = {
12835
12844
  if (!bodyScrollElem) {
12836
12845
  return
12837
12846
  }
12838
- if (!xHandleEl) {
12839
- return
12840
- }
12841
- if (!yHandleEl) {
12842
- return
12847
+ if (!useScrollbar) {
12848
+ if (!xHandleEl) {
12849
+ return
12850
+ }
12851
+ if (!yHandleEl) {
12852
+ return
12853
+ }
12843
12854
  }
12844
12855
  if (inBodyScroll) {
12845
12856
  if (scrollRenderType !== fixedType) {
12846
12857
  return
12847
12858
  }
12848
12859
  }
12849
- let scrollTop = yHandleEl.scrollTop
12850
- let scrollLeft = xHandleEl.scrollLeft
12860
+ let scrollTop = 0
12861
+ let scrollLeft = 0
12851
12862
  if (leftScrollElem && fixedType === 'left') {
12852
12863
  scrollTop = leftScrollElem.scrollTop
12853
12864
  } else if (rightScrollElem && fixedType === 'right') {
@@ -13000,8 +13011,8 @@ const tableMethods: any = {
13000
13011
 
13001
13012
  const { elemStore, lastScrollTop, lastScrollLeft } = internalData
13002
13013
  const rowOpts = $xeTable.computeRowOpts
13003
- const scrollbarXOpts = $xeTable.computeScrollbarXOpts
13004
- const scrollbarYOpts = $xeTable.computeScrollbarYOpts
13014
+ const scrollXVisible = $xeTable.computeScrollXVisible
13015
+ const scrollYVisible = $xeTable.computeScrollYVisible
13005
13016
  const xHandleEl = $xeTable.$refs.refScrollXHandleElem as HTMLDivElement
13006
13017
  const yHandleEl = $xeTable.$refs.refScrollYHandleElem as HTMLDivElement
13007
13018
  const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
@@ -13028,14 +13039,14 @@ const tableMethods: any = {
13028
13039
 
13029
13040
  if (isRollX) {
13030
13041
  // 如果禁用滚动
13031
- if (scrollbarXOpts.visible === false || scrollbarXOpts.visible === 'hidden') {
13042
+ if (scrollXVisible === false || scrollXVisible === 'hidden') {
13032
13043
  evnt.preventDefault()
13033
13044
  return
13034
13045
  }
13035
13046
  }
13036
13047
  if (isRollY) {
13037
13048
  // 如果禁用滚动
13038
- if (scrollbarYOpts.visible === false || scrollbarYOpts.visible === 'hidden') {
13049
+ if (scrollYVisible === false || scrollYVisible === 'hidden') {
13039
13050
  evnt.preventDefault()
13040
13051
  return
13041
13052
  }
@@ -14040,6 +14051,210 @@ const tableMethods: any = {
14040
14051
 
14041
14052
  return $xeTable.handleClearStack()
14042
14053
  },
14054
+
14055
+ // 滚动条
14056
+ updateThumbSize () {
14057
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14058
+ const reactData = $xeTable as unknown as TableReactData
14059
+ const internalData = $xeTable as unknown as TableInternalData
14060
+
14061
+ const { elemStore } = internalData
14062
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14063
+ if (!viewEl) {
14064
+ return
14065
+ }
14066
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
14067
+ return
14068
+ }
14069
+ const trackXEl = $xeTable.$refs.refTrackXElem as HTMLDivElement
14070
+ const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0
14071
+ const thumbXElem = $xeTable.$refs.refThumbXElem as HTMLDivElement
14072
+ if (thumbXElem) {
14073
+ thumbXElem.style.width = xThumbWidth + 'px'
14074
+ }
14075
+ reactData.xThumbWidth = xThumbWidth
14076
+
14077
+ const trackYEl = $xeTable.$refs.refTrackYElem as HTMLDivElement
14078
+
14079
+ const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0
14080
+ const thumbYElem = $xeTable.$refs.refThumbYElem as HTMLDivElement
14081
+ if (thumbYElem) {
14082
+ thumbYElem.style.height = yThumbHeight + 'px'
14083
+ }
14084
+ reactData.yThumbHeight = yThumbHeight
14085
+ },
14086
+ updateThumbOffset () {
14087
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14088
+ const reactData = $xeTable as unknown as TableReactData
14089
+ const internalData = $xeTable as unknown as TableInternalData
14090
+
14091
+ const { elemStore } = internalData
14092
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14093
+ if (!viewEl) {
14094
+ return
14095
+ }
14096
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
14097
+ return
14098
+ }
14099
+ const { xThumbWidth, yThumbHeight } = reactData
14100
+ const trackXEl = $xeTable.$refs.refTrackXElem as HTMLDivElement
14101
+ const thumbXElem = $xeTable.$refs.refThumbXElem as HTMLDivElement
14102
+ const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0
14103
+ internalData.xThumbLeft = xThumbLeft
14104
+ if (thumbXElem && xThumbWidth) {
14105
+ thumbXElem.style.width = xThumbWidth + 'px'
14106
+ thumbXElem.style.transform = `translateX(${xThumbLeft}px)`
14107
+ }
14108
+
14109
+ const trackYEl = $xeTable.$refs.refTrackYElem as HTMLDivElement
14110
+ const thumbYElem = $xeTable.$refs.refThumbYElem as HTMLDivElement
14111
+ const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0
14112
+ internalData.yThumbTop = yThumbTop
14113
+ if (thumbYElem && yThumbHeight) {
14114
+ thumbYElem.style.height = yThumbHeight + 'px'
14115
+ thumbYElem.style.transform = `translateY(${yThumbTop}px)`
14116
+ }
14117
+ },
14118
+ clickTrackXEvent (evnt: MouseEvent) {
14119
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14120
+ const reactData = $xeTable as unknown as TableReactData
14121
+ const internalData = $xeTable as unknown as TableInternalData
14122
+
14123
+ const { elemStore } = internalData
14124
+ const trackEl = evnt.currentTarget as HTMLDivElement
14125
+ if (trackEl !== evnt.target) {
14126
+ return
14127
+ }
14128
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14129
+ if (!viewEl) {
14130
+ return
14131
+ }
14132
+ const { xThumbWidth } = reactData
14133
+ const trackRect = trackEl.getBoundingClientRect()
14134
+ viewEl.scrollTo({
14135
+ left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
14136
+ behavior: 'auto'
14137
+ })
14138
+ },
14139
+ clickTrackYEvent (evnt: MouseEvent) {
14140
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14141
+ const reactData = $xeTable as unknown as TableReactData
14142
+ const internalData = $xeTable as unknown as TableInternalData
14143
+
14144
+ const trackEl = evnt.currentTarget as HTMLDivElement
14145
+ if (trackEl !== evnt.target) {
14146
+ return
14147
+ }
14148
+ const { elemStore } = internalData
14149
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14150
+ if (!viewEl) {
14151
+ return
14152
+ }
14153
+ const { yThumbHeight } = reactData
14154
+ const trackRect = trackEl.getBoundingClientRect()
14155
+ viewEl.scrollTo({
14156
+ top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
14157
+ behavior: 'auto'
14158
+ })
14159
+ },
14160
+ pointerdownThumbXEvent (evnt: PointerEvent) {
14161
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14162
+ const reactData = $xeTable as unknown as TableReactData
14163
+ const internalData = $xeTable as unknown as TableInternalData
14164
+
14165
+ const { elemStore } = internalData
14166
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14167
+ internalData.isThumbDrag = true
14168
+ thumbEl.setPointerCapture(evnt.pointerId)
14169
+
14170
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14171
+ if (!viewEl) {
14172
+ return
14173
+ }
14174
+ const { xThumbWidth } = reactData
14175
+ const trackEl = thumbEl.parentElement as HTMLDivElement
14176
+ const trackRect = trackEl.getBoundingClientRect()
14177
+ const pointerPosition = evnt.clientX - trackRect.left
14178
+ // 记录 thumb 的偏移
14179
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth)
14180
+ internalData.thumbDragOffset = pointerPosition - thumbOffset
14181
+ },
14182
+ pointermoveThumbXEvent (evnt: PointerEvent) {
14183
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14184
+ const reactData = $xeTable as unknown as TableReactData
14185
+ const internalData = $xeTable as unknown as TableInternalData
14186
+
14187
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14188
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
14189
+ return
14190
+ }
14191
+ const { elemStore, isThumbDrag, thumbDragOffset } = internalData
14192
+ if (isThumbDrag) {
14193
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14194
+ if (!viewEl) {
14195
+ return
14196
+ }
14197
+ const { xThumbWidth } = reactData
14198
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14199
+ const trackEl = thumbEl.parentElement as HTMLDivElement
14200
+ const trackRect = trackEl.getBoundingClientRect()
14201
+ // 更新偏移
14202
+ viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth)
14203
+ }
14204
+ },
14205
+ cleatPointerThumbEvent (evnt: PointerEvent) {
14206
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14207
+ const internalData = $xeTable as unknown as TableInternalData
14208
+
14209
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14210
+ thumbEl.releasePointerCapture(evnt.pointerId)
14211
+ internalData.isThumbDrag = false
14212
+ },
14213
+ pointerdownThumbYEvent (evnt: PointerEvent) {
14214
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14215
+ const reactData = $xeTable as unknown as TableReactData
14216
+ const internalData = $xeTable as unknown as TableInternalData
14217
+
14218
+ const { elemStore } = internalData
14219
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14220
+ internalData.isThumbDrag = true
14221
+ thumbEl.setPointerCapture(evnt.pointerId)
14222
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14223
+ if (!viewEl) {
14224
+ return
14225
+ }
14226
+ const { yThumbHeight } = reactData
14227
+ const trackEl = thumbEl.parentElement as HTMLDivElement
14228
+ const trackRect = trackEl.getBoundingClientRect()
14229
+ const pointerPosition = evnt.clientY - trackRect.top
14230
+ // 记录 thumb 的偏移
14231
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight)
14232
+ internalData.thumbDragOffset = pointerPosition - thumbOffset
14233
+ },
14234
+ pointermoveThumbYEvent (evnt: PointerEvent) {
14235
+ const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14236
+ const reactData = $xeTable as unknown as TableReactData
14237
+ const internalData = $xeTable as unknown as TableInternalData
14238
+
14239
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14240
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
14241
+ return
14242
+ }
14243
+ const { elemStore, isThumbDrag, thumbDragOffset } = internalData
14244
+ if (isThumbDrag) {
14245
+ const viewEl = getRefElem(elemStore['main-body-scroll'])
14246
+ if (!viewEl) {
14247
+ return
14248
+ }
14249
+ const { yThumbHeight } = reactData
14250
+ const thumbEl = evnt.currentTarget as HTMLDivElement
14251
+ const trackEl = thumbEl.parentElement as HTMLDivElement
14252
+ const trackRect = trackEl.getBoundingClientRect()
14253
+ // 更新偏移
14254
+ viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight)
14255
+ }
14256
+ },
14257
+ // 滚动条
14043
14258
  dispatchEvent (type: ValueOf<VxeTableEmits>, params: Record<string, any>, evnt: Event | null) {
14044
14259
  const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
14045
14260
  const $xeGrid = $xeTable.$xeGrid
@@ -1,5 +1,6 @@
1
1
  import { PropType } from 'vue'
2
2
  import { VxeUI } from '../../ui'
3
+ import { getDefaultConfig } from '../../ui/src/utils'
3
4
 
4
5
  import type { VxeTablePropTypes } from '../../../types'
5
6
 
@@ -300,7 +301,7 @@ export const tableProps = {
300
301
  virtualYConfig: Object as PropType<VxeTablePropTypes.VirtualYConfig>,
301
302
  useScrollbar: {
302
303
  type: Boolean as PropType<VxeTablePropTypes.UseScrollbar>,
303
- default: () => getConfig().table.useScrollbar
304
+ default: () => getDefaultConfig(getConfig().table.useScrollbar, getConfig().useScrollbar)
304
305
  },
305
306
  // 滚动条配置项
306
307
  scrollbarConfig: Object as PropType<VxeTablePropTypes.ScrollbarConfig>,