import * as _angular_core from '@angular/core'; import { TemplateRef, OnDestroy, ElementRef, Renderer2, ChangeDetectorRef, OnInit, EventEmitter, ViewContainerRef } from '@angular/core'; import { NgControl } from '@angular/forms'; import { ComponentLoaderFactory } from 'ngx-bootstrap/component-loader'; import { Subscription, Observable } from 'rxjs'; import { PositioningService } from 'ngx-bootstrap/positioning'; import * as i1 from '@angular/common'; declare const latinMap: { [key: string]: string; }; declare class TypeaheadMatch { readonly value: string; readonly item: ItemType; protected header: boolean; constructor(item: ItemType, value?: string, header?: boolean); isHeader(): boolean; toString(): string; } /** * A context for the `optionsListTemplate` * input template in case you want to override default one */ interface TypeaheadOptionListContext { /** All matches */ matches: TypeaheadMatch[]; /** Item template */ itemTemplate: TemplateRef; /** Search query */ query: string[] | string; /** Typeahead template methods */ $implicit: TypeaheadTemplateMethods; } /** * A context for the `typeaheadItemTemplate` * input template in case you want to override default one */ interface TypeaheadOptionItemContext { /** Item */ item: unknown; /** Item index */ index: number; /** Typeahead match */ match: TypeaheadMatch; /** Search query */ query: string[] | string; } /** * Methods for `optionsListTemplate` context */ interface TypeaheadTemplateMethods { /** Function to select an option by click event */ selectMatch(value: TypeaheadMatch, e?: Event): void; /** Function to select an option by mouseenter event */ selectActive(value: TypeaheadMatch): void; /** Function to check if an option is active */ isActive(value: TypeaheadMatch): boolean; } declare class TypeaheadContainerComponent implements OnDestroy { private positionService; private renderer; element: ElementRef; private changeDetectorRef; readonly activeChangeEvent: _angular_core.OutputEmitterRef; parent?: TypeaheadDirective; query?: string[] | string; isFocused: boolean; top?: string; left?: string; display?: string; placemen?: string; dropup?: boolean; guiHeight?: string; needScrollbar?: boolean; animationState?: string; positionServiceSubscription: Subscription; height: number; popupId: string; get typeaheadTemplateMethods(): TypeaheadTemplateMethods; protected _active?: TypeaheadMatch; protected _matches: TypeaheadMatch[]; private ulElement?; private liElements?; constructor(positionService: PositioningService, renderer: Renderer2, element: ElementRef, changeDetectorRef: ChangeDetectorRef); get active(): TypeaheadMatch | undefined; set active(active: TypeaheadMatch | undefined); get matches(): TypeaheadMatch[]; set matches(value: TypeaheadMatch[]); get isTopPosition(): boolean; get optionsListTemplate(): TemplateRef | undefined; get isAnimated(): boolean; get adaptivePosition(): boolean; get typeaheadScrollable(): boolean; get typeaheadOptionsInScrollableView(): number; get typeaheadIsFirstItemActive(): boolean; get itemTemplate(): TemplateRef | undefined; get canSelectItemsOnBlur(): boolean; selectActiveMatch(isActiveItemChanged?: boolean): void; activeChanged(): void; prevActiveMatch(): void; nextActiveMatch(): void; selectActive(value: TypeaheadMatch): void; highlight(match: TypeaheadMatch, query: string[] | string): string; focusLost(): void; isActive(value: TypeaheadMatch): boolean; selectMatch(value?: TypeaheadMatch, event?: Event): boolean; setScrollableMode(): void; scrollPrevious(index: number): void; scrollNext(index: number): void; ngOnDestroy(): void; protected setActive(value?: TypeaheadMatch): void; private isScrolledIntoView; private scrollToBottom; private scrollToTop; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface TypeaheadOrder { /** field for sorting */ field?: string; /** ordering direction, could be 'asc' or 'desc' */ direction: 'asc' | 'desc'; } /** Default values provider for typeahead */ declare class TypeaheadConfig { /** sets use adaptive position */ adaptivePosition: boolean; /** turn on/off animation */ isAnimated: boolean; /** used to hide results on blur */ hideResultsOnBlur: boolean; /** if true, typeahead will cancel async request on blur */ cancelRequestOnFocusLost: boolean; /** used to choose the first item in typeahead container */ selectFirstItem: boolean; /** used to active/inactive the first item in typeahead container */ isFirstItemActive: boolean; /** used to choose set minimal no of characters that needs to * be entered before typeahead kicks-in */ minLength: number; /** * used to choose item on blur event */ selectItemOnBlur: boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } type TypeaheadOption = string | Record; type TypeaheadOptionArr = TypeaheadOption[] | Observable; declare class TypeaheadDirective implements OnInit, OnDestroy { private changeDetection; private element; private ngControl; private renderer; /** options source, can be Array of strings, objects or * an Observable for external matching process */ readonly typeahead: _angular_core.InputSignal; /** minimal no of characters that needs to be entered before * typeahead kicks-in. When set to 0, typeahead shows on focus with full * list of options (limited as normal by typeaheadOptionsLimit) */ readonly typeaheadMinLength: _angular_core.InputSignal; /** sets use adaptive position */ readonly adaptivePosition: _angular_core.InputSignal; /** turn on/off animation */ readonly isAnimated: _angular_core.InputSignal; /** minimal wait time after last character typed before typeahead kicks-in */ readonly typeaheadWaitMs: _angular_core.InputSignal; /** maximum length of options items list. The default value is 20 */ readonly typeaheadOptionsLimit: _angular_core.InputSignal; /** when options source is an array of objects, the name of field * that contains the options value, we use array item as option in case * of this field is missing. Supports nested properties and methods. */ readonly typeaheadOptionField: _angular_core.InputSignal; /** when options source is an array of objects, the name of field that * contains the group value, matches are grouped by this field when set. */ readonly typeaheadGroupField: _angular_core.InputSignal; /** Used to specify a custom order of matches. When options source is an array of objects * a field for sorting has to be set up. In case of options source is an array of string, * a field for sorting is absent. The ordering direction could be changed to ascending or descending. */ readonly typeaheadOrderBy: _angular_core.InputSignal; /** should be used only in case of typeahead attribute is Observable of array. * If true - loading of options will be async, otherwise - sync. * true make sense if options array is large. */ readonly typeaheadAsync: _angular_core.InputSignal; /** match latin symbols. * If true the word súper would match super and vice versa. */ readonly typeaheadLatinize: _angular_core.InputSignal; /** Can be use to search words by inserting a single white space between each characters * for example 'C a l i f o r n i a' will match 'California'. */ readonly typeaheadSingleWords: _angular_core.InputSignal; /** should be used only in case typeaheadSingleWords attribute is true. * Sets the word delimiter to break words. Defaults to space. */ readonly typeaheadWordDelimiters: _angular_core.InputSignal; /** Can be used to conduct a search of multiple items and have suggestion not for the * whole value of the input but for the value that comes after a delimiter provided via * typeaheadMultipleSearchDelimiters attribute. This option can only be used together with * typeaheadSingleWords option if typeaheadWordDelimiters and typeaheadPhraseDelimiters * are different from typeaheadMultipleSearchDelimiters to avoid conflict in determining * when to delimit multiple searches and when a single word. */ readonly typeaheadMultipleSearch: _angular_core.InputSignal; /** should be used only in case typeaheadMultipleSearch attribute is true. * Sets the multiple search delimiter to know when to start a new search. Defaults to comma. * If space needs to be used, then explicitly set typeaheadWordDelimiters to something else than space * because space is used by default OR set typeaheadSingleWords attribute to false if you don't need * to use it together with multiple search. */ readonly typeaheadMultipleSearchDelimiters: _angular_core.InputSignal; /** should be used only in case typeaheadSingleWords attribute is true. * Sets the word delimiter to match exact phrase. * Defaults to simple and double quotes. */ readonly typeaheadPhraseDelimiters: _angular_core.InputSignal; /** used to specify a custom item template. * Template variables exposed are called item and index; */ readonly typeaheadItemTemplate: _angular_core.InputSignal | undefined>; /** used to specify a custom options list template. * Template variables: matches, itemTemplate, query */ readonly optionsListTemplate: _angular_core.InputSignal | undefined>; /** specifies if typeahead is scrollable */ readonly typeaheadScrollable: _angular_core.InputSignal; /** specifies number of options to show in scroll view */ readonly typeaheadOptionsInScrollableView: _angular_core.InputSignal; /** used to hide result on blur */ readonly typeaheadHideResultsOnBlur: _angular_core.InputSignal; /** fired when an options list was opened and the user clicked Tab * If a value equal true, it will be chosen first or active item in the list * If value equal false, it will be chosen an active item in the list or nothing */ readonly typeaheadSelectFirstItem: _angular_core.InputSignal; /** makes active first item in a list */ readonly typeaheadIsFirstItemActive: _angular_core.InputSignal; /** fired when 'busy' state of this component was changed, * fired on async mode only, returns boolean */ readonly typeaheadLoading: _angular_core.OutputEmitterRef; /** fired on every key event and returns true * in case of matches are not detected */ readonly typeaheadNoResults: _angular_core.OutputEmitterRef; /** fired when option was selected, return object with data of this option. */ readonly typeaheadOnSelect: _angular_core.OutputEmitterRef>; /** fired when option was previewed, return object with data of this option. */ readonly typeaheadOnPreview: _angular_core.OutputEmitterRef | undefined>; /** fired when blur event occurs. returns the active item */ readonly typeaheadOnBlur: _angular_core.OutputEmitterRef | undefined>; /** * A selector specifying the element the typeahead should be appended to. */ readonly container: _angular_core.InputSignal; /** This attribute indicates that the dropdown should be opened upwards */ readonly dropup: _angular_core.InputSignal; /** if false restrict model values to the ones selected from the popup only will be provided */ /** if false the first match automatically will not be focused as you type */ /** format the ng-model result after selection */ /** if true automatically select an item when there is one option that exactly matches the user input */ /** if true select the currently highlighted match on blur */ /** if false don't focus the input element the typeahead directive is associated with on selection */ activeDescendant?: string; isOpen: boolean; popupId: string; list: string; _container?: TypeaheadContainerComponent; isActiveItemChanged: boolean; isFocused: boolean; cancelRequestOnFocusLost: boolean; selectItemOnBlur: boolean; protected keyUpEventEmitter: EventEmitter; protected placement: string; protected _matches: TypeaheadMatch[]; private _typeahead; private _subscriptions; private _allEnteredValue?; private _outsideClickListener; private _typeaheadMinLengthValue; private _typeaheadAsyncValue?; constructor(cis: ComponentLoaderFactory, config: TypeaheadConfig, changeDetection: ChangeDetectorRef, element: ElementRef, ngControl: NgControl, renderer: Renderer2, viewContainerRef: ViewContainerRef); get matches(): TypeaheadMatch[]; ngOnInit(): void; onInput(e: any): void; onChange(event: KeyboardEvent): void; onFocus(): void; onBlur(): void; onKeydown(event: KeyboardEvent): void; changeModel(match?: TypeaheadMatch): void; show(): void; hide(): void; onOutsideClick(): void; ngOnDestroy(): void; protected asyncActions(): void; protected syncActions(): void; protected normalizeOption(option: TypeaheadOption): string; protected tokenizeQuery(currentQuery: string | string[]): string | string[]; protected normalizeQuery(value: string): string | string[]; protected testMatch(match: string, test: string[] | string): boolean; protected finalizeAsyncCall(matches?: TypeaheadOption | TypeaheadOption[]): void; protected prepareMatches(options: TypeaheadOption | TypeaheadOption[]): void; protected orderMatches(options: TypeaheadOption[]): TypeaheadOption[]; protected hasMatches(): boolean; protected checkDelimitersConflict(): void; protected haveCommonCharacters(str1: string, str2: string): boolean; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } declare class TypeaheadOptions { placement: string; animation: boolean; typeaheadRef: TypeaheadDirective; constructor(options: TypeaheadOptions); } declare function latinize(str: string): string; declare function escapeRegexp(queryToEscape: string): string; declare function tokenize(str: string, wordRegexDelimiters?: string, phraseRegexDelimiters?: string, delimitersForMultipleSearch?: string): Array; declare function getValueFromObject(object: string | Record, option?: string): string; declare class TypeaheadModule { static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } export { TypeaheadConfig, TypeaheadContainerComponent, TypeaheadDirective, TypeaheadMatch, TypeaheadModule, TypeaheadOptions, escapeRegexp, getValueFromObject, latinMap, latinize, tokenize }; export type { TypeaheadOptionItemContext, TypeaheadOptionListContext, TypeaheadOrder, TypeaheadTemplateMethods };