frontend support for suggestions #264

This commit is contained in:
jonaswinkler 2021-01-29 16:48:51 +01:00
parent ddcc0883eb
commit d22d9a023c
9 changed files with 102 additions and 43 deletions

View file

@ -30,11 +30,22 @@ export class SelectComponent extends AbstractInputComponent<number> {
@Input()
allowNull: boolean = false
@Input()
suggestions: number[]
@Output()
createNew = new EventEmitter()
showPlusButton(): boolean {
return this.createNew.observers.length > 0
}
getSuggestions() {
if (this.suggestions && this.items) {
return this.suggestions.filter(id => id != this.value).map(id => this.items.find(item => item.id == id))
} else {
return []
}
}
}