angularjasper2
Version:
<p align="center"> <h1 align="center">AngularJasper2</h1> </p>
71 lines • 2.94 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);
};
var core_1 = require("@angular/core");
var angular_jasper_service_1 = require("../angular-jasper.service");
var param_directive_1 = require("./param.directive");
var ReportComponent = (function () {
function ReportComponent(jasper) {
var _this = this;
this.error = new core_1.EventEmitter();
this.success = new core_1.EventEmitter();
jasper.visualizePromise.then(function (v) {
v.report({
resource: _this.resource,
container: _this.container.nativeElement,
params: _this.getParams(),
error: _this.onError.bind(_this),
success: _this.onSuccess.bind(_this)
});
});
}
ReportComponent.prototype.getParams = function () {
return this.params.reduce(function (memo, param) {
memo[param.name] = JSON.parse(param.value.replace(/'/g, '\"'));
return memo;
}, {});
};
ReportComponent.prototype.onError = function (err) {
this.error.emit({ err: err });
};
ReportComponent.prototype.onSuccess = function () {
this.success.emit();
};
return ReportComponent;
}());
__decorate([
core_1.Input(),
__metadata("design:type", String)
], ReportComponent.prototype, "resource", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", Object)
], ReportComponent.prototype, "error", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", Object)
], ReportComponent.prototype, "success", void 0);
__decorate([
core_1.ViewChild('container'),
__metadata("design:type", core_1.ElementRef)
], ReportComponent.prototype, "container", void 0);
__decorate([
core_1.ContentChildren(param_directive_1.Param),
__metadata("design:type", Array)
], ReportComponent.prototype, "params", void 0);
ReportComponent = __decorate([
core_1.Component({
selector: 'jr-report',
template: '<div #container></div>'
}),
__metadata("design:paramtypes", [angular_jasper_service_1.AngularJasper])
], ReportComponent);
exports.ReportComponent = ReportComponent;
//# sourceMappingURL=report.component.js.map