vxe-pc-ui 3.19.8 → 3.20.1

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 (97) hide show
  1. package/es/card/src/card.js +18 -3
  2. package/es/icon/style.css +1 -1
  3. package/es/language/fr-FR.js +29 -29
  4. package/es/layout-aside/src/layout-aside.js +8 -5
  5. package/es/layout-body/src/layout-body.js +22 -11
  6. package/es/list/src/list.js +409 -21
  7. package/es/list/style.css +43 -0
  8. package/es/list/style.min.css +1 -1
  9. package/es/scrollbar/src/scrollbar.js +69 -17
  10. package/es/scrollbar/style.css +1 -0
  11. package/es/style.css +1 -1
  12. package/es/style.min.css +1 -1
  13. package/es/tabs/src/tabs.js +19 -3
  14. package/es/tree/src/tree.js +439 -56
  15. package/es/tree/style.css +43 -0
  16. package/es/tree/style.min.css +1 -1
  17. package/es/ui/index.js +1 -1
  18. package/es/ui/src/log.js +1 -1
  19. package/es/ui/src/utils.js +12 -0
  20. package/es/vxe-list/style.css +43 -0
  21. package/es/vxe-list/style.min.css +1 -1
  22. package/es/vxe-scrollbar/style.css +1 -0
  23. package/es/vxe-tree/style.css +43 -0
  24. package/es/vxe-tree/style.min.css +1 -1
  25. package/lib/card/src/card.js +18 -3
  26. package/lib/card/src/card.min.js +1 -1
  27. package/lib/icon/style/style.css +1 -1
  28. package/lib/icon/style/style.min.css +1 -1
  29. package/lib/index.umd.js +956 -126
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/language/fr-FR.js +29 -29
  32. package/lib/language/fr-FR.min.js +1 -1
  33. package/lib/language/fr-FR.umd.js +29 -29
  34. package/lib/layout-aside/src/layout-aside.js +8 -8
  35. package/lib/layout-aside/src/layout-aside.min.js +1 -1
  36. package/lib/layout-body/src/layout-body.js +26 -19
  37. package/lib/layout-body/src/layout-body.min.js +1 -1
  38. package/lib/list/src/list.js +383 -22
  39. package/lib/list/src/list.min.js +1 -1
  40. package/lib/list/style/style.css +43 -0
  41. package/lib/list/style/style.min.css +1 -1
  42. package/lib/scrollbar/src/scrollbar.js +74 -15
  43. package/lib/scrollbar/src/scrollbar.min.js +1 -1
  44. package/lib/scrollbar/style/style.css +1 -0
  45. package/lib/style.css +1 -1
  46. package/lib/style.min.css +1 -1
  47. package/lib/tabs/src/tabs.js +20 -7
  48. package/lib/tabs/src/tabs.min.js +1 -1
  49. package/lib/tree/src/tree.js +416 -53
  50. package/lib/tree/src/tree.min.js +1 -1
  51. package/lib/tree/style/style.css +43 -0
  52. package/lib/tree/style/style.min.css +1 -1
  53. package/lib/ui/index.js +1 -1
  54. package/lib/ui/index.min.js +1 -1
  55. package/lib/ui/src/log.js +1 -1
  56. package/lib/ui/src/log.min.js +1 -1
  57. package/lib/ui/src/utils.js +14 -0
  58. package/lib/ui/src/utils.min.js +1 -1
  59. package/lib/vxe-list/style/style.css +43 -0
  60. package/lib/vxe-list/style/style.min.css +1 -1
  61. package/lib/vxe-scrollbar/style/style.css +1 -0
  62. package/lib/vxe-tree/style/style.css +43 -0
  63. package/lib/vxe-tree/style/style.min.css +1 -1
  64. package/package.json +1 -1
  65. package/packages/card/src/card.ts +19 -3
  66. package/packages/language/fr-FR.ts +903 -903
  67. package/packages/layout-aside/src/layout-aside.ts +8 -5
  68. package/packages/layout-body/src/layout-body.ts +26 -14
  69. package/packages/list/src/list.ts +444 -25
  70. package/packages/scrollbar/src/scrollbar.ts +79 -17
  71. package/packages/tabs/src/tabs.ts +20 -7
  72. package/packages/tree/src/tree.ts +482 -67
  73. package/packages/ui/src/utils.ts +14 -0
  74. package/styles/components/list.scss +76 -0
  75. package/styles/components/scrollbar.scss +3 -0
  76. package/styles/components/tree.scss +76 -0
  77. package/types/components/card.d.ts +10 -1
  78. package/types/components/layout-aside.d.ts +10 -1
  79. package/types/components/layout-body.d.ts +10 -1
  80. package/types/components/list.d.ts +33 -2
  81. package/types/components/scrollbar.d.ts +16 -2
  82. package/types/components/table-plugins/extend-cell-area.d.ts +1 -1
  83. package/types/components/table.d.ts +71 -4
  84. package/types/components/tabs.d.ts +10 -1
  85. package/types/components/tree.d.ts +33 -2
  86. /package/es/icon/{iconfont.1791862954819.ttf → iconfont.1791950618327.ttf} +0 -0
  87. /package/es/icon/{iconfont.1791862954819.woff → iconfont.1791950618327.woff} +0 -0
  88. /package/es/icon/{iconfont.1791862954819.woff2 → iconfont.1791950618327.woff2} +0 -0
  89. /package/es/{iconfont.1791862954819.ttf → iconfont.1791950618327.ttf} +0 -0
  90. /package/es/{iconfont.1791862954819.woff → iconfont.1791950618327.woff} +0 -0
  91. /package/es/{iconfont.1791862954819.woff2 → iconfont.1791950618327.woff2} +0 -0
  92. /package/lib/icon/style/{iconfont.1791862954819.ttf → iconfont.1791950618327.ttf} +0 -0
  93. /package/lib/icon/style/{iconfont.1791862954819.woff → iconfont.1791950618327.woff} +0 -0
  94. /package/lib/icon/style/{iconfont.1791862954819.woff2 → iconfont.1791950618327.woff2} +0 -0
  95. /package/lib/{iconfont.1791862954819.ttf → iconfont.1791950618327.ttf} +0 -0
  96. /package/lib/{iconfont.1791862954819.woff → iconfont.1791950618327.woff} +0 -0
  97. /package/lib/{iconfont.1791862954819.woff2 → iconfont.1791950618327.woff2} +0 -0
