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.
- package/README.md +2 -2
- package/dist/all.esm.js +540 -103
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/fr-FR.js +29 -29
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/props.js +9 -1
- package/es/table/src/scrollbar.js +54 -0
- package/es/table/src/table.js +458 -89
- package/es/table/src/util.js +11 -2
- package/es/table/style.css +30 -0
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -11
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +30 -0
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +118 -38
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/fr-FR.js +29 -29
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +29 -29
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/props.js +9 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/scrollbar.js +63 -0
- package/lib/table/src/scrollbar.min.js +1 -0
- package/lib/table/src/table.js +33 -23
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +11 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +30 -0
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -11
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +30 -0
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/fr-FR.ts +903 -903
- package/packages/table/src/props.ts +9 -1
- package/packages/table/src/scrollbar.ts +57 -0
- package/packages/table/src/table.ts +494 -91
- package/packages/table/src/util.ts +15 -2
- package/packages/ui/index.ts +8 -10
- package/styles/components/table.scss +65 -0
- /package/es/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
- /package/es/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
- /package/es/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
- /package/lib/{iconfont.1791880428511.ttf → iconfont.1792035024476.ttf} +0 -0
- /package/lib/{iconfont.1791880428511.woff → iconfont.1792035024476.woff} +0 -0
- /package/lib/{iconfont.1791880428511.woff2 → iconfont.1792035024476.woff2} +0 -0
package/es/table/src/props.js
CHANGED
|
@@ -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
|
+
}
|