UNPKG

2.6 kBTypeScriptView Raw
1import { EventEmitter, OnInit, TemplateRef } from '@angular/core';
2import { toString } from '../util/util';
3import * as i0 from "@angular/core";
4/**
5 * The context for the typeahead result template in case you want to override the default one.
6 */
7export interface ResultTemplateContext {
8 /**
9 * Your typeahead result item.
10 */
11 result: any;
12 /**
13 * Search term from the `<input>` used to get current result.
14 */
15 term: string;
16 /**
17 * The function which transforms the result into a string
18 */
19 formatter: (result: any) => string;
20}
21export declare class NgbTypeaheadWindow implements OnInit {
22 activeIdx: number;
23 /**
24 * The id for the typeahead window. The id should be unique and the same
25 * as the associated typeahead's id.
26 */
27 id: string;
28 /**
29 * Flag indicating if the first row should be active initially
30 */
31 focusFirst: boolean;
32 /**
33 * Typeahead match results to be displayed
34 */
35 results: any;
36 /**
37 * Search term used to get current results
38 */
39 term: string;
40 /**
41 * A function used to format a given result before display. This function should return a formatted string without any
42 * HTML markup
43 */
44 formatter: typeof toString;
45 /**
46 * A template to override a matching result default display
47 */
48 resultTemplate: TemplateRef<ResultTemplateContext>;
49 /**
50 * A custom class to append to the typeahead window
51 *
52 * @since 9.1.0
53 */
54 popupClass: string;
55 /**
56 * Event raised when user selects a particular result row
57 */
58 selectEvent: EventEmitter<any>;
59 activeChangeEvent: EventEmitter<any>;
60 hasActive(): boolean;
61 getActive(): any;
62 markActive(activeIdx: number): void;
63 next(): void;
64 prev(): void;
65 resetActive(): void;
66 select(item: any): void;
67 ngOnInit(): void;
68 private _activeChanged;
69 static ɵfac: i0.ɵɵFactoryDeclaration<NgbTypeaheadWindow, never>;
70 static ɵcmp: i0.ɵɵComponentDeclaration<NgbTypeaheadWindow, "ngb-typeahead-window", ["ngbTypeaheadWindow"], { "id": { "alias": "id"; "required": false; }; "focusFirst": { "alias": "focusFirst"; "required": false; }; "results": { "alias": "results"; "required": false; }; "term": { "alias": "term"; "required": false; }; "formatter": { "alias": "formatter"; "required": false; }; "resultTemplate": { "alias": "resultTemplate"; "required": false; }; "popupClass": { "alias": "popupClass"; "required": false; }; }, { "selectEvent": "select"; "activeChangeEvent": "activeChange"; }, never, never, true, never>;
71}