mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
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:
committed by
Eugenio Romano
parent
87a464907c
commit
ba35eda2f9
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user