From dd275f7df354e218d170ddbcc1eadff1427db76b Mon Sep 17 00:00:00 2001 From: Antony Shaleynikov Date: Thu, 2 Mar 2017 11:02:45 +0300 Subject: [PATCH] show12Hours prop was renamed to use12Hours --- README.md | 4 ++-- src/Combobox.jsx | 18 +++++++++--------- src/Panel.jsx | 8 ++++---- src/TimePicker.jsx | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b9d06fd..d8a35b9 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ API | value | moment | null | current value | | placeholder | String | '' | time input's placeholder | | showHour | Boolean | whether show hour | | -| showMinute | Boolean | whether show minute | | +| showMinute | Boolean | whether show minute | | | showSecond | Boolean | whether show second | | | format | String | | | | disabledHours | Function | disabled hour options | | | disabledMinutes | Function | disabled minute options | | | disabledSeconds | Function | disabled second options | | -| show12Hours | Boolean | 12 hours display mode | | +| use12Hours | Boolean | 12 hours display mode | | | hideDisabledOptions | Boolean | whether hide disabled options | | | onChange | Function | null | called when select a different value | | 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()`.| diff --git a/src/Combobox.jsx b/src/Combobox.jsx index e31b7fd..339764c 100644 --- a/src/Combobox.jsx +++ b/src/Combobox.jsx @@ -35,15 +35,15 @@ const Combobox = React.createClass({ disabledMinutes: PropTypes.func, disabledSeconds: PropTypes.func, onCurrentSelectPanelChange: PropTypes.func, - show12Hours: PropTypes.bool, + use12Hours: PropTypes.bool, }, onItemChange(type, itemValue) { - const { onChange, defaultOpenValue, show12Hours } = this.props; + const { onChange, defaultOpenValue, use12Hours } = this.props; const value = (this.props.value || defaultOpenValue).clone(); if (type === 'hour') { - if (show12Hours) { + if (use12Hours) { if (value.hour() > 12 || !value.hour()) { value.hour(+itemValue + 12); } else { @@ -55,7 +55,7 @@ const Combobox = React.createClass({ } else if (type === 'minute') { value.minute(+itemValue); } else if (type === 'ampm') { - if (show12Hours) { + if (use12Hours) { if (itemValue === 'PM' && value.hour() <= 12) { value.hour(value.hour() + 12); } @@ -80,13 +80,13 @@ const Combobox = React.createClass({ }, getHourSelect(hour) { - const { prefixCls, hourOptions, disabledHours, showHour, show12Hours } = this.props; + const { prefixCls, hourOptions, disabledHours, showHour, use12Hours } = this.props; if (!showHour) { return null; } const disabledOptions = disabledHours(); let hourAdj; - if (show12Hours) { + if (use12Hours) { if (hour > 12) { hourAdj = hour - 12; } else { @@ -97,7 +97,7 @@ const Combobox = React.createClass({ } let hourOptionsAdj; - if (show12Hours) { + if (use12Hours) { hourOptionsAdj = hourOptions.filter(h => h <= 12 && h > 0); } else { hourOptionsAdj = hourOptions; @@ -156,8 +156,8 @@ const Combobox = React.createClass({ }, getAMPMSelect() { - const { prefixCls, show12Hours, defaultOpenValue } = this.props; - if (!show12Hours) { + const { prefixCls, use12Hours, defaultOpenValue } = this.props; + if (!use12Hours) { return null; } const value = this.props.value || defaultOpenValue; diff --git a/src/Panel.jsx b/src/Panel.jsx index d02bd01..df128ff 100644 --- a/src/Panel.jsx +++ b/src/Panel.jsx @@ -37,7 +37,7 @@ const Panel = React.createClass({ showMinute: PropTypes.bool, showSecond: PropTypes.bool, onClear: PropTypes.func, - show12Hours: PropTypes.bool, + use12Hours: PropTypes.bool, addon: PropTypes.func, }, @@ -50,7 +50,7 @@ const Panel = React.createClass({ disabledMinutes: noop, disabledSeconds: noop, defaultOpenValue: moment(), - show12Hours: false, + use12Hours: false, addon: noop, }; }, @@ -92,7 +92,7 @@ const Panel = React.createClass({ const { prefixCls, className, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, - format, defaultOpenValue, clearText, onEsc, addon, show12Hours, + format, defaultOpenValue, clearText, onEsc, addon, use12Hours, } = this.props; const { value, currentSelectPanel, @@ -142,7 +142,7 @@ const Panel = React.createClass({ disabledMinutes={disabledMinutes} disabledSeconds={disabledSeconds} onCurrentSelectPanelChange={this.onCurrentSelectPanelChange} - show12Hours={show12Hours} + use12Hours={use12Hours} /> {addon(this)} diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index f73d2b1..6b76223 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx @@ -43,7 +43,7 @@ const Picker = React.createClass({ addon: PropTypes.func, name: PropTypes.string, autoComplete: PropTypes.string, - show12Hours: PropTypes.bool, + use12Hours: PropTypes.bool, }, getDefaultProps() { @@ -68,7 +68,7 @@ const Picker = React.createClass({ onOpen: noop, onClose: noop, addon: noop, - show12Hours: false, + use12Hours: false, }; }, @@ -144,7 +144,7 @@ const Picker = React.createClass({ prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText, - addon, show12Hours, + addon, use12Hours, } = this.props; return ( ); -- 2.41.0