forked from cerc-io/cosmos-explorer
11 lines
32 KiB
JavaScript
11 lines
32 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["go-to-date-dialog-impl"],{"2sPR":function(e,t,n){e.exports={calendar:"calendar-H-c9lyXG",header:"header-29jmPJB_",title:"title-3BLccpWI",titleDay:"titleDay-3Mp9czBi",switchBtn:"switchBtn-p718bDyp",prev:"prev-1vUszsRH",next:"next-Xxv3BCz0",month:"month-14xTSVpQ",weekdays:"weekdays-p5haX_xf",weeks:"weeks-1LCs6d3o",week:"week-49DNXkE3",day:"day-3x8ZipuB",disabled:"disabled-34cO1Z8u",selected:"selected-qmTqaBK3",currentDay:"currentDay-3sTNH-Yi",otherMonth:"otherMonth-1WMn4XfI"}},"77yN":function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M4 0c-.6 0-1 .4-1 1v1H1c-.6 0-1 .4-1 1v12c0 .6.4 1 1 1h14c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1h-2V1c0-.6-.4-1-1-1h-1c-.6 0-1 .4-1 1v1H6V1c0-.6-.4-1-1-1H4zM2 5h12v9H2V5zm5 2v2h2V7H7zm3 0v2h2V7h-2zm-6 3v2h2v-2H4zm3 0v2h2v-2H7zm3 0v2h2v-2h-2z"/></svg>'},CjI0:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18"><g fill="none" stroke="currentColor" stroke-width="2"><path d="M9 10V4"/><circle cx="9" cy="9" r="8"/><path d="M9 14v-2"/></g></svg>'},FoU0:function(e,t,n){e.exports={textInput:"textInput-3SndIvsX",inputWrapper:"inputWrapper-u_TvMxrq"}},Hrlb:function(e,t,n){e.exports={pickerInput:"pickerInput-3XGDmslV",inputIcon:"inputIcon-1N28V7pi",disabled:"disabled-aKY-xwhe","inputIcon--large":"inputIcon--large-91Ho2uuh","inputIcon--small":"inputIcon--small-93KX0qGd","inputIcon--xsmall":"inputIcon--xsmall-1GLk5pdh",picker:"picker-HQJc7fVy",fixed:"fixed-QBCsU0Gi",absolute:"absolute-2hW9cE-c",nativePicker:"nativePicker-1F6noucK"}},Oehf:function(e,t,n){e.exports={clock:"clock-3pqBsiNm",header:"header-pTWMGSpm",number:"number-9PC9lvyt",active:"active-1sonmMLV",body:"body-2Q-g3GDd",clockFace:"clockFace-eHYbqh-S",face:"face-2iCoBAOV",inner:"inner-1mVlhYbe",hand:"hand-2ZG8pJQb",knob:"knob-31dEppHa",centerDot:"centerDot-210Fo0oV"}},UX0N:function(e,t,n){e.exports={field:"field-3OP1xeZc",errorIcon:"errorIcon-AjhrEkSc",warningIcon:"warningIcon-309b7fMg"}},eFBE:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" width="14px" height="14px"><path fill-rule="evenodd" d="M7 0C3.15 0 0 3.15 0 7s3.15 7 7 7 7-3.15 7-7-3.15-7-7-7zm0 12.25c-2.888 0-5.25-2.363-5.25-5.25 0-2.888 2.362-5.25 5.25-5.25 2.887 0 5.25 2.362 5.25 5.25 0 2.887-2.363 5.25-5.25 5.25zm.25-8H6V8h3.75V6.75h-2.5v-2.5z"/></svg>'},hn2c:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 16" width="10" height="16"><path d="M.6 1.4l1.4-1.4 8 8-8 8-1.4-1.4 6.389-6.532-6.389-6.668z"/></svg>'},ilgf:function(e,t,n){e.exports={dialog:"dialog-1oXvxbfL",formRow:"formRow-28Ldm-ki",cell:"cell-m5Uv3CRU",input:"input-2rGFhmey",btn:"btn-1wL_hi5U",button:"button-1xrfeyEj"}},nPPD:function(e,t,n){"use strict";function o(e,t,n){void 0===n&&(n={});for(var o=Object.assign({},t),s=0,r=Object.keys(t);s<r.length;s++){var i=r[s],a=n[i]||i;a in e&&(o[i]=[e[a],t[i]].join(" "))}return o}function s(e,t,n){return void 0===n&&(n={}),Object.assign({},e,o(e,t,n))}
|
|
n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return s}))},pAWa:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 16" width="10" height="16"><path d="M9.4 1.4l-1.4-1.4-8 8 8 8 1.4-1.4-6.389-6.532 6.389-6.668z"/></svg>'},pBZQ:function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill="none" d="M0 0h16v16H0z"/><path d="M8 .034l-1.41 1.41 5.58 5.59H0v2h12.17l-5.58 5.59L8 16.034l8-8z"/></svg>'},"pk/F":function(e,t,n){e.exports={field:"field-1YbeVGCL",errorIcon:"errorIcon-3nKBmNTE",warningIcon:"warningIcon-2FTdXbRt","errorIcon--large":"errorIcon--large-1UBncQuh","warningIcon--large":"warningIcon--large-2-nZYwjj","errorIcon--small":"errorIcon--small-3eBcxlqP","warningIcon--small":"warningIcon--small-60SRfITp","errorIcon--xsmall":"errorIcon--xsmall-8a2JUSk7","warningIcon--xsmall":"warningIcon--xsmall-2rOz7ig5"}},srFJ:function(e,t,n){e.exports={calendar:"calendar-Q5DuQzKD"}},"uUY/":function(e,t,n){"use strict";n.r(t);var o,s=n("q1tI"),r=n("i8i4"),i=n("mrSG"),a=(n("YFKU"),n("WXjp")),c=n("AVTG"),p=(n("EsMY"),n("2sPR")),l=n("TSYQ"),h=n("ldgD"),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._onClick=function(){t.props.onClick&&!t.props.isDisabled&&t.props.onClick(t.props.day.clone())},t}return Object(i.__extends)(t,e),t.prototype.render=function(){var e,t=l(p.day,((e={})[p.selected]=this.props.isSelected,e[p.disabled]=this.props.isDisabled,e[p.currentDay]=h(new Date).isSame(this.props.day,"day"),e[p.otherMonth]=this.props.isOtherMonth,e));return s.createElement("span",{className:t,onClick:this._onClick,"data-day":this.props.day.format("YYYY-MM-DD")},s.createElement("span",null,this.props.day.date()))},t}(s.PureComponent),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.__extends)(t,e),t.prototype.render=function(){return s.createElement("div",{className:p.month},s.createElement("div",{className:p.weekdays},this._renderWeekdays()),s.createElement("div",{className:p.weeks},this._renderWeeks()))},t.prototype._renderWeekdays=function(){for(var e=[],t=1;t<8;t++){var n=h().day(t).format("dd");e.push(s.createElement("span",{key:t},n))}return e},t.prototype._renderWeeks=function(){for(var e=[],t=this.props.viewDate.clone().startOf("month").startOf("isoWeek"),n=0;n<6;n++)e.push(this._renderWeek(t)),t=t.clone().add(1,"weeks");return e},t.prototype._renderWeek=function(e){for(var t=[],n=0;n<7;n++){var o=e.clone().add(n,"days");t.push(s.createElement(u,{key:n,day:o,isDisabled:this._isDayDisabled(o),isSelected:o.isSame(this.props.selectedDate,"day"),isOtherMonth:!o.isSame(this.props.viewDate,"month"),onClick:this.props.onClickDay}))}return s.createElement("div",{className:p.week,key:e.week()},t)},t.prototype._isDayDisabled=function(e){var t=!this._isInRange(e);return!t&&this.props.disableWeekends&&(t=[5,6].includes(e.weekday())),t},t.prototype._isInRange=function(e){
|
|
return(!this.props.maxDate||this.props.maxDate.startOf("day").diff(e.startOf("day"),"days")>=0)&&(!this.props.minDate||this.props.minDate.startOf("day").diff(e.startOf("day"),"days")<=0)},t}(s.PureComponent),m=n("Iivm"),f=n("pAWa"),v=n("hn2c"),_=function(e){function t(t){var n=e.call(this,t)||this;return n._prevMonth=function(){n.setState({viewDate:n.state.viewDate.clone().subtract(1,"months")})},n._nextMonth=function(){n.setState({viewDate:n.state.viewDate.clone().add(1,"months")})},n._onClickDay=function(e){var t=e.clone();n.setState({viewDate:t}),n.props.onSelect&&n.props.onSelect(t.clone())},n.state={viewDate:t.selectedDate},n}return Object(i.__extends)(t,e),t.prototype.render=function(){return s.createElement("div",{className:l(p.calendar,this.props.className)},s.createElement("div",{className:p.header},s.createElement(m.Icon,{icon:f,onClick:this._prevMonth,className:l(p.switchBtn,p.prev)}),s.createElement("div",{className:p.title},s.createElement("span",{className:p.titleDay},this.state.viewDate.format("DD"))," "+this.state.viewDate.format("MMM")+" '"+this.state.viewDate.format("YY")),s.createElement(m.Icon,{icon:v,onClick:this._nextMonth,className:l(p.switchBtn,p.next)})),s.createElement(d,{viewDate:this.state.viewDate,selectedDate:this.props.selectedDate,maxDate:this.props.maxDate,minDate:this.props.minDate,onClickDay:this._onClickDay,disableWeekends:this.props.disableWeekends}))},t}(s.PureComponent),g=n("77yN"),y=n("srFJ"),w=n("L0Sj"),E=n("pk/F"),M=n("kSQs"),b=n("CjI0"),D={bottom:{attachment:{horizontal:"left",vertical:"top"},targetAttachment:{horizontal:"left",vertical:"bottom"}},top:{attachment:{horizontal:"left",vertical:"bottom"},targetAttachment:{horizontal:"left",vertical:"top"}},topRight:{attachment:{horizontal:"right",vertical:"bottom"},targetAttachment:{horizontal:"right",vertical:"top"}},bottomRight:{attachment:{horizontal:"right",vertical:"top"},targetAttachment:{horizontal:"right",vertical:"bottom"}}};!function(e){e.Top="top",e.Bottom="bottom"}(o||(o={}));var k={top:{attachment:D.topRight.attachment,targetAttachment:D.topRight.targetAttachment,attachmentOffsetY:-4},bottom:{attachment:D.bottomRight.attachment,targetAttachment:D.bottomRight.targetAttachment,attachmentOffsetY:4}};var O,S,C,x=(O=w.a,S=!0,void 0===(C=!0)&&(C=!1),function(e){function t(t){var n=e.call(this,t)||this;return n._onMouseOverWarning=function(e){n.setState({showWarning:!0})},n._onMouseOutWarning=function(e){n.setState({showWarning:!1})},n._mouseOver=function(e){n.state.invalid&&n.setState({showError:!0}),n.props.onMouseOver&&n.props.onMouseOver(e)},n._mouseOut=function(e){n.setState({showError:!1}),n.props.onMouseOut&&n.props.onMouseOut(e)},n._focus=function(e){n.setState({focused:!0,mouseOut:void 0,mouseOver:void 0}),n.state.invalid&&n.setState({showError:!0}),n.props.onFocus&&n.props.onFocus(e)},n._blur=function(e){n.setState({focused:!1,mouseOut:n._mouseOut,mouseOver:n._mouseOver,showError:!1}),n.props.onBlur&&n.props.onBlur(e)},n.state={invalid:Boolean(n.props.errors&&n.props.errors.length),
|
|
hasWarning:Boolean(n.props.warnings&&n.props.warnings.length),mouseOut:n._mouseOut,mouseOver:n._mouseOver,showError:!1,showWarning:!1},n._fieldElem=s.createRef(),n}return Object(i.__extends)(t,e),t.prototype.componentWillReceiveProps=function(e){e.errors!==this.props.errors&&this.setState({invalid:Boolean(e.errors&&e.errors.length),showError:this.state.focused&&Boolean(e.errors&&e.errors.length),hasWarning:Boolean(e.warnings&&e.warnings.length)})},t.prototype.render=function(){var e,t=this.props.fieldTheme||E,n=l(t.field,((e={})[this.props.className]=Boolean(this.props.className),e)),o=l(t.errorIcon,this.props.fieldSize&&t["errorIcon--"+this.props.fieldSize]),r=l(t.warningIcon,this.props.fieldSize&&t["warningIcon--"+this.props.fieldSize]);return s.createElement(s.Fragment,null,s.createElement("div",{className:n,onMouseOver:this.state.mouseOver,onMouseOut:this.state.mouseOut,ref:this._fieldElem},this._createField(),this.state.invalid&&s.createElement(m.Icon,{className:o,icon:b}),!this.state.invalid&&this.state.hasWarning&&s.createElement("span",{onMouseOver:this._onMouseOverWarning,onMouseOut:this._onMouseOutWarning},s.createElement(m.Icon,{className:r,icon:b}))),S&&!this.props.noErrorMessages&&this._createErrorsBox(),C&&this._createWarningsBox())},t.prototype._createField=function(){var e=Object.assign({},this.props,{error:this.state.invalid,onBlur:this._blur,onFocus:this._focus}),t=(e.errors,e.children),n=(e.alwaysShowError,e.fieldSize,e.noErrorMessages,e.fieldTheme,e.errorAttachment,Object(i.__rest)(e,["errors","children","alwaysShowError","fieldSize","noErrorMessages","fieldTheme","errorAttachment"])),o=O;return s.createElement(o,Object(i.__assign)({},n),t)},t.prototype._createErrorsBox=function(){var e=this.props.errorAttachment,t=void 0===e?o.Top:e,n=k[t],r=n.attachment,i=n.targetAttachment,a=n.attachmentOffsetY;return s.createElement(M.a,{isOpened:this.state.showError||this.props.alwaysShowError,target:this._fieldElem.current,root:"parent",inheritWidthFromTarget:!1,attachment:r,targetAttachment:i,attachmentOffsetY:a,inheritMaxWidthFromTarget:!0,show:!0},this.props.errors)},t.prototype._createWarningsBox=function(){var e=this.props.errorAttachment,t=void 0===e?o.Top:e,n=k[t],r=n.attachment,i=n.targetAttachment,a=n.attachmentOffsetY;return s.createElement(M.a,{isOpened:this.state.showWarning,target:this._fieldElem.current,root:"parent",inheritWidthFromTarget:!1,attachment:r,targetAttachment:i,attachmentOffsetY:a,inheritMaxWidthFromTarget:!0,show:!0},this.props.warnings)},t}(s.PureComponent)),I=n("RgaO"),T=n("Eyy1"),P=n("nPPD"),N=n("D/i5"),H=n("FoU0"),z=n("UX0N"),j=n("Hrlb"),F=Object(i.__assign)(Object(i.__assign)({},N),Object(P.b)(N,H)),R=Object(i.__assign)(Object(i.__assign)({},E),Object(P.b)(E,z)),B=function(e){function t(t){var n=e.call(this,t)||this;return n._input=null,n._handleFocus=function(){n.props.showOnFocus&&n.props.onShowPicker()},n._handleInputRef=function(e){n._input=e,n.props.dateInputDOMReference&&n.props.dateInputDOMReference(n._input)},n._onShowPicker=function(e){if(e){
|
|
var t=e.getBoundingClientRect();t.width&&t.right>window.innerWidth?e.style.right="0":e.style.right="auto"}},n._onChange=function(){var e=Object(T.ensureNotNull)(n._input).value;n.setState({value:e}),n.props.onType(e)},n._onKeyDown=function(e){n.props.onHidePicker()},n._onKeyPress=function(e){if(e.charCode){var t=String.fromCharCode(e.charCode);n.props.inputRegex.test(t)||e.preventDefault()}},n._onKeyUp=function(e){if(8!==e.keyCode){var t=Object(T.ensureNotNull)(n._input).value,o=n.props.fixValue(t);o!==t&&n.setState({value:o})}},n.state={value:t.value},n}return Object(i.__extends)(t,e),t.prototype.componentWillReceiveProps=function(e){e.value!==this.props.value&&this.setState({value:e.value})},t.prototype.render=function(){var e,t=this,n=this.props.position,o=void 0===n?"fixed":n,r=l(j.inputIcon,j["inputIcon--"+this.props.size],((e={})[j.disabled]=this.props.disabled,e));return s.createElement("div",{className:j.pickerInput},s.createElement(x,{value:this.state.value,onKeyDown:this._onKeyDown,onKeyPress:this._onKeyPress,onKeyUp:this._onKeyUp,onChange:this._onChange,onFocus:this._handleFocus,onClick:this.props.onShowPicker,reference:this._handleInputRef,rightComponent:this.props.errors&&this.props.errors.length?void 0:s.createElement(m.Icon,{icon:this.props.icon,className:r,onClick:this.props.disabled||this.props.readonly?void 0:this.props.onShowPicker}),theme:F,fieldTheme:R,sizeMode:this.props.size,disabled:this.props.disabled,errors:this.props.errors,noErrorMessages:!this.props.showErrorMessages,fieldSize:this.props.size,name:this.props.name,readOnly:this.props.readonly}),this.props.showPicker&&!this.props.readonly?s.createElement(I.a,{mouseDown:!0,handler:this.props.onHidePicker},(function(e){return s.createElement("span",{ref:e},s.createElement("div",{className:l(j.picker,j[o]),key:"0",ref:t._onShowPicker},t.props.children))})):null)},t.defaultProps={showOnFocus:!0},t}(s.PureComponent),W=Object(i.__assign)(Object(i.__assign)({},N),Object(P.b)(N,H)),A=Object(i.__assign)(Object(i.__assign)({},E),Object(P.b)(E,z)),V=function(e){function t(t){var n=e.call(this,t)||this;return n._onChange=function(e){n.setState({value:e.target.value}),n.props.onChange(e.target.value)},n.state={value:t.value},n}return Object(i.__extends)(t,e),t.prototype.render=function(){var e,t=l(j.inputIcon,this.props.size&&j["inputIcon--"+this.props.size],((e={})[j.disabled]=this.props.disabled,e)),n=!this.props.readonly&&!this.props.disabled;return s.createElement("div",{className:j.pickerInput},s.createElement(x,{value:this.state.value,readOnly:!0,rightComponent:this.props.errors&&this.props.errors.length?void 0:s.createElement(m.Icon,{icon:this.props.icon,className:t}),theme:W,fieldTheme:A,sizeMode:this.props.size,disabled:this.props.disabled,errors:this.props.errors,fieldSize:this.props.size,alwaysShowError:!0,noErrorMessages:!this.props.showErrorMessages,name:n?void 0:this.props.name}),n&&s.createElement("input",{type:this.props.type,className:j.nativePicker,onChange:this._onChange,onInput:this._onChange,value:this.props.value,
|
|
min:this.props.min,max:this.props.max,name:this.props.name}))},t}(s.PureComponent),Y=function(e){function t(t){var n=e.call(this,t)||this;return n._format="YYYY-MM-DD",n._fixValue=function(e){return e=(e=e.substr(0,10)).replace(/-+/g,"-"),(/^\d{4}$/.test(e)||/^\d{4}-\d{2}$/.test(e))&&(e+="-"),e},n._isValid=function(e){if(/^[0-9]{4}(-[0-9]{2}){2}/.test(e)){var t=h(e,n._format);return t.isValid()&&(n.props.noRangeValidation||n._isInRange(t))}return!1},n._onType=function(e){var t=n._isValid(e)?h(e,n._format):null;t?n.setState({date:t,isInvalid:!1}):n.setState({isInvalid:!0}),n.props.onPick(t)},n._onSelect=function(e){n.setState({date:e,showCalendar:!1,isInvalid:!1}),n.props.onPick(e)},n._showCalendar=function(){n.setState({showCalendar:!0})},n._hideCalendar=function(){n.setState({showCalendar:!1})},n._getErrors=function(){var e=n.props.errors?Object(i.__spreadArrays)(n.props.errors):[];return n.state.isInvalid&&e.push(window.t("Please enter the right date format yyyy-mm-dd")),e},n.state={date:t.initial,showCalendar:!1,isInvalid:!n._isValid(t.initial.format(n._format))},n}return Object(i.__extends)(t,e),t.prototype.render=function(){var e=this.props.position,t=void 0===e?"fixed":e;return Modernizr.mobiletouch?s.createElement(V,{value:this.state.date.format(this._format),type:"date",onChange:this._onType,icon:g,disabled:this.props.disabled,size:this.props.size,min:this.props.minDate&&this.props.minDate.format(this._format),max:this.props.maxDate&&this.props.maxDate.format(this._format),errors:this._getErrors(),showErrorMessages:this.props.showErrorMessages,name:this.props.name,readonly:this.props.readonly}):s.createElement(B,{value:this.state.date.format(this._format),inputRegex:/[0-9.]/,fixValue:this._fixValue,onType:this._onType,onShowPicker:this._showCalendar,onHidePicker:this._hideCalendar,showPicker:this.state.showCalendar,showOnFocus:this.props.showOnFocus,icon:g,disabled:this.props.disabled,size:this.props.size,errors:this._getErrors(),showErrorMessages:this.props.showErrorMessages,name:this.props.name,dateInputDOMReference:this.props.dateInputDOMReference,readonly:this.props.readonly,position:t},s.createElement(_,{selectedDate:this.state.date,maxDate:this.props.maxDate,minDate:this.props.minDate,onSelect:this._onSelect,className:y.calendar}))},t.prototype.componentWillReceiveProps=function(e){this.props.initial!==e.initial&&this.setState({date:e.initial})},t.prototype._isInRange=function(e){return(!this.props.maxDate||this.props.maxDate.startOf("day").diff(e.startOf("day"),"days")>=0)&&(!this.props.minDate||this.props.minDate.startOf("day").diff(e.startOf("day"),"days")<=0)},t}(s.PureComponent),L=n("Oehf"),G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._renderNumber=function(e,n){var o,r=l(L.number,((o={})[L.active]=e===t.props.activeNumber,o[L.inner]=t.props.isInner,o)),i=t.props.format?t.props.format(e):e.toString();return s.createElement("span",{key:e,className:r,style:t._numberStyle(t.props.radius-t.props.spacing,n),"data-value":i},s.createElement("span",null,i))},t}
|
|
return Object(i.__extends)(t,e),t.prototype.render=function(){return s.createElement("div",{className:L.face,style:this._faceStyle(),onMouseDown:this.props.onMouseDown,onTouchStart:this.props.onTouchStart},this.props.numbers.map(this._renderNumber))},t.prototype._faceStyle=function(){return{height:2*this.props.radius,width:2*this.props.radius}},t.prototype._numberStyle=function(e,t){var n=Math.PI/180*360/12*t;return{left:e+e*Math.sin(n)+this.props.spacing,top:e-e*Math.cos(n)+this.props.spacing}},t}(s.PureComponent),U=function(e){function t(t){var n=e.call(this,t)||this;return n._onMouseMove=function(e){n._move(K(e))},n._onTouchMove=function(e){n._move(X(e))},n._onMouseUp=function(){document.removeEventListener("mousemove",n._onMouseMove),document.removeEventListener("mouseup",n._onMouseUp),n._endMove()},n._onTouchEnd=function(e){document.removeEventListener("touchmove",n._onTouchMove),document.removeEventListener("touchend",n._onTouchEnd),n._endMove(e)},n}return Object(i.__extends)(t,e),t.prototype.componentWillUnmount=function(){document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd)},t.prototype.render=function(){var e={height:this.props.length,transform:"rotate("+this.props.angle+"deg)"};return s.createElement("div",{className:L.hand,style:e},s.createElement("span",{className:L.knob}))},t.prototype.mouseStart=function(e){document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp),this._move(K(e.nativeEvent))},t.prototype.touchStart=function(e){document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),this._move(X(e.nativeEvent)),e.stopPropagation()},t.prototype._endMove=function(e){this.props.onMoveEnd&&this.props.onMoveEnd(e)},t.prototype._move=function(e){var t=this._trimAngleToValue(this._positionToAngle(e)),n=this._getPositionRadius(e);!this.props.onMove||isNaN(t)||isNaN(n)||this.props.onMove(360===t?0:t,n)},t.prototype._trimAngleToValue=function(e){return this.props.step*Math.round(e/this.props.step)},t.prototype._positionToAngle=function(e){return t=this.props.center.x,n=this.props.center.y,o=e.x,s=e.y,(r=function(e,t,n,o){return 180*(Math.atan2(o-t,n-e)+Math.PI/2)/Math.PI}(t,n,o,s))<0?360+r:r;var t,n,o,s,r},t.prototype._getPositionRadius=function(e){var t=this.props.center.x-e.x,n=this.props.center.y-e.y;return Math.sqrt(t*t+n*n)},t}(s.PureComponent);function K(e){return{x:e.pageX-window.scrollX,y:e.pageY-window.scrollY}}function X(e){return{x:e.touches[0].pageX-window.scrollX,y:e.touches[0].pageY-window.scrollY}}function Q(e,t,n){void 0===n&&(n=1);for(var o=Math.max(Math.ceil((t-e)/n),0),s=Array(o),r=0;r<o;r++)s[r]=e,e+=n;return s}function q(e){return("0"+e).slice(-2)}var Z,J=Object(i.__spreadArrays)([0],Q(13,24)),$=Object(i.__spreadArrays)([12],Q(1,12)),ee=function(e){function t(t){var n=e.call(this,t)||this
|
|
;return n._onMouseDown=function(e){n._hand.mouseStart(e)},n._onTouchStart=function(e){n._hand.touchStart(e)},n._onHandMove=function(e,t){var o=t<n.props.radius-n.props.spacing;n.state.isInner!==o?n.setState({isInner:o},(function(){n.props.onChange(n._valueFromDegrees(e))})):n.props.onChange(n._valueFromDegrees(e))},n._onHandMoveEnd=function(){n.props.onSelect&&n.props.onSelect()},n.state={isInner:n.props.selected>0&&n.props.selected<=12},n}return Object(i.__extends)(t,e),t.prototype.render=function(){var e=this,t=this.props,n=t.center,o=t.radius,r=t.spacing,i=t.selected;return s.createElement("div",null,s.createElement(G,{radius:o,spacing:r,numbers:J,activeNumber:i,format:q,onMouseDown:this._onMouseDown,onTouchStart:this._onTouchStart}),this._renderInnerFace(.46*o),s.createElement(U,{ref:function(t){return e._hand=t},length:o-(this.state.isInner?.46*o:r)-this.props.numberRadius,angle:30*i,step:30,center:n,onMove:this._onHandMove,onMoveEnd:this._onHandMoveEnd}))},t.prototype._renderInnerFace=function(e){return s.createElement(G,{radius:this.props.radius,spacing:e,numbers:$,activeNumber:this.props.selected,onMouseDown:this._onMouseDown,onTouchStart:this._onTouchStart,isInner:!0})},t.prototype._valueFromDegrees=function(e){return this.state.isInner?$[e/30]:J[e/30]},t}(s.PureComponent),te=Q(0,60,5),ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._onMouseDown=function(e){t._hand.mouseStart(e)},t._onTouchStart=function(e){t._hand.touchStart(e)},t._onHandMove=function(e){t.props.onChange(e/6)},t._onHandMoveEnd=function(e){t.props.onSelect&&t.props.onSelect(e)},t}return Object(i.__extends)(t,e),t.prototype.render=function(){var e=this;return s.createElement("div",null,s.createElement(G,{radius:this.props.radius,spacing:this.props.spacing,numbers:te,activeNumber:this.props.selected,format:q,onMouseDown:this._onMouseDown,onTouchStart:this._onTouchStart}),s.createElement(U,{ref:function(t){return e._hand=t},length:this.props.radius-this.props.spacing-this.props.numberRadius,angle:6*this.props.selected,step:6,center:this.props.center,onMove:this._onHandMove,onMoveEnd:this._onHandMoveEnd}))},t}(s.PureComponent);!function(e){e[e.Hours=0]="Hours",e[e.Minutes=1]="Minutes"}(Z||(Z={}));var oe,se=function(e){function t(t){var n=e.call(this,t)||this;return n._clockFace=null,n._raf=null,n._recalculateTimeout=null,n._calculateShapeBinded=n._calculateShape.bind(n),n._onChangeHours=function(e){n.state.time.hours()!==e&&n._onChange(n.state.time.clone().hours(e))},n._onChangeMinutes=function(e){n.state.time.minutes()!==e&&n._onChange(n.state.time.clone().minutes(e))},n._onSelectHours=function(){n._displayMinutes()},n._onSelectMinutes=function(e){e&&e.target instanceof Node&&n._clockFace&&n._clockFace.contains(e.target)&&e.preventDefault(),n.props.onSelect&&n.props.onSelect(n.state.time.clone())},n._displayHours=function(){n.setState({faceType:Z.Hours})},n._displayMinutes=function(){n.setState({faceType:Z.Minutes})},n._setClockFace=function(e){n._clockFace=e},n.state={center:{x:0,y:0},radius:0,
|
|
time:n.props.selectedTime,faceType:Z.Hours},n}return Object(i.__extends)(t,e),t.prototype.render=function(){var e,t;return s.createElement("div",{className:l(L.clock,this.props.className)},s.createElement("div",{className:L.header},s.createElement("span",{className:l(L.number,(e={},e[L.active]=this.state.faceType===Z.Hours,e)),onClick:this._displayHours},this.state.time.format("HH")),s.createElement("span",null,":"),s.createElement("span",{className:l(L.number,(t={},t[L.active]=this.state.faceType===Z.Minutes,t)),onClick:this._displayMinutes},this.state.time.format("mm"))),s.createElement("div",{className:L.body},s.createElement("div",{className:L.clockFace,ref:this._setClockFace},this.state.faceType===Z.Hours?this._renderHours():null,this.state.faceType===Z.Minutes?this._renderMinutes():null,s.createElement("span",{className:L.centerDot}))))},t.prototype.componentDidMount=function(){this._calculateShape(),this._recalculateTimeout=setTimeout(this._calculateShapeBinded,1),window.addEventListener("resize",this._calculateShapeBinded),window.addEventListener("scroll",this._calculateShapeBinded,!0)},t.prototype.componentWillUnmount=function(){this._clearTimeout(),window.removeEventListener("resize",this._calculateShapeBinded),window.removeEventListener("scroll",this._calculateShapeBinded,!0),null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null)},t.prototype._clearTimeout=function(){null!==this._recalculateTimeout&&(clearTimeout(this._recalculateTimeout),this._recalculateTimeout=null)},t.prototype._renderHours=function(){return s.createElement(ee,{center:this.state.center,radius:this.state.radius,spacing:.18*this.state.radius,selected:this.state.time.hours(),numberRadius:13,onChange:this._onChangeHours,onSelect:this._onSelectHours})},t.prototype._renderMinutes=function(){return s.createElement(ne,{center:this.state.center,radius:this.state.radius,spacing:.18*this.state.radius,selected:this.state.time.minutes(),numberRadius:13,onChange:this._onChangeMinutes,onSelect:this._onSelectMinutes})},t.prototype._onChange=function(e){this.setState({time:e}),this.props.onChange&&this.props.onChange(e.clone())},t.prototype._calculateShape=function(){var e=this;null===this._raf&&(this._raf=requestAnimationFrame((function(){var t=Object(T.ensureNotNull)(e._clockFace).getBoundingClientRect(),n=t.left,o=t.top,s=t.width;e.setState({center:{x:n+s/2,y:o+s/2},radius:s/2}),e._raf=null})))},t}(s.PureComponent),re=n("eFBE"),ie=function(e){function t(t){var n=e.call(this,t)||this;return n._format="HH:mm",n._fixValue=function(e){return(e=(e=e.substr(0,5)).replace(/:+/g,":")).endsWith(":")||2!==e.length||(e+=":"),e},n._isValid=function(e){return/^[0-9]{2}:[0-9]{2}/.test(e)&&h(e,n._format).isValid()},n._onType=function(e){var t=n._isValid(e)?h(e,n._format):null;t?n.setState({time:t,isInvalid:!1}):n.setState({isInvalid:!0}),n.props.onPick(t)},n._onSelect=function(e){n.setState({time:e,showClock:!1,isInvalid:!1}),n.props.onPick(e)},n._showClock=function(){n.setState({showClock:!0})},n._hideClock=function(){n.setState({showClock:!1})},
|
|
n._getErrors=function(){var e=n.props.errors?Object(i.__spreadArrays)(n.props.errors):[];return n.state.isInvalid&&e.push(window.t("Please enter the right time format hh:mm")),e},n.state={time:t.initial,showClock:!1,isInvalid:!n._isValid(t.initial.format(n._format))},n}return Object(i.__extends)(t,e),t.prototype.render=function(){return Modernizr.mobiletouch?s.createElement(V,{value:this.state.time.format(this._format),type:"time",onChange:this._onType,icon:re,disabled:this.props.disabled,size:this.props.size,errors:this._getErrors(),showErrorMessages:this.props.showErrorMessages,name:this.props.name,readonly:this.props.readonly}):s.createElement(B,{value:this.state.time.format(this._format),inputRegex:/[0-9:]/,fixValue:this._fixValue,onType:this._onType,onShowPicker:this._showClock,onHidePicker:this._hideClock,showPicker:this.state.showClock,icon:re,disabled:this.props.disabled,size:this.props.size,errors:this._getErrors(),showErrorMessages:this.props.showErrorMessages,name:this.props.name,readonly:this.props.readonly},s.createElement(se,{selectedTime:this.state.time,onSelect:this._onSelect}))},t.prototype.componentWillReceiveProps=function(e){this.props.initial!==e.initial&&this.setState({time:e.initial,isInvalid:!this._isValid(e.initial.format(this._format))})},t}(s.PureComponent),ae=n("FQhm"),ce=n("ZjKI"),pe=n("oj21"),le=n("ycI/"),he=n("pBZQ"),ue=n("ilgf"),de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._todayMidnight=h("00:00","HH:mm"),t._dateInputDOMElement=null,t._dateInputDOMReference=function(e){t._dateInputDOMElement=e},t}return Object(i.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;setTimeout((function(){null!==e._dateInputDOMElement&&e._dateInputDOMElement.focus()}),0)},t.prototype.render=function(){return s.createElement(s.Fragment,null,s.createElement(c.b,{onClose:this.props.onEscape},window.t("Go to")),s.createElement(c.a,null,s.createElement(le.a,{keyCode:27,handler:this.props.onEscape}),s.createElement(le.a,{keyCode:13,handler:this.props.onGoToDateHandler}),s.createElement("div",{className:ue.formRow},s.createElement("div",{className:l(ue.cell,ue.input)},s.createElement(Y,{initial:me.lastPickedDate,onPick:this.props.onDatePick,maxDate:this._todayMidnight,disabled:this.props.processing,dateInputDOMReference:this._dateInputDOMReference,showOnFocus:!1})),s.createElement("div",{className:l(ue.cell,ue.input)},s.createElement(ie,{initial:me.lastPickedTime,onPick:this.props.onTimePick,disabled:this.props.processing||this.props.dateOnly||!this.props.date})),s.createElement("div",{className:l(ue.cell,ue.btn)},s.createElement(pe.a,{type:"primary",disabled:!this.props.date||!this.props.time||this.props.processing,onClick:this.props.onGoToDateHandler,className:ue.button},s.createElement(m.Icon,{icon:he}))))))},t}(s.PureComponent),me=function(e){function t(n){var o=e.call(this,n)||this;return o._onDatePick=function(e){o.setState({date:e})},o._onTimePick=function(e){o.setState({time:e})},o._onGoToDate=function(){
|
|
var e=o.props.onGoToDate,n=o.state,s=n.date,r=n.time;if(e&&s&&r){var i=s.clone();i.hours(r.hours()),i.minutes(r.minutes()),e(new Date(i.format("YYYY-MM-DD[T]HH:mm[:00Z]")).valueOf()),t.lastPickedDate=s,t.lastPickedTime=r}},o._handleDialogClose=function(){var e=o.props.onClose;e&&(e(),t._resetLastPickedDate())},o.state={date:t.lastPickedDate,time:t.lastPickedTime},o}return Object(i.__extends)(t,e),t.prototype.componentDidMount=function(){ae.subscribe(ce.CLOSE_POPUPS_AND_DIALOGS_COMMAND,this._handleDialogClose,null)},t.prototype.componentWillUnmount=function(){ae.unsubscribe(ce.CLOSE_POPUPS_AND_DIALOGS_COMMAND,this._handleDialogClose,null)},t.prototype.render=function(){return s.createElement(a.a,{isOpened:this.props.isOpened,onClickOutside:this._handleDialogClose,className:ue.dialog,"data-dialog-type":"go-to-date-dialog"},s.createElement(de,Object(i.__assign)({onDatePick:this._onDatePick,onTimePick:this._onTimePick,onGoToDateHandler:this._onGoToDate,onEscape:this._handleDialogClose},this.props,this.state)))},t._resetLastPickedDate=function(){t.lastPickedDate=h(),t.lastPickedTime=h("00:00","HH:mm")},t.lastPickedDate=h(),t.lastPickedTime=h("00:00","HH:mm"),t}(s.PureComponent);function fe(e){ve({isOpened:!1});var t={isOpened:!0,onClose:function(){ve({isOpened:!1}),oe=null},dateOnly:e.model().mainSeries().isDWM(),onGoToDate:function(t){!function(e,t){if(void 0===e.model().timeScale().tickMarks().minIndex)return;ve({isOpened:!0,processing:!0}),e.model().gotoTime(t).done((function(t){var n=e.model().mainSeries();void 0===t?n.clearGotoDateResult():n.setGotoDateResult(t)})).always((function(){ve({isOpened:!1,processing:!1})}))}(e,t)}};ve(t)}function ve(e){oe||(oe=document.createElement("div"),document.body.appendChild(oe)),r.render(s.createElement(me,e),oe)}n.d(t,"showGoToDateDialog",(function(){return fe}))}}]); |