ngx-material-navigation 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +97 -0
- package/LICENSE.md +21 -0
- package/README.md +119 -0
- package/components/footer/footer.component.d.ts +13 -0
- package/components/footer/footer.module.d.ts +8 -0
- package/components/navbar/nav-element/nav-element.component.d.ts +35 -0
- package/components/navbar/nav-element/nav-element.module.d.ts +13 -0
- package/components/navbar/nav-menu/nav-menu.component.d.ts +42 -0
- package/components/navbar/nav-menu/nav-menu.module.d.ts +11 -0
- package/components/navbar/navbar.component.d.ts +53 -0
- package/components/navbar/navbar.module.d.ts +11 -0
- package/esm2020/components/footer/footer.component.mjs +17 -0
- package/esm2020/components/footer/footer.module.mjs +22 -0
- package/esm2020/components/navbar/nav-element/nav-element.component.mjs +51 -0
- package/esm2020/components/navbar/nav-element/nav-element.module.mjs +42 -0
- package/esm2020/components/navbar/nav-menu/nav-menu.component.mjs +71 -0
- package/esm2020/components/navbar/nav-menu/nav-menu.module.mjs +34 -0
- package/esm2020/components/navbar/navbar.component.mjs +97 -0
- package/esm2020/components/navbar/navbar.module.mjs +34 -0
- package/esm2020/models/nav-button.model.mjs +2 -0
- package/esm2020/models/nav-image.model.mjs +2 -0
- package/esm2020/models/nav-link.model.mjs +8 -0
- package/esm2020/models/nav-menu.model.mjs +2 -0
- package/esm2020/models/nav-title.model.mjs +2 -0
- package/esm2020/models/nav.model.mjs +4 -0
- package/esm2020/models/navbar.model.mjs +2 -0
- package/esm2020/ngx-material-navigation.mjs +5 -0
- package/esm2020/public-api.mjs +16 -0
- package/esm2020/utilities/nav.utilities.mjs +198 -0
- package/fesm2015/ngx-material-navigation.mjs +551 -0
- package/fesm2015/ngx-material-navigation.mjs.map +1 -0
- package/fesm2020/ngx-material-navigation.mjs +551 -0
- package/fesm2020/ngx-material-navigation.mjs.map +1 -0
- package/models/nav-button.model.d.ts +11 -0
- package/models/nav-image.model.d.ts +40 -0
- package/models/nav-link.model.d.ts +39 -0
- package/models/nav-menu.model.d.ts +28 -0
- package/models/nav-title.model.d.ts +52 -0
- package/models/nav.model.d.ts +23 -0
- package/models/navbar.model.d.ts +11 -0
- package/ngx-material-navigation.d.ts +5 -0
- package/package.json +39 -0
- package/public-api.d.ts +12 -0
- package/utilities/nav.utilities.d.ts +81 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ViewChild, Input, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/platform-browser';
|
|
4
|
+
import * as i2$1 from '@angular/material/toolbar';
|
|
5
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
6
|
+
import * as i1 from '@angular/material/menu';
|
|
7
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
8
|
+
import * as i2 from '@angular/material/button';
|
|
9
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
+
import * as i3 from '@angular/common';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import * as i4 from '@angular/router';
|
|
13
|
+
import { RouterModule } from '@angular/router';
|
|
14
|
+
import * as i4$1 from '@angular/material/sidenav';
|
|
15
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
18
|
+
class BaseNavElement {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The base abstract definition for internal and external links.
|
|
23
|
+
*/
|
|
24
|
+
class NavLink extends BaseNavElement {
|
|
25
|
+
}
|
|
26
|
+
;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Contains HelperMethods around handling Navigation.
|
|
30
|
+
*/
|
|
31
|
+
class NavUtilities {
|
|
32
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
33
|
+
static asTitle(element) {
|
|
34
|
+
return element;
|
|
35
|
+
}
|
|
36
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
37
|
+
static asAngularRoute(route) {
|
|
38
|
+
return route;
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
41
|
+
static asStringRoute(route) {
|
|
42
|
+
return route;
|
|
43
|
+
}
|
|
44
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
45
|
+
static asInternalLink(element) {
|
|
46
|
+
return element;
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
49
|
+
static asExternalLink(element) {
|
|
50
|
+
return element;
|
|
51
|
+
}
|
|
52
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
53
|
+
static asMenu(element) {
|
|
54
|
+
return element;
|
|
55
|
+
}
|
|
56
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
57
|
+
static asButton(element) {
|
|
58
|
+
return element;
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
61
|
+
static asImage(element) {
|
|
62
|
+
return element;
|
|
63
|
+
}
|
|
64
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
65
|
+
static asImageWithInternalLink(element) {
|
|
66
|
+
return element;
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
69
|
+
static asImageWithExternalLink(element) {
|
|
70
|
+
return element;
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
73
|
+
static asTitleWithInternalLink(element) {
|
|
74
|
+
return element;
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
77
|
+
static asTitleWithExternalLink(element) {
|
|
78
|
+
return element;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Checks if the provided element is a NavInternalLink.
|
|
82
|
+
*
|
|
83
|
+
* @param element - The element to check.
|
|
84
|
+
* @returns Whether or not the given element is a NavInternalLink.
|
|
85
|
+
*/
|
|
86
|
+
static isInternalLink(element) {
|
|
87
|
+
if (element.route) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Checks if the provided element is a NavMenu.
|
|
94
|
+
*
|
|
95
|
+
* @param element - The element to check.
|
|
96
|
+
* @returns Whether or not the given element is a NavMenu.
|
|
97
|
+
*/
|
|
98
|
+
static isMenu(element) {
|
|
99
|
+
if (element.elements) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Checks if the provided value is an angular route.
|
|
106
|
+
*
|
|
107
|
+
* @param route - The value to check.
|
|
108
|
+
* @returns Whether or not the given value is an angular route.
|
|
109
|
+
*/
|
|
110
|
+
static isAngularRoute(route) {
|
|
111
|
+
if (route.path) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Checks if the provided element is a NavElement.
|
|
118
|
+
*
|
|
119
|
+
* @param value - The element to check.
|
|
120
|
+
* @returns Whether or not the given element is a NavElement.
|
|
121
|
+
*/
|
|
122
|
+
static isNavElement(value) {
|
|
123
|
+
if (value.type) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Gets the angular routes.
|
|
130
|
+
* Extracts them from the navbarRows and adds any additional routes provided in additionalRoutes.
|
|
131
|
+
*
|
|
132
|
+
* @param navbarRows - The NavbarRows used as a configuration for the navbar element.
|
|
133
|
+
* @param additionalRoutes - Any additional routes that aren't included in the NavbarRows.
|
|
134
|
+
* @returns All found angular routes.
|
|
135
|
+
*/
|
|
136
|
+
static getAngularRoutes(navbarRows = [], additionalRoutes = []) {
|
|
137
|
+
let allRoutes = [];
|
|
138
|
+
allRoutes = allRoutes.concat(NavUtilities.getRoutesFromNavbar(navbarRows));
|
|
139
|
+
allRoutes = allRoutes.concat(additionalRoutes);
|
|
140
|
+
// Filters to only contain unique paths
|
|
141
|
+
const uniquePaths = [];
|
|
142
|
+
const res = [];
|
|
143
|
+
for (const route of allRoutes) {
|
|
144
|
+
if (!uniquePaths.find(r => r === route.path)) {
|
|
145
|
+
res.push(route);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return res;
|
|
149
|
+
}
|
|
150
|
+
static getRoutesFromNavbar(navbarRows) {
|
|
151
|
+
let res = [];
|
|
152
|
+
for (const row of navbarRows) {
|
|
153
|
+
res = res.concat(NavUtilities.getRoutesFromElements(row.elements));
|
|
154
|
+
}
|
|
155
|
+
;
|
|
156
|
+
return res;
|
|
157
|
+
}
|
|
158
|
+
static getRoutesFromElements(elements) {
|
|
159
|
+
let res = [];
|
|
160
|
+
const internalLinks = elements.filter(e => NavUtilities.isInternalLink(e));
|
|
161
|
+
const angularRoutes = internalLinks.filter(l => NavUtilities.isAngularRoute(l.route)).map(l => l.route);
|
|
162
|
+
res = res.concat(angularRoutes);
|
|
163
|
+
const menus = elements.filter(e => NavUtilities.isMenu(e));
|
|
164
|
+
for (const menu of menus) {
|
|
165
|
+
res = res.concat(NavUtilities.getRoutesFromElements(menu.elements));
|
|
166
|
+
}
|
|
167
|
+
return res;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get all elements at the provided position with the provided screenWidth from the given elements.
|
|
171
|
+
*
|
|
172
|
+
* @param position - The position for which to get the elements.
|
|
173
|
+
* @param screenWidth - The current screen width. Is needed to hide elements that are already collapsed into the sidenav.
|
|
174
|
+
* @param rows - The rows to get the elements from.
|
|
175
|
+
* @returns All Elements for the provided input.
|
|
176
|
+
*/
|
|
177
|
+
static getNavbarElements(position, screenWidth, rows) {
|
|
178
|
+
if (!rows || !rows.length) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
let res = [];
|
|
182
|
+
for (const row of rows) {
|
|
183
|
+
res = res.concat(row.elements);
|
|
184
|
+
}
|
|
185
|
+
if (position === 'left') {
|
|
186
|
+
res = res.filter(e => !e.position || e.position === position);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
res = res.filter(e => e.position === position);
|
|
190
|
+
}
|
|
191
|
+
switch (screenWidth) {
|
|
192
|
+
case 'lg':
|
|
193
|
+
return res.filter(e => e.collapse !== 'always' && e.collapse !== 'lg');
|
|
194
|
+
case 'md':
|
|
195
|
+
return res.filter(e => e.collapse !== 'always' && e.collapse !== 'lg' && e.collapse !== 'md');
|
|
196
|
+
case 'sm':
|
|
197
|
+
return res.filter(e => e.collapse !== 'always' && e.collapse !== 'lg' && e.collapse !== 'md' && e.collapse !== 'sm');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Gets all the elements to display in the sidenav.
|
|
202
|
+
*
|
|
203
|
+
* @param screenWidth - The current screen width.
|
|
204
|
+
* @param rows - The rows to get the elements from.
|
|
205
|
+
* @returns The NavElements to display in the sidenav.
|
|
206
|
+
*/
|
|
207
|
+
static getSidenavElements(screenWidth, rows) {
|
|
208
|
+
if (!rows || !rows.length) {
|
|
209
|
+
return [];
|
|
210
|
+
}
|
|
211
|
+
let res = [];
|
|
212
|
+
for (const row of rows) {
|
|
213
|
+
res = res.concat(row.elements);
|
|
214
|
+
}
|
|
215
|
+
switch (screenWidth) {
|
|
216
|
+
case 'lg':
|
|
217
|
+
return res.filter(e => e.collapse === 'always' || e.collapse === 'lg');
|
|
218
|
+
case 'md':
|
|
219
|
+
return res.filter(e => e.collapse === 'always' || e.collapse === 'lg' || e.collapse === 'md');
|
|
220
|
+
case 'sm':
|
|
221
|
+
return res.filter(e => e.collapse === 'always' || e.collapse === 'lg' || e.collapse === 'md' || e.collapse === 'sm');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Displays a menu based on the provided NavMenu data.
|
|
228
|
+
*/
|
|
229
|
+
class NavMenuComponent {
|
|
230
|
+
constructor() {
|
|
231
|
+
this.NavUtilities = NavUtilities;
|
|
232
|
+
}
|
|
233
|
+
ngAfterContentChecked() {
|
|
234
|
+
if (this.nestedMenuButton) {
|
|
235
|
+
this.nestedMenuWidth = this.getMenuWidth();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Updates the width of the nestedMenu.
|
|
240
|
+
*/
|
|
241
|
+
onResize() {
|
|
242
|
+
if (this.nestedMenuButton) {
|
|
243
|
+
this.nestedMenuWidth = this.getMenuWidth();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
getMenuWidth() {
|
|
247
|
+
return this.nestedMenuButton._elementRef.nativeElement.offsetWidth;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Defines if the sidenav should be closed when the given element is clicked.
|
|
251
|
+
*
|
|
252
|
+
* @param element - The element that has been clicked.
|
|
253
|
+
*/
|
|
254
|
+
clickSidenavElement(element) {
|
|
255
|
+
if (this.sidenav) {
|
|
256
|
+
switch (element.type) {
|
|
257
|
+
case 'image':
|
|
258
|
+
case 'title':
|
|
259
|
+
case 'menu':
|
|
260
|
+
return;
|
|
261
|
+
default:
|
|
262
|
+
this.sidenav.close();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
NavMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
269
|
+
NavMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NavMenuComponent, selector: "ngx-mat-navigation-menu", inputs: { navMenu: "navMenu", sidenav: "sidenav", menuWidth: "menuWidth" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, static: true }, { propertyName: "nestedMenuButton", first: true, predicate: ["nestedMenuButton"], descendants: true }], ngImport: i0, template: "<mat-menu #menu=\"matMenu\" [overlapTrigger]=\"false\">\r\n <div *ngFor=\"let element of navMenu.elements\" [style.min-width.px]=\"menuWidth\">\r\n <div [ngSwitch]=\"element.type\">\r\n <!-- Internal Link -->\r\n <a mat-button *ngSwitchCase=\"'internalLink'\"\r\n (click)=\"clickSidenavElement(element)\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n ? NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asInternalLink(element).route)\"\r\n [target]=\"NavUtilities.asInternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asInternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n >\r\n <i *ngIf=\"NavUtilities.asInternalLink(element).icon\" [class]=\"NavUtilities.asInternalLink(element).icon\"></i> \r\n {{NavUtilities.asInternalLink(element).name}}\r\n </a>\r\n <!-- External Link -->\r\n <span *ngSwitchCase=\"'externalLink'\">\r\n <a mat-button\r\n (click)=\"clickSidenavElement(element)\"\r\n [href]=\"NavUtilities.asExternalLink(element).url\"\r\n [target]=\"NavUtilities.asExternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asExternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n >\r\n <i *ngIf=\"NavUtilities.asExternalLink(element).icon\" [class]=\"NavUtilities.asExternalLink(element).icon\"></i>\r\n {{NavUtilities.asExternalLink(element).name}}\r\n </a>\r\n </span>\r\n <!-- Nested Menu -->\r\n <button #nestedMenuButton id=\"menu-button\" *ngSwitchCase=\"'menu'\" mat-menu-item [matMenuTriggerFor]=\"internalMenu.menu\">\r\n <i *ngIf=\"NavUtilities.asMenu(element).icon\" [class]=\"NavUtilities.asMenu(element).icon\"></i>\r\n {{NavUtilities.asMenu(element).name}}\r\n </button>\r\n <ngx-mat-navigation-menu #internalMenu [navMenu]=\"NavUtilities.asMenu(element)\" [sidenav]=\"sidenav\" [menuWidth]=\"nestedMenuWidth\">\r\n </ngx-mat-navigation-menu>\r\n </div>\r\n </div>\r\n</mat-menu>", styles: ["a{width:100%}\n"], components: [{ type: i1.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i2.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { type: i1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: NavMenuComponent, selector: "ngx-mat-navigation-menu", inputs: ["navMenu", "sidenav", "menuWidth"] }], directives: [{ type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i4.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }] });
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuComponent, decorators: [{
|
|
271
|
+
type: Component,
|
|
272
|
+
args: [{ selector: 'ngx-mat-navigation-menu', template: "<mat-menu #menu=\"matMenu\" [overlapTrigger]=\"false\">\r\n <div *ngFor=\"let element of navMenu.elements\" [style.min-width.px]=\"menuWidth\">\r\n <div [ngSwitch]=\"element.type\">\r\n <!-- Internal Link -->\r\n <a mat-button *ngSwitchCase=\"'internalLink'\"\r\n (click)=\"clickSidenavElement(element)\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n ? NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asInternalLink(element).route)\"\r\n [target]=\"NavUtilities.asInternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asInternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n >\r\n <i *ngIf=\"NavUtilities.asInternalLink(element).icon\" [class]=\"NavUtilities.asInternalLink(element).icon\"></i> \r\n {{NavUtilities.asInternalLink(element).name}}\r\n </a>\r\n <!-- External Link -->\r\n <span *ngSwitchCase=\"'externalLink'\">\r\n <a mat-button\r\n (click)=\"clickSidenavElement(element)\"\r\n [href]=\"NavUtilities.asExternalLink(element).url\"\r\n [target]=\"NavUtilities.asExternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asExternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n >\r\n <i *ngIf=\"NavUtilities.asExternalLink(element).icon\" [class]=\"NavUtilities.asExternalLink(element).icon\"></i>\r\n {{NavUtilities.asExternalLink(element).name}}\r\n </a>\r\n </span>\r\n <!-- Nested Menu -->\r\n <button #nestedMenuButton id=\"menu-button\" *ngSwitchCase=\"'menu'\" mat-menu-item [matMenuTriggerFor]=\"internalMenu.menu\">\r\n <i *ngIf=\"NavUtilities.asMenu(element).icon\" [class]=\"NavUtilities.asMenu(element).icon\"></i>\r\n {{NavUtilities.asMenu(element).name}}\r\n </button>\r\n <ngx-mat-navigation-menu #internalMenu [navMenu]=\"NavUtilities.asMenu(element)\" [sidenav]=\"sidenav\" [menuWidth]=\"nestedMenuWidth\">\r\n </ngx-mat-navigation-menu>\r\n </div>\r\n </div>\r\n</mat-menu>", styles: ["a{width:100%}\n"] }]
|
|
273
|
+
}], propDecorators: { menu: [{
|
|
274
|
+
type: ViewChild,
|
|
275
|
+
args: ['menu', { static: true }]
|
|
276
|
+
}], navMenu: [{
|
|
277
|
+
type: Input
|
|
278
|
+
}], sidenav: [{
|
|
279
|
+
type: Input
|
|
280
|
+
}], menuWidth: [{
|
|
281
|
+
type: Input
|
|
282
|
+
}], nestedMenuButton: [{
|
|
283
|
+
type: ViewChild,
|
|
284
|
+
args: ['nestedMenuButton']
|
|
285
|
+
}], onResize: [{
|
|
286
|
+
type: HostListener,
|
|
287
|
+
args: ['window:resize', ['$event']]
|
|
288
|
+
}] } });
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Displays a single Navigation Element.
|
|
292
|
+
*/
|
|
293
|
+
class NavElementComponent {
|
|
294
|
+
constructor() {
|
|
295
|
+
this.NavUtilities = NavUtilities;
|
|
296
|
+
}
|
|
297
|
+
ngAfterContentChecked() {
|
|
298
|
+
if (this.menuButton) {
|
|
299
|
+
this.menuWidth = this.getMenuWidth();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Updates the width of the menu to the value of its button.
|
|
304
|
+
*/
|
|
305
|
+
onResize() {
|
|
306
|
+
if (this.menuButton) {
|
|
307
|
+
this.menuWidth = this.getMenuWidth();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
getMenuWidth() {
|
|
311
|
+
return this.menuButton._elementRef.nativeElement.offsetWidth;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
NavElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
315
|
+
NavElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NavElementComponent, selector: "ngx-mat-navigation-element", inputs: { element: "element", sidenav: "sidenav", sidenavElement: "sidenavElement" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "menuButton", first: true, predicate: ["menuButton"], descendants: true }], ngImport: i0, template: "<span [ngSwitch]=\"element.type\">\r\n <!-- Title -->\r\n <h1 mat-menu-item disabled *ngSwitchCase=\"'title'\" [class.sidenavElement]=\"sidenavElement\">\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n <!-- Title with internal link -->\r\n <a id=\"title-link\" disableRipple mat-menu-item *ngSwitchCase=\"'titleWithInternalLink'\"\r\n [routerLink]=\" \r\n NavUtilities.asAngularRoute(NavUtilities.asTitleWithInternalLink(element).link.route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asTitleWithInternalLink(element).link.route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asTitleWithInternalLink(element).link.route)\"\r\n [target]=\"NavUtilities.asTitleWithInternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asTitleWithInternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <h1>\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n </a>\r\n <!-- Title with external link -->\r\n <a class=\"title-link\" disableRipple mat-menu-item *ngSwitchCase=\"'titleWithExternalLink'\"\r\n [href]=\"NavUtilities.asTitleWithExternalLink(element).link.url\"\r\n [target]=\"NavUtilities.asTitleWithExternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asTitleWithExternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <h1>\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n </a>\r\n <!-- Image -->\r\n <img mat-menu-item disabled *ngSwitchCase=\"'image'\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n [src]=\"NavUtilities.asImage(element).url\"\r\n >\r\n <!-- Image with internal link -->\r\n <a id=\"image-link\" disableRipple mat-menu-item *ngSwitchCase=\"'imageWithInternalLink'\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asImageWithInternalLink(element).link.route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asImageWithInternalLink(element).link.route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asImageWithInternalLink(element).link.route)\"\r\n [target]=\"NavUtilities.asImageWithInternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asImageWithInternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <img [src]=\"NavUtilities.asImageWithInternalLink(element).url\">\r\n </a>\r\n <!-- Image with external link -->\r\n <a id=\"image-link\" disableRipple mat-menu-item *ngSwitchCase=\"'imageWithExternalLink'\"\r\n [href]=\"NavUtilities.asImageWithExternalLink(element).link.url\"\r\n [target]=\"NavUtilities.asImageWithExternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asImageWithExternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <img [src]=\"NavUtilities.asImageWithExternalLink(element).url\">\r\n </a>\r\n <!-- Button -->\r\n <button *ngSwitchCase=\"'button'\"\r\n mat-raised-button\r\n (click)=\"NavUtilities.asButton(element).action()\"\r\n [class.sidenavElementButton]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asButton(element).icon\" [class]=\"NavUtilities.asButton(element).icon\"></i>\r\n {{NavUtilities.asButton(element).name}}\r\n </button>\r\n <!-- Internal Link -->\r\n <a mat-button *ngSwitchCase=\"'internalLink'\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asInternalLink(element).route)\"\r\n [target]=\"NavUtilities.asInternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asInternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asInternalLink(element).icon\" [class]=\"NavUtilities.asInternalLink(element).icon\"></i> \r\n {{NavUtilities.asInternalLink(element).name}}\r\n </a>\r\n <!-- External Link -->\r\n <span *ngSwitchCase=\"'externalLink'\">\r\n <a mat-button\r\n [href]=\"NavUtilities.asExternalLink(element).url\"\r\n [target]=\"NavUtilities.asExternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asExternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asExternalLink(element).icon\" [class]=\"NavUtilities.asExternalLink(element).icon\"></i>\r\n {{NavUtilities.asExternalLink(element).name}}\r\n </a>\r\n </span>\r\n <!-- Menu -->\r\n <button #menuButton *ngSwitchCase=\"'menu'\" mat-button [matMenuTriggerFor]=\"menu.menu\" [class.sidenavElement]=\"sidenavElement\">\r\n <i *ngIf=\"NavUtilities.asMenu(element).icon\" [class]=\"NavUtilities.asMenu(element).icon\"></i>\r\n {{NavUtilities.asMenu(element).name}}\r\n </button>\r\n <ngx-mat-navigation-menu #menu\r\n [navMenu]=\"NavUtilities.asMenu(element)\"\r\n [sidenav]=\"sidenav\"\r\n [menuWidth]=\"menuWidth\">\r\n </ngx-mat-navigation-menu>\r\n \r\n</span>", styles: ["#title-link{display:flex;align-items:center;justify-content:center;color:inherit}#image-link{display:flex;align-items:center;padding:0}#image-link img{max-height:100%;max-width:100%}#image-link:hover,#title-link:hover{cursor:pointer;background-color:transparent}.sidenavElement{display:inline-block;width:100%;text-align:left}.sidenavElementButton{display:inline-block;width:100%}mat-menu{display:none}.mat-menu-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 48px);border-radius:4px;outline:0;min-height:64px}.mat-menu-panel.ng-animating{pointer-events:none}.cdk-high-contrast-active .mat-menu-panel{outline:solid 1px}.mat-menu-content:not(:empty){padding-top:8px;padding-bottom:8px}.mat-menu-item{-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative}.mat-menu-item::-moz-focus-inner{border:0}.mat-menu-item[disabled]{cursor:default}[dir=rtl] .mat-menu-item{text-align:right}.mat-menu-item .mat-icon{margin-right:16px;vertical-align:middle}.mat-menu-item .mat-icon svg{vertical-align:top}[dir=rtl] .mat-menu-item .mat-icon{margin-left:16px;margin-right:0}.mat-menu-item[disabled]:before{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.cdk-high-contrast-active .mat-menu-item{margin-top:1px}.cdk-high-contrast-active .mat-menu-item.cdk-program-focused,.cdk-high-contrast-active .mat-menu-item.cdk-keyboard-focused,.cdk-high-contrast-active .mat-menu-item-highlighted{outline:dotted 1px}.mat-menu-item-submenu-trigger{padding-right:32px}[dir=rtl] .mat-menu-item-submenu-trigger{padding-right:16px;padding-left:32px}.mat-menu-submenu-icon{position:absolute;top:50%;right:16px;transform:translateY(-50%);width:5px;height:10px;fill:currentColor}[dir=rtl] .mat-menu-submenu-icon{right:auto;left:16px;transform:translateY(-50%) scaleX(-1)}.cdk-high-contrast-active .mat-menu-submenu-icon{fill:CanvasText}button.mat-menu-item{width:100%}.mat-menu-item .mat-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n"], components: [{ type: i1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i2.MatAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { type: NavMenuComponent, selector: "ngx-mat-navigation-menu", inputs: ["navMenu", "sidenav", "menuWidth"] }], directives: [{ type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }] });
|
|
316
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementComponent, decorators: [{
|
|
317
|
+
type: Component,
|
|
318
|
+
args: [{ selector: 'ngx-mat-navigation-element', template: "<span [ngSwitch]=\"element.type\">\r\n <!-- Title -->\r\n <h1 mat-menu-item disabled *ngSwitchCase=\"'title'\" [class.sidenavElement]=\"sidenavElement\">\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n <!-- Title with internal link -->\r\n <a id=\"title-link\" disableRipple mat-menu-item *ngSwitchCase=\"'titleWithInternalLink'\"\r\n [routerLink]=\" \r\n NavUtilities.asAngularRoute(NavUtilities.asTitleWithInternalLink(element).link.route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asTitleWithInternalLink(element).link.route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asTitleWithInternalLink(element).link.route)\"\r\n [target]=\"NavUtilities.asTitleWithInternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asTitleWithInternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <h1>\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n </a>\r\n <!-- Title with external link -->\r\n <a class=\"title-link\" disableRipple mat-menu-item *ngSwitchCase=\"'titleWithExternalLink'\"\r\n [href]=\"NavUtilities.asTitleWithExternalLink(element).link.url\"\r\n [target]=\"NavUtilities.asTitleWithExternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asTitleWithExternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <h1>\r\n <i *ngIf=\"NavUtilities.asTitle(element).icon\" [class]=\"NavUtilities.asTitle(element).icon\"></i>\r\n {{NavUtilities.asTitle(element).title}}\r\n </h1>\r\n </a>\r\n <!-- Image -->\r\n <img mat-menu-item disabled *ngSwitchCase=\"'image'\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n [src]=\"NavUtilities.asImage(element).url\"\r\n >\r\n <!-- Image with internal link -->\r\n <a id=\"image-link\" disableRipple mat-menu-item *ngSwitchCase=\"'imageWithInternalLink'\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asImageWithInternalLink(element).link.route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asImageWithInternalLink(element).link.route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asImageWithInternalLink(element).link.route)\"\r\n [target]=\"NavUtilities.asImageWithInternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asImageWithInternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <img [src]=\"NavUtilities.asImageWithInternalLink(element).url\">\r\n </a>\r\n <!-- Image with external link -->\r\n <a id=\"image-link\" disableRipple mat-menu-item *ngSwitchCase=\"'imageWithExternalLink'\"\r\n [href]=\"NavUtilities.asImageWithExternalLink(element).link.url\"\r\n [target]=\"NavUtilities.asImageWithExternalLink(element).link.openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asImageWithExternalLink(element).link.openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <img [src]=\"NavUtilities.asImageWithExternalLink(element).url\">\r\n </a>\r\n <!-- Button -->\r\n <button *ngSwitchCase=\"'button'\"\r\n mat-raised-button\r\n (click)=\"NavUtilities.asButton(element).action()\"\r\n [class.sidenavElementButton]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asButton(element).icon\" [class]=\"NavUtilities.asButton(element).icon\"></i>\r\n {{NavUtilities.asButton(element).name}}\r\n </button>\r\n <!-- Internal Link -->\r\n <a mat-button *ngSwitchCase=\"'internalLink'\"\r\n [routerLink]=\"\r\n NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path !== undefined\r\n ? NavUtilities.asAngularRoute(NavUtilities.asInternalLink(element).route).path\r\n : NavUtilities.asStringRoute(NavUtilities.asInternalLink(element).route)\"\r\n [target]=\"NavUtilities.asInternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asInternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asInternalLink(element).icon\" [class]=\"NavUtilities.asInternalLink(element).icon\"></i> \r\n {{NavUtilities.asInternalLink(element).name}}\r\n </a>\r\n <!-- External Link -->\r\n <span *ngSwitchCase=\"'externalLink'\">\r\n <a mat-button\r\n [href]=\"NavUtilities.asExternalLink(element).url\"\r\n [target]=\"NavUtilities.asExternalLink(element).openInNewTab ? '_blank' : '_self'\"\r\n [rel]=\"NavUtilities.asExternalLink(element).openInNewTab ? 'noreferrer noopener' : undefined\"\r\n [class.sidenavElement]=\"sidenavElement\"\r\n >\r\n <i *ngIf=\"NavUtilities.asExternalLink(element).icon\" [class]=\"NavUtilities.asExternalLink(element).icon\"></i>\r\n {{NavUtilities.asExternalLink(element).name}}\r\n </a>\r\n </span>\r\n <!-- Menu -->\r\n <button #menuButton *ngSwitchCase=\"'menu'\" mat-button [matMenuTriggerFor]=\"menu.menu\" [class.sidenavElement]=\"sidenavElement\">\r\n <i *ngIf=\"NavUtilities.asMenu(element).icon\" [class]=\"NavUtilities.asMenu(element).icon\"></i>\r\n {{NavUtilities.asMenu(element).name}}\r\n </button>\r\n <ngx-mat-navigation-menu #menu\r\n [navMenu]=\"NavUtilities.asMenu(element)\"\r\n [sidenav]=\"sidenav\"\r\n [menuWidth]=\"menuWidth\">\r\n </ngx-mat-navigation-menu>\r\n \r\n</span>", styles: ["#title-link{display:flex;align-items:center;justify-content:center;color:inherit}#image-link{display:flex;align-items:center;padding:0}#image-link img{max-height:100%;max-width:100%}#image-link:hover,#title-link:hover{cursor:pointer;background-color:transparent}.sidenavElement{display:inline-block;width:100%;text-align:left}.sidenavElementButton{display:inline-block;width:100%}mat-menu{display:none}.mat-menu-panel{min-width:112px;max-width:280px;overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 48px);border-radius:4px;outline:0;min-height:64px}.mat-menu-panel.ng-animating{pointer-events:none}.cdk-high-contrast-active .mat-menu-panel{outline:solid 1px}.mat-menu-content:not(:empty){padding-top:8px;padding-bottom:8px}.mat-menu-item{-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative}.mat-menu-item::-moz-focus-inner{border:0}.mat-menu-item[disabled]{cursor:default}[dir=rtl] .mat-menu-item{text-align:right}.mat-menu-item .mat-icon{margin-right:16px;vertical-align:middle}.mat-menu-item .mat-icon svg{vertical-align:top}[dir=rtl] .mat-menu-item .mat-icon{margin-left:16px;margin-right:0}.mat-menu-item[disabled]:before{display:block;position:absolute;content:\"\";top:0;left:0;bottom:0;right:0}.cdk-high-contrast-active .mat-menu-item{margin-top:1px}.cdk-high-contrast-active .mat-menu-item.cdk-program-focused,.cdk-high-contrast-active .mat-menu-item.cdk-keyboard-focused,.cdk-high-contrast-active .mat-menu-item-highlighted{outline:dotted 1px}.mat-menu-item-submenu-trigger{padding-right:32px}[dir=rtl] .mat-menu-item-submenu-trigger{padding-right:16px;padding-left:32px}.mat-menu-submenu-icon{position:absolute;top:50%;right:16px;transform:translateY(-50%);width:5px;height:10px;fill:currentColor}[dir=rtl] .mat-menu-submenu-icon{right:auto;left:16px;transform:translateY(-50%) scaleX(-1)}.cdk-high-contrast-active .mat-menu-submenu-icon{fill:CanvasText}button.mat-menu-item{width:100%}.mat-menu-item .mat-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n"] }]
|
|
319
|
+
}], propDecorators: { element: [{
|
|
320
|
+
type: Input
|
|
321
|
+
}], sidenav: [{
|
|
322
|
+
type: Input
|
|
323
|
+
}], sidenavElement: [{
|
|
324
|
+
type: Input
|
|
325
|
+
}], menuButton: [{
|
|
326
|
+
type: ViewChild,
|
|
327
|
+
args: ['menuButton']
|
|
328
|
+
}], onResize: [{
|
|
329
|
+
type: HostListener,
|
|
330
|
+
args: ['window:resize', ['$event']]
|
|
331
|
+
}] } });
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* The navbar component.
|
|
335
|
+
* Takes in your configuration and builds a toolbar as well as a sidenav accordingly.
|
|
336
|
+
* Also handles responsiveness.
|
|
337
|
+
*/
|
|
338
|
+
class NavbarComponent {
|
|
339
|
+
constructor(sanitizer) {
|
|
340
|
+
this.sanitizer = sanitizer;
|
|
341
|
+
this.NavUtilities = NavUtilities;
|
|
342
|
+
this.sidenavElements = [];
|
|
343
|
+
this.burgerMenu = {
|
|
344
|
+
type: 'button',
|
|
345
|
+
name: '',
|
|
346
|
+
icon: 'fas fa-bars',
|
|
347
|
+
action: () => this.sidenav.toggle(),
|
|
348
|
+
collapse: 'never'
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
ngOnInit() {
|
|
352
|
+
if (!this.minHeight || typeof this.minHeight !== 'number'
|
|
353
|
+
|| !this.minHeightOtherElements || typeof this.minHeightOtherElements !== 'number') {
|
|
354
|
+
throw new Error('Incorrect input data');
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
this.sanitizedMinHeight = this.sanitizer.bypassSecurityTrustStyle(`calc(100vh - ${this.minHeight + this.minHeightOtherElements}px)`);
|
|
358
|
+
this.screenWidth = window.innerWidth;
|
|
359
|
+
this.screenWidthName = this.getCurrentScreenWidth();
|
|
360
|
+
this.sidenavElements = NavUtilities.getSidenavElements(this.screenWidthName, this.navbarRows);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Updates the current screen width and filters the sidenav elements accordingly.
|
|
365
|
+
*/
|
|
366
|
+
onResize() {
|
|
367
|
+
this.screenWidth = window.innerWidth;
|
|
368
|
+
this.screenWidthName = this.getCurrentScreenWidth();
|
|
369
|
+
this.sidenavElements = NavUtilities.getSidenavElements(this.screenWidthName, this.navbarRows);
|
|
370
|
+
if (!this.sidenavElements.length && this.sidenav.opened) {
|
|
371
|
+
this.sidenav.close();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Defines if the sidenav should be closed when the given element is clicked.
|
|
376
|
+
*
|
|
377
|
+
* @param element - The element that has been clicked.
|
|
378
|
+
*/
|
|
379
|
+
clickSidenavElement(element) {
|
|
380
|
+
switch (element.type) {
|
|
381
|
+
case 'image':
|
|
382
|
+
case 'title':
|
|
383
|
+
case 'menu':
|
|
384
|
+
return;
|
|
385
|
+
default:
|
|
386
|
+
this.sidenav.close();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
getCurrentScreenWidth() {
|
|
390
|
+
if (this.screenWidth < 768) {
|
|
391
|
+
return 'sm';
|
|
392
|
+
}
|
|
393
|
+
else if (this.screenWidth < 992) {
|
|
394
|
+
return 'md';
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
return 'lg';
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
NavbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavbarComponent, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
402
|
+
NavbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: NavbarComponent, selector: "ngx-mat-navigation-navbar", inputs: { navbarRows: "navbarRows", minHeight: "minHeight", minHeightOtherElements: "minHeightOtherElements", minSidenavWidth: "minSidenavWidth" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "sidenav", first: true, predicate: ["sidenav"], descendants: true }], ngImport: i0, template: "<mat-toolbar class=\"mat-elevation-z8\" [style.min-height.px]=\"minHeight\">\r\n <div *ngIf=\"navbarRows.length>1\" class=\"container\">\r\n <mat-toolbar-row class=\"toolbar-row\" *ngFor=\"let row of navbarRows\">\r\n <span class=\"toolbar-row\">\r\n <span class=\"left\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('left', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"center\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('center', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"right\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('right', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span *ngIf=\"sidenavElements.length && (navbarRows.indexOf(row) === 0)\" style=\"margin-left: 10px;\">\r\n <ngx-mat-navigation-element [element]=\"burgerMenu\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n </span>\r\n </mat-toolbar-row>\r\n </div>\r\n <div *ngIf=\"!(navbarRows.length>1)\" class=\"container\">\r\n <span class=\"toolbar-row\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('left', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span class=\"center\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('center', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"right\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('right', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span *ngIf=\"sidenavElements.length\" style=\"margin-left: 10px;\">\r\n <ngx-mat-navigation-element [element]=\"burgerMenu\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n </span>\r\n </div>\r\n</mat-toolbar>\r\n\r\n<mat-sidenav-container style=\"background-color: transparent; padding-top: 40px;\"\r\n [style.min-height]=\"sanitizedMinHeight\">\r\n <mat-sidenav #sidenav position=\"end\" style=\"padding: 20px;\" [style.min-width]=\"minSidenavWidth\" [autoFocus]=\"false\">\r\n <p *ngFor=\"let element of sidenavElements\">\r\n <ngx-mat-navigation-element (click)=\"clickSidenavElement(element)\" style=\"display: inline-block; width: 100%;\" [sidenav]=\"sidenav\" [sidenavElement]=\"true\" [element]=\"element\"></ngx-mat-navigation-element>\r\n </p>\r\n </mat-sidenav>\r\n <mat-sidenav-content style=\"padding-bottom: 40px;\">\r\n <div class=\"container\">\r\n <ng-content></ng-content>\r\n </div>\r\n </mat-sidenav-content>\r\n</mat-sidenav-container>", styles: [".toolbar-row{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.center{margin-left:auto;margin-right:auto}.right{margin-left:auto}\n"], components: [{ type: i2$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: NavElementComponent, selector: "ngx-mat-navigation-element", inputs: ["element", "sidenav", "sidenavElement"] }, { type: i4$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { type: i4$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { type: i4$1.MatSidenavContent, selector: "mat-sidenav-content" }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatToolbarRow, selector: "mat-toolbar-row", exportAs: ["matToolbarRow"] }] });
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavbarComponent, decorators: [{
|
|
404
|
+
type: Component,
|
|
405
|
+
args: [{ selector: 'ngx-mat-navigation-navbar', template: "<mat-toolbar class=\"mat-elevation-z8\" [style.min-height.px]=\"minHeight\">\r\n <div *ngIf=\"navbarRows.length>1\" class=\"container\">\r\n <mat-toolbar-row class=\"toolbar-row\" *ngFor=\"let row of navbarRows\">\r\n <span class=\"toolbar-row\">\r\n <span class=\"left\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('left', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"center\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('center', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"right\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('right', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span *ngIf=\"sidenavElements.length && (navbarRows.indexOf(row) === 0)\" style=\"margin-left: 10px;\">\r\n <ngx-mat-navigation-element [element]=\"burgerMenu\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n </span>\r\n </mat-toolbar-row>\r\n </div>\r\n <div *ngIf=\"!(navbarRows.length>1)\" class=\"container\">\r\n <span class=\"toolbar-row\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('left', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span class=\"center\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('center', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n <span class=\"right\">\r\n <span *ngFor=\"let element of NavUtilities.getNavbarElements('right', screenWidthName, navbarRows)\">\r\n <ngx-mat-navigation-element [element]=\"element\"></ngx-mat-navigation-element>\r\n </span>\r\n <span *ngIf=\"sidenavElements.length\" style=\"margin-left: 10px;\">\r\n <ngx-mat-navigation-element [element]=\"burgerMenu\"></ngx-mat-navigation-element>\r\n </span>\r\n </span>\r\n </span>\r\n </div>\r\n</mat-toolbar>\r\n\r\n<mat-sidenav-container style=\"background-color: transparent; padding-top: 40px;\"\r\n [style.min-height]=\"sanitizedMinHeight\">\r\n <mat-sidenav #sidenav position=\"end\" style=\"padding: 20px;\" [style.min-width]=\"minSidenavWidth\" [autoFocus]=\"false\">\r\n <p *ngFor=\"let element of sidenavElements\">\r\n <ngx-mat-navigation-element (click)=\"clickSidenavElement(element)\" style=\"display: inline-block; width: 100%;\" [sidenav]=\"sidenav\" [sidenavElement]=\"true\" [element]=\"element\"></ngx-mat-navigation-element>\r\n </p>\r\n </mat-sidenav>\r\n <mat-sidenav-content style=\"padding-bottom: 40px;\">\r\n <div class=\"container\">\r\n <ng-content></ng-content>\r\n </div>\r\n </mat-sidenav-content>\r\n</mat-sidenav-container>", styles: [".toolbar-row{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.center{margin-left:auto;margin-right:auto}.right{margin-left:auto}\n"] }]
|
|
406
|
+
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; }, propDecorators: { navbarRows: [{
|
|
407
|
+
type: Input
|
|
408
|
+
}], minHeight: [{
|
|
409
|
+
type: Input
|
|
410
|
+
}], minHeightOtherElements: [{
|
|
411
|
+
type: Input
|
|
412
|
+
}], minSidenavWidth: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}], sidenav: [{
|
|
415
|
+
type: ViewChild,
|
|
416
|
+
args: ['sidenav']
|
|
417
|
+
}], onResize: [{
|
|
418
|
+
type: HostListener,
|
|
419
|
+
args: ['window:resize', ['$event']]
|
|
420
|
+
}] } });
|
|
421
|
+
|
|
422
|
+
class NavMenuModule {
|
|
423
|
+
}
|
|
424
|
+
NavMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
425
|
+
NavMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuModule, declarations: [NavMenuComponent], imports: [CommonModule,
|
|
426
|
+
MatMenuModule,
|
|
427
|
+
RouterModule,
|
|
428
|
+
MatButtonModule], exports: [NavMenuComponent] });
|
|
429
|
+
NavMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuModule, imports: [[
|
|
430
|
+
CommonModule,
|
|
431
|
+
MatMenuModule,
|
|
432
|
+
RouterModule,
|
|
433
|
+
MatButtonModule
|
|
434
|
+
]] });
|
|
435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavMenuModule, decorators: [{
|
|
436
|
+
type: NgModule,
|
|
437
|
+
args: [{
|
|
438
|
+
imports: [
|
|
439
|
+
CommonModule,
|
|
440
|
+
MatMenuModule,
|
|
441
|
+
RouterModule,
|
|
442
|
+
MatButtonModule
|
|
443
|
+
],
|
|
444
|
+
declarations: [NavMenuComponent],
|
|
445
|
+
exports: [NavMenuComponent]
|
|
446
|
+
}]
|
|
447
|
+
}] });
|
|
448
|
+
|
|
449
|
+
class NavElementModule {
|
|
450
|
+
}
|
|
451
|
+
NavElementModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
452
|
+
NavElementModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementModule, declarations: [NavElementComponent], imports: [CommonModule,
|
|
453
|
+
NavMenuModule,
|
|
454
|
+
RouterModule,
|
|
455
|
+
MatMenuModule,
|
|
456
|
+
MatButtonModule,
|
|
457
|
+
MatSidenavModule], exports: [NavElementComponent] });
|
|
458
|
+
NavElementModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementModule, imports: [[
|
|
459
|
+
CommonModule,
|
|
460
|
+
NavMenuModule,
|
|
461
|
+
RouterModule,
|
|
462
|
+
MatMenuModule,
|
|
463
|
+
MatButtonModule,
|
|
464
|
+
MatSidenavModule
|
|
465
|
+
]] });
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NavElementModule, decorators: [{
|
|
467
|
+
type: NgModule,
|
|
468
|
+
args: [{
|
|
469
|
+
imports: [
|
|
470
|
+
CommonModule,
|
|
471
|
+
NavMenuModule,
|
|
472
|
+
RouterModule,
|
|
473
|
+
MatMenuModule,
|
|
474
|
+
MatButtonModule,
|
|
475
|
+
MatSidenavModule
|
|
476
|
+
],
|
|
477
|
+
declarations: [NavElementComponent],
|
|
478
|
+
exports: [NavElementComponent]
|
|
479
|
+
}]
|
|
480
|
+
}] });
|
|
481
|
+
|
|
482
|
+
class NgxMatNavigationNavbarModule {
|
|
483
|
+
}
|
|
484
|
+
NgxMatNavigationNavbarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationNavbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
485
|
+
NgxMatNavigationNavbarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationNavbarModule, declarations: [NavbarComponent], imports: [CommonModule,
|
|
486
|
+
MatToolbarModule,
|
|
487
|
+
NavElementModule,
|
|
488
|
+
MatSidenavModule], exports: [NavbarComponent] });
|
|
489
|
+
NgxMatNavigationNavbarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationNavbarModule, imports: [[
|
|
490
|
+
CommonModule,
|
|
491
|
+
MatToolbarModule,
|
|
492
|
+
NavElementModule,
|
|
493
|
+
MatSidenavModule
|
|
494
|
+
]] });
|
|
495
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationNavbarModule, decorators: [{
|
|
496
|
+
type: NgModule,
|
|
497
|
+
args: [{
|
|
498
|
+
declarations: [NavbarComponent],
|
|
499
|
+
imports: [
|
|
500
|
+
CommonModule,
|
|
501
|
+
MatToolbarModule,
|
|
502
|
+
NavElementModule,
|
|
503
|
+
MatSidenavModule
|
|
504
|
+
],
|
|
505
|
+
exports: [NavbarComponent]
|
|
506
|
+
}]
|
|
507
|
+
}] });
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Displays a footer based on the provided input data.
|
|
511
|
+
*/
|
|
512
|
+
class FooterComponent {
|
|
513
|
+
constructor() { }
|
|
514
|
+
}
|
|
515
|
+
FooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
516
|
+
FooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: FooterComponent, selector: "ngx-mat-navigation-footer", inputs: { minHeight: "minHeight" }, ngImport: i0, template: "<div class=\"mat-elevation-z8\" [style.minHeight.px]=\"minHeight\" style=\"background-color: #F5F5F5;\">\r\n\r\n</div>", styles: [""] });
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FooterComponent, decorators: [{
|
|
518
|
+
type: Component,
|
|
519
|
+
args: [{ selector: 'ngx-mat-navigation-footer', template: "<div class=\"mat-elevation-z8\" [style.minHeight.px]=\"minHeight\" style=\"background-color: #F5F5F5;\">\r\n\r\n</div>", styles: [""] }]
|
|
520
|
+
}], ctorParameters: function () { return []; }, propDecorators: { minHeight: [{
|
|
521
|
+
type: Input
|
|
522
|
+
}] } });
|
|
523
|
+
|
|
524
|
+
class NgxMatNavigationFooterModule {
|
|
525
|
+
}
|
|
526
|
+
NgxMatNavigationFooterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationFooterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
527
|
+
NgxMatNavigationFooterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationFooterModule, declarations: [FooterComponent], imports: [CommonModule], exports: [FooterComponent] });
|
|
528
|
+
NgxMatNavigationFooterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationFooterModule, imports: [[
|
|
529
|
+
CommonModule
|
|
530
|
+
]] });
|
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NgxMatNavigationFooterModule, decorators: [{
|
|
532
|
+
type: NgModule,
|
|
533
|
+
args: [{
|
|
534
|
+
imports: [
|
|
535
|
+
CommonModule
|
|
536
|
+
],
|
|
537
|
+
declarations: [FooterComponent],
|
|
538
|
+
exports: [FooterComponent]
|
|
539
|
+
}]
|
|
540
|
+
}] });
|
|
541
|
+
|
|
542
|
+
/*
|
|
543
|
+
* Public API Surface of ngx-material-navigation
|
|
544
|
+
*/
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Generated bundle index. Do not edit.
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
export { BaseNavElement, FooterComponent, NavLink, NavUtilities, NavbarComponent, NgxMatNavigationFooterModule, NgxMatNavigationNavbarModule };
|
|
551
|
+
//# sourceMappingURL=ngx-material-navigation.mjs.map
|