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 | */
|
6 | import { EventEmitter, OnInit, OnDestroy, AfterViewInit, DoCheck } from '@angular/core';
|
7 | import { Router } from '@angular/router';
|
8 | import { Subject } from 'rxjs';
|
9 | import { NbMenuInternalService, NbMenuItem, NbMenuService, NbMenuBadgeConfig } from './menu.service';
|
10 | import { NbBooleanInput } from '../helpers';
|
11 | import { NbLayoutDirectionService } from '../../services/direction.service';
|
12 | import * as i0 from "@angular/core";
|
13 | export declare enum NbToggleStates {
|
14 | Expanded = "expanded",
|
15 | Collapsed = "collapsed"
|
16 | }
|
17 | export declare class NbMenuItemComponent implements DoCheck, AfterViewInit, OnDestroy {
|
18 | protected menuService: NbMenuService;
|
19 | protected directionService: NbLayoutDirectionService;
|
20 | menuItem: NbMenuItem;
|
21 | badge: NbMenuBadgeConfig;
|
22 | hoverItem: EventEmitter<any>;
|
23 | toggleSubMenu: EventEmitter<any>;
|
24 | selectItem: EventEmitter<any>;
|
25 | itemClick: EventEmitter<any>;
|
26 | protected destroy$: Subject<void>;
|
27 | toggleState: NbToggleStates;
|
28 | constructor(menuService: NbMenuService, directionService: NbLayoutDirectionService);
|
29 | ngDoCheck(): void;
|
30 | ngAfterViewInit(): void;
|
31 | ngOnDestroy(): void;
|
32 | onToggleSubMenu(item: NbMenuItem): void;
|
33 | onHoverItem(item: NbMenuItem): void;
|
34 | onSelectItem(item: NbMenuItem): void;
|
35 | onItemClick(item: NbMenuItem): void;
|
36 | getExpandStateIcon(): string;
|
37 | static ɵfac: i0.ɵɵFactoryDeclaration<NbMenuItemComponent, never>;
|
38 | static ɵcmp: i0.ɵɵComponentDeclaration<NbMenuItemComponent, "[nbMenuItem]", never, { "menuItem": { "alias": "menuItem"; "required": false; }; "badge": { "alias": "badge"; "required": false; }; }, { "hoverItem": "hoverItem"; "toggleSubMenu": "toggleSubMenu"; "selectItem": "selectItem"; "itemClick": "itemClick"; }, never, never, false, never>;
|
39 | }
|
40 | /**
|
41 | * Vertical menu component.
|
42 | *
|
43 | * Accepts a list of menu items and renders them accordingly. Supports multi-level menus.
|
44 | *
|
45 | * Basic example
|
46 | * @stacked-example(Showcase, menu/menu-showcase.component)
|
47 | *
|
48 | * ```ts
|
49 | * // ...
|
50 | * items: NbMenuItem[] = [
|
51 | * {
|
52 | * title: home,
|
53 | * link: '/'
|
54 | * },
|
55 | * {
|
56 | * title: dashboard,
|
57 | * link: 'dashboard'
|
58 | * }
|
59 | * ];
|
60 | * // ...
|
61 | * <nb-menu [items]="items"></nb-menu>
|
62 | * ```
|
63 | * ### Installation
|
64 | *
|
65 | * Import `NbMenuModule.forRoot()` to your app module.
|
66 | * ```ts
|
67 | * @NgModule({
|
68 | * imports: [
|
69 | * // ...
|
70 | * NbMenuModule.forRoot(),
|
71 | * ],
|
72 | * })
|
73 | * export class AppModule { }
|
74 | * ```
|
75 | * and `NbMenuModule` to your feature module where the component should be shown:
|
76 | * ```ts
|
77 | * @NgModule({
|
78 | * imports: [
|
79 | * // ...
|
80 | * NbMenuModule,
|
81 | * ],
|
82 | * })
|
83 | * export class PageModule { }
|
84 | * ```
|
85 | * ### Usage
|
86 | *
|
87 | * Two-level menu example
|
88 | * @stacked-example(Two Levels, menu/menu-children.component)
|
89 | *
|
90 | *
|
91 | * Autocollapse menu example
|
92 | * @stacked-example(Autocollapse Menu, menu/menu-autocollapse.component)
|
93 | *
|
94 | * Menu badge
|
95 | * @stacked-example(Menu item badge, menu/menu-badge.component)
|
96 | *
|
97 | * @styles
|
98 | *
|
99 | * menu-background-color:
|
100 | * menu-text-color:
|
101 | * menu-text-font-family:
|
102 | * menu-text-font-size:
|
103 | * menu-text-font-weight:
|
104 | * menu-text-line-height:
|
105 | * menu-group-text-color:
|
106 | * menu-item-border-radius:
|
107 | * menu-item-padding:
|
108 | * menu-item-hover-background-color:
|
109 | * menu-item-hover-cursor:
|
110 | * menu-item-hover-text-color:
|
111 | * menu-item-icon-hover-color:
|
112 | * menu-item-active-background-color:
|
113 | * menu-item-active-text-color:
|
114 | * menu-item-icon-active-color:
|
115 | * menu-item-icon-color:
|
116 | * menu-item-icon-margin:
|
117 | * menu-item-icon-width:
|
118 | * menu-item-divider-color:
|
119 | * menu-item-divider-style:
|
120 | * menu-item-divider-width:
|
121 | * menu-submenu-background-color:
|
122 | * menu-submenu-text-color:
|
123 | * menu-submenu-margin:
|
124 | * menu-submenu-padding:
|
125 | * menu-submenu-item-border-color:
|
126 | * menu-submenu-item-border-style:
|
127 | * menu-submenu-item-border-width:
|
128 | * menu-submenu-item-border-radius:
|
129 | * menu-submenu-item-padding:
|
130 | * menu-submenu-item-hover-background-color:
|
131 | * menu-submenu-item-hover-border-color:
|
132 | * menu-submenu-item-hover-text-color:
|
133 | * menu-submenu-item-icon-hover-color:
|
134 | * menu-submenu-item-active-background-color:
|
135 | * menu-submenu-item-active-border-color:
|
136 | * menu-submenu-item-active-text-color:
|
137 | * menu-submenu-item-icon-active-color:
|
138 | * menu-submenu-item-active-hover-background-color:
|
139 | * menu-submenu-item-active-hover-border-color:
|
140 | * menu-submenu-item-active-hover-text-color:
|
141 | * menu-submenu-item-icon-active-hover-color:
|
142 | */
|
143 | export declare class NbMenuComponent implements OnInit, AfterViewInit, OnDestroy {
|
144 | protected window: any;
|
145 | protected platformId: any;
|
146 | protected menuInternalService: NbMenuInternalService;
|
147 | protected router: Router;
|
148 | /**
|
149 | * Tags a menu with some ID, can be later used in the menu service
|
150 | * to determine which menu triggered the action, if multiple menus exist on the page.
|
151 | *
|
152 | * @type {string}
|
153 | */
|
154 | tag: string;
|
155 | /**
|
156 | * List of menu items.
|
157 | * @type List<NbMenuItem> | List<any> | any
|
158 | */
|
159 | items: NbMenuItem[];
|
160 | /**
|
161 | * Collapse all opened submenus on the toggle event
|
162 | * Default value is "false"
|
163 | * @type boolean
|
164 | */
|
165 | get autoCollapse(): boolean;
|
166 | set autoCollapse(value: boolean);
|
167 | protected _autoCollapse: boolean;
|
168 | static ngAcceptInputType_autoCollapse: NbBooleanInput;
|
169 | protected destroy$: Subject<void>;
|
170 | constructor(window: any, platformId: any, menuInternalService: NbMenuInternalService, router: Router);
|
171 | ngOnInit(): void;
|
172 | ngAfterViewInit(): void;
|
173 | onAddItem(data: {
|
174 | tag: string;
|
175 | items: NbMenuItem[];
|
176 | }): void;
|
177 | onHoverItem(item: NbMenuItem): void;
|
178 | onToggleSubMenu(item: NbMenuItem): void;
|
179 | onSelectItem(item: NbMenuItem): void;
|
180 | onItemClick(item: NbMenuItem): void;
|
181 | ngOnDestroy(): void;
|
182 | protected navigateHome(): void;
|
183 | protected collapseAll(): void;
|
184 | protected getHomeItem(items: NbMenuItem[]): NbMenuItem;
|
185 | protected compareTag(tag: string): boolean;
|
186 | protected getSelectedItem(items: NbMenuItem[]): NbMenuItem;
|
187 | static ɵfac: i0.ɵɵFactoryDeclaration<NbMenuComponent, never>;
|
188 | static ɵcmp: i0.ɵɵComponentDeclaration<NbMenuComponent, "nb-menu", never, { "tag": { "alias": "tag"; "required": false; }; "items": { "alias": "items"; "required": false; }; "autoCollapse": { "alias": "autoCollapse"; "required": false; }; }, {}, never, never, false, never>;
|
189 | }
|