From 71bd9bc11f2ca6068f7977ff3511b2798f73d0c6 Mon Sep 17 00:00:00 2001 From: MG12 Date: Mon, 14 Dec 2015 00:50:41 +0800 Subject: update disabled options --- src/module/Combobox.jsx | 22 ++++++++++++++-------- src/module/Header.jsx | 15 +++++++++------ src/module/Panel.jsx | 19 +++++++++---------- 3 files changed, 32 insertions(+), 24 deletions(-) (limited to 'src/module') diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index 1e172a7..7374b39 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx @@ -31,9 +31,9 @@ const Combobox = React.createClass({ hourOptions: PropTypes.array, minuteOptions: PropTypes.array, secondOptions: PropTypes.array, - disabledHours: PropTypes.array, - disabledMinutes: PropTypes.array, - disabledSeconds: PropTypes.array, + disabledHours: PropTypes.func, + disabledMinutes: PropTypes.func, + disabledSeconds: PropTypes.func, onCurrentSelectPanelChange: PropTypes.func, }, @@ -64,10 +64,12 @@ const Combobox = React.createClass({ if (!showHour) { return null; } + const disabledOptions = disabledHours(); + return ( formatOption(option, disabledMinutes))} + options={minuteOptions.map(option => formatOption(option, disabledOptions))} selectedIndex={minuteOptions.indexOf(minute)} type="minute" onSelect={this.onItemChange} @@ -91,14 +95,16 @@ const Combobox = React.createClass({ }, getSecondSelect(second) { - const { prefixCls, secondOptions, disabledSeconds, showSecond } = this.props; + const { prefixCls, secondOptions, disabledSeconds, showSecond, value } = this.props; if (!showSecond) { return null; } + const disabledOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); + return (