From a7588481460d7bc341f317a31816db14fa74682d Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Wed, 8 Nov 2023 10:25:27 +0100 Subject: [PATCH 1/2] 108055: fix issue 8686: unable to enter freetext values in the submission form for vocabulary (cherry picked from commit 0dcf6cb8855cc5c74f781fd7490f2daaeea29092) --- .../vocabulary-treeview.component.html | 3 +++ .../vocabulary-treeview/vocabulary-treeview.component.ts | 9 +++++++++ src/assets/i18n/en.json5 | 2 ++ 3 files changed, 14 insertions(+) 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 3b858faac45..db3dc31948f 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html @@ -10,6 +10,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 804ae634913..d5a5dee1f5e 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts @@ -293,6 +293,15 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges } } + 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 3b3578fac5d..741ff0ffc9c 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -5240,4 +5240,6 @@ "access-control-option-end-date-note": "Select the date until which the related access condition is applied", + "vocabulary-treeview.search.form.add": "Add", + } From e815b1d938066b06ec4ec887e1866327affaea7b Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Wed, 8 Nov 2023 12:00:46 +0100 Subject: [PATCH 2/2] 108055: add user input to tag list (cherry picked from commit aac58e612d7fb01f87dc7a6a46b92c9c4c2fe685) --- .../models/tag/dynamic-tag.component.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 4abb68a53be..7805dad1f32 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));