From b5e401668a4824df9825b15994bac3b92641ba31 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 17 Mar 2021 12:23:13 -0400 Subject: [PATCH] LP1904036 Combobox supports domId input Signed-off-by: Bill Erickson --- Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html | 1 + Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html index d2280811e3..f72683a1c5 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.html @@ -16,6 +16,7 @@ class="form-control" [ngClass]="{'text-success font-italic font-weight-bold': selected && selected.freetext}" [placeholder]="placeholder" + [id]="domId" [name]="name" [disabled]="isDisabled" [required]="isRequired" 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 fb8b900176..fe2f981ab0 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 @@ -46,7 +46,10 @@ export class IdlClassTemplateDirective { multi: true }] }) -export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges { +export class ComboboxComponent + implements ControlValueAccessor, OnInit, AfterViewInit, OnChanges { + + static domIdAuto = 0; selected: ComboboxEntry; click$: Subject; @@ -56,6 +59,8 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie @ViewChild('defaultDisplayTemplate', { static: true}) defaultDisplayTemplate: TemplateRef; @ViewChildren(IdlClassTemplateDirective) idlClassTemplates: QueryList; + @Input() domId = 'eg-combobox-' + ComboboxComponent.domIdAuto++; + // Applies a name attribute to the input. // Useful in forms. @Input() name: string; -- 2.11.0