Fixed #2186 - Calendar input value added blur event
parent
a90690a115
commit
d2fc2d2bca
|
@ -349,9 +349,14 @@ const CalendarEvents = [
|
||||||
description: "Callback to invoke on blur of input field.",
|
description: "Callback to invoke on blur of input field.",
|
||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: "event",
|
name: "event.originalEvent",
|
||||||
type: "object",
|
type: "object",
|
||||||
description: "Blur event"
|
description: "Browser event"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "event.value",
|
||||||
|
type: "string",
|
||||||
|
description: "Input value"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -44,6 +44,17 @@ export interface CalendarYearChangeEvent {
|
||||||
year: number;
|
year: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CalendarBlurEvent {
|
||||||
|
/**
|
||||||
|
* Browser event
|
||||||
|
*/
|
||||||
|
originalEvent: Event;
|
||||||
|
/**
|
||||||
|
* Input value
|
||||||
|
*/
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CalendarProps {
|
export interface CalendarProps {
|
||||||
/**
|
/**
|
||||||
* Value of the component.
|
* Value of the component.
|
||||||
|
@ -321,9 +332,9 @@ export declare type CalendarEmits = {
|
||||||
'focus': (event: Event) => void;
|
'focus': (event: Event) => void;
|
||||||
/**
|
/**
|
||||||
* Callback to invoke on blur of input field.
|
* Callback to invoke on blur of input field.
|
||||||
* @param {Event} event - Blur event
|
* @param {CalendarBlurEvent} event - Blur event
|
||||||
*/
|
*/
|
||||||
'blur': (event: Event) => void;
|
'blur': (event: CalendarBlurEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Calendar extends ClassComponent<CalendarProps, CalendarSlots, CalendarEmits> { }
|
declare class Calendar extends ClassComponent<CalendarProps, CalendarSlots, CalendarEmits> { }
|
||||||
|
|
|
@ -2182,10 +2182,10 @@ export default {
|
||||||
this.$emit('focus', event);
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
onBlur(event) {
|
onBlur(event) {
|
||||||
|
this.$emit('blur', {originalEvent: event, value: this.input.value});
|
||||||
|
|
||||||
this.focused = false;
|
this.focused = false;
|
||||||
this.input.value = this.formatValue(this.modelValue);
|
this.input.value = this.formatValue(this.modelValue);
|
||||||
|
|
||||||
this.$emit('blur', event);
|
|
||||||
},
|
},
|
||||||
onKeyDown() {
|
onKeyDown() {
|
||||||
if (event.keyCode === 40 && this.overlay) {
|
if (event.keyCode === 40 && this.overlay) {
|
||||||
|
|
|
@ -508,7 +508,9 @@ export default {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>blur</td>
|
<td>blur</td>
|
||||||
<td>event: Blur event</td>
|
<td>event.originalEvent: Blur event <br />
|
||||||
|
event.value: Input value
|
||||||
|
</td>
|
||||||
<td>Callback to invoke on blur of input field.</td>
|
<td>Callback to invoke on blur of input field.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue