feat: date-picker add inputreadonly

pull/2156/head
tanjinzhou 2020-04-26 16:37:15 +08:00
parent b55fa75b93
commit 138eae594d
8 changed files with 27 additions and 2 deletions

View File

@ -292,6 +292,7 @@ export default {
localeCode,
format,
separator,
inputReadOnly,
} = props;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('calendar', customizePrefixCls);
@ -351,6 +352,7 @@ export default {
value: showDate,
hoverValue,
showToday,
inputReadOnly,
},
on: {
change: calendarChange,

View File

@ -140,7 +140,7 @@ export default function createPicker(TheCalendar, props) {
const { panelChange = noop, focus = noop, blur = noop, ok = noop } = listeners;
const props = getOptionProps(this);
const { prefixCls: customizePrefixCls, locale, localeCode } = props;
const { prefixCls: customizePrefixCls, locale, localeCode, inputReadOnly } = props;
const getPrefixCls = this.configProvider.getPrefixCls;
const prefixCls = getPrefixCls('calendar', customizePrefixCls);
this._prefixCls = prefixCls;
@ -189,6 +189,7 @@ export default function createPicker(TheCalendar, props) {
monthCellContentRender,
renderFooter: this.renderFooter,
value: showDate,
inputReadOnly,
},
on: {
ok,

View File

@ -36,6 +36,7 @@ export const PickerProps = () => ({
tagPrefixCls: PropTypes.string,
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
align: PropTypes.object.def(() => ({})),
inputReadOnly: PropTypes.bool,
});
export const SinglePickerProps = () => ({

View File

@ -54,6 +54,7 @@ const Calendar = {
clearIcon: PropTypes.any,
focusablePanel: PropTypes.bool.def(true),
inputMode: PropTypes.string,
inputReadOnly: PropTypes.bool,
},
mixins: [BaseMixin, CommonMixin, CalendarMixin],
@ -250,6 +251,7 @@ const Calendar = {
sMode,
renderFooter,
inputMode,
inputReadOnly,
monthCellRender,
monthCellContentRender,
$props: props,
@ -303,6 +305,7 @@ const Calendar = {
clearIcon={clearIcon}
onSelect={this.onDateInputSelect}
inputMode={inputMode}
inputReadOnly={inputReadOnly}
/>
) : null;
const children = [];

View File

@ -119,6 +119,7 @@ const RangeCalendar = {
renderSidebar: PropTypes.func.def(() => null),
dateRender: PropTypes.func,
clearIcon: PropTypes.any,
inputReadOnly: PropTypes.bool,
},
mixins: [BaseMixin, CommonMixin],

View File

@ -26,6 +26,7 @@ const DateInput = {
selectedValue: PropTypes.object,
clearIcon: PropTypes.any,
inputMode: PropTypes.string,
inputReadOnly: PropTypes.bool,
},
data() {
@ -166,7 +167,17 @@ const DateInput = {
},
render() {
const { invalid, str, locale, prefixCls, placeholder, disabled, showClear, inputMode } = this;
const {
invalid,
str,
locale,
prefixCls,
placeholder,
disabled,
showClear,
inputMode,
inputReadOnly,
} = this;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const invalidClass = invalid ? `${prefixCls}-input-invalid` : '';
return (
@ -193,6 +204,7 @@ const DateInput = {
onFocus={this.onFocus}
onBlur={this.onBlur}
inputMode={inputMode}
readOnly={inputReadOnly}
/>
</div>
{showClear ? (

View File

@ -33,6 +33,7 @@ const CalendarPart = {
clearIcon: PropTypes.any,
dateRender: PropTypes.func,
inputMode: PropTypes.string,
inputReadOnly: PropTypes.bool,
},
render() {
const { $props: props } = this;
@ -59,6 +60,7 @@ const CalendarPart = {
showWeekNumber,
showClear,
inputMode,
inputReadOnly,
} = props;
const clearIcon = getComponentFromProp(this, 'clearIcon');
const {
@ -117,6 +119,7 @@ const CalendarPart = {
onSelect={inputSelect}
clearIcon={clearIcon}
inputMode={inputMode}
inputReadOnly={inputReadOnly}
/>
);
const headerProps = {

View File

@ -86,4 +86,6 @@ export declare class DatepickerCommon extends AntdComponent {
* @type any (VNode | slot)
*/
suffixIcon: any;
inputReadOnly: boolean;
}