@hpcc-js/graph 2.81.0 → 2.83.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/graphvizlib.wasm +0 -0
- package/dist/index.es6.js +52 -17
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +52 -17
- 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 -11
- package/src/__package__.ts +2 -2
- package/src/graph2/dataGraph.ts +10 -2
- package/src/graph2/graph.ts +41 -16
- package/src/graph2/layouts/graphvizWorker.ts +2 -16
- package/src/graph2/layouts/index.ts +1 -1
- package/src/test.ts +22 -11
- package/types/__package__.d.ts +2 -2
- package/types/graph2/dataGraph.d.ts +1 -0
- package/types/graph2/dataGraph.d.ts.map +1 -1
- package/types/graph2/graph.d.ts +13 -8
- package/types/graph2/graph.d.ts.map +1 -1
- package/types/graph2/layouts/graphvizWorker.d.ts.map +1 -1
- package/types/graph2/layouts/index.d.ts +1 -1
- package/types/graph2/layouts/index.d.ts.map +1 -1
- package/types/test.d.ts +4 -1
- package/types/test.d.ts.map +1 -1
- package/types-3.4/__package__.d.ts +2 -2
- package/types-3.4/graph2/dataGraph.d.ts +1 -0
- package/types-3.4/graph2/graph.d.ts +13 -8
- package/types-3.4/test.d.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/graph",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.83.0",
|
|
4
4
|
"description": "hpcc-js - Viz Graph",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"lint": "eslint ./src",
|
|
50
50
|
"docs": "typedoc --options tdoptions.json .",
|
|
51
51
|
"ddd": "downlevel-dts . ts3.4",
|
|
52
|
-
"update": "npx npm-check-updates -u -t minor"
|
|
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.
|
|
59
|
-
"@hpcc-js/util": "^2.
|
|
55
|
+
"@hpcc-js/api": "^2.12.1",
|
|
56
|
+
"@hpcc-js/common": "^2.71.1",
|
|
57
|
+
"@hpcc-js/html": "^2.42.2",
|
|
58
|
+
"@hpcc-js/react": "^2.52.0",
|
|
59
|
+
"@hpcc-js/util": "^2.49.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@hpcc-js/bundle": "^2.11.
|
|
63
|
-
"@hpcc-js/wasm": "1.
|
|
62
|
+
"@hpcc-js/bundle": "^2.11.2",
|
|
63
|
+
"@hpcc-js/wasm": "1.15.0",
|
|
64
64
|
"@types/d3-transition": "1.3.2",
|
|
65
65
|
"@types/dagre": "0.7.47",
|
|
66
66
|
"d3-array": "^1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"d3-transition": "^1",
|
|
76
76
|
"dagre": "0.8.5",
|
|
77
77
|
"es6-promise": "4.2.8",
|
|
78
|
-
"tslib": "2.
|
|
78
|
+
"tslib": "2.4.0"
|
|
79
79
|
},
|
|
80
80
|
"repository": {
|
|
81
81
|
"type": "git",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
89
89
|
},
|
|
90
90
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "3a4f1ba7a59e2e7f5283830e0a884187a6c42fe7"
|
|
92
92
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/graph";
|
|
2
|
-
export const PKG_VERSION = "2.
|
|
3
|
-
export const BUILD_VERSION = "2.104.
|
|
2
|
+
export const PKG_VERSION = "2.83.0";
|
|
3
|
+
export const BUILD_VERSION = "2.104.3";
|
package/src/graph2/dataGraph.ts
CHANGED
|
@@ -63,6 +63,8 @@ export class DataGraph extends Graph2 {
|
|
|
63
63
|
vertexTooltipColumn: publish<this, string>;
|
|
64
64
|
@publish([], "propertyArray", "Annotations", null, { autoExpand: AnnotationColumn })
|
|
65
65
|
vertexAnnotationColumns: publish<this, AnnotationColumn[]>;
|
|
66
|
+
@publish("", "set", "Vertex expansion FAChar column", function (this: DataGraph) { return this.vertexColumns(); }, { optional: true })
|
|
67
|
+
vertexExpansionFACharColumn: publish<this, string>;
|
|
66
68
|
|
|
67
69
|
@publish([], "any", "Edge columns", null, { internal: true })
|
|
68
70
|
edgeColumns: publish<this, string[]>;
|
|
@@ -168,7 +170,9 @@ export class DataGraph extends Graph2 {
|
|
|
168
170
|
const faCharIdx = this.indexOf(columns, this.vertexFACharColumn(), "faChar");
|
|
169
171
|
const vertexTooltipIdx = this.indexOf(columns, this.vertexTooltipColumn(), "tooltip");
|
|
170
172
|
const annotationIdxs = annotationColumns.map(ac => this.indexOf(columns, ac.columnID(), ""));
|
|
173
|
+
const expansionFACharIdx = this.indexOf(columns, this.vertexExpansionFACharColumn(), "expansionFAChar");
|
|
171
174
|
const vertices: IVertex[] = this.vertices().map((v): IVertex => {
|
|
175
|
+
const annotationIDs = annotationIdxs.map((ai, i) => !!v[ai] ? annotationColumns[i].annotationID() : undefined).filter(a => !!a);
|
|
172
176
|
return {
|
|
173
177
|
categoryID: "" + v[catIdx],
|
|
174
178
|
id: "" + v[idIdx],
|
|
@@ -179,8 +183,12 @@ export class DataGraph extends Graph2 {
|
|
|
179
183
|
icon: {
|
|
180
184
|
imageChar: "" + (v[faCharIdx] || this.vertexFAChar())
|
|
181
185
|
},
|
|
182
|
-
annotationIDs
|
|
183
|
-
|
|
186
|
+
annotationIDs,
|
|
187
|
+
annotations: this.annotations().filter(ann => annotationIDs.indexOf(ann.id) >= 0),
|
|
188
|
+
expansionIcon: v[expansionFACharIdx] ? {
|
|
189
|
+
imageChar: "" + v[expansionFACharIdx]
|
|
190
|
+
} : undefined
|
|
191
|
+
} as IVertex;
|
|
184
192
|
});
|
|
185
193
|
const diff = compare2(this._prevVertices, vertices, d => d.id);
|
|
186
194
|
diff.exit.forEach(item => {
|
package/src/graph2/graph.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { d3Event, drag as d3Drag, Palette, select as d3Select, Selection, Spacer, SVGGlowFilter, SVGZoomWidget, ToggleButton, Utility, Widget } from "@hpcc-js/common";
|
|
2
|
-
import { IconEx, Icons, React, render, Subgraph, Vertex, IVertex3 } from "@hpcc-js/react";
|
|
2
|
+
import { IconEx, Icons, React, render, Subgraph, Vertex, IVertex3, IVertex4Annotation, Icon } from "@hpcc-js/react";
|
|
3
3
|
import { getScriptSrc, Graph2 as GraphCollection, hashSum } from "@hpcc-js/util";
|
|
4
4
|
import { HTMLTooltip } from "@hpcc-js/html";
|
|
5
5
|
import "d3-transition";
|
|
6
6
|
import { Circle, Dagre, ForceDirected, ForceDirectedAnimated, Graphviz, ILayout, Null } from "./layouts/index";
|
|
7
7
|
import { Options as FDOptions } from "./layouts/forceDirectedWorker";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import type { IEdge, IGraphData2, IHierarchy, ISubgraph, IVertex } from "./layouts/placeholders";
|
|
9
|
+
import { EdgePlaceholder, SubgraphPlaceholder, VertexPlaceholder } from "./layouts/placeholders";
|
|
10
|
+
import { Engine, graphviz as gvWorker } from "./layouts/graphvizWorker";
|
|
10
11
|
import { Tree, RadialTree, Dendrogram, RadialDendrogram } from "./layouts/tree";
|
|
11
12
|
|
|
12
13
|
import "../../src/graph2/graph.css";
|
|
13
|
-
import { Engine } from "./layouts/graphvizWorker";
|
|
14
14
|
|
|
15
15
|
const wasmFolder = `${getScriptSrc("/graph/lib-umd/graph2/graph") || getScriptSrc("/graph/dist/index") || "."}/graph/dist`;
|
|
16
16
|
|
|
@@ -186,10 +186,11 @@ export class Graph2 extends SVGZoomWidget {
|
|
|
186
186
|
}, d3Event().sourceEvent);
|
|
187
187
|
context.selectionChanged();
|
|
188
188
|
const selected = d.element.classed("selected");
|
|
189
|
-
context.
|
|
189
|
+
const eventOrigin = context.resolveEventOrigin();
|
|
190
|
+
context.vertex_click(d.props.origData || d.props, "", selected, eventOrigin);
|
|
190
191
|
const doClickTime = Date.now();
|
|
191
192
|
if (doClickTime - context._prevDoClickTime < context.doubleClickMaxDelay()) {
|
|
192
|
-
context.vertex_dblclick(d.props.origData || d.props, "", selected);
|
|
193
|
+
context.vertex_dblclick(d.props.origData || d.props, "", selected, eventOrigin);
|
|
193
194
|
}
|
|
194
195
|
context._prevDoClickTime = doClickTime;
|
|
195
196
|
}
|
|
@@ -199,6 +200,27 @@ export class Graph2 extends SVGZoomWidget {
|
|
|
199
200
|
this.zoomToFitLimit(1);
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
resolveEventOrigin(): { origin: string, data: undefined | IVertex4Annotation | Icon } {
|
|
204
|
+
const d3evt = d3Event();
|
|
205
|
+
const eventPath = d3evt?.sourceEvent?.path ?? d3evt?.path;
|
|
206
|
+
const element = eventPath.find(n => n?.hasAttribute && n?.hasAttribute("data-click"));
|
|
207
|
+
const origin = element ? element.getAttribute("data-click") : "";
|
|
208
|
+
const dataStr = element ? element.getAttribute("data-click-data") : "";
|
|
209
|
+
let data = undefined;
|
|
210
|
+
if (dataStr) {
|
|
211
|
+
try {
|
|
212
|
+
data = JSON.parse(dataStr);
|
|
213
|
+
} catch (e) {
|
|
214
|
+
console.warn("Unexpected annotation data:", dataStr);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
origin,
|
|
220
|
+
data
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
202
224
|
iconBarButtons(): Widget[] {
|
|
203
225
|
return this._iconBar.buttons();
|
|
204
226
|
}
|
|
@@ -749,7 +771,8 @@ export class Graph2 extends SVGZoomWidget {
|
|
|
749
771
|
Utility.safeRaise(this);
|
|
750
772
|
context.highlightVertex(d3Select(this), d);
|
|
751
773
|
const selected = d.element.classed("selected");
|
|
752
|
-
context.
|
|
774
|
+
const eventOrigin = context.resolveEventOrigin();
|
|
775
|
+
context.vertex_mousein(d.props.origData || d.props, "", selected, eventOrigin);
|
|
753
776
|
})
|
|
754
777
|
.on("mouseover", function (d) {
|
|
755
778
|
Utility.safeRaise(this);
|
|
@@ -769,12 +792,14 @@ export class Graph2 extends SVGZoomWidget {
|
|
|
769
792
|
.render()
|
|
770
793
|
;
|
|
771
794
|
}
|
|
772
|
-
context.
|
|
795
|
+
const eventOrigin = context.resolveEventOrigin();
|
|
796
|
+
context.vertex_mouseover(d.props.origData || d.props, "", selected, eventOrigin);
|
|
773
797
|
})
|
|
774
798
|
.on("mouseout", function (d) {
|
|
775
799
|
context.highlightVertex(null, null);
|
|
776
800
|
const selected = d.element.classed("selected");
|
|
777
|
-
context.
|
|
801
|
+
const eventOrigin = context.resolveEventOrigin();
|
|
802
|
+
context.vertex_mouseout(d.props.origData || d.props, "", selected, eventOrigin);
|
|
778
803
|
if (d.props.tooltip) {
|
|
779
804
|
context._tooltip.mouseout();
|
|
780
805
|
}
|
|
@@ -1125,19 +1150,19 @@ export class Graph2 extends SVGZoomWidget {
|
|
|
1125
1150
|
subgraph_click(row, _col, sel) {
|
|
1126
1151
|
}
|
|
1127
1152
|
|
|
1128
|
-
vertex_click(row, _col, sel) {
|
|
1153
|
+
vertex_click(row, _col, sel, data) {
|
|
1129
1154
|
}
|
|
1130
1155
|
|
|
1131
|
-
vertex_dblclick(row, _col, sel) {
|
|
1156
|
+
vertex_dblclick(row, _col, sel, data) {
|
|
1132
1157
|
}
|
|
1133
1158
|
|
|
1134
|
-
vertex_mousein(row, _col, sel) {
|
|
1159
|
+
vertex_mousein(row, _col, sel, data) {
|
|
1135
1160
|
}
|
|
1136
1161
|
|
|
1137
|
-
vertex_mouseover(row, _col, sel) {
|
|
1162
|
+
vertex_mouseover(row, _col, sel, data) {
|
|
1138
1163
|
}
|
|
1139
1164
|
|
|
1140
|
-
vertex_mouseout(row, _col, sel) {
|
|
1165
|
+
vertex_mouseout(row, _col, sel, data) {
|
|
1141
1166
|
}
|
|
1142
1167
|
|
|
1143
1168
|
edge_click(row, _col, sel) {
|
|
@@ -1313,14 +1338,14 @@ Graph2.prototype.publish("centroidIconHeight", 50, "number", "Centroid Icon Heig
|
|
|
1313
1338
|
Graph2.prototype.publish("centroidIconPadding", 10, "number", "Centroid Icon Padding");
|
|
1314
1339
|
Graph2.prototype.publish("centroidIconStrokeWidth", 4, "number", "Centroid Icon Stroke Width");
|
|
1315
1340
|
Graph2.prototype.publish("centroidIconFontFamily", "FontAwesome", "string", "Centroid Icon Font Family");
|
|
1316
|
-
Graph2.prototype.publish("centroidLabelFontFamily", "
|
|
1341
|
+
Graph2.prototype.publish("centroidLabelFontFamily", "Verdana", "string", "Centroid Label Font Family");
|
|
1317
1342
|
Graph2.prototype.publish("vertexTextHeight", 10, "number", "Vertex Text Height");
|
|
1318
1343
|
Graph2.prototype.publish("vertexTextPadding", 4, "number", "Vertex Text Padding");
|
|
1319
1344
|
Graph2.prototype.publish("vertexIconHeight", 50, "number", "Vertex Icon Height");
|
|
1320
1345
|
Graph2.prototype.publish("vertexIconPadding", 10, "number", "Vertex Icon Padding");
|
|
1321
1346
|
Graph2.prototype.publish("vertexIconStrokeWidth", 0, "number", "Vertex Icon Stroke Width");
|
|
1322
1347
|
Graph2.prototype.publish("vertexIconFontFamily", "FontAwesome", "string", "Vertex Icon Font Family");
|
|
1323
|
-
Graph2.prototype.publish("vertexLabelFontFamily", "
|
|
1348
|
+
Graph2.prototype.publish("vertexLabelFontFamily", "Verdana", "string", "Vertex Label Font Family");
|
|
1324
1349
|
Graph2.prototype.publish("highlightSelectedPathToCentroid", true, "boolean", "Highlight path to Center Vertex (for selected vertices)");
|
|
1325
1350
|
|
|
1326
1351
|
Graph2.prototype.publish("hierarchyRankDirection", "TB", "set", "Direction for Rank Nodes", ["TB", "BT", "LR", "RL"], { disable: (w: Graph2) => w.layout() !== "Hierarchy" });
|