How to use the rc-util/lib/Dom/contains function in rc-util

To help you get started, we’ve selected a few rc-util 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 react-component / trigger / src / index.tsx View on Github external
onPopupMouseLeave = e => {
      // https://github.com/react-component/trigger/pull/13
      // react bug?
      if (
        e.relatedTarget &&
        !e.relatedTarget.setTimeout &&
        this.popupRef.current &&
        this.popupRef.current.popupRef.current &&
        contains(this.popupRef.current.popupRef.current, e.relatedTarget)
      ) {
        return;
      }
      this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
    };
github react-component / trigger / src / Trigger.jsx View on Github external
onPopupMouseLeave(e) {
    // https://github.com/react-component/trigger/pull/13
    // react bug?
    if (e.relatedTarget && !e.relatedTarget.setTimeout &&
      this._component &&
      contains(this._component.getPopupDomNode(), e.relatedTarget)) {
      return;
    }
    this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
  },
github react-component / menu / src / SubMenuStateMixin.jsx View on Github external
handleDocumentClick(e) {
    // If the click originated from within this component
    // don't do anything.
    if (contains(ReactDOM.findDOMNode(this), e.target)) {
      return;
    }
    const props = this.props;
    props.onItemHover({
      hover: false,
      item: this,
      key: this.props.eventKey,
    });
    this.triggerOpenChange(false);
  },
github react-component / dialog / src / Dialog.tsx View on Github external
tryFocus() {
    if (!contains(this.wrap, document.activeElement)) {
      this.lastOutSideFocusNode = document.activeElement as HTMLElement;
      this.sentinelStart.focus();
    }
  }
github react-component / trigger / src / Trigger.jsx View on Github external
onDocumentClick(event) {
    if (this.props.mask && !this.props.maskClosable) {
      return;
    }
    const target = event.target;
    const root = findDOMNode(this);
    const popupNode = this.getPopupDomNode();
    if (!contains(root, target) && !contains(popupNode, target)) {
      this.close();
    }
  },
github react-component / trigger / src / index.tsx View on Github external
onDocumentClick = event => {
      if (this.props.mask && !this.props.maskClosable) {
        return;
      }

      const { target } = event;
      const root = this.getRootDomNode();
      if (!contains(root, target) && !this.hasPopupMouseDown) {
        this.close();
      }
    };
github salt-ui / saltui / src / Utils / Utils.js View on Github external
const pd = (e) => {
    if (!element || !contains(element, e.target)) {
      e.preventDefault();
    }
  };
  document.body.addEventListener('touchmove', pd, false);