diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f80d9..04b5ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +v2.0.4 - Tue, 12 Jul 2016 09:16:42 GMT +-------------------------------------- + +- + + v2.0.3 - Tue, 12 Jul 2016 09:15:00 GMT -------------------------------------- diff --git a/dist/mobile-datepicker.js b/dist/mobile-datepicker.js index 79e7fc2..07c05f5 100644 --- a/dist/mobile-datepicker.js +++ b/dist/mobile-datepicker.js @@ -124,7 +124,6 @@ return /******/ (function(modules) { // webpackBootstrap var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DatePicker).call(this, props)); _this.state = { - angle: 0, date: _this._productDate(props.date), minDate: _this._productDate(props.minDate), maxDate: _this._productDate(props.maxDate) @@ -136,6 +135,20 @@ return /******/ (function(modules) { // webpackBootstrap } _createClass(DatePicker, [{ + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(nextProps) { + this.setState({ + date: this._productDate(nextProps.date), + minDate: this._productDate(nextProps.minDate), + maxDate: this._productDate(nextProps.maxDate) + }); + } + }, { + key: 'shouldComponentUpdate', + value: function shouldComponentUpdate(nextProps, nextState) { + return nextState.date.timestamp !== this.state.date.timestamp || nextProps.date !== this.props.date || nextProps.minDate !== this.props.minDate || nextProps.maxDate !== this.props.maxDate; + } + }, { key: '_productDate', value: function _productDate(date) { var nDate = (0, _time.nextDate)(date, 0); diff --git a/dist/mobile-datepicker.min.js b/dist/mobile-datepicker.min.js index 5fe13af..e498e87 100644 --- a/dist/mobile-datepicker.min.js +++ b/dist/mobile-datepicker.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.DatePicker=t(require("react")):e.DatePicker=t(e.react)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),n(1);var a=n(2),o=r(a);t["default"]=o["default"]},function(e,t){},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;na&&l>i||oi?s=1:(o>a&&l0?((40-e)/40*100|0)/100:((40+e)/40*100|0)/100}},{key:"_clearTransition",value:function(e){e.style[m.TRANSITION]=""}},{key:"_moveToNext",value:function(e){var t=this.props,n=t.typeName,r=t.date,a=t.maxDate,o=t.minDate,i=y["next"+n](r.value,e),l=1===e?i.getTime()<=a.timestamp:i.getTime()>=o.timestamp;l?this.props.onSelect(i):this._moveTo(this.refs.scroll,this.angle)}},{key:"_moveTo",value:function(e,t){this.animating=!0,e.style[m.TRANSITION]="all .2s ease-out",this.setState({angle:t})}},{key:"handleContentTouch",value:function(e){if(e.preventDefault(),!this.animating)if("touchstart"===e.type)this.touchY=e.targetTouches[0].pageY,this.angle=this.state.angle;else if("touchmove"===e.type){var t=e.targetTouches[0].pageY,n=t-this.touchY,r=this.angle-parseInt(22.5*n/180,10);this.setState({angle:r})}else if("touchend"===e.type){var a=e.changedTouches[0].pageY,o=a-this.touchY,i=o>0?-1:1;1===i&&this.props.touchLen<-o||i===-1&&this.props.touchLenr&&s>i||oi?l=1:(o>r&&s0?((40-e)/40*100|0)/100:((40+e)/40*100|0)/100}},{key:"_clearTransition",value:function(e){e.style[y.TRANSITION]=""}},{key:"_moveToNext",value:function(e){var t=this.props,n=t.typeName,a=t.date,r=t.maxDate,o=t.minDate,i=m["next"+n](a.value,e),s=1===e?i.getTime()<=r.timestamp:i.getTime()>=o.timestamp;s?this.props.onSelect(i):this._moveTo(this.refs.scroll,this.angle)}},{key:"_moveTo",value:function(e,t){this.animating=!0,e.style[y.TRANSITION]="all .2s ease-out",this.setState({angle:t})}},{key:"handleContentTouch",value:function(e){if(e.preventDefault(),!this.animating)if("touchstart"===e.type)this.touchY=e.targetTouches[0].pageY,this.angle=this.state.angle;else if("touchmove"===e.type){var t=e.targetTouches[0].pageY,n=t-this.touchY,a=this.angle-parseInt(22.5*n/180,10);this.setState({angle:a})}else if("touchend"===e.type){var r=e.changedTouches[0].pageY,o=r-this.touchY,i=o>0?-1:1;1===i&&this.props.touchLen<-o||i===-1&&this.props.touchLen