@@ -6,6 +6,7 @@ import { ValidationTriggerTypes } from '@/core/models';
6
6
7
7
interface InputEventsComposition {
8
8
onInput : ( $event : Event ) => void ;
9
+ onChange : ( $event : Event ) => void ;
9
10
onCheck : ( $event : Event ) => void ;
10
11
onFocus : ( ) => void ;
11
12
onBlur : ( ) => void ;
@@ -18,9 +19,8 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
18
19
function onInput ( $event : Event ) : void {
19
20
const element = $event . target as HTMLInputElement ;
20
21
22
+ $event . stopImmediatePropagation ( ) ;
21
23
if ( props . control && hasValue ( element . value ) ) {
22
- $event . stopImmediatePropagation ( ) ;
23
-
24
24
if (
25
25
( ! props . control . valid &&
26
26
props . control . validationTrigger . type ===
@@ -37,6 +37,10 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
37
37
} ) ;
38
38
}
39
39
}
40
+ function onChange ( $event : Event ) : void {
41
+ $event . stopImmediatePropagation ( ) ;
42
+ $event . preventDefault ( ) ;
43
+ }
40
44
function onCheck ( $event : Event ) : void {
41
45
const element = $event . target as HTMLInputElement ;
42
46
if ( props . control ) {
@@ -68,7 +72,7 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
68
72
watch (
69
73
( ) => props ?. control ?. value ,
70
74
( curr , prev ) => {
71
- if ( prev === undefined && hasValue ( curr ) ) {
75
+ if ( prev !== undefined && hasValue ( curr ) && curr !== prev ) {
72
76
emit ( 'change' , {
73
77
name : props . control . name ,
74
78
value : props . control . value ,
@@ -80,6 +84,7 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
80
84
return {
81
85
onFocus,
82
86
onInput,
87
+ onChange,
83
88
onBlur,
84
89
onCheck,
85
90
getClasses,
0 commit comments