UNPKG

@ux-aspects/ux-aspects

Version:

Open source user interface framework for building modern, responsive, mobile big data applications

73 lines (72 loc) 3.6 kB
import { BooleanInput } from '@angular/cdk/coercion'; import { EventEmitter, OnDestroy, OnInit } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { TypeaheadKeyService, TypeaheadOptionEvent } from '../../typeahead/index'; import { FilterDynamicListConfig } from '../interfaces/filter-dynamic-list-config.interface'; import { Filter } from '../interfaces/filter.interface'; import * as i0 from "@angular/core"; export declare class FilterDynamicComponent implements OnInit, OnDestroy { readonly typeaheadKeyService: TypeaheadKeyService<any>; private readonly _filterService; private readonly _changeDetector; /** The unique id is used multiple times - this is to ensure we only increment it once per instance */ private readonly _uniqueId; /** Define the input for the component */ id: string; /** The list of possible filter options */ filters: Filter[]; /** Specify if there should be an initially selected filter */ initial: Filter; /** Defined the closeOnBlur state for the ux-menu trigger */ set closeOnBlur(value: boolean); get closeOnBlur(): boolean; /** Specify the typeahead options */ set options(options: FilterDynamicListConfig); /** Get the options with the defaults for any missing options */ get options(): FilterDynamicListConfig; /** Emit when the filter menu is closed */ readonly closed: EventEmitter<void>; /** Generate a unique id for the typeahead */ typeaheadId: string; /** Store the current search query */ query$: BehaviorSubject<string>; /** Store the selected filter */ selected: Filter; /** Indicate whether or not the typeahead should be shown */ showTypeahead: boolean; /** Store the items that should be displayed in the typeahead */ typeaheadItems: string[]; /** Store the currently highlighted element */ highlightedElement: HTMLElement; /** Store the open state of the typeahead */ typeaheadOpen: boolean; /** Get the user provided id or fallback to a default ID */ get filterId(): string; /** The default options */ private readonly _defaultOptions; /** Store the user specified typeahead options */ private _options; /** Unsubscribe from all subscriptions */ private readonly _onDestroy; private _closeOnBlur; constructor(); /** Set up the initial conditions */ ngOnInit(): void; /** Cleanup all subscriptions */ ngOnDestroy(): void; /** Get the items to display in the typeahead based on the search query */ getItems(): string[]; /** When the dropdown is closed clear the query */ onClose(): void; /** If a filter needs removed, and is not the initial filter then remove it */ removeFilter(): void; /** Select a specific filter */ selectFilter(filter: Filter): void; /** Update typeahead items and visibility */ updateTypeahead(query: string): void; /** Select a filter from a typeahead item */ select(event: TypeaheadOptionEvent): void; static ngAcceptInputType_closeOnBlur: BooleanInput; static ɵfac: i0.ɵɵFactoryDeclaration<FilterDynamicComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FilterDynamicComponent, "ux-filter-dynamic", never, { "id": { "alias": "id"; "required": false; }; "filters": { "alias": "filters"; "required": false; }; "initial": { "alias": "initial"; "required": false; }; "closeOnBlur": { "alias": "closeOnBlur"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, { "closed": "closed"; }, never, never, false, never>; }