mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor #3922 - For Slider
This commit is contained in:
parent
0f6803631f
commit
a760c56aef
6 changed files with 157 additions and 5 deletions
48
components/lib/slider/Slider.d.ts
vendored
48
components/lib/slider/Slider.d.ts
vendored
|
@ -9,6 +9,49 @@
|
|||
*/
|
||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||
|
||||
export declare type SliderPassThroughOptionType = SliderPassThroughAttributes | ((options: SliderPassThroughMethodOptions) => SliderPassThroughAttributes) | null | undefined;
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) option method.
|
||||
*/
|
||||
export interface SliderPassThroughMethodOptions {
|
||||
props: SliderProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) options.
|
||||
* @see {@link SliderProps.pt}
|
||||
*/
|
||||
export interface SliderPassThroughOptions {
|
||||
/**
|
||||
* Uses to pass attributes to the root's DOM element.
|
||||
*/
|
||||
root?: SliderPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the range's DOM element.
|
||||
*/
|
||||
range?: SliderPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the handle's DOM element.
|
||||
*/
|
||||
handle?: SliderPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the start handler's DOM element.
|
||||
*/
|
||||
startHandler?: SliderPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the end handler's DOM element.
|
||||
*/
|
||||
endHandler?: SliderPassThroughOptionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough attributes for each DOM elements
|
||||
*/
|
||||
export interface SliderPassThroughAttributes {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom slide end event.
|
||||
* @see {@link SliderEmits.slideend}
|
||||
|
@ -74,6 +117,11 @@ export interface SliderProps {
|
|||
* Used to define a string that labels the element.
|
||||
*/
|
||||
'aria-label'?: string | undefined;
|
||||
/**
|
||||
* Uses to pass attributes to DOM elements inside the component.
|
||||
* @type {SliderPassThroughOptions}
|
||||
*/
|
||||
pt?: SliderPassThroughOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div :class="containerClass" @click="onBarClick">
|
||||
<span class="p-slider-range" :style="rangeStyle"></span>
|
||||
<div :class="containerClass" @click="onBarClick" v-bind="ptm('root')">
|
||||
<span class="p-slider-range" :style="rangeStyle" v-bind="ptm('range')"></span>
|
||||
<span
|
||||
v-if="!range"
|
||||
class="p-slider-handle"
|
||||
|
@ -18,6 +18,7 @@
|
|||
:aria-labelledby="ariaLabelledby"
|
||||
:aria-label="ariaLabel"
|
||||
:aria-orientation="orientation"
|
||||
v-bind="ptm('handle')"
|
||||
></span>
|
||||
<span
|
||||
v-if="range"
|
||||
|
@ -36,6 +37,7 @@
|
|||
:aria-labelledby="ariaLabelledby"
|
||||
:aria-label="ariaLabel"
|
||||
:aria-orientation="orientation"
|
||||
v-bind="ptm('startHandler')"
|
||||
></span>
|
||||
<span
|
||||
v-if="range"
|
||||
|
@ -54,15 +56,18 @@
|
|||
:aria-labelledby="ariaLabelledby"
|
||||
:aria-label="ariaLabel"
|
||||
:aria-orientation="orientation"
|
||||
v-bind="ptm('endHandler')"
|
||||
></span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { DomHandler } from 'primevue/utils';
|
||||
|
||||
export default {
|
||||
name: 'Slider',
|
||||
extends: BaseComponent,
|
||||
emits: ['update:modelValue', 'change', 'slideend'],
|
||||
props: {
|
||||
modelValue: [Number, Array],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue