onshore-forms 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -156,7 +156,7 @@ class OnshoreFormsService {
|
|
|
156
156
|
formGroup(form, name) {
|
|
157
157
|
return form.get(name);
|
|
158
158
|
}
|
|
159
|
-
addFormArrayItem(formArray, item) {
|
|
159
|
+
addFormArrayItem(formArray, item, defaultValues = null) {
|
|
160
160
|
let formControls = {};
|
|
161
161
|
if (item) {
|
|
162
162
|
item.subformArray?.forEach((subitem) => {
|
|
@@ -169,7 +169,8 @@ class OnshoreFormsService {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
else {
|
|
172
|
-
|
|
172
|
+
const defaultValue = defaultValues?.find(value => value.name === subitem.name)?.value;
|
|
173
|
+
formControls[subitem.name] = new FormControl(defaultValue ?? (subitem.default !== undefined ? subitem.default : ''), {
|
|
173
174
|
validators: subitem.validators || [],
|
|
174
175
|
updateOn: 'change'
|
|
175
176
|
});
|