Created
August 3, 2020 22:29
-
-
Save ChadJPetersen/2e2587bbd753c6a384c02519183e2031 to your computer and use it in GitHub Desktop.
A type def for https://github.com/crubier/react-graph-vis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You must first install the vis and react types 'npm install --save-dev @types/vis @types/react' | |
declare module "react-graph-vis" { | |
import { Network, NetworkEvents, Options, Node, Edge, DataSet } from "vis"; | |
import { Component } from "react"; | |
export { Network, NetworkEvents, Options, Node, Edge, DataSet } from "vis"; | |
export interface graphEvents { | |
[event: NetworkEvents]: (params?: any) => void; | |
} | |
//Doesn't appear that this module supports passing in a vis.DataSet directly. Once it does graph can just use the Data object from vis. | |
export interface graphData { | |
nodes: Node[]; | |
edges: Edge[]; | |
} | |
export interface NetworkGraphProps { | |
graph: graphData; | |
options?: Options; | |
events?: graphEvents; | |
getNetwork?: (network: Network) => void; | |
identifier?: string; | |
style?: React.CSSProperties; | |
getNodes?: (nodes: DataSet) => void; | |
getEdges?: (edges: DataSet) => void; | |
} | |
export interface NetworkGraphState { | |
identifier: string; | |
} | |
export default class NetworkGraph extends Component< | |
NetworkGraphProps, | |
NetworkGraphState | |
> { | |
render(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment