import { AfterViewInit, ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core'; import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { NgxMatSelectOptionType } from '../../select-model'; import { NgxMatSelectComponent } from '../../select'; import * as i0 from "@angular/core"; export interface NgxMatSelectFetchOptions { filteredOptions$: Observable; loading$: Observable; hasSearchBox: boolean | undefined | null; searchBoxPlaceholder: string | null | undefined; } export declare abstract class NgxMatSelectFetchOptionsDirective implements OnDestroy, OnInit, NgxMatSelectFetchOptions, AfterViewInit { protected host: NgxMatSelectComponent; protected _changeDetectorRef: ChangeDetectorRef; /** * Function used to sort the values in a select in multiple mode. * Follows the same logic as `Array.prototype.sort`. * in the server-side mode you should provide sortComparator in order to sort the selected options, * but in the client-side mode all the selected options and values would order with the order of received options */ sortComparator?: (a: unknown, b: unknown, options: unknown[]) => number; /** * if it's true the search-box will appear inside the panel */ get hasSearchBox(): boolean | undefined | null; set hasSearchBox(value: boolean | undefined | null); private _hasSearchBox; /** * a placeholder for the search-box to be shown if nothing is written in the search-box */ set searchBoxPlaceholder(value: string | undefined | null); /** * an observable to manage the filtered options state */ filteredOptions$: BehaviorSubject; /** * when the main stream is busy with fetching data from the server, the loading is true */ loading$: BehaviorSubject; /** * to handle the search */ abstract search: (searchTerm: string) => void; /** * all the options which are provided up to now * @protected */ protected abstract options: unknown[] | undefined | null; /** * an observable to manage destroying the other observables * @protected */ protected destroy$: Subject; /** * the type of received options * @protected */ protected optionType: NgxMatSelectOptionType; /** * if every input initialized or not * @private */ private initialized; /** * to recognize the first empty search * @private */ private isFirstEmptySearch; private searchSubscription?; protected constructor(host: NgxMatSelectComponent, _changeDetectorRef: ChangeDetectorRef); /** * to sync the value with selection Model, and check the possibility of fill incomplete values from the * received options * @private */ protected abstract syncValueAndOptions: () => void; /** Sorts the selected values in the selected based on their order in the panel. */ protected abstract sortValues: () => void; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** * to check the type of the options to realize there are primitive or an object * @protected */ protected checkOptionsType(): void; /** * to listen to the search-box input changes, and filter the options through the searchTerm * @private */ private initializeSearch; /** * to check value member and display-member are required if they are required, checking they are provided or not * @private */ private checkOptionLabel; /** * to sync the selected items with the value of the select-box * @private */ private listenToValueChanges; /** * to scroll to the selected option when the select has a value. * it works just in client side because we have whole the options and the selection mode has to be single selection, * @private */ private initScrollIntoSelectedOption; /** * @returns - a boolean to find out whether we are successful in scroll to the selected option or not * it depends on whether the corresponding option is present in the options. * @param selected - the selected item * @private */ private scrollIntoVisibleOptionView; /** * to sort the selected option and values with order of received options, whenever the selection or value changes * @private */ private initSortValues; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; }