Replace onMouseDown with onClick in DatePicker and TimePicker

old
Antony Lau 2016-09-07 23:46:44 +08:00
parent 2e543ed8a0
commit ac8b6d61a7
4 changed files with 16 additions and 8 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

@ -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}

View File

@ -86,9 +86,10 @@ var factory = function factory(Input, DatePickerDialog) {
}, _this.handleInputBlur = function (event) {
_events2.default.pauseEvent(event);
_this.setState({ active: false });
}, _this.handleInputMouseDown = function (event) {
}, _this.handleInputClick = function (event) {
_events2.default.pauseEvent(event);
_this.setState({ active: true });
if (_this.props.onClick) _this.props.onClick(event);
}, _this.handleInputKeyPress = function (event) {
if (event.charCode === 13) {
_events2.default.pauseEvent(event);
@ -143,7 +144,7 @@ var factory = function factory(Input, DatePickerDialog) {
name: this.props.name,
onFocus: this.handleInputFocus,
onKeyPress: this.handleInputKeyPress,
onMouseDown: this.handleInputMouseDown,
onClick: this.handleInputClick,
readOnly: true,
type: 'text',
value: formattedDate
@ -187,6 +188,7 @@ var factory = function factory(Input, DatePickerDialog) {
onChange: _react.PropTypes.func,
onEscKeyDown: _react.PropTypes.func,
onKeyPress: _react.PropTypes.func,
onClick: _react.PropTypes.func,
onOverlayClick: _react.PropTypes.func,
readonly: _react.PropTypes.bool,
sundayFirstDayOfWeek: _react2.default.PropTypes.bool,

View File

@ -78,9 +78,10 @@ var factory = function factory(TimePickerDialog, Input) {
}, _this.handleInputBlur = function (event) {
_events2.default.pauseEvent(event);
_this.setState({ active: false });
}, _this.handleInputMouseDown = function (event) {
}, _this.handleInputClick = function (event) {
_events2.default.pauseEvent(event);
_this.setState({ active: true });
if (_this.props.onClick) _this.props.onClick(event);
}, _this.handleInputKeyPress = function (event) {
if (event.charCode === 13) {
_events2.default.pauseEvent(event);
@ -125,7 +126,7 @@ var factory = function factory(TimePickerDialog, Input) {
label: this.props.label,
name: this.props.name,
onKeyPress: this.handleInputKeyPress,
onMouseDown: this.handleInputMouseDown,
onClick: this.handleInputClick,
readOnly: true,
type: 'text',
value: formattedTime
@ -160,6 +161,7 @@ var factory = function factory(TimePickerDialog, Input) {
onChange: _react.PropTypes.func,
onEscKeyDown: _react.PropTypes.func,
onKeyPress: _react.PropTypes.func,
onClick: _react.PropTypes.func,
onOverlayClick: _react.PropTypes.func,
readonly: _react.PropTypes.bool,
theme: _react.PropTypes.shape({