nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
94 lines • 3.68 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, Renderer, ViewChildren, QueryList } from '@angular/core';
import { focus } from '../helpers-components';
export function wrapAction(a) {
return {
value: a.title,
doClick: function () { return a.doInvoke(); },
doRightClick: function () { return a.doInvoke(true); },
show: function () { return true; },
disabled: function () { return a.disabled() ? true : null; },
tempDisabled: function () { return a.tempDisabled(); },
title: function () { return a.description; },
accesskey: null
};
}
var ActionComponent = (function () {
function ActionComponent(renderer) {
this.renderer = renderer;
}
ActionComponent.prototype.canClick = function () {
return !(this.disabled() || this.tempDisabled());
};
ActionComponent.prototype.doClick = function () {
if (this.canClick()) {
this.action.doClick();
}
};
ActionComponent.prototype.doRightClick = function () {
if (this.canClick() && this.action.doRightClick) {
this.action.doRightClick();
}
};
ActionComponent.prototype.class = function () {
return ({
tempdisabled: this.tempDisabled()
});
};
ActionComponent.prototype.show = function () {
return this.action && this.action.show();
};
ActionComponent.prototype.disabled = function () {
return this.action.disabled();
};
ActionComponent.prototype.tempDisabled = function () {
return this.action.tempDisabled();
};
Object.defineProperty(ActionComponent.prototype, "value", {
get: function () {
return this.action.value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ActionComponent.prototype, "title", {
get: function () {
return this.action.title();
},
enumerable: true,
configurable: true
});
ActionComponent.prototype.focus = function () {
if (this.disabled()) {
return false;
}
return !!(this.focusList && this.focusList.first) && focus(this.renderer, this.focusList.first);
};
return ActionComponent;
}());
__decorate([
Input(),
__metadata("design:type", Object)
], ActionComponent.prototype, "action", void 0);
__decorate([
ViewChildren("focus"),
__metadata("design:type", QueryList)
], ActionComponent.prototype, "focusList", void 0);
ActionComponent = __decorate([
Component({
selector: 'nof-action',
template: require('./action.component.html'),
styles: [require('./action.component.css')]
}),
__metadata("design:paramtypes", [Renderer])
], ActionComponent);
export { ActionComponent };
//# sourceMappingURL=action.component.js.map