@@ -1,17 +1,18 @@
1
1
  import { PropType, CreateElement, VNode } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils, { XEBrowse } from 'xe-utils'
4
- import { VxeUI, getConfig, getIcon, getI18n, menus, globalEvents, globalResize, createEvent, globalMixins, renderEmptyElement } from '../../ui'
4
+ import { VxeUI, getConfig, getIcon, getI18n, domUtils, menus, globalEvents, globalResize, createEvent, globalMixins, renderEmptyElement } from '../../ui'
5
5
  import { crossListDragRowGlobal, getCrossListDragRowInfo } from './store'
6
6
  import { addClass, getTpImg, hasClass, isScale, removeClass, toCssUnit } from '../../ui/src/dom'
7
- import { isEnableConf, getText, enModelValue, deModelValue } from '../../ui/src/utils'
7
+ import { isEnableConf, getText, enModelValue, deModelValue, getDefaultConfig } from '../../ui/src/utils'
8
8
  import { getSlotVNs } from '../../ui/src/vn'
9
9
  import { createComponentLog } from '../../ui/src/log'
10
10
  import { moveRowAnimateToTb, clearRowAnimate } from '../../ui/src/anime'
11
+ import { getThumbOffsetSize, getThumbSize, getScrollFromClick, getScrollFromDrag } from '../../scrollbar/src/util'
11
12
  import { getItemCacheObj } from './util'
12
13
  import VxeLoadingComponent from '../../loading'
13
14
 
14
- import type { VxeListPropTypes, VxeListEmits, VxeComponentSizeType, ListReactData, VxeListDefines, ValueOf, ListInternalData, VxeListConstructor, VxeListPrivateMethods, VxeComponentStyleType } from '../../../types'
15
+ import type { VxeListPropTypes, VxeListEmits, VxeComponentSizeType, ListReactData, VxeListDefines, ValueOf, ListInternalData, VxeListConstructor, VxeListPrivateMethods, VxeComponentStyleType, VxeScrollbarPropTypes } from '../../../types'
15
16
 
16
17
  const { warnLog, errLog } = createComponentLog('tree')
17
18
 
