How to use the dom-lib.hasClass function in dom-lib

To help you get started, we’ve selected a few dom-lib 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 rsuite / rsuite / src / CheckTreePicker / CheckTreeNode.js View on Github external
classPrefix,
      onSelect,
      layer,
      disabled,
      uncheckable,
      nodeData,
      checkState
    } = this.props;

    if (disabled || uncheckable) {
      return;
    }

    // 如果点击的是展开 icon 就 return
    if (event.target instanceof HTMLElement) {
      if (hasClass(event.target.parentNode, `${classPrefix}-node-expand-icon-wrapper`)) {
        return;
      }
    }

    let isChecked = false;
    if (checkState === CHECK_STATE.UNCHECK || checkState === CHECK_STATE.INDETERMINATE) {
      isChecked = true;
    }

    if (checkState === CHECK_STATE.CHECK) {
      isChecked = false;
    }
    nodeData.check = isChecked;
    onSelect && onSelect(nodeData, layer, event);
  };
github rsuite / rsuite / src / TreePicker / TreeNode.tsx View on Github external
handleSelect = (event: React.SyntheticEvent) => {
    const { onSelect, layer, disabled, nodeData } = this.props;

    if (disabled) {
      return;
    }

    if (event.target instanceof HTMLElement) {
      if (hasClass(event.target.parentNode, this.addPrefix('expand-icon-wrapper'))) {
        return;
      }
    }

    onSelect?.(nodeData, layer, event);
  };
github rsuite / rsuite / src / mixins / ClassNameMixin.js View on Github external
hasClass: function (className, target = findDOMNode(this)) {
        return hasClass(target, className);
    },
    addClass: function (className, target = findDOMNode(this)) {