primevue-mirror/components/rating/Rating.d.ts

153 lines
3.3 KiB
TypeScript
Raw Normal View History

2023-03-01 08:50:51 +00:00
/**
*
* Rating component is a star based selection input.
*
* [Live Demo](https://www.primevue.org/rating/)
*
* @module rating
*
*/
2023-01-03 09:31:56 +00:00
import { VNode } from 'vue';
2022-09-06 12:03:37 +00:00
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2023-03-01 08:50:51 +00:00
/**
* Custom change event.
2023-03-01 10:52:00 +00:00
* @see change
2023-03-01 08:50:51 +00:00
*/
2022-09-06 12:03:37 +00:00
export interface RatingChangeEvent {
/**
* Browser event
*/
originalEvent: Event;
/**
* Selected option value
*/
value: number;
}
2023-03-01 08:50:51 +00:00
/**
* Defines valid properties in Rating component.
*/
2022-09-06 12:03:37 +00:00
export interface RatingProps {
/**
* Value of the rating.
*/
modelValue?: number | undefined;
/**
* Name of the element.
*/
name?: string | undefined;
/**
* When present, it specifies that the element should be disabled.
2023-03-01 08:50:51 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
disabled?: boolean | undefined;
/**
* When present, it specifies that component is read-only.
2023-03-01 08:50:51 +00:00
* @defaultValue false
2022-09-06 12:03:37 +00:00
*/
readonly?: boolean | undefined;
/**
* Number of stars.
2023-03-01 08:50:51 +00:00
* @defaultValue 5
2022-09-06 12:03:37 +00:00
*/
stars?: number | undefined;
/**
* When specified a cancel icon is displayed to allow clearing the value.
2023-03-01 08:50:51 +00:00
* @defaultValue true
2022-09-06 12:03:37 +00:00
*/
cancel?: boolean | undefined;
2022-09-14 11:26:01 +00:00
/**
* Icon for the on state.
2023-03-03 08:18:55 +00:00
* @defaultValue 'pi pi-star'
2022-09-14 11:26:01 +00:00
*/
onIcon?: string | undefined;
/**
* Icon for the off state.
2023-03-03 08:18:55 +00:00
* @defaultValue 'pi pi-star-fill'
2022-09-14 11:26:01 +00:00
*/
offIcon?: string | undefined;
/**
* Icon for the cancelable state.
2023-03-03 08:18:55 +00:00
* @defaultValue 'pi pi-ban'
2022-09-14 11:26:01 +00:00
*/
cancelIcon?: string | undefined;
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:51 +00:00
/**
* Defines valid slots in Rating component.
*/
2022-09-06 12:03:37 +00:00
export interface RatingSlots {
2022-09-14 11:26:01 +00:00
/**
* Custom cancel icon template.
*/
2023-03-01 08:50:51 +00:00
cancelicon(): VNode[];
2022-09-14 11:26:01 +00:00
/**
* Custom on icon template.
* @param {Object} scope - on icon slot's params.
*/
2023-03-01 08:50:51 +00:00
onicon(scope: {
2022-09-14 11:26:01 +00:00
/**
* Item value
*/
value: number;
2023-03-01 08:50:51 +00:00
}): VNode[];
2022-09-14 11:26:01 +00:00
/**
* Custom off icon template.
* @param {Object} scope - off icon slot's params.
*/
2023-03-01 08:50:51 +00:00
officon(scope: {
2022-09-14 11:26:01 +00:00
/**
* Item value
*/
value: number;
2023-03-01 08:50:51 +00:00
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:51 +00:00
/**
* Defines valid emits in Rating component.
*/
export interface RatingEmits {
2022-09-06 12:03:37 +00:00
/**
* Emitted when the value changes.
* @param {number} value - New value.
*/
2023-03-01 08:50:51 +00:00
'update:modelValue'(value: number): void;
2022-09-06 12:03:37 +00:00
/**
* Callback to invoke when a suggestion is selected.
* @param {RatingChangeEvent} event - Custom change event.
*/
2023-03-01 08:50:51 +00:00
change(event: RatingChangeEvent): void;
2022-09-14 11:26:01 +00:00
/**
* Callback to invoke when the component receives focus.
* @param {Event} event - Browser event.
*/
2023-03-01 08:50:51 +00:00
focus(event: Event): void;
2022-09-14 11:26:01 +00:00
/**
* Callback to invoke when the component loses focus.
* @param {Event} event - Browser event.
*/
2023-03-01 08:50:51 +00:00
blur(event: Event): void;
}
2022-09-06 12:03:37 +00:00
2023-03-01 08:50:51 +00:00
/**
* **PrimeVue - Rating**
*
* _Rating component is a star based selection input._
*
* [Live Demo](https://www.primevue.org/rating/)
* --- ---
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
*
* @group Component
*/
2023-03-01 14:48:23 +00:00
declare class Rating extends ClassComponent<RatingProps, RatingSlots, RatingEmits> {}
2022-09-06 12:03:37 +00:00
declare module '@vue/runtime-core' {
interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Rating: GlobalComponentConstructor<Rating>;
2022-09-06 12:03:37 +00:00
}
}
export default Rating;