DatePicker & TimePicker support Form's disabled

This commit is contained in:
梁灏 2019-09-16 21:56:27 +08:00
parent 1588396357
commit 0875722286

View file

@ -12,7 +12,7 @@
:element-id="elementId" :element-id="elementId"
:class="[prefixCls + '-editor']" :class="[prefixCls + '-editor']"
:readonly="!editable || readonly" :readonly="!editable || readonly"
:disabled="disabled" :disabled="itemDisabled"
:size="size" :size="size"
:placeholder="placeholder" :placeholder="placeholder"
:value="visualValue" :value="visualValue"
@ -86,6 +86,7 @@
import { DEFAULT_FORMATS, TYPE_VALUE_RESOLVER_MAP, getDayCountOfMonth } from './util'; import { DEFAULT_FORMATS, TYPE_VALUE_RESOLVER_MAP, getDayCountOfMonth } from './util';
import {findComponentsDownward} from '../../utils/assist'; import {findComponentsDownward} from '../../utils/assist';
import Emitter from '../../mixins/emitter'; import Emitter from '../../mixins/emitter';
import mixinsForm from '../../mixins/form';
const prefixCls = 'ivu-date-picker'; const prefixCls = 'ivu-date-picker';
const pickerPrefixCls = 'ivu-picker'; const pickerPrefixCls = 'ivu-picker';
@ -120,7 +121,7 @@
export default { export default {
mixins: [ Emitter ], mixins: [ Emitter, mixinsForm ],
components: { iInput, Drop, Icon }, components: { iInput, Drop, Icon },
directives: { clickOutside, TransferDom }, directives: { clickOutside, TransferDom },
props: { props: {
@ -393,7 +394,7 @@
if (this.readonly) return; if (this.readonly) return;
this.isFocused = true; this.isFocused = true;
if (e && e.type === 'focus') return; // just focus, don't open yet if (e && e.type === 'focus') return; // just focus, don't open yet
if(!this.disabled){ if(!this.itemDisabled){
this.visible = true; this.visible = true;
} }
}, },
@ -635,7 +636,7 @@
} }
}, },
handleInputMouseenter () { handleInputMouseenter () {
if (this.readonly || this.disabled) return; if (this.readonly || this.itemDisabled) return;
if (this.visualValue && this.clearable) { if (this.visualValue && this.clearable) {
this.showClose = true; this.showClose = true;
} }
@ -647,7 +648,7 @@
if (this.showClose) { if (this.showClose) {
if (e) e.stopPropagation(); if (e) e.stopPropagation();
this.handleClear(); this.handleClear();
} else if (!this.disabled) { } else if (!this.itemDisabled) {
this.handleFocus(); this.handleFocus();
} }
}, },