From: 偏右 Date: Mon, 20 Feb 2017 08:03:41 +0000 (+0800) Subject: Merge branch 'master' into feat-focus X-Git-Tag: 2.2.2~4^2^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=dd63e6e7fa1d600d3656a4edbe5f5fc5410f443a;hp=ed8496061a1535fb82503d9723a6014a85ee7625;p=github%2Ffretlink%2Ftime-picker.git Merge branch 'master' into feat-focus --- diff --git a/.travis.yml b/.travis.yml index e780b32..d2c1fdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ notifications: - yiminghe@gmail.com node_js: -- 4.0.0 +- 6 before_install: - | diff --git a/README.md b/README.md index 05182c2..4a36815 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ API | 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()`.| | placement | String | bottomLeft | one of ['left','right','top','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'] | | transitionName | String | '' | | +| name | String | nothing | sets the name of the generated input | ## 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({ onOpen: PropTypes.func, onClose: PropTypes.func, addon: PropTypes.func, + name: PropTypes.string, }, getDefaultProps() { @@ -69,6 +70,7 @@ const Picker = React.createClass({ }, getInitialState() { + this.saveInputRef = refFn.bind(this, 'picker'); this.savePanelRef = refFn.bind(this, 'panelInstance'); const { defaultOpen, defaultValue, open = defaultOpen, value = defaultValue } = this.props; return { @@ -184,14 +186,14 @@ const Picker = React.createClass({ }, focus() { - this.refs.picker.focus(); + this.picker.focus(); }, render() { const { prefixCls, placeholder, placement, align, disabled, transitionName, style, className, showHour, - showMinute, showSecond, getPopupContainer, + showMinute, showSecond, getPopupContainer, name, } = this.props; const { open, value } = this.state; let popupClassName; @@ -216,7 +218,10 @@ const Picker = React.createClass({