mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#3794 Submit mit Enter und Lupen-Symbol führt zu unterschiedliche Ergebnisse
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
</button>
|
||||
|
||||
<ng-container *ngIf="!loading">
|
||||
<button tabindex="0" class="search-button search" *ngIf="!canScan" (click)="search.emit(query)">
|
||||
<button tabindex="0" class="search-button search" *ngIf="!canScan" (click)="emitSearch()" [disabled]="completeValue !== query">
|
||||
<ui-icon icon="search" size="28px"></ui-icon>
|
||||
</button>
|
||||
<button tabindex="0" class="search-button scan" *ngIf="canScan" (click)="startScan()">
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
ui-icon {
|
||||
@apply text-gray-300;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.clear-button {
|
||||
|
||||
@@ -49,8 +49,16 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
@Input()
|
||||
placeholder: string = '';
|
||||
|
||||
private _query = '';
|
||||
|
||||
@Input()
|
||||
query: string = '';
|
||||
get query() {
|
||||
return this._query;
|
||||
}
|
||||
set query(value: string) {
|
||||
this._query = value;
|
||||
this.completeValue = value;
|
||||
}
|
||||
|
||||
@Output()
|
||||
queryChange = new EventEmitter<string>();
|
||||
@@ -58,6 +66,7 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
@Output()
|
||||
search = new EventEmitter<string>();
|
||||
|
||||
completeValue = this.query;
|
||||
@Output()
|
||||
complete = new EventEmitter<string>();
|
||||
|
||||
@@ -117,6 +126,7 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
|
||||
writeValue(obj: any): void {
|
||||
this.setQuery(obj, false);
|
||||
this.completeValue = obj;
|
||||
}
|
||||
|
||||
registerOnChange(fn: any): void {
|
||||
@@ -166,13 +176,14 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
}
|
||||
|
||||
setQuery(query: string, emitEvent: boolean = true, complete?: boolean) {
|
||||
this.query = query;
|
||||
this._query = query;
|
||||
if (emitEvent) {
|
||||
this.queryChange.emit(query);
|
||||
this.onChange(query);
|
||||
this.onTouched();
|
||||
}
|
||||
if (complete) {
|
||||
this.completeValue = query;
|
||||
this.complete.emit(query);
|
||||
}
|
||||
this.cdr.markForCheck();
|
||||
@@ -206,7 +217,7 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
this.autocomplete?.handleKeyboardEvent(event);
|
||||
if (this.autocomplete?.activeItem) {
|
||||
const query = this.autocompleteValueSelector(this.autocomplete.activeItem.item);
|
||||
this.setQuery(query, false);
|
||||
this.setQuery(query, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +228,10 @@ export class UiSearchboxNextComponent extends UiFormControlDirective<any>
|
||||
}
|
||||
}
|
||||
|
||||
emitSearch() {
|
||||
this.search.emit(this.query);
|
||||
}
|
||||
|
||||
@HostListener('focusout', ['$event'])
|
||||
onBlur() {
|
||||
this.onTouched();
|
||||
|
||||
Reference in New Issue
Block a user