1111 v-for =" control in controls"
1212 :key =" control.name"
1313 :control =" control"
14- :submited =" submited"
1514 :forceValidation =" forceValidation"
1615 @change =" valueChange"
1716 @blur =" onBlur"
@@ -61,15 +60,12 @@ import {
6160 InputType ,
6261 ValidationEvent ,
6362 InputEvent ,
63+ FormChanges ,
6464} from ' @/core/models' ;
6565import { dynamicFormsSymbol } from ' @/useApi' ;
66- import {
67- deepClone ,
68- hasValue ,
69- isEvent ,
70- removeEmpty ,
71- } from ' @/core/utils/helpers' ;
66+ import { deepClone , hasValue , removeEmpty } from ' @/core/utils/helpers' ;
7267import { FieldControl } from ' @/core/factories' ;
68+ import { useDebounceFn } from ' @/composables/use-debounce' ;
7369
7470const props = {
7571 form: {
@@ -86,6 +82,7 @@ const components = {
8682 */
8783export default defineComponent ({
8884 name: ' asDynamicForm' ,
85+ inheritAttrs: false ,
8986 props ,
9087 components ,
9188 setup(props , ctx ) {
@@ -197,14 +194,20 @@ export default defineComponent({
197194 return updatedCtrl ;
198195 }
199196
200- function valueChange(event : any ) {
197+ function emitChanges(changes : FormChanges ) {
198+ ctx .emit (' change' , changes );
199+ }
200+
201+ const debounceEmitChanges = useDebounceFn (emitChanges , 300 );
202+
203+ function valueChange(event : InputEvent ) {
201204 if (hasValue (event .value )) {
202205 const updatedCtrl = findControlByName (event .name );
203206 if (updatedCtrl ) {
204207 updatedCtrl .value = event .value as string ;
205208 updatedCtrl .dirty = true ;
206209 }
207- ctx . emit ( ' change ' , formValues .value );
210+ debounceEmitChanges ( formValues .value );
208211 }
209212 }
210213
0 commit comments