Fix panels reset on blur and

This commit is contained in:
Sergio Crisostomo 2018-01-24 13:33:48 +01:00
parent bcf09be744
commit 46726afdf4
3 changed files with 23 additions and 13 deletions

View file

@ -35,6 +35,7 @@
<div>
<component
:is="panel"
ref="pickerPanel"
:visible="visible"
:showTime="type === 'datetime' || type === 'datetimerange'"
:confirm="isConfirm"
@ -212,10 +213,9 @@
},
methods: {
onSelectionModeChange(type){
if (type.match(/^date/)) type = 'date';
this.selectionMode = type;
return type;
this.selectionMode = oneOf(type, ['year', 'month', 'date', 'time']) && type;
return this.selectionMode;
},
// transfer Drop
handleTransferClick () {
@ -237,7 +237,12 @@
},
handleBlur () {
this.visible = false;
this.onSelectionModeChange(this.type);
this.internalValue = this.internalValue.slice(); // trigger panel watchers to reset views
this.reset();
},
reset(){
this.$refs.pickerPanel.reset && this.$refs.pickerPanel.reset();
},
handleInputChange (event) {
const isArrayValue = this.type.includes('range') || this.multiple;
@ -280,6 +285,7 @@
this.$emit('on-clear');
this.dispatch('FormItem', 'on-form-change', '');
this.emitChange();
this.reset();
setTimeout(
() => this.onSelectionModeChange(this.type),
@ -354,6 +360,7 @@
onPickSuccess(){
this.visible = false;
this.$emit('on-ok');
this.reset();
},
},
watch: {