UNPKG

3.61 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Akveo. All Rights Reserved.
4 * Licensed under the MIT License. See License.txt in the project root for license information.
5 */
6import { ChangeDetectorRef, ElementRef, EventEmitter, QueryList, AfterContentInit, OnDestroy } from '@angular/core';
7import { NgClass } from '@angular/common';
8import { Subject } from 'rxjs';
9import { NbComponentSize } from '../component-size';
10import { NbPosition } from '../cdk/overlay/overlay-position';
11import { NbOptionComponent } from '../option/option.component';
12import { NbPortalDirective } from '../cdk/overlay/mapping';
13import * as i0 from "@angular/core";
14/**
15 * The `NbAutocompleteComponent` overlay component.
16 * Provides an `NbOptionList` overlay component.
17 * */
18export declare class NbAutocompleteComponent<T> implements AfterContentInit, OnDestroy {
19 protected cd: ChangeDetectorRef;
20 protected destroy$: Subject<void>;
21 /**
22 * HTML input reference to which autocomplete connected.
23 * */
24 hostRef: ElementRef;
25 /**
26 * Component scoped id for aria attributes.
27 * */
28 id: string;
29 /**
30 * @docs-private
31 * Current overlay position because of we have to toggle overlayPosition
32 * in [ngClass] direction.
33 */
34 _overlayPosition: NbPosition;
35 get overlayPosition(): NbPosition;
36 set overlayPosition(value: NbPosition);
37 /**
38 * Returns width of the input.
39 * */
40 get hostWidth(): number;
41 /**
42 * Function passed as input to process each string option value before render.
43 * */
44 handleDisplayFn: (value: any) => string;
45 /**
46 * Autocomplete size, available sizes:
47 * `tiny`, `small`, `medium` (default), `large`, `giant`
48 */
49 size: NbComponentSize;
50 /**
51 * Flag passed as input to always make first option active.
52 * */
53 activeFirst: boolean;
54 /**
55 * Specifies class to be set on `nb-option`s container (`nb-option-list`)
56 * */
57 optionsListClass: NgClass['ngClass'];
58 /**
59 * Specifies class for the overlay panel with options
60 * */
61 optionsPanelClass: string | string[];
62 /**
63 * Specifies width (in pixels) to be set on `nb-option`s container (`nb-option-list`)
64 * */
65 get optionsWidth(): number;
66 set optionsWidth(value: number);
67 protected _optionsWidth: number | undefined;
68 /**
69 * Will be emitted when selected value changes.
70 * */
71 selectedChange: EventEmitter<T>;
72 /**
73 * List of `NbOptionComponent`'s components passed as content.
74 * */
75 options: QueryList<NbOptionComponent<T>>;
76 /**
77 * NbOptionList with options content.
78 * */
79 portal: NbPortalDirective;
80 constructor(cd: ChangeDetectorRef);
81 ngAfterContentInit(): void;
82 ngOnDestroy(): void;
83 /**
84 * Autocomplete knows nothing about host html input element.
85 * So, attach method set input hostRef for styling.
86 * */
87 setHost(hostRef: ElementRef): void;
88 /**
89 * Propagate selected value.
90 * */
91 emitSelected(selected: T): void;
92 get tiny(): boolean;
93 get small(): boolean;
94 get medium(): boolean;
95 get large(): boolean;
96 get giant(): boolean;
97 static ɵfac: i0.ɵɵFactoryDeclaration<NbAutocompleteComponent<any>, never>;
98 static ɵcmp: i0.ɵɵComponentDeclaration<NbAutocompleteComponent<any>, "nb-autocomplete", never, { "handleDisplayFn": "handleDisplayFn"; "size": "size"; "activeFirst": "activeFirst"; "optionsListClass": "optionsListClass"; "optionsPanelClass": "optionsPanelClass"; "optionsWidth": "optionsWidth"; }, { "selectedChange": "selectedChange"; }, ["options"], ["nb-option, nb-option-group"]>;
99}