ng-mat-multilevel-menu 7.0.2 → 7.1.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.
@@ -1,19 +1,63 @@
1
- import * as i3 from '@angular/common';
2
1
  import { CommonModule } from '@angular/common';
3
2
  import * as i0 from '@angular/core';
4
- import { Injectable, Component, Input, EventEmitter, Output, NgModule, ContentChild } from '@angular/core';
3
+ import { NgModule, Injectable, EventEmitter, ContentChild, Output, Input, Component } from '@angular/core';
5
4
  import * as i1 from '@angular/router';
6
- import { NavigationEnd, RouterModule } from '@angular/router';
7
- import { trigger, state, style, transition, group, animate } from '@angular/animations';
8
- import { Subject } from 'rxjs';
9
- import * as i4 from '@angular/cdk/bidi';
10
- import * as i5 from '@angular/material/list';
11
- import { MatListModule } from '@angular/material/list';
12
- import * as i6 from '@angular/material/divider';
13
- import * as i7 from '@angular/material/core';
5
+ import { RouterModule, NavigationEnd } from '@angular/router';
14
6
  import { MatRippleModule } from '@angular/material/core';
15
- import * as i2 from '@angular/material/icon';
16
7
  import { MatIconModule } from '@angular/material/icon';
8
+ import { MatListModule } from '@angular/material/list';
9
+ import { Subject } from 'rxjs';
10
+ import { trigger, state, transition, style, group, animate } from '@angular/animations';
11
+
12
+ class MaterialsModule {
13
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MaterialsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
14
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: MaterialsModule, imports: [MatIconModule,
15
+ MatListModule,
16
+ MatRippleModule], exports: [MatIconModule,
17
+ MatListModule,
18
+ MatRippleModule] }); }
19
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MaterialsModule, imports: [MatIconModule,
20
+ MatListModule,
21
+ MatRippleModule, MatIconModule,
22
+ MatListModule,
23
+ MatRippleModule] }); }
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MaterialsModule, decorators: [{
26
+ type: NgModule,
27
+ args: [{
28
+ imports: [
29
+ MatIconModule,
30
+ MatListModule,
31
+ MatRippleModule,
32
+ ],
33
+ declarations: [],
34
+ exports: [
35
+ MatIconModule,
36
+ MatListModule,
37
+ MatRippleModule,
38
+ ]
39
+ }]
40
+ }] });
41
+
42
+ class NgMaterialMultilevelMenuModule {
43
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
44
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuModule, imports: [CommonModule,
45
+ MaterialsModule,
46
+ RouterModule] }); }
47
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuModule, imports: [CommonModule,
48
+ MaterialsModule,
49
+ RouterModule] }); }
50
+ }
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuModule, decorators: [{
52
+ type: NgModule,
53
+ args: [{
54
+ imports: [
55
+ CommonModule,
56
+ MaterialsModule,
57
+ RouterModule,
58
+ ]
59
+ }]
60
+ }] });
17
61
 
18
62
  var ExpandCollapseStatusEnum;
19
63
  (function (ExpandCollapseStatusEnum) {
@@ -41,36 +85,6 @@ const CONSTANT = {
41
85
  NO: 'no'
42
86
  };
43
87
 
44
- const SlideInOut = trigger('SlideInOut', [
45
- state('in', style({ height: '*', opacity: 0 })),
46
- transition(':leave', [
47
- style({ height: '*', opacity: 0.2 }),
48
- group([
49
- animate(200, style({ height: 0 })),
50
- animate('200ms ease-out', style({ opacity: 0 }))
51
- ])
52
- ]),
53
- transition(':enter', [
54
- style({ height: '0', opacity: 0 }),
55
- group([
56
- animate(200, style({ height: '*' })),
57
- animate('400ms ease-out', style({ opacity: 1 }))
58
- ])
59
- ])
60
- ]);
61
- const ExpandedLTR = trigger('ExpandedLTR', [
62
- state('no', style({ transform: 'rotate(-90deg)' })),
63
- state('yes', style({ transform: 'rotate(0deg)', })),
64
- transition('no => yes', animate(200)),
65
- transition('yes => no', animate(200))
66
- ]);
67
- const ExpandedRTL = trigger('ExpandedRTL', [
68
- state('no', style({ transform: 'rotate(90deg)' })),
69
- state('yes', style({ transform: 'rotate(0deg)', })),
70
- transition('no => yes', animate(200)),
71
- transition('yes => no', animate(200))
72
- ]);
73
-
74
88
  class CommonUtils {
75
89
  static { this.isNullOrUndefinedOrEmpty = function (object) {
76
90
  return CommonUtils.isNullOrUndefined(object) || object === '';
@@ -158,267 +172,16 @@ class MultilevelMenuService {
158
172
  this.selectedMenuID.next(menuID);
159
173
  return this.foundLinkObject;
160
174
  }
161
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MultilevelMenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
162
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MultilevelMenuService, providedIn: 'root' }); }
175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MultilevelMenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
176
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MultilevelMenuService, providedIn: 'root' }); }
163
177
  }
