mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
dropdown form field return object
This commit is contained in:
+6
-2
@@ -196,7 +196,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
|
||||
private setFormControlValue(): void {
|
||||
if (this.field?.value && typeof this.field?.value === 'object') {
|
||||
this.dropdownControl.setValue(this.field?.value, { emitEvent: false });
|
||||
this.dropdownControl.setValue({ id: this.field?.value.id, name: this.field?.value.name }, { emitEvent: false });
|
||||
} else {
|
||||
this.dropdownControl.setValue({ id: this.field?.value, name: '' }, { emitEvent: false });
|
||||
}
|
||||
@@ -473,7 +473,11 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
const fieldValueIds = this.field.value.map((valueOption) => valueOption.id);
|
||||
return fieldValueIds.every((valueOptionId) => optionIdList.includes(valueOptionId));
|
||||
} else {
|
||||
return [...this.field.options].map((option) => option.id).includes(this.field.value);
|
||||
if (this.field?.value && typeof this.field?.value === 'object') {
|
||||
return [...this.field.options].map((option) => option.id).includes(this.field.value.id);
|
||||
} else {
|
||||
return [...this.field.options].map((option) => option.id).includes(this.field.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export const defaultValueValidator =
|
||||
});
|
||||
|
||||
const isSomeOptionSelected = optionsWithNoDefaultValue.some((dropdownOption) => {
|
||||
const isOptionSelected = dropdownOption.id === control.value.id;
|
||||
const isOptionSelected = dropdownOption.id === control.value?.id;
|
||||
|
||||
return isOptionSelected;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user