aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
author偏右 <afc163@gmail.com>2017-02-20 15:59:58 +0800
committerGitHub <noreply@github.com>2017-02-20 15:59:58 +0800
commitee6394229b2340c70c342851ecf5dba3462ac4ef (patch)
tree98c76dec8cf04bdd52183bf519c982391b103f3e
parent8c2e96b8ab6688db31b811946213af9b0bff8f84 (diff)
parent679773bb9664038f2f00e2b6d5e9c9d30b96acd1 (diff)
downloadtime-picker-ee6394229b2340c70c342851ecf5dba3462ac4ef.tar.gz
time-picker-ee6394229b2340c70c342851ecf5dba3462ac4ef.tar.zst
time-picker-ee6394229b2340c70c342851ecf5dba3462ac4ef.zip
Merge pull request #30 from fehnomenal/add-name-prop
Add prop for naming the input
-rw-r--r--README.md1
-rw-r--r--src/TimePicker.jsx4
2 files changed, 4 insertions, 1 deletions
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 ec3eda0..e6c2031 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() {
@@ -187,7 +188,7 @@ const Picker = React.createClass({
187 const { 188 const {
188 prefixCls, placeholder, placement, align, 189 prefixCls, placeholder, placement, align,
189 disabled, transitionName, style, className, showHour, 190 disabled, transitionName, style, className, showHour,
190 showMinute, showSecond, getPopupContainer, 191 showMinute, showSecond, getPopupContainer, name,
191 } = this.props; 192 } = this.props;
192 const { open, value } = this.state; 193 const { open, value } = this.state;
193 let popupClassName; 194 let popupClassName;
@@ -213,6 +214,7 @@ const Picker = React.createClass({
213 <input 214 <input
214 className={`${prefixCls}-input`} 215 className={`${prefixCls}-input`}
215 ref="picker" type="text" placeholder={placeholder} 216 ref="picker" type="text" placeholder={placeholder}
217 name={name}
216 readOnly 218 readOnly
217 onKeyDown={this.onKeyDown} 219 onKeyDown={this.onKeyDown}
218 disabled={disabled} value={value && value.format(this.getFormat()) || ''} 220 disabled={disabled} value={value && value.format(this.getFormat()) || ''}