Fix #4891 Kundendaten erfassen // Land bei Lieferung nicht auswählbar

This commit is contained in:
Lorenz Hilpert
2024-11-26 16:56:50 +01:00
parent f62e198aed
commit 6743c8e630
2 changed files with 6 additions and 13 deletions

View File

@@ -46,6 +46,7 @@ export class SelectOptionComponent<T = any> implements FocusableOption {
select(event: Event): void {
event.preventDefault();
event.stopPropagation();
console.log('SelectOptionComponent.select', this.value, this._onSelect);
this._onSelect(this.value);
}
}

View File

@@ -12,7 +12,6 @@ import {
HostListener,
ElementRef,
HostBinding,
AfterContentInit,
OnDestroy,
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@@ -20,7 +19,6 @@ import { SelectOptionComponent } from './select-option.component';
import { IconComponent } from '@shared/components/icon';
import { BaseFormControlDirective } from '@shared/components/form-control';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { NgIf } from '@angular/common';
@Component({
@@ -34,7 +32,7 @@ import { NgIf } from '@angular/common';
imports: [IconComponent, NgIf],
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: SelectComponent, multi: true }],
})
export class SelectComponent<T = any> extends BaseFormControlDirective implements ControlValueAccessor, AfterContentInit, OnDestroy {
export class SelectComponent<T = any> extends BaseFormControlDirective implements ControlValueAccessor, OnDestroy {
@ContentChildren(SelectOptionComponent)
options: QueryList<SelectOptionComponent>;
@@ -101,16 +99,6 @@ export class SelectComponent<T = any> extends BaseFormControlDirective implement
super();
}
ngAfterContentInit() {
this.options.changes.pipe(takeUntil(this._onDestroy$)).subscribe(() => {
this.options.forEach((option) => {
option.registerOnSelect((value) => this.setValue(value));
});
this._cdr.markForCheck();
});
}
ngOnDestroy() {
this._onDestroy$.next();
this._onDestroy$.complete();
@@ -158,6 +146,10 @@ export class SelectComponent<T = any> extends BaseFormControlDirective implement
this._open = true;
this._forceClose = false;
this._cdr.markForCheck();
this.options.forEach((option) => {
option.registerOnSelect((value) => this.setValue(value));
});
}
close() {