@hpcc-js/graph 2.80.3 → 2.82.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/graph",
3
- "version": "2.80.3",
3
+ "version": "2.82.1",
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.11.1",
56
- "@hpcc-js/common": "^2.70.0",
57
- "@hpcc-js/html": "^2.41.7",
58
- "@hpcc-js/react": "^2.49.7",
59
- "@hpcc-js/util": "^2.48.0"
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.51.1",
59
+ "@hpcc-js/util": "^2.49.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@hpcc-js/bundle": "^2.11.1",
63
- "@hpcc-js/wasm": "1.14.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.3.1"
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": "c89642c69c9fd13e236a79a6868022a89a44513d"
91
+ "gitHead": "e2724f0154c334e8d4cb5a29533b70131ab58938"
92
92
  }
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/graph";
2
- export const PKG_VERSION = "2.80.3";
3
- export const BUILD_VERSION = "2.103.5";
2
+ export const PKG_VERSION = "2.82.1";
3
+ export const BUILD_VERSION = "2.104.2";
@@ -1,5 +1,5 @@
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 } 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";
@@ -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.vertex_click(d.props.origData || d.props, "", selected);
189
+ const annoData = context.resolveAnnoEventNode();
190
+ context.vertex_click(d.props.origData || d.props, "", selected, annoData);
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, annoData);
193
194
  }
194
195
  context._prevDoClickTime = doClickTime;
195
196
  }
@@ -199,6 +200,21 @@ export class Graph2 extends SVGZoomWidget {
199
200
  this.zoomToFitLimit(1);
200
201
  }
201
202
 
203
+ resolveAnnoEventNode(): undefined | IVertex4Annotation {
204
+ const d3evt = d3Event();
205
+ const eventPath = d3evt?.sourceEvent?.path ?? d3evt?.path;
206
+ const anno = eventPath.find(n => n?.hasAttribute("data-anno"));
207
+ let annoData;
208
+ if (anno) {
209
+ try{
210
+ annoData = JSON.parse(anno.getAttribute("data-anno"));
211
+ } catch(e) {
212
+ console.warn("Unexpected annotation data:", anno);
213
+ }
214
+ }
215
+ return annoData;
216
+ }
217
+
202
218
  iconBarButtons(): Widget[] {
203
219
  return this._iconBar.buttons();
204
220
  }
@@ -749,7 +765,8 @@ export class Graph2 extends SVGZoomWidget {
749
765
  Utility.safeRaise(this);
750
766
  context.highlightVertex(d3Select(this), d);
751
767
  const selected = d.element.classed("selected");
752
- context.vertex_mousein(d.props.origData || d.props, "", selected);
768
+ const annoData = context.resolveAnnoEventNode();
769
+ context.vertex_mousein(d.props.origData || d.props, "", selected, annoData);
753
770
  })
754
771
  .on("mouseover", function (d) {
755
772
  Utility.safeRaise(this);
@@ -769,12 +786,14 @@ export class Graph2 extends SVGZoomWidget {
769
786
  .render()
770
787
  ;
771
788
  }
772
- context.vertex_mouseover(d.props.origData || d.props, "", selected);
789
+ const annoData = context.resolveAnnoEventNode();
790
+ context.vertex_mouseover(d.props.origData || d.props, "", selected, annoData);
773
791
  })
774
792
  .on("mouseout", function (d) {
775
793
  context.highlightVertex(null, null);
776
794
  const selected = d.element.classed("selected");
777
- context.vertex_mouseout(d.props.origData || d.props, "", selected);
795
+ const annoData = context.resolveAnnoEventNode();
796
+ context.vertex_mouseout(d.props.origData || d.props, "", selected, annoData);
778
797
  if (d.props.tooltip) {
779
798
  context._tooltip.mouseout();
780
799
  }
@@ -1125,19 +1144,19 @@ export class Graph2 extends SVGZoomWidget {
1125
1144
  subgraph_click(row, _col, sel) {
1126
1145
  }
1127
1146
 
1128
- vertex_click(row, _col, sel) {
1147
+ vertex_click(row, _col, sel, data) {
1129
1148
  }
1130
1149
 
1131
- vertex_dblclick(row, _col, sel) {
1150
+ vertex_dblclick(row, _col, sel, data) {
1132
1151
  }
1133
1152
 
1134
- vertex_mousein(row, _col, sel) {
1153
+ vertex_mousein(row, _col, sel, data) {
1135
1154
  }
1136
1155
 
1137
- vertex_mouseover(row, _col, sel) {
1156
+ vertex_mouseover(row, _col, sel, data) {
1138
1157
  }
1139
1158
 
1140
- vertex_mouseout(row, _col, sel) {
1159
+ vertex_mouseout(row, _col, sel, data) {
1141
1160
  }
1142
1161
 
1143
1162
  edge_click(row, _col, sel) {