Merge with dev

old
Javi Velasco 2016-09-27 00:01:49 +02:00
commit 5ba891fe19
3 changed files with 11 additions and 7 deletions

View File

@ -35,6 +35,7 @@ const factory = (Input, DatePickerDialog) => {
onChange: PropTypes.func,
onEscKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,
onClick: PropTypes.func,
onOverlayClick: PropTypes.func,
readonly: PropTypes.bool,
sundayFirstDayOfWeek: React.PropTypes.bool,
@ -77,9 +78,10 @@ const factory = (Input, DatePickerDialog) => {
this.setState({active: false});
};
handleInputMouseDown = (event) => {
handleInputClick = (event) => {
events.pauseEvent(event);
this.setState({active: true});
if (this.props.onClick) this.props.onClick(event);
};
handleInputKeyPress = (event) => {
@ -116,7 +118,7 @@ const factory = (Input, DatePickerDialog) => {
name={this.props.name}
onFocus={this.handleInputFocus}
onKeyPress={this.handleInputKeyPress}
onMouseDown={this.handleInputMouseDown}
onClick={this.handleInputClick}
readOnly
type='text'
value={formattedDate}

View File

@ -33,7 +33,7 @@ class Overlay extends Component {
componentWillUpdate (nextProps) {
if (nextProps.active && !this.props.active) document.body.style.overflow = 'hidden';
if (!nextProps.active && this.props.active) document.body.style.overflow = '';
if (!nextProps.active && this.props.active && !document.querySelectorAll('[data-react-toolbox="overlay"]')[1]) document.body.style.overflow = '';
}
componentDidUpdate () {
@ -43,7 +43,7 @@ class Overlay extends Component {
}
componentWillUnmount () {
document.body.style.overflow = '';
if (!document.querySelectorAll('[data-react-toolbox="overlay"]')[1]) document.body.style.overflow = '';
if (this.escKeyListener) {
document.body.removeEventListener('keydown', this.handleEscKey);
this.escKeyListener = null;
@ -65,7 +65,7 @@ class Overlay extends Component {
return (
<Portal>
<div className={_className}>
<div className={_className} data-react-toolbox="overlay">
<div className={theme.backdrop} onClick={onClick} />
{children}
</div>

View File

@ -21,6 +21,7 @@ const factory = (TimePickerDialog, Input) => {
onChange: PropTypes.func,
onEscKeyDown: PropTypes.func,
onKeyPress: PropTypes.func,
onClick: PropTypes.func,
onOverlayClick: PropTypes.func,
readonly: PropTypes.bool,
theme: PropTypes.shape({
@ -59,9 +60,10 @@ const factory = (TimePickerDialog, Input) => {
this.setState({active: false});
};
handleInputMouseDown = (event) => {
handleInputClick = (event) => {
events.pauseEvent(event);
this.setState({active: true});
if (this.props.onClick) this.props.onClick(event);
};
handleInputKeyPress = (event) => {
@ -93,7 +95,7 @@ const factory = (TimePickerDialog, Input) => {
label={this.props.label}
name={this.props.name}
onKeyPress={this.handleInputKeyPress}
onMouseDown={this.handleInputMouseDown}
onClick={this.handleInputClick}
readOnly
type='text'
value={formattedTime}