164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MultilevelMenuService, decorators: [{
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: MultilevelMenuService, decorators: [{
165
179
  type: Injectable,
166
180
  args: [{
167
181
  providedIn: 'root'
168
182
  }]
169
183
  }] });
170
184
 
171
- class ListItemContentComponent {
172
- constructor() {
173
- this.nodeConfiguration = null;
174
- // NOOP
175
- }
176
- ngOnInit() {
177
- // NOOP
178
- }
179
- getListIcon(node) {
180
- if (!CommonUtils.isNullOrUndefinedOrEmpty(node.icon)) {
181
- return `icon`;
182
- }
183
- else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.faIcon)) {
184
- return `faIcon`;
185
- }
186
- else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.imageIcon)) {
187
- return `imageIcon`;
188
- }
189
- else if (!CommonUtils.isNullOrUndefinedOrEmpty(node.svgIcon)) {
190
- return `svgIcon`;
191
- }
192
- else {
193
- return ``;
194
- }
195
- }
196
- getHrefTargetType() {
197
- return this.node.hrefTargetType ? this.node.hrefTargetType : CONSTANT.DEFAULT_HREF_TARGET_TYPE;
198
- }
199
- getSelectedSvgIcon() {
200
- return this.node.isSelected && this.node.activeSvgIcon ? this.node.activeSvgIcon : this.node.svgIcon;
201
- }
202
- getSelectedIcon() {
203
- return this.node.isSelected && this.node.activeIcon ? this.node.activeIcon : this.node.icon;
204
- }
205
- getSelectedFaIcon() {
206
- return this.node.isSelected && this.node.activeFaIcon ? this.node.activeFaIcon : this.node.faIcon;
207
- }
208
- getSelectedImageIcon() {
209
- return this.node.isSelected && this.node.activeImageIcon ? this.node.activeImageIcon : this.node.imageIcon;
210
- }
211
- nodeExpandStatus() {
212
- return this.node.expanded ? CONSTANT.YES : CONSTANT.NO;
213
- }
214
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListItemContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
215
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: ListItemContentComponent, selector: "ng-list-item-content", inputs: { node: "node", isRtlLayout: "isRtlLayout", listContentStyle: "listContentStyle", nodeConfiguration: "nodeConfiguration" }, ngImport: i0, template: "<ng-container *ngTemplateOutlet=\"node.externalRedirect ? redirectLinkTemplate : routerLinkTemplate\"></ng-container>\r\n\r\n<ng-template #redirectLinkTemplate>\r\n <a class=\"anml-link\" [href]=\"node.link\" [target]=\"getHrefTargetType()\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n</ng-template>\r\n\r\n<ng-template #routerLinkTemplate>\r\n <ng-container *ngIf=\"node.link && nodeConfiguration.interfaceWithRoute; else defaultContentContainer\">\r\n <a class=\"anml-link\" [routerLink]=\"node.link\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #defaultContentContainer>\r\n <a class=\"anml-link\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n</ng-template>\r\n\r\n<ng-template #linkLabelLtrOutlet>\r\n <div class=\"anml-data\" [dir]=\"'ltr'\">\r\n <ng-container *ngTemplateOutlet=\"iconContainer\"></ng-container>\r\n <span class=\"label\">{{node.label}}</span>\r\n </div>\r\n <div class=\"amml-icon-arrow-container\" *ngIf='node.hasChildren'>\r\n <mat-icon [@ExpandedLTR]=\"nodeExpandStatus()\">\r\n keyboard_arrow_down\r\n </mat-icon>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #linkLabelRtlOutlet>\r\n <div class=\"anml-data\" [dir]=\"'rtl'\">\r\n <ng-container *ngTemplateOutlet=\"iconContainer\"></ng-container>\r\n <span class=\"label\">{{node.label}}</span>\r\n </div>\r\n <div class=\"amml-icon-arrow-container\" *ngIf='node.hasChildren'>\r\n <mat-icon [@ExpandedRTL]=\"nodeExpandStatus()\">\r\n keyboard_arrow_down\r\n </mat-icon>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #iconContainer>\r\n <div class=\"icon-container\" [ngSwitch]=\"getListIcon(node)\">\r\n <span *ngSwitchCase=\"'faIcon'\" class=\"amml-icon amml-icon-fa\">\r\n <i [ngClass]=\"getSelectedFaIcon()\"></i>\r\n </span>\r\n <mat-icon *ngSwitchCase=\"'icon'\" class=\"amml-icon\">\r\n {{getSelectedIcon()}}\r\n </mat-icon>\r\n <mat-icon *ngSwitchCase=\"'svgIcon'\" class=\"amml-icon amml-svg-icon\"\r\n svgIcon=\"{{getSelectedSvgIcon()}}\">\r\n </mat-icon>\r\n <img *ngSwitchCase=\"'imageIcon'\" class=\"amml-icon amml-img-icon\"\r\n src=\"{{getSelectedImageIcon()}}\" alt=\"{{node.label}}\"/>\r\n </div>\r\n</ng-template>\r\n\r\n", styles: [".amml-item{position:relative;cursor:pointer}.anml-link{width:100%;display:flex;justify-content:flex-start;text-transform:capitalize;text-decoration:none}.anml-data{width:100%;height:48px;display:flex;justify-content:flex-start}.icon-container{display:flex;flex-direction:column;justify-content:center}.amml-icon-fa{font-size:20px}.label{line-height:48px;font-weight:400}.amml-svg-icon{width:22px;height:22px;margin-top:-12px}.amml-img-icon{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.amml-icon-arrow-container{direction:ltr;display:flex;align-items:center}div[dir=ltr] .amml-icon{margin-right:16px}div[dir=rtl] .amml-icon{margin-left:16px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], animations: [ExpandedLTR, ExpandedRTL] }); }
216
- }
217
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListItemContentComponent, decorators: [{
218
- type: Component,
219
- args: [{ selector: 'ng-list-item-content', animations: [ExpandedLTR, ExpandedRTL], template: "<ng-container *ngTemplateOutlet=\"node.externalRedirect ? redirectLinkTemplate : routerLinkTemplate\"></ng-container>\r\n\r\n<ng-template #redirectLinkTemplate>\r\n <a class=\"anml-link\" [href]=\"node.link\" [target]=\"getHrefTargetType()\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n</ng-template>\r\n\r\n<ng-template #routerLinkTemplate>\r\n <ng-container *ngIf=\"node.link && nodeConfiguration.interfaceWithRoute; else defaultContentContainer\">\r\n <a class=\"anml-link\" [routerLink]=\"node.link\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #defaultContentContainer>\r\n <a class=\"anml-link\" [ngStyle]=\"listContentStyle\">\r\n <ng-container *ngTemplateOutlet=\"isRtlLayout ? linkLabelRtlOutlet : linkLabelLtrOutlet\"></ng-container>\r\n </a>\r\n</ng-template>\r\n\r\n<ng-template #linkLabelLtrOutlet>\r\n <div class=\"anml-data\" [dir]=\"'ltr'\">\r\n <ng-container *ngTemplateOutlet=\"iconContainer\"></ng-container>\r\n <span class=\"label\">{{node.label}}</span>\r\n </div>\r\n <div class=\"amml-icon-arrow-container\" *ngIf='node.hasChildren'>\r\n <mat-icon [@ExpandedLTR]=\"nodeExpandStatus()\">\r\n keyboard_arrow_down\r\n </mat-icon>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #linkLabelRtlOutlet>\r\n <div class=\"anml-data\" [dir]=\"'rtl'\">\r\n <ng-container *ngTemplateOutlet=\"iconContainer\"></ng-container>\r\n <span class=\"label\">{{node.label}}</span>\r\n </div>\r\n <div class=\"amml-icon-arrow-container\" *ngIf='node.hasChildren'>\r\n <mat-icon [@ExpandedRTL]=\"nodeExpandStatus()\">\r\n keyboard_arrow_down\r\n </mat-icon>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #iconContainer>\r\n <div class=\"icon-container\" [ngSwitch]=\"getListIcon(node)\">\r\n <span *ngSwitchCase=\"'faIcon'\" class=\"amml-icon amml-icon-fa\">\r\n <i [ngClass]=\"getSelectedFaIcon()\"></i>\r\n </span>\r\n <mat-icon *ngSwitchCase=\"'icon'\" class=\"amml-icon\">\r\n {{getSelectedIcon()}}\r\n </mat-icon>\r\n <mat-icon *ngSwitchCase=\"'svgIcon'\" class=\"amml-icon amml-svg-icon\"\r\n svgIcon=\"{{getSelectedSvgIcon()}}\">\r\n </mat-icon>\r\n <img *ngSwitchCase=\"'imageIcon'\" class=\"amml-icon amml-img-icon\"\r\n src=\"{{getSelectedImageIcon()}}\" alt=\"{{node.label}}\"/>\r\n </div>\r\n</ng-template>\r\n\r\n", styles: [".amml-item{position:relative;cursor:pointer}.anml-link{width:100%;display:flex;justify-content:flex-start;text-transform:capitalize;text-decoration:none}.anml-data{width:100%;height:48px;display:flex;justify-content:flex-start}.icon-container{display:flex;flex-direction:column;justify-content:center}.amml-icon-fa{font-size:20px}.label{line-height:48px;font-weight:400}.amml-svg-icon{width:22px;height:22px;margin-top:-12px}.amml-img-icon{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.amml-icon-arrow-container{direction:ltr;display:flex;align-items:center}div[dir=ltr] .amml-icon{margin-right:16px}div[dir=rtl] .amml-icon{margin-left:16px}\n"] }]
220
- }], ctorParameters: () => [], propDecorators: { node: [{
221
- type: Input
222
- }], isRtlLayout: [{
223
- type: Input
224
- }], listContentStyle: [{
225
- type: Input
226
- }], nodeConfiguration: [{
227
- type: Input
228
- }] } });
229
-
230
- class ListItemComponent {
231
- constructor(router, multilevelMenuService) {
232
- this.router = router;
233
- this.multilevelMenuService = multilevelMenuService;
234
- this.level = 1;
235
- this.submenuLevel = 0;
236
- this.nodeConfiguration = null;
237
- this.nodeExpandCollapseStatus = null;
238
- this.listTemplate = null;
239
- this.selectedItem = new EventEmitter();
240
- this.isSelected = false;
241
- this.expanded = false;
242
- this.firstInitializer = false;
243
- this.selectedListClasses = {
244
- [CONSTANT.DEFAULT_LIST_CLASS_NAME]: true,
245
- [CONSTANT.SELECTED_LIST_CLASS_NAME]: false,
246
- [CONSTANT.ACTIVE_ITEM_CLASS_NAME]: false,
247
- };
248
- }
249
- ngOnChanges() {
250
- this.nodeChildren = this.node && this.node.items ? this.node.items.filter(n => !n.hidden) : [];
251
- this.node.hasChildren = this.hasItems();
252
- if (!CommonUtils.isNullOrUndefined(this.selectedNode)) {
253
- this.setSelectedClass(this.multilevelMenuService.recursiveCheckId(this.node, this.selectedNode.id));
254
- }
255
- this.setExpandCollapseStatus();
256
- }
257
- ngOnInit() {
258
- this.selectedListClasses[CONSTANT.DISABLED_ITEM_CLASS_NAME] = this.node.disabled;
259
- if (!CommonUtils.isNullOrUndefined(this.node.faIcon) &&
260
- this.node.faIcon.match(/\bfa\w(?!-)/) === null) {
261
- this.node.faIcon = `fas ${this.node.faIcon}`;
262
- }
263
- this.selectedListClasses[`level-${this.level}-submenulevel-${this.submenuLevel}`] = true;
264
- if (typeof this.node.expanded === 'boolean') {
265
- this.expanded = this.node.expanded;
266
- }
267
- this.setClasses();
268
- }
269
- setSelectedClass(isFound) {
270
- if (isFound) {
271
- if (!this.firstInitializer) {
272
- this.expanded = true;
273
- }
274
- this.isSelected = this.nodeConfiguration.highlightOnSelect || this.selectedNode.items === undefined;
275
- }
276
- else {
277
- this.isSelected = false;
278
- if (this.nodeConfiguration.collapseOnSelect) {
279
- this.node.expanded = false;
280
- this.expanded = false;
281
- }
282
- }
283
- this.selectedListClasses = {
284
- [CONSTANT.DEFAULT_LIST_CLASS_NAME]: true,
285
- [CONSTANT.SELECTED_LIST_CLASS_NAME]: this.isSelected,
286
- [CONSTANT.ACTIVE_ITEM_CLASS_NAME]: this.selectedNode.id === this.node.id,
287
- [CONSTANT.DISABLED_ITEM_CLASS_NAME]: this.node.disabled,
288
- [`level-${this.level}-submenulevel-${this.submenuLevel}`]: true,
289
- };
290
- this.node.isSelected = this.isSelected;
291
- this.setClasses();
292
- }
293
- getPaddingAtStart() {
294
- return this.nodeConfiguration.paddingAtStart;
295
- }
296
- getListStyle() {
297
- const styles = {
298
- background: CONSTANT.DEFAULT_LIST_BACKGROUND_COLOR,
299
- color: CONSTANT.DEFAULT_LIST_FONT_COLOR
300
- };
301
- if (this.nodeConfiguration.listBackgroundColor !== null) {
302
- styles.background = this.nodeConfiguration.listBackgroundColor;
303
- }
304
- if (this.isSelected) {
305
- this.nodeConfiguration.selectedListFontColor !== null ?
306
- styles.color = this.nodeConfiguration.selectedListFontColor : styles.color = CONSTANT.DEFAULT_SELECTED_FONT_COLOR;
307
- }
308
- else if (this.nodeConfiguration.fontColor !== null) {
309
- styles.color = this.nodeConfiguration.fontColor;
310
- }
311
- return styles;
312
- }
313
- hasItems() {
314
- return this.nodeChildren.length > 0;
315
- }
316
- isRtlLayout() {
317
- return this.nodeConfiguration.rtlLayout;
318
- }
319
- setClasses() {
320
- this.classes = {
321
- [`level-${this.level + 1}`]: true,
322
- [CONSTANT.SUBMENU_ITEM_CLASS_NAME]: this.hasItems() && this.getPaddingAtStart(),
323
- [CONSTANT.HAS_SUBMENU_ITEM_CLASS_NAME]: this.hasItems()
324
- };
325
- }
326
- setExpandCollapseStatus() {
327
- if (!CommonUtils.isNullOrUndefined(this.nodeExpandCollapseStatus)) {
328
- if (this.nodeExpandCollapseStatus === ExpandCollapseStatusEnum.expand) {
329
- this.expanded = true;
330
- if (this.nodeConfiguration.customTemplate) {
331
- this.node.expanded = true;
332
- }
333
- }
334
- if (this.nodeExpandCollapseStatus === ExpandCollapseStatusEnum.collapse) {
335
- this.expanded = false;
336
- if (this.nodeConfiguration.customTemplate) {
337
- this.node.expanded = false;
338
- }
339
- }
340
- }
341
- }
342
- expand(node) {
343
- if (node.disabled) {
344
- return;
345
- }
346
- this.nodeExpandCollapseStatus = ExpandCollapseStatusEnum.neutral;
347
- this.expanded = !this.expanded;
348
- this.node.expanded = this.expanded;
349
- this.firstInitializer = true;
350
- this.setClasses();
351
- if (this.nodeConfiguration.interfaceWithRoute !== null
352
- && this.nodeConfiguration.interfaceWithRoute
353
- && node.link !== undefined
354
- && node.link) {
355
- this.router.navigate([node.link], node.navigationExtras).then();
356
- }
357
- else if (node.onSelected && typeof node.onSelected === 'function') {
358
- node.onSelected(node);
359
- this.selectedListItem(node);
360
- }
361
- else if (node.items === undefined || this.nodeConfiguration.collapseOnSelect) {
362
- this.selectedListItem(node);
363
- }
364
- }
365
- selectedListItem(node) {
366
- this.selectedItem.emit(node);
367
- }
368
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListItemComponent, deps: [{ token: i1.Router }, { token: MultilevelMenuService }], target: i0.ɵɵFactoryTarget.Component }); }
369
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: ListItemComponent, selector: "ng-list-item", inputs: { node: "node", level: "level", submenuLevel: "submenuLevel", selectedNode: "selectedNode", nodeConfiguration: "nodeConfiguration", nodeExpandCollapseStatus: "nodeExpandCollapseStatus", listTemplate: "listTemplate" }, outputs: { selectedItem: "selectedItem" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"amml-menu-container\">\r\n <!-- Base Template rendering condition starts -->\r\n <div *ngIf=\"nodeConfiguration.customTemplate && !node.hidden;else baseTemplate\"\r\n [ngClass]=\"selectedListClasses\"\r\n (click)=\"expand(node)\">\r\n <ng-container [ngTemplateOutlet]=\"listTemplate\"\r\n [ngTemplateOutletContext]=\"{item: node, configuration: nodeConfiguration}\">\r\n </ng-container>\r\n </div>\r\n <!-- Base Template rendering condition ends -->\r\n\r\n <!-- Recursive Template calls begins -->\r\n <div *ngIf=\"hasItems() && expanded\" [@SlideInOut] [dir]=\"isRtlLayout() ? 'rtl' : 'ltr'\" [ngClass]=\"classes\">\r\n <ng-list-item *ngFor=\"let singleNode of nodeChildren | keyvalue : multilevelMenuService.kvDummyComparerFn\"\r\n [nodeConfiguration]='nodeConfiguration'\r\n [node]=\"singleNode.value\"\r\n [level]=\"level + 1\"\r\n [submenuLevel]=\"singleNode.key\"\r\n [selectedNode]='selectedNode'\r\n [nodeExpandCollapseStatus]='nodeExpandCollapseStatus'\r\n (selectedItem)=\"selectedListItem($event)\"\r\n [listTemplate]=\"listTemplate\">\r\n </ng-list-item>\r\n </div>\r\n</div>\r\n<!-- Recursive Template calls ends -->\r\n\r\n<!-- Base Template starts from here -->\r\n<ng-template #baseTemplate>\r\n <mat-list-item matRipple\r\n *ngIf=\"!node.hidden\"\r\n title=\"{{node.label}}\"\r\n [matRippleDisabled]=\"node.disabled\"\r\n [ngClass]=\"selectedListClasses\"\r\n (click)=\"expand(node)\">\r\n <ng-container *ngTemplateOutlet=\"linkTemplate\"></ng-container>\r\n </mat-list-item>\r\n <mat-divider *ngIf=\"nodeConfiguration.useDividers\"></mat-divider>\r\n</ng-template>\r\n\r\n<ng-template #linkTemplate>\r\n <ng-list-item-content class=\"filled\" [node]=\"node\" [nodeConfiguration]=\"nodeConfiguration\" [isRtlLayout]=\"isRtlLayout()\" [listContentStyle]=\"getListStyle()\"></ng-list-item-content>\r\n</ng-template>\r\n", styles: [".filled{width:100%}div[dir=rtl].amml-submenu{margin-right:16px}div[dir=ltr].amml-submenu{margin-left:16px}.disabled-amml-item{opacity:.5;text-decoration:none;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "component", type: i5.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i6.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: i7.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "component", type: ListItemComponent, selector: "ng-list-item", inputs: ["node", "level", "submenuLevel", "selectedNode", "nodeConfiguration", "nodeExpandCollapseStatus", "listTemplate"], outputs: ["selectedItem"] }, { kind: "component", type: ListItemContentComponent, selector: "ng-list-item-content", inputs: ["node", "isRtlLayout", "listContentStyle", "nodeConfiguration"] }, { kind: "pipe", type: i3.KeyValuePipe, name: "keyvalue" }], animations: [SlideInOut] }); }
370
- }
371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ListItemComponent, decorators: [{
372
- type: Component,
373
- args: [{ selector: 'ng-list-item', animations: [SlideInOut], template: "<div class=\"amml-menu-container\">\r\n <!-- Base Template rendering condition starts -->\r\n <div *ngIf=\"nodeConfiguration.customTemplate && !node.hidden;else baseTemplate\"\r\n [ngClass]=\"selectedListClasses\"\r\n (click)=\"expand(node)\">\r\n <ng-container [ngTemplateOutlet]=\"listTemplate\"\r\n [ngTemplateOutletContext]=\"{item: node, configuration: nodeConfiguration}\">\r\n </ng-container>\r\n </div>\r\n <!-- Base Template rendering condition ends -->\r\n\r\n <!-- Recursive Template calls begins -->\r\n <div *ngIf=\"hasItems() && expanded\" [@SlideInOut] [dir]=\"isRtlLayout() ? 'rtl' : 'ltr'\" [ngClass]=\"classes\">\r\n <ng-list-item *ngFor=\"let singleNode of nodeChildren | keyvalue : multilevelMenuService.kvDummyComparerFn\"\r\n [nodeConfiguration]='nodeConfiguration'\r\n [node]=\"singleNode.value\"\r\n [level]=\"level + 1\"\r\n [submenuLevel]=\"singleNode.key\"\r\n [selectedNode]='selectedNode'\r\n [nodeExpandCollapseStatus]='nodeExpandCollapseStatus'\r\n (selectedItem)=\"selectedListItem($event)\"\r\n [listTemplate]=\"listTemplate\">\r\n </ng-list-item>\r\n </div>\r\n</div>\r\n<!-- Recursive Template calls ends -->\r\n\r\n<!-- Base Template starts from here -->\r\n<ng-template #baseTemplate>\r\n <mat-list-item matRipple\r\n *ngIf=\"!node.hidden\"\r\n title=\"{{node.label}}\"\r\n [matRippleDisabled]=\"node.disabled\"\r\n [ngClass]=\"selectedListClasses\"\r\n (click)=\"expand(node)\">\r\n <ng-container *ngTemplateOutlet=\"linkTemplate\"></ng-container>\r\n </mat-list-item>\r\n <mat-divider *ngIf=\"nodeConfiguration.useDividers\"></mat-divider>\r\n</ng-template>\r\n\r\n<ng-template #linkTemplate>\r\n <ng-list-item-content class=\"filled\" [node]=\"node\" [nodeConfiguration]=\"nodeConfiguration\" [isRtlLayout]=\"isRtlLayout()\" [listContentStyle]=\"getListStyle()\"></ng-list-item-content>\r\n</ng-template>\r\n", styles: [".filled{width:100%}div[dir=rtl].amml-submenu{margin-right:16px}div[dir=ltr].amml-submenu{margin-left:16px}.disabled-amml-item{opacity:.5;text-decoration:none;pointer-events:none}\n"] }]
374
- }], ctorParameters: () => [{ type: i1.Router }, { type: MultilevelMenuService }], propDecorators: { node: [{
375
- type: Input
376
- }], level: [{
377
- type: Input
378
- }], submenuLevel: [{
379
- type: Input
380
- }], selectedNode: [{
381
- type: Input
382
- }], nodeConfiguration: [{
383
- type: Input
384
- }], nodeExpandCollapseStatus: [{
385
- type: Input
386
- }], listTemplate: [{
387
- type: Input
388
- }], selectedItem: [{
389
- type: Output
390
- }] } });
391
-
392
- class MaterialsModule {
393
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MaterialsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
394
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: MaterialsModule, imports: [MatIconModule,
395
- MatListModule,
396
- MatRippleModule], exports: [MatIconModule,
397
- MatListModule,
398
- MatRippleModule] }); }
399
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MaterialsModule, imports: [MatIconModule,
400
- MatListModule,
401
- MatRippleModule, MatIconModule,
402
- MatListModule,
403
- MatRippleModule] }); }
404
- }
405
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: MaterialsModule, decorators: [{
406
- type: NgModule,
407
- args: [{
408
- imports: [
409
- MatIconModule,
410
- MatListModule,
411
- MatRippleModule,
412
- ],
413
- declarations: [],
414
- exports: [
415
- MatIconModule,
416
- MatListModule,
417
- MatRippleModule,
418
- ]
419
- }]
420
- }] });
421
-
422
185
  class NgMaterialMultilevelMenuComponent {
423
186
  constructor(router, multilevelMenuService) {
424
187
  this.router = router;
@@ -590,10 +353,10 @@ class NgMaterialMultilevelMenuComponent {
590
353
  this.expandCollapseStatusSubscription.unsubscribe();
591
354
  this.selectMenuByIDSubscription.unsubscribe();
592
355
  }
593
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuComponent, deps: [{ token: i1.Router }, { token: MultilevelMenuService }], target: i0.ɵɵFactoryTarget.Component }); }
594
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: NgMaterialMultilevelMenuComponent, selector: "ng-material-multilevel-menu", inputs: { items: "items", configuration: "configuration" }, outputs: { selectedItem: "selectedItem", selectedLabel: "selectedLabel", menuIsReady: "menuIsReady" }, queries: [{ propertyName: "listTemplate", first: true, predicate: ["listTemplate"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"getClassName()\" [ngStyle]=\"getGlobalStyle()\" *ngIf='!isInvalidData && items.length !== 0' [dir]=\"isRtlLayout() ? 'rtl' : 'ltr'\">\r\n <mat-list>\r\n <ng-list-item\r\n *ngFor=\"let node of items | keyvalue: multilevelMenuService.kvDummyComparerFn\"\r\n [nodeConfiguration]='nodeConfig'\r\n [node]='node.value'\r\n [level]=\"1\"\r\n [submenuLevel]=\"node.key\"\r\n [selectedNode]='currentNode'\r\n [nodeExpandCollapseStatus]='nodeExpandCollapseStatus'\r\n (selectedItem)=\"selectedListItem($event)\"\r\n [listTemplate] = \"listTemplate\"\r\n >\r\n </ng-list-item>\r\n </mat-list>\r\n</div>\r\n", styles: [".amml-container .mat-list-base{padding-top:unset}.amml-item{line-height:48px;display:flex;justify-content:space-between;position:relative}.anml-data{width:100%;text-transform:capitalize;display:flex;justify-content:flex-start}.amml-icon-fa{font-size:20px}.amml-icon{line-height:48px}.active{color:#1976d2}div[dir=ltr] .amml-icon{margin-right:15px}div[dir=ltr] .amml-submenu{margin-left:16px}div[dir=rtl] .amml-icon{margin-left:15px}div[dir=rtl] .amml-submenu{margin-right:16px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i4.Dir, selector: "[dir]", inputs: ["dir"], outputs: ["dirChange"], exportAs: ["dir"] }, { kind: "component", type: i5.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: ListItemComponent, selector: "ng-list-item", inputs: ["node", "level", "submenuLevel", "selectedNode", "nodeConfiguration", "nodeExpandCollapseStatus", "listTemplate"], outputs: ["selectedItem"] }, { kind: "pipe", type: i3.KeyValuePipe, name: "keyvalue" }] }); }
356
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuComponent, deps: [{ token: i1.Router }, { token: MultilevelMenuService }], target: i0.ɵɵFactoryTarget.Component }); }
357
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: NgMaterialMultilevelMenuComponent, isStandalone: true, selector: "ng-material-multilevel-menu", inputs: { items: "items", configuration: "configuration" }, outputs: { selectedItem: "selectedItem", selectedLabel: "selectedLabel", menuIsReady: "menuIsReady" }, queries: [{ propertyName: "listTemplate", first: true, predicate: ["listTemplate"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [ngClass]=\"getClassName()\" [ngStyle]=\"getGlobalStyle()\" *ngIf='!isInvalidData && items.length !== 0' [dir]=\"isRtlLayout() ? 'rtl' : 'ltr'\">\r\n <mat-list>\r\n <ng-list-item\r\n *ngFor=\"let node of items | keyvalue: multilevelMenuService.kvDummyComparerFn\"\r\n [nodeConfiguration]='nodeConfig'\r\n [node]='node.value'\r\n [level]=\"1\"\r\n [submenuLevel]=\"node.key\"\r\n [selectedNode]='currentNode'\r\n [nodeExpandCollapseStatus]='nodeExpandCollapseStatus'\r\n (selectedItem)=\"selectedListItem($event)\"\r\n [listTemplate] = \"listTemplate\"\r\n >\r\n </ng-list-item>\r\n </mat-list>\r\n</div>\r\n", styles: [".amml-container .mat-list-base{padding-top:unset}.amml-item{line-height:48px;display:flex;justify-content:space-between;position:relative}.anml-data{width:100%;text-transform:capitalize;display:flex;justify-content:flex-start}.amml-icon-fa{font-size:20px}.amml-icon{line-height:48px}.active{color:#1976d2}div[dir=ltr] .amml-icon{margin-right:15px}div[dir=ltr] .amml-submenu{margin-left:16px}div[dir=rtl] .amml-icon{margin-left:15px}div[dir=rtl] .amml-submenu{margin-right:16px}\n"] }); }
595
358
  }
