This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/components/dynamic-form Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ export default defineComponent({
108
108
});
109
109
110
110
const isValid = computed (() => {
111
- const control = controls ? .value ?. find (control => ! control .valid );
112
- return control ? control . valid : true ;
111
+ const hasInvalidControls = controls .value . some (control => ! control .valid );
112
+ return ! hasInvalidControls ;
113
113
});
114
114
115
115
const errors = computed (() => {
@@ -146,12 +146,12 @@ export default defineComponent({
146
146
}
147
147
});
148
148
149
- function valueChange(changedValue ) {
149
+ function valueChange(changedValue : Record < string , unknown > ) {
150
150
Object .assign (formValues , changedValue );
151
151
ctx .emit (' changed' , removeEmpty (formValues ));
152
152
}
153
153
154
- function mapControls(empty ? ) {
154
+ function mapControls(empty ? : boolean ) {
155
155
const controlArray =
156
156
Object .entries (props .form ?.fields ).map (
157
157
([key , field ]: [string , InputType ]) =>
@@ -162,12 +162,14 @@ export default defineComponent({
162
162
value: null ,
163
163
dirty: false ,
164
164
touched: false ,
165
+ valid: true ,
165
166
} as FormControl <InputType >)
166
167
: ({
167
168
... field ,
168
169
name: key ,
169
170
dirty: false ,
170
171
touched: false ,
172
+ valid: true ,
171
173
} as FormControl <InputType >),
172
174
) || [];
173
175
if (props .form .fieldOrder ) {
You can’t perform that action at this time.
0 commit comments