element-plus
Version:
A Component Library for Vue 3
131 lines (130 loc) • 6.6 kB
TypeScript
import type { Component, ExtractPublicPropTypes } from 'vue';
import type { ComponentSize } from 'element-plus/es/constants';
import type Rate from './rate.vue';
export interface RateProps {
/**
* @description binding value
*/
modelValue?: number;
/**
* @description native `id` attribute
*/
id?: string;
/**
* @description threshold value between low and medium level. The value itself will be included in low level
*/
lowThreshold?: number;
/**
* @description threshold value between medium and high level. The value itself will be included in high level
*/
highThreshold?: number;
/**
* @description max rating score
*/
max?: number;
/**
* @description colors for icons. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding color
*/
colors?: string[] | Record<number, string>;
/**
* @description color of unselected icons
*/
voidColor?: string;
/**
* @description color of unselected read-only icons
*/
disabledVoidColor?: string;
/**
* @description icon components. If array, it should have 3 elements, each of which corresponds with a score level, else if object, the key should be threshold value between two levels, and the value should be corresponding icon component
*/
icons?: Array<string | Component> | Record<number, string | Component>;
/**
* @description component of unselected icons
*/
voidIcon?: string | Component;
/**
* @description component of unselected read-only icons
*/
disabledVoidIcon?: string | Component;
/**
* @description whether Rate is read-only
*/
disabled?: boolean;
/**
* @description whether picking half start is allowed
*/
allowHalf?: boolean;
/**
* @description whether to display texts
*/
showText?: boolean;
/**
* @description whether to display current score. show-score and show-text cannot be true at the same time
*/
showScore?: boolean;
/**
* @description color of texts
*/
textColor?: string;
/**
* @description text array
*/
texts?: string[];
/**
* @description score template
*/
scoreTemplate?: string;
/**
* @description size of Rate
*/
size?: ComponentSize;
/**
* @description whether value can be reset to `0`
*/
clearable?: boolean;
/**
* @description native `aria-label` attribute
*/
ariaLabel?: string;
}
/**
* @deprecated Removed after 3.0.0, Use `RateProps` instead.
*/
export declare const rateProps: {
readonly ariaLabel: StringConstructor;
readonly modelValue: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
readonly lowThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 2, boolean>;
readonly highThreshold: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 4, boolean>;
readonly max: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 5, boolean>;
readonly colors: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>) | ((new (...args: any[]) => string[] | Record<number, string>) | (() => string[] | Record<number, string>))[], unknown, unknown, () => ["", "", ""], boolean>;
readonly voidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly disabledVoidColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly icons: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>) | ((new (...args: any[]) => (string | Component)[] | Record<number, string | Component>) | (() => (string | Component)[] | Record<number, string | Component>))[], unknown, unknown, () => [Component, Component, Component], boolean>;
readonly voidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
readonly disabledVoidIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component) & {}) | (() => string | Component) | ((new (...args: any[]) => (string | Component) & {}) | (() => string | Component))[], unknown, unknown, () => Component, boolean>;
readonly disabled: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
readonly allowHalf: BooleanConstructor;
readonly showText: BooleanConstructor;
readonly showScore: BooleanConstructor;
readonly textColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly texts: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string[]) | (() => string[]) | ((new (...args: any[]) => string[]) | (() => string[]))[], unknown, unknown, () => ["Extremely bad", "Disappointed", "Fair", "Satisfied", "Surprise"], boolean>;
readonly scoreTemplate: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "{value}", boolean>;
readonly size: {
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
__epPropKey: true;
};
readonly clearable: BooleanConstructor;
};
/**
* @deprecated Removed after 3.0.0, Use `RateProps` instead.
*/
export type RatePropsPublic = ExtractPublicPropTypes<typeof rateProps>;
export declare const rateEmits: {
change: (value: number) => boolean;
"update:modelValue": (value: number) => boolean;
};
export type RateEmits = typeof rateEmits;
export type RateInstance = InstanceType<typeof Rate> & unknown;