aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-02-20 16:03:41 +0800
committerGitHub <noreply@github.com>2017-02-20 16:03:41 +0800
commitdd63e6e7fa1d600d3656a4edbe5f5fc5410f443a (patch)
treed4d7f3cb8ad22cfed3a5f39408a4953b9844bf4c /src
parented8496061a1535fb82503d9723a6014a85ee7625 (diff)
parent46e5fd60344c4fa718117e82153773ab0d15ebfc (diff)
downloadtime-picker-dd63e6e7fa1d600d3656a4edbe5f5fc5410f443a.tar.gz
time-picker-dd63e6e7fa1d600d3656a4edbe5f5fc5410f443a.tar.zst
time-picker-dd63e6e7fa1d600d3656a4edbe5f5fc5410f443a.zip
Merge branch 'master' into feat-focus
Diffstat (limited to 'src')
-rw-r--r--src/TimePicker.jsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 01bab2c..aa3e0da 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -41,6 +41,7 @@ const Picker = React.createClass({
41 onOpen: PropTypes.func, 41 onOpen: PropTypes.func,
42 onClose: PropTypes.func, 42 onClose: PropTypes.func,
43 addon: PropTypes.func, 43 addon: PropTypes.func,
44 name: PropTypes.string,
44 }, 45 },
45 46
46 getDefaultProps() { 47 getDefaultProps() {
@@ -69,6 +70,7 @@ const Picker = React.createClass({
69 }, 70 },
70 71
71 getInitialState() { 72 getInitialState() {
73 this.saveInputRef = refFn.bind(this, 'picker');
72 this.savePanelRef = refFn.bind(this, 'panelInstance'); 74 this.savePanelRef = refFn.bind(this, 'panelInstance');
73 const { defaultOpen, defaultValue, open = defaultOpen, value = defaultValue } = this.props; 75 const { defaultOpen, defaultValue, open = defaultOpen, value = defaultValue } = this.props;
74 return { 76 return {
@@ -184,14 +186,14 @@ const Picker = React.createClass({
184 }, 186 },
185 187
186 focus() { 188 focus() {
187 this.refs.picker.focus(); 189 this.picker.focus();
188 }, 190 },
189 191
190 render() { 192 render() {
191 const { 193 const {
192 prefixCls, placeholder, placement, align, 194 prefixCls, placeholder, placement, align,
193 disabled, transitionName, style, className, showHour, 195 disabled, transitionName, style, className, showHour,
194 showMinute, showSecond, getPopupContainer, 196 showMinute, showSecond, getPopupContainer, name,
195 } = this.props; 197 } = this.props;
196 const { open, value } = this.state; 198 const { open, value } = this.state;
197 let popupClassName; 199 let popupClassName;
@@ -216,7 +218,10 @@ const Picker = React.createClass({
216 <span className={`${prefixCls} ${className}`} style={style}> 218 <span className={`${prefixCls} ${className}`} style={style}>
217 <input 219 <input
218 className={`${prefixCls}-input`} 220 className={`${prefixCls}-input`}
219 ref="picker" type="text" placeholder={placeholder} 221 ref={this.saveInputRef}
222 type="text"
223 placeholder={placeholder}
224 name={name}
220 readOnly 225 readOnly
221 onKeyDown={this.onKeyDown} 226 onKeyDown={this.onKeyDown}
222 disabled={disabled} value={value && value.format(this.getFormat()) || ''} 227 disabled={disabled} value={value && value.format(this.getFormat()) || ''}