vxe-table 4.23.0-beta.1 → 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 (52) hide show
  1. package/README.md +2 -2
  2. package/dist/all.esm.js +499 -87
  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/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/table/src/props.js +6 -2
  10. package/es/table/src/scrollbar.js +54 -0
  11. package/es/table/src/table.js +427 -81
  12. package/es/table/src/util.js +11 -2
  13. package/es/table/style.css +30 -0
  14. package/es/table/style.min.css +1 -1
  15. package/es/ui/index.js +1 -1
  16. package/es/ui/src/log.js +1 -1
  17. package/es/vxe-table/style.css +30 -0
  18. package/es/vxe-table/style.min.css +1 -1
  19. package/lib/index.css +1 -1
  20. package/lib/index.min.css +1 -1
  21. package/lib/index.umd.js +106 -28
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/style.css +1 -1
  24. package/lib/style.min.css +1 -1
  25. package/lib/table/src/props.js +6 -2
  26. package/lib/table/src/props.min.js +1 -1
  27. package/lib/table/src/scrollbar.js +63 -0
  28. package/lib/table/src/scrollbar.min.js +1 -0
  29. package/lib/table/src/table.js +32 -22
  30. package/lib/table/src/table.min.js +1 -1
  31. package/lib/table/src/util.js +11 -2
  32. package/lib/table/src/util.min.js +1 -1
  33. package/lib/table/style/style.css +30 -0
  34. package/lib/table/style/style.min.css +1 -1
  35. package/lib/ui/index.js +1 -1
  36. package/lib/ui/index.min.js +1 -1
  37. package/lib/ui/src/log.js +1 -1
  38. package/lib/ui/src/log.min.js +1 -1
  39. package/lib/vxe-table/style/style.css +30 -0
  40. package/lib/vxe-table/style/style.min.css +1 -1
  41. package/package.json +2 -2
  42. package/packages/table/src/props.ts +6 -2
  43. package/packages/table/src/scrollbar.ts +57 -0
  44. package/packages/table/src/table.ts +459 -83
  45. package/packages/table/src/util.ts +15 -2
  46. package/styles/components/table.scss +65 -0
  47. /package/es/{iconfont.1791954193706.ttf → iconfont.1792035024476.ttf} +0 -0
  48. /package/es/{iconfont.1791954193706.woff → iconfont.1792035024476.woff} +0 -0
  49. /package/es/{iconfont.1791954193706.woff2 → iconfont.1792035024476.woff2} +0 -0
  50. /package/lib/{iconfont.1791954193706.ttf → iconfont.1792035024476.ttf} +0 -0
  51. /package/lib/{iconfont.1791954193706.woff → iconfont.1792035024476.woff} +0 -0
  52. /package/lib/{iconfont.1791954193706.woff2 → iconfont.1792035024476.woff2} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-table",
3
- "version": "4.23.0-beta.1",
3
+ "version": "4.23.0-beta.2",
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",
@@ -66,7 +66,7 @@
66
66
  "typescript": "~5.9.3",
67
67
  "vue": "3.4.27",
68
68
  "vue-router": "~4.5.1",
69
- "vxe-pc-ui": "4.20.1"
69
+ "vxe-pc-ui": "4.20.2"
70
70
  },
71
71
  "vetur": {
72
72
  "tags": "helper/vetur/tags.json",
@@ -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
@@ -307,7 +311,7 @@ export const tableProps = {
307
311
  virtualYConfig: Object as PropType<VxeTablePropTypes.VirtualYConfig>,
308
312
  useScrollbar: {
309
313
  type: Boolean as PropType<VxeTablePropTypes.UseScrollbar>,
310
- default: () => getConfig().table.useScrollbar
314
+ default: () => getDefaultConfig(getConfig().table.useScrollbar, getConfig().useScrollbar)
311
315
  },
312
316
  // 滚动条配置项
313
317
  scrollbarConfig: Object as PropType<VxeTablePropTypes.ScrollbarConfig>,
@@ -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
+ }