Build 533169stable
Module 289726
4,544 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.r(t),n.d(t,{IGNORE_CLASS_NAME:()=>g,default:()=>I});var r,i=n(64700),s=n(340287);function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){if(null==e)return{};var n,r,i={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function u(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}function d(e,t,n){if(e===t)return!0;for(;e.parentNode||e.host;){if(e.parentNode&&c(e,t,n))return!0;e=e.parentNode||e.host}return e}function _(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY}var f=function(){if("u">typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}},p=function(e){return void 0===e&&(e=0),function(){return++e}}(),h={},m={},E=["touchstart","touchmove"],g="ignore-react-onclickoutside";function A(e,t){var n={};return -1!==E.indexOf(t)&&r&&(n.passive=!e.props.preventDefault),n}let I=function(e,t){var n,o,c=e.displayName||e.name||"Component";return o=n=function(n){function o(e){var i;return(i=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"==typeof i.__clickOutsideHandlerProp)return void i.__clickOutsideHandlerProp(e);var t=i.getInstance();if("function"==typeof t.props.handleClickOutside)return void t.props.handleClickOutside(e);if("function"==typeof t.handleClickOutside)return void t.handleClickOutside(e);throw Error("WrappedComponent: "+c+" lacks a handleClickOutside(event) function for processing outside click events.")},i.__getComponentNode=function(){var e=i.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():(0,s.findDOMNode)(e)},i.enableOnClickOutside=function(){if("u">typeof document&&!m[i._uid]){void 0===r&&(r=f()),m[i._uid]=!0;var e=i.props.eventTypes;e.forEach||(e=[e]),h[i._uid]=function(e){null===i.componentNode||i.initTimeStamp>e.timeStamp||(i.props.preventDefault&&e.preventDefault(),i.props.stopPropagation&&e.stopPropagation(),i.props.excludeScrollbar&&_(e)||d(e.composed&&e.composedPath&&e.composedPath().shift()||e.target,i.componentNode,i.props.outsideClickIgnoreClass)===document&&i.__outsideClickHandler(e))},e.forEach(function(e){document.addEventListener(e,h[i._uid],A(u(i),e))})}},i.disableOnClickOutside=function(){delete m[i._uid];var e=h[i._uid];if(e&&"u">typeof document){var t=i.props.eventTypes;t.forEach||(t=[t]),t.forEach(function(t){return document.removeEventListener(t,e,A(u(i),t))}),delete h[i._uid]}},i.getRef=function(e){return i.instanceRef=e},i._uid=p(),i.initTimeStamp=performance.now(),i}a(o,n);var E=o.prototype;return E.getInstance=function(){if(e.prototype&&!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},E.componentDidMount=function(){if(!("u"<typeof document)&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw Error("WrappedComponent: "+c+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},E.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},E.componentWillUnmount=function(){this.disableOnClickOutside()},E.render=function(){var t=this.props;t.excludeScrollbar;var n=l(t,["excludeScrollbar"]);return e.prototype&&e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,(0,i.createElement)(e,n)},o}(i.Component),n.displayName="OnClickOutside("+c+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:g,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},o}}