diff options
Diffstat (limited to 'src/Header.jsx')
-rw-r--r-- | src/Header.jsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Header.jsx b/src/Header.jsx index 1520d25..21d557e 100644 --- a/src/Header.jsx +++ b/src/Header.jsx | |||
@@ -10,6 +10,7 @@ class Header extends Component { | |||
10 | placeholder: PropTypes.string, | 10 | placeholder: PropTypes.string, |
11 | clearText: PropTypes.string, | 11 | clearText: PropTypes.string, |
12 | value: PropTypes.object, | 12 | value: PropTypes.object, |
13 | inputReadOnly: PropTypes.bool, | ||
13 | hourOptions: PropTypes.array, | 14 | hourOptions: PropTypes.array, |
14 | minuteOptions: PropTypes.array, | 15 | minuteOptions: PropTypes.array, |
15 | secondOptions: PropTypes.array, | 16 | secondOptions: PropTypes.array, |
@@ -26,6 +27,10 @@ class Header extends Component { | |||
26 | onKeyDown: PropTypes.func, | 27 | onKeyDown: PropTypes.func, |
27 | }; | 28 | }; |
28 | 29 | ||
30 | static defaultProps = { | ||
31 | inputReadOnly: false, | ||
32 | } | ||
33 | |||
29 | constructor(props) { | 34 | constructor(props) { |
30 | super(props); | 35 | super(props); |
31 | const { value, format } = props; | 36 | const { value, format } = props; |
@@ -166,7 +171,7 @@ class Header extends Component { | |||
166 | } | 171 | } |
167 | 172 | ||
168 | getInput() { | 173 | getInput() { |
169 | const { prefixCls, placeholder } = this.props; | 174 | const { prefixCls, placeholder, inputReadOnly } = this.props; |
170 | const { invalid, str } = this.state; | 175 | const { invalid, str } = this.state; |
171 | const invalidClass = invalid ? `${prefixCls}-input-invalid` : ''; | 176 | const invalidClass = invalid ? `${prefixCls}-input-invalid` : ''; |
172 | return ( | 177 | return ( |
@@ -177,6 +182,7 @@ class Header extends Component { | |||
177 | value={str} | 182 | value={str} |
178 | placeholder={placeholder} | 183 | placeholder={placeholder} |
179 | onChange={this.onInputChange} | 184 | onChange={this.onInputChange} |
185 | readOnly={!!inputReadOnly} | ||
180 | /> | 186 | /> |
181 | ); | 187 | ); |
182 | } | 188 | } |