mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2846] new facets (#3251)
* schema and configuration improvements * check list search widget * "Clear all" button to reset the list * page size and "show more" for response facet fields * test fixes * fix tests * fix pagination bug (skipCount reseting) * integrate date range picker from #3248 * i18n support for date and number range * some docs for search filter * docs update * docs update * cleanup code as per review
This commit is contained in:
committed by
Eugenio Romano
parent
bb664a283b
commit
dbe88a5efc
@@ -18,7 +18,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { QueryBody } from 'alfresco-js-api';
|
||||
import { QueryBody, RequestFacetFields, RequestFacetField } from 'alfresco-js-api';
|
||||
import { SearchCategory } from './search-category.interface';
|
||||
import { FilterQuery } from './filter-query.interface';
|
||||
import { SearchRange } from './search-range.interface';
|
||||
@@ -45,8 +45,8 @@ export class SearchQueryBuilderService {
|
||||
throw new Error('Search configuration not found.');
|
||||
}
|
||||
|
||||
if (this.config.query && this.config.query.categories) {
|
||||
this.categories = this.config.query.categories.filter(f => f.enabled);
|
||||
if (this.config.categories) {
|
||||
this.categories = this.config.categories.filter(f => f.enabled);
|
||||
}
|
||||
|
||||
this.filterQueries = this.config.filterQueries || [];
|
||||
@@ -116,7 +116,7 @@ export class SearchQueryBuilderService {
|
||||
fields: this.config.fields,
|
||||
filterQueries: this.filterQueries,
|
||||
facetQueries: this.config.facetQueries,
|
||||
facetFields: this.config.facetFields
|
||||
facetFields: this.facetFields
|
||||
};
|
||||
|
||||
return result;
|
||||
@@ -124,4 +124,23 @@ export class SearchQueryBuilderService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private get facetFields(): RequestFacetFields {
|
||||
const facetFields = this.config.facetFields;
|
||||
|
||||
if (facetFields && facetFields.length > 0) {
|
||||
return {
|
||||
facets: facetFields.map(facet => <RequestFacetField> {
|
||||
field: facet.field,
|
||||
mincount: facet.mincount,
|
||||
label: facet.label,
|
||||
limit: facet.limit,
|
||||
offset: facet.offset,
|
||||
prefix: facet.prefix
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user