@@ -6,6 +6,7 @@ import { ValidationTriggerTypes } from '@/core/models';
66
77interface InputEventsComposition {
88 onInput : ( $event : Event ) => void ;
9+ onChange : ( $event : Event ) => void ;
910 onCheck : ( $event : Event ) => void ;
1011 onFocus : ( ) => void ;
1112 onBlur : ( ) => void ;
@@ -18,9 +19,8 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
1819 function onInput ( $event : Event ) : void {
1920 const element = $event . target as HTMLInputElement ;
2021
22+ $event . stopImmediatePropagation ( ) ;
2123 if ( props . control && hasValue ( element . value ) ) {
22- $event . stopImmediatePropagation ( ) ;
23-
2424 if (
2525 ( ! props . control . valid &&
2626 props . control . validationTrigger . type ===
@@ -37,6 +37,10 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
3737 } ) ;
3838 }
3939 }
40+ function onChange ( $event : Event ) : void {
41+ $event . stopImmediatePropagation ( ) ;
42+ $event . preventDefault ( ) ;
43+ }
4044 function onCheck ( $event : Event ) : void {
4145 const element = $event . target as HTMLInputElement ;
4246 if ( props . control ) {
@@ -68,7 +72,7 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
6872 watch (
6973 ( ) => props ?. control ?. value ,
7074 ( curr , prev ) => {
71- if ( prev === undefined && hasValue ( curr ) ) {
75+ if ( prev !== undefined && hasValue ( curr ) && curr !== prev ) {
7276 emit ( 'change' , {
7377 name : props . control . name ,
7478 value : props . control . value ,
@@ -80,6 +84,7 @@ export function useInputEvents(props: any, emit: any): InputEventsComposition {
8084 return {
8185 onFocus,
8286 onInput,
87+ onChange,
8388 onBlur,
8489 onCheck,
8590 getClasses,
0 commit comments