nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
66 lines • 3.02 kB
JavaScript
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 { wrapAction } from '../action/action.component';
import { ActionComponent } from '../action/action.component';
import flatten from 'lodash/flatten';
import map from 'lodash/map';
import some from 'lodash/map';
import { safeUnsubscribe } from '../helpers-components';
var ActionBarComponent = (function () {
function ActionBarComponent() {
}
Object.defineProperty(ActionBarComponent.prototype, "menuHolder", {
set: function (mhvm) {
var menuItems = mhvm.menuItems;
var avms = flatten(map(menuItems || [], function (mi) { return mi.actions; }));
this.actions = map(avms, function (a) { return wrapAction(a); });
},
enumerable: true,
configurable: true
});
ActionBarComponent.prototype.focusOnFirstAction = function (actions) {
if (actions) {
// until first element returns true
some(actions.toArray(), function (i) { return i.focus(); });
}
};
ActionBarComponent.prototype.ngAfterViewInit = function () {
var _this = this;
this.focusOnFirstAction(this.actionChildren);
this.sub = this.actionChildren.changes.subscribe(function (ql) { return _this.focusOnFirstAction(ql); });
};
ActionBarComponent.prototype.ngOnDestroy = function () {
safeUnsubscribe(this.sub);
};
return ActionBarComponent;
}());
__decorate([
Input(),
__metadata("design:type", Array)
], ActionBarComponent.prototype, "actions", void 0);
__decorate([
Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], ActionBarComponent.prototype, "menuHolder", null);
__decorate([
ViewChildren(ActionComponent),
__metadata("design:type", QueryList)
], ActionBarComponent.prototype, "actionChildren", void 0);
ActionBarComponent = __decorate([
Component({
selector: 'nof-action-bar',
template: require('./action-bar.component.html'),
styles: [require('./action-bar.component.css')]
})
], ActionBarComponent);
export { ActionBarComponent };
//# sourceMappingURL=action-bar.component.js.map