From 182e9fccc90ae709322b7cc314c8775a9d8d46b8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 12 Dec 2015 00:55:14 +0800 Subject: select input value range when enter different select panel --- src/module/Combobox.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/module/Combobox.jsx') diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index 3dfd321..a017ec9 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx @@ -21,6 +21,7 @@ const Combobox = React.createClass({ hourOptions: PropTypes.array, minuteOptions: PropTypes.array, secondOptions: PropTypes.array, + onCurrentSelectPanelChange: PropTypes.func, }, onItemChange(type, itemValue) { @@ -41,6 +42,10 @@ const Combobox = React.createClass({ onChange(value); }, + onEnterSelectPanel(range) { + this.props.onCurrentSelectPanelChange(range); + }, + getHourSelect(hour) { const { prefixCls, hourOptions, showHour } = this.props; if (!showHour) { @@ -53,6 +58,7 @@ const Combobox = React.createClass({ selectedIndex={hourOptions.indexOf(hour)} type="hour" onSelect={this.onItemChange} + onMouseEnter={this.onEnterSelectPanel.bind(this, 'hour')} /> ); }, @@ -66,11 +72,12 @@ const Combobox = React.createClass({ selectedIndex={minuteOptions.indexOf(minute)} type="minute" onSelect={this.onItemChange} + onMouseEnter={this.onEnterSelectPanel.bind(this, 'minute')} /> ); }, - getSectionSelect(second) { + getSecondSelect(second) { const { prefixCls, secondOptions, showSecond } = this.props; if (!showSecond) { return null; @@ -82,6 +89,7 @@ const Combobox = React.createClass({ selectedIndex={secondOptions.indexOf(second)} type="second" onSelect={this.onItemChange} + onMouseEnter={this.onEnterSelectPanel.bind(this, 'second')} /> ); }, @@ -103,7 +111,7 @@ const Combobox = React.createClass({
{this.getHourSelect(value.getHourOfDay())} {this.getMinuteSelect(value.getMinutes())} - {this.getSectionSelect(value.getSeconds())} + {this.getSecondSelect(value.getSeconds())}
); }, -- cgit v1.2.3