element-plus/packages/components/scrollbar/src/util.ts
JeremyWuuuuu 77c7225a9d
docs(components): [virtual-table] basic usage (#7352)
- Add entry for table-v2
- Add basic usage for table-v2
2022-04-24 13:44:40 +08:00

30 lines
637 B
TypeScript

import type { CSSProperties } from 'vue'
export const BAR_MAP = {
vertical: {
offset: 'offsetHeight',
scroll: 'scrollTop',
scrollSize: 'scrollHeight',
size: 'height',
key: 'vertical',
axis: 'Y',
client: 'clientY',
direction: 'top',
},
horizontal: {
offset: 'offsetWidth',
scroll: 'scrollLeft',
scrollSize: 'scrollWidth',
size: 'width',
key: 'horizontal',
axis: 'X',
client: 'clientX',
direction: 'left',
},
} as const
export const renderThumbStyle = ({ move, size, bar }): CSSProperties => ({
[bar.size]: size,
transform: `translate${bar.axis}(${move}%)`,
})