596
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuComponent, decorators: [{
359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: NgMaterialMultilevelMenuComponent, decorators: [{
597
360
  type: Component,
598
361
  args: [{ selector: 'ng-material-multilevel-menu', template: "<div [ngClass]=\"getClassName()\" [ngStyle]=\"getGlobalStyle()\" *ngIf='!isInvalidData && items.length !== 0' [dir]=\"isRtlLayout() ? 'rtl' : 'ltr'\">\r\n <mat-list>\r\n <ng-list-item\r\n *ngFor=\"let node of items | keyvalue: multilevelMenuService.kvDummyComparerFn\"\r\n [nodeConfiguration]='nodeConfig'\r\n [node]='node.value'\r\n [level]=\"1\"\r\n [submenuLevel]=\"node.key\"\r\n [selectedNode]='currentNode'\r\n [nodeExpandCollapseStatus]='nodeExpandCollapseStatus'\r\n (selectedItem)=\"selectedListItem($event)\"\r\n [listTemplate] = \"listTemplate\"\r\n >\r\n </ng-list-item>\r\n </mat-list>\r\n</div>\r\n", styles: [".amml-container .mat-list-base{padding-top:unset}.amml-item{line-height:48px;display:flex;justify-content:space-between;position:relative}.anml-data{width:100%;text-transform:capitalize;display:flex;justify-content:flex-start}.amml-icon-fa{font-size:20px}.amml-icon{line-height:48px}.active{color:#1976d2}div[dir=ltr] .amml-icon{margin-right:15px}div[dir=ltr] .amml-submenu{margin-left:16px}div[dir=rtl] .amml-icon{margin-left:15px}div[dir=rtl] .amml-submenu{margin-right:16px}\n"] }]
599
362
  }], ctorParameters: () => [{ type: i1.Router }, { type: MultilevelMenuService }], propDecorators: { items: [{
@@ -611,33 +374,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
611
374
  args: ['listTemplate', { static: true }]
612
375
  }] } });
