X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FTimePicker.jsx;h=6b762230223844c7a1f28ca0ebe2aebdb4b45f5a;hb=dd275f7df354e218d170ddbcc1eadff1427db76b;hp=28857a07796da025a5a139d436f6e019ff19353e;hpb=fa912931fa6952cf85fe4b35bd15cd83f3e32876;p=github%2Ffretlink%2Ftime-picker.git diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index 28857a0..6b76223 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx @@ -41,6 +41,9 @@ const Picker = React.createClass({ onOpen: PropTypes.func, onClose: PropTypes.func, addon: PropTypes.func, + name: PropTypes.string, + autoComplete: PropTypes.string, + use12Hours: PropTypes.bool, }, getDefaultProps() { @@ -65,6 +68,7 @@ const Picker = React.createClass({ onOpen: noop, onClose: noop, addon: noop, + use12Hours: false, }; }, @@ -105,7 +109,7 @@ const Picker = React.createClass({ onEsc() { this.setOpen(false); - this.picker.focus(); + this.focus(); }, onKeyDown(e) { @@ -140,7 +144,7 @@ const Picker = React.createClass({ prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText, - addon, + addon, use12Hours, } = this.props; return ( ); }, - setOpen(open, callback) { + setOpen(open) { const { onOpen, onClose } = this.props; if (this.state.open !== open) { - this.setState({ - open, - }, callback); - const event = { - open, - }; + if (!('open' in this.props)) { + this.setState({ open }); + } if (open) { - onOpen(event); + onOpen({ open }); } else { - onClose(event); + onClose({ open }); } } }, + focus() { + this.picker.focus(); + }, + render() { const { prefixCls, placeholder, placement, align, disabled, transitionName, style, className, showHour, - showMinute, showSecond, getPopupContainer, + showMinute, showSecond, getPopupContainer, name, autoComplete, } = this.props; const { open, value } = this.state; let popupClassName; @@ -213,10 +219,14 @@ const Picker = React.createClass({