nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
119 lines • 5.11 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, ElementRef, Renderer, ViewChildren, QueryList } from '@angular/core';
import { ItemViewModel } from '../view-models/item-view-model';
import * as Helpers from '../view-models/helpers-view-models';
import { ContextService } from '../context.service';
import { RecentItemViewModel } from '../view-models/recent-item-view-model';
import { focus } from '../helpers-components';
var RowComponent = (function () {
function RowComponent(context, renderer, element) {
var _this = this;
this.context = context;
this.renderer = renderer;
this.element = element;
this.tableTitle = function () { return _this.item.tableRowViewModel ? _this.item.tableRowViewModel.title : _this.title; };
this.hasTableTitle = function () { return (_this.item.tableRowViewModel && _this.item.tableRowViewModel.showTitle) || (_this.item instanceof RecentItemViewModel && _this.item.title); };
this.tableProperties = function () { return _this.item.tableRowViewModel && _this.item.tableRowViewModel.properties; };
this.propertyType = function (property) { return property.type; };
this.propertyValue = function (property) { return property.value; };
this.propertyFormattedValue = function (property) { return property.formattedValue; };
this.propertyReturnType = function (property) { return property.returnType; };
this.doClick = function (right) { return _this.item.doClick(right); };
}
Object.defineProperty(RowComponent.prototype, "id", {
get: function () {
return "" + (this.item.id || "item") + this.item.paneId + "-" + this.row;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RowComponent.prototype, "color", {
get: function () {
return this.item.color;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RowComponent.prototype, "selected", {
get: function () {
return this.item.selected;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RowComponent.prototype, "title", {
get: function () {
return this.item.title;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RowComponent.prototype, "friendlyName", {
get: function () {
return this.item instanceof RecentItemViewModel ? this.item.friendlyName : "";
},
enumerable: true,
configurable: true
});
RowComponent.prototype.tabIndexFirstColumn = function (i) {
if (this.isTable) {
if (this.hasTableTitle()) {
return i === "title" ? 0 : -1;
}
else if (this.friendlyName) {
return i === "fname" ? 0 : -1;
}
else if (i === 0) {
return 0;
}
}
return -1;
};
RowComponent.prototype.copy = function (event, item) {
Helpers.copy(event, item, this.context);
};
RowComponent.prototype.focus = function () {
return !!this.rowChildren && this.rowChildren.length > 0 && focus(this.renderer, this.rowChildren.first);
};
return RowComponent;
}());
__decorate([
Input(),
__metadata("design:type", ItemViewModel)
], RowComponent.prototype, "item", void 0);
__decorate([
Input(),
__metadata("design:type", Number)
], RowComponent.prototype, "row", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RowComponent.prototype, "withCheckbox", void 0);
__decorate([
Input(),
__metadata("design:type", Boolean)
], RowComponent.prototype, "isTable", void 0);
__decorate([
ViewChildren("focus"),
__metadata("design:type", QueryList)
], RowComponent.prototype, "rowChildren", void 0);
RowComponent = __decorate([
Component({
selector: '[nof-row]',
template: require('./row.component.html'),
styles: [require('./row.component.css')]
}),
__metadata("design:paramtypes", [ContextService,
Renderer,
ElementRef])
], RowComponent);
export { RowComponent };
//# sourceMappingURL=row.component.js.map