@@ -52,6 +53,11 @@ function createReactData (): ListReactData {
52
53
  updateCheckboxFlag: 1,
53
54
  isAllChecked: false,
54
55
  isAllIndeterminate: false,
56
+
57
+ // 滚动条
58
+ yThumbHeight: 0,
59
+ xThumbWidth: 0,
60
+
55
61
  insertRowFlag: 1,
56
62
  removeRowFlag: 1,
57
63
  dragRow: null,
@@ -62,13 +68,20 @@ function createReactData (): ListReactData {
62
68
 
63
69
  function createInternalData (): ListInternalData {
64
70
  return {
65
- resizeObserver: undefined,
66
71
  fullData: [],
67
72
  afterList: [],
68
73
  fullKeyMaps: {},
69
74
  rowMaps: {},
70
- lastScrollLeft: 0,
75
+
76
+ // 滚动条
77
+ // resizeObserver: undefined,
78
+ // isThumbDrag: false,
79
+ thumbDragOffset: 0,
80
+ yThumbTop: 0,
81
+ xThumbLeft: 0,
71
82
  lastScrollTop: 0,
83
+ lastScrollLeft: 0,
84
+
72
85
  scrollYStore: {
73
86
  startIndex: 0,
74
87
  endIndex: 0,
@@ -125,7 +138,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
125
138
  dragConfig: Object as PropType<VxeListPropTypes.DragConfig>,
126
139
  menuConfig: Object as PropType<VxeListPropTypes.MenuConfig>,
127
140
  virtualYConfig: Object as PropType<VxeListPropTypes.VirtualYConfig>,
128
- scrollY: Object as PropType<VxeListPropTypes.ScrollY>
141
+ scrollY: Object as PropType<VxeListPropTypes.ScrollY>,
142
+ useScrollbar: {
143
+ type: Boolean as PropType<VxeListPropTypes.UseScrollbar>,
144
+ default: () => getConfig().list.useScrollbar
145
+ },
146
+ scrollbarConfig: Object as PropType<VxeListPropTypes.ScrollbarConfig>
129
147
  },
130
148
  data () {
131
149
  const xID = XEUtils.uniqueId()
@@ -208,11 +226,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
208
226
  const $xeList = this
209
227
 
210
228
  const rowHeight = $xeList.computeRowHeight
211
- const style: VxeComponentStyleType = {}
229
+ const scrollbarOpts = $xeList.computeScrollbarOpts
230
+ const scrollbarXOpts = $xeList.computeScrollbarXOpts as VxeScrollbarPropTypes.XConfig
231
+ const scrollbarYOpts = $xeList.computeScrollbarYOpts as VxeScrollbarPropTypes.YConfig
232
+ const barWidth = getDefaultConfig(getDefaultConfig(scrollbarYOpts.width, scrollbarOpts.width), getConfig().scrollbar.width)
233
+ const barHeight = getDefaultConfig(getDefaultConfig(scrollbarXOpts.height, scrollbarOpts.height), getConfig().scrollbar.height)
234
+ const stys: VxeComponentStyleType = {}
212
235
  if (rowHeight) {
213
- style['--vxe-ui-list-row-height'] = toCssUnit(rowHeight)
236
+ stys['--vxe-ui-list-row-height'] = toCssUnit(rowHeight)
214
237
  }
215
- return style
238
+ if (barWidth || barHeight) {
239
+ stys['--vxe-ui-scrollbar-y-width'] = toCssUnit(barWidth || barHeight)
240
+ stys['--vxe-ui-scrollbar-x-height'] = toCssUnit(barHeight || barWidth)
241
+ }
242
+ return stys
216
243
  },
217
244
  computeVirtualStyles () {
218
245
  const $xeList = this
@@ -229,8 +256,92 @@ export default /* define-vxe-component start */ defineVxeComponent({
229
256
  style.maxHeight = toCssUnit(Math.max(20, customMaxHeight - headHeight - footHeight))
230
257
  }
231
258
  return style
232
- }
259
+ },
260
+ computeScrollbarOpts () {
261
+ const $xeList = this
262
+ const props = $xeList
263
+
264
+ return Object.assign({}, getConfig().list.scrollbarConfig, props.scrollbarConfig)
265
+ },
266
+ computeScrollbarXOpts () {
267
+ const $xeList = this
268
+
269
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
270
+ return Object.assign({}, getConfig().scrollbar.xConfig, scrollbarOpts.xConfig)
271
+ },
272
+ computeScrollbarYOpts () {
273
+ const $xeList = this
274
+
275
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
276
+ return Object.assign({}, getConfig().scrollbar.yConfig, scrollbarOpts.yConfig)
277
+ },
278
+ computeScrollXVisible () {
279
+ const $xeList = this
280
+
281
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
282
+ const scrollbarXOpts = $xeList.computeScrollbarXOpts as VxeScrollbarPropTypes.XConfig
283
+ return getDefaultConfig(scrollbarXOpts.visible, scrollbarOpts.visible)
284
+ },
285
+ computeScrollYVisible () {
286
+ const $xeList = this
287
+
288
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
289
+ const scrollbarYOpts = $xeList.computeScrollbarYOpts as VxeScrollbarPropTypes.YConfig
290
+ return getDefaultConfig(scrollbarYOpts.visible, scrollbarOpts.visible)
291
+ },
292
+ computeScrollXAutoHide () {
293
+ const $xeList = this
294
+
295
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
296
+ const scrollbarXOpts = $xeList.computeScrollbarXOpts as VxeScrollbarPropTypes.XConfig
297
+ return getDefaultConfig(getDefaultConfig(scrollbarXOpts.autoHide, scrollbarOpts.autoHide), getConfig().scrollbar.autoHide)
298
+ },
299
+ computeScrollYAutoHide () {
300
+ const $xeList = this
301
+
302
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
303
+ const scrollbarYOpts = $xeList.computeScrollbarYOpts as VxeScrollbarPropTypes.YConfig
304
+ return getDefaultConfig(getDefaultConfig(scrollbarYOpts.autoHide, scrollbarOpts.autoHide), getConfig().scrollbar.autoHide)
305
+ },
306
+ computeScrollbarWrapperClss () {
307
+ const $xeList = this
308
+ const reactData = $xeList.reactData
309
+
310
+ const scrollbarOpts = $xeList.computeScrollbarOpts as VxeListPropTypes.ScrollbarConfig
311
+ const { padding } = scrollbarOpts
312
+ const { yThumbHeight, xThumbWidth } = reactData
313
+ const scrollbarXToTop = $xeList.computeScrollbarXToTop
314
+ const scrollbarYToLeft = $xeList.computeScrollbarYToLeft
315
+ const scrollXVisible = $xeList.computeScrollXVisible
316
+ const scrollYVisible = $xeList.computeScrollYVisible
317
+ const scrollXAutoHide = $xeList.computeScrollXAutoHide as boolean
318
+ const scrollYAutoHide = $xeList.computeScrollYAutoHide as boolean
319
+ return domUtils.buildClass([
320
+ 'vxe-scrollbar is--virtual',
321
+ `ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}`,
322
+ `ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}`,
323
+ `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}`,
324
+ `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}`
325
+ ], {
326
+ 'is--padding': padding,
327
+ 'ov-x--auto-hide': scrollXAutoHide,
328
+ 'ov-y--auto-hide': scrollYAutoHide,
329
+ 'overflow-y': yThumbHeight,
330
+ 'overflow-x': xThumbWidth
331
+ })
332
+ },
333
+ computeScrollbarXToTop () {
334
+ const $xeList = this
335
+
336
+ const scrollbarXOpts = $xeList.computeScrollbarXOpts as VxeScrollbarPropTypes.XConfig
337
+ return scrollbarXOpts.position === 'top'
338
+ },
339
+ computeScrollbarYToLeft () {
340
+ const $xeList = this
233
341
 
342
+ const scrollbarYOpts = $xeList.computeScrollbarYOpts as VxeScrollbarPropTypes.YConfig
343
+ return scrollbarYOpts.position === 'left'
344
+ }
234
345
  },
235
346
  methods: {
236
347
  //
@@ -573,6 +684,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
573
684
  }
574
685
  })
575
686
  },
