Example #1
0
        .each(function(d) {
          const view = d3.select(this);

          //deepLeaf
          if (!d.children) {
            if (d.id === "_default") {
              d.name = _this.translator("indicator/_default/" + targetModelType);
              d.description = _this.translator("description/_default/" + targetModelType);
            }
            if (!d.description) d.description = noDescription;
            const deepLeaf = view.append("div").attr("class", css.menuHorizontal + " " + css.list_outer + " " + css.list_item_leaf);
            deepLeaf.on("click", d => {
              _this._selectIndicator({ concept: d.id, dataSource: d.dataSource, use: d.use });
            });
          }

          if (d.id == _this._targetModel[_this._targetProp]) {
            let parent;
            if (_this.selectedNode && toplevel) {
              parent = _this.selectedNode.parentNode;
              d3.select(_this.selectedNode)
                .select("." + css.list_item_leaf).classed("active", false);
              while (!(utils.hasClass(parent, css.list_top_level))) {
                if (parent.tagName == "UL") {
                  d3.select(parent.parentNode)
                    .classed("active", false);
                }
                parent = parent.parentNode;
              }
            }
            if (!_this.selectedNode || toplevel) {
              parent = this.parentNode;
              d3.select(this).classed("item-active", true)
                .select("." + css.list_item_leaf).classed("active", true);
              while (!(utils.hasClass(parent, css.list_top_level))) {
                if (parent.tagName == "UL") {
                  d3.select(parent.parentNode)
                    .classed("active", true);
                }
                if (parent.tagName == "LI") {
                  d3.select(parent).classed("item-active", true);
                }
                parent = parent.parentNode;
              }
              _this.selectedNode = this;
            }
          }
          createSubmeny(view, d);
        });
Example #2
0
  toggleFullScreen: function(id) {

    if(!window) return;

    var component = this;
    var pholder = component.placeholder;
    var pholder_found = false;
    var btn = this.element.selectAll(".vzb-buttonlist-btn[data-btn='" + id + "']");
    var fs = !this.model.ui.fullscreen;
    var body_overflow = (fs) ? "hidden" : this._prev_body_overflow;

    while(!(pholder_found = utils.hasClass(pholder, 'vzb-placeholder'))) {
      component = component.parent;
      pholder = component.placeholder;
    }

    //TODO: figure out a way to avoid fullscreen resize delay in firefox
    if(fs) {
      launchIntoFullscreen(pholder);
      subscribeFullscreenChangeEvent.call(this, this.toggleFullScreen.bind(this, id));
    } else {
      exitFullscreen.call(this);
    }
    utils.classed(pholder, class_vzb_fullscreen, fs);
    if (typeof container != 'undefined') {
      utils.classed(container, class_container_fullscreen, fs);
    }

    this.model.ui.fullscreen = fs;
    var translator = this.model.language.getTFunction();
    btn.classed(class_active_locked, fs);

    btn.select(".vzb-buttonlist-btn-icon").html(iconset[fs ? "unexpand" : "expand"]);

    btn.select(".vzb-buttonlist-btn-title>span").text(
      translator("buttons/" + (fs ? "unexpand" : "expand"))
    )
    .attr("data-vzb-translate", "buttons/" + (fs ? "unexpand" : "expand"));

    //restore body overflow
    document.body.style.overflow = body_overflow;

    this.root.layout.resizeHandler();

    //force window resize event
    // utils.defer(function() {
    //   event = window.document.createEvent("HTMLEvents");
    //   event.initEvent("resize", true, true);
    //   event.eventName = "resize";
    //   window.dispatchEvent(event);
    // });
  }
Example #3
0
      const scrollTop = itemRect.bottom - rect.top - listNode.offsetHeight + 10;
      listNode.scrollTop = scrollTop;
    };

    if (this.menuEntity.direction == MENU_VERTICAL) {
      scrollToItem(this.wrapper.node(), this.selectedNode);
      _this.menuEntity.marqueeToggleAll(true);
    } else {
      const selectedItem = this.menuEntity.findItemById(d3.select(this.selectedNode).data().id);
      selectedItem.submenu.calculateMissingWidth(0, () => {
        _this.menuEntity.marqueeToggleAll(true);
      });

      let parent = this.selectedNode;
      let listNode;
      while (!(utils.hasClass(parent, css.list_top_level))) {
        if (parent.tagName == "LI") {
          listNode = utils.hasClass(parent.parentNode, css.list_top_level) ? parent.parentNode.parentNode : parent.parentNode;
          scrollToItem(listNode, parent);
        }
        parent = parent.parentNode;
      }
    }
  },

  setPos() {
    const top = this._top;
    const left = this._left;
    const rect = this.wrapperOuter.node().getBoundingClientRect();

    if (top) {