import React, { PureComponent } from "react"; import { ConfigConsumerProps } from "../Config"; interface IProps { /** * 当前数,受控值 * **/ value?: number; /** * 默认值 * * @default 0 **/ defaultValue?: number; /** * star 总数 * * @default 5 **/ count?: number; /** * 是否允许半选 * * @default false **/ allowHalf?: boolean; /** * 是否允许再次点击后清除 * * @default true **/ allowClear?: boolean; /** * 自定义样式 * * @default **/ style?: React.CSSProperties; /** * 自定义前缀 * * @default 'lg' **/ prefixCls?: string; /** * 选择时的回调 * * **/ onChange?: (value: number) => void; /** * 鼠标经过时数值变化的回调 * * **/ onHoverChange?: (value: number | undefined) => void; /** * 自定义样式类名 * * @default ‘’ **/ className?: string; /** * 当前tabIndex * * @default 0 **/ tabIndex?: number; /** * 只读,无法进行交互操作 * * @default false **/ disabled?: boolean; /** * 获取焦点时的回调 * * @default **/ onFocus?: () => void; /** * 失去焦点时的回调 * * @default **/ onBlur?: () => void; /** * 自动获取焦点 * * @default false **/ autoFocus?: boolean; /** * 显示类型,可选 font,image * * @default ‘image’ **/ type?: string; /** * 类型为image时,高亮图片 * * @default ’//static.360buyimg.com/JDC_legao/widget/rate/i/star-on.png‘ **/ onImage?: string; /** * 类型为image时,半星图片 * * @default ‘//static.360buyimg.com/JDC_legao/widget/rate/i/star-half.png’ **/ halfImage?: string; /** * 类型为image时,置灰图片 * * @default ‘//static.360buyimg.com/JDC_legao/widget/rate/i/star-off.png’ **/ offImage?: string; /** * 显示类型为font 时自定义字符 * * @default **/ character?: React.ReactNode; /** * 自定义渲染显示star * * @default **/ characterRender?: (...args: any[]) => JSX.Element; } interface IState { value: string; focused: boolean; cleanedValue: string | null; hoverValue?: any; } declare class Rate extends PureComponent { private stars; private rate; static defaultProps: { defaultValue: number; count: number; allowHalf: boolean; allowClear: boolean; style: {}; onChange: () => null; character: string; onHoverChange: () => null; disabled: boolean; tabIndex: number; type: string; onImage: string; offImage: string; halfImage: string; }; constructor(props: any); componentWillReceiveProps(nextProps: any): void; componentDidMount(): void; onHover: (event: any, index: any) => void; onMouseLeave: () => void; onClick: (event: any, index: any) => void; onFocus: () => void; onBlur: () => void; getStarDOM(index: any): any; getStarValue(index: any, x: any): any; saveRef: (index: any) => (node: any) => void; saveRate: (node: any) => void; changeValue(value: any): void; renderList: (prefixCls: any) => JSX.Element[]; renderRate: ({ getPrefixCls }: ConfigConsumerProps) => JSX.Element; render(): JSX.Element; } export default Rate;