nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
77 lines • 3.95 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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 { ContextService } from '../context.service';
import { Component, ComponentFactoryResolver, ViewChild, ViewContainerRef } from '@angular/core';
import { CustomComponentService } from '../custom-component.service';
import { ActivatedRoute } from '@angular/router';
import { ViewType } from '../route-data';
import { UrlManagerService } from '../url-manager.service';
import { PaneComponent } from '../pane/pane';
import * as Models from '../models';
import { ConfigService } from '../config.service';
var DynamicObjectComponent = (function (_super) {
__extends(DynamicObjectComponent, _super);
function DynamicObjectComponent(activatedRoute, urlManager, context, componentFactoryResolver, customComponentService, configService) {
var _this = _super.call(this, activatedRoute, urlManager, context) || this;
_this.componentFactoryResolver = componentFactoryResolver;
_this.customComponentService = customComponentService;
_this.configService = configService;
return _this;
}
DynamicObjectComponent.prototype.setup = function (routeData) {
var _this = this;
if (!routeData.objectId) {
return;
}
var oid = Models.ObjectIdWrapper.fromObjectId(routeData.objectId, this.configService.config.keySeparator);
if (oid.domainType !== this.lastOid) {
this.lastOid = oid.domainType;
this.parent.clear();
this.customComponentService.getCustomComponent(this.lastOid, ViewType.Object).then(function (c) {
var childComponent = _this.componentFactoryResolver.resolveComponentFactory(c);
_this.parent.createComponent(childComponent);
});
}
};
DynamicObjectComponent.prototype.ngOnDestroy = function () {
_super.prototype.ngOnDestroy.call(this);
this.parent.clear();
};
return DynamicObjectComponent;
}(PaneComponent));
__decorate([
ViewChild('parent', { read: ViewContainerRef }),
__metadata("design:type", ViewContainerRef)
], DynamicObjectComponent.prototype, "parent", void 0);
DynamicObjectComponent = __decorate([
Component({
selector: 'nof-dynamic-object',
template: require('./dynamic-object.component.html'),
styles: [require('./dynamic-object.component.css')]
}),
__metadata("design:paramtypes", [ActivatedRoute,
UrlManagerService,
ContextService,
ComponentFactoryResolver,
CustomComponentService,
ConfigService])
], DynamicObjectComponent);
export { DynamicObjectComponent };
//# sourceMappingURL=dynamic-object.component.js.map