X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FTimePicker.jsx;h=f9b92078c9be3714681704795ced2c28339c41fa;hb=6fc4e0e8e2f7bd8bbcbb759a69bc7b94930f131c;hp=2354db8887300e829c4f9effc6a91ae23eb9b5a7;hpb=96d366afb6e5b4821c87af25cfbfbc8a4eccc2d7;p=github%2Ffretlink%2Ftime-picker.git diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index 2354db8..f9b9207 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx @@ -4,7 +4,6 @@ import Panel from './module/Panel'; import placements from './util/placements'; import CommonMixin from './mixin/CommonMixin'; import {getFormatter} from './util/index'; -import defaultGregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US'; function noop() { } @@ -27,16 +26,16 @@ const Picker = React.createClass({ placement: PropTypes.any, transitionName: PropTypes.string, getPopupContainer: PropTypes.func, - gregorianCalendarLocale: PropTypes.object, placeholder: PropTypes.string, formatter: PropTypes.any, showHour: PropTypes.bool, style: PropTypes.object, className: PropTypes.string, showSecond: PropTypes.bool, - hourOptions: PropTypes.array, - minuteOptions: PropTypes.array, - secondOptions: PropTypes.array, + disabledHours: PropTypes.func, + disabledMinutes: PropTypes.func, + disabledSeconds: PropTypes.func, + hideDisabledOptions: PropTypes.bool, onChange: PropTypes.func, onOpen: PropTypes.func, onClose: PropTypes.func, @@ -49,11 +48,14 @@ const Picker = React.createClass({ defaultOpen: false, style: {}, className: '', - gregorianCalendarLocale: defaultGregorianCalendarLocale, align: {}, allowEmpty: true, showHour: true, showSecond: true, + disabledHours: noop, + disabledMinutes: noop, + disabledSeconds: noop, + hideDisabledOptions: false, placement: 'bottomLeft', onChange: noop, onOpen: noop, @@ -72,7 +74,7 @@ const Picker = React.createClass({ componentWillReceiveProps(nextProps) { const { value, open } = nextProps; - if (value !== undefined) { + if ('value' in nextProps) { this.setState({ value, }); @@ -145,22 +147,15 @@ const Picker = React.createClass({ }, getPanelElement() { - const { prefixCls, defaultValue, locale, placeholder, hourOptions, minuteOptions, secondOptions, allowEmpty, showHour, showSecond, gregorianCalendarLocale, value } = this.props; - let calendarLocale; - if (value) { - calendarLocale = value.locale; - } else if (defaultValue) { - calendarLocale = defaultValue.locale; - } else { - calendarLocale = gregorianCalendarLocale; - } + const { prefixCls, defaultValue, locale, placeholder, disabledHours, + disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond } = this.props; return ( ); }, @@ -199,7 +195,7 @@ const Picker = React.createClass({ const { open, value } = this.state; let popupClassName; if (!showHour || !showSecond) { - popupClassName = `${prefixCls}-panel-narrow}`; + popupClassName = `${prefixCls}-panel-narrow`; } return (