1 | import { ElementRef, EventEmitter, OnInit, Renderer, TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core';
|
2 | import { NgControl } from '@angular/forms';
|
3 | import { TypeaheadContainerComponent } from './typeahead-container.component';
|
4 | import 'rxjs/add/observable/from';
|
5 | import 'rxjs/add/operator/debounceTime';
|
6 | import 'rxjs/add/operator/filter';
|
7 | import 'rxjs/add/operator/map';
|
8 | import 'rxjs/add/operator/mergeMap';
|
9 | import 'rxjs/add/operator/toArray';
|
10 | import { TypeaheadMatch } from './typeahead-match.class';
|
11 | import { ComponentLoaderFactory } from '../component-loader';
|
12 | export declare class TypeaheadDirective implements OnInit, OnDestroy {
|
13 | /** options source, can be Array of strings, objects or an Observable for external matching process */
|
14 | typeahead: any;
|
15 | /** 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) */
|
16 | typeaheadMinLength: number;
|
17 | /** minimal wait time after last character typed before typeahead kicks-in */
|
18 | typeaheadWaitMs: number;
|
19 | /** maximum length of options items list */
|
20 | typeaheadOptionsLimit: number;
|
21 | /** 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. */
|
22 | typeaheadOptionField: string;
|
23 | /** 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. */
|
24 | typeaheadGroupField: string;
|
25 | /** should be used only in case of typeahead attribute is array. If true - loading of options will be async, otherwise - sync. true make sense if options array is large. */
|
26 | typeaheadAsync: boolean;
|
27 | /** match latin symbols. If true the word súper would match super and vice versa. */
|
28 | typeaheadLatinize: boolean;
|
29 | /** break words with spaces. If true the text "exact phrase" here match would match with match exact phrase here but not with phrase here exact match (kind of "google style"). */
|
30 | typeaheadSingleWords: boolean;
|
31 | /** should be used only in case typeaheadSingleWords attribute is true. Sets the word delimiter to break words. Defaults to space. */
|
32 | typeaheadWordDelimiters: string;
|
33 | /** should be used only in case typeaheadSingleWords attribute is true. Sets the word delimiter to match exact phrase. Defaults to simple and double quotes. */
|
34 | typeaheadPhraseDelimiters: string;
|
35 | /** used to specify a custom item template. Template variables exposed are called item and index; */
|
36 | typeaheadItemTemplate: TemplateRef<any>;
|
37 | /** used to specify a custom options list template. Template variables: matches, itemTemplate, query */
|
38 | optionsListTemplate: TemplateRef<any>;
|
39 | /** fired when 'busy' state of this component was changed, fired on async mode only, returns boolean */
|
40 | typeaheadLoading: EventEmitter<boolean>;
|
41 | /** fired on every key event and returns true in case of matches are not detected */
|
42 | typeaheadNoResults: EventEmitter<boolean>;
|
43 | /** fired when option was selected, return object with data of this option */
|
44 | typeaheadOnSelect: EventEmitter<TypeaheadMatch>;
|
45 | /** fired when blur event occurres. returns the active item */
|
46 | typeaheadOnBlur: EventEmitter<any>;
|
47 | /**
|
48 | * A selector specifying the element the typeahead should be appended to.
|
49 | * Currently only supports "body".
|
50 | */
|
51 | container: string;
|
52 | /** if false restrict model values to the ones selected from the popup only will be provided */
|
53 | /** if false the first match automatically will not be focused as you type */
|
54 | /** format the ng-model result after selection */
|
55 | /** if true automatically select an item when there is one option that exactly matches the user input */
|
56 | /** if true select the currently highlighted match on blur */
|
57 | /** if false don't focus the input element the typeahead directive is associated with on selection */
|
58 | _container: TypeaheadContainerComponent;
|
59 | isTypeaheadOptionsListActive: boolean;
|
60 | protected keyUpEventEmitter: EventEmitter<any>;
|
61 | protected _matches: TypeaheadMatch[];
|
62 | protected placement: string;
|
63 | protected ngControl: NgControl;
|
64 | protected viewContainerRef: ViewContainerRef;
|
65 | protected element: ElementRef;
|
66 | protected renderer: Renderer;
|
67 | private _typeahead;
|
68 | onChange(e: any): void;
|
69 | onFocus(): void;
|
70 | onBlur(): void;
|
71 | onKeydown(e: any): void;
|
72 | constructor(control: NgControl, viewContainerRef: ViewContainerRef, element: ElementRef, renderer: Renderer, cis: ComponentLoaderFactory);
|
73 | ngOnInit(): void;
|
74 | changeModel(match: TypeaheadMatch): void;
|
75 | readonly matches: any[];
|
76 | show(): void;
|
77 | hide(): void;
|
78 | ngOnDestroy(): any;
|
79 | protected asyncActions(): void;
|
80 | protected syncActions(): void;
|
81 | protected normalizeOption(option: any): any;
|
82 | protected normalizeQuery(value: string): any;
|
83 | protected testMatch(match: string, test: any): boolean;
|
84 | protected finalizeAsyncCall(matches: any[]): void;
|
85 | protected prepareMatches(options: any[]): void;
|
86 | protected hasMatches(): boolean;
|
87 | }
|