/** * @license * Copyright Datorama. All Rights Reserved. * * Use of this source code is governed by an Apache License 2.0 license that can be * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE */ import { AfterContentInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core'; import { ControlValueAccessor, FormControl } from '@angular/forms'; import { DatoTranslateService } from '../services/translate.service'; import { BaseCustomControl } from '../custom-control/base-custom-control'; import { DatoOptionComponent } from '../options/option.component'; import { DatoGroupComponent } from '../options/group.component'; import { DatoAccordionComponent } from '../accordion/public_api'; import { DatoListSearchStrategy } from './search.strategy'; import { DatoListSortComparator } from './sort.comparator'; export declare class DatoListComponent extends BaseCustomControl implements OnInit, ControlValueAccessor, AfterContentInit, OnDestroy { private cdr; private translate; private host; datoSize: any; /** QueryList of datoOptions children */ options: QueryList; /** QueryList of datoGroups children */ groups: QueryList; /** QueryList of datoAccordionGroups children */ accordion: QueryList; /** autoFocus on search input element */ autoFocus: boolean; /** The options to display in the list */ set dataSet(data: any[]); /** Debounce time to emit search queries */ debounceTime: number; /** If defined, indicates by which key the data should be normalized */ groupBy: string; /** The key that stores the option id */ idKey: string; /** Whether to show loading indicator */ isLoading: boolean; /** The lookup key for the label */ labelKey: string; /** Search groups as well as options */ searchGroupLabels: boolean; /** Client search strategy */ searchStrategy: DatoListSearchStrategy; /** Client sort comparator */ sortComparator: DatoListSortComparator; /** Client sort */ sort: boolean; allowSelectAll: boolean; /** A placeholder for the search */ set searchPlaceholder(value: string); visibleOptions: any[]; private get hasGroups(); private get _visibleOptions(); private get visibleCheckedCount(); /** Whether all the options are checked */ get _isAllChecked(): boolean; /** * Getters and Setters */ get data(): any[]; get hasSearchResults(): boolean; get hasResults(): boolean; get hasValue(): number; get searchTerm(): any; /** Internal */ get _count(): string; /** FormControl which listens for search value changes */ searchControl: FormControl; _searchPlaceholder: string; /** * Private Properties */ /** Store the initial data */ private _data; /** Store filtered data after performing a search */ private _searchData; /** Indicates whether we already initialized the data, * This is optimization for non async calls. * */ private _dataIsDirty; /** Enable/disable the select-trigger */ private _disabled; /** Whether we have search results */ private _hasSearchResults; /** Store the active options */ private _model; _listClass: string; _hasData: boolean; /** Clicks options subscription */ private clicksSubscription; /** Current index of active item (keyboard navigation) */ private currentIndex; /** true until ngOnInit */ private initialRun; /** Keyboard Manager */ private keyboardEventsManager; /** Keyboard subscription */ private keyboardEventsManagerSubscription; /** Whether we're in a search mode */ private isSearching; constructor(cdr: ChangeDetectorRef, translate: DatoTranslateService, host: ElementRef, datoSize: any); ngOnInit(): void; /** * A public helper function for trackBy. * This is in use by the developer. * @param index * @param option * @return {any} */ private _trackByFn; trackByFn: any; ngAfterContentInit(): void; ngOnDestroy(): void; /** * * @param {KeyboardEvent} event * @returns {boolean} */ keyup(event: KeyboardEvent): boolean; checkAll(checked: boolean): void; /** * * @param {boolean} isDisabled */ setDisabledState(isDisabled: boolean): void; /** * * @param {any | any[]} activeOptions */ writeValue(activeOptions: any | any[]): void; /** * Subscribe to options click events and mark the relevant DatoOptions as active */ private initOptions; /** * Normalize a flatten and sorting a data set * @param data * @return {any[]} */ private normalizeData; /** * Sort the groups and their children with the default comparator * @param {any[]} data * @return {any[]} * @private */ private _sort; /** * Whether the group component is Accordion * @return {number} */ private isAccordionGroup; /** * Retrieve an array of the group components * @return {ListGroupComponent[]} */ private getGroupComponentsArray; /** * * @param {DatoOptionComponent} datoOption */ private handleClick; /** * * @param {string} value * @returns {boolean} */ private isEmpty; /** * Subscribe to search changes and filter the list */ private listenToSearch; private performSearch; /** * Mark the initial control value as active * @param model */ private markAsActive; /** * * @param {number} index */ private scrollToElement; /** * Search for matching results * @param {string} searchTerm * @returns {boolean} */ private search; /** * Search for matching groups and children. * @param {string} searchTerm * @return {ListSearchResult} */ private groupSearch; /** * Get the key of the option group. It can be the group Id if exists, or the label. * @param option * @return {any} */ private getGroupKey; /** * Subscribe to option click and change the state accordingly * @param {DatoOptionComponent[]} options */ private subscribeToOptionClick; private setVisibleOptions; }