1 |
|
2 |
|
3 |
|
4 | import React, { PureComponent, ReactNode, MouseEvent, ReactElement } from 'react';
|
5 | import { DataKey, LegendType, LayoutType, PresentationAttributesAdaptChildEvent } from '../util/types';
|
6 | export type ContentType = ReactElement | ((props: Props) => ReactNode);
|
7 | export type IconType = Exclude<LegendType, 'none'>;
|
8 | export type HorizontalAlignmentType = 'center' | 'left' | 'right';
|
9 | export type VerticalAlignmentType = 'top' | 'bottom' | 'middle';
|
10 | export type Formatter = (value: any, entry: {
|
11 | value: any;
|
12 | id?: string;
|
13 | type?: LegendType;
|
14 | color?: string;
|
15 | payload?: {
|
16 | strokeDasharray: string | number;
|
17 | value?: any;
|
18 | };
|
19 | }, index: number) => ReactNode;
|
20 | export interface Payload {
|
21 | value: any;
|
22 | id?: string;
|
23 | type?: LegendType;
|
24 | color?: string;
|
25 | payload?: {
|
26 | strokeDasharray: string | number;
|
27 | value?: any;
|
28 | };
|
29 | formatter?: Formatter;
|
30 | inactive?: boolean;
|
31 | legendIcon?: ReactElement<SVGElement>;
|
32 | dataKey?: DataKey<any>;
|
33 | }
|
34 | interface InternalProps {
|
35 | content?: ContentType;
|
36 | iconSize?: number;
|
37 | iconType?: IconType;
|
38 | layout?: LayoutType;
|
39 | align?: HorizontalAlignmentType;
|
40 | verticalAlign?: VerticalAlignmentType;
|
41 | payload?: Array<Payload>;
|
42 | inactiveColor?: string;
|
43 | formatter?: Formatter;
|
44 | onMouseEnter?: (data: Payload, index: number, event: MouseEvent) => void;
|
45 | onMouseLeave?: (data: Payload, index: number, event: MouseEvent) => void;
|
46 | onClick?: (data: Payload, index: number, event: MouseEvent) => void;
|
47 | }
|
48 | export type Props = InternalProps & Omit<PresentationAttributesAdaptChildEvent<any, ReactElement>, keyof InternalProps>;
|
49 | export declare class DefaultLegendContent extends PureComponent<Props> {
|
50 | static displayName: string;
|
51 | static defaultProps: {
|
52 | iconSize: number;
|
53 | layout: string;
|
54 | align: string;
|
55 | verticalAlign: string;
|
56 | inactiveColor: string;
|
57 | };
|
58 | |
59 |
|
60 |
|
61 |
|
62 |
|
63 | renderIcon(data: Payload): React.JSX.Element;
|
64 | |
65 |
|
66 |
|
67 |
|
68 | renderItems(): React.JSX.Element[];
|
69 | render(): React.JSX.Element;
|
70 | }
|
71 | export {};
|