UNPKG

ngx-admin-lte

Version:

AdminLTE theme for angular

1,121 lines (1,087 loc) 50.7 kB
import { __decorate } from 'tslib'; import { Injectable, Component, Pipe, Input, ComponentFactoryResolver, ViewChild, ViewContainerRef, ViewEncapsulation, NgModule } from '@angular/core'; import { ReplaySubject, Subject, Observable } from 'rxjs'; import { Router, ActivatedRoute, RouterModule } from '@angular/router'; import { TranslateService as TranslateService$1, TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { map, catchError } from 'rxjs/operators'; import { HttpHeaders, HttpClient, HttpClientModule } from '@angular/common/http'; import { DomSanitizer, BrowserModule } from '@angular/platform-browser'; import { ToastrModule, ToastrService } from 'ngx-toastr'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; let BreadcrumbService = class BreadcrumbService { constructor() { this.initialData = { description: '', display: false, header: '', levels: [ { icon: 'clock-o', link: ['/'], title: 'Default' } ] }; this.current = new ReplaySubject(1); this.clear(); } setCurrent(data) { this.current.next(data); } getCurrent() { return this.current; } clear() { this.setCurrent(this.initialData); } }; BreadcrumbService = __decorate([ Injectable() ], BreadcrumbService); class User { constructor(data = {}) { this.connected = false; this.firstname = data.firstname || ''; this.lastname = data.lastname || ''; this.email = data.email || ''; this.avatarUrl = data.avatarUrl || ''; this.creationDate = data.creation_date || Date.now(); this.preferredLang = data.preferredLang || null; this.connected = data.connected || false; } getName() { return this.firstname + ' ' + this.lastname; } } let UserService = class UserService { constructor(router) { this.router = router; this.current = new ReplaySubject(1); } setCurrent(user) { this.current.next(user); } getCurrent() { return this.current; } logout() { if (this.logoutAction) { this.logoutAction(); } else { const user = new User(); user.connected = false; this.setCurrent(user); this.router.navigate(['login']); } } }; UserService.ctorParameters = () => [ { type: Router } ]; UserService = __decorate([ Injectable() ], UserService); let CanActivateGuard = class CanActivateGuard { constructor(router, userService) { this.router = router; this.userService = userService; this.connected = false; this.userService.getCurrent().subscribe((user) => { this.connected = user.connected; }); } canActivate() { // test here if you user is logged if (!this.connected) { this.router.navigate(['login']); } return this.connected; } }; CanActivateGuard.ctorParameters = () => [ { type: Router }, { type: UserService } ]; CanActivateGuard = __decorate([ Injectable() ], CanActivateGuard); const langs = ['en', 'fr', 'ru', 'he', 'zh', 'pt', 'it']; const langmatch = /en|fr|ru|he|zh|pt|it/; let TranslateService = class TranslateService { constructor(userServ, translate) { this.userServ = userServ; this.translate = translate; this.lang = 'us'; translate.addLangs(langs); // this language will be used as a fallback when a translation isn't found in the current language translate.setDefaultLang('en'); this.userServ.getCurrent().subscribe((user) => { this.currentUser = user; // the lang to use, if the lang isn't available, it will use the current loader to get them const browserLang = this.translate.getBrowserLang(); const browserCultureLang = this.translate.getBrowserCultureLang(); console.log('Detected browser language: "' + browserCultureLang + '"'); // check if current User has a Preferred Language set, and it differs from his browser lang let useLang = 'en'; const prefLang = (this.currentUser) ? this.currentUser.preferredLang : null; if (!prefLang) { useLang = browserLang.match(langmatch) ? browserLang : 'en'; } else { console.log('Detected User preferred language: "' + prefLang + '"'); useLang = prefLang.match(langmatch) ? prefLang : 'en'; } this.translate.use(useLang); console.log('Translation language has been set to: "' + useLang + '"'); // translate.use( 'ru' ); }); } ngOnInit() { // TODO } getTranslate() { return this.translate; } }; TranslateService.ctorParameters = () => [ { type: UserService }, { type: TranslateService$1 } ]; TranslateService = __decorate([ Injectable() ], TranslateService); let LoggerService = class LoggerService { constructor(translate) { this.translate = translate; } log(component, msg, i18nRef, data) { // here we should test some environment config to show or not the log if (true) { if (i18nRef) { let params = {}; if (data) { params = (data[0]) ? { 0: data[0] } : params; params = (data[1]) ? { 0: data[0], 1: data[1] } : params; params = (data[2]) ? { 0: data[0], 1: data[1], 2: data[2] } : params; } this.translate.getTranslate().get(i18nRef, params).subscribe((res) => { console.log(component + ': ' + res); }); } else { console.log(component + ': ' + msg); } } } }; LoggerService.ctorParameters = () => [ { type: TranslateService } ]; LoggerService = __decorate([ Injectable() ], LoggerService); const initialMessages = []; let MessagesService = class MessagesService { // public markThreadAsRead: Subject<any> = new Subject<any>(); constructor() { this.messagesList = []; // a stream that publishes new messages only once this.newMessages = new Subject(); // `messages` is a stream that emits an array of the most up to date messages this.messages = new ReplaySubject(1); // `updates` receives _operations_ to be applied to our `messages` // it's a way we can perform changes on *all* messages (that are currently // stored in `messages`) this.updates = new Subject(); // action streams this.create = new Subject(); // recois des operation, et les fais sur la liste interne, puis diffuse le resultat sur messages this.updates.subscribe((ope) => { this.messagesList = ope(this.messagesList); console.log(this.messagesList); this.messages.next(this.messagesList); }); this.newMessages.pipe(map(function (message) { return (messages) => { return messages.concat(message); }; })) .subscribe(this.updates); } // an imperative function call to this action stream addMessage(message) { this.newMessages.next(message); } }; MessagesService = __decorate([ Injectable() ], MessagesService); const initialNotifications = []; let NotificationsService = class NotificationsService { // public markThreadAsRead: Subject<any> = new Subject<any>(); constructor() { this.notificationsList = []; // a stream that publishes new notifications only once this.newNotifications = new Subject(); // `notifications` is a stream that emits an array of the most up to date notifications this.notifications = new ReplaySubject(1); // `updates` receives _operations_ to be applied to our `notifications` // it's a way we can perform changes on *all* notifications (that are currently // stored in `notifications`) this.updates = new Subject(); // action streams this.create = new Subject(); // recois des operation, et les fais sur la liste interne, puis diffuse le resultat sur notifications this.updates.subscribe((ope) => { this.notificationsList = ope(this.notificationsList); console.log(this.notificationsList); this.notifications.next(this.notificationsList); }); this.newNotifications.pipe(map(function (notification) { return (notifications) => { return notifications.concat(notification); }; })) .subscribe(this.updates); } // an imperative function call to this action stream addNotification(notification) { this.newNotifications.next(notification); } }; NotificationsService = __decorate([ Injectable() ], NotificationsService); let RestService = class RestService { constructor(http) { this.http = http; this.modelName = 'to-configure'; this.headers = new HttpHeaders({ 'Content-Type': 'application/json', 'Accept': 'application/json' }); } setApiUrl(url) { this.serverWithApiUrl = url; } // HELPERS getAllFromLS(maxtime = 0) { const json = localStorage.getItem('rest_all_' + this.modelName); if (json) { const obj = JSON.parse(json); if (obj && (obj.date < (Date.now() - maxtime))) { return obj; } } } getFromCache(id) { if (this.lastGetAll) { return this.lastGetAll.find((unit) => unit.id === id); } else { return null; } } getActionUrl() { return this.serverWithApiUrl + this.modelName + '/'; } // REST functions getAll() { return this.http.get(this.getActionUrl(), { headers: this.headers }) .pipe(map((response) => { // getting an array having the same name as the model const data = response.body[this.modelName]; // transforming the array from indexed to associative const tab = data.records.map((elem) => { const unit = {}; // using the columns order and number to rebuild the object data.columns.forEach((champ, index) => { unit[champ] = elem[index]; }); return unit; }); this.lastGetAll = tab; const obj = { data: tab, date: Date.now() }; localStorage.setItem('rest_all_' + this.modelName, JSON.stringify(obj)); return tab; }), catchError(this.handleError)); } get(id) { return this.http.get(this.getActionUrl() + id, { headers: this.headers }) .pipe(map((response) => { const data = response.body; this.lastGet = data; return data; }), catchError(this.handleError)); } add(item) { const toAdd = JSON.stringify(item); return this.http.post(this.getActionUrl(), toAdd, { headers: this.headers }) .pipe(map((response) => response.body), catchError(this.handleError)); } addAll(tab) { const toAdd = JSON.stringify(tab); return this.http.post(this.getActionUrl(), toAdd, { headers: this.headers }) .pipe(map((response) => response.body), catchError(this.handleError)); } update(id, itemToUpdate) { return this.http.put(this.getActionUrl() + id, JSON.stringify(itemToUpdate), { headers: this.headers }) .pipe(map((response) => response.body), catchError(this.handleError)); } delete(id) { return this.http.delete(this.getActionUrl() + id, { headers: this.headers }) .pipe(catchError(this.handleError)); } handleError(error) { console.error(error); return Observable.throw(error.body || 'Server error'); } }; RestService.ctorParameters = () => [ { type: HttpClient } ]; RestService = __decorate([ Injectable() ], RestService); let MenuService = class MenuService { constructor(router) { this.router = router; this.current = new ReplaySubject(1); } setCurrent(menu) { this.current.next(menu); } getCurrent() { return this.current; } }; MenuService.ctorParameters = () => [ { type: Router } ]; MenuService = __decorate([ Injectable() ], MenuService); let LogoService = class LogoService { constructor() { this.current = new ReplaySubject(1); // default logo this.logo = { html_mini: '<b>A</b>LT', html_lg: '<b>Admin</b>LTE' }; this.setCurrent(this.logo); } /* Redefine the logo */ setCurrent(logo) { if (logo.small || logo.big) { console.log('NgxAdminLTE: LogoService setCurrent: small and big are now deprecated in logo, use html_mini and html_lg'); } this.current.next(logo); } getCurrent() { return this.current; } }; LogoService = __decorate([ Injectable() ], LogoService); let FooterService = class FooterService { constructor() { this.current = new ReplaySubject(1); this.default = { right_part: 'Anything you want', left_part: `<strong>Copyright &copy; 2016 <a href="#" routerLink="/">Company X</a>. </strong> All rights reserved.` }; } /* Redefine the footer html */ setCurrent(footer) { this.current.next(footer); } getCurrent() { return this.current; } }; FooterService = __decorate([ Injectable() ], FooterService); let ControlSidebarService = class ControlSidebarService { constructor() { // Handle the state (open or closed) this.current_state = new ReplaySubject(1); this.default_state = false; this.current_state_value = false; // Handle the items this.current_items = new ReplaySubject(1); this.default_items = [ { id: 'control-sidebar-home-tab', icon: 'home', active: true, items: [ { html: ` <h3 class='control-sidebar-heading'>Recent Activity</h3> <ul class='control-sidebar-menu'> <li><a href='javascript::;'> <i class='menu-icon fa fa-birthday-cake bg-red'></i> <div class='menu-info'> <h4 class='control-sidebar-subheading'>Langdon's Birthday</h4> <p>Will be 23 on April 24th</p> </div> </a></li> </ul>` }, { html: ` <h3 class='control-sidebar-heading'>Tasks Progress</h3> <ul class='control-sidebar-menu'> <li><a href='javascript::;'> <h4 class='control-sidebar-subheading'> Custom Template Design <span class='label label-danger pull-right'>70%</span> </h4> <div class='progress progress-xxs'> <div class='progress-bar progress-bar-danger' style='width: 70%'></div> </div> </a></li> </ul>` } ] }, { id: 'control-sidebar-settings-tab', icon: 'gear', active: false, items: [ { html: `<form method='post'> <h3 class='control-sidebar-heading'>General Settings</h3> <div class='form-group'> <label class='control-sidebar-subheading'> Report panel usage <input type='checkbox' class='pull-right' checked> </label> <p>Some information about this general settings option</p> </div> <!-- /.form-group --> </form>` } ] } ]; this.current_state.next(this.default_state); this.current_items.next(this.default_items); } setItems(items) { this.current_items.next(items); } getItems() { return this.current_items; } getState() { return this.current_state; } setState(val) { this.current_state_value = val; this.current_state.next(this.current_state_value); } open() { this.setState(true); this.current_state.next(this.current_state_value); } close() { this.setState(false); } toggle() { this.setState(!this.current_state_value); } }; ControlSidebarService = __decorate([ Injectable() ], ControlSidebarService); let LayoutAuthComponent = class LayoutAuthComponent { constructor(menuServ, translate, route) { this.menuServ = menuServ; this.translate = translate; this.mylinks = []; this.skin = 'skin-blue'; this.display_control = true; this.display_user = true; this.display_tasks = true; this.display_messages = true; this.display_notifications = true; this.display_menu_user = true; this.display_menu_search = true; this.display_logout = false; this.header_components = []; this.boxed_style = true; this.display_control_sidebar = true; const param = route.snapshot.data[0]; this.skin = this.paramExistOrDefault(param, 'skin', 'skin-blue'); this.display_control = this.paramExistOrDefault(param, 'display_control'); this.display_user = this.paramExistOrDefault(param, 'display_user'); this.display_tasks = this.paramExistOrDefault(param, 'display_tasks'); this.display_messages = this.paramExistOrDefault(param, 'display_messages'); this.display_notifications = this.paramExistOrDefault(param, 'display_notifications'); this.display_menu_user = this.paramExistOrDefault(param, 'display_menu_user'); this.display_menu_search = this.paramExistOrDefault(param, 'display_menu_search'); this.display_logout = this.paramExistOrDefault(param, 'display_logout', false); this.display_control_sidebar = this.paramExistOrDefault(param, 'display_control_sidebar', true); this.header_components = this.paramExistOrDefault(param, 'header_components', []); this.boxed_style = this.paramExistOrDefault(param, 'boxed_style', true); } paramExistOrDefault(param, index, default_value = true) { return param.hasOwnProperty(index) ? param[index] : default_value; } ngOnInit() { // sedding the resize event, for AdminLTE to place the height const ie = this.detectIE(); if (!ie) { window.dispatchEvent(new Event('resize')); } else { // solution for IE from @hakonamatata const event = document.createEvent('Event'); event.initEvent('resize', false, true); window.dispatchEvent(event); } // default menu structure, please use the menuService to modify this.mylinks = [ { 'header': 'NAVIGATION' }, { 'title': 'Home', 'icon': 'dashboard', 'link': ['/'] } ]; // register to menu change this.menuServ.getCurrent().subscribe((menu) => { this.mylinks = menu; }); document.body.className = 'hold-transition ' + this.skin + ' sidebar-mini'; } ngOnDestroy() { document.body.className = ''; } detectIE() { const ua = window.navigator.userAgent; return ua.includes('MSIE ') || ua.includes('Trident/') || ua.includes('Edge/'); } }; LayoutAuthComponent.ctorParameters = () => [ { type: MenuService }, { type: TranslateService }, { type: ActivatedRoute } ]; LayoutAuthComponent = __decorate([ Component({ selector: 'app-layouts-auth', template: "<div class=\"wrapper\">\n\t<app-header\n\t\t[display_messages]='display_messages'\n\t\t[display_notifications]='display_notifications'\n\t\t[display_tasks]='display_tasks'\n\t\t[display_user]='display_user'\n\t\t[display_control]='display_control'\n\t\t[display_logout]='display_logout'\n\t\t[header_components]='header_components'\n >{{ 'LOADING' | translate }} header...</app-header>\n\t<app-menu-aside\n\t[links]=\"mylinks\"\n\t[display_menu_user]='display_menu_user'\n\t[display_menu_search]='display_menu_search'\n\t>{{ 'LOADING' | translate }} menu...</app-menu-aside>\n\n\t<!-- Content Wrapper. Contains page content -->\n\t<div class=\"content-wrapper\">\n\t\t<!-- Content Header (Page header) -->\n\t\t<app-breadcrumb></app-breadcrumb>\n\n\t\t<!-- Main content -->\n\t\t<section class=\"content\">\n\t\t\t<div [ngClass]=\"{'box': boxed_style, 'box-default': boxed_style}\">\n\t\t\t\t<div [ngClass]=\"{'box-body': boxed_style}\">\n\t\t\t\t\t<router-outlet></router-outlet>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t\t<!-- /.content -->\n\t</div>\n\t<!-- /.content-wrapper -->\n\t<app-footer>{{ 'LOADING' | translate }} footer...</app-footer>\n\t<app-control-sidebar *ngIf='display_control_sidebar'>{{ 'LOADING' | translate }} control sidebar...</app-control-sidebar>\n</div>\n<!-- ./wrapper -->\n" }) ], LayoutAuthComponent); let LayoutLoginComponent = class LayoutLoginComponent { constructor() { } ngOnInit() { window.dispatchEvent(new Event('resize')); document.body.className = 'hold-transition login-page'; } ngOnDestroy() { document.body.className = ''; } }; LayoutLoginComponent = __decorate([ Component({ selector: 'app-layout-login', template: "<div class=\"login-box\" >\n <div class=\"login-logo\">\n <app-logo [hide]='\"mini\"'></app-logo>\n </div>\n <!-- /.login-logo -->\n <div class=\"login-box-body\">\n <router-outlet></router-outlet>\n </div>\n <!-- /.login-box-body -->\n</div>\n<!-- /.login-box -->\n", styles: ['./login.css'] }) ], LayoutLoginComponent); let LayoutRegisterComponent = class LayoutRegisterComponent { constructor() { // TODO } ngOnInit() { // TODO } }; LayoutRegisterComponent = __decorate([ Component({ selector: 'app-layout-register', template: "<body class=\"hold-transition register-page\">\n<div class=\"register-box\">\n <div class=\"register-logo\">\n <app-logo></app-logo>\n </div>\n\n <div class=\"register-box-body\">\n <router-outlet></router-outlet>\n </div>\n <!-- /.form-box -->\n</div>\n<!-- /.register-box -->\n</body>\n" }) ], LayoutRegisterComponent); class Message { constructor(data = {}) { this.content = data.content || ''; this.title = data.title || ''; this.author = data.author || null; this.destination = data.destination || null; this.date = data.date || Date.now(); } } class Preference { constructor(data = {}) { this.avatarUrl = data.avatarUrl || ''; this.preferredLang = data.preferredLang || null; } } class Notification { constructor(data = {}) { this.content = data.content || ''; this.class = data.class || ''; this.link = data.link || ''; } } let SafeHtmlPipe = class SafeHtmlPipe { constructor(sanitized) { this.sanitized = sanitized; } transform(value) { return this.sanitized.bypassSecurityTrustHtml(value); } }; SafeHtmlPipe.ctorParameters = () => [ { type: DomSanitizer } ]; SafeHtmlPipe = __decorate([ Pipe({ name: 'safeHtml' }) ], SafeHtmlPipe); let AppHeaderComponent = class AppHeaderComponent { constructor(userService, sidebarService) { this.userService = userService; this.sidebarService = sidebarService; this.display_messages = true; this.display_notifications = true; this.display_tasks = true; this.display_user = true; this.display_control = true; this.display_logout = false; this.header_components = []; } logout() { this.userService.logout(); } toggleSidebar() { this.sidebarService.toggle(); } }; AppHeaderComponent.ctorParameters = () => [ { type: UserService }, { type: ControlSidebarService } ]; __decorate([ Input() ], AppHeaderComponent.prototype, "display_messages", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "display_notifications", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "display_tasks", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "display_user", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "display_control", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "display_logout", void 0); __decorate([ Input() ], AppHeaderComponent.prototype, "header_components", void 0); AppHeaderComponent = __decorate([ Component({ selector: 'app-header', template: "<!-- Main Header -->\n<header class=\"main-header\">\n\t<!-- Logo -->\n\t<app-logo></app-logo>\n\t<!-- Header Navbar -->\n\t<nav class=\"navbar navbar-static-top\" role=\"navigation\">\n\t\t<!-- Sidebar toggle button-->\n\t\t<a class=\"sidebar-toggle\" data-toggle=\"offcanvas\" role=\"button\">\n\t\t\t<!-- ADMIN LTE 2.4.0 <a class=\"sidebar-toggle\" data-toggle=\"push-menu\" role=\"button\"> -->\n <span class=\"sr-only\">Toggle navigation</span>\n\t\t</a>\n\t\t<!-- Navbar Right Menu -->\n\t\t<div class=\"navbar-custom-menu\">\n\t\t\t<ul class=\"nav navbar-nav\" >\n\t\t\t\t<!-- Messages: style can be found in dropdown.less-->\n\t\t\t\t<li class=\"dropdown messages-menu messagesBox\" *ngIf=\"display_messages\"></li>\n\t\t\t\t<!-- Notifications Menu -->\n\t\t\t\t<li class=\"dropdown notifications-menu notificationsBox\" *ngIf=\"display_notifications\"></li>\n\t\t\t\t<!-- Tasks Menu -->\n\t\t\t\t<li class=\"dropdown tasks-menu tasksBox\" *ngIf=\"display_tasks\"></li>\n\t\t\t\t<!-- User Account Menu -->\n <li class=\"dropdown user user-menu userBox\" *ngIf=\"display_user\"></li>\n <li *ngIf=\"display_logout\">\n\t\t\t\t\t<button class=\"btn btn-primary btn-lg\" (click)=\"logout()\">\n\t\t\t\t\t\t<i class=\"fa fa-power-off\"></i>\n\t\t\t\t\t</button>\n\t\t\t\t</li>\n\t\t\t\t<!-- Control Sidebar Toggle Button -->\n\t\t\t\t<li>\n\t\t\t\t\t<a class=\"toggle-sidebar-right\" role=\"button\" *ngIf=\"display_control\">\n\t\t\t\t\t\t<i class=\"fa fa-gears\" (click)=\"toggleSidebar()\"></i>\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t\t\t<!-- Additionnal components -->\n\t\t\t\t<ng-container *ngFor=\"let widget of header_components\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<app-component-loader [class_component]=\"widget.class\" [data]=\"widget.data\"></app-component-loader>\n\t\t\t\t\t</li>\n\t\t\t\t</ng-container>\n\t\t\t</ul>\n\t\t</div>\n\t</nav>\n</header>\n", styles: [""] }) ], AppHeaderComponent); let LogoComponent = class LogoComponent { constructor(logoServ) { this.logoServ = logoServ; this.hide = ''; } ngOnInit() { this.logoServ.getCurrent().subscribe((logo) => { this.logo = logo; }); } }; LogoComponent.ctorParameters = () => [ { type: LogoService } ]; __decorate([ Input() ], LogoComponent.prototype, "hide", void 0); LogoComponent = __decorate([ Component({ selector: 'app-logo', template: "<!-- Logo -->\n<a href=\"#\" routerLink=\"/\" class=\"logo\"> <!-- mini logo for sidebar mini 50x50 pixels -->\n\t<ng-container *ngIf=\"hide !== 'mini'\">\n\t\t<ng-container *ngIf=\"logo?.html_mini; else oldsyntaxmini\">\n\t\t\t<span class=\"logo-mini\" [innerHtml]=\"logo?.html_mini | safeHtml\"></span>\n\t\t</ng-container>\n\t\t<ng-template #oldsyntaxmini>\n\t\t\t<span class=\"logo-mini\"><b>{{logo.small.bold}}</b>{{logo.small.normal}}</span> <!-- logo for regular state and mobile devices -->\n\t\t</ng-template>\n\t</ng-container>\n\n\t<ng-container *ngIf=\"hide !== 'lg'\">\n\t\t<ng-container *ngIf=\"logo?.html_lg; else oldsyntaxlg\">\n\t\t\t<span class=\"logo-lg\" [innerHtml]=\"logo?.html_lg | safeHtml\"></span>\n\t\t</ng-container>\n\t\t<ng-template #oldsyntaxlg>\n\t\t\t<span class=\"logo-lg\" ><b>{{logo.big.bold}}</b>{{logo.big.normal}}</span>\n\t\t</ng-template>\n\t</ng-container>\n</a>\n" }) ], LogoComponent); let AppFooterComponent = class AppFooterComponent { constructor(footerServ) { this.footerServ = footerServ; this.footer = {}; this.footerServ.getCurrent().subscribe(footer => this.footer = footer); } }; AppFooterComponent.ctorParameters = () => [ { type: FooterService } ]; AppFooterComponent = __decorate([ Component({ selector: 'app-footer', template: "<!-- Main Footer -->\n<footer class=\"main-footer\">\n\t<!-- To the right -->\n\t<div class=\"pull-right hidden-xs\" [innerHTML]=\"footer?.right_part | safeHtml\"></div>\n\t<!-- Default to the left -->\n\t<div [innerHtml]=\"footer?.left_part | safeHtml\"></div>\n</footer>\n", styles: [""] }) ], AppFooterComponent); let MenuAsideComponent = class MenuAsideComponent { constructor(userServ, router) { this.userServ = userServ; this.router = router; this.currentUser = new User(); this.links = []; this.display_menu_user = true; this.display_menu_search = true; // getting the current url this.router.events.subscribe((evt) => this.currentUrl = evt.url); this.userServ.getCurrent().subscribe((user) => this.currentUser = user); } ngOnInit() { } }; MenuAsideComponent.ctorParameters = () => [ { type: UserService }, { type: Router } ]; __decorate([ Input() ], MenuAsideComponent.prototype, "links", void 0); __decorate([ Input() ], MenuAsideComponent.prototype, "display_menu_user", void 0); __decorate([ Input() ], MenuAsideComponent.prototype, "display_menu_search", void 0); MenuAsideComponent = __decorate([ Component({ selector: 'app-menu-aside', template: "<!-- Left side column. contains the logo and sidebar -->\n<aside class=\"main-sidebar\">\n\t<!-- sidebar: style can be found in sidebar.less -->\n\t<section class=\"sidebar\" >\n\t\t<!-- Sidebar user panel (optional) -->\n\t\t<div *ngIf=\"display_menu_user\" class=\"user-panel\">\n\t\t\t<div class=\"pull-left image\" *ngIf=\"currentUser?.avatarUrl\" >\n\t\t\t\t<img [src]=\"currentUser?.avatarUrl\" class=\"img-circle\"\n\t\t\t\t\t[alt]=\"currentUser?.getName()\">\n\t\t\t</div>\n\t\t\t<div class=\"pull-left info\">\n\t\t\t\t<p>{{currentUser?.getName()}}</p>\n\t\t\t\t<!-- Status -->\n\t\t\t\t<a href=\"#\"><i class=\"fa fa-circle text-success\"></i> Online</a>\n\t\t\t</div>\n\t\t</div>\n\t\t<!-- search form (Optional) -->\n\t\t<form *ngIf=\"display_menu_search\" action=\"#\" method=\"get\" class=\"sidebar-form\">\n\t\t\t<div class=\"input-group\">\n\t\t\t\t<input type=\"text\" name=\"q\" class=\"form-control\"\n\t\t\t\t\tplaceholder=\"Search...\"> <span class=\"input-group-btn\">\n\t\t\t\t\t<button type=\"submit\" name=\"search\" id=\"search-btn\"\n\t\t\t\t\t\tclass=\"btn btn-flat\">\n\t\t\t\t\t\t<i class=\"fa fa-search\"></i>\n\t\t\t\t\t</button>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</form>\n\t\t<!-- /.search form -->\n\t\t<!-- Sidebar Menu -->\n\t\t<ul class=\"sidebar-menu\" data-widget=\"tree\">\n\t\t\t<ng-container *ngFor=\"let item of links\">\n\t\t\t\t<!-- HEADER -->\n\t\t\t\t<ng-container *ngIf=\"item.header\">\n\t\t\t\t\t<li class=\"header\">{{item.header}}</li>\n\t\t\t\t</ng-container>\n\t\t\t\t<!-- COMPONENT -->\n\t\t\t\t<ng-container *ngIf=\"item.class\">\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<app-component-loader [class_component]=\"item.class\" [data]=\"item.data\"></app-component-loader>\n\t\t\t\t\t</li>\n\t\t\t\t</ng-container>\n\t\t\t\t<!-- LINK -->\n\t\t\t\t<ng-container *ngIf=\"item.link\">\n\t\t\t\t\t<li [class.active]=\"item.link[0] === currentUrl\">\n\t\t\t\t\t\t<a *ngIf=\"!item.external\" [routerLink]=\"item.link\">\n\t\t\t\t\t\t\t<i class=\"fa fa-{{item.icon}}\"></i>\n\t\t\t\t\t\t\t<span>{{item.title}}</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<a *ngIf=\"item.external\" [href]=\"item.link\" [target]=\"item.target\">\n\t\t\t\t\t\t\t<i class=\"fa fa-{{item.icon}}\"></i>\n\t\t\t\t\t\t\t<span>{{item.title}}</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ng-container>\n\t\t\t\t<!-- LINK WITH SUBLINKS -->\n\t\t\t\t<ng-container *ngIf=\"item.sublinks\">\n\t\t\t\t\t<li class=\"treeview\">\n\t\t\t\t\t\t<a href=\"#\">\n\t\t\t\t\t\t\t<i *ngIf=\"item.icon\" class=\"fa fa-{{item.icon}}\"></i>\n\t\t\t\t\t\t\t<span>{{item.title}}</span>\n\t\t\t\t\t\t\t<span class=\"pull-right-container\">\n\t\t\t\t\t\t\t\t<i class=\"fa fa-angle-left pull-right\"></i>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<!--i class=\"fa fa-angle-left pull-right\"></i-->\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<ul class=\"treeview-menu\">\n\t\t\t\t\t\t\t<ng-container *ngFor=\"let subitem of item.sublinks\">\n\t\t\t\t\t\t\t\t<li [class.active]=\"subitem.link[0] === currentUrl\">\n\t\t\t\t\t\t\t\t\t<a *ngIf=\"!subitem.external\" [routerLink]=\"subitem.link\">\n\t\t\t\t\t\t\t\t\t\t<i *ngIf=\"subitem.icon\" class=\"fa fa-{{subitem.icon}}\"></i>\n\t\t\t\t\t\t\t\t\t\t<span>{{subitem.title}}</span>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t<a *ngIf=\"subitem.external\" [href]=\"subitem.link\" [target]=\"subitem.target\">\n\t\t\t\t\t\t\t\t\t\t<i *ngIf=\"subitem.icon\" class=\"fa fa-{{subitem.icon}}\"></i>\n\t\t\t\t\t\t\t\t\t\t<span>{{subitem.title}}</span>\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</ng-container>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</li>\n\t\t\t\t</ng-container>\n\t\t\t</ng-container>\n\t\t</ul>\n\t\t<!-- /.sidebar-menu -->\n\t</section>\n\t<!-- /.sidebar -->\n</aside>\n", styles: [""] }) ], MenuAsideComponent); let ControlSidebarComponent = class ControlSidebarComponent { constructor(_sidebar) { this._sidebar = _sidebar; } ngOnInit() { const sub = this._sidebar.getItems().subscribe(items => { this.items = items; }); this.subs = []; this.subs.push(sub); } ngOnDestroy() { this.subs.forEach((sub) => sub.unsubscribe()); this.subs = null; this.items = null; } }; ControlSidebarComponent.ctorParameters = () => [ { type: ControlSidebarService } ]; ControlSidebarComponent = __decorate([ Component({ selector: 'app-control-sidebar', template: "<!-- Control Sidebar -->\n<aside [ngClass]=\"{\n\t'control-sidebar': true,\n\t'control-sidebar-dark': true,\n\t'control-sidebar-open': _sidebar.getState() | async\n}\">\n <!-- Create the tabs -->\n <ul class=\"nav nav-tabs nav-justified control-sidebar-tabs\">\n <ng-container *ngFor=\"let item of items\">\n <li [ngClass]=\"{'active': item.active}\">\n <a href=\"{{ item.id }}\" data-toggle=\"tab\"><i class=\"fa fa-{{ item.icon }}\"></i></a>\n </li>\n </ng-container>\n </ul>\n <!-- Tab panes -->\n <div class=\"tab-content\">\n <ng-container *ngFor=\"let item of items\">\n <!-- Home tab content -->\n <div [ngClass]=\"{'active': item.active, 'tab-pane': true}\" id=\"{{ item.id }}\">\n <ng-container *ngFor=\"let subitem of item.items\">\n <!-- COMPONENT -->\n <ng-container *ngIf=\"subitem.class\">\n <li>\n <app-component-loader [class_component]=\"subitem.class\" [data]=\"subitem.data\"></app-component-loader>\n </li>\n </ng-container>\n <ng-container *ngIf=\"subitem.html\">\n {{ subitem.html | safeHtml }}\n </ng-container>\n </ng-container>\n </div>\n </ng-container>\n </div>\n</aside>\n<!-- /.control-sidebar -->\n<!-- Add the sidebar's background. This div must be placed\n immediately after the control sidebar -->\n<div class=\"control-sidebar-bg\"></div>", styles: [""] }) ], ControlSidebarComponent); let MessagesBoxComponent = class MessagesBoxComponent { constructor(msgServ, logger) { this.msgServ = msgServ; this.logger = logger; this.msgLength = { 0: 0 }; this.messages = []; } ngOnInit() { // Every incoming message changes entire local message Array. this.msgServ.messages.subscribe((msg) => { this.logger.log('MsgBox', null, 'RECEIVED.MESSAGE', null); this.messages = msg; this.msgLength = { 0: this.messages.length }; }); } }; MessagesBoxComponent.ctorParameters = () => [ { type: MessagesService }, { type: LoggerService } ]; MessagesBoxComponent = __decorate([ Component({ /* tslint:disable */ selector: '.messagesBox', template: "<!-- Menu toggle button -->\n<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"> <i\n\tclass=\"fa fa-envelope-o\"></i> <span class=\"label label-success\"\n\t[innerHTML]=\"messages.length\"></span>\n</a>\n<ul class=\"dropdown-menu\">\n\t<li class=\"header\">{{ 'MSGBOX.COUNT' | translate:msgLength }}</li>\n\t<li>\n\t\t<!-- inner menu: contains the messages -->\n\t\t<ul class=\"menu\">\n\t\t\t<li *ngFor=\"let msg of messages; let i = index\">\n\t\t\t\t<!-- start message --> <a href=\"#\">\n\t\t\t\t\t<div class=\"pull-left\">\n\t\t\t\t\t\t<!-- User Image -->\n\t\t\t\t\t\t<img src=\"{{msg.author.avatarUrl}}\" class=\"img-circle\"\n\t\t\t\t\t\t\talt=\"{{ msg.author.getName() }}\">\n\t\t\t\t\t</div> <!-- Message title and timestamp -->\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t{{msg.title}} <small><i class=\"fa fa-clock-o\"></i>\n\t\t\t\t\t\t\t{{msg.date | date:'yMd' }}</small>\n\t\t\t\t\t</h4> <!-- The message -->\n\t\t\t\t\t<p>{{msg.content}}</p>\n\t\t\t</a>\n\t\t\t</li>\n\t\t\t<!-- end message -->\n\t\t</ul> <!-- /.menu -->\n\t</li>\n\t<li class=\"footer\">\n <a href=\"#\">{{ 'MSGBOX.FOOTER' | translate }}</a>\n </li>\n</ul>\n", styles: [""] }) ], MessagesBoxComponent); let NotificationBoxComponent = class NotificationBoxComponent { constructor(notifServ, logger) { this.notifServ = notifServ; this.logger = logger; this.notifLength = { 0: 0 }; this.notifications = []; } ngOnInit() { // Every incoming notification changes entire local notification Array. this.notifServ.notifications.subscribe((notif) => { this.logger.log('NotificationBox', null, 'RECEIVED.NOTIFICATION', null); this.notifications = notif; this.notifLength = { 0: this.notifications.length }; }); } }; NotificationBoxComponent.ctorParameters = () => [ { type: NotificationsService }, { type: LoggerService } ]; NotificationBoxComponent = __decorate([ Component({ /* tslint:disable */ selector: '.notificationsBox', template: "<!-- Menu toggle button -->\n<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n\t<i class=\"fa fa-bell-o\"></i>\n\t<span class=\"label label-warning\">{{ notifications.length }}</span>\n</a>\n<ul class=\"dropdown-menu\">\n\t<li class=\"header\">{{ 'NOTIFBOX.COUNT' | translate:notifLength }}</li>\n\t<li>\n\t\t<!-- Inner Menu: contains the notifications -->\n\t\t<ul class=\"menu\">\n\t\t\t<li *ngFor=\"let notif of notifications.reverse(); let i = index\">\n\t\t\t\t<a routerLink=\"{{notif.link}}\">\n\t\t\t\t\t<i class=\"{{notif.class}}\"></i> {{notif.content}}\n\t\t\t\t</a>\n\t\t\t</li>\n\t\t\t<!-- end notification -->\n\t\t</ul>\n\t</li>\n\t<li class=\"footer\">\n\t\t<a href=\"#\">\n\t\t\t{{ 'NOTIFBOX.FOOTER' | translate }}\n\t\t</a>\n\t</li>\n</ul>\n", styles: [""] }) ], NotificationBoxComponent); let TasksBoxComponent = class TasksBoxComponent { constructor() { this.tasksLength = { 0: 0 }; } ngOnInit() { } }; __decorate([ Input() ], TasksBoxComponent.prototype, "user", void 0); TasksBoxComponent = __decorate([ Component({ /* tslint:disable */ selector: '.tasksBox', template: "<!-- Menu Toggle Button -->\n<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\"> <i\n\tclass=\"fa fa-flag-o\"></i> <span class=\"label label-danger\">9</span>\n</a>\n<ul class=\"dropdown-menu\">\n\t<li class=\"header\">{{ 'TASKBOX.COUNT' | translate:tasksLength }}</li>\n\t<li>\n\t\t<!-- Inner menu: contains the tasks -->\n\t\t<ul class=\"menu\">\n\t\t\t<li>\n\t\t\t\t<!-- Task item --> <a href=\"#\"> <!-- Task title and progress text -->\n\t\t\t\t\t<h3>\n\t\t\t\t\t\tDesign some buttons <small class=\"pull-right\">20%</small>\n\t\t\t\t\t</h3> <!-- The progress bar -->\n\t\t\t\t\t<div class=\"progress xs\">\n\t\t\t\t\t\t<!-- Change the css width attribute to simulate progress -->\n\t\t\t\t\t\t<div class=\"progress-bar progress-bar-aqua\" style=\"width: 20%\"\n\t\t\t\t\t\t\trole=\"progressbar\" aria-valuenow=\"20\" aria-valuemin=\"0\"\n\t\t\t\t\t\t\taria-valuemax=\"100\">\n\t\t\t\t\t\t\t<span class=\"sr-only\">20% Complete</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t</a>\n\t\t\t</li>\n\t\t\t<!-- end task item -->\n\t\t</ul>\n\t</li>\n\t<li class=\"footer\"><a href=\"#\">{{ 'TASKBOX.FOOTER' | translate\n\t\t\t}}</a></li>\n</ul>\n", styles: [""] }) ], TasksBoxComponent); let UserBoxComponent = class UserBoxComponent { constructor(userServ, router) { this.userServ = userServ; this.router = router; // default user, only an example, please use the userService to modify this.currentUser = new User({ avatarUrl: 'assets/img/user2-160x160.jpg', email: 'weber.antoine@outlook.com', firstname: 'WEBER', lastname: 'Antoine' }); this.logout = () => { this.userServ.logout(); }; // se connecter au modif du user courant this.userServ.getCurrent().subscribe((user) => this.currentUser = user); } ngOnInit() { // TODO } }; UserBoxComponent.ctorParameters = () => [ { type: UserService }, { type: Router } ]; UserBoxComponent = __decorate([ Component({ /* tslint:disable */ selector: '.userBox', template: "<!-- Menu Toggle Button -->\n<a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n <!-- The user image in the navbar-->\n <img *ngIf=\"currentUser.avatarUrl != ''\" [src]=\"currentUser.avatarUrl\" class=\"user-image\" [alt]=\"currentUser.getName()\">\n <!-- hidden-xs hides the username on small devices so only the image appears. -->\n <span class=\"hidden-xs\">{{currentUser.getName()}}</span>\n</a>\n<ul class=\"dropdown-menu\">\n <!-- The user image in the menu -->\n <li class=\"user-header\">\n <img *ngIf=\"currentUser.avatarUrl != ''\" [src]=\"currentUser.avatarUrl\" class=\"img-circle\" [alt]=\"currentUser.getName()\">\n <p>\n {{currentUser.getName()}} - Web Developer\n <small>{{ 'USERBOX.MEMBERSINCE' | translate }} {{currentUser.creationDate}}</small>\n </p>\n </li>\n <!-- Menu Body -->\n <li class=\"user-body\">\n <div class=\"col-xs-4 text-center\">\n <a href=\"#\">Followers</a>\n </div>\n <div class=\"col-xs-4 text-center\">\n <a href=\"#\">Sales</a>\n </div>\n <div class=\"col-xs-4 text-center\">\n <a href=\"#\">Friends</a>\n </div>\n </li>\n <!-- Menu Footer-->\n <li class=\"user-footer\">\n <div class=\"pull-left\">\n <a href=\"#\" class=\"btn btn-default btn-flat\">{{ 'USERBOX.PROFILE' | translate }}</a>\n </div>\n <div class=\"pull-right\">\n <a (click)=\"logout()\" class=\"btn btn-default btn-flat\">{{ 'USERBOX.SIGNOUT' | translate }}</a>\n </div>\n </li>\n</ul>\n", styles: [""] }) ], UserBoxComponent); let BreadcrumbComponent = class BreadcrumbComponent { constructor(breadServ) { this.breadServ = breadServ; this.display = false; this.header = ''; this.description = ''; this.levels = []; // getting the data from the services this.breadServ.getCurrent().subscribe((data) => { this.display = data.display; this.header = data.header; this.description = data.description; this.levels = data.levels; }); } }; BreadcrumbComponent.ctorParameters = () => [ { type: BreadcrumbService } ]; BreadcrumbComponent = __decorate([ Component({ selector: 'app-breadcrumb', template: "<section class=\"content-header\" *ngIf=\"display\">\n <h1>\n {{ header }}\n <small>{{ description }}</small>\n </h1>\n <ol class=\"breadcrumb\">\n <ng-container *ngFor=\"let item of levels\">\n <li [class.active]=\"item.active\">\n <a [routerLink]=\"item.link\">\n <i *ngIf=\"item.icon !=null\" class=\"fa fa-{{item.icon}}\"></i> {{ item.title }}\n </a>\n </li>\n </ng-container>\n </ol>\n</section>\n" }) ], BreadcrumbComponent); /** * Component to dynamicly load other component */ let ComponentLoaderComponent = class ComponentLoaderComponent { /** * Component initialisation */ constructor(_factoryResolver) { this._factoryResolver = _factoryResolver; /** * class of the component to load */ this.class_component = null; /** * data to pass to component */ this.data = null; /** * component reference */ this.componentRef = null; } /** * Lifecycle hook OnInit */ ngOnInit() { // Build the child component const factory = this._factoryResolver.resolveComponentFactory(this.class_component); this.componentRef = this.viewContainerRef.createComponent(factory); // then give some data this.setComponentData(this.data); } /** * Lifecycle hook OnChanges, on modification of data send it to the child */ ngOnChanges(changes) { this.setComponentData(changes); } /** * Send data to the inner component */ setComponentData(changes) { if (this.componentRef) { // send data to component Object.assign(this.componentRef.instance, changes); // trigger component ngOnChange this.componentRef.instance.ngOnChanges(changes); } } /** * Lifecycle hook OnDestroy */ ngOnDestroy() { if (this.componentRef) { this.componentRef.destroy(); } } }; ComponentLoaderComponent.ctorParameters = () => [ { type: ComponentFactoryResolver } ]; __decorate([ Input() ], ComponentLoaderComponent.prototype, "class_component", void 0); __decorate([ Input() ], ComponentLoaderComponent.prototype, "data", void 0); __decorate([ ViewChild('destination', { read: ViewContainerRef, static: false }) ], ComponentLoaderComponent.prototype, "viewContainerRef", void 0); ComponentLoaderComponent = __decorate([ Component({ selector: 'app-component-loader', encapsulation: ViewEncapsulation.None, template: '<ng-container #destination ></ng-container>' }) ], ComponentLoaderComponent); // AoT requires an exported function for factories function HttpLoaderFactory(httpClient) { return new TranslateHttpLoader(httpClient, 'assets/i18n/', '.json'); } const ɵ0 = (HttpLoaderFactory); let NgxAdminLteModule = class NgxAdminLteModule { }; NgxAdminLteModule = __decorate([ NgModule({ declarations: [ // PIPES SafeHtmlPipe, // WIDGETS BreadcrumbComponent, AppHeaderComponent, LogoComponent, AppFooterComponent, MenuAsideComponent, ControlSidebarComponent, MessagesBoxComponent, NotificationBoxComponent, TasksBoxComponent, UserBoxComponent, ComponentLoaderComponent, // LAYOUTS LayoutAuthComponent, LayoutLoginComponent, LayoutRegisterComponent ], imports: [ BrowserModule, RouterModule, ToastrModule.forRoot({ timeOut: 10000, positionClass: 'toast-top-right', preventDuplicates: true, tapToDismiss: false, newestOnTop: true }), HttpClientModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: ɵ0, deps: [HttpClient] } }), ], exports: [ SafeHtmlPipe, ], providers: [ // SERVICES UserService, MenuService, LogoService, FooterService, BreadcrumbService, MessagesService, CanActivateGuard, NotificationsService, TranslateService, LoggerService, ControlSidebarService, ToastrService ] }) ], NgxAdminLteModule); /** * Generated bundle index. Do not edit. */ export { Breadcrum