@hpcc-js/graph 2.83.0 → 2.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graphvizlib.wasm +0 -0
- package/dist/index.es6.js +1139 -260
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1139 -256
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +11 -10
- package/src/__package__.ts +2 -2
- package/src/graph2/dataGraph.ts +27 -25
- package/src/graph2/edge.tsx +30 -0
- package/src/graph2/graph.ts +48 -1308
- package/src/graph2/graphReactT.ts +43 -0
- package/src/graph2/graphT.ts +1311 -0
- package/src/graph2/index.ts +4 -0
- package/src/graph2/layouts/dagre.ts +13 -1
- package/src/graph2/layouts/forceDirected.ts +2 -2
- package/src/graph2/layouts/graphvizWorker.ts +2 -2
- package/src/graph2/layouts/placeholders.ts +41 -32
- package/src/graph2/layouts/tree.ts +1 -1
- package/src/graph2/sankeyGraph.ts +8 -12
- package/src/graph2/subgraph.tsx +30 -0
- package/src/graph2/vertex.tsx +31 -0
- package/types/__package__.d.ts +2 -2
- package/types/graph2/dataGraph.d.ts +4 -4
- package/types/graph2/dataGraph.d.ts.map +1 -1
- package/types/graph2/edge.d.ts +9 -0
- package/types/graph2/edge.d.ts.map +1 -0
- package/types/graph2/graph.d.ts +26 -233
- package/types/graph2/graph.d.ts.map +1 -1
- package/types/graph2/graphReactT.d.ts +15 -0
- package/types/graph2/graphReactT.d.ts.map +1 -0
- package/types/graph2/graphT.d.ts +232 -0
- package/types/graph2/graphT.d.ts.map +1 -0
- package/types/graph2/index.d.ts +4 -0
- package/types/graph2/index.d.ts.map +1 -1
- package/types/graph2/layouts/dagre.d.ts.map +1 -1
- package/types/graph2/layouts/placeholders.d.ts +39 -32
- package/types/graph2/layouts/placeholders.d.ts.map +1 -1
- package/types/graph2/sankeyGraph.d.ts +5 -5
- package/types/graph2/sankeyGraph.d.ts.map +1 -1
- package/types/graph2/subgraph.d.ts +12 -0
- package/types/graph2/subgraph.d.ts.map +1 -0
- package/types/graph2/vertex.d.ts +13 -0
- package/types/graph2/vertex.d.ts.map +1 -0
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/graph2/dataGraph.d.ts +4 -4
- package/types-3.4/graph2/edge.d.ts +9 -0
- package/types-3.4/graph2/graph.d.ts +26 -233
- package/types-3.4/graph2/graphReactT.d.ts +15 -0
- package/types-3.4/graph2/graphT.d.ts +232 -0
- package/types-3.4/graph2/index.d.ts +4 -0
- package/types-3.4/graph2/layouts/placeholders.d.ts +42 -32
- package/types-3.4/graph2/sankeyGraph.d.ts +5 -5
- package/types-3.4/graph2/subgraph.d.ts +12 -0
- package/types-3.4/graph2/vertex.d.ts +13 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { render, React, SubgraphProps, VertexProps } from "@hpcc-js/react";
|
|
2
|
+
import { EdgeProps, GraphT, RendererT } from "./graphT";
|
|
3
|
+
|
|
4
|
+
function adapter<T>(reactRenderer: React.FunctionComponent<T>): RendererT<T> {
|
|
5
|
+
return (props: T, element: SVGGElement) => render(reactRenderer, props, element);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps> extends GraphT<SG, V, E> {
|
|
9
|
+
|
|
10
|
+
constructor(subgraphRenderer: React.FunctionComponent<SG>, vertexRenderer: React.FunctionComponent<V>, edgeRenderer: React.FunctionComponent<E>) {
|
|
11
|
+
super(adapter(subgraphRenderer), adapter(vertexRenderer), adapter(edgeRenderer));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private _reactSubgraphRenderer: React.FunctionComponent<SG>;
|
|
15
|
+
subgraphRenderer(): React.FunctionComponent<SG>;
|
|
16
|
+
subgraphRenderer(_: React.FunctionComponent<SG>): this;
|
|
17
|
+
subgraphRenderer(_?: React.FunctionComponent<SG>): this | React.FunctionComponent<SG> {
|
|
18
|
+
if (!arguments.length) return this._reactSubgraphRenderer;
|
|
19
|
+
this._reactSubgraphRenderer = _;
|
|
20
|
+
super.subgraphRenderer(adapter(this._reactSubgraphRenderer));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private _reactVertexRenderer: React.FunctionComponent<V>;
|
|
25
|
+
vertexRenderer(): React.FunctionComponent<V>;
|
|
26
|
+
vertexRenderer(_: React.FunctionComponent<V>): this;
|
|
27
|
+
vertexRenderer(_?: React.FunctionComponent<V>): this | React.FunctionComponent<V> {
|
|
28
|
+
if (!arguments.length) return this._reactVertexRenderer;
|
|
29
|
+
this._reactVertexRenderer = _;
|
|
30
|
+
super.vertexRenderer((props: V, element: SVGGElement) => render(this._reactVertexRenderer, props, element));
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private _reactEdgeRenderer: React.FunctionComponent<E>;
|
|
35
|
+
edgeRenderer(): React.FunctionComponent<E>;
|
|
36
|
+
edgeRenderer(_: React.FunctionComponent<E>): this;
|
|
37
|
+
edgeRenderer(_?: React.FunctionComponent<E>): this | React.FunctionComponent<E> {
|
|
38
|
+
if (!arguments.length) return this._reactEdgeRenderer;
|
|
39
|
+
this._reactEdgeRenderer = _;
|
|
40
|
+
super.edgeRenderer((props: E, element: SVGGElement) => render(this._reactEdgeRenderer, props, element));
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}
|