@@ -24,7 +24,7 @@ import {
2424 InputType ,
2525} from ' @/core/models' ;
2626
27- import { isEmpty , entries , values , keys } from ' @/core/utils/helpers' ;
27+ import { isEmpty , entries , values , keys , isEvent } from ' @/core/utils/helpers' ;
2828import { useInputEvents } from ' @/composables/input-events' ;
2929import { dynamicFormsSymbol } from ' @/useApi' ;
3030
@@ -50,7 +50,7 @@ const props = {
5050
5151export type ControlAttribute <T extends InputType > = {
5252 control: FormControl <T >;
53- onChanged : (value : unknown ) => void ;
53+ onChange : (value : unknown ) => void ;
5454};
5555
5656export default defineComponent ({
@@ -66,7 +66,7 @@ export default defineComponent({
6666 const attributes = computed (() => {
6767 return {
6868 control: props ?.control ,
69- onChanged : valueChange ,
69+ onChange : valueChange ,
7070 };
7171 });
7272
@@ -142,12 +142,24 @@ export default defineComponent({
142142 }
143143 }
144144
145- function valueChange(value ) {
145+ function valueChange($event ) {
146+ let value;
146147 const newValue = {};
148+
149+ if (isEvent ($event )) {
150+ $event .stopPropagation ();
151+ value =
152+ props .control .type === ' checkbox'
153+ ? $event .target .checked
154+ : $event .target .value ;
155+ } else {
156+ value = $event ;
157+ }
158+
147159 if (props .control ) {
148160 newValue [props .control .name ] = value ;
149161 validate ();
150- emit (' changed ' , newValue );
162+ emit (' change ' , newValue );
151163 }
152164 }
153165
0 commit comments