react-datetime
Advanced tools
Comparing version 3.0.1 to 3.0.2
Changelog | ||
========= | ||
## 3.0.2 | ||
* Fixes typescript typings not being exposed publicly | ||
## 3.0.1 | ||
@@ -4,0 +7,0 @@ * Big refactor, the state is not derived from the props after every update. |
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(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(t){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?m(e):t}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e){!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&&f(e,t)}(a,e);var t,n,r,o=d(a);function a(){var e;l(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return v(m(e=o.call.apply(o,[this].concat(n))),"_setDate",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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(t.prototype,n),r&&p(t,r),a}(u.a.Component);function g(e){return(g="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 O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(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 D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}v(b,"defaultProps",{isValidDate:function(){return!0}});var S=function(e){!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&&D(e,t)}(a,e);var t,n,r,o=k(a);function a(){var e;O(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(_(e=o.call.apply(o,[this].concat(n))),"_updateSelectedMonth",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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))}}])&&w(t.prototype,n),r&&w(t,r),a}(u.a.Component);function j(e){return(j="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 V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(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 N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=I(e);if(t){var o=I(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?F(e):t}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=function(e){!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&&N(e,t)}(a,e);var t,n,r,o=x(a);function a(){var e;V(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return M(F(e=o.call.apply(o,[this].concat(n))),"disabledYearsCache",{}),M(F(e),"_updateSelectedYear",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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}}])&&T(t.prototype,n),r&&T(t,r),a}(u.a.Component);function Y(e){return(Y="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 H(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 A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function U(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 Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=q(e);if(t){var o=q(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return B(this,n)}}function B(e,t){return!t||"object"!==Y(t)&&"function"!=typeof t?z(e):t}function z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var X={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}},G=function(e){!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&&Z(e,t)}(a,e);var t,n,r,o=W(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),K(z(t=o.call(this,e)),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),t.constraints=t.createConstraints(e),t.state=t.getTimeParts(e.selectedDate||e.viewDate),t}return t=a,(n=[{key:"createConstraints",value:function(e){var t={};return Object.keys(X).forEach((function(n){t[n]=A(A({},X[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))}}])&&U(t.prototype,n),r&&U(t,r),a}(u.a.Component),J=n(3);function Q(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var $,ee,te=(void 0===$&&($=0),function(){return++$}),ne={},re={},oe=["touchstart","touchmove"];function ae(e,t){var n=null;return-1!==oe.indexOf(t)&&ee&&(n={passive:!e.props.preventDefault}),n}var ie=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(J.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!re[r._uid]){void 0===ee&&(ee=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}}()),re[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),ne[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(Q(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,ne[r._uid],ae(r,e))}))}},r.disableOnClickOutside=function(){delete re[r._uid];var e=ne[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,ae(r,t))})),delete ne[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=te(),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 se(e){return(se="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 ue(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 ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(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 fe(e,t,n){return t&&pe(e.prototype,t),n&&pe(e,n),e}function de(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&&he(e,t)}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=be(e);if(t){var o=be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){return!t||"object"!==se(t)&&"function"!=typeof t?ve(e):t}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ge(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 Pe}));var Oe="years",we="months",De="days",ke="time",Ce=o.a,_e=function(){},Ee=Ce.oneOfType([Ce.instanceOf(i.a),Ce.instanceOf(Date),Ce.string]),Pe=function(e){de(n,e);var t=me(n);function n(e){var r;return le(this,n),ge(ve(r=t.call(this,e)),"_renderCalendar",(function(e){var t=r.props,n={viewDate:r.state.viewDate.clone(),selectedDate:r.getSelectedDate(),isValidDate:t.isValidDate,updateDate:r._updateDate,navigate:r._viewNavigate,moment:i.a,showView:r._showView};switch(e){case Oe:return n.renderYear=t.renderYear,u.a.createElement(L,n);case we:return n.renderMonth=t.renderMonth,u.a.createElement(S,n);case De:return n.renderDay=t.renderDay,n.timeFormat=r.getFormat("time"),u.a.createElement(b,n);default:return n.dateFormat=r.getFormat("date"),n.timeFormat=r.getFormat("time"),n.timeConstraints=t.timeConstraints,n.setTime=r._setTime,u.a.createElement(G,n)}})),ge(ve(r),"_showView",(function(e,t){var n=(t||r.state.viewDate).clone(),o=r.props.onBeforeNavigate(e,r.state.currentView,n);o&&r.state.currentView!==o&&(r.props.onNavigate(o),r.setState({currentView:o}))})),ge(ve(r),"viewToMethod",{days:"date",months:"month",years:"year"}),ge(ve(r),"nextView",{days:"time",months:"days",years:"months"}),ge(ve(r),"_updateDate",(function(e){var t=r.state.currentView,n=r.getUpdateOn(r.getFormat("date")),o=r.state.viewDate.clone();o[r.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===n?(a.selectedDate=o.clone(),a.inputValue=o.format(r.getFormat("datetime")),void 0===r.props.open&&r.props.input&&r.props.closeOnSelect&&r._closeCalendar(),r.props.onChange(o.clone())):r._showView(r.nextView[t],o),r.setState(a)})),ge(ve(r),"_viewNavigate",(function(e,t){var n=r.state.viewDate.clone();n.add(e,t),e>0?r.props.onNavigateForward(e,t):r.props.onNavigateBack(-e,t),r.setState({viewDate:n})})),ge(ve(r),"_setTime",(function(e,t){var n=r.state,o=(n.selectedDate||n.viewDate).clone();o[e](t),r.props.value||r.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(r.getFormat("datetime"))}),r.props.onChange(o.clone())})),ge(ve(r),"_openCalendar",(function(){r.isOpen()||r.setState({open:!0},r.props.onOpen)})),ge(ve(r),"_closeCalendar",(function(){r.isOpen()&&r.setState({open:!1},(function(){r.props.onClose(r.state.selectedDate||r.state.inputValue)}))})),ge(ve(r),"_handleClickOutside",(function(){var e=r.props;e.input&&r.state.open&&void 0===e.open&&e.closeOnClickOutside&&r._closeCalendar()})),ge(ve(r),"_onInputFocus",(function(e){r.callHandler(r.props.inputProps.onFocus,e)&&r._openCalendar()})),ge(ve(r),"_onInputChange",(function(e){if(r.callHandler(r.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,n=r.localMoment(t,r.getFormat("datetime")),o={inputValue:t};n.isValid()?(o.selectedDate=n,o.viewDate=n.clone().startOf("month")):o.selectedDate=null,r.setState(o,(function(){r.props.onChange(n.isValid()?n:r.state.inputValue)}))}})),ge(ve(r),"_onInputKeyDown",(function(e){r.callHandler(r.props.inputProps.onKeyDown,e)&&9===e.which&&r.props.closeOnTab&&r._closeCalendar()})),r.state=r.getInitialState(e),r}return fe(n,[{key:"render",value:function(){return u.a.createElement(Se,{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=ce(ce({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):ke}},{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]/)?De:-1!==e.indexOf("M")?we:-1!==e.indexOf("Y")?Oe:De}},{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),n.value&&n.value!==e.value&&this.setViewDate(n.value),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)}}]),n}(u.a.Component);ge(Pe,"propTypes",{value:Ee,initialValue:Ee,initialViewDate:Ee,initialViewMode:Ce.oneOf([Oe,we,De,ke]),onOpen:Ce.func,onClose:Ce.func,onChange:Ce.func,onNavigate:Ce.func,onBeforeNavigate:Ce.func,onNavigateBack:Ce.func,onNavigateForward:Ce.func,updateOnView:Ce.string,locale:Ce.string,utc:Ce.bool,displayTimeZone:Ce.string,input:Ce.bool,dateFormat:Ce.oneOfType([Ce.string,Ce.bool]),timeFormat:Ce.oneOfType([Ce.string,Ce.bool]),inputProps:Ce.object,timeConstraints:Ce.object,isValidDate:Ce.func,open:Ce.bool,strictParsing:Ce.bool,closeOnSelect:Ce.bool,closeOnTab:Ce.bool,renderView:Ce.func,renderInput:Ce.func,renderDay:Ce.func,renderMonth:Ce.func,renderYear:Ce.func}),ge(Pe,"defaultProps",{onOpen:_e,onClose:_e,onCalendarOpen:_e,onCalendarClose:_e,onChange:_e,onNavigate:_e,onBeforeNavigate:function(e){return e},onNavigateBack:_e,onNavigateForward:_e,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),ge(Pe,"moment",i.a);var Se=ie(function(e){de(n,e);var t=me(n);function n(){return le(this,n),t.apply(this,arguments)}return fe(n,[{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)}}]),n}(u.a.Component))}]); | ||
//# sourceMappingURL=react-datetime.cjs.js.map |
!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(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(t){var o=y(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m(this,n)}}function m(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e){!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&&f(e,t)}(a,e);var t,n,r,o=d(a);function a(){var e;l(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return v(h(e=o.call.apply(o,[this].concat(n))),"_setDate",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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(t.prototype,n),r&&p(t,r),a}(u.a.Component);function g(e){return(g="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 O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(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 D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}v(b,"defaultProps",{isValidDate:function(){return!0}});var S=function(e){!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&&D(e,t)}(a,e);var t,n,r,o=k(a);function a(){var e;O(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(_(e=o.call.apply(o,[this].concat(n))),"_updateSelectedMonth",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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))}}])&&w(t.prototype,n),r&&w(t,r),a}(u.a.Component);function j(e){return(j="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 V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(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 N(e,t){return(N=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=I(e);if(t){var o=I(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return R(this,n)}}function R(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?F(e):t}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var L=function(e){!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&&N(e,t)}(a,e);var t,n,r,o=x(a);function a(){var e;V(this,a);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return M(F(e=o.call.apply(o,[this].concat(n))),"disabledYearsCache",{}),M(F(e),"_updateSelectedYear",(function(t){e.props.updateDate(t)})),e}return t=a,(n=[{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}}])&&T(t.prototype,n),r&&T(t,r),a}(u.a.Component);function Y(e){return(Y="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 H(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 A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){K(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function U(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 Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=q(e);if(t){var o=q(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return B(this,n)}}function B(e,t){return!t||"object"!==Y(t)&&"function"!=typeof t?z(e):t}function z(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var X={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}},G=function(e){!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&&Z(e,t)}(a,e);var t,n,r,o=W(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),K(z(t=o.call(this,e)),"padValues",{hours:1,minutes:2,seconds:2,milliseconds:3}),t.constraints=t.createConstraints(e),t.state=t.getTimeParts(e.selectedDate||e.viewDate),t}return t=a,(n=[{key:"createConstraints",value:function(e){var t={};return Object.keys(X).forEach((function(n){t[n]=A(A({},X[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))}}])&&U(t.prototype,n),r&&U(t,r),a}(u.a.Component),J=n(3);function Q(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}var $,ee,te=(void 0===$&&($=0),function(){return++$}),ne={},re={},oe=["touchstart","touchmove"];function ae(e,t){var n=null;return-1!==oe.indexOf(t)&&ee&&(n={passive:!e.props.preventDefault}),n}var ie=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(J.findDOMNode)(e)},r.enableOnClickOutside=function(){if("undefined"!=typeof document&&!re[r._uid]){void 0===ee&&(ee=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}}()),re[r._uid]=!0;var e=r.props.eventTypes;e.forEach||(e=[e]),ne[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(Q(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,ne[r._uid],ae(r,e))}))}},r.disableOnClickOutside=function(){delete re[r._uid];var e=ne[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,ae(r,t))})),delete ne[r._uid]}},r.getRef=function(e){return r.instanceRef=e},r._uid=te(),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 se(e){return(se="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 ue(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 ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pe(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 fe(e,t,n){return t&&pe(e.prototype,t),n&&pe(e,n),e}function de(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&&me(e,t)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function he(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=be(e);if(t){var o=be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ye(this,n)}}function ye(e,t){return!t||"object"!==se(t)&&"function"!=typeof t?ve(e):t}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function be(e){return(be=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ge(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 Pe}));var Oe="years",we="months",De="days",ke="time",Ce=o.a,_e=function(){},Ee=Ce.oneOfType([Ce.instanceOf(i.a),Ce.instanceOf(Date),Ce.string]),Pe=function(e){de(n,e);var t=he(n);function n(e){var r;return le(this,n),ge(ve(r=t.call(this,e)),"_renderCalendar",(function(e){var t=r.props,n={viewDate:r.state.viewDate.clone(),selectedDate:r.getSelectedDate(),isValidDate:t.isValidDate,updateDate:r._updateDate,navigate:r._viewNavigate,moment:i.a,showView:r._showView};switch(e){case Oe:return n.renderYear=t.renderYear,u.a.createElement(L,n);case we:return n.renderMonth=t.renderMonth,u.a.createElement(S,n);case De:return n.renderDay=t.renderDay,n.timeFormat=r.getFormat("time"),u.a.createElement(b,n);default:return n.dateFormat=r.getFormat("date"),n.timeFormat=r.getFormat("time"),n.timeConstraints=t.timeConstraints,n.setTime=r._setTime,u.a.createElement(G,n)}})),ge(ve(r),"_showView",(function(e,t){var n=(t||r.state.viewDate).clone(),o=r.props.onBeforeNavigate(e,r.state.currentView,n);o&&r.state.currentView!==o&&(r.props.onNavigate(o),r.setState({currentView:o}))})),ge(ve(r),"viewToMethod",{days:"date",months:"month",years:"year"}),ge(ve(r),"nextView",{days:"time",months:"days",years:"months"}),ge(ve(r),"_updateDate",(function(e){var t=r.state.currentView,n=r.getUpdateOn(r.getFormat("date")),o=r.state.viewDate.clone();o[r.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===n?(a.selectedDate=o.clone(),a.inputValue=o.format(r.getFormat("datetime")),void 0===r.props.open&&r.props.input&&r.props.closeOnSelect&&r._closeCalendar(),r.props.onChange(o.clone())):r._showView(r.nextView[t],o),r.setState(a)})),ge(ve(r),"_viewNavigate",(function(e,t){var n=r.state.viewDate.clone();n.add(e,t),e>0?r.props.onNavigateForward(e,t):r.props.onNavigateBack(-e,t),r.setState({viewDate:n})})),ge(ve(r),"_setTime",(function(e,t){var n=r.state,o=(n.selectedDate||n.viewDate).clone();o[e](t),r.props.value||r.setState({selectedDate:o,viewDate:o.clone(),inputValue:o.format(r.getFormat("datetime"))}),r.props.onChange(o.clone())})),ge(ve(r),"_openCalendar",(function(){r.isOpen()||r.setState({open:!0},r.props.onOpen)})),ge(ve(r),"_closeCalendar",(function(){r.isOpen()&&r.setState({open:!1},(function(){r.props.onClose(r.state.selectedDate||r.state.inputValue)}))})),ge(ve(r),"_handleClickOutside",(function(){var e=r.props;e.input&&r.state.open&&void 0===e.open&&e.closeOnClickOutside&&r._closeCalendar()})),ge(ve(r),"_onInputFocus",(function(e){r.callHandler(r.props.inputProps.onFocus,e)&&r._openCalendar()})),ge(ve(r),"_onInputChange",(function(e){if(r.callHandler(r.props.inputProps.onChange,e)){var t=e.target?e.target.value:e,n=r.localMoment(t,r.getFormat("datetime")),o={inputValue:t};n.isValid()?(o.selectedDate=n,o.viewDate=n.clone().startOf("month")):o.selectedDate=null,r.setState(o,(function(){r.props.onChange(n.isValid()?n:r.state.inputValue)}))}})),ge(ve(r),"_onInputKeyDown",(function(e){r.callHandler(r.props.inputProps.onKeyDown,e)&&9===e.which&&r.props.closeOnTab&&r._closeCalendar()})),r.state=r.getInitialState(e),r}return fe(n,[{key:"render",value:function(){return u.a.createElement(Se,{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=ce(ce({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):ke}},{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]/)?De:-1!==e.indexOf("M")?we:-1!==e.indexOf("Y")?Oe:De}},{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),n.value&&n.value!==e.value&&this.setViewDate(n.value),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)}}]),n}(u.a.Component);ge(Pe,"propTypes",{value:Ee,initialValue:Ee,initialViewDate:Ee,initialViewMode:Ce.oneOf([Oe,we,De,ke]),onOpen:Ce.func,onClose:Ce.func,onChange:Ce.func,onNavigate:Ce.func,onBeforeNavigate:Ce.func,onNavigateBack:Ce.func,onNavigateForward:Ce.func,updateOnView:Ce.string,locale:Ce.string,utc:Ce.bool,displayTimeZone:Ce.string,input:Ce.bool,dateFormat:Ce.oneOfType([Ce.string,Ce.bool]),timeFormat:Ce.oneOfType([Ce.string,Ce.bool]),inputProps:Ce.object,timeConstraints:Ce.object,isValidDate:Ce.func,open:Ce.bool,strictParsing:Ce.bool,closeOnSelect:Ce.bool,closeOnTab:Ce.bool,renderView:Ce.func,renderInput:Ce.func,renderDay:Ce.func,renderMonth:Ce.func,renderYear:Ce.func}),ge(Pe,"defaultProps",{onOpen:_e,onClose:_e,onCalendarOpen:_e,onCalendarClose:_e,onChange:_e,onNavigate:_e,onBeforeNavigate:function(e){return e},onNavigateBack:_e,onNavigateForward:_e,dateFormat:!0,timeFormat:!0,utc:!1,className:"",input:!0,inputProps:{},timeConstraints:{},isValidDate:function(){return!0},strictParsing:!0,closeOnSelect:!1,closeOnTab:!0,closeOnClickOutside:!0}),ge(Pe,"moment",i.a);var Se=ie(function(e){de(n,e);var t=he(n);function n(){return le(this,n),t.apply(this,arguments)}return fe(n,[{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)}}]),n}(u.a.Component))}]).default})); | ||
//# sourceMappingURL=react-datetime.umd.js.map |
{ | ||
"name": "react-datetime", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "A lightweight but complete datetime picker React.js component", | ||
@@ -11,6 +11,7 @@ "homepage": "https://github.com/arqex/react-datetime", | ||
"main": "./dist/react-datetime.cjs.js", | ||
"typings": "./src/datetime/DateTime.d.ts", | ||
"typings": "./typings/DateTime.d.ts", | ||
"files": [ | ||
"css", | ||
"dist" | ||
"dist", | ||
"typings" | ||
], | ||
@@ -17,0 +18,0 @@ "scripts": { |
@@ -39,6 +39,8 @@ # react-datetime | ||
**Don't forget to add the [CSS stylesheet](https://github.com/arqex/react-datetime/blob/master/css/react-datetime.css) to make it work out of the box.** | ||
**Don't forget to add the [CSS stylesheet](https://github.com/arqex/react-datetime/blob/master/css/react-datetime.css) to make it work out of the box.**. You only need to do this once in your app: | ||
```js | ||
import "react-datetime/css/react-datetime.css"; | ||
``` | ||
## API | ||
@@ -45,0 +47,0 @@ |
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
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
292637
11
877
303
0