@hpcc-js/graph 2.82.1 → 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/index.es6.js CHANGED
@@ -5,8 +5,8 @@ import { render, Subgraph as Subgraph$1, Icons, Vertex as Vertex$1, Vertex3, Cen
5
5
  import { HTMLTooltip } from '@hpcc-js/html';
6
6
 
7
7
  var PKG_NAME = "@hpcc-js/graph";
8
- var PKG_VERSION = "2.82.1";
9
- var BUILD_VERSION = "2.104.2";
8
+ var PKG_VERSION = "2.83.0";
9
+ var BUILD_VERSION = "2.104.3";
10
10
 
11
11
  /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
@@ -16928,11 +16928,11 @@ var Graph2 = /** @class */ (function (_super) {
16928
16928
  }, d3Event().sourceEvent);
16929
16929
  context.selectionChanged();
16930
16930
  var selected = d.element.classed("selected");
16931
- var annoData = context.resolveAnnoEventNode();
16932
- context.vertex_click(d.props.origData || d.props, "", selected, annoData);
16931
+ var eventOrigin = context.resolveEventOrigin();
16932
+ context.vertex_click(d.props.origData || d.props, "", selected, eventOrigin);
16933
16933
  var doClickTime = Date.now();
16934
16934
  if (doClickTime - context._prevDoClickTime < context.doubleClickMaxDelay()) {
16935
- context.vertex_dblclick(d.props.origData || d.props, "", selected, annoData);
16935
+ context.vertex_dblclick(d.props.origData || d.props, "", selected, eventOrigin);
16936
16936
  }
16937
16937
  context._prevDoClickTime = doClickTime;
16938
16938
  }
