[GIT] Evergreen ILS branch rel_3_15 updated. 6afec604bc8cf2a0695c74f0396fc966ad562f92

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Evergreen ILS". The branch, rel_3_15 has been updated via 6afec604bc8cf2a0695c74f0396fc966ad562f92 (commit) from 20371e6f70f4e675f5f6b6e6644c013f7adc234e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6afec604bc8cf2a0695c74f0396fc966ad562f92 Author: Dan Briem <dbriem@harrisonpl.org> Date: Wed Apr 2 15:17:18 2025 +0000 LP#2093840 Combobox says null when empty Instead of clearing the combobox when receiving an object with an id property of null in its writeValue method, since 893a5c5 it attempts to create a freetext entry, resulting in a freetext entry of null. This rewrites the writeValue method to explicitly ensure: - only support an entry with a defined id - support a freetext entry and update an existing entry - otherwise, run the selectedId logic to select an entry or clear on null - removes the logic to select an entry on matching labels (match on ID only) Release-note: Fixes an issue where freetext null displays in comboboxes. Signed-off-by: Dan Briem <dbriem@harrisonpl.org> Signed-off-by: Carol Witt <wittc@cwmars.org> Signed-off-by: Michele Morgan <mmorgan@noblenet.org> diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts index 5805ccfe5a..0c338abcc4 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts @@ -397,12 +397,7 @@ implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges { acc[cur.egIdlClass] = cur.template; return acc; }, {}); - - // Make the default an entry with no id if we have it - usually from reloading after saving a freetext - if (!this.selectedId && !this.selected){ - this.selected = this.entrylist.find(e => e.id == null); - } - + document.querySelectorAll('ngb-typeahead-window button[disabled]').forEach(b => b.setAttribute('tabindex', '-1')); this.controller = this.instance['_elementRef'].nativeElement as HTMLInputElement; this.controller.addEventListener('keydown', this.onKeydown.bind(this)); @@ -812,27 +807,21 @@ implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges { }; writeValue(value: ComboboxEntry) { - //console.debug('writeValue: ', value); - if (value !== undefined && value !== null) { - if (!this.hasEntry(value.id)) { - // First we see if we have a different entry with the same text. - let dupeEntry = this.entrylist.find(e => e.label === value.label); - if (dupeEntry !== undefined) { - // Duplicate, select the preexisting entry - this.selected = dupeEntry; - - } else { - // No duplicate, make a new freetext entry with the same value - this.selected = - { - id: null, - label: value?.label, - freetext: true, - class: value?.class - }; - } - - } else {this.selectedId = value.id;} + // only support a ComboboxEntry + if (value?.id === undefined) { return; } + + // support a freetext entry + if (value.id === null && value.freetext && this.allowFreeText) { + const existingFreetext = this.entrylist.find( + ({ id, freetext }) => id === null && freetext + ); + if (existingFreetext) { + Object.assign(existingFreetext, value); + } + this.selected = { ...value }; + + } else { + this.selectedId = value.id; this.applySelection(); } } ----------------------------------------------------------------------- Summary of changes: .../src/app/share/combobox/combobox.component.ts | 43 ++++++++-------------- 1 file changed, 16 insertions(+), 27 deletions(-) hooks/post-receive -- Evergreen ILS
participants (1)
-
Git User