@hpcc-js/graph 3.2.0 → 3.3.0
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/assets/{dagre-D0bY8RPD.js.map → dagre-BVMQn91n.js.map} +1 -1
- package/dist/assets/graphviz-CMhlTALo.js.map +1 -1
- package/dist/index.js +4741 -1992
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +148 -7
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +6 -5
- package/src/__tests__/test5.ts +1 -1
- package/src/common/graphT.css +33 -0
- package/src/{graph2 → common}/graphT.ts +78 -47
- package/src/common/index.ts +3 -0
- package/src/{graph2 → common}/layouts/dagre.ts +16 -3
- package/src/{graph2 → common}/layouts/graphviz.ts +17 -4
- package/src/{graph2 → common}/layouts/layout.ts +48 -5
- package/src/common/layouts/pathIntersection.ts +67 -0
- package/src/{graph2 → common}/layouts/placeholders.ts +12 -0
- package/src/{graph2 → common}/layouts/tree.ts +2 -4
- package/src/{graph2 → common}/sankeyGraph.ts +2 -2
- package/src/html/annotation.ts +71 -0
- package/src/html/component.ts +14 -0
- package/src/html/graphHtml.ts +10 -0
- package/src/html/graphHtmlT.ts +49 -0
- package/src/html/icon.ts +64 -0
- package/src/html/image.ts +26 -0
- package/src/html/imageChar.ts +18 -0
- package/src/html/index.ts +8 -0
- package/src/html/shape.ts +136 -0
- package/src/html/text.ts +59 -0
- package/src/html/textBox.ts +41 -0
- package/src/html/vertex.ts +65 -0
- package/src/index.ts +3 -1
- package/src/{graph2 → react}/dataGraph.ts +11 -11
- package/src/{graph2/graph.ts → react/graphReact.ts} +65 -22
- package/src/{graph2 → react}/graphReactT.ts +1 -1
- package/src/react/index.ts +4 -0
- package/src/{graph2 → react}/subgraph.tsx +2 -1
- package/src/{graph2 → react}/vertex.tsx +2 -1
- package/types/{graph2 → common}/graphT.d.ts +9 -11
- package/types/common/index.d.ts +3 -0
- package/types/{graph2 → common}/layouts/layout.d.ts +18 -1
- package/types/common/layouts/pathIntersection.d.ts +24 -0
- package/types/{graph2 → common}/layouts/placeholders.d.ts +6 -0
- package/types/{graph2 → common}/sankeyGraph.d.ts +2 -2
- package/types/html/annotation.d.ts +13 -0
- package/types/html/component.d.ts +10 -0
- package/types/html/graphHtml.d.ts +5 -0
- package/types/html/graphHtmlT.d.ts +9 -0
- package/types/html/icon.d.ts +15 -0
- package/types/html/image.d.ts +8 -0
- package/types/html/imageChar.d.ts +2 -0
- package/types/html/index.d.ts +8 -0
- package/types/html/shape.d.ts +31 -0
- package/types/html/text.d.ts +10 -0
- package/types/html/textBox.d.ts +11 -0
- package/types/html/vertex.d.ts +17 -0
- package/types/index.d.ts +3 -1
- package/types/{graph2 → react}/dataGraph.d.ts +2 -2
- package/types/{graph2/graph.d.ts → react/graphReact.d.ts} +13 -3
- package/types/{graph2 → react}/graphReactT.d.ts +1 -1
- package/types/react/index.d.ts +4 -0
- package/types/{graph2 → react}/subgraph.d.ts +1 -1
- package/types/{graph2 → react}/vertex.d.ts +1 -1
- package/src/graph2/graph.css +0 -34
- package/src/graph2/index.ts +0 -7
- package/src/test.ts +0 -649
- package/types/graph2/index.d.ts +0 -7
- /package/src/{graph2 → common}/layouts/circle.ts +0 -0
- /package/src/{graph2 → common}/layouts/dagreWorker.ts +0 -0
- /package/src/{graph2 → common}/layouts/forceDirected.ts +0 -0
- /package/src/{graph2 → common}/layouts/forceDirectedWorker.ts +0 -0
- /package/src/{graph2 → common}/layouts/geoForceDirected.ts +0 -0
- /package/src/{graph2 → common}/layouts/graphvizWorker.ts +0 -0
- /package/src/{graph2 → common}/layouts/index.ts +0 -0
- /package/src/{graph2 → common}/layouts/null.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/dagre.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/dagreOptions.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/forceDirected.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/forceDirectedOptions.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/graphviz.ts +0 -0
- /package/src/{graph2 → common}/layouts/workers/graphvizOptions.ts +0 -0
- /package/src/{graph2 → common}/liteMap.ts +0 -0
- /package/src/{graph2 → common}/liteSVGZooom.ts +0 -0
- /package/src/{graph2 → common}/sankeyGraph.css +0 -0
- /package/types/{graph2 → common}/layouts/circle.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/dagre.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/dagreWorker.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/forceDirected.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/forceDirectedWorker.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/geoForceDirected.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/graphviz.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/graphvizWorker.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/index.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/null.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/tree.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/workers/dagreOptions.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/workers/forceDirectedOptions.d.ts +0 -0
- /package/types/{graph2 → common}/layouts/workers/graphvizOptions.d.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconEx, Icons, render } from "@hpcc-js/react";
|
|
2
|
+
import { React, Subgraph, SubgraphProps, Vertex, VertexProps, Edge, EdgeProps } from "@hpcc-js/react";
|
|
2
3
|
import { GraphReactT } from "./graphReactT.ts";
|
|
3
|
-
import { GraphDataProps, HierarchyBase } from "
|
|
4
|
+
import { GraphDataProps, HierarchyBase } from "../common/graphT.ts";
|
|
4
5
|
|
|
5
6
|
// Backward compatibility layer ---
|
|
6
7
|
export type ISubgraph = SubgraphProps;
|
|
@@ -9,7 +10,7 @@ export type IEdge = EdgeProps;
|
|
|
9
10
|
export type IHierarchy = HierarchyBase<ISubgraph, IVertex>;
|
|
10
11
|
export type IGraphData2 = GraphDataProps<ISubgraph, IVertex, IEdge>;
|
|
11
12
|
|
|
12
|
-
export class
|
|
13
|
+
export class GraphReact extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
13
14
|
|
|
14
15
|
constructor() {
|
|
15
16
|
super(Subgraph, Vertex, Edge);
|
|
@@ -20,6 +21,24 @@ export class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
protected _categories: IconEx[] = [];
|
|
25
|
+
categories(): IconEx[];
|
|
26
|
+
categories(_: IconEx[]): this;
|
|
27
|
+
categories(_?: IconEx[]): IconEx[] | this {
|
|
28
|
+
if (_ === void 0) return this._categories;
|
|
29
|
+
this._categories = _;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected _annotations: IconEx[] = [];
|
|
34
|
+
annotations(): IconEx[];
|
|
35
|
+
annotations(_: IconEx[]): this;
|
|
36
|
+
annotations(_?: IconEx[]): IconEx[] | this {
|
|
37
|
+
if (_ === void 0) return this._annotations;
|
|
38
|
+
this._annotations = _;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
|
|
23
42
|
calcProps(_props: VertexProps): VertexProps {
|
|
24
43
|
const props = super.calcProps(_props);
|
|
25
44
|
if (!props.icon) props.icon = {};
|
|
@@ -71,14 +90,37 @@ export class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
|
71
90
|
super.enter(domNode, element);
|
|
72
91
|
}
|
|
73
92
|
|
|
93
|
+
updateCategories() {
|
|
94
|
+
render(Icons, {
|
|
95
|
+
icons: this._categories.map((c): IconEx => ({
|
|
96
|
+
...c,
|
|
97
|
+
id: this.categoryID(c.id),
|
|
98
|
+
fill: c.fill || "transparent",
|
|
99
|
+
imageCharFill: c.imageCharFill || this._catPalette(c.id)
|
|
100
|
+
}))
|
|
101
|
+
}, this._svgDefsCat.node());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
updateAnnotations() {
|
|
105
|
+
render(Icons, {
|
|
106
|
+
icons: this._annotations.map((c): IconEx => ({
|
|
107
|
+
...c,
|
|
108
|
+
id: this.categoryID(c.id, "ann"),
|
|
109
|
+
shape: c.shape || "square",
|
|
110
|
+
height: c.height || 12,
|
|
111
|
+
fill: c.fill || this._catPalette(c.id)
|
|
112
|
+
}))
|
|
113
|
+
}, this._svgDefsAnn.node());
|
|
114
|
+
}
|
|
115
|
+
|
|
74
116
|
update(domNode, element) {
|
|
75
117
|
super.update(domNode, element);
|
|
76
118
|
this._centroidFilter.update(this.centroidColor());
|
|
77
119
|
}
|
|
78
120
|
}
|
|
79
|
-
|
|
121
|
+
GraphReact.prototype._class += " graph_GraphReact";
|
|
80
122
|
|
|
81
|
-
export interface
|
|
123
|
+
export interface GraphReact {
|
|
82
124
|
vertexTextHeight(): number;
|
|
83
125
|
vertexTextHeight(_: number): this;
|
|
84
126
|
vertexTextPadding(): number;
|
|
@@ -114,21 +156,22 @@ export interface Graph2 {
|
|
|
114
156
|
centroidLabelFontFamily(_: string): this;
|
|
115
157
|
}
|
|
116
158
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
GraphReact.prototype.publish("vertexTextHeight", 10, "number", "Vertex Text Height");
|
|
160
|
+
GraphReact.prototype.publish("vertexTextPadding", 4, "number", "Vertex Text Padding");
|
|
161
|
+
GraphReact.prototype.publish("vertexIconHeight", 50, "number", "Vertex Icon Height");
|
|
162
|
+
GraphReact.prototype.publish("vertexIconPadding", 10, "number", "Vertex Icon Padding");
|
|
163
|
+
GraphReact.prototype.publish("vertexIconStrokeWidth", 0, "number", "Vertex Icon Stroke Width");
|
|
164
|
+
GraphReact.prototype.publish("vertexIconFontFamily", "FontAwesome", "string", "Vertex Icon Font Family");
|
|
165
|
+
GraphReact.prototype.publish("vertexLabelFontFamily", "Verdana", "string", "Vertex Label Font Family");
|
|
166
|
+
|
|
167
|
+
GraphReact.prototype.publish("centroidColor", "#00A000", "html-color", "Centroid Glow Color");
|
|
168
|
+
GraphReact.prototype.publish("centroidScale", 1, "number", "Centroid Scale");
|
|
169
|
+
GraphReact.prototype.publish("centroidTextHeight", 12, "number", "Centroid Text Height");
|
|
170
|
+
GraphReact.prototype.publish("centroidTextPadding", 4, "number", "Centroid Text Padding");
|
|
171
|
+
GraphReact.prototype.publish("centroidIconHeight", 50, "number", "Centroid Icon Height");
|
|
172
|
+
GraphReact.prototype.publish("centroidIconPadding", 10, "number", "Centroid Icon Padding");
|
|
173
|
+
GraphReact.prototype.publish("centroidIconStrokeWidth", 4, "number", "Centroid Icon Stroke Width");
|
|
174
|
+
GraphReact.prototype.publish("centroidIconFontFamily", "FontAwesome", "string", "Centroid Icon Font Family");
|
|
175
|
+
GraphReact.prototype.publish("centroidLabelFontFamily", "Verdana", "string", "Centroid Label Font Family");
|
|
134
176
|
|
|
177
|
+
export const Graph2 = GraphReact;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, React, SubgraphProps, VertexProps, EdgeProps } from "@hpcc-js/react";
|
|
2
|
-
import { GraphT, RendererT } from "
|
|
2
|
+
import { GraphT, RendererT } from "../common/graphT.ts";
|
|
3
3
|
|
|
4
4
|
function adapter<T>(reactRenderer: React.FunctionComponent<T>): RendererT<T> {
|
|
5
5
|
return (props: T, element: SVGGElement) => render(reactRenderer, props, element);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { React, Text } from "@hpcc-js/react";
|
|
2
|
-
import { SubgraphBaseProps } from "
|
|
2
|
+
import { SubgraphBaseProps } from "../common/layouts/placeholders.ts";
|
|
3
3
|
|
|
4
4
|
export interface BasicSubgraphProps extends SubgraphBaseProps {
|
|
5
5
|
label?: string;
|
|
@@ -23,6 +23,7 @@ export const BasicSubgraph: React.FunctionComponent<BasicSubgraphProps> = ({
|
|
|
23
23
|
return <g transform={`translate(${-width / 2} ${-height / 2})`}>
|
|
24
24
|
<rect width={width} height={height} fill={fill} stroke={stroke} style={{ strokeWidth }} />
|
|
25
25
|
<g transform={`translate(8 ${8 + labelHeight})`}>
|
|
26
|
+
{/* @ts-ignore */}
|
|
26
27
|
<Text text={label} fill={labelFill} height={labelHeight} />
|
|
27
28
|
</g>
|
|
28
29
|
</g>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { React, Text } from "@hpcc-js/react";
|
|
2
|
-
import { VertexBaseProps } from "
|
|
2
|
+
import { VertexBaseProps } from "../common/layouts/placeholders.ts";
|
|
3
3
|
|
|
4
4
|
export interface BasicVertexProps extends VertexBaseProps {
|
|
5
5
|
textFill?: string;
|
|
@@ -24,6 +24,7 @@ export const BasicVertex: React.FunctionComponent<BasicVertexProps> = ({
|
|
|
24
24
|
return <g transform={`scale(${scale})`}>
|
|
25
25
|
<circle cx="0" cy="0" r={circleRadius} fill={circleFill} stroke={circleStroke} style={{ strokeWidth: circleStrokeWidth }} />
|
|
26
26
|
<g transform={`translate(0 ${circleRadius + textHeight})`}>
|
|
27
|
+
{/* @ts-ignore */}
|
|
27
28
|
<Text text={text} fill={textFill} height={textHeight} />
|
|
28
29
|
</g>
|
|
29
30
|
</g>;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Palette, Selection, SVGGlowFilter, SVGZoomWidget, ToggleButton, Utility, Widget } from "@hpcc-js/common";
|
|
2
|
-
import { IconEx } from "@hpcc-js/react";
|
|
3
2
|
import { Graph2 as GraphCollection } from "@hpcc-js/util";
|
|
4
3
|
import { HTMLTooltip } from "@hpcc-js/html";
|
|
5
4
|
import "d3-transition";
|
|
6
5
|
import { ILayout } from "./layouts/index.ts";
|
|
7
6
|
import { Options as FDOptions } from "./layouts/forceDirectedWorker.ts";
|
|
8
|
-
import type { VertexBaseProps, EdgeBaseProps, GraphDataProps, HierarchyBase, SubgraphBaseProps } from "./layouts/placeholders.ts";
|
|
7
|
+
import type { BaseProps, VertexBaseProps, EdgeBaseProps, GraphDataProps, HierarchyBase, SubgraphBaseProps } from "./layouts/placeholders.ts";
|
|
9
8
|
import { EdgePlaceholder, SubgraphPlaceholder, VertexPlaceholder } from "./layouts/placeholders.ts";
|
|
10
9
|
import { Engine } from "./layouts/graphvizWorker.ts";
|
|
11
|
-
import "
|
|
12
|
-
export { GraphDataProps, SubgraphBaseProps, VertexBaseProps, EdgeBaseProps, HierarchyBase };
|
|
10
|
+
import "./graphT.css";
|
|
11
|
+
export { BaseProps, GraphDataProps, SubgraphBaseProps, VertexBaseProps, EdgeBaseProps, HierarchyBase };
|
|
13
12
|
type GraphLayoutType = "Hierarchy" | "DOT" | "Tree" | "Dendrogram" | "RadialTree" | "RadialDendrogram" | "ForceDirected" | "ForceDirected2" | "ForceDirectedHybrid" | "Neato" | "FDP" | "Circle" | "TwoPI" | "Circo" | "None";
|
|
14
|
-
export type RendererT<T> = (props: T, element: SVGGElement) =>
|
|
13
|
+
export type RendererT<T> = (props: T, element: SVGGElement) => unknown;
|
|
15
14
|
export declare class GraphT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E extends EdgeBaseProps<V>> extends SVGZoomWidget {
|
|
16
15
|
protected _centroidFilter: SVGGlowFilter;
|
|
17
16
|
private _toggleHierarchy;
|
|
@@ -45,12 +44,6 @@ export declare class GraphT<SG extends SubgraphBaseProps, V extends VertexBasePr
|
|
|
45
44
|
data?: SG | V | E;
|
|
46
45
|
};
|
|
47
46
|
iconBarButtons(): Widget[];
|
|
48
|
-
protected _categories: IconEx[];
|
|
49
|
-
categories(): IconEx[];
|
|
50
|
-
categories(_: IconEx[]): this;
|
|
51
|
-
protected _annotations: IconEx[];
|
|
52
|
-
annotations(): IconEx[];
|
|
53
|
-
annotations(_: IconEx[]): this;
|
|
54
47
|
private _origData;
|
|
55
48
|
data(): GraphDataProps<SG, V, E>;
|
|
56
49
|
data(_: GraphDataProps<SG, V, E>, merge?: boolean): this;
|
|
@@ -97,6 +90,10 @@ export declare class GraphT<SG extends SubgraphBaseProps, V extends VertexBasePr
|
|
|
97
90
|
x: number;
|
|
98
91
|
y: number;
|
|
99
92
|
};
|
|
93
|
+
rprojectPlacholder(vp: VertexPlaceholder<V>): {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
};
|
|
100
97
|
categoryID(id: string | number, prefix?: "cat" | "ann"): string;
|
|
101
98
|
updateCategories(): void;
|
|
102
99
|
updateAnnotations(): void;
|
|
@@ -115,6 +112,7 @@ export declare class GraphT<SG extends SubgraphBaseProps, V extends VertexBasePr
|
|
|
115
112
|
subgraphRenderer(): RendererT<SG>;
|
|
116
113
|
subgraphRenderer(_: RendererT<SG>): this;
|
|
117
114
|
updateSubgraphs(): this;
|
|
115
|
+
addMarkers(clearFirst?: boolean): void;
|
|
118
116
|
enter(domNode: any, element: any): void;
|
|
119
117
|
protected forceDirectedOptions(): FDOptions;
|
|
120
118
|
private layoutOptions;
|
|
@@ -2,6 +2,14 @@ import { Graph2 as GraphCollection } from "@hpcc-js/util";
|
|
|
2
2
|
import { EdgePlaceholder, SubgraphPlaceholder, VertexPlaceholder } from "./placeholders.ts";
|
|
3
3
|
import { EdgeLayout } from "./tree.ts";
|
|
4
4
|
export type Point = [number, number];
|
|
5
|
+
interface Position {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
interface Line {
|
|
10
|
+
source: Position;
|
|
11
|
+
target: Position;
|
|
12
|
+
}
|
|
5
13
|
export interface ILayout {
|
|
6
14
|
start(): Promise<this>;
|
|
7
15
|
stop(): this;
|
|
@@ -13,10 +21,13 @@ export type Size = {
|
|
|
13
21
|
height: number;
|
|
14
22
|
};
|
|
15
23
|
export interface IGraph {
|
|
24
|
+
id(): string;
|
|
16
25
|
size(): Size;
|
|
17
26
|
graphData(): GraphCollection<VertexPlaceholder, EdgePlaceholder, SubgraphPlaceholder>;
|
|
18
|
-
project(pos: number, clip
|
|
27
|
+
project(pos: number, clip?: boolean): any;
|
|
28
|
+
rproject(pos: number): any;
|
|
19
29
|
projectPlacholder(vp: VertexPlaceholder): any;
|
|
30
|
+
rprojectPlacholder(vp: VertexPlaceholder): any;
|
|
20
31
|
moveSubgraphs(transition: boolean): this;
|
|
21
32
|
moveVertexPlaceholder(vp: VertexPlaceholder, transition: boolean, moveEdges: boolean): this;
|
|
22
33
|
moveVertices(transition: boolean): this;
|
|
@@ -32,8 +43,14 @@ export declare class Layout implements ILayout {
|
|
|
32
43
|
stop(): this;
|
|
33
44
|
running(): boolean;
|
|
34
45
|
protected center(points: Point[]): Point;
|
|
46
|
+
vertexSize(vp: VertexPlaceholder): {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
};
|
|
50
|
+
edgeLine(ep: EdgePlaceholder): Line;
|
|
35
51
|
edgePath(ep: EdgePlaceholder, curveDepth: number): {
|
|
36
52
|
path: string;
|
|
37
53
|
labelPos: Point;
|
|
38
54
|
};
|
|
39
55
|
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Pos {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Segment {
|
|
6
|
+
start: Pos;
|
|
7
|
+
end: Pos;
|
|
8
|
+
}
|
|
9
|
+
export interface Rectangle {
|
|
10
|
+
topLeft: Pos;
|
|
11
|
+
topRight: Pos;
|
|
12
|
+
bottomLeft: Pos;
|
|
13
|
+
bottomRight: Pos;
|
|
14
|
+
}
|
|
15
|
+
export interface Rectangle2 {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
w: number;
|
|
19
|
+
h: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function intersection(rect: Rectangle2, line: Segment): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
@@ -26,7 +26,10 @@ export interface EdgeBaseProps<V extends VertexBaseProps = VertexBaseProps> exte
|
|
|
26
26
|
strokeDasharray?: string;
|
|
27
27
|
strokeWidth?: number;
|
|
28
28
|
stroke?: string;
|
|
29
|
+
path?: string;
|
|
29
30
|
fontFamily?: string;
|
|
31
|
+
markerStart?: string;
|
|
32
|
+
markerEnd?: string;
|
|
30
33
|
}
|
|
31
34
|
export interface HierarchyBase<SG extends SubgraphBaseProps, V extends VertexBaseProps> {
|
|
32
35
|
id: string | number;
|
|
@@ -43,6 +46,7 @@ export interface SubgraphPlaceholder<SG extends SubgraphBaseProps = SubgraphBase
|
|
|
43
46
|
id: string | number;
|
|
44
47
|
element?: Selection<SVGGElement, SubgraphPlaceholder<SG>, SVGGElement, any>;
|
|
45
48
|
props: SG;
|
|
49
|
+
renderResult?: unknown;
|
|
46
50
|
x?: number;
|
|
47
51
|
y?: number;
|
|
48
52
|
}
|
|
@@ -50,6 +54,7 @@ export interface VertexPlaceholder<V extends VertexBaseProps = VertexBaseProps>
|
|
|
50
54
|
id: string | number;
|
|
51
55
|
element?: Selection<SVGGElement, VertexPlaceholder<V>, SVGGElement, any>;
|
|
52
56
|
props: V;
|
|
57
|
+
renderResult?: any;
|
|
53
58
|
index?: number;
|
|
54
59
|
x?: number;
|
|
55
60
|
y?: number;
|
|
@@ -70,6 +75,7 @@ export interface EdgePlaceholder<V extends VertexBaseProps = VertexBaseProps, E
|
|
|
70
75
|
props: E;
|
|
71
76
|
source: VertexPlaceholder<V>;
|
|
72
77
|
target: VertexPlaceholder<V>;
|
|
78
|
+
renderResult?: any;
|
|
73
79
|
index?: number;
|
|
74
80
|
points?: Array<[number, number]>;
|
|
75
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SVGWidget } from "@hpcc-js/common";
|
|
2
|
-
import { AnnotationColumn } from "
|
|
3
|
-
import "
|
|
2
|
+
import { AnnotationColumn } from "../react/dataGraph.ts";
|
|
3
|
+
import "./sankeyGraph.css";
|
|
4
4
|
import { EdgeBaseProps, VertexBaseProps } from "./graphT.ts";
|
|
5
5
|
export declare class SankeyGraph extends SVGWidget {
|
|
6
6
|
protected _d3Sankey: any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AnnotationProps {
|
|
2
|
+
text: string;
|
|
3
|
+
fontFamily?: string;
|
|
4
|
+
fontSize?: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const annotation: ({ text, fontFamily, fontSize, fill, stroke }: AnnotationProps) => import("./component.ts").TemplateResultEx;
|
|
9
|
+
export interface AnnotationsProps {
|
|
10
|
+
annotations: AnnotationProps[];
|
|
11
|
+
padding?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const annotations: ({ annotations, padding, }: AnnotationsProps) => import("./component.ts").TemplateResultEx;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLTemplateResult, SVGTemplateResult } from "lit-html";
|
|
2
|
+
export type TemplateResult = HTMLTemplateResult | SVGTemplateResult;
|
|
3
|
+
export type TemplateResultEx = TemplateResult & {
|
|
4
|
+
extent?: {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function extend(result: TemplateResult, width: number, height: number): TemplateResultEx;
|
|
10
|
+
export type Component<T> = (props: T) => TemplateResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { html, svg } from "lit-html";
|
|
2
|
+
import type { BaseProps, EdgeBaseProps, SubgraphBaseProps, VertexBaseProps } from "../common/graphT.ts";
|
|
3
|
+
import { GraphT, RendererT } from "../common/graphT.ts";
|
|
4
|
+
import type { Component } from "./component.ts";
|
|
5
|
+
export { html, svg, EdgeBaseProps, SubgraphBaseProps, VertexBaseProps };
|
|
6
|
+
export declare function adapter<T extends BaseProps>(component: Component<T>): RendererT<T>;
|
|
7
|
+
export declare class GraphHtmlT<SG extends SubgraphBaseProps, V extends VertexBaseProps, E extends EdgeBaseProps<V>> extends GraphT<SG, V, E> {
|
|
8
|
+
constructor(subgraphRenderer?: Component<SG>, vertexRenderer?: Component<V>, edgeRenderer?: Component<E>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IconProps {
|
|
2
|
+
shape?: "circle" | "square" | "rectangle";
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
padding?: number;
|
|
6
|
+
fill?: string;
|
|
7
|
+
stroke?: string;
|
|
8
|
+
strokeWidth?: number;
|
|
9
|
+
imageUrl?: string;
|
|
10
|
+
imageFontFamily?: string;
|
|
11
|
+
imageChar?: string;
|
|
12
|
+
imageCharFill?: string;
|
|
13
|
+
cornerRadius?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function icon({ shape, width, height, fill, stroke, strokeWidth, imageUrl, imageFontFamily, imageChar, imageCharFill, padding, cornerRadius, }: IconProps): import("./component.ts").TemplateResultEx;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const DEFAULT_SHAPE_SIZE = 32;
|
|
2
|
+
interface BaseProps {
|
|
3
|
+
fill?: string;
|
|
4
|
+
stroke?: string;
|
|
5
|
+
strokeWidth?: number;
|
|
6
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
7
|
+
}
|
|
8
|
+
export interface CircleProps extends BaseProps {
|
|
9
|
+
diameter?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const circle: ({ diameter, fill, stroke, strokeWidth, shapeRendering }: CircleProps) => import("./component.ts").TemplateResultEx;
|
|
12
|
+
export interface RectangleProps extends BaseProps {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
cornerRadius?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const rectangle: ({ width, height, cornerRadius, fill, stroke, strokeWidth, shapeRendering }: RectangleProps) => import("./component.ts").TemplateResultEx;
|
|
18
|
+
export interface SquareProps extends BaseProps {
|
|
19
|
+
width?: number;
|
|
20
|
+
cornerRadius?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const square: ({ width, cornerRadius, fill, stroke, strokeWidth, shapeRendering }: SquareProps) => import("./component.ts").TemplateResultEx;
|
|
23
|
+
export interface ShapeProps extends BaseProps {
|
|
24
|
+
shape?: "circle" | "square" | "rectangle";
|
|
25
|
+
diameter?: number;
|
|
26
|
+
width?: number;
|
|
27
|
+
height?: number;
|
|
28
|
+
cornerRadius?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const shape: ({ shape, diameter, width, height, fill, stroke, strokeWidth, shapeRendering, cornerRadius }: ShapeProps) => import("./component.ts").TemplateResultEx;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface TextProps {
|
|
2
|
+
text: string;
|
|
3
|
+
anchor?: "left" | "middle" | "end";
|
|
4
|
+
fill?: string;
|
|
5
|
+
fontFamily?: string;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
dominantBaseline?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TextLine: ({ text, anchor, fill, fontFamily, fontSize, dominantBaseline, }: TextProps) => import("./component.ts").TemplateResultEx;
|
|
10
|
+
export declare const Text: ({ text, anchor, fill, fontFamily, fontSize, }: TextProps) => import("./component.ts").TemplateResultEx;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextProps } from "./text.ts";
|
|
2
|
+
export interface TextBoxProps {
|
|
3
|
+
text: TextProps;
|
|
4
|
+
padding?: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
cornerRadius?: number;
|
|
9
|
+
yOffset?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const TextBox: ({ text, padding, fill, stroke, strokeWidth, cornerRadius, }: TextBoxProps) => import("./component.ts").TemplateResultEx;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { VertexBaseProps } from "../common/layouts/placeholders.ts";
|
|
2
|
+
import { IconProps } from "./icon.ts";
|
|
3
|
+
import { TextBoxProps } from "./textBox.ts";
|
|
4
|
+
import { AnnotationProps } from "./annotation.ts";
|
|
5
|
+
import { Component } from "./component.ts";
|
|
6
|
+
export interface VertexProps extends VertexBaseProps {
|
|
7
|
+
icon?: IconProps;
|
|
8
|
+
iconOffset?: number;
|
|
9
|
+
iconAnnotations?: AnnotationProps[];
|
|
10
|
+
iconAnnotationsOffset?: number;
|
|
11
|
+
textBox?: TextBoxProps;
|
|
12
|
+
textBoxAnnotationsE?: AnnotationProps[];
|
|
13
|
+
textBoxAnnotationsSE?: AnnotationProps[];
|
|
14
|
+
textBoxAnnotationsS?: AnnotationProps[];
|
|
15
|
+
textBoxAnnotationsOffset?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const vertex: Component<VertexProps>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropertyExt, Widget } from "@hpcc-js/common";
|
|
2
2
|
import { Vertex3Props, EdgeProps } from "@hpcc-js/react";
|
|
3
|
-
import {
|
|
3
|
+
import { GraphReact } from "./graphReact.ts";
|
|
4
4
|
export type IVertex3 = Vertex3Props;
|
|
5
5
|
export declare function toJsonObj<T>(row: any, columns: any): T;
|
|
6
6
|
export declare class AnnotationColumn extends PropertyExt {
|
|
@@ -15,7 +15,7 @@ export interface AnnotationColumn {
|
|
|
15
15
|
annotationID(): string;
|
|
16
16
|
annotationID(_: string): this;
|
|
17
17
|
}
|
|
18
|
-
export declare class DataGraph extends
|
|
18
|
+
export declare class DataGraph extends GraphReact {
|
|
19
19
|
constructor();
|
|
20
20
|
clear(): void;
|
|
21
21
|
indexOf(columns: readonly string[], column: string, defColumn?: string): number;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { IconEx } from "@hpcc-js/react";
|
|
1
2
|
import { React, SubgraphProps, VertexProps, EdgeProps } from "@hpcc-js/react";
|
|
2
3
|
import { GraphReactT } from "./graphReactT.ts";
|
|
3
|
-
import { GraphDataProps, HierarchyBase } from "
|
|
4
|
+
import { GraphDataProps, HierarchyBase } from "../common/graphT.ts";
|
|
4
5
|
export type ISubgraph = SubgraphProps;
|
|
5
6
|
export type IVertex = VertexProps;
|
|
6
7
|
export type IEdge = EdgeProps;
|
|
7
8
|
export type IHierarchy = HierarchyBase<ISubgraph, IVertex>;
|
|
8
9
|
export type IGraphData2 = GraphDataProps<ISubgraph, IVertex, IEdge>;
|
|
9
|
-
export declare class
|
|
10
|
+
export declare class GraphReact extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
10
11
|
constructor();
|
|
12
|
+
protected _categories: IconEx[];
|
|
13
|
+
categories(): IconEx[];
|
|
14
|
+
categories(_: IconEx[]): this;
|
|
15
|
+
protected _annotations: IconEx[];
|
|
16
|
+
annotations(): IconEx[];
|
|
17
|
+
annotations(_: IconEx[]): this;
|
|
11
18
|
calcProps(_props: VertexProps): VertexProps;
|
|
12
19
|
protected _reactVertexRenderer2: React.FunctionComponent<any>;
|
|
13
20
|
vertexRenderer<T extends VertexProps>(): React.FunctionComponent<T>;
|
|
@@ -16,9 +23,11 @@ export declare class Graph2 extends GraphReactT<ISubgraph, IVertex, IEdge> {
|
|
|
16
23
|
centroidRenderer<T extends VertexProps>(): React.FunctionComponent<T>;
|
|
17
24
|
centroidRenderer<T extends VertexProps>(_: React.FunctionComponent<T>): this;
|
|
18
25
|
enter(domNode: any, element: any): void;
|
|
26
|
+
updateCategories(): void;
|
|
27
|
+
updateAnnotations(): void;
|
|
19
28
|
update(domNode: any, element: any): void;
|
|
20
29
|
}
|
|
21
|
-
export interface
|
|
30
|
+
export interface GraphReact {
|
|
22
31
|
vertexTextHeight(): number;
|
|
23
32
|
vertexTextHeight(_: number): this;
|
|
24
33
|
vertexTextPadding(): number;
|
|
@@ -52,3 +61,4 @@ export interface Graph2 {
|
|
|
52
61
|
centroidLabelFontFamily(): string;
|
|
53
62
|
centroidLabelFontFamily(_: string): this;
|
|
54
63
|
}
|
|
64
|
+
export declare const Graph2: typeof GraphReact;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { React, SubgraphProps, VertexProps, EdgeProps } from "@hpcc-js/react";
|
|
2
|
-
import { GraphT } from "
|
|
2
|
+
import { GraphT } from "../common/graphT.ts";
|
|
3
3
|
export declare class GraphReactT<SG extends SubgraphProps, V extends VertexProps, E extends EdgeProps<V>> extends GraphT<SG, V, E> {
|
|
4
4
|
constructor(subgraphRenderer: React.FunctionComponent<SG>, vertexRenderer: React.FunctionComponent<V>, edgeRenderer: React.FunctionComponent<E>);
|
|
5
5
|
private _reactSubgraphRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { React } from "@hpcc-js/react";
|
|
2
|
-
import { SubgraphBaseProps } from "
|
|
2
|
+
import { SubgraphBaseProps } from "../common/layouts/placeholders.ts";
|
|
3
3
|
export interface BasicSubgraphProps extends SubgraphBaseProps {
|
|
4
4
|
label?: string;
|
|
5
5
|
labelFill?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { React } from "@hpcc-js/react";
|
|
2
|
-
import { VertexBaseProps } from "
|
|
2
|
+
import { VertexBaseProps } from "../common/layouts/placeholders.ts";
|
|
3
3
|
export interface BasicVertexProps extends VertexBaseProps {
|
|
4
4
|
textFill?: string;
|
|
5
5
|
textHeight?: number;
|
package/src/graph2/graph.css
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
.graph_Graph2 .graphVertex {
|
|
2
|
-
cursor: pointer;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.graph_Graph2 .allowDragging .graphVertex {
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.graph_Graph2 .allowDragging .graphVertex.grabbed {
|
|
11
|
-
cursor: grabbing;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.graph_Graph2 .graphEdge {
|
|
15
|
-
stroke: darkgray;
|
|
16
|
-
fill: none;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.graph_Graph2 .graphEdge > text {
|
|
20
|
-
stroke: none;
|
|
21
|
-
fill: black;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.graph_Graph2 .graphEdge.hide-text > text {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.graph_Graph2 g.selected rect {
|
|
29
|
-
stroke:red !important;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.graph_Graph2 g.selected circle {
|
|
33
|
-
stroke:red !important;
|
|
34
|
-
}
|