@@ -16941,21 +16941,26 @@ var Graph2 = /** @class */ (function (_super) {
16941
16941
  _this.zoomToFitLimit(1);
16942
16942
  return _this;
16943
16943
  }
16944
- Graph2.prototype.resolveAnnoEventNode = function () {
16944
+ Graph2.prototype.resolveEventOrigin = function () {
16945
16945
  var _a, _b;
16946
16946
  var d3evt = d3Event();
16947
16947
  var eventPath = (_b = (_a = d3evt === null || d3evt === void 0 ? void 0 : d3evt.sourceEvent) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : d3evt === null || d3evt === void 0 ? void 0 : d3evt.path;
16948
- var anno = eventPath.find(function (n) { return n === null || n === void 0 ? void 0 : n.hasAttribute("data-anno"); });
16949
- var annoData;
16950
- if (anno) {
16948
+ var element = eventPath.find(function (n) { return (n === null || n === void 0 ? void 0 : n.hasAttribute) && (n === null || n === void 0 ? void 0 : n.hasAttribute("data-click")); });
16949
+ var origin = element ? element.getAttribute("data-click") : "";
16950
+ var dataStr = element ? element.getAttribute("data-click-data") : "";
16951
+ var data = undefined;
16952
+ if (dataStr) {
16951
16953
  try {
16952
- annoData = JSON.parse(anno.getAttribute("data-anno"));
16954
+ data = JSON.parse(dataStr);
16953
16955
  }
16954
16956
  catch (e) {
16955
- console.warn("Unexpected annotation data:", anno);
16957
+ console.warn("Unexpected annotation data:", dataStr);
16956
16958
  }
16957
16959
  }
16958
- return annoData;
16960
+ return {
16961
+ origin: origin,
16962
+ data: data
16963
+ };
16959
16964
  };
16960
16965
  Graph2.prototype.iconBarButtons = function () {
16961
16966
  return this._iconBar.buttons();
@@ -17415,8 +17420,8 @@ var Graph2 = /** @class */ (function (_super) {
17415
17420
  Utility.safeRaise(this);
17416
17421
  context.highlightVertex(select(this), d);
17417
17422
  var selected = d.element.classed("selected");
17418
- var annoData = context.resolveAnnoEventNode();
17419
- context.vertex_mousein(d.props.origData || d.props, "", selected, annoData);
17423
+ var eventOrigin = context.resolveEventOrigin();
17424
+ context.vertex_mousein(d.props.origData || d.props, "", selected, eventOrigin);
17420
17425
  })
17421
17426
  .on("mouseover", function (d) {
17422
17427
  Utility.safeRaise(this);
@@ -17435,14 +17440,14 @@ var Graph2 = /** @class */ (function (_super) {
17435
17440
  .visible(true)
17436
17441
  .render();
17437
17442
  }
17438
- var annoData = context.resolveAnnoEventNode();
17439
- context.vertex_mouseover(d.props.origData || d.props, "", selected, annoData);
17443
+ var eventOrigin = context.resolveEventOrigin();
17444
+ context.vertex_mouseover(d.props.origData || d.props, "", selected, eventOrigin);
17440
17445
  })
17441
17446
  .on("mouseout", function (d) {
17442
17447
  context.highlightVertex(null, null);
17443
17448
  var selected = d.element.classed("selected");
17444
- var annoData = context.resolveAnnoEventNode();
17445
- context.vertex_mouseout(d.props.origData || d.props, "", selected, annoData);
17449
+ var eventOrigin = context.resolveEventOrigin();
17450
+ context.vertex_mouseout(d.props.origData || d.props, "", selected, eventOrigin);
17446
17451
  if (d.props.tooltip) {
17447
17452
  context._tooltip.mouseout();
17448
17453
  }
@@ -17801,14 +17806,14 @@ Graph2.prototype.publish("centroidIconHeight", 50, "number", "Centroid Icon Heig
17801
17806
  Graph2.prototype.publish("centroidIconPadding", 10, "number", "Centroid Icon Padding");
17802
17807
  Graph2.prototype.publish("centroidIconStrokeWidth", 4, "number", "Centroid Icon Stroke Width");
17803
17808
  Graph2.prototype.publish("centroidIconFontFamily", "FontAwesome", "string", "Centroid Icon Font Family");
17804
- Graph2.prototype.publish("centroidLabelFontFamily", "FontAwesome", "string", "Centroid Label Font Family");
17809
+ Graph2.prototype.publish("centroidLabelFontFamily", "Verdana", "string", "Centroid Label Font Family");
17805
17810
  Graph2.prototype.publish("vertexTextHeight", 10, "number", "Vertex Text Height");
17806
17811
  Graph2.prototype.publish("vertexTextPadding", 4, "number", "Vertex Text Padding");
17807
17812
  Graph2.prototype.publish("vertexIconHeight", 50, "number", "Vertex Icon Height");
17808
17813
  Graph2.prototype.publish("vertexIconPadding", 10, "number", "Vertex Icon Padding");
17809
17814
  Graph2.prototype.publish("vertexIconStrokeWidth", 0, "number", "Vertex Icon Stroke Width");
17810
17815
  Graph2.prototype.publish("vertexIconFontFamily", "FontAwesome", "string", "Vertex Icon Font Family");
17811
- Graph2.prototype.publish("vertexLabelFontFamily", "FontAwesome", "string", "Vertex Label Font Family");
17816
+ Graph2.prototype.publish("vertexLabelFontFamily", "Verdana", "string", "Vertex Label Font Family");
17812
17817
  Graph2.prototype.publish("highlightSelectedPathToCentroid", true, "boolean", "Highlight path to Center Vertex (for selected vertices)");
17813
17818
  Graph2.prototype.publish("hierarchyRankDirection", "TB", "set", "Direction for Rank Nodes", ["TB", "BT", "LR", "RL"], { disable: function (w) { return w.layout() !== "Hierarchy"; } });
17814
17819
  Graph2.prototype.publish("hierarchyNodeSeparation", 50, "number", "Number of pixels that separate nodes horizontally in the layout", null, { disable: function (w) { return w.layout() !== "Hierarchy"; } });
@@ -17961,7 +17966,9 @@ var DataGraph = /** @class */ (function (_super) {
17961
17966
  var faCharIdx = this.indexOf(columns, this.vertexFACharColumn(), "faChar");
17962
17967
  var vertexTooltipIdx = this.indexOf(columns, this.vertexTooltipColumn(), "tooltip");
17963
17968
  var annotationIdxs = annotationColumns.map(function (ac) { return _this.indexOf(columns, ac.columnID(), ""); });
17969
+ var expansionFACharIdx = this.indexOf(columns, this.vertexExpansionFACharColumn(), "expansionFAChar");
17964
17970
  var vertices = this.vertices().map(function (v) {
17971
+ var annotationIDs = annotationIdxs.map(function (ai, i) { return !!v[ai] ? annotationColumns[i].annotationID() : undefined; }).filter(function (a) { return !!a; });
17965
17972
  return {
17966
17973
  categoryID: "" + v[catIdx],
17967
17974
  id: "" + v[idIdx],
@@ -17972,7 +17979,11 @@ var DataGraph = /** @class */ (function (_super) {
17972
17979
  icon: {
17973
17980
  imageChar: "" + (v[faCharIdx] || _this.vertexFAChar())
17974
17981
  },
17975
- annotationIDs: annotationIdxs.map(function (ai, i) { return !!v[ai] ? annotationColumns[i].annotationID() : undefined; }).filter(function (a) { return !!a; })
17982
+ annotationIDs: annotationIDs,
17983
+ annotations: _this.annotations().filter(function (ann) { return annotationIDs.indexOf(ann.id) >= 0; }),
17984
+ expansionIcon: v[expansionFACharIdx] ? {
17985
+ imageChar: "" + v[expansionFACharIdx]
17986
+ } : undefined
17976
17987
  };
17977
17988
  });
17978
17989
  var diff = compare2(this._prevVertices, vertices, function (d) { return d.id; });
@@ -18125,6 +18136,10 @@ var DataGraph = /** @class */ (function (_super) {
18125
18136
  publish([], "propertyArray", "Annotations", null, { autoExpand: AnnotationColumn }),
18126
18137
  __metadata("design:type", Function)
18127
18138
  ], DataGraph.prototype, "vertexAnnotationColumns", void 0);
18139
+ __decorate([
18140
+ publish("", "set", "Vertex expansion FAChar column", function () { return this.vertexColumns(); }, { optional: true }),
18141
+ __metadata("design:type", Function)
18142
+ ], DataGraph.prototype, "vertexExpansionFACharColumn", void 0);
18128
18143
  __decorate([
18129
18144
  publish([], "any", "Edge columns", null, { internal: true }),
18130
18145
  __metadata("design:type", Function)