UNPKG

nakedobjects.spa

Version:

Single Page Application client for a Naked Objects application.

74 lines 3.38 kB
var __decorate = (this && this.__decorate) || function (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; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Component, Input, QueryList, ViewChildren } from '@angular/core'; import { ActionComponent } from '../action/action.component'; import { UrlManagerService } from '../url-manager.service'; import map from 'lodash/map'; import some from 'lodash/some'; import { safeUnsubscribe } from '../helpers-components'; var MenuBarComponent = (function () { function MenuBarComponent(urlManager) { this.urlManager = urlManager; } Object.defineProperty(MenuBarComponent.prototype, "menus", { set: function (links) { var _this = this; this.actions = map(links, function (link) { return ({ value: link.title, doClick: function () { var menuId = link.link.rel().parms[0].value; _this.urlManager.setMenu(menuId, link.paneId); }, doRightClick: function () { }, show: function () { return true; }, disabled: function () { return null; }, tempDisabled: function () { return false; }, title: function () { return link.title; }, accesskey: null }); }); }, enumerable: true, configurable: true }); MenuBarComponent.prototype.focusOnFirstMenu = function (menusList) { if (menusList) { // until first element returns true some(menusList.toArray(), function (i) { return i.focus(); }); } }; MenuBarComponent.prototype.ngAfterViewInit = function () { var _this = this; this.focusOnFirstMenu(this.actionComponents); this.sub = this.actionComponents.changes.subscribe(function (ql) { return _this.focusOnFirstMenu(ql); }); }; MenuBarComponent.prototype.ngOnDestroy = function () { safeUnsubscribe(this.sub); }; return MenuBarComponent; }()); __decorate([ Input(), __metadata("design:type", Array), __metadata("design:paramtypes", [Array]) ], MenuBarComponent.prototype, "menus", null); __decorate([ ViewChildren(ActionComponent), __metadata("design:type", QueryList) ], MenuBarComponent.prototype, "actionComponents", void 0); MenuBarComponent = __decorate([ Component({ selector: 'nof-menu-bar', template: require('./menu-bar.component.html'), styles: [require('./menu-bar.component.css')] }), __metadata("design:paramtypes", [UrlManagerService]) ], MenuBarComponent); export { MenuBarComponent }; //# sourceMappingURL=menu-bar.component.js.map