Merge pull request #5 from anateus/feature/blur
Added a simulation of onBlur to enable final save events and the like
| | |
| | | }, |
| | | propTypes: { |
| | | date: TYPES.object, |
| | | onBlur: TYPES.func, |
| | | onChange: TYPES.func, |
| | | locale: TYPES.string, |
| | | input: TYPES.bool, |
| | |
| | | viewMode: 'days', |
| | | inputProps: {}, |
| | | input: true, |
| | | onBlur: function () {}, |
| | | onChange: function (x) { |
| | | console.log(x); |
| | | } |
| | |
| | | selectedDate: date, |
| | | viewDate: date.clone().startOf('month'), |
| | | inputValue: date.format( this.state.inputFormat ) |
| | | }); |
| | | }, this.callOnChange ); |
| | | }, |
| | | |
| | | openCalendar: function() { |
| | |
| | | }, |
| | | |
| | | handleClickOutside: function(){ |
| | | this.props.onBlur(this.state.inputValue); |
| | | if( this.props.input && this.state.open ) |
| | | this.setState({ open: false }); |
| | | }, |
| | |
| | | | **input** | boolean | true | Wether to show an input field to edit the date manually. | |
| | | | **locale** | string | null | Manually set the locale for the react-datetime instance. Moment.js locale needs to be loaded to be used, see [i18n docs](#i18n). |
| | | | **onChange** | function | x => console.log(x) | Callback trigger when the date changes | |
| | | | **onBlur** | function | empty function | Callback trigger for when the user clicks outside of the input, simulating a regular onBlur | |
| | | | **viewMode** | string or number | 'days' | The default view to display when the picker is shown. ('years', 'months', 'days', 'time') | |
| | | | **inputProps** | object | undefined | Defines additional attributes for the input element of the component. | |
| | | | **minDate** | moment | undefined | The earliest date allowed for entry in the calendar view. | |