From ef94eaccb8591780db30053816222076da796108 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 30 Mar 2017 16:32:33 -0400 Subject: [PATCH 1/3] only set the date after changing min and max date - this was causing a bug where new dates would be set, but the main date was still constrained by the old min/max dates --- src/ReactPikadayComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ReactPikadayComponent.js b/src/ReactPikadayComponent.js index c4fdb95..b69babb 100644 --- a/src/ReactPikadayComponent.js +++ b/src/ReactPikadayComponent.js @@ -41,9 +41,9 @@ class ReactPikadayComponent extends React.Component { const newDate = this._getValueLink(nextProps).value; const lastDate = this._getValueLink(this.props).value; - this._setDateIfChanged(newDate, lastDate); this._setMinDateIfChanged(nextProps.minDate, this.props.minDate); this._setMaxDateIfChanged(nextProps.maxDate, this.props.maxDate); + this._setDateIfChanged(newDate, lastDate); } componentDidUpdate(prevProps) { From ef43a8da48155cba9b82cb9e1f76855f7f66138a Mon Sep 17 00:00:00 2001 From: david Date: Fri, 31 Mar 2017 09:52:18 -0400 Subject: [PATCH 2/3] npm install && npm run build --- dist/react-pikaday-component.js | 9 +++++++-- dist/react-pikaday-component.min.js | 2 +- index.js | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dist/react-pikaday-component.js b/dist/react-pikaday-component.js index 51b591e..e7b80ef 100644 --- a/dist/react-pikaday-component.js +++ b/dist/react-pikaday-component.js @@ -107,9 +107,9 @@ return /******/ (function(modules) { // webpackBootstrap var newDate = this._getValueLink(nextProps).value; var lastDate = this._getValueLink(this.props).value; - this._setDateIfChanged(newDate, lastDate); this._setMinDateIfChanged(nextProps.minDate, this.props.minDate); this._setMaxDateIfChanged(nextProps.maxDate, this.props.maxDate); + this._setDateIfChanged(newDate, lastDate); } }, { key: 'componentDidUpdate', @@ -134,6 +134,7 @@ return /******/ (function(modules) { // webpackBootstrap value: function render() { var _props = this.props, id = _props.id, + type = _props.type, className = _props.className, name = _props.name, tabIndex = _props.tabIndex, @@ -145,7 +146,7 @@ return /******/ (function(modules) { // webpackBootstrap return _react2.default.createElement('input', { id: id, - type: 'text', + type: type, ref: 'pikaday', name: name, className: className, @@ -235,6 +236,7 @@ return /******/ (function(modules) { // webpackBootstrap ReactPikadayComponent.propTypes = { id: _react.PropTypes.string, + type: _react.PropTypes.string, value: _react.PropTypes.instanceOf(Date), onChange: _react.PropTypes.func, disabled: _react.PropTypes.bool, @@ -251,6 +253,9 @@ return /******/ (function(modules) { // webpackBootstrap // see Pikaday options at https://github.com/dbushell/Pikaday#configuration // except `onSelect` and `field` }; + ReactPikadayComponent.defaultProps = { + type: 'text' + }; exports.default = ReactPikadayComponent; module.exports = exports['default']; diff --git a/dist/react-pikaday-component.min.js b/dist/react-pikaday-component.min.js index f990a5f..942c0e6 100644 --- a/dist/react-pikaday-component.min.js +++ b/dist/react-pikaday-component.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("pikaday"),require("react")):"function"==typeof define&&define.amd?define("ReactPikadayComponent",["pikaday","react"],t):"object"==typeof exports?exports.ReactPikadayComponent=t(require("pikaday"),require("react")):e.ReactPikadayComponent=t(e.Pikaday,e.React)}(this,function(e,t){return function(e){function t(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return e[a].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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 p=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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 p=Object.assign||function(e){for(var t=1;t Date: Tue, 30 May 2017 13:36:14 -0400 Subject: [PATCH 3/3] Add onChange event to input to listen to clearing changes - MAIN-20873 --- dist/react-pikaday-component.js | 20 ++++++++++++-------- dist/react-pikaday-component.min.js | 2 +- index.js | 8 ++++++-- src/ReactPikadayComponent.js | 3 ++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/dist/react-pikaday-component.js b/dist/react-pikaday-component.js index e7b80ef..5a314ab 100644 --- a/dist/react-pikaday-component.js +++ b/dist/react-pikaday-component.js @@ -52,7 +52,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -141,7 +141,8 @@ return /******/ (function(modules) { // webpackBootstrap disabled = _props.disabled, placeholder = _props.placeholder, readOnly = _props.readOnly, - style = _props.style; + style = _props.style, + _onChange = _props.onChange; return _react2.default.createElement('input', { @@ -154,7 +155,10 @@ return /******/ (function(modules) { // webpackBootstrap placeholder: placeholder, disabled: disabled, readOnly: readOnly, - tabIndex: tabIndex + tabIndex: tabIndex, + onChange: function onChange(e) { + return e.target.value === '' ? _onChange(undefined) : null; + } }); } }, { @@ -259,19 +263,19 @@ return /******/ (function(modules) { // webpackBootstrap exports.default = ReactPikadayComponent; module.exports = exports['default']; -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_1__; -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; -/***/ } +/***/ }) /******/ ]) }); ; \ No newline at end of file diff --git a/dist/react-pikaday-component.min.js b/dist/react-pikaday-component.min.js index 942c0e6..03c1504 100644 --- a/dist/react-pikaday-component.min.js +++ b/dist/react-pikaday-component.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("pikaday"),require("react")):"function"==typeof define&&define.amd?define("ReactPikadayComponent",["pikaday","react"],t):"object"==typeof exports?exports.ReactPikadayComponent=t(require("pikaday"),require("react")):e.ReactPikadayComponent=t(e.Pikaday,e.React)}(this,function(e,t){return function(e){function t(a){if(n[a])return n[a].exports;var o=n[a]={exports:{},id:a,loaded:!1};return e[a].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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 p=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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 s(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 u=Object.assign||function(e){for(var t=1;t (e.target.value === '' ? onChange(undefined) : null)} /> ); }