aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Header.jsx
diff options
context:
space:
mode:
authorWei Zhu <yesmeck@gmail.com>2018-02-01 14:20:33 +0800
committerWei Zhu <yesmeck@gmail.com>2018-02-01 14:20:33 +0800
commitc50a40056d80c52f328566d51cc49cbcdc5f0a95 (patch)
tree571e224e324c18164323917778c1a202c7c36068 /src/Header.jsx
parent73a24157501c8d75aac94b3f6c913c754d46e94f (diff)
parent4e70ea0da45e572cd660f79ac98b6a25c640cb36 (diff)
downloadtime-picker-c50a40056d80c52f328566d51cc49cbcdc5f0a95.tar.gz
time-picker-c50a40056d80c52f328566d51cc49cbcdc5f0a95.tar.zst
time-picker-c50a40056d80c52f328566d51cc49cbcdc5f0a95.zip
Merge branch 'abyr-readonly_header_input'
Diffstat (limited to 'src/Header.jsx')
-rw-r--r--src/Header.jsx8
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 }