/**
* @file Rating
* @description
* @author fex
*/
///
import React from 'react';
import { ClassNamesFn } from 'amis-core';
export type textPositionType = 'left' | 'right';
interface RatingProps {
id?: string;
key?: string | number;
style?: React.CSSProperties;
count: number;
half: boolean;
char: string | React.ReactNode;
className?: string;
charClassName?: string;
textClassName?: string;
onChange?: (value: number) => void;
onHoverChange?: (value: number) => void;
value: number;
containerClass?: string;
readOnly: boolean;
classPrefix: string;
disabled?: boolean;
allowClear?: boolean;
inactiveColor?: string;
colors?: string | {
[propName: string]: string;
};
texts?: {
[propName: string]: string;
};
textPosition?: textPositionType;
classnames: ClassNamesFn;
}
export declare class Rating extends React.Component {
static defaultProps: {
containerClass: string;
readOnly: boolean;
half: boolean;
allowClear: boolean;
value: number;
count: number;
char: React.JSX.Element;
colors: string;
textPosition: textPositionType;
};
ratingRef: React.RefObject;
starsNode: Record;
constructor(props: RatingProps);
componentDidMount(): void;
componentDidUpdate(prevProps: RatingProps): void;
sortKeys(map: {
[propName: number]: string;
}): string[];
getShowColorAndText(value: number): void;
getRate(): number;
getStars(activeCount?: number): {
active: boolean;
}[];
saveRef(index: number): (node?: HTMLLIElement | null) => void;
mouseOver(event: React.ChangeEvent, index: number): void;
onHoverChange(value: number): void;
moreThanHalf(event: any, index: number): boolean;
mouseLeave(): void;
handleStarMouseLeave(event: any, index: number): void;
handleClick(event: React.ChangeEvent, index: number): void;
renderStars(): React.JSX.Element;
renderText(): React.JSX.Element | null;
render(): React.JSX.Element;
}
declare const _default: {
new (props: Pick, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps): {
ref: any;
childRef(ref: any): void;
getWrappedInstance(): any;
render(): React.JSX.Element;
context: unknown;
setState(state: {} | ((prevState: Readonly<{}>, props: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly, "disabled" | "id" | "onChange" | "key" | "charClassName" | "textClassName" | "onHoverChange" | "inactiveColor" | "texts"> & {
value?: number | undefined;
char?: React.ReactNode;
readOnly?: boolean | undefined;
half?: boolean | undefined;
count?: number | undefined;
containerClass?: string | undefined;
allowClear?: boolean | undefined;
colors?: string | {
[propName: string]: string;
} | undefined;
textPosition?: textPositionType | undefined;
} & {} & import("packages/amis-core/lib/theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
};
displayName: string;
contextType: React.Context;
ComposedComponent: React.ComponentType;
} & import("hoist-non-react-statics").NonReactStatics & {
ComposedComponent: typeof Rating;
};
export default _default;