UNPKG

2.92 kBTypeScriptView Raw
1import { Component, ComponentType, Ref } from '@antv/f-engine';
2import { Category } from '../../attr';
3import CoordController from '../../controller/coord';
4import { Data, DataRecord, DataField } from '../../chart/Data';
5import { CoordProps } from '../../chart/Coord';
6export interface ColorAttrObject {
7 field: string;
8 range?: string[] | number[];
9 callback?: (value: any) => string | number;
10}
11export interface RecordNode<TRecord extends DataRecord = DataRecord> {
12 key: string | number | null | undefined;
13 color: DataField<TRecord> | string;
14 origin: TRecord;
15 xMax: number;
16 xMin: number;
17 yMax: number;
18 yMin: number;
19 style: any;
20}
21export interface TreemapProps<TRecord extends DataRecord = DataRecord> {
22 data: Data<TRecord>;
23 value: DataField<TRecord> | string;
24 coord?: CoordProps;
25 color?: ColorAttrObject;
26 space?: number;
27 theme?: Record<string, any>;
28 nodes?: RecordNode<TRecord>[];
29 selection?: any;
30}
31declare const withTreemap: <IProps extends TreemapProps<DataRecord> = TreemapProps<DataRecord>>(View: ComponentType<IProps>) => {
32 new <TRecord extends DataRecord = DataRecord, P extends TreemapProps<TRecord> = TreemapProps<TRecord>>(props: P & IProps, context: any): {
33 coord: CoordController;
34 color: Category;
35 coordRef: Ref;
36 records: RecordNode<DataRecord>[];
37 isSelected(record: any): boolean;
38 getSelectionStyle(record: any): any;
39 willMount(): void;
40 willReceiveProps(nextProps: P): void;
41 treemapLayout(): RecordNode[];
42 select(ev: any, trigger: any): void;
43 render(): import("@antv/f-engine").JSX.Element;
44 props: P & IProps;
45 state: import("@antv/f-engine").IState;
46 context: import("@antv/f-engine").IContext;
47 refs: {
48 [key: string]: Component<import("@antv/f-engine").IProps, import("@antv/f-engine").IState>;
49 };
50 updater: import("@antv/f-engine/es/component/updater").Updater<import("@antv/f-engine").IState>;
51 container: import("@antv/g-lite").Group;
52 layout: import("@antv/f-engine").LayoutProps;
53 children: import("@antv/f-engine/es/canvas/vnode").VNode | import("@antv/f-engine/es/canvas/vnode").VNode[];
54 isMounted: boolean;
55 animate: boolean;
56 animator: import("@antv/f-engine/es/canvas/render/animator").default;
57 destroyed: boolean;
58 _vNode: import("@antv/f-engine/es/canvas/vnode").VNode;
59 didMount(): void;
60 shouldUpdate(_nextProps: P & IProps): boolean;
61 willUpdate(): void;
62 didUpdate(): void;
63 willUnmount(): void;
64 didUnmount(): void;
65 setState(partialState: import("@antv/f-engine").IState, callback?: () => void): void;
66 forceUpdate(callback?: () => void): void;
67 setAnimate(animate: boolean): void;
68 destroy(): void;
69 };
70};
71export default withTreemap;