UNPKG

4.3 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 { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit, QueryList, Renderer2 } from '@angular/core';
7import { Subject } from 'rxjs';
8import { NbLayoutDirectionService } from '../../services/direction.service';
9import { NbStatusService } from '../../services/status.service';
10import { NbFocusMonitor } from '../cdk/a11y/a11y.module';
11import { NbActiveDescendantKeyManager, NbActiveDescendantKeyManagerFactoryService } from '../cdk/a11y/descendant-key-manager';
12import { NbBooleanInput } from '../helpers';
13import { NbComponentSize } from '../component-size';
14import { NbAutocompleteDirective } from '../autocomplete/autocomplete.directive';
15import { NbTagComponent } from './tag.component';
16import { NbTagInputDirective } from './tag-input.directive';
17/**
18 *
19 * `nb-tag-list` component displays a list of `nb-tag` components.
20 *
21 * @stacked-example(Tag List Showcase, tag/tag-showcase.component)
22 *
23 * @styles
24 *
25 * tag-list-tiny-tag-offset:
26 * tag-list-small-tag-offset:
27 * tag-list-medium-tag-offset:
28 * tag-list-large-tag-offset:
29 * tag-list-giant-tag-offset:
30 * tag-list-with-input-tiny-padding:
31 * tag-list-with-input-small-padding:
32 * tag-list-with-input-medium-padding:
33 * tag-list-with-input-large-padding:
34 * tag-list-with-input-giant-padding:
35 * tag-list-with-input-rectangle-border-radius:
36 * tag-list-with-input-semi-round-border-radius:
37 * tag-list-with-input-round-border-radius:
38 */
39export declare class NbTagListComponent implements OnInit, AfterContentInit, AfterViewInit, OnDestroy {
40 protected hostElement: ElementRef<HTMLElement>;
41 protected cd: ChangeDetectorRef;
42 protected renderer: Renderer2;
43 protected zone: NgZone;
44 protected focusMonitor: NbFocusMonitor;
45 protected activeDescendantKeyManagerFactory: NbActiveDescendantKeyManagerFactoryService<NbTagComponent>;
46 protected directionService: NbLayoutDirectionService;
47 protected statusService: NbStatusService;
48 protected readonly destroy$: Subject<void>;
49 protected readonly keyDown$: Subject<KeyboardEvent>;
50 protected readonly tagClick$: Subject<NbTagComponent>;
51 protected focused: boolean;
52 protected keyManager: NbActiveDescendantKeyManager<NbTagComponent>;
53 tags: QueryList<NbTagComponent>;
54 tagInput: NbTagInputDirective;
55 autocompleteDirective: NbAutocompleteDirective<any>;
56 /**
57 * Controls tags offset.
58 */
59 size: NbComponentSize;
60 tabIndex: number;
61 role: string;
62 get multiple(): boolean;
63 set multiple(value: boolean);
64 protected _multiple: boolean;
65 static ngAcceptInputType_multiple: NbBooleanInput;
66 activeTagId: string | null;
67 /**
68 * Emits when tag need to be removed (whether because of click on the remove button
69 * or when `delete` or `backspace` key pressed).
70 */
71 readonly tagRemove: EventEmitter<NbTagComponent>;
72 get _hasInput(): boolean;
73 get _isFocused(): boolean;
74 get _isFullWidth(): boolean;
75 get _inputClasses(): string[];
76 _onKeydown(event: KeyboardEvent): void;
77 _onClick({ target }: MouseEvent): void;
78 constructor(hostElement: ElementRef<HTMLElement>, cd: ChangeDetectorRef, renderer: Renderer2, zone: NgZone, focusMonitor: NbFocusMonitor, activeDescendantKeyManagerFactory: NbActiveDescendantKeyManagerFactoryService<NbTagComponent>, directionService: NbLayoutDirectionService, statusService: NbStatusService);
79 ngOnInit(): void;
80 ngAfterContentInit(): void;
81 ngAfterViewInit(): void;
82 ngOnDestroy(): void;
83 protected initKeyManager(): void;
84 protected listenToLayoutDirectionChange(): void;
85 protected listenListKeyDown(): void;
86 protected listenInputKeyDown(): void;
87 protected listenTagClick(): void;
88 protected listenTagRemove(): void;
89 protected listenTagDestroy(): void;
90 protected listenNoTags(): void;
91 protected listenActiveTagChange(): void;
92 protected onFocusChange(isFocused: boolean): void;
93 protected isBackspaceOrDelete(keyCode: number): boolean;
94 protected setAutocompleteCustomHost(): void;
95 protected toggleTag(tagToToggle: NbTagComponent): void;
96 protected focusInput(): void;
97}