react-datetime
Advanced tools
Comparing version 3.0.0-beta.7 to 3.0.0-beta.8
@@ -7,2 +7,3 @@ Changelog | ||
* `onBlur` and `onFocus` are renamed to `onClose` and `onOpen` since they had nothing to do with the blur event and it was misleading some users. If we want to listen to the input's `onBlur` and `onFocus` use `inputProps`. | ||
* `defaultValue` prop is now called `initialValue`. | ||
* Updated typescript definitions. | ||
@@ -9,0 +10,0 @@ * Time is not updated anymore on right clicks. |
@@ -1,2 +0,2 @@ | ||
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("moment")},function(e,t,n){e.exports=n(5)()},function(e,t){e.exports=require("react-dom")},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";var r=n(6);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),a=n(1),i=n.n(a),s=n(0),u=n.n(s);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?m(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;l(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return y(m(n=f(this,(e=d(t)).call.apply(e,[this].concat(o)))),"_setDate",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this.props.viewDate,t=e.localeData(),n=e.clone().startOf("month"),r=e.clone().endOf("month");return u.a.createElement("div",{className:"rdtDays"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderNavigation(e,t),this.renderDayHeaders(t)),u.a.createElement("tbody",null,this.renderDays(e,n,r)),this.renderFooter(e)))}},{key:"renderNavigation",value:function(e,t){var n=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return n.props.navigate(-1,"months")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return n.props.showView("months")},colSpan:5,"data-value":this.props.viewDate.month()},t.months(e)+" "+e.year()),u.a.createElement("th",{className:"rdtNext",onClick:function(){return n.props.navigate(1,"months")}},u.a.createElement("span",null,"›")))}},{key:"renderDayHeaders",value:function(e){var t=this.getDaysOfWeek(e).map((function(e,t){return u.a.createElement("th",{key:e+t,className:"dow"},e)}));return u.a.createElement("tr",null,t)}},{key:"renderDays",value:function(e,t,n){var r=[[],[],[],[],[],[]],o=e.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");for(var a=o.clone().add(42,"d"),i=0;o.isBefore(a);)this.getRow(r,i++).push(this.renderDay(o,t,n)),o.add(1,"d");return r.map((function(e,t){return u.a.createElement("tr",{key:"".concat(a.month(),"_").concat(t)},e)}))}},{key:"renderDay",value:function(e,t,n){var r=this.props.selectedDate,o={key:e.format("M_D"),"data-value":e.date(),"data-month":e.month(),"data-year":e.year()},a="rdtDay";return e.isBefore(t)?a+=" rdtOld":e.isAfter(n)&&(a+=" rdtNew"),r&&e.isSame(r,"day")&&(a+=" rdtActive"),e.isSame(this.props.moment(),"day")&&(a+=" rdtToday"),this.props.isValidDate(e)?o.onClick=this._setDate:a+=" rdtDisabled",o.className=a,this.props.renderDay?this.props.renderDay(o,e.clone(),r&&r.clone()):u.a.createElement("td",o,e.date())}},{key:"renderFooter",value:function(e){var t=this;if(this.props.timeFormat)return u.a.createElement("tfoot",null,u.a.createElement("tr",null,u.a.createElement("td",{onClick:function(){return t.props.showView("time")},colSpan:7,className:"rdtTimeToggle"},e.format(this.props.timeFormat))))}},{key:"getDaysOfWeek",value:function(e){var t=e.firstDayOfWeek(),n=[],r=0;return e._weekdaysMin.forEach((function(e){n[(7+r++-t)%7]=e})),n}},{key:"getRow",value:function(e,t){return e[Math.floor(t/7)]}}])&&p(n.prototype,r),o&&p(n,o),t}(u.a.Component);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?D(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(v,"defaultProps",{isValidDate:function(){return!0}});var E=function(e){function t(){var e,n;g(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _(D(n=w(this,(e=k(t)).call.apply(e,[this].concat(o)))),"_updateSelectedMonth",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){return u.a.createElement("div",{className:"rdtMonths"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader())),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderMonths())))}},{key:"renderHeader",value:function(){var e=this,t=this.props.viewDate.year();return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return e.props.navigate(-1,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return e.props.showView("years")},colSpan:"2","data-value":t},t),u.a.createElement("th",{className:"rdtNext",onClick:function(){return e.props.navigate(1,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderMonths",value:function(e){for(var t=[[],[],[]],n=0;n<12;n++)this.getRow(t,n).push(this.renderMonth(n,this.props.selectedDate));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderMonth",value:function(e,t){var n,r="rdtMonth";this.isDisabledMonth(e)?r+=" rdtDisabled":n=this._updateSelectedMonth,t&&t.year()===this.props.viewDate.year()&&t.month()===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderMonth?this.props.renderMonth(o,e,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,this.getMonthText(e))}},{key:"getRow",value:function(e,t){return t<4?e[0]:t<8?e[1]:e[2]}},{key:"capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"isDisabledMonth",value:function(e){var t=this.props.isValidDate;if(!t)return!1;for(var n=this.props.viewDate.clone().set({month:e}),r=n.endOf("month").date()+1;r-- >1;)if(t(n.date(r)))return!1;return!0}},{key:"getMonthText",value:function(e){var t=this.props.viewDate,n=t.localeData().monthsShort(t.month(e));return this.capitalize(n.substring(0,3))}}])&&O(n.prototype,r),o&&O(n,o),t}(u.a.Component);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=function(e){function t(){var e,n;S(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return F(N(n=V(this,(e=T(t)).call.apply(e,[this].concat(o)))),"disabledYearsCache",{}),F(N(n),"_updateSelectedYear",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=10*parseInt(this.props.viewDate.year()/10,10);return u.a.createElement("div",{className:"rdtYears"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader(e))),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderYears(e))))}},{key:"renderHeader",value:function(e){var t=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return t.props.navigate(-10,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return t.props.showView("years")}},"".concat(e,"-").concat(e+9)),u.a.createElement("th",{className:"rdtNext",onClick:function(){return t.props.navigate(10,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderYears",value:function(e){for(var t=[[],[],[]],n=this.props.selectedDate&&this.props.selectedDate.year(),r=e-1;r<e+11;r++)this.getRow(t,r-e).push(this.renderYear(r,n));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderYear",value:function(e,t){var n,r="rdtYear";this.isDisabledYear(e)?r+=" rdtDisabled":n=this._updateSelectedYear,t===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderYear?this.props.renderYear(o,e,this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,e)}},{key:"getRow",value:function(e,t){return t<3?e[0]:t<7?e[1]:e[2]}},{key:"isDisabledYear",value:function(e){var t=this.disabledYearsCache;if(void 0!==t[e])return t[e];var n=this.props.isValidDate;if(!n)return!1;for(var r=this.props.viewDate.clone().set({year:e}),o=r.endOf("year").dayOfYear()+1;o-- >1;)if(n(r.dayOfYear(o)))return t[e]=!1,!1;return t[e]=!0,!0}}])&&j(n.prototype,r),o&&j(n,o),t}(u.a.Component);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},W=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(o=Y(t).call(this,e))||"object"!==M(o)&&"function"!=typeof o?H(r):o,U(H(n),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),n.constraints=n.createConstraints(e),n.state=n.getTimeParts(e.selectedDate||e.viewDate),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),n=t,(r=[{key:"createConstraints",value:function(e){var t={};return Object.keys(Z).forEach((function(n){t[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){U(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Z[n],{},e.timeConstraints[n]||{})})),t}},{key:"render",value:function(){var e=this,t=[],n=this.state;return this.getCounters().forEach((function(r,o){o&&"ampm"!==r&&t.push(u.a.createElement("div",{key:"sep".concat(o),className:"rdtCounterSeparator"},":")),t.push(e.renderCounter(r,n[r]))})),u.a.createElement("div",{className:"rdtTime"},u.a.createElement("table",null,this.renderHeader(),u.a.createElement("tbody",null,u.a.createElement("tr",null,u.a.createElement("td",null,u.a.createElement("div",{className:"rdtCounters"},t))))))}},{key:"renderCounter",value:function(e,t){var n=this;return"hours"===e&&this.isAMPM()&&0==(t=(t-1)%12+1)&&(t=12),"ampm"===e&&-1!==this.props.timeFormat.indexOf(" A")&&(t=t.toUpperCase()),u.a.createElement("div",{key:e,className:"rdtCounter"},u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"increase",e)}},"▲"),u.a.createElement("div",{className:"rdtCount"},t),u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"decrease",e)}},"▼"))}},{key:"renderHeader",value:function(){var e=this;if(this.props.dateFormat){var t=this.props.selectedDate||this.props.viewDate;return u.a.createElement("thead",null,u.a.createElement("tr",null,u.a.createElement("td",{className:"rdtSwitch",colSpan:"4",onClick:function(){return e.props.showView("days")}},t.format(this.props.dateFormat))))}}},{key:"onStartClicking",value:function(e,t,n){var r=this;if(!e||!e.button||0===e.button){if("ampm"===n)return this.toggleDayPart();var o={},a=document.body;o[n]=this[t](n),this.setState(o),this.timer=setTimeout((function(){r.increaseTimer=setInterval((function(){o[n]=r[t](n),r.setState(o)}),70)}),500),this.mouseUpListener=function(){clearTimeout(r.timer),clearInterval(r.increaseTimer),r.props.setTime(n,parseInt(r.state[n],10)),a.removeEventListener("mouseup",r.mouseUpListener),a.removeEventListener("touchend",r.mouseUpListener)},a.addEventListener("mouseup",this.mouseUpListener),a.addEventListener("touchend",this.mouseUpListener)}}},{key:"toggleDayPart",value:function(){var e=parseInt(this.state.hours,10);e>=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)+t.step;return n>t.max&&(n=t.min+(n-(t.max+1))),this.pad(e,n)}},{key:"decrease",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)-t.step;return n<t.min&&(n=t.max+1-(t.min-n)),this.pad(e,n)}},{key:"pad",value:function(e,t){for(var n=t+"";n.length<this.padValues[e];)n="0"+n;return n}},{key:"getCounters",value:function(){var e=[],t=this.props.timeFormat;return-1!==t.toLowerCase().indexOf("h")&&(e.push("hours"),-1!==t.indexOf("m")&&(e.push("minutes"),-1!==t.indexOf("s")&&(e.push("seconds"),-1!==t.indexOf("S")&&e.push("milliseconds")))),this.isAMPM()&&e.push("ampm"),e}},{key:"isAMPM",value:function(){return-1!==this.props.timeFormat.toLowerCase().indexOf(" a")}},{key:"getTimeParts",value:function(e){var t=e.hours();return{hours:this.pad("hours",t),minutes:this.pad("minutes",e.minutes()),seconds:this.pad("seconds",e.seconds()),milliseconds:this.pad("milliseconds",e.milliseconds()),ampm:t<12?"am":"pm"}}},{key:"componentDidUpdate",value:function(e){this.props.selectedDate?this.props.selectedDate!==e.selectedDate&&this.setState(this.getTimeParts(this.props.selectedDate)):e.viewDate!==this.props.viewDate&&this.setState(this.getTimeParts(this.props.viewDate))}}])&&L(n.prototype,r),o&&L(n,o),t}(u.a.Component),B=n(3);function z(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var q,K,X=(void 0===q&&(q=0),function(){return++q}),G={},J={},Q=["touchstart","touchmove"];function $(e,t){var n=null;return-1!==Q.indexOf(t)&&K&&(n={passive:!e.props.preventDefault}),n}var ee=function(e,t){var n,r,o=e.displayName||e.name||"Component";return r=n=function(n){var r,a;function i(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+o+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(B.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!J[r._uid]){void 0===K&&(K=function(){if("undefined"!=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}}()),J[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),G[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(z(e,t,n))return!0;e=e.parentNode}return e}(e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,G[r._uid],$(r,e))}))}},r.disableOnClickOutside=function(){delete J[r._uid];var e=G[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,$(r,t))})),delete G[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=X(),r}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var u=i.prototype;return u.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},u.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+o+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},u.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},u.componentWillUnmount=function(){this.disableOnClickOutside()},u.render=function(){var t=this.props,n=(t.excludeScrollbar,function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(s.createElement)(e,n)},i}(s.Component),n.displayName="OnClickOutside("+o+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r};function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t,n){return t&&oe(e.prototype,t),n&&oe(e,n),e}function ie(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?ue(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return ge}));var fe="years",de="months",me="days",he="time",ye=o.a,ve=function(){},be=ye.oneOfType([ye.instanceOf(i.a),ye.instanceOf(Date),ye.string]),ge=function(e){function t(e){var n;return re(this,t),pe(ue(n=ie(this,se(t).call(this,e))),"_renderCalendar",(function(e){var t=n.props,r={viewDate:n.state.viewDate.clone(),selectedDate:n.getSelectedDate(),isValidDate:t.isValidDate,updateDate:n._updateDate,navigate:n._viewNavigate,moment:i.a,showView:n._showView};switch(e){case fe:return r.renderYear=t.renderYear,u.a.createElement(I,r);case de:return r.renderMonth=t.renderMonth,u.a.createElement(E,r);case me:return r.renderDay=t.renderDay,r.timeFormat=n.getFormat("time"),u.a.createElement(v,r);default:return r.dateFormat=n.getFormat("date"),r.timeFormat=n.getFormat("time"),r.timeConstraints=t.timeConstraints,r.setTime=n._setTime,u.a.createElement(W,r)}})),pe(ue(n),"_showView",(function(e,t){var r=(t||n.state.viewDate).clone(),o=n.props.onBeforeNavigate(e,n.state.currentView,r);o&&n.state.currentView!==o&&(n.props.onNavigate(o),n.setState({currentView:o}))})),pe(ue(n),"viewToMethod",{days:"date",months:"month",years:"year"}),pe(ue(n),"nextView",{days:"time",months:"days",years:"months"}),pe(ue(n),"_updateDate",(function(e){var t=n.state.currentView,r=n.getUpdateOn(n.getFormat("date")),o=n.state.viewDate.clone();o[n.viewToMethod[t]](parseInt(e.target.getAttribute("data-value"),10)),"days"===t&&(o.month(parseInt(e.target.getAttribute("data-month"),10)),o.year(parseInt(e.target.getAttribute("data-year"),10)));var a={viewDate:o};t===r?(a.selectedDate=o.clone(),a.inputValue=o.format(n.getFormat("datetime")),void 0===n.props.open&&n.props.input&&n.props.closeOnSelect&&n._closeCalendar(),n.props.onChange(o.clone())):n._showView(n.nextView[t],o),n.setState(a)})),pe(ue(n),"_viewNavigate",(function(e,t){var r=n.state.viewDate.clone();r.add(e,t),e>0?n.props.onNavigateForward(e,t):n.props.onNavigateBack(-e,t),n.setState({viewDate:r})})),pe(ue(n),"_setTime",(function(e,t){var r=n.state,o=(r.selectedDate||r.viewDate).clone();o[e](t),n.props.value||n.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(n.getFormat("datetime"))}),n.props.onChange(o.clone())})),pe(ue(n),"_openCalendar",(function(){n.isOpen()||n.setState({open:!0},n.props.onOpen)})),pe(ue(n),"_closeCalendar",(function(){n.isOpen()&&n.setState({open:!1},(function(){n.props.onClose(n.state.selectedDate||n.state.inputValue)}))})),pe(ue(n),"_handleClickOutside",(function(){var e=n.props;e.input&&n.state.open&&void 0===e.open&&e.closeOnClickOutside&&n._closeCalendar()})),pe(ue(n),"_onInputFocus",(function(e){n.callHandler(n.props.inputProps.onFocus,e)&&n._openCalendar()})),pe(ue(n),"_onInputChange",(function(e){if(n.callHandler(n.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,r=n.localMoment(t,n.getFormat("datetime")),o={inputValue:t};r.isValid()?(o.selectedDate=r,o.viewDate=r.clone().startOf("month")):o.selectedDate=null,n.setState(o,(function(){n.props.onChange(r.isValid()?r:n.state.inputValue)}))}})),pe(ue(n),"_onInputKeyDown",(function(e){n.callHandler(n.props.inputProps.onKeyDown,e)&&9===e.which&&n.props.closeOnTab&&n._closeCalendar()})),n.state=n.getInitialState(e),n}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement(Oe,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView(this.state.currentView,this._renderCalendar)))}},{key:"renderInput",value:function(){if(this.props.input){var e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){pe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps,{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(e,this._openCalendar,this._closeCalendar)):u.a.createElement("input",e)}}},{key:"renderView",value:function(e,t){return this.props.renderView?this.props.renderView(e,(function(){return t(e)})):t(this.state.currentView)}},{key:"getInitialState",value:function(e){var t=e||this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(t),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(this.getFormat("date")),viewDate:this.getInitialViewDate(t.initialViewDate,r,n),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(t,r,n)}}},{key:"getInitialViewDate",value:function(e,t,n){var r;if(e){if((r=this.parseDate(e,n))&&r.isValid())return r;this.log('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var e=this.localMoment();return e.hour(0).minute(0).second(0).millisecond(0),e}},{key:"getInitialView",value:function(e){return e?this.getUpdateOn(e):he}},{key:"parseDate",value:function(e,t){var n;return e&&"string"==typeof e?n=this.localMoment(e,t):e&&(n=this.localMoment(e)),n&&!n.isValid()&&(n=null),n}},{key:"getClassName",value:function(){var e="rdt",t=this.props,n=t.className;return Array.isArray(n)?e+=" "+n.join(" "):n&&(e+=" "+n),t.input||(e+=" rdtStatic"),this.isOpen()&&(e+=" rdtOpen"),e}},{key:"isOpen",value:function(){return!this.props.input||(void 0===this.props.open?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(e){return this.props.updateOnView?this.props.updateOnView:e.match(/[lLD]/)?me:-1!==e.indexOf("M")?de:-1!==e.indexOf("Y")?fe:me}},{key:"getLocaleData",value:function(e){var t=e||this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(e){var t=this.props.dateFormat;return!0===t?e.longDateFormat("L"):t||""}},{key:"getTimeFormat",value:function(e){var t=this.props.timeFormat;return!0===t?e.longDateFormat("LT"):t||""}},{key:"getFormat",value:function(e){if("date"===e)return this.getDateFormat(this.getLocaleData());if("time"===e)return this.getTimeFormat(this.getLocaleData());var t=this.getLocaleData(),n=this.getDateFormat(t),r=this.getTimeFormat(t);return n&&r?n+" "+r:n||r}},{key:"updateTime",value:function(e,t,n,r){var o={},a=r?"selectedDate":"viewDate";o[a]=this.state[a].clone()[e](t,n),this.setState(o)}},{key:"localMoment",value:function(e,t,n){var r=null;return r=(n=n||this.props).utc?i.a.utc(e,t,n.strictParsing):n.displayTimeZone?i.a.tz(e,t,n.displayTimeZone):i()(e,t,n.strictParsing),n.locale&&r.locale(n.locale),r}},{key:"checkTZ",value:function(e){!e.displayTimeZone||this.tzWarning||i.a.tz||(this.tzWarning=!0,this.log('displayTimeZone prop with value "'+e.displayTimeZone+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(e){if(e!==this.props){var t=!1,n=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach((function(r){e[r]!==n[r]&&(t=!0)})),t&&this.regenerateDates(this.props),this.checkTZ(this.props)}}},{key:"regenerateDates",value:function(e){var t=this.state.viewDate.clone(),n=this.state.selectedDate&&this.state.selectedDate.clone();e.locale&&(t.locale(e.locale),n&&n.locale(e.locale)),e.utc?(t.utc(),n&&n.utc()):e.displayTimeZone?(t.tz(e.displayTimeZone),n&&n.tz(e.displayTimeZone)):(t.locale(),n&&n.locale());var r={viewDate:t,selectedDate:n};n&&n.isValid()&&(r.inputValue=n.format(this.getFormat("datetime"))),this.setState(r)}},{key:"getSelectedDate",value:function(){if(void 0===this.props.value)return this.state.selectedDate;var e=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!e||!e.isValid())&&e}},{key:"getInitialInputValue",value:function(e,t,n){return e.inputProps.value?e.inputProps.value:t&&t.isValid()?t.format(n):e.value&&"string"==typeof e.value?e.value:e.initialValue&&"string"==typeof e.initialValue?e.initialValue:""}},{key:"getInputValue",value:function(){var e=this.getSelectedDate();return e?e.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(e){var t,n=this,r=function(){return n.log("Invalid date passed to the `setViewDate` method: "+e)};return e&&(t="string"==typeof e?this.localMoment(e,this.getFormat("datetime")):this.localMoment(e))&&t.isValid()?void this.setState({viewDate:t}):r()}},{key:"navigate",value:function(e){this.showView(e)()}},{key:"log",value:function(e,t){var n="undefined"!=typeof window&&window.console;n&&(t||(t="warn"),n[t]("***react-datetime:"+e))}},{key:"callHandler",value:function(e,t){return!e||!1!==e(t)}}]),t}(u.a.Component);pe(ge,"propTypes",{value:be,initialValue:be,initialViewDate:be,initialViewMode:ye.oneOf([fe,de,me,he]),onOpen:ye.func,onClose:ye.func,onChange:ye.func,onNavigate:ye.func,onBeforeNavigate:ye.func,onNavigateBack:ye.func,onNavigateForward:ye.func,updateOnView:ye.string,locale:ye.string,utc:ye.bool,displayTimeZone:ye.string,input:ye.bool,dateFormat:ye.oneOfType([ye.string,ye.bool]),timeFormat:ye.oneOfType([ye.string,ye.bool]),inputProps:ye.object,timeConstraints:ye.object,isValidDate:ye.func,open:ye.bool,strictParsing:ye.bool,closeOnSelect:ye.bool,closeOnTab:ye.bool,renderView:ye.func,renderInput:ye.func,renderDay:ye.func,renderMonth:ye.func,renderYear:ye.func}),pe(ge,"defaultProps",{onOpen:ve,onClose:ve,onCalendarOpen:ve,onCalendarClose:ve,onChange:ve,onNavigate:ve,onBeforeNavigate:function(e){return e},onNavigateBack:ve,onNavigateForward:ve,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),pe(ge,"moment",i.a);var Oe=ee(function(e){function t(){return re(this,t),ie(this,se(t).apply(this,arguments))}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement("div",{className:this.props.className},this.props.children)}},{key:"handleClickOutside",value:function(e){this.props.onClickOut(e)}}]),t}(u.a.Component))}]); | ||
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("moment")},function(e,t,n){e.exports=n(5)()},function(e,t){e.exports=require("react-dom")},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";var r=n(6),o=n(7),a=n(8);e.exports=function(){function e(e,t,n,r,i,s){s!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,a,i,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,i,s],l=0;(u=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),a=n(1),i=n.n(a),s=n(0),u=n.n(s);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?h(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;l(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return y(h(n=f(this,(e=d(t)).call.apply(e,[this].concat(o)))),"_setDate",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this.props.viewDate,t=e.localeData(),n=e.clone().startOf("month"),r=e.clone().endOf("month");return u.a.createElement("div",{className:"rdtDays"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderNavigation(e,t),this.renderDayHeaders(t)),u.a.createElement("tbody",null,this.renderDays(e,n,r)),this.renderFooter(e)))}},{key:"renderNavigation",value:function(e,t){var n=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return n.props.navigate(-1,"months")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return n.props.showView("months")},colSpan:5,"data-value":this.props.viewDate.month()},t.months(e)+" "+e.year()),u.a.createElement("th",{className:"rdtNext",onClick:function(){return n.props.navigate(1,"months")}},u.a.createElement("span",null,"›")))}},{key:"renderDayHeaders",value:function(e){var t=this.getDaysOfWeek(e).map((function(e,t){return u.a.createElement("th",{key:e+t,className:"dow"},e)}));return u.a.createElement("tr",null,t)}},{key:"renderDays",value:function(e,t,n){var r=[[],[],[],[],[],[]],o=e.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");for(var a=o.clone().add(42,"d"),i=0;o.isBefore(a);)this.getRow(r,i++).push(this.renderDay(o,t,n)),o.add(1,"d");return r.map((function(e,t){return u.a.createElement("tr",{key:"".concat(a.month(),"_").concat(t)},e)}))}},{key:"renderDay",value:function(e,t,n){var r=this.props.selectedDate,o={key:e.format("M_D"),"data-value":e.date(),"data-month":e.month(),"data-year":e.year()},a="rdtDay";return e.isBefore(t)?a+=" rdtOld":e.isAfter(n)&&(a+=" rdtNew"),r&&e.isSame(r,"day")&&(a+=" rdtActive"),e.isSame(this.props.moment(),"day")&&(a+=" rdtToday"),this.props.isValidDate(e)?o.onClick=this._setDate:a+=" rdtDisabled",o.className=a,this.props.renderDay?this.props.renderDay(o,e.clone(),r&&r.clone()):u.a.createElement("td",o,e.date())}},{key:"renderFooter",value:function(e){var t=this;if(this.props.timeFormat)return u.a.createElement("tfoot",null,u.a.createElement("tr",null,u.a.createElement("td",{onClick:function(){return t.props.showView("time")},colSpan:7,className:"rdtTimeToggle"},e.format(this.props.timeFormat))))}},{key:"getDaysOfWeek",value:function(e){var t=e.firstDayOfWeek(),n=[],r=0;return e._weekdaysMin.forEach((function(e){n[(7+r++-t)%7]=e})),n}},{key:"getRow",value:function(e,t){return e[Math.floor(t/7)]}}])&&p(n.prototype,r),o&&p(n,o),t}(u.a.Component);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?D(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(v,"defaultProps",{isValidDate:function(){return!0}});var E=function(e){function t(){var e,n;g(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _(D(n=w(this,(e=k(t)).call.apply(e,[this].concat(o)))),"_updateSelectedMonth",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){return u.a.createElement("div",{className:"rdtMonths"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader())),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderMonths())))}},{key:"renderHeader",value:function(){var e=this,t=this.props.viewDate.year();return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return e.props.navigate(-1,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return e.props.showView("years")},colSpan:"2","data-value":t},t),u.a.createElement("th",{className:"rdtNext",onClick:function(){return e.props.navigate(1,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderMonths",value:function(e){for(var t=[[],[],[]],n=0;n<12;n++)this.getRow(t,n).push(this.renderMonth(n,this.props.selectedDate));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderMonth",value:function(e,t){var n,r="rdtMonth";this.isDisabledMonth(e)?r+=" rdtDisabled":n=this._updateSelectedMonth,t&&t.year()===this.props.viewDate.year()&&t.month()===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderMonth?this.props.renderMonth(o,e,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,this.getMonthText(e))}},{key:"getRow",value:function(e,t){return t<4?e[0]:t<8?e[1]:e[2]}},{key:"capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"isDisabledMonth",value:function(e){var t=this.props.isValidDate;if(!t)return!1;for(var n=this.props.viewDate.clone().set({month:e}),r=n.endOf("month").date()+1;r-- >1;)if(t(n.date(r)))return!1;return!0}},{key:"getMonthText",value:function(e){var t=this.props.viewDate,n=t.localeData().monthsShort(t.month(e));return this.capitalize(n.substring(0,3))}}])&&O(n.prototype,r),o&&O(n,o),t}(u.a.Component);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=function(e){function t(){var e,n;S(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return F(N(n=V(this,(e=T(t)).call.apply(e,[this].concat(o)))),"disabledYearsCache",{}),F(N(n),"_updateSelectedYear",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=10*parseInt(this.props.viewDate.year()/10,10);return u.a.createElement("div",{className:"rdtYears"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader(e))),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderYears(e))))}},{key:"renderHeader",value:function(e){var t=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return t.props.navigate(-10,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return t.props.showView("years")}},"".concat(e,"-").concat(e+9)),u.a.createElement("th",{className:"rdtNext",onClick:function(){return t.props.navigate(10,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderYears",value:function(e){for(var t=[[],[],[]],n=this.props.selectedDate&&this.props.selectedDate.year(),r=e-1;r<e+11;r++)this.getRow(t,r-e).push(this.renderYear(r,n));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderYear",value:function(e,t){var n,r="rdtYear";this.isDisabledYear(e)?r+=" rdtDisabled":n=this._updateSelectedYear,t===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderYear?this.props.renderYear(o,e,this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,e)}},{key:"getRow",value:function(e,t){return t<3?e[0]:t<7?e[1]:e[2]}},{key:"isDisabledYear",value:function(e){var t=this.disabledYearsCache;if(void 0!==t[e])return t[e];var n=this.props.isValidDate;if(!n)return!1;for(var r=this.props.viewDate.clone().set({year:e}),o=r.endOf("year").dayOfYear()+1;o-- >1;)if(n(r.dayOfYear(o)))return t[e]=!1,!1;return t[e]=!0,!0}}])&&j(n.prototype,r),o&&j(n,o),t}(u.a.Component);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},B=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(o=Y(t).call(this,e))||"object"!==M(o)&&"function"!=typeof o?H(r):o,U(H(n),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),n.constraints=n.createConstraints(e),n.state=n.getTimeParts(e.selectedDate||e.viewDate),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),n=t,(r=[{key:"createConstraints",value:function(e){var t={};return Object.keys(Z).forEach((function(n){t[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){U(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Z[n],{},e.timeConstraints[n]||{})})),t}},{key:"render",value:function(){var e=this,t=[],n=this.state;return this.getCounters().forEach((function(r,o){o&&"ampm"!==r&&t.push(u.a.createElement("div",{key:"sep".concat(o),className:"rdtCounterSeparator"},":")),t.push(e.renderCounter(r,n[r]))})),u.a.createElement("div",{className:"rdtTime"},u.a.createElement("table",null,this.renderHeader(),u.a.createElement("tbody",null,u.a.createElement("tr",null,u.a.createElement("td",null,u.a.createElement("div",{className:"rdtCounters"},t))))))}},{key:"renderCounter",value:function(e,t){var n=this;return"hours"===e&&this.isAMPM()&&0==(t=(t-1)%12+1)&&(t=12),"ampm"===e&&-1!==this.props.timeFormat.indexOf(" A")&&(t=t.toUpperCase()),u.a.createElement("div",{key:e,className:"rdtCounter"},u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"increase",e)}},"▲"),u.a.createElement("div",{className:"rdtCount"},t),u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"decrease",e)}},"▼"))}},{key:"renderHeader",value:function(){var e=this;if(this.props.dateFormat){var t=this.props.selectedDate||this.props.viewDate;return u.a.createElement("thead",null,u.a.createElement("tr",null,u.a.createElement("td",{className:"rdtSwitch",colSpan:"4",onClick:function(){return e.props.showView("days")}},t.format(this.props.dateFormat))))}}},{key:"onStartClicking",value:function(e,t,n){var r=this;if(!e||!e.button||0===e.button){if("ampm"===n)return this.toggleDayPart();var o={},a=document.body;o[n]=this[t](n),this.setState(o),this.timer=setTimeout((function(){r.increaseTimer=setInterval((function(){o[n]=r[t](n),r.setState(o)}),70)}),500),this.mouseUpListener=function(){clearTimeout(r.timer),clearInterval(r.increaseTimer),r.props.setTime(n,parseInt(r.state[n],10)),a.removeEventListener("mouseup",r.mouseUpListener),a.removeEventListener("touchend",r.mouseUpListener)},a.addEventListener("mouseup",this.mouseUpListener),a.addEventListener("touchend",this.mouseUpListener)}}},{key:"toggleDayPart",value:function(){var e=parseInt(this.state.hours,10);e>=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)+t.step;return n>t.max&&(n=t.min+(n-(t.max+1))),this.pad(e,n)}},{key:"decrease",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)-t.step;return n<t.min&&(n=t.max+1-(t.min-n)),this.pad(e,n)}},{key:"pad",value:function(e,t){for(var n=t+"";n.length<this.padValues[e];)n="0"+n;return n}},{key:"getCounters",value:function(){var e=[],t=this.props.timeFormat;return-1!==t.toLowerCase().indexOf("h")&&(e.push("hours"),-1!==t.indexOf("m")&&(e.push("minutes"),-1!==t.indexOf("s")&&(e.push("seconds"),-1!==t.indexOf("S")&&e.push("milliseconds")))),this.isAMPM()&&e.push("ampm"),e}},{key:"isAMPM",value:function(){return-1!==this.props.timeFormat.toLowerCase().indexOf(" a")}},{key:"getTimeParts",value:function(e){var t=e.hours();return{hours:this.pad("hours",t),minutes:this.pad("minutes",e.minutes()),seconds:this.pad("seconds",e.seconds()),milliseconds:this.pad("milliseconds",e.milliseconds()),ampm:t<12?"am":"pm"}}},{key:"componentDidUpdate",value:function(e){this.props.selectedDate?this.props.selectedDate!==e.selectedDate&&this.setState(this.getTimeParts(this.props.selectedDate)):e.viewDate!==this.props.viewDate&&this.setState(this.getTimeParts(this.props.viewDate))}}])&&L(n.prototype,r),o&&L(n,o),t}(u.a.Component),W=n(3);function z(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var q,K,X=(void 0===q&&(q=0),function(){return++q}),G={},J={},Q=["touchstart","touchmove"];function $(e,t){var n=null;return-1!==Q.indexOf(t)&&K&&(n={passive:!e.props.preventDefault}),n}var ee=function(e,t){var n,r,o=e.displayName||e.name||"Component";return r=n=function(n){var r,a;function i(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+o+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(W.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!J[r._uid]){void 0===K&&(K=function(){if("undefined"!=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}}()),J[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),G[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(z(e,t,n))return!0;e=e.parentNode}return e}(e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,G[r._uid],$(r,e))}))}},r.disableOnClickOutside=function(){delete J[r._uid];var e=G[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,$(r,t))})),delete G[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=X(),r}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var u=i.prototype;return u.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},u.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+o+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},u.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},u.componentWillUnmount=function(){this.disableOnClickOutside()},u.render=function(){var t=this.props,n=(t.excludeScrollbar,function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(s.createElement)(e,n)},i}(s.Component),n.displayName="OnClickOutside("+o+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r};function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t,n){return t&&oe(e.prototype,t),n&&oe(e,n),e}function ie(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?ue(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return ge}));var fe="years",de="months",he="days",me="time",ye=o.a,ve=function(){},be=ye.oneOfType([ye.instanceOf(i.a),ye.instanceOf(Date),ye.string]),ge=function(e){function t(e){var n;return re(this,t),pe(ue(n=ie(this,se(t).call(this,e))),"_renderCalendar",(function(e){var t=n.props,r={viewDate:n.state.viewDate.clone(),selectedDate:n.getSelectedDate(),isValidDate:t.isValidDate,updateDate:n._updateDate,navigate:n._viewNavigate,moment:i.a,showView:n._showView};switch(e){case fe:return r.renderYear=t.renderYear,u.a.createElement(I,r);case de:return r.renderMonth=t.renderMonth,u.a.createElement(E,r);case he:return r.renderDay=t.renderDay,r.timeFormat=n.getFormat("time"),u.a.createElement(v,r);default:return r.dateFormat=n.getFormat("date"),r.timeFormat=n.getFormat("time"),r.timeConstraints=t.timeConstraints,r.setTime=n._setTime,u.a.createElement(B,r)}})),pe(ue(n),"_showView",(function(e,t){var r=(t||n.state.viewDate).clone(),o=n.props.onBeforeNavigate(e,n.state.currentView,r);o&&n.state.currentView!==o&&(n.props.onNavigate(o),n.setState({currentView:o}))})),pe(ue(n),"viewToMethod",{days:"date",months:"month",years:"year"}),pe(ue(n),"nextView",{days:"time",months:"days",years:"months"}),pe(ue(n),"_updateDate",(function(e){var t=n.state.currentView,r=n.getUpdateOn(n.getFormat("date")),o=n.state.viewDate.clone();o[n.viewToMethod[t]](parseInt(e.target.getAttribute("data-value"),10)),"days"===t&&(o.month(parseInt(e.target.getAttribute("data-month"),10)),o.year(parseInt(e.target.getAttribute("data-year"),10)));var a={viewDate:o};t===r?(a.selectedDate=o.clone(),a.inputValue=o.format(n.getFormat("datetime")),void 0===n.props.open&&n.props.input&&n.props.closeOnSelect&&n._closeCalendar(),n.props.onChange(o.clone())):n._showView(n.nextView[t],o),n.setState(a)})),pe(ue(n),"_viewNavigate",(function(e,t){var r=n.state.viewDate.clone();r.add(e,t),e>0?n.props.onNavigateForward(e,t):n.props.onNavigateBack(-e,t),n.setState({viewDate:r})})),pe(ue(n),"_setTime",(function(e,t){var r=n.state,o=(r.selectedDate||r.viewDate).clone();o[e](t),n.props.value||n.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(n.getFormat("datetime"))}),n.props.onChange(o.clone())})),pe(ue(n),"_openCalendar",(function(){n.isOpen()||n.setState({open:!0},n.props.onOpen)})),pe(ue(n),"_closeCalendar",(function(){n.isOpen()&&n.setState({open:!1},(function(){n.props.onClose(n.state.selectedDate||n.state.inputValue)}))})),pe(ue(n),"_handleClickOutside",(function(){var e=n.props;e.input&&n.state.open&&void 0===e.open&&e.closeOnClickOutside&&n._closeCalendar()})),pe(ue(n),"_onInputFocus",(function(e){n.callHandler(n.props.inputProps.onFocus,e)&&n._openCalendar()})),pe(ue(n),"_onInputChange",(function(e){if(n.callHandler(n.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,r=n.localMoment(t,n.getFormat("datetime")),o={inputValue:t};r.isValid()?(o.selectedDate=r,o.viewDate=r.clone().startOf("month")):o.selectedDate=null,n.setState(o,(function(){n.props.onChange(r.isValid()?r:n.state.inputValue)}))}})),pe(ue(n),"_onInputKeyDown",(function(e){n.callHandler(n.props.inputProps.onKeyDown,e)&&9===e.which&&n.props.closeOnTab&&n._closeCalendar()})),n.state=n.getInitialState(e),n}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement(Oe,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView(this.state.currentView,this._renderCalendar)))}},{key:"renderInput",value:function(){if(this.props.input){var e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){pe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps,{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(e,this._openCalendar,this._closeCalendar)):u.a.createElement("input",e)}}},{key:"renderView",value:function(e,t){return this.props.renderView?this.props.renderView(e,(function(){return t(e)})):t(this.state.currentView)}},{key:"getInitialState",value:function(e){var t=e||this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(t),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(this.getFormat("date")),viewDate:this.getInitialViewDate(t.initialViewDate,r,n),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(t,r,n)}}},{key:"getInitialViewDate",value:function(e,t,n){var r;if(e){if((r=this.parseDate(e,n))&&r.isValid())return r;this.log('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var e=this.localMoment();return e.hour(0).minute(0).second(0).millisecond(0),e}},{key:"getInitialView",value:function(e){return e?this.getUpdateOn(e):me}},{key:"parseDate",value:function(e,t){var n;return e&&"string"==typeof e?n=this.localMoment(e,t):e&&(n=this.localMoment(e)),n&&!n.isValid()&&(n=null),n}},{key:"getClassName",value:function(){var e="rdt",t=this.props,n=t.className;return Array.isArray(n)?e+=" "+n.join(" "):n&&(e+=" "+n),t.input||(e+=" rdtStatic"),this.isOpen()&&(e+=" rdtOpen"),e}},{key:"isOpen",value:function(){return!this.props.input||(void 0===this.props.open?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(e){return this.props.updateOnView?this.props.updateOnView:e.match(/[lLD]/)?he:-1!==e.indexOf("M")?de:-1!==e.indexOf("Y")?fe:he}},{key:"getLocaleData",value:function(e){var t=e||this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(e){var t=this.props.dateFormat;return!0===t?e.longDateFormat("L"):t||""}},{key:"getTimeFormat",value:function(e){var t=this.props.timeFormat;return!0===t?e.longDateFormat("LT"):t||""}},{key:"getFormat",value:function(e){if("date"===e)return this.getDateFormat(this.getLocaleData());if("time"===e)return this.getTimeFormat(this.getLocaleData());var t=this.getLocaleData(),n=this.getDateFormat(t),r=this.getTimeFormat(t);return n&&r?n+" "+r:n||r}},{key:"updateTime",value:function(e,t,n,r){var o={},a=r?"selectedDate":"viewDate";o[a]=this.state[a].clone()[e](t,n),this.setState(o)}},{key:"localMoment",value:function(e,t,n){var r=null;return r=(n=n||this.props).utc?i.a.utc(e,t,n.strictParsing):n.displayTimeZone?i.a.tz(e,t,n.displayTimeZone):i()(e,t,n.strictParsing),n.locale&&r.locale(n.locale),r}},{key:"checkTZ",value:function(e){!e.displayTimeZone||this.tzWarning||i.a.tz||(this.tzWarning=!0,this.log('displayTimeZone prop with value "'+e.displayTimeZone+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(e){if(e!==this.props){var t=!1,n=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach((function(r){e[r]!==n[r]&&(t=!0)})),t&&this.regenerateDates(this.props),this.checkTZ(this.props)}}},{key:"regenerateDates",value:function(e){var t=this.state.viewDate.clone(),n=this.state.selectedDate&&this.state.selectedDate.clone();e.locale&&(t.locale(e.locale),n&&n.locale(e.locale)),e.utc?(t.utc(),n&&n.utc()):e.displayTimeZone?(t.tz(e.displayTimeZone),n&&n.tz(e.displayTimeZone)):(t.locale(),n&&n.locale());var r={viewDate:t,selectedDate:n};n&&n.isValid()&&(r.inputValue=n.format(this.getFormat("datetime"))),this.setState(r)}},{key:"getSelectedDate",value:function(){if(void 0===this.props.value)return this.state.selectedDate;var e=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!e||!e.isValid())&&e}},{key:"getInitialInputValue",value:function(e,t,n){return e.inputProps.value?e.inputProps.value:t&&t.isValid()?t.format(n):e.value&&"string"==typeof e.value?e.value:e.initialValue&&"string"==typeof e.initialValue?e.initialValue:""}},{key:"getInputValue",value:function(){var e=this.getSelectedDate();return e?e.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(e){var t,n=this,r=function(){return n.log("Invalid date passed to the `setViewDate` method: "+e)};return e&&(t="string"==typeof e?this.localMoment(e,this.getFormat("datetime")):this.localMoment(e))&&t.isValid()?void this.setState({viewDate:t}):r()}},{key:"navigate",value:function(e){this.showView(e)()}},{key:"log",value:function(e,t){var n="undefined"!=typeof window&&window.console;n&&(t||(t="warn"),n[t]("***react-datetime:"+e))}},{key:"callHandler",value:function(e,t){return!e||!1!==e(t)}}]),t}(u.a.Component);pe(ge,"propTypes",{value:be,initialValue:be,initialViewDate:be,initialViewMode:ye.oneOf([fe,de,he,me]),onOpen:ye.func,onClose:ye.func,onChange:ye.func,onNavigate:ye.func,onBeforeNavigate:ye.func,onNavigateBack:ye.func,onNavigateForward:ye.func,updateOnView:ye.string,locale:ye.string,utc:ye.bool,displayTimeZone:ye.string,input:ye.bool,dateFormat:ye.oneOfType([ye.string,ye.bool]),timeFormat:ye.oneOfType([ye.string,ye.bool]),inputProps:ye.object,timeConstraints:ye.object,isValidDate:ye.func,open:ye.bool,strictParsing:ye.bool,closeOnSelect:ye.bool,closeOnTab:ye.bool,renderView:ye.func,renderInput:ye.func,renderDay:ye.func,renderMonth:ye.func,renderYear:ye.func}),pe(ge,"defaultProps",{onOpen:ve,onClose:ve,onCalendarOpen:ve,onCalendarClose:ve,onChange:ve,onNavigate:ve,onBeforeNavigate:function(e){return e},onNavigateBack:ve,onNavigateForward:ve,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),pe(ge,"moment",i.a);var Oe=ee(function(e){function t(){return re(this,t),ie(this,se(t).apply(this,arguments))}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement("div",{className:this.props.className},this.props.children)}},{key:"handleClickOutside",value:function(e){this.props.onClickOut(e)}}]),t}(u.a.Component))}]); | ||
//# sourceMappingURL=react-datetime.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","moment","react-dom"],t):"object"==typeof exports?exports.Datetime=t(require("react"),require("moment"),require("react-dom")):e.Datetime=t(e.react,e.moment,e["react-dom"])}(window,(function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){e.exports=n(5)()},function(e,t){e.exports=n},function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";var r=n(6);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),a=n(1),i=n.n(a),s=n(0),u=n.n(s);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?m(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;l(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return y(m(n=f(this,(e=d(t)).call.apply(e,[this].concat(o)))),"_setDate",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this.props.viewDate,t=e.localeData(),n=e.clone().startOf("month"),r=e.clone().endOf("month");return u.a.createElement("div",{className:"rdtDays"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderNavigation(e,t),this.renderDayHeaders(t)),u.a.createElement("tbody",null,this.renderDays(e,n,r)),this.renderFooter(e)))}},{key:"renderNavigation",value:function(e,t){var n=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return n.props.navigate(-1,"months")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return n.props.showView("months")},colSpan:5,"data-value":this.props.viewDate.month()},t.months(e)+" "+e.year()),u.a.createElement("th",{className:"rdtNext",onClick:function(){return n.props.navigate(1,"months")}},u.a.createElement("span",null,"›")))}},{key:"renderDayHeaders",value:function(e){var t=this.getDaysOfWeek(e).map((function(e,t){return u.a.createElement("th",{key:e+t,className:"dow"},e)}));return u.a.createElement("tr",null,t)}},{key:"renderDays",value:function(e,t,n){var r=[[],[],[],[],[],[]],o=e.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");for(var a=o.clone().add(42,"d"),i=0;o.isBefore(a);)this.getRow(r,i++).push(this.renderDay(o,t,n)),o.add(1,"d");return r.map((function(e,t){return u.a.createElement("tr",{key:"".concat(a.month(),"_").concat(t)},e)}))}},{key:"renderDay",value:function(e,t,n){var r=this.props.selectedDate,o={key:e.format("M_D"),"data-value":e.date(),"data-month":e.month(),"data-year":e.year()},a="rdtDay";return e.isBefore(t)?a+=" rdtOld":e.isAfter(n)&&(a+=" rdtNew"),r&&e.isSame(r,"day")&&(a+=" rdtActive"),e.isSame(this.props.moment(),"day")&&(a+=" rdtToday"),this.props.isValidDate(e)?o.onClick=this._setDate:a+=" rdtDisabled",o.className=a,this.props.renderDay?this.props.renderDay(o,e.clone(),r&&r.clone()):u.a.createElement("td",o,e.date())}},{key:"renderFooter",value:function(e){var t=this;if(this.props.timeFormat)return u.a.createElement("tfoot",null,u.a.createElement("tr",null,u.a.createElement("td",{onClick:function(){return t.props.showView("time")},colSpan:7,className:"rdtTimeToggle"},e.format(this.props.timeFormat))))}},{key:"getDaysOfWeek",value:function(e){var t=e.firstDayOfWeek(),n=[],r=0;return e._weekdaysMin.forEach((function(e){n[(7+r++-t)%7]=e})),n}},{key:"getRow",value:function(e,t){return e[Math.floor(t/7)]}}])&&p(n.prototype,r),o&&p(n,o),t}(u.a.Component);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?k(e):t}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(v,"defaultProps",{isValidDate:function(){return!0}});var E=function(e){function t(){var e,n;g(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _(k(n=w(this,(e=D(t)).call.apply(e,[this].concat(o)))),"_updateSelectedMonth",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){return u.a.createElement("div",{className:"rdtMonths"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader())),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderMonths())))}},{key:"renderHeader",value:function(){var e=this,t=this.props.viewDate.year();return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return e.props.navigate(-1,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return e.props.showView("years")},colSpan:"2","data-value":t},t),u.a.createElement("th",{className:"rdtNext",onClick:function(){return e.props.navigate(1,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderMonths",value:function(e){for(var t=[[],[],[]],n=0;n<12;n++)this.getRow(t,n).push(this.renderMonth(n,this.props.selectedDate));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderMonth",value:function(e,t){var n,r="rdtMonth";this.isDisabledMonth(e)?r+=" rdtDisabled":n=this._updateSelectedMonth,t&&t.year()===this.props.viewDate.year()&&t.month()===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderMonth?this.props.renderMonth(o,e,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,this.getMonthText(e))}},{key:"getRow",value:function(e,t){return t<4?e[0]:t<8?e[1]:e[2]}},{key:"capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"isDisabledMonth",value:function(e){var t=this.props.isValidDate;if(!t)return!1;for(var n=this.props.viewDate.clone().set({month:e}),r=n.endOf("month").date()+1;r-- >1;)if(t(n.date(r)))return!1;return!0}},{key:"getMonthText",value:function(e){var t=this.props.viewDate,n=t.localeData().monthsShort(t.month(e));return this.capitalize(n.substring(0,3))}}])&&O(n.prototype,r),o&&O(n,o),t}(u.a.Component);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=function(e){function t(){var e,n;S(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return F(N(n=V(this,(e=T(t)).call.apply(e,[this].concat(o)))),"disabledYearsCache",{}),F(N(n),"_updateSelectedYear",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=10*parseInt(this.props.viewDate.year()/10,10);return u.a.createElement("div",{className:"rdtYears"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader(e))),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderYears(e))))}},{key:"renderHeader",value:function(e){var t=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return t.props.navigate(-10,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return t.props.showView("years")}},"".concat(e,"-").concat(e+9)),u.a.createElement("th",{className:"rdtNext",onClick:function(){return t.props.navigate(10,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderYears",value:function(e){for(var t=[[],[],[]],n=this.props.selectedDate&&this.props.selectedDate.year(),r=e-1;r<e+11;r++)this.getRow(t,r-e).push(this.renderYear(r,n));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderYear",value:function(e,t){var n,r="rdtYear";this.isDisabledYear(e)?r+=" rdtDisabled":n=this._updateSelectedYear,t===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderYear?this.props.renderYear(o,e,this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,e)}},{key:"getRow",value:function(e,t){return t<3?e[0]:t<7?e[1]:e[2]}},{key:"isDisabledYear",value:function(e){var t=this.disabledYearsCache;if(void 0!==t[e])return t[e];var n=this.props.isValidDate;if(!n)return!1;for(var r=this.props.viewDate.clone().set({year:e}),o=r.endOf("year").dayOfYear()+1;o-- >1;)if(n(r.dayOfYear(o)))return t[e]=!1,!1;return t[e]=!0,!0}}])&&j(n.prototype,r),o&&j(n,o),t}(u.a.Component);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},W=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(o=Y(t).call(this,e))||"object"!==M(o)&&"function"!=typeof o?H(r):o,U(H(n),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),n.constraints=n.createConstraints(e),n.state=n.getTimeParts(e.selectedDate||e.viewDate),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),n=t,(r=[{key:"createConstraints",value:function(e){var t={};return Object.keys(Z).forEach((function(n){t[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){U(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Z[n],{},e.timeConstraints[n]||{})})),t}},{key:"render",value:function(){var e=this,t=[],n=this.state;return this.getCounters().forEach((function(r,o){o&&"ampm"!==r&&t.push(u.a.createElement("div",{key:"sep".concat(o),className:"rdtCounterSeparator"},":")),t.push(e.renderCounter(r,n[r]))})),u.a.createElement("div",{className:"rdtTime"},u.a.createElement("table",null,this.renderHeader(),u.a.createElement("tbody",null,u.a.createElement("tr",null,u.a.createElement("td",null,u.a.createElement("div",{className:"rdtCounters"},t))))))}},{key:"renderCounter",value:function(e,t){var n=this;return"hours"===e&&this.isAMPM()&&0==(t=(t-1)%12+1)&&(t=12),"ampm"===e&&-1!==this.props.timeFormat.indexOf(" A")&&(t=t.toUpperCase()),u.a.createElement("div",{key:e,className:"rdtCounter"},u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"increase",e)}},"▲"),u.a.createElement("div",{className:"rdtCount"},t),u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"decrease",e)}},"▼"))}},{key:"renderHeader",value:function(){var e=this;if(this.props.dateFormat){var t=this.props.selectedDate||this.props.viewDate;return u.a.createElement("thead",null,u.a.createElement("tr",null,u.a.createElement("td",{className:"rdtSwitch",colSpan:"4",onClick:function(){return e.props.showView("days")}},t.format(this.props.dateFormat))))}}},{key:"onStartClicking",value:function(e,t,n){var r=this;if(!e||!e.button||0===e.button){if("ampm"===n)return this.toggleDayPart();var o={},a=document.body;o[n]=this[t](n),this.setState(o),this.timer=setTimeout((function(){r.increaseTimer=setInterval((function(){o[n]=r[t](n),r.setState(o)}),70)}),500),this.mouseUpListener=function(){clearTimeout(r.timer),clearInterval(r.increaseTimer),r.props.setTime(n,parseInt(r.state[n],10)),a.removeEventListener("mouseup",r.mouseUpListener),a.removeEventListener("touchend",r.mouseUpListener)},a.addEventListener("mouseup",this.mouseUpListener),a.addEventListener("touchend",this.mouseUpListener)}}},{key:"toggleDayPart",value:function(){var e=parseInt(this.state.hours,10);e>=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)+t.step;return n>t.max&&(n=t.min+(n-(t.max+1))),this.pad(e,n)}},{key:"decrease",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)-t.step;return n<t.min&&(n=t.max+1-(t.min-n)),this.pad(e,n)}},{key:"pad",value:function(e,t){for(var n=t+"";n.length<this.padValues[e];)n="0"+n;return n}},{key:"getCounters",value:function(){var e=[],t=this.props.timeFormat;return-1!==t.toLowerCase().indexOf("h")&&(e.push("hours"),-1!==t.indexOf("m")&&(e.push("minutes"),-1!==t.indexOf("s")&&(e.push("seconds"),-1!==t.indexOf("S")&&e.push("milliseconds")))),this.isAMPM()&&e.push("ampm"),e}},{key:"isAMPM",value:function(){return-1!==this.props.timeFormat.toLowerCase().indexOf(" a")}},{key:"getTimeParts",value:function(e){var t=e.hours();return{hours:this.pad("hours",t),minutes:this.pad("minutes",e.minutes()),seconds:this.pad("seconds",e.seconds()),milliseconds:this.pad("milliseconds",e.milliseconds()),ampm:t<12?"am":"pm"}}},{key:"componentDidUpdate",value:function(e){this.props.selectedDate?this.props.selectedDate!==e.selectedDate&&this.setState(this.getTimeParts(this.props.selectedDate)):e.viewDate!==this.props.viewDate&&this.setState(this.getTimeParts(this.props.viewDate))}}])&&L(n.prototype,r),o&&L(n,o),t}(u.a.Component),B=n(3);function z(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var q,K,X=(void 0===q&&(q=0),function(){return++q}),G={},J={},Q=["touchstart","touchmove"];function $(e,t){var n=null;return-1!==Q.indexOf(t)&&K&&(n={passive:!e.props.preventDefault}),n}var ee=function(e,t){var n,r,o=e.displayName||e.name||"Component";return r=n=function(n){var r,a;function i(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+o+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(B.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!J[r._uid]){void 0===K&&(K=function(){if("undefined"!=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}}()),J[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),G[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(z(e,t,n))return!0;e=e.parentNode}return e}(e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,G[r._uid],$(r,e))}))}},r.disableOnClickOutside=function(){delete J[r._uid];var e=G[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,$(r,t))})),delete G[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=X(),r}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var u=i.prototype;return u.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},u.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+o+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},u.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},u.componentWillUnmount=function(){this.disableOnClickOutside()},u.render=function(){var t=this.props,n=(t.excludeScrollbar,function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(s.createElement)(e,n)},i}(s.Component),n.displayName="OnClickOutside("+o+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r};function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t,n){return t&&oe(e.prototype,t),n&&oe(e,n),e}function ie(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?ue(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return ge}));var fe="years",de="months",me="days",he="time",ye=o.a,ve=function(){},be=ye.oneOfType([ye.instanceOf(i.a),ye.instanceOf(Date),ye.string]),ge=function(e){function t(e){var n;return re(this,t),pe(ue(n=ie(this,se(t).call(this,e))),"_renderCalendar",(function(e){var t=n.props,r={viewDate:n.state.viewDate.clone(),selectedDate:n.getSelectedDate(),isValidDate:t.isValidDate,updateDate:n._updateDate,navigate:n._viewNavigate,moment:i.a,showView:n._showView};switch(e){case fe:return r.renderYear=t.renderYear,u.a.createElement(I,r);case de:return r.renderMonth=t.renderMonth,u.a.createElement(E,r);case me:return r.renderDay=t.renderDay,r.timeFormat=n.getFormat("time"),u.a.createElement(v,r);default:return r.dateFormat=n.getFormat("date"),r.timeFormat=n.getFormat("time"),r.timeConstraints=t.timeConstraints,r.setTime=n._setTime,u.a.createElement(W,r)}})),pe(ue(n),"_showView",(function(e,t){var r=(t||n.state.viewDate).clone(),o=n.props.onBeforeNavigate(e,n.state.currentView,r);o&&n.state.currentView!==o&&(n.props.onNavigate(o),n.setState({currentView:o}))})),pe(ue(n),"viewToMethod",{days:"date",months:"month",years:"year"}),pe(ue(n),"nextView",{days:"time",months:"days",years:"months"}),pe(ue(n),"_updateDate",(function(e){var t=n.state.currentView,r=n.getUpdateOn(n.getFormat("date")),o=n.state.viewDate.clone();o[n.viewToMethod[t]](parseInt(e.target.getAttribute("data-value"),10)),"days"===t&&(o.month(parseInt(e.target.getAttribute("data-month"),10)),o.year(parseInt(e.target.getAttribute("data-year"),10)));var a={viewDate:o};t===r?(a.selectedDate=o.clone(),a.inputValue=o.format(n.getFormat("datetime")),void 0===n.props.open&&n.props.input&&n.props.closeOnSelect&&n._closeCalendar(),n.props.onChange(o.clone())):n._showView(n.nextView[t],o),n.setState(a)})),pe(ue(n),"_viewNavigate",(function(e,t){var r=n.state.viewDate.clone();r.add(e,t),e>0?n.props.onNavigateForward(e,t):n.props.onNavigateBack(-e,t),n.setState({viewDate:r})})),pe(ue(n),"_setTime",(function(e,t){var r=n.state,o=(r.selectedDate||r.viewDate).clone();o[e](t),n.props.value||n.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(n.getFormat("datetime"))}),n.props.onChange(o.clone())})),pe(ue(n),"_openCalendar",(function(){n.isOpen()||n.setState({open:!0},n.props.onOpen)})),pe(ue(n),"_closeCalendar",(function(){n.isOpen()&&n.setState({open:!1},(function(){n.props.onClose(n.state.selectedDate||n.state.inputValue)}))})),pe(ue(n),"_handleClickOutside",(function(){var e=n.props;e.input&&n.state.open&&void 0===e.open&&e.closeOnClickOutside&&n._closeCalendar()})),pe(ue(n),"_onInputFocus",(function(e){n.callHandler(n.props.inputProps.onFocus,e)&&n._openCalendar()})),pe(ue(n),"_onInputChange",(function(e){if(n.callHandler(n.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,r=n.localMoment(t,n.getFormat("datetime")),o={inputValue:t};r.isValid()?(o.selectedDate=r,o.viewDate=r.clone().startOf("month")):o.selectedDate=null,n.setState(o,(function(){n.props.onChange(r.isValid()?r:n.state.inputValue)}))}})),pe(ue(n),"_onInputKeyDown",(function(e){n.callHandler(n.props.inputProps.onKeyDown,e)&&9===e.which&&n.props.closeOnTab&&n._closeCalendar()})),n.state=n.getInitialState(e),n}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement(Oe,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView(this.state.currentView,this._renderCalendar)))}},{key:"renderInput",value:function(){if(this.props.input){var e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){pe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps,{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(e,this._openCalendar,this._closeCalendar)):u.a.createElement("input",e)}}},{key:"renderView",value:function(e,t){return this.props.renderView?this.props.renderView(e,(function(){return t(e)})):t(this.state.currentView)}},{key:"getInitialState",value:function(e){var t=e||this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(t),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(this.getFormat("date")),viewDate:this.getInitialViewDate(t.initialViewDate,r,n),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(t,r,n)}}},{key:"getInitialViewDate",value:function(e,t,n){var r;if(e){if((r=this.parseDate(e,n))&&r.isValid())return r;this.log('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var e=this.localMoment();return e.hour(0).minute(0).second(0).millisecond(0),e}},{key:"getInitialView",value:function(e){return e?this.getUpdateOn(e):he}},{key:"parseDate",value:function(e,t){var n;return e&&"string"==typeof e?n=this.localMoment(e,t):e&&(n=this.localMoment(e)),n&&!n.isValid()&&(n=null),n}},{key:"getClassName",value:function(){var e="rdt",t=this.props,n=t.className;return Array.isArray(n)?e+=" "+n.join(" "):n&&(e+=" "+n),t.input||(e+=" rdtStatic"),this.isOpen()&&(e+=" rdtOpen"),e}},{key:"isOpen",value:function(){return!this.props.input||(void 0===this.props.open?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(e){return this.props.updateOnView?this.props.updateOnView:e.match(/[lLD]/)?me:-1!==e.indexOf("M")?de:-1!==e.indexOf("Y")?fe:me}},{key:"getLocaleData",value:function(e){var t=e||this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(e){var t=this.props.dateFormat;return!0===t?e.longDateFormat("L"):t||""}},{key:"getTimeFormat",value:function(e){var t=this.props.timeFormat;return!0===t?e.longDateFormat("LT"):t||""}},{key:"getFormat",value:function(e){if("date"===e)return this.getDateFormat(this.getLocaleData());if("time"===e)return this.getTimeFormat(this.getLocaleData());var t=this.getLocaleData(),n=this.getDateFormat(t),r=this.getTimeFormat(t);return n&&r?n+" "+r:n||r}},{key:"updateTime",value:function(e,t,n,r){var o={},a=r?"selectedDate":"viewDate";o[a]=this.state[a].clone()[e](t,n),this.setState(o)}},{key:"localMoment",value:function(e,t,n){var r=null;return r=(n=n||this.props).utc?i.a.utc(e,t,n.strictParsing):n.displayTimeZone?i.a.tz(e,t,n.displayTimeZone):i()(e,t,n.strictParsing),n.locale&&r.locale(n.locale),r}},{key:"checkTZ",value:function(e){!e.displayTimeZone||this.tzWarning||i.a.tz||(this.tzWarning=!0,this.log('displayTimeZone prop with value "'+e.displayTimeZone+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(e){if(e!==this.props){var t=!1,n=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach((function(r){e[r]!==n[r]&&(t=!0)})),t&&this.regenerateDates(this.props),this.checkTZ(this.props)}}},{key:"regenerateDates",value:function(e){var t=this.state.viewDate.clone(),n=this.state.selectedDate&&this.state.selectedDate.clone();e.locale&&(t.locale(e.locale),n&&n.locale(e.locale)),e.utc?(t.utc(),n&&n.utc()):e.displayTimeZone?(t.tz(e.displayTimeZone),n&&n.tz(e.displayTimeZone)):(t.locale(),n&&n.locale());var r={viewDate:t,selectedDate:n};n&&n.isValid()&&(r.inputValue=n.format(this.getFormat("datetime"))),this.setState(r)}},{key:"getSelectedDate",value:function(){if(void 0===this.props.value)return this.state.selectedDate;var e=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!e||!e.isValid())&&e}},{key:"getInitialInputValue",value:function(e,t,n){return e.inputProps.value?e.inputProps.value:t&&t.isValid()?t.format(n):e.value&&"string"==typeof e.value?e.value:e.initialValue&&"string"==typeof e.initialValue?e.initialValue:""}},{key:"getInputValue",value:function(){var e=this.getSelectedDate();return e?e.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(e){var t,n=this,r=function(){return n.log("Invalid date passed to the `setViewDate` method: "+e)};return e&&(t="string"==typeof e?this.localMoment(e,this.getFormat("datetime")):this.localMoment(e))&&t.isValid()?void this.setState({viewDate:t}):r()}},{key:"navigate",value:function(e){this.showView(e)()}},{key:"log",value:function(e,t){var n="undefined"!=typeof window&&window.console;n&&(t||(t="warn"),n[t]("***react-datetime:"+e))}},{key:"callHandler",value:function(e,t){return!e||!1!==e(t)}}]),t}(u.a.Component);pe(ge,"propTypes",{value:be,initialValue:be,initialViewDate:be,initialViewMode:ye.oneOf([fe,de,me,he]),onOpen:ye.func,onClose:ye.func,onChange:ye.func,onNavigate:ye.func,onBeforeNavigate:ye.func,onNavigateBack:ye.func,onNavigateForward:ye.func,updateOnView:ye.string,locale:ye.string,utc:ye.bool,displayTimeZone:ye.string,input:ye.bool,dateFormat:ye.oneOfType([ye.string,ye.bool]),timeFormat:ye.oneOfType([ye.string,ye.bool]),inputProps:ye.object,timeConstraints:ye.object,isValidDate:ye.func,open:ye.bool,strictParsing:ye.bool,closeOnSelect:ye.bool,closeOnTab:ye.bool,renderView:ye.func,renderInput:ye.func,renderDay:ye.func,renderMonth:ye.func,renderYear:ye.func}),pe(ge,"defaultProps",{onOpen:ve,onClose:ve,onCalendarOpen:ve,onCalendarClose:ve,onChange:ve,onNavigate:ve,onBeforeNavigate:function(e){return e},onNavigateBack:ve,onNavigateForward:ve,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),pe(ge,"moment",i.a);var Oe=ee(function(e){function t(){return re(this,t),ie(this,se(t).apply(this,arguments))}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement("div",{className:this.props.className},this.props.children)}},{key:"handleClickOutside",value:function(e){this.props.onClickOut(e)}}]),t}(u.a.Component))}]).default})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("moment"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","moment","react-dom"],t):"object"==typeof exports?exports.Datetime=t(require("react"),require("moment"),require("react-dom")):e.Datetime=t(e.react,e.moment,e["react-dom"])}(window,(function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){e.exports=n(5)()},function(e,t){e.exports=n},function(e,t,n){e.exports=n(9)},function(e,t,n){"use strict";var r=n(6),o=n(7),a=n(8);e.exports=function(){function e(e,t,n,r,i,s){s!==a&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,a,i,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,i,s],l=0;(u=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),a=n(1),i=n.n(a),s=n(0),u=n.n(s);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?m(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=function(e){function t(){var e,n;l(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return y(m(n=f(this,(e=d(t)).call.apply(e,[this].concat(o)))),"_setDate",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this.props.viewDate,t=e.localeData(),n=e.clone().startOf("month"),r=e.clone().endOf("month");return u.a.createElement("div",{className:"rdtDays"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderNavigation(e,t),this.renderDayHeaders(t)),u.a.createElement("tbody",null,this.renderDays(e,n,r)),this.renderFooter(e)))}},{key:"renderNavigation",value:function(e,t){var n=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return n.props.navigate(-1,"months")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return n.props.showView("months")},colSpan:5,"data-value":this.props.viewDate.month()},t.months(e)+" "+e.year()),u.a.createElement("th",{className:"rdtNext",onClick:function(){return n.props.navigate(1,"months")}},u.a.createElement("span",null,"›")))}},{key:"renderDayHeaders",value:function(e){var t=this.getDaysOfWeek(e).map((function(e,t){return u.a.createElement("th",{key:e+t,className:"dow"},e)}));return u.a.createElement("tr",null,t)}},{key:"renderDays",value:function(e,t,n){var r=[[],[],[],[],[],[]],o=e.clone().subtract(1,"months");o.date(o.daysInMonth()).startOf("week");for(var a=o.clone().add(42,"d"),i=0;o.isBefore(a);)this.getRow(r,i++).push(this.renderDay(o,t,n)),o.add(1,"d");return r.map((function(e,t){return u.a.createElement("tr",{key:"".concat(a.month(),"_").concat(t)},e)}))}},{key:"renderDay",value:function(e,t,n){var r=this.props.selectedDate,o={key:e.format("M_D"),"data-value":e.date(),"data-month":e.month(),"data-year":e.year()},a="rdtDay";return e.isBefore(t)?a+=" rdtOld":e.isAfter(n)&&(a+=" rdtNew"),r&&e.isSame(r,"day")&&(a+=" rdtActive"),e.isSame(this.props.moment(),"day")&&(a+=" rdtToday"),this.props.isValidDate(e)?o.onClick=this._setDate:a+=" rdtDisabled",o.className=a,this.props.renderDay?this.props.renderDay(o,e.clone(),r&&r.clone()):u.a.createElement("td",o,e.date())}},{key:"renderFooter",value:function(e){var t=this;if(this.props.timeFormat)return u.a.createElement("tfoot",null,u.a.createElement("tr",null,u.a.createElement("td",{onClick:function(){return t.props.showView("time")},colSpan:7,className:"rdtTimeToggle"},e.format(this.props.timeFormat))))}},{key:"getDaysOfWeek",value:function(e){var t=e.firstDayOfWeek(),n=[],r=0;return e._weekdaysMin.forEach((function(e){n[(7+r++-t)%7]=e})),n}},{key:"getRow",value:function(e,t){return e[Math.floor(t/7)]}}])&&p(n.prototype,r),o&&p(n,o),t}(u.a.Component);function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function w(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?k(e):t}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}y(v,"defaultProps",{isValidDate:function(){return!0}});var E=function(e){function t(){var e,n;g(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return _(k(n=w(this,(e=D(t)).call.apply(e,[this].concat(o)))),"_updateSelectedMonth",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){return u.a.createElement("div",{className:"rdtMonths"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader())),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderMonths())))}},{key:"renderHeader",value:function(){var e=this,t=this.props.viewDate.year();return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return e.props.navigate(-1,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return e.props.showView("years")},colSpan:"2","data-value":t},t),u.a.createElement("th",{className:"rdtNext",onClick:function(){return e.props.navigate(1,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderMonths",value:function(e){for(var t=[[],[],[]],n=0;n<12;n++)this.getRow(t,n).push(this.renderMonth(n,this.props.selectedDate));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderMonth",value:function(e,t){var n,r="rdtMonth";this.isDisabledMonth(e)?r+=" rdtDisabled":n=this._updateSelectedMonth,t&&t.year()===this.props.viewDate.year()&&t.month()===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderMonth?this.props.renderMonth(o,e,this.props.viewDate.year(),this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,this.getMonthText(e))}},{key:"getRow",value:function(e,t){return t<4?e[0]:t<8?e[1]:e[2]}},{key:"capitalize",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}},{key:"isDisabledMonth",value:function(e){var t=this.props.isValidDate;if(!t)return!1;for(var n=this.props.viewDate.clone().set({month:e}),r=n.endOf("month").date()+1;r-- >1;)if(t(n.date(r)))return!1;return!0}},{key:"getMonthText",value:function(e){var t=this.props.viewDate,n=t.localeData().monthsShort(t.month(e));return this.capitalize(n.substring(0,3))}}])&&O(n.prototype,r),o&&O(n,o),t}(u.a.Component);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=function(e){function t(){var e,n;S(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return F(N(n=V(this,(e=T(t)).call.apply(e,[this].concat(o)))),"disabledYearsCache",{}),F(N(n),"_updateSelectedYear",(function(e){n.props.updateDate(e)})),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=10*parseInt(this.props.viewDate.year()/10,10);return u.a.createElement("div",{className:"rdtYears"},u.a.createElement("table",null,u.a.createElement("thead",null,this.renderHeader(e))),u.a.createElement("table",null,u.a.createElement("tbody",null,this.renderYears(e))))}},{key:"renderHeader",value:function(e){var t=this;return u.a.createElement("tr",null,u.a.createElement("th",{className:"rdtPrev",onClick:function(){return t.props.navigate(-10,"years")}},u.a.createElement("span",null,"‹")),u.a.createElement("th",{className:"rdtSwitch",onClick:function(){return t.props.showView("years")}},"".concat(e,"-").concat(e+9)),u.a.createElement("th",{className:"rdtNext",onClick:function(){return t.props.navigate(10,"years")}},u.a.createElement("span",null,"›")))}},{key:"renderYears",value:function(e){for(var t=[[],[],[]],n=this.props.selectedDate&&this.props.selectedDate.year(),r=e-1;r<e+11;r++)this.getRow(t,r-e).push(this.renderYear(r,n));return t.map((function(e,t){return u.a.createElement("tr",{key:t},e)}))}},{key:"renderYear",value:function(e,t){var n,r="rdtYear";this.isDisabledYear(e)?r+=" rdtDisabled":n=this._updateSelectedYear,t===e&&(r+=" rdtActive");var o={key:e,className:r,"data-value":e,onClick:n};return this.props.renderYear?this.props.renderYear(o,e,this.props.selectedDate&&this.props.selectedDate.clone()):u.a.createElement("td",o,e)}},{key:"getRow",value:function(e,t){return t<3?e[0]:t<7?e[1]:e[2]}},{key:"isDisabledYear",value:function(e){var t=this.disabledYearsCache;if(void 0!==t[e])return t[e];var n=this.props.isValidDate;if(!n)return!1;for(var r=this.props.viewDate.clone().set({year:e}),o=r.endOf("year").dayOfYear()+1;o-- >1;)if(n(r.dayOfYear(o)))return t[e]=!1,!1;return t[e]=!0,!0}}])&&j(n.prototype,r),o&&j(n,o),t}(u.a.Component);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Y(e){return(Y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z={hours:{min:0,max:23,step:1},minutes:{min:0,max:59,step:1},seconds:{min:0,max:59,step:1},milliseconds:{min:0,max:999,step:1}},B=function(e){function t(e){var n,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(o=Y(t).call(this,e))||"object"!==M(o)&&"function"!=typeof o?H(r):o,U(H(n),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),n.constraints=n.createConstraints(e),n.state=n.getTimeParts(e.selectedDate||e.viewDate),n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),n=t,(r=[{key:"createConstraints",value:function(e){var t={};return Object.keys(Z).forEach((function(n){t[n]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){U(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Z[n],{},e.timeConstraints[n]||{})})),t}},{key:"render",value:function(){var e=this,t=[],n=this.state;return this.getCounters().forEach((function(r,o){o&&"ampm"!==r&&t.push(u.a.createElement("div",{key:"sep".concat(o),className:"rdtCounterSeparator"},":")),t.push(e.renderCounter(r,n[r]))})),u.a.createElement("div",{className:"rdtTime"},u.a.createElement("table",null,this.renderHeader(),u.a.createElement("tbody",null,u.a.createElement("tr",null,u.a.createElement("td",null,u.a.createElement("div",{className:"rdtCounters"},t))))))}},{key:"renderCounter",value:function(e,t){var n=this;return"hours"===e&&this.isAMPM()&&0==(t=(t-1)%12+1)&&(t=12),"ampm"===e&&-1!==this.props.timeFormat.indexOf(" A")&&(t=t.toUpperCase()),u.a.createElement("div",{key:e,className:"rdtCounter"},u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"increase",e)}},"▲"),u.a.createElement("div",{className:"rdtCount"},t),u.a.createElement("span",{className:"rdtBtn",onMouseDown:function(t){return n.onStartClicking(t,"decrease",e)}},"▼"))}},{key:"renderHeader",value:function(){var e=this;if(this.props.dateFormat){var t=this.props.selectedDate||this.props.viewDate;return u.a.createElement("thead",null,u.a.createElement("tr",null,u.a.createElement("td",{className:"rdtSwitch",colSpan:"4",onClick:function(){return e.props.showView("days")}},t.format(this.props.dateFormat))))}}},{key:"onStartClicking",value:function(e,t,n){var r=this;if(!e||!e.button||0===e.button){if("ampm"===n)return this.toggleDayPart();var o={},a=document.body;o[n]=this[t](n),this.setState(o),this.timer=setTimeout((function(){r.increaseTimer=setInterval((function(){o[n]=r[t](n),r.setState(o)}),70)}),500),this.mouseUpListener=function(){clearTimeout(r.timer),clearInterval(r.increaseTimer),r.props.setTime(n,parseInt(r.state[n],10)),a.removeEventListener("mouseup",r.mouseUpListener),a.removeEventListener("touchend",r.mouseUpListener)},a.addEventListener("mouseup",this.mouseUpListener),a.addEventListener("touchend",this.mouseUpListener)}}},{key:"toggleDayPart",value:function(){var e=parseInt(this.state.hours,10);e>=12?e-=12:e+=12,this.props.setTime("hours",e)}},{key:"increase",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)+t.step;return n>t.max&&(n=t.min+(n-(t.max+1))),this.pad(e,n)}},{key:"decrease",value:function(e){var t=this.constraints[e],n=parseInt(this.state[e],10)-t.step;return n<t.min&&(n=t.max+1-(t.min-n)),this.pad(e,n)}},{key:"pad",value:function(e,t){for(var n=t+"";n.length<this.padValues[e];)n="0"+n;return n}},{key:"getCounters",value:function(){var e=[],t=this.props.timeFormat;return-1!==t.toLowerCase().indexOf("h")&&(e.push("hours"),-1!==t.indexOf("m")&&(e.push("minutes"),-1!==t.indexOf("s")&&(e.push("seconds"),-1!==t.indexOf("S")&&e.push("milliseconds")))),this.isAMPM()&&e.push("ampm"),e}},{key:"isAMPM",value:function(){return-1!==this.props.timeFormat.toLowerCase().indexOf(" a")}},{key:"getTimeParts",value:function(e){var t=e.hours();return{hours:this.pad("hours",t),minutes:this.pad("minutes",e.minutes()),seconds:this.pad("seconds",e.seconds()),milliseconds:this.pad("milliseconds",e.milliseconds()),ampm:t<12?"am":"pm"}}},{key:"componentDidUpdate",value:function(e){this.props.selectedDate?this.props.selectedDate!==e.selectedDate&&this.setState(this.getTimeParts(this.props.selectedDate)):e.viewDate!==this.props.viewDate&&this.setState(this.getTimeParts(this.props.viewDate))}}])&&L(n.prototype,r),o&&L(n,o),t}(u.a.Component),W=n(3);function z(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var q,K,X=(void 0===q&&(q=0),function(){return++q}),G={},J={},Q=["touchstart","touchmove"];function $(e,t){var n=null;return-1!==Q.indexOf(t)&&K&&(n={passive:!e.props.preventDefault}),n}var ee=function(e,t){var n,r,o=e.displayName||e.name||"Component";return r=n=function(n){var r,a;function i(e){var r;return(r=n.call(this,e)||this).__outsideClickHandler=function(e){if("function"!=typeof r.__clickOutsideHandlerProp){var t=r.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw new Error("WrappedComponent: "+o+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else r.__clickOutsideHandlerProp(e)},r.__getComponentNode=function(){var e=r.getInstance();return t&&"function"==typeof t.setClickOutsideRef?t.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():Object(W.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!J[r._uid]){void 0===K&&(K=function(){if("undefined"!=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}}()),J[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),G[r._uid]=function(e){var t;null!==r.componentNode&&(r.props.preventDefault&&e.preventDefault(),r.props.stopPropagation&&e.stopPropagation(),r.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(z(e,t,n))return!0;e=e.parentNode}return e}(e.target,r.componentNode,r.props.outsideClickIgnoreClass)===document&&r.__outsideClickHandler(e))},e.forEach((function(e){document.addEventListener(e,G[r._uid],$(r,e))}))}},r.disableOnClickOutside=function(){delete J[r._uid];var e=G[r._uid];if(e&&"undefined"!=typeof document){var t=r.props.eventTypes;t.forEach||(t=[t]),t.forEach((function(t){return document.removeEventListener(t,e,$(r,t))})),delete G[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=X(),r}a=n,(r=i).prototype=Object.create(a.prototype),r.prototype.constructor=r,r.__proto__=a;var u=i.prototype;return u.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},u.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(t&&"function"==typeof t.handleClickOutside&&(this.__clickOutsideHandlerProp=t.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw new Error("WrappedComponent: "+o+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},u.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},u.componentWillUnmount=function(){this.disableOnClickOutside()},u.render=function(){var t=this.props,n=(t.excludeScrollbar,function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(s.createElement)(e,n)},i}(s.Component),n.displayName="OnClickOutside("+o+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:"ignore-react-onclickoutside",preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},r};function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t,n){return t&&oe(e.prototype,t),n&&oe(e,n),e}function ie(e,t){return!t||"object"!==te(t)&&"function"!=typeof t?ue(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return ge}));var fe="years",de="months",me="days",he="time",ye=o.a,ve=function(){},be=ye.oneOfType([ye.instanceOf(i.a),ye.instanceOf(Date),ye.string]),ge=function(e){function t(e){var n;return re(this,t),pe(ue(n=ie(this,se(t).call(this,e))),"_renderCalendar",(function(e){var t=n.props,r={viewDate:n.state.viewDate.clone(),selectedDate:n.getSelectedDate(),isValidDate:t.isValidDate,updateDate:n._updateDate,navigate:n._viewNavigate,moment:i.a,showView:n._showView};switch(e){case fe:return r.renderYear=t.renderYear,u.a.createElement(I,r);case de:return r.renderMonth=t.renderMonth,u.a.createElement(E,r);case me:return r.renderDay=t.renderDay,r.timeFormat=n.getFormat("time"),u.a.createElement(v,r);default:return r.dateFormat=n.getFormat("date"),r.timeFormat=n.getFormat("time"),r.timeConstraints=t.timeConstraints,r.setTime=n._setTime,u.a.createElement(B,r)}})),pe(ue(n),"_showView",(function(e,t){var r=(t||n.state.viewDate).clone(),o=n.props.onBeforeNavigate(e,n.state.currentView,r);o&&n.state.currentView!==o&&(n.props.onNavigate(o),n.setState({currentView:o}))})),pe(ue(n),"viewToMethod",{days:"date",months:"month",years:"year"}),pe(ue(n),"nextView",{days:"time",months:"days",years:"months"}),pe(ue(n),"_updateDate",(function(e){var t=n.state.currentView,r=n.getUpdateOn(n.getFormat("date")),o=n.state.viewDate.clone();o[n.viewToMethod[t]](parseInt(e.target.getAttribute("data-value"),10)),"days"===t&&(o.month(parseInt(e.target.getAttribute("data-month"),10)),o.year(parseInt(e.target.getAttribute("data-year"),10)));var a={viewDate:o};t===r?(a.selectedDate=o.clone(),a.inputValue=o.format(n.getFormat("datetime")),void 0===n.props.open&&n.props.input&&n.props.closeOnSelect&&n._closeCalendar(),n.props.onChange(o.clone())):n._showView(n.nextView[t],o),n.setState(a)})),pe(ue(n),"_viewNavigate",(function(e,t){var r=n.state.viewDate.clone();r.add(e,t),e>0?n.props.onNavigateForward(e,t):n.props.onNavigateBack(-e,t),n.setState({viewDate:r})})),pe(ue(n),"_setTime",(function(e,t){var r=n.state,o=(r.selectedDate||r.viewDate).clone();o[e](t),n.props.value||n.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(n.getFormat("datetime"))}),n.props.onChange(o.clone())})),pe(ue(n),"_openCalendar",(function(){n.isOpen()||n.setState({open:!0},n.props.onOpen)})),pe(ue(n),"_closeCalendar",(function(){n.isOpen()&&n.setState({open:!1},(function(){n.props.onClose(n.state.selectedDate||n.state.inputValue)}))})),pe(ue(n),"_handleClickOutside",(function(){var e=n.props;e.input&&n.state.open&&void 0===e.open&&e.closeOnClickOutside&&n._closeCalendar()})),pe(ue(n),"_onInputFocus",(function(e){n.callHandler(n.props.inputProps.onFocus,e)&&n._openCalendar()})),pe(ue(n),"_onInputChange",(function(e){if(n.callHandler(n.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,r=n.localMoment(t,n.getFormat("datetime")),o={inputValue:t};r.isValid()?(o.selectedDate=r,o.viewDate=r.clone().startOf("month")):o.selectedDate=null,n.setState(o,(function(){n.props.onChange(r.isValid()?r:n.state.inputValue)}))}})),pe(ue(n),"_onInputKeyDown",(function(e){n.callHandler(n.props.inputProps.onKeyDown,e)&&9===e.which&&n.props.closeOnTab&&n._closeCalendar()})),n.state=n.getInitialState(e),n}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement(Oe,{className:this.getClassName(),onClickOut:this._handleClickOutside},this.renderInput(),u.a.createElement("div",{className:"rdtPicker"},this.renderView(this.state.currentView,this._renderCalendar)))}},{key:"renderInput",value:function(){if(this.props.input){var e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach((function(t){pe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"text",className:"form-control",value:this.getInputValue()},this.props.inputProps,{onFocus:this._onInputFocus,onChange:this._onInputChange,onKeyDown:this._onInputKeyDown});return this.props.renderInput?u.a.createElement("div",null,this.props.renderInput(e,this._openCalendar,this._closeCalendar)):u.a.createElement("input",e)}}},{key:"renderView",value:function(e,t){return this.props.renderView?this.props.renderView(e,(function(){return t(e)})):t(this.state.currentView)}},{key:"getInitialState",value:function(e){var t=e||this.props,n=this.getFormat("datetime"),r=this.parseDate(t.value||t.initialValue,n);return this.checkTZ(t),{open:!t.input,currentView:t.initialViewMode||this.getInitialView(this.getFormat("date")),viewDate:this.getInitialViewDate(t.initialViewDate,r,n),selectedDate:r&&r.isValid()?r:void 0,inputValue:this.getInitialInputValue(t,r,n)}}},{key:"getInitialViewDate",value:function(e,t,n){var r;if(e){if((r=this.parseDate(e,n))&&r.isValid())return r;this.log('The initialViewDated given "'+e+'" is not valid. Using current date instead.')}else if(t&&t.isValid())return t.clone();return this.getInitialDate()}},{key:"getInitialDate",value:function(){var e=this.localMoment();return e.hour(0).minute(0).second(0).millisecond(0),e}},{key:"getInitialView",value:function(e){return e?this.getUpdateOn(e):he}},{key:"parseDate",value:function(e,t){var n;return e&&"string"==typeof e?n=this.localMoment(e,t):e&&(n=this.localMoment(e)),n&&!n.isValid()&&(n=null),n}},{key:"getClassName",value:function(){var e="rdt",t=this.props,n=t.className;return Array.isArray(n)?e+=" "+n.join(" "):n&&(e+=" "+n),t.input||(e+=" rdtStatic"),this.isOpen()&&(e+=" rdtOpen"),e}},{key:"isOpen",value:function(){return!this.props.input||(void 0===this.props.open?this.state.open:this.props.open)}},{key:"getUpdateOn",value:function(e){return this.props.updateOnView?this.props.updateOnView:e.match(/[lLD]/)?me:-1!==e.indexOf("M")?de:-1!==e.indexOf("Y")?fe:me}},{key:"getLocaleData",value:function(e){var t=e||this.props;return this.localMoment(t.value||t.defaultValue||new Date).localeData()}},{key:"getDateFormat",value:function(e){var t=this.props.dateFormat;return!0===t?e.longDateFormat("L"):t||""}},{key:"getTimeFormat",value:function(e){var t=this.props.timeFormat;return!0===t?e.longDateFormat("LT"):t||""}},{key:"getFormat",value:function(e){if("date"===e)return this.getDateFormat(this.getLocaleData());if("time"===e)return this.getTimeFormat(this.getLocaleData());var t=this.getLocaleData(),n=this.getDateFormat(t),r=this.getTimeFormat(t);return n&&r?n+" "+r:n||r}},{key:"updateTime",value:function(e,t,n,r){var o={},a=r?"selectedDate":"viewDate";o[a]=this.state[a].clone()[e](t,n),this.setState(o)}},{key:"localMoment",value:function(e,t,n){var r=null;return r=(n=n||this.props).utc?i.a.utc(e,t,n.strictParsing):n.displayTimeZone?i.a.tz(e,t,n.displayTimeZone):i()(e,t,n.strictParsing),n.locale&&r.locale(n.locale),r}},{key:"checkTZ",value:function(e){!e.displayTimeZone||this.tzWarning||i.a.tz||(this.tzWarning=!0,this.log('displayTimeZone prop with value "'+e.displayTimeZone+'" is used but moment.js timezone is not loaded.',"error"))}},{key:"componentDidUpdate",value:function(e){if(e!==this.props){var t=!1,n=this.props;["locale","utc","displayZone","dateFormat","timeFormat"].forEach((function(r){e[r]!==n[r]&&(t=!0)})),t&&this.regenerateDates(this.props),this.checkTZ(this.props)}}},{key:"regenerateDates",value:function(e){var t=this.state.viewDate.clone(),n=this.state.selectedDate&&this.state.selectedDate.clone();e.locale&&(t.locale(e.locale),n&&n.locale(e.locale)),e.utc?(t.utc(),n&&n.utc()):e.displayTimeZone?(t.tz(e.displayTimeZone),n&&n.tz(e.displayTimeZone)):(t.locale(),n&&n.locale());var r={viewDate:t,selectedDate:n};n&&n.isValid()&&(r.inputValue=n.format(this.getFormat("datetime"))),this.setState(r)}},{key:"getSelectedDate",value:function(){if(void 0===this.props.value)return this.state.selectedDate;var e=this.parseDate(this.props.value,this.getFormat("datetime"));return!(!e||!e.isValid())&&e}},{key:"getInitialInputValue",value:function(e,t,n){return e.inputProps.value?e.inputProps.value:t&&t.isValid()?t.format(n):e.value&&"string"==typeof e.value?e.value:e.initialValue&&"string"==typeof e.initialValue?e.initialValue:""}},{key:"getInputValue",value:function(){var e=this.getSelectedDate();return e?e.format(this.getFormat("datetime")):this.state.inputValue}},{key:"setViewDate",value:function(e){var t,n=this,r=function(){return n.log("Invalid date passed to the `setViewDate` method: "+e)};return e&&(t="string"==typeof e?this.localMoment(e,this.getFormat("datetime")):this.localMoment(e))&&t.isValid()?void this.setState({viewDate:t}):r()}},{key:"navigate",value:function(e){this.showView(e)()}},{key:"log",value:function(e,t){var n="undefined"!=typeof window&&window.console;n&&(t||(t="warn"),n[t]("***react-datetime:"+e))}},{key:"callHandler",value:function(e,t){return!e||!1!==e(t)}}]),t}(u.a.Component);pe(ge,"propTypes",{value:be,initialValue:be,initialViewDate:be,initialViewMode:ye.oneOf([fe,de,me,he]),onOpen:ye.func,onClose:ye.func,onChange:ye.func,onNavigate:ye.func,onBeforeNavigate:ye.func,onNavigateBack:ye.func,onNavigateForward:ye.func,updateOnView:ye.string,locale:ye.string,utc:ye.bool,displayTimeZone:ye.string,input:ye.bool,dateFormat:ye.oneOfType([ye.string,ye.bool]),timeFormat:ye.oneOfType([ye.string,ye.bool]),inputProps:ye.object,timeConstraints:ye.object,isValidDate:ye.func,open:ye.bool,strictParsing:ye.bool,closeOnSelect:ye.bool,closeOnTab:ye.bool,renderView:ye.func,renderInput:ye.func,renderDay:ye.func,renderMonth:ye.func,renderYear:ye.func}),pe(ge,"defaultProps",{onOpen:ve,onClose:ve,onCalendarOpen:ve,onCalendarClose:ve,onChange:ve,onNavigate:ve,onBeforeNavigate:function(e){return e},onNavigateBack:ve,onNavigateForward:ve,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),pe(ge,"moment",i.a);var Oe=ee(function(e){function t(){return re(this,t),ie(this,se(t).apply(this,arguments))}return ce(t,e),ae(t,[{key:"render",value:function(){return u.a.createElement("div",{className:this.props.className},this.props.children)}},{key:"handleClickOutside",value:function(e){this.props.onClickOut(e)}}]),t}(u.a.Component))}]).default})); | ||
//# sourceMappingURL=react-datetime.umd.js.map |
{ | ||
"name": "react-datetime", | ||
"version": "3.0.0-beta.7", | ||
"version": "3.0.0-beta.8", | ||
"description": "A lightweight but complete datetime picker React.js component", | ||
@@ -18,3 +18,3 @@ "homepage": "https://github.com/YouCanBookMe/react-datetime", | ||
"build": "webpack --config config/webpack.config.build.js", | ||
"lint": "eslint src/datetime/Datetime.js test/ && echo 'Linting OK! 💪'", | ||
"lint": "eslint src/datetime/DateTime.js test/ && echo 'Linting OK! 💪'", | ||
"notify-pre-commit-hook": "echo '### Starting pre-commit hook 🦄'", | ||
@@ -97,3 +97,3 @@ "playground": "node scripts/start.js", | ||
"react-app-polyfill": "^1.0.5", | ||
"react-dev-utils": "^10.0.0", | ||
"react-dev-utils": "10.1.0", | ||
"react-dom": "^16.5.0", | ||
@@ -100,0 +100,0 @@ "react-onclickoutside": "^6.9.0", |
@@ -59,4 +59,4 @@ # react-datetime | ||
| **onChange** | `function` | empty function | Callback trigger when the date changes. The callback receives the selected `moment` object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback receives the value of the input (a string). | | ||
| **onFocus** | `function` | empty function | Callback trigger for when the user opens the datepicker. The callback receives an event of type SyntheticEvent. | | ||
| **onBlur** | `function` | empty function | Callback trigger for when the user clicks outside of the input, simulating a regular onBlur. The callback receives the selected `moment` object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback returned. | | ||
| **onOpen** | `function` | empty function | Callback trigger for when the user opens the datepicker. The callback receives an event of type SyntheticEvent. | | ||
| **onClose** | `function` | empty function | Callback trigger for when the user clicks outside of the input. The callback receives the selected `moment` object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback returned. | | ||
| **onNavigate** | `function` | empty function | Callback trigger when the view mode changes. The callback receives the selected view mode string (`years`, `months`, `days` or `time`) as only parameter.| | ||
@@ -63,0 +63,0 @@ | **onBeforeNavigate** | `function` | ( nextView, currentView, viewDate ) => nextView | Allows to intercept a change of the calendar view. The accepted function receives the view that it's supposed to navigate to, the view that is showing currently and the date currently shown in the view. Return a viewMode ( default ones are `years`, `months`, `days` or `time`) to navigate to it. If the function returns a "falsy" value, the navigation is stopped and we will remain in the current view. | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
279510
8
471