diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts index 89553772ab1..22d9ac52196 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.ts @@ -89,6 +89,18 @@ export class DsDynamicTagComponent extends DsDynamicVocabularyComponent implemen } }), map((list: PaginatedList) => list.page), + // Add user input as last item of the list + map((list: VocabularyEntry[]) => { + if (list && list.length > 0) { + if (isNotEmpty(this.currentValue)) { + let vocEntry = new VocabularyEntry(); + vocEntry.display = this.currentValue; + vocEntry.value = this.currentValue; + list.push(vocEntry); + } + } + return list; + }), tap(() => this.changeSearchingStatus(false)), merge(this.hideSearchingWhenUnsubscribed)); diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html index 39c62d6e534..450020dfa37 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html @@ -18,6 +18,9 @@ + diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts index 56909090c77..bdc61233336 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts @@ -280,6 +280,15 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit { this.searchText = ''; } + add() { + const userVocabularyEntry = { + value: this.searchText, + display: this.searchText, + } as VocabularyEntryDetail; + this.select.emit(userVocabularyEntry); + } + + /** * Unsubscribe from all subscriptions */ diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 4f36b9e5828..57ca0f68210 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -5879,5 +5879,8 @@ "navbar.about.service-integrations": "Service integrations", - "navbar.about.project-partnership": "Project partnerships" + "navbar.about.project-partnership": "Project partnerships", + + "vocabulary-treeview.search.form.add": "Add", + }