forked from cerc-io/cosmos-explorer
3 lines
7.8 KiB
JavaScript
3 lines
7.8 KiB
JavaScript
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"+EG+":function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n("mrSG"),o=n("q1tI"),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(r.__extends)(t,e),t.prototype.shouldComponentUpdate=function(){return!1},t.prototype.render=function(){return o.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})},t}(o.Component),u=o.createContext(null)},"6uNr":function(e,t,n){e.exports={menuWrap:"menuWrap-1gEtmoET",isMeasuring:"isMeasuring-FZ0EJCM2",scrollWrap:"scrollWrap-1B5MfTJt",momentumBased:"momentumBased-1Jq4gQt2",menuBox:"menuBox-20sJGjtG",isHidden:"isHidden-2vLQpR1t"}},"8Rai":function(e,t,n){"use strict";var r=n("q1tI"),o=function(e,t){var n=void 0===t?{}:t,r=n.bubbles,o=void 0!==r&&r,i=n.cancelable,u=void 0!==i&&i,s=n.detail,a=void 0===s?null:s;try{return new window.CustomEvent(e,{bubbles:o,cancelable:u,detail:a})}catch(c){var l=document.createEvent("CustomEvent");return l.initCustomEvent(e,o,u,a),l}},i=n("R5JZ");function u(e){var t=e.click,n=e.mouseDown,u=e.touchEnd,s=e.touchStart,a=e.handler,l=e.reference,c=e.ownerDocument,p=void 0===c?document:c,d=Object(r.useRef)(null),h=Object(r.useRef)(new o("timestamp").timeStamp);return Object(r.useLayoutEffect)((function(){var e={click:t,mouseDown:n,touchEnd:u,touchStart:s},r=l?l.current:d.current;return Object(i.a)(h.current,r,a,p,e)}),[t,n,u,s,a]),l||d}n.d(t,"a",(function(){return u}))},AiMB:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return c}));var r=n("mrSG"),o=n("q1tI"),i=n("i8i4"),u=n("e3/o"),s=n("jAh7"),a=n("+EG+"),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._uuid=Object(u.guid)(),t}return Object(r.__extends)(t,e),t.prototype.componentWillUnmount=function(){this._manager().removeWindow(this._uuid)},t.prototype.render=function(){var e=this._manager().ensureWindow(this._uuid,this.props.layerOptions);return e.style.top=this.props.top||"",e.style.bottom=this.props.bottom||"",e.style.left=this.props.left||"",e.style.right=this.props.right||"",e.style.pointerEvents=this.props.pointerEvents||"",i.createPortal(o.createElement(c.Provider,{value:this},this.props.children),e)},t.prototype.moveToTop=function(){this._manager().moveToTop(this._uuid)},t.prototype._manager=function(){return null===this.context?Object(s.getRootOverlapManager)():this.context},t.contextType=a.b,t}(o.PureComponent),c=o.createContext(null)},DTHj:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n("mrSG"),o=n("q1tI"),i=n.n(o),u=n("TSYQ"),s=n.n(u),a=n("Eyy1"),l=n("Hr11"),c=n("XAms"),p=n("+EG+"),d=n("tWVy"),h=n("jAh7"),f=n("lxNp"),m=n("dxYz"),v=n("PN6A"),_=n("6uNr"),b=function(e){function t(t){var n=e.call(this,t)||this;return n._containerRef=null,n._scrollWrapRef=null,n._raf=null,n._manager=new h.OverlapManager,n._hotkeys=null,n._scroll=0,n._handleContainerRef=function(e){n._containerRef=e,
|
||
|
"function"==typeof n.props.reference&&n.props.reference(e),"object"==typeof n.props.reference&&(n.props.reference.current=e)},n._handleScrollWrapRef=function(e){return n._scrollWrapRef=e},n._handleMeasure=function(e){if(!n.state.isMeasureValid){var t=n.props.position,r=Object(a.ensureNotNull)(n._containerRef),o=r.getBoundingClientRect(),i=document.documentElement.clientHeight,u=document.documentElement.clientWidth,s=i-0,c=o.height>s;if(c)Object(a.ensureNotNull)(n._scrollWrapRef).style.overflowY="scroll",o=r.getBoundingClientRect();var p=o.width,d=o.height,h="function"==typeof t?t(p,d):t,f=u-(h.overrideWidth||p)-0,m=Object(l.clamp)(h.x,0,Math.max(0,f)),v=i-(h.overrideHeight||d)-0,_=Object(l.clamp)(h.y,0,Math.max(0,v));h.forbidCorrectYCoord&&_<h.y&&(s-=h.y-_,_=h.y),n.setState({appearingMenuHeight:h.overrideHeight||(c?s:void 0),appearingMenuWidth:h.overrideWidth,appearingPosition:{x:m,y:_},isMeasureValid:!0},(function(){n._restoreScrollPosition(),e&&e()}))}},n._restoreScrollPosition=function(){var e=document.activeElement,t=Object(a.ensureNotNull)(n._containerRef);if(null!==e&&t.contains(e))try{e.scrollIntoView()}catch(r){}else Object(a.ensureNotNull)(n._scrollWrapRef).scrollTop=n._scroll},n._resize=function(){null===n._raf&&(n._raf=requestAnimationFrame((function(){n.setState({appearingMenuHeight:void 0,appearingMenuWidth:void 0,appearingPosition:void 0,isMeasureValid:void 0}),n._raf=null})))},n._handleGlobalClose=function(){n.props.onClose()},n._handleSlot=function(e){n._manager.setContainer(e)},n._handleScroll=function(){n._scroll=Object(a.ensureNotNull)(n._scrollWrapRef).scrollTop},n.state={},n}return Object(r.__extends)(t,e),t.prototype.componentWillReceiveProps=function(e){this.props.isOpened&&!e.isOpened&&(this.setState({isMeasureValid:void 0}),this._scroll=0)},t.prototype.componentDidMount=function(){var e=this;this._handleMeasure(this.props.onOpen);var t=this.props.customCloseDelegate;(void 0===t?d.a:t).subscribe(this,this._handleGlobalClose),window.addEventListener("resize",this._resize),this._hotkeys||(this._hotkeys=f.createGroup({desc:"Popup menu"}),this._hotkeys.add({desc:"Close",hotkey:27,handler:function(){return e._handleGlobalClose()}}))},t.prototype.componentDidUpdate=function(){this._handleMeasure()},t.prototype.componentWillUnmount=function(){var e=this.props.customCloseDelegate;(void 0===e?d.a:e).unsubscribe(this,this._handleGlobalClose),window.removeEventListener("resize",this._resize),this._hotkeys&&(this._hotkeys.destroy(),this._hotkeys=null),null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null)},t.prototype.render=function(){var e=this.props,t=e.children,n=e.minWidth,r=e.theme,o=void 0===r?_:r,u=e.className,a=e.onMouseOver,l=e.onMouseOut,d=e.onKeyDown,h=this.state,f=h.appearingMenuHeight,b=h.appearingMenuWidth,g=h.appearingPosition,E=h.isMeasureValid;return i.a.createElement(v.a.Provider,{value:this},i.a.createElement(m.b,null,i.a.createElement(p.b.Provider,{value:this._manager},i.a.createElement("div",{className:s()(u,o.menuWrap,!E&&o.isMeasuring),style:{height:f,left:g&&g.x,
|
||
|
minWidth:n,position:"fixed",top:g&&g.y,width:b},ref:this._handleContainerRef,onScroll:this.props.onScroll,onContextMenu:c.b,tabIndex:this.props.tabIndex,onMouseOver:a,onMouseOut:l,onKeyDown:d},i.a.createElement("div",{className:s()(o.scrollWrap,!this.props.noMomentumBasedScroll&&o.momentumBased),style:{overflowY:void 0!==f?"scroll":"auto"},onScroll:this._handleScroll,ref:this._handleScrollWrapRef},i.a.createElement(y,{className:o.menuBox},t)))),i.a.createElement(p.a,{reference:this._handleSlot})))},t.prototype.update=function(){this._resize()},t}(i.a.PureComponent);function y(e){var t=Object(a.ensureNotNull)(Object(o.useContext)(m.a));return i.a.createElement("div",{className:e.className,onMouseOver:function(e){if(null===t.current||!(e.target instanceof Node))return;t.isSubmenuNode(e.target)||t.setCurrent(null)},"data-name":"menu-inner"},e.children)}},PN6A:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n("q1tI"),o=n.n(r).a.createContext(null)},X0gx:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n("q1tI"),o=n.n(r),i=n("tWVy"),u=o.a.createContext(i.a)},dxYz:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n("q1tI"),o=n.n(r),i=o.a.createContext(null);function u(e){var t=Object(r.useState)(null),n=t[0],u=t[1],s=Object(r.useRef)(null),a=Object(r.useRef)(new Map);return Object(r.useEffect)((function(){return function(){null!==s.current&&clearTimeout(s.current)}}),[]),o.a.createElement(i.Provider,{value:{current:n,setCurrent:function(e){null!==s.current&&(clearTimeout(s.current),s.current=null);null===n?u(e):s.current=setTimeout((function(){s.current=null,u(e)}),100)},registerSubmenu:function(e,t){return a.current.set(e,t),function(){a.current.delete(e)}},isSubmenuNode:function(e){return Array.from(a.current.values()).some((function(t){return t(e)}))}}},e.children)}}}]);
|