@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.
Files changed (56) hide show
  1. package/dist/graphvizlib.wasm +0 -0
  2. package/dist/index.es6.js +1139 -260
  3. package/dist/index.es6.js.map +1 -1
  4. package/dist/index.js +1139 -256
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/package.json +11 -10
  9. package/src/__package__.ts +2 -2
  10. package/src/graph2/dataGraph.ts +27 -25
  11. package/src/graph2/edge.tsx +30 -0
  12. package/src/graph2/graph.ts +48 -1308
  13. package/src/graph2/graphReactT.ts +43 -0
  14. package/src/graph2/graphT.ts +1311 -0
  15. package/src/graph2/index.ts +4 -0
  16. package/src/graph2/layouts/dagre.ts +13 -1
  17. package/src/graph2/layouts/forceDirected.ts +2 -2
  18. package/src/graph2/layouts/graphvizWorker.ts +2 -2
  19. package/src/graph2/layouts/placeholders.ts +41 -32
  20. package/src/graph2/layouts/tree.ts +1 -1
  21. package/src/graph2/sankeyGraph.ts +8 -12
  22. package/src/graph2/subgraph.tsx +30 -0
  23. package/src/graph2/vertex.tsx +31 -0
  24. package/types/__package__.d.ts +2 -2
  25. package/types/graph2/dataGraph.d.ts +4 -4
  26. package/types/graph2/dataGraph.d.ts.map +1 -1
  27. package/types/graph2/edge.d.ts +9 -0
  28. package/types/graph2/edge.d.ts.map +1 -0
  29. package/types/graph2/graph.d.ts +26 -233
  30. package/types/graph2/graph.d.ts.map +1 -1
  31. package/types/graph2/graphReactT.d.ts +15 -0
  32. package/types/graph2/graphReactT.d.ts.map +1 -0
  33. package/types/graph2/graphT.d.ts +232 -0
  34. package/types/graph2/graphT.d.ts.map +1 -0
  35. package/types/graph2/index.d.ts +4 -0
  36. package/types/graph2/index.d.ts.map +1 -1
  37. package/types/graph2/layouts/dagre.d.ts.map +1 -1
  38. package/types/graph2/layouts/placeholders.d.ts +39 -32
  39. package/types/graph2/layouts/placeholders.d.ts.map +1 -1
  40. package/types/graph2/sankeyGraph.d.ts +5 -5
  41. package/types/graph2/sankeyGraph.d.ts.map +1 -1
  42. package/types/graph2/subgraph.d.ts +12 -0
  43. package/types/graph2/subgraph.d.ts.map +1 -0
  44. package/types/graph2/vertex.d.ts +13 -0
  45. package/types/graph2/vertex.d.ts.map +1 -0
  46. package/types-3.4/__package__.d.ts +2 -2
  47. package/types-3.4/graph2/dataGraph.d.ts +4 -4
  48. package/types-3.4/graph2/edge.d.ts +9 -0
  49. package/types-3.4/graph2/graph.d.ts +26 -233
  50. package/types-3.4/graph2/graphReactT.d.ts +15 -0
  51. package/types-3.4/graph2/graphT.d.ts +232 -0
  52. package/types-3.4/graph2/index.d.ts +4 -0
  53. package/types-3.4/graph2/layouts/placeholders.d.ts +42 -32
  54. package/types-3.4/graph2/sankeyGraph.d.ts +5 -5
  55. package/types-3.4/graph2/subgraph.d.ts +12 -0
  56. 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
+ }