northdata-viz 1.301.10 → 1.302.10

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": "northdata-viz",
3
- "version": "1.301.10",
3
+ "version": "1.302.10",
4
4
  "description": "North Data Widget API",
5
5
  "main": "viz.min.js",
6
6
  "module": "viz.esm.js",
package/viz.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! northdata-viz V1.301.10 */
1
+ /*! northdata-viz V1.302.10 */
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
4
  /***/ 100:
@@ -463,8 +463,8 @@ module.exports = debounce;
463
463
  /************************************************************************/
464
464
 
465
465
  ;// ./src/ts/env.ts
466
- var VERSION = "1.301.10";
467
- var VERSION_PREFIX = (/* unused pure expression or super */ null && ("/ui/v1-301-10"));
466
+ var VERSION = "1.302.10";
467
+ var VERSION_PREFIX = (/* unused pure expression or super */ null && ("/ui/v1-302-10"));
468
468
 
469
469
  ;// ./src/ts/util/params.ts
470
470
  function clone(object) {
@@ -6550,6 +6550,11 @@ function enrichNodes(widget, svg,
6550
6550
  //rootId: number | undefined,
6551
6551
  denseLeaves) {
6552
6552
  var maxWidth = widget.container.getBoundingClientRect().width;
6553
+ var d3NodesContainer = svg.select("g.nodes");
6554
+ var highlightContainer = svg
6555
+ .append("g")
6556
+ .attr("class", "highlight-container")
6557
+ .attr("style", "pointer-events: none;");
6553
6558
  function selectNode(id) {
6554
6559
  return svg.select(".node[data-id='" + id + "']");
6555
6560
  }
@@ -6561,21 +6566,21 @@ denseLeaves) {
6561
6566
  var nodeId = node.getAttribute("data-id");
6562
6567
  var highlightMode = node.getAttribute("data-root") == "true" ? "root" : "node";
6563
6568
  // highlight node
6564
- node.setAttribute("data-highlight", highlightMode);
6569
+ src_select(node).attr("data-highlight", highlightMode).classed("hovered", true);
6565
6570
  var textNode = node.querySelector(".text");
6566
6571
  if (textNode) {
6567
6572
  textNode.textContent = node.getAttribute("data-description");
6568
6573
  }
6569
6574
  syncTextBackground(src_select(node), ".text", ".text-bg", denseLeaves ? 2 : 5, 2, maxWidth);
6570
6575
  // highlight links
6571
- var linkEls = svg
6576
+ var linkEls = d3NodesContainer
6572
6577
  .selectAll(".link[data-source-id='" + nodeId + "'],.link[data-target-id='" + nodeId + "']")
6573
6578
  .attr("data-highlight", highlightMode);
6574
6579
  syncTextBackground(linkEls, ".desc", ".desc-bg", 3, 2, maxWidth);
6575
6580
  // bring highlighted stuff to front
6576
6581
  window.clearTimeout(restoreDefaultOrder);
6577
6582
  var toBeMoved = [];
6578
- linkEls.each(function (link) {
6583
+ linkEls.each(function () {
6579
6584
  var linkEl = this;
6580
6585
  toBeMoved.push(linkEl);
6581
6586
  function moveOtherEndToFront(id) {
@@ -6589,6 +6594,26 @@ denseLeaves) {
6589
6594
  toBeMoved.push(node);
6590
6595
  moveToFront(toBeMoved);
6591
6596
  }
6597
+ function highlightLink(link) {
6598
+ var _a;
6599
+ // Move clone of link element to highlight container that is always in front of all nodes & links
6600
+ var linkClone = src_select(link).clone(true);
6601
+ linkClone
6602
+ .attr("data-highlight", "link")
6603
+ .selectAll(":not(.desc, .desc-bg)")
6604
+ .remove();
6605
+ var linkCloneNode = linkClone.node();
6606
+ if (linkCloneNode) {
6607
+ highlightContainer.html(null);
6608
+ (_a = highlightContainer.node()) === null || _a === void 0 ? void 0 : _a.append(linkCloneNode);
6609
+ }
6610
+ }
6611
+ function unhighlightAll() {
6612
+ svg
6613
+ .selectAll("[data-highlight]")
6614
+ .attr("data-highlight", "false")
6615
+ .classed("hovered", false);
6616
+ }
6592
6617
  function arrangeInDefaultOrder() {
6593
6618
  var toBeMoved = [];
6594
6619
  svg.select(".node").each(function () {
@@ -6598,7 +6623,7 @@ denseLeaves) {
6598
6623
  moveToFront(toBeMoved);
6599
6624
  }
6600
6625
  function unhighlight(node) {
6601
- svg.selectAll("[data-highlight]").attr("data-highlight", "false");
6626
+ unhighlightAll();
6602
6627
  var nodeId = node.getAttribute("data-id");
6603
6628
  svg
6604
6629
  .select(".node[data-id='" + nodeId + "']")
@@ -6607,8 +6632,7 @@ denseLeaves) {
6607
6632
  .attr("x", 0);
6608
6633
  restoreDefaultOrder = window.setTimeout(arrangeInDefaultOrder, 1000);
6609
6634
  }
6610
- var d3NodesContainer = svg.select("g.nodes");
6611
- var d3NewNodes = d3NodesContainer.selectAll(".node").each(function () {
6635
+ d3NodesContainer.selectAll(".node").each(function () {
6612
6636
  var el = this;
6613
6637
  var root = el.getAttribute("data-root") == "true";
6614
6638
  var linkify = widget.getLinkifier();
@@ -6634,6 +6658,14 @@ denseLeaves) {
6634
6658
  .on("mouseout", function () {
6635
6659
  unhighlight(this);
6636
6660
  });
6661
+ d3NodesContainer
6662
+ .selectAll(".link")
6663
+ .on("mouseover", function () {
6664
+ highlightLink(this);
6665
+ })
6666
+ .on("mouseout", function () {
6667
+ unhighlightAll();
6668
+ });
6637
6669
  arrangeInDefaultOrder();
6638
6670
  // REMOVE ME
6639
6671
  NorthData.debug("successfully completed v12");