Exemplo n.º 1
0
    function _onClick(ev) {
      ev.preventDefault();

      const mel = ev.target;
      const submenu = mel.querySelector('gui-menu');

      if ( mel.getAttribute('data-disabled') === 'true' ) {
        return;
      }

      mel.querySelectorAll('gui-menu-entry').forEach((c) => {
        DOM.$removeClass(c, 'gui-hover');
      });

      if ( submenu ) {
        Menu.setActive((ev) => {
          if ( ev instanceof window.Event  ) {
            ev.stopPropagation();
          }
          DOM.$removeClass(mel, 'gui-active');
        });
      }

      if ( DOM.$hasClass(mel, 'gui-active') ) {
        if ( submenu ) {
          DOM.$removeClass(mel, 'gui-active');
        }
      } else {
        if ( submenu ) {
          DOM.$addClass(mel, 'gui-active');
        }

        mel.dispatchEvent(new CustomEvent('_select', {detail: getSelectionEventAttribs(mel)}));
      }
    }
Exemplo n.º 2
0
      node.querySelectorAll(key).forEach((pel) => {
        if ( pel._wasParsed || DOM.$hasClass(pel, 'gui-data-view') ) {
          return;
        }

        try {
          createElementInstance(key, pel, null, []);
        } catch ( e ) {
          console.warn('parseNode()', id, type, win, 'exception');
          console.warn(e, e.stack);
        }
        pel._wasParsed = true;
      });