import { ComponentRef, ElementRef, EventEmitter, OnDestroy, OnInit, ViewContainerRef } from '@angular/core'; import { OperatorFunction } from 'rxjs'; import { Option, OptionBase } from '@sebgroup/green-angular/src/v-angular/core'; import { NggvInputComponent } from '@sebgroup/green-angular/src/v-angular/input'; import { NggvDropdownComponent } from '../dropdown.component'; import { NggvTypeaheadDropdownListComponent } from '../typeahead/typeahead-dropdown-list/typeahead-dropdown-list.component'; import { NggvTypeaheadInputComponent } from './typeahead-input/typeahead-input.component'; import * as i0 from "@angular/core"; export declare class NggvTypeaheadDirective = Option> implements OnInit, OnDestroy { private viewContainerRef; private element; private hostDropdown; private hostInput; /** Function that filter the inputvalue */ set nggvTypeahead(value: OperatorFunction | undefined); /** Formats each item that is displayed as an option. Only applies format if the option if it implement Option interface. */ resultFormatter?: (option: OptionBase) => string; /** Formats the selected item in the input when dropdown is opened. If no function is provided, it will display the value of the selected objects label property */ selectedFormatter?: (selected: OptionBase) => string; /** Allow option to be unselected in the dropdown even if it is required. Defaults to true */ allowUnselect: boolean; /** Custom label for the unselect option */ unselectLabel?: string; /** Custom label for the empty option */ emptyOptionLabel?: string; /** Emits the entered string the user has written in the input */ filterPhraseChange: EventEmitter; /** Forward text inputs to apply the filter function*/ onNggvInput(event: any): void; /** Helper to the determine if the host is nggv-drodpown or nggv-input*/ get hostIsDropdown(): boolean; /** Predefined options */ get defaultNullishOption(): OptionBase; get emptyOption(): OptionBase; /** Name of the component. nggv-dropdown if NggvDropdownComponent or nggv-input if NggvInputComponent */ get localName(): any; dropdownListComponent: ComponentRef; inputComponent: ComponentRef; private typeaheadFunction?; private inputValue$; private inputSubscription$?; private onDestroy$; constructor(viewContainerRef: ViewContainerRef, element: ElementRef, hostDropdown: NggvDropdownComponent, hostInput: NggvInputComponent); ngOnInit(): void; ngOnDestroy(): void; /** * @internal * Core functionality of typeahead. Emits input, then filters the result based on the supplied function * If directive is applied on nggv-input, manually show or hide options in the list. * If directive is applied on nggv-dropdown, let the dropdown itself choose when to open or close */ private handleInputChanges; /** * @internal * Creates a nggv-input if the host itself is not a text-input * Set styles to not display the input when closed * Trigger filtering when changes occur in the field * */ private createInput; /** @internal Creates a nggv-dropdown-list if the host itself is a nggv-input */ private createDropdownList; /** * @internal Sets the options the user can select. * If the host is a nggv-dropdown, utilize the dropdown itself to display the options * If the host is a nggv-input, use the created nggv-dropdown-list to displaye the options * @param filteredValues The options to display in the dropdown * @param emptyInput If the input is empty */ private setOptions; /** * @internal Formats the available options to display in the dropdown list * @param options The selected value * @returns The formatted value */ private formatOptions; static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, { optional: true; host: true; }, { optional: true; host: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration, "nggv-input[nggvTypeahead], nggv-dropdown[nggvTypeahead]", never, { "nggvTypeahead": { "alias": "nggvTypeahead"; "required": false; }; "resultFormatter": { "alias": "resultFormatter"; "required": false; }; "selectedFormatter": { "alias": "selectedFormatter"; "required": false; }; "allowUnselect": { "alias": "allowUnselect"; "required": false; }; "unselectLabel": { "alias": "unselectLabel"; "required": false; }; "emptyOptionLabel": { "alias": "emptyOptionLabel"; "required": false; }; }, { "filterPhraseChange": "filterPhraseChange"; }, never, never, true, never>; }