1 |
59718
|
k.triantaf
|
import {Component, Input, OnInit} from '@angular/core';
|
2 |
57935
|
argiro.kok
|
import {MenuItem} from "../../../sharedComponents/menu";
|
3 |
|
|
import {Router} from "@angular/router";
|
4 |
58889
|
argiro.kok
|
import {DomSanitizer} from "@angular/platform-browser";
|
5 |
|
|
import {properties} from "../../../../../environments/environment";
|
6 |
59554
|
argiro.kok
|
import {LayoutService} from "./layout.service";
|
7 |
57496
|
k.triantaf
|
|
8 |
|
|
@Component({
|
9 |
|
|
selector: 'dashboard-sidebar',
|
10 |
|
|
templateUrl: 'sideBar.component.html'
|
11 |
|
|
})
|
12 |
|
|
export class SideBarComponent implements OnInit {
|
13 |
57935
|
argiro.kok
|
@Input() items: MenuItem[] = [];
|
14 |
60151
|
k.triantaf
|
@Input() logoLabel: string;
|
15 |
57935
|
argiro.kok
|
@Input() headerName: string;
|
16 |
59995
|
k.triantaf
|
@Input() headerPosition: "left" | "center" | "right" = "center";
|
17 |
57935
|
argiro.kok
|
@Input() headerLogoUrl: string;
|
18 |
58844
|
argiro.kok
|
@Input() headerUrl: string;
|
19 |
57757
|
argiro.kok
|
@Input() showHeader: boolean = true;
|
20 |
57805
|
k.triantaf
|
@Input() activeItem: string = '';
|
21 |
|
|
@Input() activeSubItem: string = '';
|
22 |
59718
|
k.triantaf
|
@Input() specialMenuItem: MenuItem = null;
|
23 |
59078
|
argiro.kok
|
@Input() searchParams = {};
|
24 |
59223
|
argiro.kok
|
@Input() queryParamsHandling = "";
|
25 |
58889
|
argiro.kok
|
properties;
|
26 |
59718
|
k.triantaf
|
|
27 |
59554
|
argiro.kok
|
constructor(private router: Router, private sanitizer: DomSanitizer, private layoutService: LayoutService) {
|
28 |
58889
|
argiro.kok
|
this.properties = properties;
|
29 |
|
|
}
|
30 |
59718
|
k.triantaf
|
|
31 |
|
|
ngOnInit(): void {
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
|
35 |
57935
|
argiro.kok
|
isTheActiveMenuItem(item: MenuItem, subItem: MenuItem = null): boolean {
|
36 |
59718
|
k.triantaf
|
if (this.activeItem || this.activeSubItem) {
|
37 |
|
|
return (!subItem && this.activeItem === item.id) ||
|
38 |
57811
|
k.triantaf
|
(subItem && this.activeItem === item.id && this.activeSubItem === subItem.id);
|
39 |
59718
|
k.triantaf
|
} else {
|
40 |
|
|
if (subItem) {
|
41 |
60269
|
k.triantaf
|
return MenuItem.isTheActiveMenu(subItem, this.router.url.split('?')[0]) || MenuItem.isTheActiveMenu(subItem, this.router.url.split('#')[0]);
|
42 |
57935
|
argiro.kok
|
}
|
43 |
60269
|
k.triantaf
|
return MenuItem.isTheActiveMenu(item,this.router.url.split('?')[0]) || MenuItem.isTheActiveMenu(item,this.router.url.split('#')[0]);
|
44 |
57935
|
argiro.kok
|
}
|
45 |
57496
|
k.triantaf
|
}
|
46 |
59718
|
k.triantaf
|
|
47 |
59078
|
argiro.kok
|
isTheActiveUrl(menuItemURL): boolean {
|
48 |
|
|
return (menuItemURL == this.router.url.split('?')[0])
|
49 |
|
|
}
|
50 |
59718
|
k.triantaf
|
|
51 |
|
|
satinizeHTML(html) {
|
52 |
58889
|
argiro.kok
|
return this.sanitizer.bypassSecurityTrustHtml(html);
|
53 |
|
|
}
|
54 |
59718
|
k.triantaf
|
|
55 |
59554
|
argiro.kok
|
public get isSmallScreen() {
|
56 |
|
|
return this.layoutService.isSmallScreen;
|
57 |
|
|
}
|
58 |
59718
|
k.triantaf
|
|
59 |
59554
|
argiro.kok
|
public get open() {
|
60 |
|
|
return this.layoutService.open;
|
61 |
|
|
}
|
62 |
59718
|
k.triantaf
|
|
63 |
59554
|
argiro.kok
|
public toggleOpen(event: MouseEvent) {
|
64 |
|
|
event.preventDefault();
|
65 |
|
|
this.layoutService.setOpen(!this.open);
|
66 |
|
|
}
|
67 |
57496
|
k.triantaf
|
}
|