UNPKG

nakedobjects.spa

Version:

Single Page Application client for a Naked Objects application.

99 lines 4.6 kB
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, ViewChildren, QueryList } from '@angular/core'; import { ViewModelFactoryService } from '../view-model-factory.service'; import { ActivatedRoute } from '@angular/router'; import { UrlManagerService } from '../url-manager.service'; import { PaneComponent } from '../pane/pane'; import * as Msg from '../user-messages'; import { safeUnsubscribe } from '../helpers-components'; var RecentComponent = (function (_super) { __extends(RecentComponent, _super); function RecentComponent(activatedRoute, urlManager, context, viewModelFactory) { var _this = _super.call(this, activatedRoute, urlManager, context) || this; _this.viewModelFactory = viewModelFactory; // template API _this.title = Msg.recentTitle; _this.items = function () { return _this.recent.items; }; _this.clearButton = { value: Msg.clear, doClick: function () { return _this.clear(); }, show: function () { return true; }, disabled: function () { return _this.clearDisabled(); }, tempDisabled: function () { return null; }, title: function () { return _this.clearDisabled() ? Msg.recentDisabledMessage : Msg.recentMessage; }, accesskey: "c" }; return _this; } Object.defineProperty(RecentComponent.prototype, "actionHolders", { get: function () { return [this.clearButton]; }, enumerable: true, configurable: true }); RecentComponent.prototype.hasItems = function () { return this.recent && this.recent.items.length > 0; }; RecentComponent.prototype.clear = function () { this.recent.clear(); }; RecentComponent.prototype.clearDisabled = function () { return this.recent.items.length === 0 ? true : null; }; RecentComponent.prototype.setup = function (routeData) { this.recent = this.viewModelFactory.recentItemsViewModel(this.paneId); }; RecentComponent.prototype.focusOnFirstRow = function (rows) { if (rows && rows.first) { // until first element returns true rows.first.focus(); } }; RecentComponent.prototype.ngAfterViewInit = function () { var _this = this; this.focusOnFirstRow(this.actionChildren); this.sub = this.actionChildren.changes.subscribe(function (ql) { return _this.focusOnFirstRow(ql); }); }; RecentComponent.prototype.ngOnDestroy = function () { safeUnsubscribe(this.sub); _super.prototype.ngOnDestroy.call(this); }; return RecentComponent; }(PaneComponent)); __decorate([ ViewChildren("row"), __metadata("design:type", QueryList) ], RecentComponent.prototype, "actionChildren", void 0); RecentComponent = __decorate([ Component({ selector: 'nof-recent', template: require('./recent.component.html'), styles: [require('./recent.component.css')] }), __metadata("design:paramtypes", [ActivatedRoute, UrlManagerService, ContextService, ViewModelFactoryService]) ], RecentComponent); export { RecentComponent }; //# sourceMappingURL=recent.component.js.map