vxe-table 4.23.0-beta.0 → 4.23.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.
Files changed (58) hide show
  1. package/README.md +2 -2
  2. package/dist/all.esm.js +540 -103
  3. package/dist/style.css +1 -1
  4. package/dist/style.min.css +1 -1
  5. package/es/index.css +1 -1
  6. package/es/index.min.css +1 -1
  7. package/es/locale/lang/fr-FR.js +29 -29
  8. package/es/style.css +1 -1
  9. package/es/style.min.css +1 -1
  10. package/es/table/src/props.js +9 -1
  11. package/es/table/src/scrollbar.js +54 -0
  12. package/es/table/src/table.js +458 -89
  13. package/es/table/src/util.js +11 -2
  14. package/es/table/style.css +30 -0
  15. package/es/table/style.min.css +1 -1
  16. package/es/ui/index.js +9 -11
  17. package/es/ui/src/log.js +1 -1
  18. package/es/vxe-table/style.css +30 -0
  19. package/es/vxe-table/style.min.css +1 -1
  20. package/lib/index.css +1 -1
  21. package/lib/index.min.css +1 -1
  22. package/lib/index.umd.js +118 -38
  23. package/lib/index.umd.min.js +1 -1
  24. package/lib/locale/lang/fr-FR.js +29 -29
  25. package/lib/locale/lang/fr-FR.min.js +1 -1
  26. package/lib/locale/lang/fr-FR.umd.js +29 -29
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table/src/props.js +9 -1
  30. package/lib/table/src/props.min.js +1 -1
  31. package/lib/table/src/scrollbar.js +63 -0
  32. package/lib/table/src/scrollbar.min.js +1 -0
  33. package/lib/table/src/table.js +33 -23
  34. package/lib/table/src/table.min.js +1 -1
  35. package/lib/table/src/util.js +11 -2
  36. package/lib/table/src/util.min.js +1 -1
  37. package/lib/table/style/style.css +30 -0
  38. package/lib/table/style/style.min.css +1 -1
  39. package/lib/ui/index.js +9 -11
  40. package/lib/ui/index.min.js +1 -1
  41. package/lib/ui/src/log.js +1 -1
  42. package/lib/ui/src/log.min.js +1 -1
  43. package/lib/vxe-table/style/style.css +30 -0
  44. package/lib/vxe-table/style/style.min.css +1 -1
  45. package/package.json +2 -2
  46. package/packages/locale/lang/fr-FR.ts +903 -903
  47. package/packages/table/src/props.ts +9 -1
  48. package/packages/table/src/scrollbar.ts +57 -0
  49. package/packages/table/src/table.ts +494 -91
  50. package/packages/table/src/util.ts +15 -2
  51. package/packages/ui/index.ts +8 -10
  52. package/styles/components/table.scss +65 -0
  53. /package/es/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
  54. /package/es/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
  55. /package/es/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
  56. /package/lib/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
  57. /package/lib/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
  58. /package/lib/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
@@ -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
 
@@ -81,7 +82,10 @@ export const tableProps = {
81
82
  type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentRow>,
82
83
  default: () => getConfig().table.highlightCurrentRow
83
84
  },
84
- // (即将废弃)鼠标移到行是否要高亮显示
85
+ /**
86
+ * (即将废弃)鼠标移到行是否要高亮显示
87
+ * @deprecated
88
+ */
85
89
  highlightHoverRow: {
86
90
  type: Boolean as PropType<VxeTablePropTypes.HighlightHoverRow>,
87
91
  default: () => getConfig().table.highlightHoverRow
@@ -305,6 +309,10 @@ export const tableProps = {
305
309
  virtualXConfig: Object as PropType<VxeTablePropTypes.VirtualXConfig>,
306
310
  // 纵向虚拟滚动配置项
307
311
  virtualYConfig: Object as PropType<VxeTablePropTypes.VirtualYConfig>,
312
+ useScrollbar: {
313
+ type: Boolean as PropType<VxeTablePropTypes.UseScrollbar>,
314
+ default: () => getDefaultConfig(getConfig().table.useScrollbar, getConfig().useScrollbar)
315
+ },
308
316
  // 滚动条配置项
309
317
  scrollbarConfig: Object as PropType<VxeTablePropTypes.ScrollbarConfig>,
310
318
  // 撤销/恢复历史配置项
@@ -0,0 +1,57 @@
1
+ /**
2
+ * 计算滚动条滑块的长度
3
+ */
4
+ export function getThumbSize (viewportSize: number, contentSize: number, trackSize: number) {
5
+ if (contentSize <= viewportSize) {
6
+ return 0
7
+ }
8
+ const ratio = viewportSize / contentSize
9
+ const ideal = trackSize * ratio
10
+ return Math.max(20, Math.min(ideal, trackSize))
11
+ }
12
+
13
+ /**
14
+ * 计算滚动条滑块的偏移位置
15
+ */
16
+ export function getThumbOffsetSize (offsetSize: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
17
+ const maxScroll = contentSize - viewportSize
18
+ if (maxScroll <= 0) {
19
+ return 0
20
+ }
21
+ const maxThumbOffset = trackSize - thumbSize
22
+ if (maxThumbOffset <= 0) {
23
+ return 0
24
+ }
25
+ const clamped = Math.min(Math.max(offsetSize, 0), maxScroll)
26
+ const ratio = clamped / maxScroll
27
+ return ratio * maxThumbOffset
28
+ }
29
+
30
+ /**
31
+ * 根据点击轨道的位置,计算滑块的偏移位置
32
+ */
33
+ export function getScrollFromClick (clickPosition: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
34
+ const maxThumbOffset = trackSize - thumbSize
35
+ const maxScroll = contentSize - viewportSize
36
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
37
+ return 0
38
+ }
39
+ let thumbOffset = clickPosition - thumbSize / 2
40
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset)
41
+ const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll
42
+ return scrollOffset
43
+ }
44
+
45
+ /**
46
+ * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
47
+ */
48
+ export function getScrollFromDrag (pointerPosition: number, dragOffset: number, viewportSize: number, contentSize: number, trackSize: number, thumbSize: number) {
49
+ const maxScroll = contentSize - viewportSize
50
+ const maxThumbOffset = trackSize - thumbSize
51
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
52
+ return 0
53
+ }
54
+ let thumbOffset = pointerPosition - dragOffset
55
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset)
56
+ return (thumbOffset / maxThumbOffset) * maxScroll
57
+ }