diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-12-14 00:50:41 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-12-14 00:50:41 +0800 |
commit | 71bd9bc11f2ca6068f7977ff3511b2798f73d0c6 (patch) | |
tree | e24404e929db29204fa008546377351d314f9480 /src/module/Panel.jsx | |
parent | 0e62bf0b7bdc260e882fd185492939cbaed04d56 (diff) | |
download | time-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.tar.gz time-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.tar.zst time-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.zip |
update disabled options
Diffstat (limited to 'src/module/Panel.jsx')
-rw-r--r-- | src/module/Panel.jsx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/module/Panel.jsx b/src/module/Panel.jsx index 12d23f7..94d3842 100644 --- a/src/module/Panel.jsx +++ b/src/module/Panel.jsx | |||
@@ -24,9 +24,9 @@ const Panel = React.createClass({ | |||
24 | placeholder: PropTypes.string, | 24 | placeholder: PropTypes.string, |
25 | gregorianCalendarLocale: PropTypes.object, | 25 | gregorianCalendarLocale: PropTypes.object, |
26 | formatter: PropTypes.object, | 26 | formatter: PropTypes.object, |
27 | disabledHours: PropTypes.array, | 27 | disabledHours: PropTypes.func, |
28 | disabledMinutes: PropTypes.array, | 28 | disabledMinutes: PropTypes.func, |
29 | disabledSeconds: PropTypes.array, | 29 | disabledSeconds: PropTypes.func, |
30 | hideDisabledOptions: PropTypes.bool, | 30 | hideDisabledOptions: PropTypes.bool, |
31 | onChange: PropTypes.func, | 31 | onChange: PropTypes.func, |
32 | onEsc: PropTypes.func, | 32 | onEsc: PropTypes.func, |
@@ -40,10 +40,6 @@ const Panel = React.createClass({ | |||
40 | 40 | ||
41 | getDefaultProps() { | 41 | getDefaultProps() { |
42 | return { | 42 | return { |
43 | disabledHours: null, | ||
44 | disabledMinutes: null, | ||
45 | disabledSeconds: null, | ||
46 | hideDisabledOptions: false, | ||
47 | onChange: noop, | 43 | onChange: noop, |
48 | onClear: noop, | 44 | onClear: noop, |
49 | }; | 45 | }; |
@@ -81,9 +77,12 @@ const Panel = React.createClass({ | |||
81 | render() { | 77 | render() { |
82 | const { locale, prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, formatter, gregorianCalendarLocale } = this.props; | 78 | const { locale, prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, formatter, gregorianCalendarLocale } = this.props; |
83 | const value = this.state.value; | 79 | const value = this.state.value; |
84 | const hourOptions = generateOptions(24, disabledHours, hideDisabledOptions); | 80 | const disabledHourOptions = disabledHours(); |
85 | const minuteOptions = generateOptions(60, disabledMinutes, hideDisabledOptions); | 81 | const disabledMinuteOptions = disabledMinutes(value.getHourOfDay()); |
86 | const secondOptions = generateOptions(60, disabledSeconds, hideDisabledOptions); | 82 | const disabledSecondOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); |
83 | const hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); | ||
84 | const minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); | ||
85 | const secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); | ||
87 | 86 | ||
88 | return ( | 87 | return ( |
89 | <div className={`${prefixCls}-inner`}> | 88 | <div className={`${prefixCls}-inner`}> |