[ACA-3507] [ACA-3523] Fix Filters (#5821)

* fix search one letter
fix navigation
add new property search text prefix and suffix

* fix unit test

* fix unit test

* fix failing test
This commit is contained in:
Eugenio Romano
2020-06-29 17:27:52 +01:00
committed by GitHub
parent 0183f9e7f7
commit 5180493aa8
14 changed files with 102 additions and 64 deletions

View File

@@ -36,6 +36,7 @@ export class SearchTextComponent implements SearchWidget, OnInit {
id: string;
settings: SearchWidgetSettings;
context: SearchQueryBuilderService;
isActive = false;
ngOnInit() {
if (this.context && this.settings && this.settings.pattern) {
@@ -49,6 +50,8 @@ export class SearchTextComponent implements SearchWidget, OnInit {
}
reset() {
this.isActive = false;
this.value = '';
this.updateQuery(null);
}
@@ -59,10 +62,21 @@ export class SearchTextComponent implements SearchWidget, OnInit {
}
private updateQuery(value: string) {
this.isActive = !!value;
if (this.context && this.settings && this.settings.field) {
this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${value}'` : '';
this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${this.getSearchPrefix()}${value}${this.getSearchSuffix()}'` : '';
this.context.update();
}
}
private getSearchPrefix(): string {
return this.settings.searchPrefix ? this.settings.searchPrefix : '';
}
private getSearchSuffix(): string {
return this.settings.searchSuffix ? this.settings.searchSuffix : '';
}
}