diff options
author | afc163 <afc163@gmail.com> | 2015-12-12 00:55:14 +0800 |
---|---|---|
committer | afc163 <afc163@gmail.com> | 2015-12-12 00:55:14 +0800 |
commit | 182e9fccc90ae709322b7cc314c8775a9d8d46b8 (patch) | |
tree | 8abc77d6d96667ad26614e47dae3305b3f461f5c /src/module/Combobox.jsx | |
parent | 85a5d3e6e9f0907780b2ed512faaf1c65d246f0d (diff) | |
download | time-picker-182e9fccc90ae709322b7cc314c8775a9d8d46b8.tar.gz time-picker-182e9fccc90ae709322b7cc314c8775a9d8d46b8.tar.zst time-picker-182e9fccc90ae709322b7cc314c8775a9d8d46b8.zip |
select input value range when enter different select panel
Diffstat (limited to 'src/module/Combobox.jsx')
-rw-r--r-- | src/module/Combobox.jsx | 12 |
1 files changed, 10 insertions, 2 deletions
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({ | |||
21 | hourOptions: PropTypes.array, | 21 | hourOptions: PropTypes.array, |
22 | minuteOptions: PropTypes.array, | 22 | minuteOptions: PropTypes.array, |
23 | secondOptions: PropTypes.array, | 23 | secondOptions: PropTypes.array, |
24 | onCurrentSelectPanelChange: PropTypes.func, | ||
24 | }, | 25 | }, |
25 | 26 | ||
26 | onItemChange(type, itemValue) { | 27 | onItemChange(type, itemValue) { |
@@ -41,6 +42,10 @@ const Combobox = React.createClass({ | |||
41 | onChange(value); | 42 | onChange(value); |
42 | }, | 43 | }, |
43 | 44 | ||
45 | onEnterSelectPanel(range) { | ||
46 | this.props.onCurrentSelectPanelChange(range); | ||
47 | }, | ||
48 | |||
44 | getHourSelect(hour) { | 49 | getHourSelect(hour) { |
45 | const { prefixCls, hourOptions, showHour } = this.props; | 50 | const { prefixCls, hourOptions, showHour } = this.props; |
46 | if (!showHour) { | 51 | if (!showHour) { |
@@ -53,6 +58,7 @@ const Combobox = React.createClass({ | |||
53 | selectedIndex={hourOptions.indexOf(hour)} | 58 | selectedIndex={hourOptions.indexOf(hour)} |
54 | type="hour" | 59 | type="hour" |
55 | onSelect={this.onItemChange} | 60 | onSelect={this.onItemChange} |
61 | onMouseEnter={this.onEnterSelectPanel.bind(this, 'hour')} | ||
56 | /> | 62 | /> |
57 | ); | 63 | ); |
58 | }, | 64 | }, |
@@ -66,11 +72,12 @@ const Combobox = React.createClass({ | |||
66 | selectedIndex={minuteOptions.indexOf(minute)} | 72 | selectedIndex={minuteOptions.indexOf(minute)} |
67 | type="minute" | 73 | type="minute" |
68 | onSelect={this.onItemChange} | 74 | onSelect={this.onItemChange} |
75 | onMouseEnter={this.onEnterSelectPanel.bind(this, 'minute')} | ||
69 | /> | 76 | /> |
70 | ); | 77 | ); |
71 | }, | 78 | }, |
72 | 79 | ||
73 | getSectionSelect(second) { | 80 | getSecondSelect(second) { |
74 | const { prefixCls, secondOptions, showSecond } = this.props; | 81 | const { prefixCls, secondOptions, showSecond } = this.props; |
75 | if (!showSecond) { | 82 | if (!showSecond) { |
76 | return null; | 83 | return null; |
@@ -82,6 +89,7 @@ const Combobox = React.createClass({ | |||
82 | selectedIndex={secondOptions.indexOf(second)} | 89 | selectedIndex={secondOptions.indexOf(second)} |
83 | type="second" | 90 | type="second" |
84 | onSelect={this.onItemChange} | 91 | onSelect={this.onItemChange} |
92 | onMouseEnter={this.onEnterSelectPanel.bind(this, 'second')} | ||
85 | /> | 93 | /> |
86 | ); | 94 | ); |
87 | }, | 95 | }, |
@@ -103,7 +111,7 @@ const Combobox = React.createClass({ | |||
103 | <div className={`${prefixCls}-combobox`}> | 111 | <div className={`${prefixCls}-combobox`}> |
104 | {this.getHourSelect(value.getHourOfDay())} | 112 | {this.getHourSelect(value.getHourOfDay())} |
105 | {this.getMinuteSelect(value.getMinutes())} | 113 | {this.getMinuteSelect(value.getMinutes())} |
106 | {this.getSectionSelect(value.getSeconds())} | 114 | {this.getSecondSelect(value.getSeconds())} |
107 | </div> | 115 | </div> |
108 | ); | 116 | ); |
109 | }, | 117 | }, |