@hpcc-js/graph 2.83.1 → 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/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 +8 -7
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/graph",
|
|
3
|
-
"version": "2.83.
|
|
3
|
+
"version": "2.83.2",
|
|
4
4
|
"description": "hpcc-js - Viz Graph",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -52,21 +52,22 @@
|
|
|
52
52
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@hpcc-js/api": "^2.12.
|
|
56
|
-
"@hpcc-js/common": "^2.71.
|
|
57
|
-
"@hpcc-js/html": "^2.42.
|
|
58
|
-
"@hpcc-js/react": "^2.52.
|
|
55
|
+
"@hpcc-js/api": "^2.12.3",
|
|
56
|
+
"@hpcc-js/common": "^2.71.3",
|
|
57
|
+
"@hpcc-js/html": "^2.42.4",
|
|
58
|
+
"@hpcc-js/react": "^2.52.2",
|
|
59
59
|
"@hpcc-js/util": "^2.49.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@hpcc-js/bundle": "^2.11.3",
|
|
63
|
-
"@hpcc-js/wasm": "1.
|
|
63
|
+
"@hpcc-js/wasm": "1.16.5",
|
|
64
64
|
"@types/d3-transition": "1.3.2",
|
|
65
65
|
"@types/dagre": "0.7.48",
|
|
66
66
|
"d3-array": "^1",
|
|
67
67
|
"d3-drag": "^1",
|
|
68
68
|
"d3-force": "^1",
|
|
69
69
|
"d3-geo": "^1",
|
|
70
|
+
"d3-interpolate-path": "2.3.0",
|
|
70
71
|
"d3-sankey": "^0",
|
|
71
72
|
"d3-scale": "^1",
|
|
72
73
|
"d3-selection": "^1",
|
|
@@ -88,5 +89,5 @@
|
|
|
88
89
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
89
90
|
},
|
|
90
91
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "0b196092f8781f2f56a7f688496d1ae9bc229ace"
|
|
92
93
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/graph";
|
|
2
|
-
export const PKG_VERSION = "2.83.
|
|
3
|
-
export const BUILD_VERSION = "2.104.
|
|
2
|
+
export const PKG_VERSION = "2.83.2";
|
|
3
|
+
export const BUILD_VERSION = "2.104.7";
|
package/src/graph2/dataGraph.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { PropertyExt, publish, Widget } from "@hpcc-js/common";
|
|
2
|
-
import { CentroidVertex3, Vertex3 } from "@hpcc-js/react";
|
|
2
|
+
import { CentroidVertex3, IVertex3, SubgraphProps, Vertex3 } from "@hpcc-js/react";
|
|
3
3
|
import { compare2 } from "@hpcc-js/util";
|
|
4
4
|
import { Graph2 } from "./graph";
|
|
5
|
-
import {
|
|
5
|
+
import { HierarchyBase } from "./layouts/placeholders";
|
|
6
|
+
import { BasicEdgeProps } from "./edge";
|
|
6
7
|
|
|
7
|
-
export function toJsonObj(row, columns) {
|
|
8
|
-
const retVal = {};
|
|
8
|
+
export function toJsonObj<T>(row, columns): T {
|
|
9
|
+
const retVal: T = {} as T;
|
|
9
10
|
columns.forEach((c, i) => retVal[c] = row[i]);
|
|
10
11
|
return retVal;
|
|
11
12
|
}
|
|
@@ -128,18 +129,18 @@ export class DataGraph extends Graph2 {
|
|
|
128
129
|
return retVal >= 0 ? retVal : columns.indexOf(defColumn);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
private _prevSubgraphs: readonly
|
|
132
|
-
private _masterSubgraphs:
|
|
133
|
-
private _masterSubgraphsMap: { [key: string]:
|
|
132
|
+
private _prevSubgraphs: readonly SubgraphProps[] = [];
|
|
133
|
+
private _masterSubgraphs: SubgraphProps[] = [];
|
|
134
|
+
private _masterSubgraphsMap: { [key: string]: SubgraphProps } = {};
|
|
134
135
|
mergeSubgraphs() {
|
|
135
136
|
const columns = this.subgraphColumns();
|
|
136
137
|
const idIdx = this.indexOf(columns, this.subgraphIDColumn(), "id");
|
|
137
138
|
const labelIdx = this.indexOf(columns, this.subgraphLabelColumn(), "label");
|
|
138
|
-
const subgraphs = this.subgraphs().map((sg):
|
|
139
|
+
const subgraphs = this.subgraphs().map((sg): SubgraphProps => {
|
|
139
140
|
return {
|
|
140
141
|
id: "" + sg[idIdx],
|
|
141
142
|
text: "" + sg[labelIdx],
|
|
142
|
-
origData: toJsonObj(sg, columns)
|
|
143
|
+
origData: toJsonObj<SubgraphProps>(sg, columns)
|
|
143
144
|
};
|
|
144
145
|
});
|
|
145
146
|
const diff = compare2(this._prevSubgraphs, subgraphs, d => d.id);
|
|
@@ -157,9 +158,9 @@ export class DataGraph extends Graph2 {
|
|
|
157
158
|
this._prevSubgraphs = subgraphs;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
private _prevVertices: readonly
|
|
161
|
-
private _masterVertices:
|
|
162
|
-
private _masterVerticesMap: { [key: string]:
|
|
161
|
+
private _prevVertices: readonly IVertex3[] = [];
|
|
162
|
+
private _masterVertices: IVertex3[] = [];
|
|
163
|
+
private _masterVerticesMap: { [key: string]: IVertex3 } = {};
|
|
163
164
|
mergeVertices() {
|
|
164
165
|
const columns = this.vertexColumns();
|
|
165
166
|
const annotationColumns = this.vertexAnnotationColumns();
|
|
@@ -171,7 +172,7 @@ export class DataGraph extends Graph2 {
|
|
|
171
172
|
const vertexTooltipIdx = this.indexOf(columns, this.vertexTooltipColumn(), "tooltip");
|
|
172
173
|
const annotationIdxs = annotationColumns.map(ac => this.indexOf(columns, ac.columnID(), ""));
|
|
173
174
|
const expansionFACharIdx = this.indexOf(columns, this.vertexExpansionFACharColumn(), "expansionFAChar");
|
|
174
|
-
const vertices:
|
|
175
|
+
const vertices: IVertex3[] = this.vertices().map((v): IVertex3 => {
|
|
175
176
|
const annotationIDs = annotationIdxs.map((ai, i) => !!v[ai] ? annotationColumns[i].annotationID() : undefined).filter(a => !!a);
|
|
176
177
|
return {
|
|
177
178
|
categoryID: "" + v[catIdx],
|
|
@@ -188,7 +189,7 @@ export class DataGraph extends Graph2 {
|
|
|
188
189
|
expansionIcon: v[expansionFACharIdx] ? {
|
|
189
190
|
imageChar: "" + v[expansionFACharIdx]
|
|
190
191
|
} : undefined
|
|
191
|
-
} as
|
|
192
|
+
} as IVertex3;
|
|
192
193
|
});
|
|
193
194
|
const diff = compare2(this._prevVertices, vertices, d => d.id);
|
|
194
195
|
diff.exit.forEach(item => {
|
|
@@ -205,9 +206,9 @@ export class DataGraph extends Graph2 {
|
|
|
205
206
|
this._prevVertices = vertices;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
protected _prevEdges: readonly
|
|
209
|
-
protected _masterEdges:
|
|
210
|
-
private _masterEdgesMap: { [key: string]:
|
|
209
|
+
protected _prevEdges: readonly BasicEdgeProps[] = [];
|
|
210
|
+
protected _masterEdges: BasicEdgeProps[] = [];
|
|
211
|
+
private _masterEdgesMap: { [key: string]: BasicEdgeProps } = {};
|
|
211
212
|
mergeEdges() {
|
|
212
213
|
const columns = this.edgeColumns();
|
|
213
214
|
const idIdx = this.indexOf(columns, this.edgeIDColumn(), "id");
|
|
@@ -216,20 +217,21 @@ export class DataGraph extends Graph2 {
|
|
|
216
217
|
const labelIdx = this.indexOf(columns, this.edgeLabelColumn(), "label");
|
|
217
218
|
const weightIdx = this.indexOf(columns, this.edgeWeightColumn(), "weight");
|
|
218
219
|
const colorIdx = this.indexOf(columns, this.edgeColorColumn(), "color");
|
|
219
|
-
const edges:
|
|
220
|
+
const edges: BasicEdgeProps[] = this.edges().map((e): BasicEdgeProps => {
|
|
220
221
|
const source = this._masterVerticesMap["" + e[sourceIdx]];
|
|
221
222
|
if (!source) console.error(`Invalid edge source entity "${e[sourceIdx]}" does not exist.`);
|
|
222
223
|
const target = this._masterVerticesMap["" + e[targetIdx]];
|
|
223
224
|
if (!target) console.error(`Invalid edge target entity "${e[targetIdx]}" does not exist.`);
|
|
224
225
|
return {
|
|
225
|
-
type: "edge",
|
|
226
226
|
id: idIdx >= 0 ? "" + e[idIdx] : "" + e[sourceIdx] + "->" + e[targetIdx],
|
|
227
227
|
source,
|
|
228
228
|
target,
|
|
229
229
|
weight: +e[weightIdx] || 1,
|
|
230
230
|
color: e[colorIdx] as string,
|
|
231
231
|
label: labelIdx >= 0 ? ("" + e[labelIdx]) : "",
|
|
232
|
-
origData: toJsonObj(e, columns)
|
|
232
|
+
origData: toJsonObj(e, columns),
|
|
233
|
+
labelPos: [0, 0],
|
|
234
|
+
path: ""
|
|
233
235
|
};
|
|
234
236
|
}).filter(e => e.source && e.target);
|
|
235
237
|
const diff = compare2(this._masterEdges, edges, d => d.id);
|
|
@@ -248,17 +250,17 @@ export class DataGraph extends Graph2 {
|
|
|
248
250
|
this._prevEdges = edges;
|
|
249
251
|
}
|
|
250
252
|
|
|
251
|
-
private _prevHierarchy: readonly
|
|
252
|
-
private _masterHierarchy:
|
|
253
|
-
private _masterHierarchyMap: { [key: string]:
|
|
253
|
+
private _prevHierarchy: readonly HierarchyBase<SubgraphProps, IVertex3>[] = [];
|
|
254
|
+
private _masterHierarchy: HierarchyBase<SubgraphProps, IVertex3>[] = [];
|
|
255
|
+
private _masterHierarchyMap: { [key: string]: HierarchyBase<SubgraphProps, IVertex3> } = {};
|
|
254
256
|
mergeHierarchy() {
|
|
255
257
|
const columns = this.hierarchyColumns();
|
|
256
258
|
const parentIDIdx = this.indexOf(columns, this.hierarchyParentIDColumn(), "parentID");
|
|
257
259
|
const childIDIdx = this.indexOf(columns, this.hierarchyChildIDColumn(), "childID");
|
|
258
|
-
const hierarchy:
|
|
260
|
+
const hierarchy: HierarchyBase<SubgraphProps, IVertex3>[] = this.hierarchy().map((h): HierarchyBase<SubgraphProps, IVertex3> => {
|
|
259
261
|
return {
|
|
260
262
|
id: "" + h[parentIDIdx] + "=>" + h[childIDIdx],
|
|
261
|
-
parent: this._masterSubgraphsMap["" + h[parentIDIdx]],
|
|
263
|
+
parent: this._masterSubgraphsMap["" + h[parentIDIdx]] as SubgraphProps,
|
|
262
264
|
child: this._masterSubgraphsMap["" + h[childIDIdx]] || this._masterVerticesMap["" + h[childIDIdx]]
|
|
263
265
|
};
|
|
264
266
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// , Shape, Text,
|
|
2
|
+
import { React, Text } from "@hpcc-js/react";
|
|
3
|
+
import { EdgeProps as EdgeProps } from "./layouts/placeholders";
|
|
4
|
+
|
|
5
|
+
export interface BasicEdgeProps extends EdgeProps {
|
|
6
|
+
labelFill?: string;
|
|
7
|
+
labelHeight?: number,
|
|
8
|
+
path?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BasicEdge: React.FunctionComponent<BasicEdgeProps> = ({
|
|
12
|
+
label,
|
|
13
|
+
labelPos,
|
|
14
|
+
labelFill = "black",
|
|
15
|
+
labelHeight = 12,
|
|
16
|
+
path,
|
|
17
|
+
color,
|
|
18
|
+
strokeWidth,
|
|
19
|
+
strokeDasharray
|
|
20
|
+
}) => {
|
|
21
|
+
return <>
|
|
22
|
+
<path d={path} stroke={color} style={{ strokeWidth, strokeDasharray }}></path>
|
|
23
|
+
{
|
|
24
|
+
label && labelPos && labelPos.length === 2 ?
|
|
25
|
+
<g transform={`translate(${labelPos[0]} ${labelPos[1]})`}>
|
|
26
|
+
<Text text={label} fill={labelFill} height={labelHeight} />
|
|
27
|
+
</g> : undefined
|
|
28
|
+
}
|
|
29
|
+
</>;
|
|
30
|
+
};
|