nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
85 lines • 3.79 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 } from '@angular/core';
import { AttachmentViewModel } from '../view-models/attachment-view-model';
import { ErrorService } from '../error.service';
import { Router } from '@angular/router';
import { UrlManagerService } from '../url-manager.service';
import { ClickHandlerService } from '../click-handler.service';
import * as Msg from '../user-messages';
var AttachmentPropertyComponent = (function () {
function AttachmentPropertyComponent(error, urlManager, clickHandlerService, router) {
var _this = this;
this.error = error;
this.urlManager = urlManager;
this.clickHandlerService = clickHandlerService;
this.router = router;
this.noImage = Msg.noImageMessage;
this.doAttachmentClick = function (right) {
if (_this.attachment.displayInline()) {
_this.urlManager.setAttachment(_this.attachment.link, _this.clickHandlerService.pane(_this.attachment.onPaneId, right));
}
else {
_this.attachment.downloadFile()
.then(function (blob) {
if (window.navigator.msSaveBlob) {
// internet explorer
window.navigator.msSaveBlob(blob, _this.attachment.title);
}
else {
var burl = URL.createObjectURL(blob);
window.open(burl);
}
})
.catch(function (reject) { return _this.error.handleError(reject); });
}
};
}
Object.defineProperty(AttachmentPropertyComponent.prototype, "attachment", {
get: function () {
return this.attach;
},
set: function (avm) {
this.attach = avm;
if (this.attach) {
this.setup();
}
},
enumerable: true,
configurable: true
});
AttachmentPropertyComponent.prototype.setup = function () {
if (this.attachment.displayInline()) {
this.attachment.setImage(this);
}
else {
this.attachment.setTitle(this);
}
};
return AttachmentPropertyComponent;
}());
__decorate([
Input(),
__metadata("design:type", AttachmentViewModel),
__metadata("design:paramtypes", [AttachmentViewModel])
], AttachmentPropertyComponent.prototype, "attachment", null);
AttachmentPropertyComponent = __decorate([
Component({
selector: 'nof-attachment-property',
template: require('./attachment-property.component.html'),
styles: [require('./attachment-property.component.css')]
}),
__metadata("design:paramtypes", [ErrorService,
UrlManagerService,
ClickHandlerService,
Router])
], AttachmentPropertyComponent);
export { AttachmentPropertyComponent };
//# sourceMappingURL=attachment-property.component.js.map