primevue-mirror/components/lib/slider/Slider.d.ts

186 lines
4.5 KiB
TypeScript
Raw Normal View History

2023-03-01 11:09:05 +00:00
/**
*
* Slider is a component to provide input with a drag handle.
*
* [Live Demo](https://www.primevue.org/slider/)
*
* @module slider
*
*/
2023-07-06 11:17:08 +00:00
import { ComponentHooks } from '../basecomponent';
import { ClassComponent, GlobalComponentConstructor, PTOptions } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
export declare type SliderPassThroughOptionType = SliderPassThroughAttributes | ((options: SliderPassThroughMethodOptions) => SliderPassThroughAttributes | string) | string | null | undefined;
2023-05-07 10:54:26 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface SliderPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-05-07 10:54:26 +00:00
props: SliderProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link SliderProps.pt}
*/
export interface SliderPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-07 10:54:26 +00:00
*/
root?: SliderPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the range's DOM element.
2023-05-07 10:54:26 +00:00
*/
range?: SliderPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the handle's DOM element.
2023-05-07 10:54:26 +00:00
*/
handle?: SliderPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the start handler's DOM element.
2023-05-07 10:54:26 +00:00
*/
startHandler?: SliderPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the end handler's DOM element.
2023-05-07 10:54:26 +00:00
*/
endHandler?: SliderPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to manage all lifecycle hooks
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-05-07 10:54:26 +00:00
}
/**
* Custom passthrough attributes for each DOM elements
*/
export interface SliderPassThroughAttributes {
[key: string]: any;
}
2023-03-01 11:09:05 +00:00
/**
* Custom slide end event.
* @see {@link SliderEmits.slideend}
*/
2022-09-06 12:03:37 +00:00
export interface SliderSlideEndEvent {
/**
* Original event
*/
originalEvent: Event;
/**
* New value.
*/
value: number;
}
2023-03-01 11:09:05 +00:00
/**
* Defines valid properties in Slider component.
*/
2022-09-06 12:03:37 +00:00
export interface SliderProps {
/**
* Value of the component.
*/
modelValue?: number | number[] | undefined;
/**
* Mininum boundary value.
2023-03-01 11:09:05 +00:00
* @defaultValue 0
2022-09-06 12:03:37 +00:00
*/
min?: number | undefined;
/**
* Maximum boundary value.
2023-03-01 11:09:05 +00:00
* @defaultValue 100
2022-09-06 12:03:37 +00:00
*/
max?: number | undefined;
/**
* Orientation of the slider.
2023-03-08 10:51:52 +00:00
* @defaultValue horizontal
2022-09-06 12:03:37 +00:00
*/
2023-03-01 11:09:05 +00:00
orientation?: 'horizontal' | 'vertical' | undefined;
2022-09-06 12:03:37 +00:00
/**
* Step factor to increment/decrement the value.
2023-03-01 11:09:05 +00:00
* @defaultValue 1
2022-09-06 12:03:37 +00:00
*/
step?: number | undefined;
/**
* When speficed, allows two boundary values to be picked.
2023-03-01 11:09:05 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
range?: boolean | undefined;
/**
* When present, it specifies that the component should be disabled.
2023-03-01 11:09:05 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
/**
* Index of the element in tabbing order.
*/
tabindex?: number | undefined;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
'aria-labelledby'?: string | undefined;
/**
* Used to define a string that labels the element.
*/
'aria-label'?: string | undefined;
2023-05-07 10:54:26 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-07 10:54:26 +00:00
* @type {SliderPassThroughOptions}
*/
pt?: PTOptions<SliderPassThroughOptions>;
2023-05-24 14:09:28 +00:00
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
2022-09-06 12:03:37 +00:00
}
2023-03-01 11:09:05 +00:00
/**
* Defines valid slots in Slider component.
*/
2022-09-14 11:26:01 +00:00
export interface SliderSlots {}
2022-09-06 12:03:37 +00:00
2023-03-01 11:09:05 +00:00
/**
* Defines valid emits in Slider component.
*/
2023-03-01 11:09:42 +00:00
export interface SliderEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {number | number[]} value - New value.
*/
2023-03-01 11:09:05 +00:00
'update:modelValue'(value: number | number[]): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke on value change.
* @param {number} value - New value
*/
2023-03-01 11:09:05 +00:00
change(value: number): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when slide ends.
* @param {SliderSlideEndEvent} event - Custom slide end event.
*/
2023-03-01 11:09:05 +00:00
slideend(event: SliderSlideEndEvent): void;
2023-03-01 11:09:42 +00:00
}
2022-09-06 12:03:37 +00:00
2023-03-01 11:09:05 +00:00
/**
* **PrimeVue - Slider**
*
* _Slider is a component to provide input with a drag handle._
*
* [Live Demo](https://www.primevue.org/slider/)
* --- ---
2023-03-03 10:55:20 +00:00
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
2023-03-01 11:09:05 +00:00
*
* @group Component
*
*/
2022-09-14 11:26:01 +00:00
declare class Slider extends ClassComponent<SliderProps, SliderSlots, SliderEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Slider: GlobalComponentConstructor<Slider>;
2022-09-06 12:03:37 +00:00
}
}
export default Slider;