aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--README.md1
-rw-r--r--src/TimePicker.jsx11
3 files changed, 10 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index e780b32..d2c1fdb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ notifications:
7 - yiminghe@gmail.com 7 - yiminghe@gmail.com
8 8
9node_js: 9node_js:
10- 4.0.0 10- 6
11 11
12before_install: 12before_install:
13- | 13- |
diff --git a/README.md b/README.md
index 05182c2..4a36815 100644
--- a/README.md
+++ b/README.md
@@ -71,6 +71,7 @@ API
71| addon | Function | nothing | called from timepicker panel to render some addon to its bottom, like an OK button. Receives panel instance as parameter, to be able to close it like `panel.close()`.| 71| addon | Function | nothing | called from timepicker panel to render some addon to its bottom, like an OK button. Receives panel instance as parameter, to be able to close it like `panel.close()`.|
72| placement | String | bottomLeft | one of ['left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'] | 72| placement | String | bottomLeft | one of ['left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'] |
73| transitionName | String | '' | | 73| transitionName | String | '' | |
74| name | String | nothing | sets the name of the generated input |
74 75
75 76
76## Test Case 77## Test Case
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()) || ''}