diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Header.jsx | 6 | ||||
-rw-r--r-- | src/Panel.jsx | 5 | ||||
-rw-r--r-- | src/TimePicker.jsx | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/Header.jsx b/src/Header.jsx index 91e8549..f6dd241 100644 --- a/src/Header.jsx +++ b/src/Header.jsx | |||
@@ -22,6 +22,7 @@ class Header extends Component { | |||
22 | allowEmpty: PropTypes.bool, | 22 | allowEmpty: PropTypes.bool, |
23 | defaultOpenValue: PropTypes.object, | 23 | defaultOpenValue: PropTypes.object, |
24 | currentSelectPanel: PropTypes.string, | 24 | currentSelectPanel: PropTypes.string, |
25 | onKeyDown: PropTypes.func, | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | constructor(props) { | 28 | constructor(props) { |
@@ -122,9 +123,12 @@ class Header extends Component { | |||
122 | } | 123 | } |
123 | 124 | ||
124 | onKeyDown = (e) => { | 125 | onKeyDown = (e) => { |
126 | const { onEsc, onKeyDown } = this.props; | ||
125 | if (e.keyCode === 27) { | 127 | if (e.keyCode === 27) { |
126 | this.props.onEsc(); | 128 | onEsc(); |
127 | } | 129 | } |
130 | |||
131 | onKeyDown(e); | ||
128 | } | 132 | } |
129 | 133 | ||
130 | onClear = () => { | 134 | onClear = () => { |
diff --git a/src/Panel.jsx b/src/Panel.jsx index 1953ad4..8a6c872 100644 --- a/src/Panel.jsx +++ b/src/Panel.jsx | |||
@@ -40,6 +40,7 @@ class Panel extends Component { | |||
40 | onClear: PropTypes.func, | 40 | onClear: PropTypes.func, |
41 | use12Hours: PropTypes.bool, | 41 | use12Hours: PropTypes.bool, |
42 | addon: PropTypes.func, | 42 | addon: PropTypes.func, |
43 | onKeyDown: PropTypes.func, | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | static defaultProps = { | 46 | static defaultProps = { |
@@ -52,6 +53,7 @@ class Panel extends Component { | |||
52 | defaultOpenValue: moment(), | 53 | defaultOpenValue: moment(), |
53 | use12Hours: false, | 54 | use12Hours: false, |
54 | addon: noop, | 55 | addon: noop, |
56 | onKeyDown: noop, | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | constructor(props) { | 59 | constructor(props) { |
@@ -89,7 +91,7 @@ class Panel extends Component { | |||
89 | const { | 91 | const { |
90 | prefixCls, className, placeholder, disabledHours, disabledMinutes, | 92 | prefixCls, className, placeholder, disabledHours, disabledMinutes, |
91 | disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, | 93 | disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, |
92 | format, defaultOpenValue, clearText, onEsc, addon, use12Hours, onClear, | 94 | format, defaultOpenValue, clearText, onEsc, addon, use12Hours, onClear, onKeyDown, |
93 | } = this.props; | 95 | } = this.props; |
94 | const { | 96 | const { |
95 | value, currentSelectPanel, | 97 | value, currentSelectPanel, |
@@ -122,6 +124,7 @@ class Panel extends Component { | |||
122 | onChange={this.onChange} | 124 | onChange={this.onChange} |
123 | onClear={onClear} | 125 | onClear={onClear} |
124 | allowEmpty={allowEmpty} | 126 | allowEmpty={allowEmpty} |
127 | onKeyDown={onKeyDown} | ||
125 | /> | 128 | /> |
126 | <Combobox | 129 | <Combobox |
127 | prefixCls={prefixCls} | 130 | prefixCls={prefixCls} |
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index 6e16457..271515d 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx | |||
@@ -48,6 +48,7 @@ export default class Picker extends Component { | |||
48 | name: PropTypes.string, | 48 | name: PropTypes.string, |
49 | autoComplete: PropTypes.string, | 49 | autoComplete: PropTypes.string, |
50 | use12Hours: PropTypes.bool, | 50 | use12Hours: PropTypes.bool, |
51 | onKeyDown: PropTypes.func, | ||
51 | }; | 52 | }; |
52 | 53 | ||
53 | static defaultProps = { | 54 | static defaultProps = { |
@@ -75,6 +76,7 @@ export default class Picker extends Component { | |||
75 | onBlur: noop, | 76 | onBlur: noop, |
76 | addon: noop, | 77 | addon: noop, |
77 | use12Hours: false, | 78 | use12Hours: false, |
79 | onKeyDown: noop, | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | constructor(props) { | 82 | constructor(props) { |
@@ -161,7 +163,7 @@ export default class Picker extends Component { | |||
161 | prefixCls, placeholder, disabledHours, | 163 | prefixCls, placeholder, disabledHours, |
162 | disabledMinutes, disabledSeconds, hideDisabledOptions, | 164 | disabledMinutes, disabledSeconds, hideDisabledOptions, |
163 | allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText, | 165 | allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText, |
164 | addon, use12Hours, | 166 | addon, use12Hours, onKeyDown, |
165 | } = this.props; | 167 | } = this.props; |
166 | return ( | 168 | return ( |
167 | <Panel | 169 | <Panel |
@@ -185,6 +187,7 @@ export default class Picker extends Component { | |||
185 | hideDisabledOptions={hideDisabledOptions} | 187 | hideDisabledOptions={hideDisabledOptions} |
186 | use12Hours={use12Hours} | 188 | use12Hours={use12Hours} |
187 | addon={addon} | 189 | addon={addon} |
190 | onKeyDown={onKeyDown} | ||
188 | /> | 191 | /> |
189 | ); | 192 | ); |
190 | } | 193 | } |