Add optional cancel handler in dialog dismiss

old
Jose Javier Señaris 2016-10-16 12:49:32 -03:00
parent c7ef9ea772
commit c2da4d8547
1 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ const factory = (Input, DatePickerDialog) => {
name: PropTypes.string,
onChange: PropTypes.func,
onClick: PropTypes.func,
onDismiss: PropTypes.func,
onEscKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,
onOverlayClick: PropTypes.func,
@ -101,7 +102,7 @@ const factory = (Input, DatePickerDialog) => {
const { active, // eslint-disable-line
autoOk, inputClassName, inputFormat, locale, maxDate, minDate,
onEscKeyDown, onOverlayClick, readonly, sundayFirstDayOfWeek, value,
...others } = this.props;
onDismiss, ...others } = this.props;
const finalInputFormat = inputFormat || time.formatDate;
const date = Object.prototype.toString.call(value) === '[object Date]' ? value : undefined;
const formattedDate = date === undefined ? '' : finalInputFormat(value, locale);
@ -131,7 +132,7 @@ const factory = (Input, DatePickerDialog) => {
maxDate={maxDate}
minDate={minDate}
name={this.props.name}
onDismiss={this.handleDismiss}
onDismiss={onDismiss || this.handleDismiss}
onEscKeyDown={onEscKeyDown || this.handleDismiss}
onOverlayClick={onOverlayClick || this.handleDismiss}
onSelect={this.handleSelect}