mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Improve autocomplete closing #558
This commit is contained in:
parent
f2ac6debd9
commit
74e4a8160b
@ -1,32 +1,10 @@
|
|||||||
import {
|
import {Component, ElementRef, EventEmitter, forwardRef, Input, OnDestroy, Output, ViewChild,} from '@angular/core';
|
||||||
Component,
|
|
||||||
ElementRef,
|
|
||||||
EventEmitter,
|
|
||||||
forwardRef,
|
|
||||||
Input,
|
|
||||||
OnDestroy,
|
|
||||||
Output,
|
|
||||||
ViewChild,
|
|
||||||
} from '@angular/core';
|
|
||||||
import {Router, RouterLink} from '@angular/router';
|
import {Router, RouterLink} from '@angular/router';
|
||||||
import {BehaviorSubject, Subscription} from 'rxjs';
|
import {BehaviorSubject, Subscription} from 'rxjs';
|
||||||
import {
|
import {AutoCompleteService, RenderableAutoCompleteItem,} from '../autocomplete.service';
|
||||||
AutoCompleteService,
|
import {MetadataSearchQueryTypes, SearchQueryTypes,} from '../../../../../../common/entities/SearchQueryDTO';
|
||||||
RenderableAutoCompleteItem,
|
|
||||||
} from '../autocomplete.service';
|
|
||||||
import {
|
|
||||||
MetadataSearchQueryTypes,
|
|
||||||
SearchQueryTypes,
|
|
||||||
} from '../../../../../../common/entities/SearchQueryDTO';
|
|
||||||
import {Config} from '../../../../../../common/config/public/Config';
|
import {Config} from '../../../../../../common/config/public/Config';
|
||||||
import {
|
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, UntypedFormControl, ValidationErrors, Validator,} from '@angular/forms';
|
||||||
ControlValueAccessor,
|
|
||||||
UntypedFormControl,
|
|
||||||
NG_VALIDATORS,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
ValidationErrors,
|
|
||||||
Validator,
|
|
||||||
} from '@angular/forms';
|
|
||||||
import {AutoCompleteRenderItem} from '../AutoCompleteRenderItem';
|
import {AutoCompleteRenderItem} from '../AutoCompleteRenderItem';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -49,8 +27,7 @@ import { AutoCompleteRenderItem } from '../AutoCompleteRenderItem';
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class GallerySearchFieldBaseComponent
|
export class GallerySearchFieldBaseComponent
|
||||||
implements ControlValueAccessor, Validator, OnDestroy
|
implements ControlValueAccessor, Validator, OnDestroy {
|
||||||
{
|
|
||||||
@Input() placeholder = $localize`Search`;
|
@Input() placeholder = $localize`Search`;
|
||||||
@Output() search = new EventEmitter<void>();
|
@Output() search = new EventEmitter<void>();
|
||||||
|
|
||||||
@ -231,7 +208,8 @@ export class GallerySearchFieldBaseComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
public onTouched(): void {}
|
public onTouched(): void {
|
||||||
|
}
|
||||||
|
|
||||||
public writeValue(obj: string): void {
|
public writeValue(obj: string): void {
|
||||||
this.rawSearchText = obj;
|
this.rawSearchText = obj;
|
||||||
@ -259,6 +237,7 @@ export class GallerySearchFieldBaseComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private emptyAutoComplete(): void {
|
private emptyAutoComplete(): void {
|
||||||
|
this.mouseOverAutoComplete = false;
|
||||||
this.highlightedAutoCompleteItem = -1;
|
this.highlightedAutoCompleteItem = -1;
|
||||||
this.autoCompleteRenders = [];
|
this.autoCompleteRenders = [];
|
||||||
}
|
}
|
||||||
@ -314,9 +293,11 @@ export class GallerySearchFieldBaseComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
||||||
private propagateChange = (_: string): void => {};
|
private propagateChange = (_: string): void => {
|
||||||
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
||||||
private propagateTouch = (_: never): void => {};
|
private propagateTouch = (_: never): void => {
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user