UNPKG

@rero/ng-core

Version:

RERO angular core library.

79 lines (78 loc) 2.88 kB
import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; /** * Interface representing aggregations filters */ export interface AggregationsFilter { key: string; values: Array<any>; } /** * Service for managing records search. */ export declare class RecordSearchService { /** Aggregations filters array */ private _aggregationsFilters; /** Aggregations filters subject */ private _aggregationsFiltersSubject; /** * Constructor, initialize aggregations filters subject. */ constructor(); /** * Returns an observable which emits aggregations filters. */ get aggregationsFilters(): Observable<Array<AggregationsFilter>>; /** * Removes the given value from selected filters and removes all children * selected values, too. * @param key Aggregation key * @param bucket Bucket containing the value to remove */ removeAggregationFilter(key: string, bucket: any): void; /** * Set all aggregations filters and emit the list. * @param aggregationsFilters List of aggregations filters * @param forceRefresh Force the refresh of aggregations filters */ setAggregationsFilters(aggregationsFilters: Array<AggregationsFilter>, forceRefresh?: boolean): void; /** * Stores selected values for an aggregation or removes it if values are empty. * @param term Term (aggregation key) * @param values Selected values * @param bucket The complete ElasticSearch affected bucket configuration */ updateAggregationFilter(term: string, values: string[], bucket?: any): void; /** * Remove a filter from the current aggregations filters. * @param key - the filter name * @param value - the filter value * @param emit - is the `_aggregationsFiltersSubject` should be emitted */ removeFilter(key: string, value: string, emit?: boolean): void; /** * Check if a given filter exist in the current aggregations filters. * @param key - the filter name * @param value - the filter value * @returns `true` if exists */ hasFilter(key: string, value: string): boolean; /** * Remove the parent filters of a given bucket. * @param bucket - The ElasticSearch bucket */ removeParentFilters(bucket: any): void; /** * Removes children filters of a given bucket. * @param bucket - The ElasticSearch bucket */ removeChildrenFilters(bucket: any): void; /** * Check if a children filter of a given bucket exists * @param bucket - The ElasticSearch bucket * @returns `true` if the bucket has children with a corresponding filter */ hasChildrenFilter(bucket: any): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<RecordSearchService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RecordSearchService>; }