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,4 +1,5 @@
1
1
  import { VxeUI } from '../../ui';
2
+ import { getDefaultConfig } from '../../ui/src/utils';
2
3
  const { getConfig } = VxeUI;
3
4
  export const tableProps = {
4
5
  /** 基本属性 */
@@ -76,7 +77,10 @@ export const tableProps = {
76
77
  type: Boolean,
77
78
  default: () => getConfig().table.highlightCurrentRow
78
79
  },
79
- // (即将废弃)鼠标移到行是否要高亮显示
80
+ /**
81
+ * (即将废弃)鼠标移到行是否要高亮显示
82
+ * @deprecated
83
+ */
80
84
  highlightHoverRow: {
81
85
  type: Boolean,
82
86
  default: () => getConfig().table.highlightHoverRow
@@ -299,6 +303,10 @@ export const tableProps = {
299
303
  virtualXConfig: Object,
300
304
  // 纵向虚拟滚动配置项
301
305
  virtualYConfig: Object,
306
+ useScrollbar: {
307
+ type: Boolean,
308
+ default: () => getDefaultConfig(getConfig().table.useScrollbar, getConfig().useScrollbar)
309
+ },
302
310
  // 滚动条配置项
303
311
  scrollbarConfig: Object,
304
312
  // 撤销/恢复历史配置项
@@ -0,0 +1,54 @@
1
+ /**
2
+ * 计算滚动条滑块的长度
3
+ */
4
+ export function getThumbSize(viewportSize, contentSize, trackSize) {
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
+ export function getThumbOffsetSize(offsetSize, viewportSize, contentSize, trackSize, thumbSize) {
16
+ const maxScroll = contentSize - viewportSize;
17
+ if (maxScroll <= 0) {
18
+ return 0;
19
+ }
20
+ const maxThumbOffset = trackSize - thumbSize;
21
+ if (maxThumbOffset <= 0) {
22
+ return 0;
23
+ }
24
+ const clamped = Math.min(Math.max(offsetSize, 0), maxScroll);
25
+ const ratio = clamped / maxScroll;
26
+ return ratio * maxThumbOffset;
27
+ }
28
+ /**
29
+ * 根据点击轨道的位置,计算滑块的偏移位置
30
+ */
31
+ export function getScrollFromClick(clickPosition, viewportSize, contentSize, trackSize, thumbSize) {
32
+ const maxThumbOffset = trackSize - thumbSize;
33
+ const maxScroll = contentSize - viewportSize;
34
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
35
+ return 0;
36
+ }
37
+ let thumbOffset = clickPosition - thumbSize / 2;
38
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
39
+ const scrollOffset = (thumbOffset / maxThumbOffset) * maxScroll;
40
+ return scrollOffset;
41
+ }
42
+ /**
43
+ * 拖拽 thumb 时,根据鼠标位置计算滑块的偏移位置
44
+ */
45
+ export function getScrollFromDrag(pointerPosition, dragOffset, viewportSize, contentSize, trackSize, thumbSize) {
46
+ const maxScroll = contentSize - viewportSize;
47
+ const maxThumbOffset = trackSize - thumbSize;
48
+ if (maxScroll <= 0 || maxThumbOffset <= 0) {
49
+ return 0;
50
+ }
51
+ let thumbOffset = pointerPosition - dragOffset;
52
+ thumbOffset = Math.min(Math.max(thumbOffset, 0), maxThumbOffset);
53
+ return (thumbOffset / maxThumbOffset) * maxScroll;
54
+ }