@kgdata/forcegraph
Version:
forcegraph
59 lines (51 loc) • 1.29 kB
text/typescript
import type { Graph, G6GraphEvent, GraphOptions } from '@antv/g6';
import type { CSSProperties } from 'react';
export interface nodeItem {
id: string;
label?: string;
size?: number;
[propName: string]: any;
}
export interface edgesItem {
label?: string;
source: string;
target: string;
[propName: string]: any;
}
export interface GuidData {
nodes: nodeItem[];
edges: edgesItem[];
}
export interface IAddEvent {
(example: Graph, enventProps: IEnventProps): void;
}
export interface IEnventProps {
onNodeClick?: G6GraphFn;
onNodeDblClick?: G6GraphFn;
}
export interface G6GraphFn {
(e: G6GraphEvent, graph: Graph): void;
}
export interface FGDProps {
graphCfg?: GraphOptions;
graphData?: GuidData;
onNodeClick?: G6GraphFn;
onNodeDblClick?: G6GraphFn;
style?: CSSProperties;
request?: IGetGraphDataFn;
params?: Record<string, any>;
postData?: IpostData;
[propName: string]: any;
}
export interface IRGraphData {
data: GuidData;
}
export interface IpostData {
(data: GuidData): GuidData;
}
export interface IGetGraphDataFn {
(params?: Record<string, any>, graph?: Graph): Promise<IRGraphData>;
}
export interface FGDComponentProps {
getInstance: () => Graph | undefined;
}