How to use the heyui/src/utils/utils.addClass function in heyui

To help you get started, we’ve selected a few heyui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heyui / heyui / src / plugins / notify / index.js View on Github external
window.setTimeout(() => {
      utils.addClass($body, notifyShowCls);
      if (param.hasMask) {
        let body = document.documentElement;
        let scrollWidth = window.innerWidth - body.clientWidth;
        body.style.overflow = 'hidden';
        body.style.paddingRight = `${scrollWidth}px`;
      }
    }, 20);
github heyui / heyui / src / components / table / table.vue View on Github external
tbody.addEventListener('mouseover', (event) => {
          let tr = null;
          let target = event.target;
          while (target.parentNode != window.document.body) {
            if (target.tagName == 'TH') {
              return;
            } else if (target.tagName == 'TR') {
              tr = target;
              break;
            }
            target = target.parentNode;
          }
          if (tr) {
            utils.addClass(tr, 'h-table-tr-hovered');
            let index = tr.getAttribute('trIndex');
            for (let el of this.$el.querySelectorAll(`.h-table-tbody>tr[trIndex='${index}']`) || []) {
              utils.addClass(el, 'h-table-tr-hovered');
            }
          }
        }, false);
        tbody.addEventListener('mouseout', (event) => {
github heyui / heyui / src / plugins / pop / index.js View on Github external
if (!this.popNode) {
      this.initPopNode();
    }
    if (!this.popperInstance) {
      this.initPopper();
    }
    this.popperInstance.enableEventListeners();
    if (!this.popNode) {
      return;
    }
    if (this.options.equalWidth) {
      this.popNode.style.width = `${this.reference.clientWidth}px`;
    }

    this.popNode.style.display = '';
    utils.addClass(this.reference, 'h-pop-trigger');
    this.showTimeout = setTimeout(() => {
      this.popNode.setAttribute('aria-hidden', 'false');
      this.popperInstance.update();
    }, 0);
    return this;
  }
github heyui / heyui / src / components / slider / slider.vue View on Github external
mousedown(type, event) {
      if (this.readonly) return;
      utils.addClass(event.target, 'h-slider-node-dragging');
      this.eventControl.type = type;
      this.eventControl.x = event.clientX;
      this.eventControl.init = this.values[type];
      document.body.addEventListener('mousemove', this.mousemove);
      document.body.addEventListener('mouseup', this.mouseup);
      document.body.addEventListener('click', this.click);
      if (this.tooltip[type]) this.tooltip[type].show();
    },
    mouseup(event) {
github heyui / heyui / src / plugins / loading-bar / index.js View on Github external
this.loading(100, 100, () => {
      if (!success) {
        utils.addClass(this.inner, 'error');
      }
      setTimeout(() => {
        utils.removeClass(this.inner, 'loading');
        utils.removeClass(this.inner, 'error');
        this.inner.style.width = '0';
        this.width = 0;
      }, 200);
    });
  }
github heyui / heyui / src / plugins / pop / index.js View on Github external
if (!content) {
      return this;
    }

    const popNode = this.create(reference, options.template, content, options.html);

    popNode.setAttribute('aria-describedby', popNode.id);
    this.reference.setAttribute('aria-describe', popNode.id);
    const container = this.findContainer();

    container.appendChild(popNode);
    if (options.class) {
      utils.addClass(popNode, options.class);
    }
    if (options.className) {
      utils.addClass(popNode, options.className);
    }

    const contentNode = popNode.querySelector(this.innerSelector);
    log(contentNode, options.maxWidth);
    if (contentNode && options.maxWidth) {
      contentNode.style.maxWidth = `${options.maxWidth}px`;
    }

    this.popNode = popNode;
    this.popNode.setAttribute('aria-hidden', 'true');

    if (this.options.trigger.indexOf('hover') > -1) {
      this.setPopNodeEvent();
    }
  }
github heyui / heyui / src / plugins / notice / index.js View on Github external
function Notice(originalParam) {
  if (!noticeDom) {
    noticeDom = document.createElement('div');
    utils.addClass(noticeDom, `${prefixCls}-container`);
    document.body.appendChild(noticeDom);
  }

  let param = {
    type: prefixCls,
    hasCloseIcon: true,
    parent: noticeDom
  };
  if (Object.keys(iconNames).indexOf(originalParam.type) != -1) {
    if (originalParam.title) originalParam.style = `${prefixCls}-has-icon`;
    originalParam.content = `<i class="${iconPrefixCls}-${iconNames[originalParam.type]} ${iconColor[originalParam.type]}-color"></i>${originalParam.content}`;
    delete originalParam.type;
  } else if (originalParam.icon) {
    if (originalParam.title) originalParam.style = `${prefixCls}-has-icon`;
    originalParam.content = `<i class="${originalParam.icon}"></i>${originalParam.content}`;
  }
github heyui / heyui / src / plugins / pop / index.js View on Github external
let options = this.options;
    const content = options.content || reference.getAttribute('content');

    if (!content) {
      return this;
    }

    const popNode = this.create(reference, options.template, content, options.html);

    popNode.setAttribute('aria-describedby', popNode.id);
    this.reference.setAttribute('aria-describe', popNode.id);
    const container = this.findContainer();

    container.appendChild(popNode);
    if (options.class) {
      utils.addClass(popNode, options.class);
    }
    if (options.className) {
      utils.addClass(popNode, options.className);
    }

    const contentNode = popNode.querySelector(this.innerSelector);
    log(contentNode, options.maxWidth);
    if (contentNode && options.maxWidth) {
      contentNode.style.maxWidth = `${options.maxWidth}px`;
    }

    this.popNode = popNode;
    this.popNode.setAttribute('aria-hidden', 'true');

    if (this.options.trigger.indexOf('hover') > -1) {
      this.setPopNodeEvent();
github heyui / heyui / src / directives / style.js View on Github external
update(el, binding) {
      let color = binding.value || binding.arg || binding.expression;
      if (color.startsWith('#')) {
        el.style.color = color;
      } else {
        utils.addClass(el, `${color}-color`);
      }
    },
    unbind(el) {