cosmos-explorer/public/charting_library/bundles/38.f7058b17c9cf23a00b5b.js
2021-11-21 09:42:01 +08:00

2 lines
5.4 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[38],{"4Cm8":function(t,e,i){"use strict";i.d(e,"a",(function(){return M}));var s=i("mrSG"),r=i("q1tI"),n=i("TSYQ"),o=i("cvc5"),l=i("Iivm"),a=i("//lZ"),c=i("9uLv"),u=i("Ialn"),h=i("Vike"),p=i("ji/R"),d={isVisibleScrollbar:!0,shouldMeasure:!0,hideButtonsFrom:1};function f(t){var e;return r.createElement("div",{className:n(p.fadeLeft,(e={},e[p.isVisible]=t.isVisible,e))})}function w(t){var e;return r.createElement("div",{className:n(p.fadeRight,(e={},e[p.isVisible]=t.isVisible,e))})}function m(t){return r.createElement(v,Object(s.__assign)({},t,{className:p.scrollLeft}))}function b(t){return r.createElement(v,Object(s.__assign)({},t,{className:p.scrollRight}))}function v(t){var e;return r.createElement("div",{className:n(t.className,(e={},e[p.isVisible]=t.isVisible,e)),onClick:t.onClick},r.createElement("div",{className:p.iconWrap},r.createElement(l.Icon,{icon:h,className:p.icon})))}var _,R,S,V,g,M=(void 0===(_=m)&&(_=m),void 0===(R=b)&&(R=b),void 0===(S=f)&&(S=f),void 0===(V=w)&&(V=w),(g=function(t){function e(e){var i=t.call(this,e)||this;return i._scroll=r.createRef(),i._wrapMeasureRef=r.createRef(),i._contentMeasureRef=r.createRef(),i._handleScrollLeft=function(){if(i.props.onScrollButtonClick)i.props.onScrollButtonClick("left");else{var t=i.props.scrollStepSize||i.state.widthWrap-50;i.animateTo(Math.max(0,i.currentPosition()-t))}},i._handleScrollRight=function(){if(i.props.onScrollButtonClick)i.props.onScrollButtonClick("right");else{var t=i.props.scrollStepSize||i.state.widthWrap-50;i.animateTo(Math.min((i.state.widthContent||0)-(i.state.widthWrap||0),i.currentPosition()+t))}},i._handleResizeWrap=function(t){i.props.onMeasureWrap&&i.props.onMeasureWrap(t),i.setState({widthWrap:t.width}),i._checkButtonsVisibility()},i._handleResizeContent=function(t){i.props.onMeasureContent&&i.props.onMeasureContent(t);var e=i.props,s=e.shouldDecreaseWidthContent,r=e.buttonsWidthIfDecreasedWidthContent;s&&r?i.setState({widthContent:t.width+2*r}):i.setState({widthContent:t.width})},i._handleScroll=function(){var t=i.props.onScroll;t&&t(i.currentPosition(),i.isAtLeft(),i.isAtRight()),i._checkButtonsVisibility()},i._checkButtonsVisibility=function(){var t=i.state,e=t.isVisibleLeftButton,s=t.isVisibleRightButton,r=i.isAtLeft(),n=i.isAtRight();r||e?r&&e&&i.setState({isVisibleLeftButton:!1}):i.setState({isVisibleLeftButton:!0}),n||s?n&&s&&i.setState({isVisibleRightButton:!1}):i.setState({isVisibleRightButton:!0})},i.state={widthContent:0,widthWrap:0,isVisibleRightButton:!1,isVisibleLeftButton:!1},i}return Object(s.__extends)(e,t),e.prototype.componentDidMount=function(){this._checkButtonsVisibility()},e.prototype.componentDidUpdate=function(t,e){e.widthWrap===this.state.widthWrap&&e.widthContent===this.state.widthContent||this._handleScroll(),this.props.shouldMeasure&&this._wrapMeasureRef.current&&this._contentMeasureRef.current&&(this._wrapMeasureRef.current.measure(),this._contentMeasureRef.current.measure())},e.prototype.currentPosition=function(){
return this._scroll.current?Object(u.isRtl)()?Object(u.getLTRScrollLeft)(this._scroll.current):this._scroll.current.scrollLeft:0},e.prototype.isAtLeft=function(){return!this._isOverflowed()||this.currentPosition()<=this.props.hideButtonsFrom},e.prototype.isAtRight=function(){return!this._isOverflowed()||this.currentPosition()+this.state.widthWrap>=this.state.widthContent-this.props.hideButtonsFrom},e.prototype.animateTo=function(t,e){void 0===e&&(e=c.dur);var i=this._scroll.current;i&&(Object(u.isRtl)()&&(t=Object(u.getLTRScrollLeftOffset)(i,t)),e<=0?i.scrollLeft=Math.round(t):Object(a.doAnimate)({onStep:function(t,e){i.scrollLeft=Math.round(e)},from:i.scrollLeft,to:Math.round(t),easing:c.easingFunc.easeInOutCubic,duration:e}))},e.prototype.render=function(){var t,e=this.props,i=e.children,s=e.isVisibleScrollbar,l=e.isVisibleFade,a=e.isVisibleButtons,c=e.shouldMeasure,u=e.shouldDecreaseWidthContent,h=e.buttonsWidthIfDecreasedWidthContent,d=e.onMouseOver,f=e.onMouseOut,w=this.state,m=w.isVisibleRightButton,b=w.isVisibleLeftButton,v=u&&h;return r.createElement(o,{whitelist:["width"],onMeasure:this._handleResizeWrap,shouldMeasure:c,ref:this._wrapMeasureRef},r.createElement("div",{className:p.wrapOverflow,onMouseOver:d,onMouseOut:f},r.createElement("div",{className:n(p.wrap,v?p.wrapWithArrowsOuting:"")},r.createElement("div",{className:n(p.scrollWrap,(t={},t[p.noScrollBar]=!s,t)),onScroll:this._handleScroll,ref:this._scroll},r.createElement(o,{onMeasure:this._handleResizeContent,whitelist:["width"],shouldMeasure:c,ref:this._contentMeasureRef},i)),l&&r.createElement(S,{isVisible:b}),l&&r.createElement(V,{isVisible:m}),a&&r.createElement(_,{onClick:this._handleScrollLeft,isVisible:b}),a&&r.createElement(R,{onClick:this._handleScrollRight,isVisible:m}))))},e.prototype._isOverflowed=function(){var t=this.state;return t.widthContent>t.widthWrap},e}(r.PureComponent)).defaultProps=d,g)},Vike:function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10" width="20" height="10"><path fill="none" stroke="currentColor" stroke-width="1.5" d="M2 1l8 8 8-8"/></svg>'},"ji/R":function(t,e,i){t.exports={wrap:"wrap-5DN0XnS4",wrapWithArrowsOuting:"wrapWithArrowsOuting-1OPNi0IP",wrapOverflow:"wrapOverflow-2FHnhKaN",scrollWrap:"scrollWrap-nAnkzkWd",noScrollBar:"noScrollBar-34JzryqI",icon:"icon-1nfNqIRh",scrollLeft:"scrollLeft-2cl_k1e7",scrollRight:"scrollRight-2SEqCpTf",isVisible:"isVisible-Stm3XOHb",iconWrap:"iconWrap-1E4GEP7h",fadeLeft:"fadeLeft-244lj3pA",fadeRight:"fadeRight-1JnS42hI"}}}]);