From d9a9b69178669117327ec65a362cd3c8f3e60373 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Wed, 15 Nov 2017 14:59:01 +0800 Subject: Add blur() and autoFocus --- src/TimePicker.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index c7ff80a..9a91a2c 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx @@ -53,6 +53,7 @@ export default class Picker extends Component { secondStep: PropTypes.number, focusOnOpen: PropTypes.bool, onKeyDown: PropTypes.func, + autoFocus: PropTypes.bool, }; static defaultProps = { @@ -243,11 +244,15 @@ export default class Picker extends Component { this.picker.focus(); } + blur() { + this.picker.blur(); + } + render() { const { prefixCls, placeholder, placement, align, disabled, transitionName, style, className, getPopupContainer, name, autoComplete, - onFocus, onBlur, + onFocus, onBlur, autoFocus, } = this.props; const { open, value } = this.state; const popupClassName = this.getPopupClassName(); @@ -273,12 +278,13 @@ export default class Picker extends Component { type="text" placeholder={placeholder} name={name} - readOnly onKeyDown={this.onKeyDown} - disabled={disabled} value={value && value.format(this.getFormat()) || ''} + disabled={disabled} + value={value && value.format(this.getFormat()) || ''} autoComplete={autoComplete} onFocus={onFocus} onBlur={onBlur} + autoFocus={autoFocus} /> -- cgit v1.2.3