Merge branch 'pepesenaris-dev' into dev

* pepesenaris-dev:
  Add onDismiss for TimePicker
  Add optional cancel handler in dialog dismiss
old
Javi Velasco 2016-10-22 16:56:30 +02:00
commit 9f710bfdf9
2 changed files with 11 additions and 3 deletions

View File

@ -36,6 +36,7 @@ const factory = (Input, DatePickerDialog) => {
okLabel: PropTypes.string,
onChange: PropTypes.func,
onClick: PropTypes.func,
onDismiss: PropTypes.func,
onEscKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,
onOverlayClick: PropTypes.func,
@ -68,6 +69,9 @@ const factory = (Input, DatePickerDialog) => {
handleDismiss = () => {
this.setState({active: false});
if (this.props.onDismiss) {
this.props.onDismiss();
}
};
handleInputFocus = (event) => {
@ -100,7 +104,7 @@ const factory = (Input, DatePickerDialog) => {
};
render () {
const { active, // eslint-disable-line
const { active, onDismiss,// eslint-disable-line
autoOk, cancelLabel, inputClassName, inputFormat, locale, maxDate, minDate,
okLabel, onEscKeyDown, onOverlayClick, readonly, sundayFirstDayOfWeek, value,
...others } = this.props;
@ -134,8 +138,8 @@ const factory = (Input, DatePickerDialog) => {
maxDate={maxDate}
minDate={minDate}
name={this.props.name}
okLabel={okLabel}
onDismiss={this.handleDismiss}
okLabel={okLabel}
onEscKeyDown={onEscKeyDown || this.handleDismiss}
onOverlayClick={onOverlayClick || this.handleDismiss}
onSelect={this.handleSelect}

View File

@ -22,6 +22,7 @@ const factory = (TimePickerDialog, Input) => {
okLabel: PropTypes.string,
onChange: PropTypes.func,
onClick: PropTypes.func,
onDismiss: PropTypes.func,
onEscKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,
onOverlayClick: PropTypes.func,
@ -50,6 +51,9 @@ const factory = (TimePickerDialog, Input) => {
handleDismiss = () => {
this.setState({active: false});
if (this.props.onDismiss) {
this.props.onDismiss();
}
};
handleInputFocus = (event) => {
@ -83,7 +87,7 @@ const factory = (TimePickerDialog, Input) => {
render () {
const {
active, // eslint-disable-line
active, onDismiss, // eslint-disable-line
cancelLabel, format, inputClassName, okLabel, onEscKeyDown, onOverlayClick,
readonly, value, ...others
} = this.props;