687
+ updateScrollbar () {
688
+ const $xeList = this
689
+
690
+ $xeList.updateThumbSize()
691
+ $xeList.updateThumbOffset()
692
+ },
576
693
  /**
577
694
  * 重新计算列表
578
695
  */
@@ -593,6 +710,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
593
710
  parentHeight = parentEl.clientHeight - Math.ceil(XEUtils.toNumber(parentStyle.paddingLeft) + XEUtils.toNumber(parentStyle.paddingRight))
594
711
  }
595
712
  reactData.parentHeight = parentHeight
713
+ $xeList.updateScrollbar()
596
714
  $xeList.updateHeight()
597
715
  if (el.clientWidth && el.clientHeight) {
598
716
  return $xeList.computeScrollLoad()
@@ -629,6 +747,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
629
747
  const scrollLeft = scrollBodyElem.scrollLeft
630
748
  const isX = scrollLeft !== internalData.lastScrollLeft
631
749
  const isY = scrollTop !== internalData.lastScrollTop
750
+ $xeList.updateThumbOffset()
632
751
  internalData.lastScrollTop = scrollTop
633
752
  internalData.lastScrollLeft = scrollLeft
634
753
  if (reactData.scrollYLoad) {
@@ -1951,6 +2070,200 @@ export default /* define-vxe-component start */ defineVxeComponent({
1951
2070
  }
1952
2071
  $xeList.dispatchEvent('row-menu', { row }, evnt)
1953
2072
  },
2073
+ // 滚动条
2074
+ updateThumbSize () {
2075
+ const $xeList = this
2076
+ const reactData = $xeList.reactData
2077
+
2078
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2079
+ if (!viewEl) {
2080
+ return
2081
+ }
2082
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
2083
+ return
2084
+ }
2085
+ const trackXEl = $xeList.$refs.refTrackXElem as HTMLDivElement
2086
+ const xThumbWidth = trackXEl ? getThumbSize(viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth) : 0
2087
+ const thumbXElem = $xeList.$refs.refThumbXElem as HTMLDivElement
2088
+ if (thumbXElem) {
2089
+ thumbXElem.style.width = xThumbWidth + 'px'
2090
+ }
2091
+ reactData.xThumbWidth = xThumbWidth
2092
+
2093
+ const trackYEl = $xeList.$refs.refTrackYElem as HTMLDivElement
2094
+
2095
+ const yThumbHeight = trackYEl ? getThumbSize(viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight) : 0
2096
+ const thumbYElem = $xeList.$refs.refThumbYElem as HTMLDivElement
2097
+ if (thumbYElem) {
2098
+ thumbYElem.style.height = yThumbHeight + 'px'
2099
+ }
2100
+ reactData.yThumbHeight = yThumbHeight
2101
+ },
2102
+ updateThumbOffset () {
2103
+ const $xeList = this
2104
+ const reactData = $xeList.reactData
2105
+ const internalData = $xeList.internalData
2106
+
2107
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2108
+ if (!viewEl) {
2109
+ return
2110
+ }
2111
+ if (!viewEl.clientHeight || !viewEl.clientHeight) {
2112
+ return
2113
+ }
2114
+ const { xThumbWidth, yThumbHeight } = reactData
2115
+ const trackXEl = $xeList.$refs.refTrackXElem as HTMLDivElement
2116
+ const thumbXElem = $xeList.$refs.refThumbXElem as HTMLDivElement
2117
+ const xThumbLeft = trackXEl && xThumbWidth ? getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackXEl.clientWidth, xThumbWidth) : 0
2118
+ internalData.xThumbLeft = xThumbLeft
2119
+ if (thumbXElem && xThumbWidth) {
2120
+ thumbXElem.style.width = xThumbWidth + 'px'
2121
+ thumbXElem.style.transform = `translateX(${xThumbLeft}px)`
2122
+ }
2123
+
2124
+ const trackYEl = $xeList.$refs.refTrackYElem as HTMLDivElement
2125
+ const thumbYElem = $xeList.$refs.refThumbYElem as HTMLDivElement
2126
+ const yThumbTop = trackYEl && yThumbHeight ? getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackYEl.clientHeight, yThumbHeight) : 0
2127
+ internalData.yThumbTop = yThumbTop
2128
+ if (thumbYElem && yThumbHeight) {
2129
+ thumbYElem.style.height = yThumbHeight + 'px'
2130
+ thumbYElem.style.transform = `translateY(${yThumbTop}px)`
2131
+ }
2132
+ },
2133
+ clickTrackXEvent (evnt: MouseEvent) {
2134
+ const $xeList = this
2135
+ const reactData = $xeList.reactData
2136
+
2137
+ const trackEl = evnt.currentTarget as HTMLDivElement
2138
+ if (trackEl !== evnt.target) {
2139
+ return
2140
+ }
2141
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2142
+ if (!viewEl) {
2143
+ return
2144
+ }
2145
+ const { xThumbWidth } = reactData
2146
+ const trackRect = trackEl.getBoundingClientRect()
2147
+ viewEl.scrollTo({
2148
+ left: getScrollFromClick(evnt.clientX - trackRect.left, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth),
2149
+ behavior: 'auto'
2150
+ })
2151
+ },
2152
+ clickTrackYEvent (evnt: MouseEvent) {
2153
+ const $xeList = this
2154
+ const reactData = $xeList.reactData
2155
+
2156
+ const trackEl = evnt.currentTarget as HTMLDivElement
2157
+ if (trackEl !== evnt.target) {
2158
+ return
2159
+ }
2160
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2161
+ if (!viewEl) {
2162
+ return
2163
+ }
2164
+ const { yThumbHeight } = reactData
2165
+ const trackRect = trackEl.getBoundingClientRect()
2166
+ viewEl.scrollTo({
2167
+ top: getScrollFromClick(evnt.clientY - trackRect.top, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight),
2168
+ behavior: 'auto'
2169
+ })
2170
+ },
2171
+ pointerdownThumbXEvent (evnt: PointerEvent) {
2172
+ const $xeList = this
2173
+ const reactData = $xeList.reactData
2174
+ const internalData = $xeList.internalData
2175
+
2176
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2177
+ internalData.isThumbDrag = true
2178
+ thumbEl.setPointerCapture(evnt.pointerId)
2179
+
2180
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2181
+ if (!viewEl) {
2182
+ return
2183
+ }
2184
+ const { xThumbWidth } = reactData
2185
+ const trackEl = thumbEl.parentElement as HTMLDivElement
2186
+ const trackRect = trackEl.getBoundingClientRect()
2187
+ const pointerPosition = evnt.clientX - trackRect.left
2188
+ // 记录 thumb 的偏移
2189
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollLeft, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth)
2190
+ internalData.thumbDragOffset = pointerPosition - thumbOffset
2191
+ },
2192
+ pointermoveThumbXEvent (evnt: PointerEvent) {
2193
+ const $xeList = this
2194
+ const reactData = $xeList.reactData
2195
+ const internalData = $xeList.internalData
2196
+
2197
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2198
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
2199
+ return
2200
+ }
2201
+ const { isThumbDrag, thumbDragOffset } = internalData
2202
+ if (isThumbDrag) {
2203
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2204
+ if (!viewEl) {
2205
+ return
2206
+ }
2207
+ const { xThumbWidth } = reactData
2208
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2209
+ const trackEl = thumbEl.parentElement as HTMLDivElement
2210
+ const trackRect = trackEl.getBoundingClientRect()
2211
+ // 更新偏移
2212
+ viewEl.scrollLeft = getScrollFromDrag(evnt.clientX - trackRect.left, thumbDragOffset, viewEl.clientWidth, viewEl.scrollWidth, trackEl.clientWidth, xThumbWidth)
2213
+ }
2214
+ },
2215
+ cleatPointerThumbEvent (evnt: PointerEvent) {
2216
+ const $xeList = this
2217
+ const internalData = $xeList.internalData
2218
+
2219
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2220
+ thumbEl.releasePointerCapture(evnt.pointerId)
2221
+ internalData.isThumbDrag = false
2222
+ },
2223
+ pointerdownThumbYEvent (evnt: PointerEvent) {
2224
+ const $xeList = this
2225
+ const reactData = $xeList.reactData
2226
+ const internalData = $xeList.internalData
2227
+
2228
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2229
+ internalData.isThumbDrag = true
2230
+ thumbEl.setPointerCapture(evnt.pointerId)
2231
+
2232
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2233
+ if (!viewEl) {
2234
+ return
2235
+ }
2236
+ const { yThumbHeight } = reactData
2237
+ const trackEl = thumbEl.parentElement as HTMLDivElement
2238
+ const trackRect = trackEl.getBoundingClientRect()
2239
+ const pointerPosition = evnt.clientY - trackRect.top
2240
+ // 记录 thumb 的偏移
2241
+ const thumbOffset = getThumbOffsetSize(viewEl.scrollTop, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight)
2242
+ internalData.thumbDragOffset = pointerPosition - thumbOffset
2243
+ },
2244
+ pointermoveThumbYEvent (evnt: PointerEvent) {
2245
+ const $xeList = this
2246
+ const reactData = $xeList.reactData
2247
+ const internalData = $xeList.internalData
2248
+
2249
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2250
+ if (!thumbEl.hasPointerCapture(evnt.pointerId)) {
2251
+ return
2252
+ }
2253
+ const { isThumbDrag, thumbDragOffset } = internalData
2254
+ if (isThumbDrag) {
2255
+ const viewEl = $xeList.$refs.refVirtualWrapper as HTMLDivElement
2256
+ if (!viewEl) {
2257
+ return
2258
+ }
2259
+ const { yThumbHeight } = reactData
2260
+ const thumbEl = evnt.currentTarget as HTMLDivElement
2261
+ const trackEl = thumbEl.parentElement as HTMLDivElement
2262
+ const trackRect = trackEl.getBoundingClientRect()
2263
+ // 更新偏移
2264
+ viewEl.scrollTop = getScrollFromDrag(evnt.clientY - trackRect.top, thumbDragOffset, viewEl.clientHeight, viewEl.scrollHeight, trackEl.clientHeight, yThumbHeight)
2265
+ }
2266
+ },
1954
2267
 
