You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 lines
8.6 KiB

{"ast":null,"code":"import { placements } from '@popperjs/core';\nimport { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';\nimport { useSizeProp } from '../../../hooks/use-size/index.mjs';\nimport { useAriaProps } from '../../../hooks/use-aria/index.mjs';\nimport { UPDATE_MODEL_EVENT, INPUT_EVENT, CHANGE_EVENT } from '../../../constants/event.mjs';\nimport { isNumber } from '../../../utils/types.mjs';\nimport { isArray } from '@vue/shared';\nconst sliderProps = buildProps({\n modelValue: {\n type: definePropType([Number, Array]),\n default: 0\n },\n id: {\n type: String,\n default: void 0\n },\n min: {\n type: Number,\n default: 0\n },\n max: {\n type: Number,\n default: 100\n },\n step: {\n type: Number,\n default: 1\n },\n showInput: Boolean,\n showInputControls: {\n type: Boolean,\n default: true\n },\n size: useSizeProp,\n inputSize: useSizeProp,\n showStops: Boolean,\n showTooltip: {\n type: Boolean,\n default: true\n },\n formatTooltip: {\n type: definePropType(Function),\n default: void 0\n },\n disabled: Boolean,\n range: Boolean,\n vertical: Boolean,\n height: String,\n debounce: {\n type: Number,\n default: 300\n },\n rangeStartLabel: {\n type: String,\n default: void 0\n },\n rangeEndLabel: {\n type: String,\n default: void 0\n },\n formatValueText: {\n type: definePropType(Function),\n default: void 0\n },\n tooltipClass: {\n type: String,\n default: void 0\n },\n placement: {\n type: String,\n values: placements,\n default: \"top\"\n },\n marks: {\n type: definePropType(Object)\n },\n validateEvent: {\n type: Boolean,\n default: true\n },\n ...useAriaProps([\"ariaLabel\"])\n});\nconst isValidValue = value => isNumber(value) || isArray(value) && value.every(isNumber);\nconst sliderEmits = {\n [UPDATE_MODEL_EVENT]: isValidValue,\n [INPUT_EVENT]: isValidValue,\n [CHANGE_EVENT]: isValidValue\n};\nexport { sliderEmits, sliderProps };","map":{"version":3,"names":["sliderProps","buildProps","modelValue","type","definePropType","Number","Array","default","id","String","min","max","step","showInput","Boolean","showInputControls","size","useSizeProp","inputSize","showStops","showTooltip","formatTooltip","Function","disabled","range","vertical","height","debounce","rangeStartLabel","rangeEndLabel","formatValueText","tooltipClass","placement","values","placements","marks","Object","validateEvent","useAriaProps","isValidValue","value","isNumber","isArray","every","sliderEmits","UPDATE_MODEL_EVENT","INPUT_EVENT","CHANGE_EVENT"],"sources":["../../../../../../packages/components/slider/src/slider.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport {\n buildProps,\n definePropType,\n isArray,\n isNumber,\n} from '@element-plus/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { useAriaProps, useSizeProp } from '@element-plus/hooks'\nimport type { Arrayable } from '@element-plus/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { SliderMarkerProps } from './marker'\nimport type Slider from './slider.vue'\n\ntype SliderMarks = Record<number, string | SliderMarkerProps['mark']>\n\nexport interface SliderInitData {\n firstValue: number\n secondValue: number\n oldValue?: Arrayable<number>\n dragging: boolean\n sliderSize: number\n}\n\nexport const sliderProps = buildProps({\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType<Arrayable<number>>([Number, Array]),\n default: 0,\n },\n id: {\n type: String,\n default: undefined,\n },\n /**\n * @description minimum value\n */\n min: {\n type: Number,\n default: 0,\n },\n /**\n * @description maximum value\n */\n max: {\n type: Number,\n default: 100,\n },\n /**\n * @description step size\n */\n step: {\n type: Number,\n default: 1,\n },\n /**\n * @description whether to display an input box, works when `range` is false\n */\n showInput: Boolean,\n /**\n * @description whether to display control buttons when `show-input` is true\n */\n showInputControls: {\n type: Boolean,\n default: true,\n },\n /**\n * @description size of the slider wrapper, will not work in vertical mode\n */\n size: useSizeProp,\n /**\n * @description size of the input box, when set `size`, the default is the value of `size`\n */\n inputSize: useSizeProp,\n /**\n * @description whether to display breakpoints\n */\n showStops: Boolean,\n /**\n * @description whether to display tooltip value\n */\n showTooltip: {\n type: Boolean,\n default: true,\n },\n /**\n * @description format to display tooltip value\n */\n formatTooltip: {\n type: definePropType<(val: number) => number | string>(Function),\n default: undefined,\n },\n /**\n * @description whether Slider is disabled\n */\n disabled: Boolean,\n /**\n * @description whether to select a range\n */\n range: Boolean,\n /**\n * @description vertical mode\n */\n vertical: Boolean,\n /**\n * @description slider height, required in vertical mode\n */\n height: String,\n /**\n * @description debounce delay when typing, in milliseconds, works when `show-input` is true\n */\n debounce: {\n type: Number,\n default: 300,\n },\n /**\n * @description when `range` is true, screen reader label for the start of the range\n */\n rangeStartLabel: {\n type: String,\n default: undefined,\n },\n /**\n * @description when `range` is true, screen reader label for the end of the range\n */\n rangeEndLabel: {\n type: String,\n default: undefined,\n },\n /**\n * @description format to display the `aria-valuenow` attribute for screen readers\n */\n formatValueText: {\n type: definePropType<(val: number) => string>(Function),\n default: undefined,\n },\n /**\n * @description custom class name for the tooltip\n */\n tooltipClass: {\n type: String,\n default: undefined,\n },\n /**\n * @description position of Tooltip\n */\n placement: {\n type: String,\n values: placements,\n default: 'top',\n },\n /**\n * @description marks, type of key must be `number` and must in closed interval `[min, max]`, each mark can custom style\n */\n marks: {\n type: definePropType<SliderMarks>(Object),\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n ...useAriaProps(['ariaLabel']),\n} as const)\nexport type SliderProps = ExtractPropTypes<typeof sliderProps>\n\nconst isValidValue = (value: Arrayable<number>) =>\n isNumber(value) || (isArray(value) && value.every(isNumber))\nexport const sliderEmits = {\n [UPDATE_MODEL_EVENT]: isValidValue,\n [INPUT_EVENT]: isValidValue,\n [CHANGE_EVENT]: isValidValue,\n}\nexport type SliderEmits = typeof sliderEmits\n\nexport type SliderInstance = InstanceType<typeof Slider>\n"],"mappings":";;;;;;;AAaY,MAACA,WAAW,GAAGC,UAAU,CAAC;EACpCC,UAAU,EAAE;IACVC,IAAI,EAAEC,cAAc,CAAC,CAACC,MAAM,EAAEC,KAAK,CAAC,CAAC;IACrCC,OAAO,EAAE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