element-plus
Version:
A Component Library for Vue 3
1 lines • 6.25 kB
Source Map (JSON)
{"version":3,"file":"scrollbar.mjs","sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport interface ScrollbarProps {\n /**\n * @description trigger distance(px)\n * @default 0\n */\n distance?: number\n /**\n * @description height of scrollbar\n * @default ''\n */\n height?: number | string\n /**\n * @description max height of scrollbar\n * @default ''\n */\n maxHeight?: number | string\n /**\n * @description whether to use the native scrollbar\n */\n native?: boolean\n /**\n * @description style of wrap\n * @default ''\n */\n wrapStyle?: StyleValue\n /**\n * @description class of wrap\n * @default ''\n */\n wrapClass?: string | string[]\n /**\n * @description class of view\n * @default ''\n */\n viewClass?: string | string[]\n /**\n * @description style of view\n * @default ''\n */\n viewStyle?: StyleValue\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize?: boolean\n /**\n * @description element tag of the view\n * @default 'div'\n */\n tag?: keyof HTMLElementTagNameMap | (string & {})\n /**\n * @description always show\n */\n always?: boolean\n /**\n * @description minimum size of scrollbar\n * @default 20\n */\n minSize?: number\n /**\n * @description Wrap tabindex\n * @default undefined\n */\n tabindex?: number | string\n /**\n * @description id of view\n */\n id?: string\n /**\n * @description role of view\n */\n role?: string\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n /**\n * @description native `aria-orientation` attribute\n */\n ariaOrientation?: 'horizontal' | 'vertical' | 'undefined'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport const scrollbarProps = buildProps({\n /**\n * @description trigger distance(px)\n */\n distance: {\n type: Number,\n default: 0,\n },\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: Boolean,\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: [String, Array],\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: [String, Array, Object],\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description Wrap tabindex\n */\n tabindex: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\nexport type ScrollbarPropsPublic = ExtractPublicPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n 'end-reached': (direction: ScrollbarDirection) =>\n ['left', 'right', 'top', 'bottom'].includes(direction),\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\nexport type ScrollbarDirection = 'top' | 'bottom' | 'left' | 'right'\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar> & unknown\n"],"names":[],"mappings":";;;;AA0FO,MAAM,iBAAiB,UAAA,CAAW;AAAA;AAAA;AAAA;AAAA,EAIvC,QAAA,EAAU;AAAA,IACR,IAAA,EAAM,MAAA;AAAA,IACN,OAAA,EAAS;AAAA,GACX;AAAA;AAAA;AAAA;AAAA,EAIA,MAAA,EA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