diff --git a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts index 5ddc69426b..0fe50d99ba 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts @@ -61,6 +61,24 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit entitySubtypeValue: string; + entityText: string; + + noEntitiesMatchingText: string; + + entityRequiredText: string; + + filteredEntities: Observable>>; + + searchText = ''; + + private requiredValue: boolean; + + private dirty = false; + + private refresh$ = new Subject>>(); + + private propagateChange = (v: any) => { }; + @Input() set entityType(entityType: EntityType) { if (this.entityTypeValue !== entityType) { @@ -71,6 +89,7 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit this.dirty = true; } } + @Input() set entitySubtype(entitySubtype: string) { if (this.entitySubtypeValue !== entitySubtype) { @@ -99,14 +118,13 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit @Input() appearance: MatFormFieldAppearance = 'fill'; - private requiredValue: boolean; - get required(): boolean { - return this.requiredValue; - } @Input() set required(value: boolean) { this.requiredValue = coerceBooleanProperty(value); } + get required(): boolean { + return this.requiredValue; + } @Input() disabled: boolean; @@ -116,19 +134,20 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit @ViewChild('entityInput', {static: true}) entityInput: ElementRef; - entityText: string; - noEntitiesMatchingText: string; - entityRequiredText: string; - - filteredEntities: Observable>>; - - searchText = ''; + get requiredErrorText(): string { + if (this.requiredText && this.requiredText.length) { + return this.requiredText; + } + return this.entityRequiredText; + } - private dirty = false; + get label(): string { + if (this.labelText && this.labelText.length) { + return this.labelText; + } + return this.entityText; + } - private refresh$ = new Subject>>(); - - private propagateChange = (v: any) => { }; constructor(private store: Store, public translate: TranslateService, @@ -377,18 +396,4 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit } return entityType; } - - get label(): string { - if (this.labelText && this.labelText.length) { - return this.labelText; - } - return this.entityText; - } - - get requiredErrorText(): string { - if (this.requiredText && this.requiredText.length) { - return this.requiredText; - } - return this.entityRequiredText; - } }