onshore-forms 0.0.51 → 0.0.52
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.
- package/esm2020/lib/components/form-dropdown-item/form-dropdown-item.component.mjs +3 -6
- package/esm2020/lib/onshore-forms.service.mjs +3 -3
- package/fesm2015/onshore-forms.mjs +7 -10
- package/fesm2015/onshore-forms.mjs.map +1 -1
- package/fesm2020/onshore-forms.mjs +4 -7
- package/fesm2020/onshore-forms.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -173,13 +173,13 @@ class OnshoreFormsService {
|
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
175
|
const defaultValue = defaultValues?.find(value => value.name === subitem.name)?.value;
|
|
176
|
-
|
|
176
|
+
if (defaultValue)
|
|
177
|
+
subitem.default = defaultValue.value;
|
|
177
178
|
formControls[subitem.name] = new FormControl(defaultValue ?? (subitem.default !== undefined ? subitem.default : ''), {
|
|
178
179
|
validators: subitem.validators || [],
|
|
179
180
|
updateOn: 'change'
|
|
180
181
|
});
|
|
181
182
|
formControls[subitem.name].updateValueAndValidity({ onlySelf: false, emitEvent: true });
|
|
182
|
-
console.log("OSF - FORM CONTROL VAL", formControls[subitem.name], formControls[subitem.name].value);
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
}
|
|
@@ -921,7 +921,7 @@ class OnshoreFormDropdownItemComponent {
|
|
|
921
921
|
this.cdr.markForCheck();
|
|
922
922
|
}
|
|
923
923
|
ngOnInit() {
|
|
924
|
-
if (this.ngControl.control?.value == ''
|
|
924
|
+
if ((!this.ngControl.control?.value || this.ngControl.control?.value == '' || this.ngControl.control?.value == undefined) && !this.multiple) {
|
|
925
925
|
this.ngControl.control?.setValue(this.formTemplate.default);
|
|
926
926
|
this.cdr.markForCheck();
|
|
927
927
|
}
|
|
@@ -931,13 +931,10 @@ class OnshoreFormDropdownItemComponent {
|
|
|
931
931
|
}
|
|
932
932
|
ngOnChanges(changes) {
|
|
933
933
|
const currentOptions = changes['options']?.currentValue ?? changes['formTemplate']?.currentValue?.options;
|
|
934
|
-
const previousOptions =
|
|
934
|
+
//const previousOptions = changes['options']?.previousValue ?? changes['formTemplate']?.previousValue?.options;
|
|
935
935
|
if (!this.options && currentOptions) {
|
|
936
936
|
this.options = currentOptions;
|
|
937
937
|
}
|
|
938
|
-
if (currentOptions?.length > 0 && currentOptions != previousOptions && !this.multiple) {
|
|
939
|
-
this.ngControl.control?.setValue(this.options[0]?.value);
|
|
940
|
-
}
|
|
941
938
|
this.cdr.markForCheck();
|
|
942
939
|
}
|
|
943
940
|
}
|