placeholder: PropTypes.string,
clearText: PropTypes.string,
value: PropTypes.object,
+ readOnlyInput: PropTypes.bool,
hourOptions: PropTypes.array,
minuteOptions: PropTypes.array,
secondOptions: PropTypes.array,
onKeyDown: PropTypes.func,
};
+ static defaultProps = {
+ readOnlyInput: false,
+ }
+
constructor(props) {
super(props);
const { value, format } = props;
}
getInput() {
- const { prefixCls, placeholder } = this.props;
+ const { prefixCls, placeholder, readOnlyInput } = this.props;
const { invalid, str } = this.state;
const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
return (
value={str}
placeholder={placeholder}
onChange={this.onInputChange}
+ readOnly={!!readOnlyInput}
/>
);
}
value: PropTypes.object,
placeholder: PropTypes.string,
format: PropTypes.string,
+ readOnlyInput: PropTypes.bool,
disabledHours: PropTypes.func,
disabledMinutes: PropTypes.func,
disabledSeconds: PropTypes.func,
use12Hours: false,
addon: noop,
onKeyDown: noop,
+ readOnlyInput: false,
};
constructor(props) {
prefixCls, className, placeholder, disabledHours, disabledMinutes,
disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showMinute, showSecond,
format, defaultOpenValue, clearText, onEsc, addon, use12Hours, onClear,
- focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep,
+ focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep, readOnlyInput,
} = this.props;
const {
value, currentSelectPanel,
allowEmpty={allowEmpty}
focusOnOpen={focusOnOpen}
onKeyDown={onKeyDown}
+ readOnlyInput={readOnlyInput}
/>
<Combobox
prefixCls={prefixCls}
clearText: PropTypes.string,
value: PropTypes.object,
defaultOpenValue: PropTypes.object,
+ readOnlyInput: PropTypes.bool,
disabled: PropTypes.bool,
allowEmpty: PropTypes.bool,
defaultValue: PropTypes.object,
clearText: 'clear',
prefixCls: 'rc-time-picker',
defaultOpen: false,
+ readOnlyInput: false,
style: {},
className: '',
popupClassName: '',
getPanelElement() {
const {
prefixCls, placeholder, disabledHours,
- disabledMinutes, disabledSeconds, hideDisabledOptions,
+ disabledMinutes, disabledSeconds, hideDisabledOptions, readOnlyInput,
allowEmpty, showHour, showMinute, showSecond, defaultOpenValue, clearText,
addon, use12Hours, focusOnOpen, onKeyDown, hourStep, minuteStep, secondStep,
} = this.props;
prefixCls={`${prefixCls}-panel`}
ref={this.savePanelRef}
value={this.state.value}
+ readOnlyInput={readOnlyInput}
onChange={this.onPanelChange}
onClear={this.onPanelClear}
defaultOpenValue={defaultOpenValue}