search fixes (#3272)

* "show less" button for search filter container

* consistent button styles across widgets

* i18n support for facets

* page sizes for check list

* display page buttons only when needed

* page sizes for all facet fields

* test fixes

* update lib versions

* fix angular configuration
This commit is contained in:
Denys Vuika
2018-05-08 13:41:27 +01:00
committed by Eugenio Romano
parent 87a464907c
commit ba35eda2f9
25 changed files with 518 additions and 258 deletions

View File

@@ -20,6 +20,13 @@ import { MatCheckboxChange } from '@angular/material';
import { SearchWidget } from '../../search-widget.interface';
import { SearchWidgetSettings } from '../../search-widget-settings.interface';
import { SearchQueryBuilderService } from '../../search-query-builder.service';
import { SearchFilterList } from '../search-filter/models/search-filter-list.model';
export interface SearchListOption {
name: string;
value: string;
checked: boolean;
}
@Component({
selector: 'adf-search-check-list',
@@ -33,21 +40,27 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
id: string;
settings?: SearchWidgetSettings;
context?: SearchQueryBuilderService;
options: { name: string, value: string, checked: boolean }[] = [];
options: SearchFilterList<SearchListOption>;
operator: string = 'OR';
pageSize = 5;
constructor() {
this.options = new SearchFilterList<SearchListOption>();
}
ngOnInit(): void {
if (this.settings) {
this.operator = this.settings.operator || 'OR';
this.pageSize = this.settings.pageSize || 5;
if (this.settings.options && this.settings.options.length > 0) {
this.options = [...this.settings.options];
this.options = new SearchFilterList(this.settings.options, this.pageSize);
}
}
}
reset() {
this.options.forEach(opt => {
this.options.items.forEach(opt => {
opt.checked = false;
});
@@ -63,7 +76,7 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
}
flush() {
const checkedValues = this.options
const checkedValues = this.options.items
.filter(option => option.checked)
.map(option => option.value);