onshore-forms 0.0.51 → 0.0.53
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/components/form-item-container/form-item-container.component.mjs +3 -3
- package/esm2020/lib/onshore-forms.service.mjs +4 -3
- package/fesm2015/onshore-forms.mjs +11 -12
- package/fesm2015/onshore-forms.mjs.map +1 -1
- package/fesm2020/onshore-forms.mjs +7 -9
- package/fesm2020/onshore-forms.mjs.map +1 -1
- package/lib/onshore-forms.service.d.ts +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
|
}
|
|
@@ -187,6 +187,7 @@ class OnshoreFormsService {
|
|
|
187
187
|
formGroup.setParent(formArray);
|
|
188
188
|
formArray.push(formGroup);
|
|
189
189
|
this.subscribeNestedFormGroup(formGroup);
|
|
190
|
+
return formArray;
|
|
190
191
|
}
|
|
191
192
|
removeFormArrayItem(form, index) {
|
|
192
193
|
form.removeAt(index);
|
|
@@ -416,8 +417,8 @@ class OnshoreFormItemContainer {
|
|
|
416
417
|
this.onWindowResize();
|
|
417
418
|
}
|
|
418
419
|
ngOnChanges(changes) {
|
|
419
|
-
const previousValue = changes['formTemplate']
|
|
420
|
-
const currentValue = changes['formTemplate']
|
|
420
|
+
const previousValue = changes['formTemplate']?.previousValue;
|
|
421
|
+
const currentValue = changes['formTemplate']?.currentValue;
|
|
421
422
|
if (currentValue) {
|
|
422
423
|
if (previousValue?.enabled !== currentValue?.enabled) {
|
|
423
424
|
this.enabled(currentValue?.enabled);
|
|
@@ -921,7 +922,7 @@ class OnshoreFormDropdownItemComponent {
|
|
|
921
922
|
this.cdr.markForCheck();
|
|
922
923
|
}
|
|
923
924
|
ngOnInit() {
|
|
924
|
-
if (this.ngControl.control?.value == ''
|
|
925
|
+
if ((!this.ngControl.control?.value || this.ngControl.control?.value == '' || this.ngControl.control?.value == undefined) && !this.multiple) {
|
|
925
926
|
this.ngControl.control?.setValue(this.formTemplate.default);
|
|
926
927
|
this.cdr.markForCheck();
|
|
927
928
|
}
|
|
@@ -931,13 +932,10 @@ class OnshoreFormDropdownItemComponent {
|
|
|
931
932
|
}
|
|
932
933
|
ngOnChanges(changes) {
|
|
933
934
|
const currentOptions = changes['options']?.currentValue ?? changes['formTemplate']?.currentValue?.options;
|
|
934
|
-
const previousOptions =
|
|
935
|
+
//const previousOptions = changes['options']?.previousValue ?? changes['formTemplate']?.previousValue?.options;
|
|
935
936
|
if (!this.options && currentOptions) {
|
|
936
937
|
this.options = currentOptions;
|
|
937
938
|
}
|
|
938
|
-
if (currentOptions?.length > 0 && currentOptions != previousOptions && !this.multiple) {
|
|
939
|
-
this.ngControl.control?.setValue(this.options[0]?.value);
|
|
940
|
-
}
|
|
941
939
|
this.cdr.markForCheck();
|
|
942
940
|
}
|
|
943
941
|
}
|