Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions dist/react-pikaday-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ return /******/ (function(modules) { // webpackBootstrap
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, exports, __webpack_require__) {

'use strict';

Expand Down Expand Up @@ -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',
Expand All @@ -134,26 +134,31 @@ 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,
disabled = _props.disabled,
placeholder = _props.placeholder,
readOnly = _props.readOnly,
style = _props.style;
style = _props.style,
_onChange = _props.onChange;


return _react2.default.createElement('input', {
id: id,
type: 'text',
type: type,
ref: 'pikaday',
name: name,
className: className,
style: style,
placeholder: placeholder,
disabled: disabled,
readOnly: readOnly,
tabIndex: tabIndex
tabIndex: tabIndex,
onChange: function onChange(e) {
return e.target.value === '' ? _onChange(undefined) : null;
}
});
}
}, {
Expand Down Expand Up @@ -235,6 +240,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,
Expand All @@ -251,22 +257,25 @@ 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'];

/***/ },
/***/ }),
/* 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__;

/***/ }
/***/ })
/******/ ])
});
;
2 changes: 1 addition & 1 deletion dist/react-pikaday-component.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ var ReactPikadayComponent = function (_React$Component) {
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',
Expand Down Expand Up @@ -85,7 +85,8 @@ var ReactPikadayComponent = function (_React$Component) {
disabled = _props.disabled,
placeholder = _props.placeholder,
readOnly = _props.readOnly,
style = _props.style;
style = _props.style,
_onChange = _props.onChange;


return _react2.default.createElement('input', {
Expand All @@ -98,7 +99,10 @@ var ReactPikadayComponent = function (_React$Component) {
placeholder: placeholder,
disabled: disabled,
readOnly: readOnly,
tabIndex: tabIndex
tabIndex: tabIndex,
onChange: function onChange(e) {
return e.target.value === '' ? _onChange(undefined) : null;
}
});
}
}, {
Expand Down
5 changes: 3 additions & 2 deletions src/ReactPikadayComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -63,7 +63,7 @@ class ReactPikadayComponent extends React.Component {
}

render() {
const { id, type, className, name, tabIndex, disabled, placeholder, readOnly, style } = this.props;
const { id, type, className, name, tabIndex, disabled, placeholder, readOnly, style, onChange } = this.props;

return (
<input
Expand All @@ -77,6 +77,7 @@ class ReactPikadayComponent extends React.Component {
disabled={disabled}
readOnly={readOnly}
tabIndex={tabIndex}
onChange={(e) => (e.target.value === '' ? onChange(undefined) : null)}
/>
);
}
Expand Down