613
376
 
614
- class NgMaterialMultilevelMenuModule {
615
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
616
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuModule, declarations: [NgMaterialMultilevelMenuComponent,
617
- ListItemComponent,
618
- ListItemContentComponent], imports: [CommonModule,
619
- MaterialsModule,
620
- RouterModule], exports: [NgMaterialMultilevelMenuComponent] }); }
621
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuModule, imports: [CommonModule,
622
- MaterialsModule,
623
- RouterModule] }); }
624
- }
625
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NgMaterialMultilevelMenuModule, decorators: [{
626
- type: NgModule,
627
- args: [{
628
- imports: [
629
- CommonModule,
630
- MaterialsModule,
631
- RouterModule,
632
- ],
633
- declarations: [
634
- NgMaterialMultilevelMenuComponent,
635
- ListItemComponent,
636
- ListItemContentComponent,
637
- ],
638
- exports: [NgMaterialMultilevelMenuComponent]
639
- }]
640
- }] });
377
+ const SlideInOut = trigger('SlideInOut', [
378
+ state('in', style({ height: '*', opacity: 0 })),
379
+ transition(':leave', [
380
+ style({ height: '*', opacity: 0.2 }),
381
+ group([
382
+ animate(200, style({ height: 0 })),
383
+ animate('200ms ease-out', style({ opacity: 0 }))
384
+ ])
385
+ ]),
386
+ transition(':enter', [
387
+ style({ height: '0', opacity: 0 }),
388
+ group([
389
+ animate(200, style({ height: '*' })),
390
+ animate('400ms ease-out', style({ opacity: 1 }))
391
+ ])
392
+ ])
393
+ ]);
394
+ const ExpandedLTR = trigger('ExpandedLTR', [
395
+ state('no', style({ transform: 'rotate(-90deg)' })),
396
+ state('yes', style({ transform: 'rotate(0deg)', })),
397
+ transition('no => yes', animate(200)),
398
+ transition('yes => no', animate(200))
399
+ ]);
400
+ const ExpandedRTL = trigger('ExpandedRTL', [
401
+ state('no', style({ transform: 'rotate(90deg)' })),
402
+ state('yes', style({ transform: 'rotate(0deg)', })),
403
+ transition('no => yes', animate(200)),
404
+ transition('yes => no', animate(200))
405
+ ]);
641
406
 
642
407
  /*
643
408
  * Public API Surface of ng-material-multilevel-menu