UNPKG

9.29 kBTypeScriptView Raw
1import { AfterContentInit, DestroyRef, EventEmitter, OnChanges, OnInit, QueryList, SimpleChanges, TemplateRef } from '@angular/core';
2import { Subject } from 'rxjs';
3import * as i0 from "@angular/core";
4/**
5 * Context passed to the nav content template.
6 *
7 * See [this demo](#/components/nav/examples#keep-content) as the example.
8 *
9 * @since 5.2.0
10 */
11export interface NgbNavContentContext {
12 /**
13 * If `true`, current nav content is visible and active
14 */
15 $implicit: boolean;
16}
17/**
18 * This directive must be used to wrap content to be displayed in the nav.
19 *
20 * @since 5.2.0
21 */
22export declare class NgbNavContent {
23 templateRef: TemplateRef<any>;
24 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavContent, never>;
25 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavContent, "ng-template[ngbNavContent]", never, {}, {}, never, never, true, never>;
26}
27/**
28 * This directive applies a specific role on a non-container based ngbNavItem.
29 *
30 * @since 14.1.0
31 */
32export declare class NgbNavItemRole {
33 role: string;
34 nav: NgbNav;
35 constructor(role: string);
36 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavItemRole, [{ attribute: "role"; }]>;
37 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavItemRole, "[ngbNavItem]:not(ng-container)", never, {}, {}, never, never, true, never>;
38}
39/**
40 * The directive used to group nav link and related nav content. As well as set nav identifier and some options.
41 *
42 * @since 5.2.0
43 */
44export declare class NgbNavItem implements OnInit {
45 private _nav;
46 private _nativeElement;
47 /**
48 * If `true`, non-active current nav item content will be removed from DOM
49 * Otherwise it will just be hidden
50 */
51 destroyOnHide: any;
52 /**
53 * If `true`, the current nav item is disabled and can't be toggled by user.
54 *
55 * Nevertheless disabled nav can be selected programmatically via the `.select()` method and the `[activeId]` binding.
56 */
57 disabled: boolean;
58 /**
59 * The id used for the DOM elements.
60 * Must be unique inside the document in case you have multiple `ngbNav`s on the page.
61 *
62 * Autogenerated as `ngb-nav-XXX` if not provided.
63 */
64 domId: string;
65 /**
66 * The id used as a model for active nav.
67 * It can be anything, but must be unique inside one `ngbNav`.
68 *
69 * The only limitation is that it is not possible to have the `''` (empty string) as id,
70 * because ` ngbNavItem `, `ngbNavItem=''` and `[ngbNavItem]="''"` are indistinguishable
71 */
72 _id: any;
73 /**
74 * An event emitted when the fade in transition is finished on the related nav content
75 *
76 * @since 8.0.0
77 */
78 shown: EventEmitter<void>;
79 /**
80 * An event emitted when the fade out transition is finished on the related nav content
81 *
82 * @since 8.0.0
83 */
84 hidden: EventEmitter<void>;
85 contentTpl?: NgbNavContent;
86 ngOnInit(): void;
87 get active(): boolean;
88 get id(): any;
89 get panelDomId(): string;
90 isPanelInDom(): boolean;
91 /**
92 * @internal
93 */
94 isNgContainer(): boolean;
95 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavItem, never>;
96 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavItem, "[ngbNavItem]", ["ngbNavItem"], { "destroyOnHide": { "alias": "destroyOnHide"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "domId": { "alias": "domId"; "required": false; }; "_id": { "alias": "ngbNavItem"; "required": false; }; }, { "shown": "shown"; "hidden": "hidden"; }, ["contentTpl"], never, true, never>;
97}
98/**
99 * A nav directive that helps with implementing tabbed navigation components.
100 *
101 * @since 5.2.0
102 */
103export declare class NgbNav implements AfterContentInit, OnChanges {
104 role: string;
105 static ngAcceptInputType_orientation: string;
106 static ngAcceptInputType_roles: boolean | string;
107 private _config;
108 private _cd;
109 private _document;
110 private _nativeElement;
111 destroyRef: DestroyRef;
112 _navigatingWithKeyboard: boolean;
113 /**
114 * The id of the nav that should be active
115 *
116 * You could also use the `.select()` method and the `(navChange)` event
117 */
118 activeId: any;
119 /**
120 * The event emitted after the active nav changes
121 * The payload of the event is the newly active nav id
122 *
123 * If you want to prevent nav change, you should use `(navChange)` event
124 */
125 activeIdChange: EventEmitter<any>;
126 /**
127 * If `true`, nav change will be animated.
128 *
129 * @since 8.0.0
130 */
131 animation: boolean;
132 /**
133 * If `true`, non-active nav content will be removed from DOM
134 * Otherwise it will just be hidden
135 */
136 destroyOnHide: boolean;
137 /**
138 * The orientation of navs.
139 *
140 * Using `vertical` will also add the `aria-orientation` attribute
141 */
142 orientation: "horizontal" | "vertical";
143 /**
144 * Role attribute generating strategy:
145 * - `false` - no role attributes will be generated
146 * - `'tablist'` - 'tablist', 'tab' and 'tabpanel' will be generated (default)
147 */
148 roles: false | "tablist";
149 /**
150 * Keyboard support for nav focus/selection using arrow keys.
151 *
152 * * `true` - navs will be focused using keyboard arrow keys
153 * * `false` - no keyboard support
154 * * `'changeWithArrows'` - nav will be selected using keyboard arrow keys
155 *
156 * See the [list of available keyboard shortcuts](#/components/nav/overview#keyboard-shortcuts).
157 *
158 * @since 6.1.0
159 */
160 keyboard: boolean | "changeWithArrows";
161 /**
162 * An event emitted when the fade in transition is finished for one of the items.
163 *
164 * Payload of the event is the nav id that was just shown.
165 *
166 * @since 8.0.0
167 */
168 shown: EventEmitter<any>;
169 /**
170 * An event emitted when the fade out transition is finished for one of the items.
171 *
172 * Payload of the event is the nav id that was just hidden.
173 *
174 * @since 8.0.0
175 */
176 hidden: EventEmitter<any>;
177 items: QueryList<NgbNavItem>;
178 links: QueryList<NgbNavLinkBase>;
179 navItemChange$: Subject<NgbNavItem | null>;
180 constructor(role: string);
181 /**
182 * The nav change event emitted right before the nav change happens on user click.
183 *
184 * This event won't be emitted if nav is changed programmatically via `[activeId]` or `.select()`.
185 *
186 * See [`NgbNavChangeEvent`](#/components/nav/api#NgbNavChangeEvent) for payload details.
187 */
188 navChange: EventEmitter<NgbNavChangeEvent<any>>;
189 click(item: NgbNavItem): void;
190 onFocusout({ relatedTarget }: FocusEvent): void;
191 onKeyDown(event: KeyboardEvent): void;
192 /**
193 * Selects the nav with the given id and shows its associated pane.
194 * Any other nav that was previously selected becomes unselected and its associated pane is hidden.
195 */
196 select(id: any): void;
197 ngAfterContentInit(): void;
198 ngOnChanges({ activeId }: SimpleChanges): void;
199 private _updateActiveId;
200 private _notifyItemChanged;
201 private _getItemById;
202 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNav, [{ attribute: "role"; }]>;
203 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNav, "[ngbNav]", ["ngbNav"], { "activeId": { "alias": "activeId"; "required": false; }; "animation": { "alias": "animation"; "required": false; }; "destroyOnHide": { "alias": "destroyOnHide"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "roles": { "alias": "roles"; "required": false; }; "keyboard": { "alias": "keyboard"; "required": false; }; }, { "activeIdChange": "activeIdChange"; "shown": "shown"; "hidden": "hidden"; "navChange": "navChange"; }, ["items", "links"], never, true, never>;
204}
205export declare class NgbNavLinkBase {
206 role: string;
207 navItem: NgbNavItem;
208 nav: NgbNav;
209 nativeElement: HTMLElement;
210 constructor(role: string);
211 get tabindex(): -1 | undefined;
212 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavLinkBase, [{ attribute: "role"; }]>;
213 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavLinkBase, "[ngbNavLink]", never, {}, {}, never, never, true, never>;
214}
215/**
216 * A directive to mark the nav link when used on a button element.
217 */
218export declare class NgbNavLinkButton extends NgbNavLinkBase {
219 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavLinkButton, never>;
220 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavLinkButton, "button[ngbNavLink]", never, {}, {}, never, never, true, never>;
221}
222/**
223 * A directive to mark the nav link when used on a link element.
224 *
225 * @since 5.2.0
226 */
227export declare class NgbNavLink extends NgbNavLinkBase {
228 static ɵfac: i0.ɵɵFactoryDeclaration<NgbNavLink, never>;
229 static ɵdir: i0.ɵɵDirectiveDeclaration<NgbNavLink, "a[ngbNavLink]", never, {}, {}, never, never, true, never>;
230}
231/**
232 * The payload of the change event emitted right before the nav change happens on user click.
233 *
234 * This event won't be emitted if nav is changed programmatically via `[activeId]` or `.select()`.
235 *
236 * @since 5.2.0
237 */
238export interface NgbNavChangeEvent<T = any> {
239 /**
240 * Id of the currently active nav.
241 */
242 activeId: T;
243 /**
244 * Id of the newly selected nav.
245 */
246 nextId: T;
247 /**
248 * Function that will prevent nav change if called.
249 */
250 preventDefault: () => void;
251}