UNPKG

angular-admin-lte

Version:
1,046 lines (1,027 loc) 161 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('rxjs'), require('@angular/platform-browser'), require('rxjs/operators'), require('@angular/forms')) : typeof define === 'function' && define.amd ? define('angular-admin-lte', ['exports', '@angular/core', '@angular/common', '@angular/router', 'rxjs', '@angular/platform-browser', 'rxjs/operators', '@angular/forms'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['angular-admin-lte'] = {}, global.ng.core, global.ng.common, global.ng.router, global.rxjs, global.ng.platformBrowser, global.rxjs.operators, global.ng.forms)); }(this, (function (exports, core, common, router, rxjs, platformBrowser, operators, forms) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); }; } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function () { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function (o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } }); }) : (function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; } ; var __setModuleDefault = Object.create ? (function (o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function (o, v) { o["default"] = v; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } var RoutingService = /** @class */ (function () { function RoutingService(router) { this.router = router; this.onChange = new rxjs.BehaviorSubject(undefined); this.events = new rxjs.BehaviorSubject(undefined); this.init(); } RoutingService.createUrl = function (route) { var url = route.url.map(function (urlSegment) { return urlSegment.toString(); }).join('/'); return url; }; RoutingService.isChildrenSelfRoute = function (route) { var _a, _b; var test = false; (_b = (_a = route === null || route === void 0 ? void 0 : route.routeConfig) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.forEach(function (child) { if (child.path === '' && (child.component || child.loadChildren)) { test = true; } }); return test; }; RoutingService.createBreadcrumb = function (route, url) { var _a, _b, _c, _d; var isUrl = true; if (route.children.length !== 0 && ((_b = (_a = route === null || route === void 0 ? void 0 : route.firstChild) === null || _a === void 0 ? void 0 : _a.routeConfig) === null || _b === void 0 ? void 0 : _b.path)) { if (url !== '/' && !((_c = route === null || route === void 0 ? void 0 : route.routeConfig) === null || _c === void 0 ? void 0 : _c.loadChildren) && !((_d = route === null || route === void 0 ? void 0 : route.routeConfig) === null || _d === void 0 ? void 0 : _d.component) && !RoutingService.isChildrenSelfRoute(route)) { isUrl = false; } } return { data: route.data, params: route.params, url: isUrl ? url : null }; }; RoutingService.prototype.init = function () { var _this = this; this.router.events.subscribe(function (routeEvent) { var _a; // https://github.com/angular/angular/issues/17473: event not fired anymore on load for routed component. if (routeEvent instanceof router.NavigationEnd) { _this.events.next(routeEvent); var route = _this.router.routerState.root.snapshot; var tmpUrl = ''; var url = ''; var rootRoot = true; var paths = []; while (route.children.length) { route = route.firstChild || route; tmpUrl = "/" + RoutingService.createUrl(route); if (route.outlet !== router.PRIMARY_OUTLET || (!((_a = route === null || route === void 0 ? void 0 : route.routeConfig) === null || _a === void 0 ? void 0 : _a.path) && !rootRoot)) { continue; } rootRoot = false; if (route.params && route.data) { for (var key in route.params) { if (!key) { continue; } if (route.data.hasOwnProperty('title')) { route.data.title = route.data.title.replace(":" + key, route.params[key]); route.data.title = route.data.title.replace(":" + key, route.params[key]); } if (route.data.hasOwnProperty('breadcrumbs')) { route.data.breadcrumbs = route.data.breadcrumbs.replace(":" + key, route.params[key]); } if (route.data.hasOwnProperty('description')) { route.data.description = route.data.description.replace(":" + key, route.params[key]); } } } if (tmpUrl === '/') { paths.push(RoutingService.createBreadcrumb(route, tmpUrl)); } else { url += tmpUrl; paths.push(RoutingService.createBreadcrumb(route, url)); } } _this.onChange.next(paths); } }); }; return RoutingService; }()); RoutingService.decorators = [ { type: core.Injectable } ]; RoutingService.ctorParameters = function () { return [ { type: router.Router } ]; }; var BreadcrumbsComponent = /** @class */ (function () { function BreadcrumbsComponent(routingService, changeDetectorRef) { this.routingService = routingService; this.changeDetectorRef = changeDetectorRef; this.homeIcon = 'fa fa-home'; } BreadcrumbsComponent.prototype.ngOnInit = function () { var _this = this; this.subscription = this.routingService.onChange.subscribe(function (paths) { _this.breadcrumbs = paths; }); }; BreadcrumbsComponent.prototype.ngOnDestroy = function () { if (this.subscription) { this.subscription.unsubscribe(); } }; return BreadcrumbsComponent; }()); BreadcrumbsComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-breadcrumbs', template: "<ol class=\"breadcrumb\">\n <li *ngFor=\"let breadcrumb of breadcrumbs; let first = first; let last = last\" [class.active]=\"last || !breadcrumb.url\">\n <a *ngIf=\"breadcrumb.url && !last; else noLink\" [routerLink]=\"breadcrumb.url\">\n <i *ngIf=\"first\" ngClass=\"{{homeIcon}}\"></i>\n <ng-template [ngIf]=\"breadcrumb.data.breadcrumbs\">{{breadcrumb.data.breadcrumbs}}</ng-template>\n <ng-template [ngIf]=\"breadcrumb.data.title\">{{breadcrumb.data.title}}</ng-template>\n </a>\n <ng-template #noLink>\n <i *ngIf=\"first\" ngClass=\"{{homeIcon}}\"></i>\n <ng-template [ngIf]=\"breadcrumb.data.breadcrumbs\">{{breadcrumb.data.breadcrumbs}}</ng-template>\n <ng-template [ngIf]=\"breadcrumb.data.title\">{{breadcrumb.data.title}}</ng-template>\n </ng-template>\n </li>\n</ol>\n", styles: [".breadcrumb{background:transparent;border-radius:2px;float:right;font-size:12px;margin-bottom:0;margin-top:0;padding:7px 5px;position:absolute;right:10px;top:15px}.breadcrumb>li>a{color:#444;display:inline-block;text-decoration:none}.breadcrumb>li .fa,.breadcrumb>li .glyphicon,.breadcrumb>li .ion{margin-right:5px}"] },] } ]; BreadcrumbsComponent.ctorParameters = function () { return [ { type: RoutingService }, { type: core.ChangeDetectorRef } ]; }; BreadcrumbsComponent.propDecorators = { homeIcon: [{ type: core.Input }] }; var BreadcrumbsModule = /** @class */ (function () { function BreadcrumbsModule() { } return BreadcrumbsModule; }()); BreadcrumbsModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule, router.RouterModule], exports: [BreadcrumbsComponent], declarations: [BreadcrumbsComponent] },] } ]; var LayoutState = /** @class */ (function () { function LayoutState(config) { this.isSidebarLeftCollapsed = false; this.isSidebarLeftExpandOnOver = false; this.isSidebarLeftMouseOver = false; this.isSidebarLeftMini = true; this.sidebarRightSkin = 'dark'; this.isSidebarRightCollapsed = true; this.isSidebarRightOverContent = true; this.layout = 'normal'; this.sidebarLeftMenu = []; this.sidebarLeftMenuActiveUrl = ''; this.skin = 'blue'; Object.assign(this, config); } return LayoutState; }()); var LayoutStore = /** @class */ (function () { function LayoutStore(layoutConfig) { this.initialLayoutState = new LayoutState(layoutConfig); this.state = new rxjs.BehaviorSubject(this.initialLayoutState); this.layoutState = this.state.asObservable(); } Object.defineProperty(LayoutStore.prototype, "windowInnerHeight", { get: function () { return this.layoutState.pipe(operators.pluck('windowInnerHeight'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "windowInnerWidth", { get: function () { return this.layoutState.pipe(operators.pluck('windowInnerWidth'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarLeftCollapsed", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarLeftCollapsed'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarLeftExpandOnOver", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarLeftExpandOnOver'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarLeftMouseOver", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarLeftMouseOver'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarLeftMini", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarLeftMini'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "sidebarRightSkin", { get: function () { return this.layoutState.pipe(operators.pluck('sidebarRightSkin'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarRightCollapsed", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarRightCollapsed'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "isSidebarRightOverContent", { get: function () { return this.layoutState.pipe(operators.pluck('isSidebarRightOverContent'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "sidebarLeftMenu", { get: function () { return this.layoutState.pipe(operators.pluck('sidebarLeftMenu'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "sidebarLeftMenuActiveUrl", { get: function () { return this.layoutState.pipe(operators.pluck('sidebarLeftMenuActiveUrl'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "sidebarLeftElementHeight", { get: function () { return this.layoutState.pipe(operators.pluck('sidebarLeftElementHeight'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "layout", { get: function () { return this.layoutState.pipe(operators.pluck('layout'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); Object.defineProperty(LayoutStore.prototype, "skin", { get: function () { return this.layoutState.pipe(operators.pluck('skin'), operators.distinctUntilChanged()); }, enumerable: false, configurable: true }); LayoutStore.prototype.sidebarLeftCollapsed = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarLeftCollapsed: value })); }; LayoutStore.prototype.sidebarLeftExpandOnOver = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarLeftExpandOnOver: value })); }; LayoutStore.prototype.setSidebarLeftElementHeight = function (value) { this.state.next(Object.assign(this.state.value, { sidebarLeftElementHeight: value })); }; LayoutStore.prototype.setSidebarRightSkin = function (value) { this.state.next(Object.assign(this.state.value, { sidebarRightSkin: value })); }; LayoutStore.prototype.sidebarLeftMouseOver = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarLeftMouseOver: value })); }; LayoutStore.prototype.sidebarLeftMini = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarLeftMini: value })); }; LayoutStore.prototype.sidebarRightCollapsed = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarRightCollapsed: value })); }; LayoutStore.prototype.sidebarRightOverContent = function (value) { this.state.next(Object.assign(this.state.value, { isSidebarRightOverContent: value })); }; LayoutStore.prototype.setSidebarLeftMenu = function (value) { this.state.next(Object.assign(this.state.value, { sidebarLeftMenu: value })); }; LayoutStore.prototype.setSidebarLeftMenuActiveUrl = function (value) { this.state.next(Object.assign(this.state.value, { sidebarLeftMenuActiveUrl: value })); }; LayoutStore.prototype.setLayout = function (value) { this.state.next(Object.assign(this.state.value, { layout: value })); }; LayoutStore.prototype.setSkin = function (value) { this.state.next(Object.assign(this.state.value, { skin: value })); }; LayoutStore.prototype.setWindowInnerHeight = function (value) { this.state.next(Object.assign(this.state.value, { windowInnerHeight: value })); }; LayoutStore.prototype.setWindowInnerWidth = function (value) { this.state.next(Object.assign(this.state.value, { windowInnerWidth: value })); }; return LayoutStore; }()); var SidebarRightService = /** @class */ (function () { function SidebarRightService() { } Object.defineProperty(SidebarRightService.prototype, "scrollHeight", { get: function () { return this.elementRef ? this.elementRef.nativeElement.scrollHeight : 0; }, enumerable: false, configurable: true }); return SidebarRightService; }()); SidebarRightService.decorators = [ { type: core.Injectable } ]; var HeaderService = /** @class */ (function () { function HeaderService() { } Object.defineProperty(HeaderService.prototype, "offsetHeight", { get: function () { return this.elementRef ? this.elementRef.nativeElement.offsetHeight : 0; }, enumerable: false, configurable: true }); return HeaderService; }()); HeaderService.decorators = [ { type: core.Injectable } ]; var FooterService = /** @class */ (function () { function FooterService() { } Object.defineProperty(FooterService.prototype, "offsetHeight", { get: function () { return this.elementRef ? this.elementRef.nativeElement.offsetHeight : 0; }, enumerable: false, configurable: true }); return FooterService; }()); FooterService.decorators = [ { type: core.Injectable } ]; function throttle(callback, delay) { var _this = this; var timeout = 0; return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (!timeout) { timeout = setTimeout(function () { // @ts-ignore callback.call.apply(callback, __spread([_this], args)); timeout = 0; }, delay); } }; } function removeSubscriptions(subscriptions) { if (subscriptions) { subscriptions.forEach(function (subscription) { subscription.unsubscribe(); }); } return []; } function removeListeners(listeners) { if (listeners === void 0) { listeners = []; } if (listeners) { listeners.forEach(function (listener) { listener(); }); } return []; } var ContentComponent = /** @class */ (function () { function ContentComponent(layoutStore, routingService, titleService, elementRef, changeDetectorRef, sidebarRightService, headerService, footerService, router) { this.layoutStore = layoutStore; this.routingService = routingService; this.titleService = titleService; this.elementRef = elementRef; this.changeDetectorRef = changeDetectorRef; this.sidebarRightService = sidebarRightService; this.headerService = headerService; this.footerService = footerService; this.router = router; this.navigationEnd = false; this.subscriptions = []; } ContentComponent.prototype.ngOnInit = function () { var _this = this; this.titleTag = this.titleService.getTitle(); this.subscriptions.push(this.routingService.onChange.subscribe(function (value) { if (value && value[value.length - 1] && value[value.length - 1].data) { var data = value[value.length - 1].data; _this.titleService.setTitle(_this.getTitle(data.title) || ''); _this.header = data.title; _this.description = data.description; } _this.changeDetectorRef.markForCheck(); })); this.subscriptions.push(this.router.events.subscribe(function (routeEvent) { if (routeEvent instanceof router.NavigationStart) { _this.navigationEnd = false; } if (routeEvent instanceof router.NavigationEnd) { _this.navigationEnd = true; _this.setContentMinHeight(); } })); this.subscriptions.push(this.layoutStore.sidebarLeftElementHeight.subscribe(function (value) { _this.sidebarLeftHeight = value; _this.setContentMinHeight(); })); this.subscriptions.push(this.layoutStore.layout.subscribe(function (value) { _this.layout = value; _this.setContentMinHeight(); })); this.subscriptions.push(this.layoutStore.windowInnerHeight.subscribe(function (value) { _this.windowInnerHeight = value; _this.setContentMinHeight(); })); this.heightStyle = this.windowInnerHeight; }; ContentComponent.prototype.ngOnDestroy = function () { this.subscriptions = removeSubscriptions(this.subscriptions); }; Object.defineProperty(ContentComponent.prototype, "scrollHeight", { get: function () { return this.contentInnerElement.nativeElement.scrollHeight; }, enumerable: false, configurable: true }); ContentComponent.prototype.getTitle = function (title) { return title ? title + " - " + this.titleTag : this.titleTag; }; ContentComponent.prototype.setContentMinHeight = function () { if (this.navigationEnd) { var heightStyle = 0; var headerFooterOffsetHeight = this.headerService.offsetHeight + this.footerService.offsetHeight; if (this.layout === 'fixed' && this.windowInnerHeight) { heightStyle = this.windowInnerHeight - this.footerService.offsetHeight; } else if (this.windowInnerHeight && this.sidebarLeftHeight) { var sidebarRight = this.sidebarRightService.scrollHeight ? this.sidebarRightService.scrollHeight - this.headerService.offsetHeight : 0; heightStyle = Math.max(this.windowInnerHeight - headerFooterOffsetHeight, this.sidebarLeftHeight - this.headerService.offsetHeight, sidebarRight); } if (heightStyle && heightStyle !== this.heightStyle) { if (this.scrollHeight > heightStyle) { heightStyle = 0; } this.heightStyle = heightStyle; this.changeDetectorRef.detectChanges(); } } }; return ContentComponent; }()); ContentComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-content', template: "<div class=\"content-wrapper\" [style.min-height.px]=\"heightStyle\">\n <div #contentInnerElement class=\"content-inner\">\n <ng-content select=\"[mk-layout-content-before-header]\"></ng-content>\n <section *ngIf=\"header || description\" class=\"content-header\">\n <h1>\n {{header}}\n <small *ngIf=\"description\">{{description}}</small>\n </h1>\n <mk-breadcrumbs></mk-breadcrumbs>\n </section>\n <ng-content select=\"[mk-layout-content-after-header]\"></ng-content>\n <section class=\"content\">\n <ng-content></ng-content>\n </section>\n </div>\n</div>\n", changeDetection: core.ChangeDetectionStrategy.OnPush, styles: [":host{display:block}.content-wrapper{position:relative}"] },] } ]; ContentComponent.ctorParameters = function () { return [ { type: LayoutStore }, { type: RoutingService }, { type: platformBrowser.Title }, { type: core.ElementRef }, { type: core.ChangeDetectorRef }, { type: SidebarRightService }, { type: HeaderService }, { type: FooterService }, { type: router.Router } ]; }; ContentComponent.propDecorators = { contentInnerElement: [{ type: core.ViewChild, args: ['contentInnerElement', { static: true },] }] }; var ContentModule = /** @class */ (function () { function ContentModule() { } return ContentModule; }()); ContentModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule, router.RouterModule, BreadcrumbsModule], exports: [ContentComponent], declarations: [ContentComponent] },] } ]; var FooterLeftComponent = /** @class */ (function () { function FooterLeftComponent() { } return FooterLeftComponent; }()); FooterLeftComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-footer-left', template: '<ng-template #templateRef><ng-content></ng-content></ng-template>' },] } ]; FooterLeftComponent.propDecorators = { templateRef: [{ type: core.ViewChild, args: ['templateRef', { static: true },] }] }; var FooterRightComponent = /** @class */ (function () { function FooterRightComponent() { } return FooterRightComponent; }()); FooterRightComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-footer-right', template: '<ng-template #templateRef><ng-content></ng-content></ng-template>' },] } ]; FooterRightComponent.propDecorators = { templateRef: [{ type: core.ViewChild, args: ['templateRef', { static: true },] }] }; var FooterComponent = /** @class */ (function () { function FooterComponent(elementRef, footerService) { this.elementRef = elementRef; this.footerService = footerService; } FooterComponent.prototype.ngOnInit = function () { this.footerService.elementRef = this.elementRef; }; return FooterComponent; }()); FooterComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-footer', template: "<footer class=\"main-footer\">\n <div class=\"pull-right hidden-xs\">\n <ng-template *ngIf=\"footerRightComponent\" [ngTemplateOutlet]=\"footerRightComponent.templateRef\"></ng-template>\n </div>\n <ng-template *ngIf=\"footerLeftComponent\" [ngTemplateOutlet]=\"footerLeftComponent.templateRef\"></ng-template>\n</footer>\n", styles: [":host{display:block}"] },] } ]; FooterComponent.ctorParameters = function () { return [ { type: core.ElementRef }, { type: FooterService } ]; }; FooterComponent.propDecorators = { footerLeftComponent: [{ type: core.ContentChild, args: [FooterLeftComponent,] }], footerRightComponent: [{ type: core.ContentChild, args: [FooterRightComponent,] }] }; var FooterModule = /** @class */ (function () { function FooterModule() { } return FooterModule; }()); FooterModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule], exports: [FooterComponent, FooterLeftComponent, FooterRightComponent], declarations: [FooterComponent, FooterLeftComponent, FooterRightComponent] },] } ]; var HeaderLogoComponent = /** @class */ (function () { function HeaderLogoComponent() { } return HeaderLogoComponent; }()); HeaderLogoComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-header-logo', template: '<ng-template #templateRef><ng-content></ng-content></ng-template>' },] } ]; HeaderLogoComponent.propDecorators = { templateRef: [{ type: core.ViewChild, args: ['templateRef', { static: true },] }] }; var HeaderLogoMiniComponent = /** @class */ (function () { function HeaderLogoMiniComponent() { } return HeaderLogoMiniComponent; }()); HeaderLogoMiniComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-header-logo-mini', template: '<ng-template #templateRef><ng-content></ng-content></ng-template>' },] } ]; HeaderLogoMiniComponent.propDecorators = { templateRef: [{ type: core.ViewChild, args: ['templateRef', { static: true },] }] }; var HeaderComponent = /** @class */ (function () { function HeaderComponent(layoutStore, ngZone, renderer2, elementRef, headerService) { this.layoutStore = layoutStore; this.ngZone = ngZone; this.renderer2 = renderer2; this.elementRef = elementRef; this.headerService = headerService; this.isSidebarLeftToggle = true; this.isSidebarRightToggle = true; this.logoLink = '/'; this.listeners = []; this.subscriptions = []; } HeaderComponent.prototype.ngAfterViewInit = function () { var _this = this; this.headerService.elementRef = this.headerElement; if (this.sidebarLeftToggleElement) { this.subscriptions.push(this.layoutStore.isSidebarLeftCollapsed.subscribe(function (value) { _this.isSidebarLeftCollapsed = value; })); this.ngZone.runOutsideAngular(function () { var _a; _this.listeners.push(_this.renderer2.listen((_a = _this.sidebarLeftToggleElement) === null || _a === void 0 ? void 0 : _a.nativeElement, 'click', function (event) { event.preventDefault(); _this.layoutStore.sidebarLeftCollapsed(!_this.isSidebarLeftCollapsed); })); }); } if (this.sidebarRightToggleElement) { this.subscriptions.push(this.layoutStore.isSidebarRightCollapsed.subscribe(function (value) { _this.isSidebarRightCollapsed = value; })); this.ngZone.runOutsideAngular(function () { var _a; _this.listeners.push(_this.renderer2.listen((_a = _this.sidebarRightToggleElement) === null || _a === void 0 ? void 0 : _a.nativeElement, 'click', function (event) { event.preventDefault(); _this.layoutStore.sidebarRightCollapsed(!_this.isSidebarRightCollapsed); })); }); } }; HeaderComponent.prototype.ngOnDestroy = function () { this.listeners = removeListeners(this.listeners); this.subscriptions = removeSubscriptions(this.subscriptions); }; return HeaderComponent; }()); HeaderComponent.decorators = [ { type: core.Component, args: [{ selector: 'mk-layout-header', template: "<header #headerElement class=\"main-header\">\n <a [routerLink]=\"logoLink\" class=\"logo\">\n <span class=\"logo-mini\" *ngIf=\"headerLogoMiniComponent\"><ng-template [ngTemplateOutlet]=\"headerLogoMiniComponent.templateRef\"></ng-template></span>\n <span class=\"logo-lg\" *ngIf=\"headerLogoComponent\"><ng-template [ngTemplateOutlet]=\"headerLogoComponent.templateRef\"></ng-template></span>\n </a>\n <nav class=\"navbar navbar-static-top\">\n <a *ngIf=\"isSidebarLeftToggle\" #sidebarLeftToggleElement href=\"#\" class=\"sidebar-toggle {{sidebarLeftToggleIconClasses ? 'sidebar-toggle-custom-icon' : ''}}\">\n <span class=\"sr-only\">Toggle navigation</span>\n <ng-container *ngIf=\"sidebarLeftToggleIconClasses\">\n <i [class]=\"sidebarLeftToggleIconClasses\"></i>\n </ng-container>\n </a>\n <div *ngIf=\"isSidebarRightToggle\" class=\"sidebar-right-toggle\">\n <a #sidebarRightToggleElement href=\"#\">\n <i [class]=\"sidebarRightToggleIconClasses ? sidebarRightToggleIconClasses : 'fa fa-gears'\"></i>\n </a>\n </div>\n <ng-content></ng-content>\n </nav>\n</header>\n", styles: [":host{display:block}.sidebar-right-toggle{float:right}.sidebar-right-toggle a{cursor:pointer;display:block;line-height:20px;padding:15px}.sidebar-toggle-custom-icon:before{content:\"\"}"] },] } ]; HeaderComponent.ctorParameters = function () { return [ { type: LayoutStore }, { type: core.NgZone }, { type: core.Renderer2 }, { type: core.ElementRef }, { type: HeaderService } ]; }; HeaderComponent.propDecorators = { isSidebarLeftToggle: [{ type: core.Input }], sidebarLeftToggleIconClasses: [{ type: core.Input }], isSidebarRightToggle: [{ type: core.Input }], sidebarRightToggleIconClasses: [{ type: core.Input }], logoLink: [{ type: core.Input }], headerLogoComponent: [{ type: core.ContentChild, args: [HeaderLogoComponent,] }], headerLogoMiniComponent: [{ type: core.ContentChild, args: [HeaderLogoMiniComponent,] }], headerElement: [{ type: core.ViewChild, args: ['headerElement', { static: true },] }], sidebarLeftToggleElement: [{ type: core.ViewChild, args: ['sidebarLeftToggleElement',] }], sidebarRightToggleElement: [{ type: core.ViewChild, args: ['sidebarRightToggleElement',] }] }; var HeaderModule = /** @class */ (function () { function HeaderModule() { } return HeaderModule; }()); HeaderModule.decorators = [ { type: core.NgModule, args: [{ imports: [common.CommonModule, router.RouterModule], exports: [HeaderComponent, HeaderLogoComponent, HeaderLogoMiniComponent], declarations: [HeaderComponent, HeaderLogoComponent, HeaderLogoMiniComponent] },] } ]; var CollapseAnimationDirective = /** @class */ (function () { function CollapseAnimationDirective(elementRef, ngZone, renderer2) { this.elementRef = elementRef; this.ngZone = ngZone; this.renderer2 = renderer2; this.collapseAnimationDuration = 350; // tslint:disable-next-line:no-output-rename this.startEventEmitter = new core.EventEmitter(); // tslint:disable-next-line:no-output-rename this.doneEventEmitter = new core.EventEmitter(); this.firstStart = true; this.isCollapsed = false; this.lastIsCollapsed = false; this.transitioning = false; } Object.defineProperty(CollapseAnimationDirective.prototype, "_isCollapsed", { set: function (value) { this.lastIsCollapsed = this.isCollapsed; this.isCollapsed = value; if (!this.firstStart) { this.emit('start'); if (value) { this.collapse(); } else if (!value) { this.unCollapse(); } } }, enumerable: false, configurable: true }); CollapseAnimationDirective.prototype.ngOnInit = function () { if (this.collapseAnimationDuration && this.collapseAnimationDuration !== 350) { this.renderer2.setStyle(this.elementRef.nativeElement, 'transition-duration', this.collapseAnimationDuration + "ms"); } if (this.collapseAnimationTiming) { this.renderer2.setS