diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/TimePicker.jsx | 27 | ||||
-rw-r--r-- | src/module/Header.jsx | 18 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx index f9b9207..350eeb2 100644 --- a/src/TimePicker.jsx +++ b/src/TimePicker.jsx | |||
@@ -1,9 +1,9 @@ | |||
1 | import React, {PropTypes} from 'react'; | 1 | import React, { PropTypes } from 'react'; |
2 | import Trigger from 'rc-trigger'; | 2 | import Trigger from 'rc-trigger'; |
3 | import Panel from './module/Panel'; | 3 | import Panel from './module/Panel'; |
4 | import placements from './util/placements'; | 4 | import placements from './util/placements'; |
5 | import CommonMixin from './mixin/CommonMixin'; | 5 | import CommonMixin from './mixin/CommonMixin'; |
6 | import {getFormatter} from './util/index'; | 6 | import { getFormatter } from './util/index'; |
7 | 7 | ||
8 | function noop() { | 8 | function noop() { |
9 | } | 9 | } |
@@ -80,7 +80,7 @@ const Picker = React.createClass({ | |||
80 | }); | 80 | }); |
81 | } | 81 | } |
82 | if (open !== undefined) { | 82 | if (open !== undefined) { |
83 | this.setState({open}); | 83 | this.setState({ open }); |
84 | } | 84 | } |
85 | }, | 85 | }, |
86 | 86 | ||
@@ -147,8 +147,11 @@ const Picker = React.createClass({ | |||
147 | }, | 147 | }, |
148 | 148 | ||
149 | getPanelElement() { | 149 | getPanelElement() { |
150 | const { prefixCls, defaultValue, locale, placeholder, disabledHours, | 150 | const { |
151 | disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond } = this.props; | 151 | prefixCls, defaultValue, locale, placeholder, disabledHours, |
152 | disabledMinutes, disabledSeconds, hideDisabledOptions, | ||
153 | allowEmpty, showHour, showSecond, | ||
154 | } = this.props; | ||
152 | return ( | 155 | return ( |
153 | <Panel | 156 | <Panel |
154 | prefixCls={`${prefixCls}-panel`} | 157 | prefixCls={`${prefixCls}-panel`} |
@@ -174,7 +177,7 @@ const Picker = React.createClass({ | |||
174 | }, | 177 | }, |
175 | 178 | ||
176 | setOpen(open, callback) { | 179 | setOpen(open, callback) { |
177 | const {onOpen, onClose} = this.props; | 180 | const { onOpen, onClose } = this.props; |
178 | if (this.state.open !== open) { | 181 | if (this.state.open !== open) { |
179 | this.setState({ | 182 | this.setState({ |
180 | open, | 183 | open, |
@@ -213,11 +216,13 @@ const Picker = React.createClass({ | |||
213 | onPopupVisibleChange={this.onVisibleChange} | 216 | onPopupVisibleChange={this.onVisibleChange} |
214 | > | 217 | > |
215 | <span className={`${prefixCls} ${className}`} style={style}> | 218 | <span className={`${prefixCls} ${className}`} style={style}> |
216 | <input className={`${prefixCls}-input`} | 219 | <input |
217 | ref="picker" type="text" placeholder={placeholder} | 220 | className={`${prefixCls}-input`} |
218 | readOnly | 221 | ref="picker" type="text" placeholder={placeholder} |
219 | onKeyDown={this.onKeyDown} | 222 | readOnly |
220 | disabled={disabled} value={value && this.getFormatter().format(value)}/> | 223 | onKeyDown={this.onKeyDown} |
224 | disabled={disabled} value={value && this.getFormatter().format(value) || ''} | ||
225 | /> | ||
221 | <span className={`${prefixCls}-icon`}/> | 226 | <span className={`${prefixCls}-icon`}/> |
222 | </span> | 227 | </span> |
223 | </Trigger> | 228 | </Trigger> |
diff --git a/src/module/Header.jsx b/src/module/Header.jsx index 33dec43..41099cc 100644 --- a/src/module/Header.jsx +++ b/src/module/Header.jsx | |||
@@ -1,4 +1,4 @@ | |||
1 | import React, {PropTypes} from 'react'; | 1 | import React, { PropTypes } from 'react'; |
2 | import createSelection from '../util/selection'; | 2 | import createSelection from '../util/selection'; |
3 | 3 | ||
4 | const Header = React.createClass({ | 4 | const Header = React.createClass({ |
@@ -57,7 +57,7 @@ const Header = React.createClass({ | |||
57 | str, | 57 | str, |
58 | }); | 58 | }); |
59 | let value = null; | 59 | let value = null; |
60 | const {formatter, gregorianCalendarLocale, hourOptions, minuteOptions, secondOptions, disabledHours, disabledMinutes, disabledSeconds, onChange, allowEmpty} = this.props; | 60 | const { formatter, gregorianCalendarLocale, hourOptions, minuteOptions, secondOptions, disabledHours, disabledMinutes, disabledSeconds, onChange, allowEmpty } = this.props; |
61 | 61 | ||
62 | if (str) { | 62 | if (str) { |
63 | const originalValue = this.props.value; | 63 | const originalValue = this.props.value; |
@@ -144,7 +144,7 @@ const Header = React.createClass({ | |||
144 | }, | 144 | }, |
145 | 145 | ||
146 | onClear() { | 146 | onClear() { |
147 | this.setState({str: ''}); | 147 | this.setState({ str: '' }); |
148 | this.props.onClear(); | 148 | this.props.onClear(); |
149 | }, | 149 | }, |
150 | 150 | ||
@@ -160,11 +160,13 @@ const Header = React.createClass({ | |||
160 | const { prefixCls, placeholder } = this.props; | 160 | const { prefixCls, placeholder } = this.props; |
161 | const { invalid, str } = this.state; | 161 | const { invalid, str } = this.state; |
162 | const invalidClass = invalid ? `${prefixCls}-input-invalid` : ''; | 162 | const invalidClass = invalid ? `${prefixCls}-input-invalid` : ''; |
163 | return (<input className={`${prefixCls}-input ${invalidClass}`} | 163 | return (<input |
164 | ref="input" | 164 | className={`${prefixCls}-input ${invalidClass}`} |
165 | onKeyDown={this.onKeyDown} | 165 | ref="input" |
166 | value={str} | 166 | onKeyDown={this.onKeyDown} |
167 | placeholder={placeholder} onChange={this.onInputChange}/>); | 167 | value={str} |
168 | placeholder={placeholder} onChange={this.onInputChange} | ||
169 | />); | ||
168 | }, | 170 | }, |
169 | 171 | ||
170 | selectRange() { | 172 | selectRange() { |