1955
2268
  //
1956
2269
  // Render
@@ -2215,8 +2528,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
2215
2528
  const reactData = $xeList.reactData
2216
2529
  const slots = $xeList.$scopedSlots
2217
2530
 
2218
- const { showCheckbox, className, loading } = props
2219
- const { bodyHeight, topSpaceHeight, rowList, isAllChecked, isAllIndeterminate } = reactData
2531
+ const { showCheckbox, className, loading, useScrollbar } = props
2532
+ const { bodyHeight, topSpaceHeight, rowList, isAllChecked, isAllIndeterminate, xThumbWidth, yThumbHeight } = reactData
2220
2533
  const defaultSlot = slots.default
2221
2534
  const headerSlot = slots.header
2222
2535
  const footerSlot = slots.footer
@@ -2229,6 +2542,15 @@ export default /* define-vxe-component start */ defineVxeComponent({
2229
2542
  const { trigger, isCrossListDrag } = dragOpts
2230
2543
  const rowOpts = $xeList.computeRowOpts
2231
2544
  const { isHover, padding } = rowOpts
2545
+ const isDrag = $xeList.computeIsDrag
2546
+ const scrollbarOpts = $xeList.computeScrollbarOpts
2547
+ const scrollXVisible = $xeList.computeScrollXVisible
2548
+ const scrollYVisible = $xeList.computeScrollYVisible
2549
+ const scrollbarXToTop = $xeList.computeScrollbarXToTop
2550
+ const scrollbarYToLeft = $xeList.computeScrollbarYToLeft
2551
+ const scrollXAutoHide = $xeList.computeScrollXAutoHide
2552
+ const scrollYAutoHide = $xeList.computeScrollYAutoHide
2553
+ const scrollbarWrapperClss = $xeList.computeScrollbarWrapperClss
2232
2554
  const showDefChekboxHead = showCheckbox && checkboxOpts.showHeader !== false
2233
2555
 
2234
2556
  const leOns: {
@@ -2239,10 +2561,25 @@ export default /* define-vxe-component start */ defineVxeComponent({
2239
2561
  }
2240
2562
  return h('div', {
2241
2563
  ref: 'refElem',
2242
- class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
2243
- [`size--${vSize}`]: vSize,
2244
- 'is--loading': loading
2245
- }],
2564
+ class: [
2565
+ 'vxe-list',
2566
+ useScrollbar ? `ov-x--${scrollXVisible === false ? 'hidden' : 'visible'}` : '',
2567
+ useScrollbar ? `ov-y--${scrollYVisible === false ? 'hidden' : 'visible'}` : '',
2568
+ useScrollbar ? `sx-pos--${scrollbarXToTop ? 'top' : 'bottom'}` : '',
2569
+ useScrollbar ? `sy-pos--${scrollbarYToLeft ? 'left' : 'right'}` : '',
2570
+ className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '',
2571
+ {
2572
+ [`size--${vSize}`]: vSize,
2573
+ 'is--virtual-scrollbar': useScrollbar,
2574
+ 'ov-padding': useScrollbar && scrollbarOpts.padding,
2575
+ 'ov-x--auto-hide': useScrollbar && scrollXAutoHide,
2576
+ 'ov-y--auto-hide': useScrollbar && scrollYAutoHide,
2577
+ 'overflow-y': yThumbHeight,
2578
+ 'overflow-x': xThumbWidth,
2579
+ 'is--drag': isDrag,
2580
+ 'is--loading': loading
2581
+ }
2582
+ ],
2246
2583
  on: leOns,
2247
2584
  style: wrapperStyles
2248
2585
  }, [
@@ -2311,6 +2648,57 @@ export default /* define-vxe-component start */ defineVxeComponent({
2311
2648
  class: 'vxe-list--footer-wrapper'
2312
2649
  }, footerSlot({ items: rowList, $list: $xeList }))
2313
2650
  : renderEmptyElement($xeList),
2651
+ /**
2652
+ * 滚动条
2653
+ */
2654
+ useScrollbar
2655
+ ? h('div', {
2656
+ class: scrollbarWrapperClss
2657
+ }, [
2658
+ scrollXVisible === false
2659
+ ? renderEmptyElement($xeList)
2660
+ : h('div', {
2661
+ ref: 'refTrackXElem',
2662
+ class: 'vxe-scrollbar--track-x',
2663
+ on: {
2664
+ click: $xeList.clickTrackXEvent
2665
+ }
2666
+ }, [
2667
+ h('div', {
2668
+ ref: 'refThumbXElem',
2669
+ class: 'vxe-scrollbar--thumb-x',
2670
+ on: {
2671
+ pointerdown: $xeList.pointerdownThumbXEvent,
2672
+ pointermove: $xeList.pointermoveThumbXEvent,
2673
+ pointerup: $xeList.cleatPointerThumbEvent,
2674
+ pointercancel: $xeList.cleatPointerThumbEvent,
2675
+ lostpointercapture: $xeList.cleatPointerThumbEvent
2676
+ }
2677
+ })
2678
+ ]),
2679
+ scrollYVisible === false
2680
+ ? renderEmptyElement($xeList)
2681
+ : h('div', {
2682
+ ref: 'refTrackYElem',
2683
+ class: 'vxe-scrollbar--track-y',
2684
+ on: {
2685
+ click: $xeList.clickTrackYEvent
2686
+ }
2687
+ }, [
2688
+ h('div', {
2689
+ ref: 'refThumbYElem',
2690
+ class: 'vxe-scrollbar--thumb-y',
2691
+ on: {
2692
+ pointerdown: $xeList.pointerdownThumbYEvent,
2693
+ pointermove: $xeList.pointermoveThumbYEvent,
2694
+ pointerup: $xeList.cleatPointerThumbEvent,
2695
+ pointercancel: $xeList.cleatPointerThumbEvent,
2696
+ lostpointercapture: $xeList.cleatPointerThumbEvent
2697
+ }
2698
+ })
2699
+ ])
2700
+ ])
2701
+ : renderEmptyElement($xeList),
2314
2702
  /**
2315
2703
  * 拖拽提示
2316
2704
  */
@@ -2349,15 +2737,34 @@ export default /* define-vxe-component start */ defineVxeComponent({
2349
2737
 
2350
2738
  $xeList.reFlag++
2351
2739
  },
2740
+ useScrollbar () {
2741
+ const $xeList = this
2742
+
2743
+ $xeList.reFlag++
2744
+ },
2352
2745
  computeRowHeight () {
2353
2746
  const $xeList = this
2354
2747
 
2355
2748
  $xeList.reFlag++
2356
2749
  },
2357
- reFlag () {
2750
+ computeScrollXVisible () {
2358
2751
  const $xeList = this
2359
2752
 
2360
2753
  $xeList.$nextTick(() => {
2754
+ $xeList.reFlag++
2755
+ })
2756
+ },
2757
+ computeScrollYVisible () {
2758
+ const $xeList = this
2759
+
2760
+ $xeList.$nextTick(() => {
2761
+ $xeList.reFlag++
2762
+ })
2763
+ },
2764
+ reFlag () {
2765
+ const $xeList = this
2766
+
2767
+ $xeList.recalculate().then(() => {
2361
2768
  $xeList.recalculate()
2362
2769
  })
2363
2770
  },
@@ -2386,7 +2793,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
2386
2793
  const props = $xeList
2387
2794
  const internalData = $xeList.internalData
2388
2795
 
2389
- const { showSeq, showRadio, showCheckbox } = props
2796
+ const { showSeq, showRadio, showCheckbox, autoResize, useScrollbar } = props
2390
2797
  const rowOpts = $xeList.computeRowOpts
2391
2798
  const { useKey, keyField } = rowOpts
2392
2799
  const isDrag = $xeList.computeIsDrag
@@ -2407,22 +2814,34 @@ export default /* define-vxe-component start */ defineVxeComponent({
2407
2814
  if (useKey && !keyField) {
2408
2815
  errLog('vxe.error.reqSupportProp', ['row-config.useKey', 'row-config.keyField'])
2409
2816
  }
2410
- if (props.autoResize) {
2817
+ if (useScrollbar || autoResize) {
2411
2818
  const el = $xeList.$refs.refElem as HTMLDivElement
2412
- const resizeObserver = globalResize.create(() => $xeList.recalculate())
2413
- resizeObserver.observe(el)
2819
+ const viewInnerEl = $xeList.$refs.refVirtualBody as HTMLDivElement
2820
+ const resizeObserver = globalResize.create(() => {
2821
+ $xeList.reFlag++
2822
+ })
2414
2823
  if (el) {
2415
- resizeObserver.observe(el.parentElement as HTMLDivElement)
2824
+ resizeObserver.observe(el)
2825
+ if (autoResize) {
2826
+ resizeObserver.observe(el.parentElement as HTMLDivElement)
2827
+ }
2828
+ }
2829
+ if (viewInnerEl) {
2830
+ resizeObserver.observe(viewInnerEl)
2416
2831
  }
2417
2832
  internalData.resizeObserver = resizeObserver
2418
2833
  }
2419
- $xeList.recalculate()
2420
- globalEvents.on($xeList, 'resize', $xeList.recalculate)
2834
+ $xeList.reFlag++
2835
+ globalEvents.on($xeList, 'resize', () => {
2836
+ $xeList.reFlag++
2837
+ })
2421
2838
  },
2422
2839
  activated () {
2423
2840
  const $xeList = this
2424
2841
 
2425
- $xeList.recalculate().then(() => $xeList.refreshScroll())
2842
+ $xeList.recalculate().then(() => {
2843
+ $xeList.refreshScroll()
2844
+ })
2426
2845
  },
2427
2846
  beforeDestroy () {
2428
2847
  const $xeList = this