aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Header.jsx8
-rw-r--r--src/Panel.jsx5
-rw-r--r--src/TimePicker.jsx5
3 files changed, 15 insertions, 3 deletions
diff --git a/src/Header.jsx b/src/Header.jsx
index 1520d25..1ba5909 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 readOnlyInput: 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 readOnlyInput: 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, readOnlyInput } = 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={!!readOnlyInput}
180 /> 186 />
181 ); 187 );
182 } 188 }
diff --git a/src/Panel.jsx b/src/Panel.jsx
index a1b7c77..c23241d 100644
--- a/src/Panel.jsx
+++ b/src/Panel.jsx
@@ -27,6 +27,7 @@ class Panel extends Component {
27 value: PropTypes.object, 27 value: PropTypes.object,
28 placeholder: PropTypes.string, 28 placeholder: PropTypes.string,
29 format: PropTypes.string, 29 format: PropTypes.string,
30 readOnlyInput: PropTypes.bool,
30 disabledHours: PropTypes.func, 31 disabledHours: PropTypes.func,
31 disabledMinutes: PropTypes.func, 32 disabledMinutes: PropTypes.func,
32 disabledSeconds: PropTypes.func, 33 disabledSeconds: PropTypes.func,
@@ -58,6 +59,7 @@ class Panel extends Component {
58 use12Hours: false, 59 use12Hours: false,
59 addon: noop, 60 addon: noop,
60 onKeyDown: noop, 61 onKeyDown: noop,
62 readOnlyInput: false,
61 }; 63 };
62 64
63 constructor(props) { 65 constructor(props) {
@@ -96,7 +98,7 @@ class Panel extends Component {
96 prefixCls, className, placeholder, disabledHours, disabledMinutes, 98 prefixCls, className, placeholder, disabledHours, disabledMinutes,
97 disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond, 99 disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond,
98 format, defaultOpenValue, clearText, onEsc, addon, use12Hours, onClear, 100 format, defaultOpenValue, clearText, onEsc, addon, use12Hours, onClear,
99 focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep, 101 focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep, readOnlyInput,
100 } = this.props; 102 } = this.props;
101 const { 103 const {
102 value, currentSelectPanel, 104 value, currentSelectPanel,
@@ -137,6 +139,7 @@ class Panel extends Component {
137 allowEmpty={allowEmpty} 139 allowEmpty={allowEmpty}
138 focusOnOpen={focusOnOpen} 140 focusOnOpen={focusOnOpen}
139 onKeyDown={onKeyDown} 141 onKeyDown={onKeyDown}
142 readOnlyInput={readOnlyInput}
140 /> 143 />
141 <Combobox 144 <Combobox
142 prefixCls={prefixCls} 145 prefixCls={prefixCls}
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 9a91a2c..039c2f5 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -18,6 +18,7 @@ export default class Picker extends Component {
18 clearText: PropTypes.string, 18 clearText: PropTypes.string,
19 value: PropTypes.object, 19 value: PropTypes.object,
20 defaultOpenValue: PropTypes.object, 20 defaultOpenValue: PropTypes.object,
21 readOnlyInput: PropTypes.bool,
21 disabled: PropTypes.bool, 22 disabled: PropTypes.bool,
22 allowEmpty: PropTypes.bool, 23 allowEmpty: PropTypes.bool,
23 defaultValue: PropTypes.object, 24 defaultValue: PropTypes.object,
@@ -60,6 +61,7 @@ export default class Picker extends Component {
60 clearText: 'clear', 61 clearText: 'clear',
61 prefixCls: 'rc-time-picker', 62 prefixCls: 'rc-time-picker',
62 defaultOpen: false, 63 defaultOpen: false,
64 readOnlyInput: false,
63 style: {}, 65 style: {},
64 className: '', 66 className: '',
65 popupClassName: '', 67 popupClassName: '',
@@ -167,7 +169,7 @@ export default class Picker extends Component {
167 getPanelElement() { 169 getPanelElement() {
168 const { 170 const {
169 prefixCls, placeholder, disabledHours, 171 prefixCls, placeholder, disabledHours,
170 disabledMinutes, disabledSeconds, hideDisabledOptions, 172 disabledMinutes, disabledSeconds, hideDisabledOptions, readOnlyInput,
171 allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText, 173 allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText,
172 addon, use12Hours, focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep, 174 addon, use12Hours, focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep,
173 } = this.props; 175 } = this.props;
@@ -177,6 +179,7 @@ export default class Picker extends Component {
177 prefixCls={`${prefixCls}-panel`} 179 prefixCls={`${prefixCls}-panel`}
178 ref={this.savePanelRef} 180 ref={this.savePanelRef}
179 value={this.state.value} 181 value={this.state.value}
182 readOnlyInput={readOnlyInput}
180 onChange={this.onPanelChange} 183 onChange={this.onPanelChange}
181 onClear={this.onPanelClear} 184 onClear={this.onPanelClear}
182 defaultOpenValue={defaultOpenValue} 185 defaultOpenValue={defaultOpenValue}