diff options
author | Wei Zhu <yesmeck@gmail.com> | 2017-11-15 14:59:01 +0800 |
---|---|---|
committer | Wei Zhu <yesmeck@gmail.com> | 2017-11-15 14:59:01 +0800 |
commit | d9a9b69178669117327ec65a362cd3c8f3e60373 (patch) | |
tree | 8caa6b876e7bfe2e6f317954a3930f56c0b0234d /src | |
parent | 5ee034436ac8ea322be48ba58c5ca691578df452 (diff) | |
download | time-picker-d9a9b69178669117327ec65a362cd3c8f3e60373.tar.gz time-picker-d9a9b69178669117327ec65a362cd3c8f3e60373.tar.zst time-picker-d9a9b69178669117327ec65a362cd3c8f3e60373.zip |
Add blur() and autoFocus
Diffstat (limited to 'src')
-rw-r--r-- | src/TimePicker.jsx | 12 |
1 files changed, 9 insertions, 3 deletions
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 { | |||
53 | secondStep: PropTypes.number, | 53 | secondStep: PropTypes.number, |
54 | focusOnOpen: PropTypes.bool, | 54 | focusOnOpen: PropTypes.bool, |
55 | onKeyDown: PropTypes.func, | 55 | onKeyDown: PropTypes.func, |
56 | autoFocus: PropTypes.bool, | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | static defaultProps = { | 59 | static defaultProps = { |
@@ -243,11 +244,15 @@ export default class Picker extends Component { | |||
243 | this.picker.focus(); | 244 | this.picker.focus(); |
244 | } | 245 | } |
245 | 246 | ||
247 | blur() { | ||
248 | this.picker.blur(); | ||
249 | } | ||
250 | |||
246 | render() { | 251 | render() { |
247 | const { | 252 | const { |
248 | prefixCls, placeholder, placement, align, | 253 | prefixCls, placeholder, placement, align, |
249 | disabled, transitionName, style, className, getPopupContainer, name, autoComplete, | 254 | disabled, transitionName, style, className, getPopupContainer, name, autoComplete, |
250 | onFocus, onBlur, | 255 | onFocus, onBlur, autoFocus, |
251 | } = this.props; | 256 | } = this.props; |
252 | const { open, value } = this.state; | 257 | const { open, value } = this.state; |
253 | const popupClassName = this.getPopupClassName(); | 258 | const popupClassName = this.getPopupClassName(); |
@@ -273,12 +278,13 @@ export default class Picker extends Component { | |||
273 | type="text" | 278 | type="text" |
274 | placeholder={placeholder} | 279 | placeholder={placeholder} |
275 | name={name} | 280 | name={name} |
276 | readOnly | ||
277 | onKeyDown={this.onKeyDown} | 281 | onKeyDown={this.onKeyDown} |
278 | disabled={disabled} value={value && value.format(this.getFormat()) || ''} | 282 | disabled={disabled} |
283 | value={value && value.format(this.getFormat()) || ''} | ||
279 | autoComplete={autoComplete} | 284 | autoComplete={autoComplete} |
280 | onFocus={onFocus} | 285 | onFocus={onFocus} |
281 | onBlur={onBlur} | 286 | onBlur={onBlur} |
287 | autoFocus={autoFocus} | ||
282 | /> | 288 | /> |
283 | <span className={`${prefixCls}-icon`}/> | 289 | <span className={`${prefixCls}-icon`}/> |
284 | </span> | 290 | </span> |