nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
134 lines • 5.46 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 { ContextService } from '../context.service';
import { Component, Input, ViewChild, ElementRef, Renderer } from '@angular/core';
import { FieldViewModel } from '../view-models/field-view-model';
import { FormGroup } from '@angular/forms';
import { BehaviorSubject } from 'rxjs';
import { accept, dropOn, paste, focus } from '../helpers-components';
var AutoCompleteFacadeComponent = (function () {
function AutoCompleteFacadeComponent(context, renderer) {
this.context = context;
this.renderer = renderer;
this.canDrop = false;
}
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "model", {
get: function () {
return this.viewModel;
},
set: function (m) {
this.viewModel = m;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "modelPaneId", {
get: function () {
return this.model.paneArgId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "modelId", {
get: function () {
return this.model.id;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "control", {
get: function () {
return this.form.controls[this.model.id];
},
enumerable: true,
configurable: true
});
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "choices", {
get: function () {
return this.model.choices;
},
enumerable: true,
configurable: true
});
AutoCompleteFacadeComponent.prototype.accept = function (droppableVm) {
return accept(droppableVm, this);
};
;
AutoCompleteFacadeComponent.prototype.drop = function (draggableVm) {
dropOn(draggableVm, this.model, this);
};
AutoCompleteFacadeComponent.prototype.classes = function () {
return _a = {},
_a[this.model.color] = true,
_a["candrop"] = this.canDrop,
_a["mat-input-element"] = null // remove this class to prevent angular/materials styling overiding our styling
,
_a;
var _a;
};
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "description", {
get: function () {
return this.model.description;
},
enumerable: true,
configurable: true
});
AutoCompleteFacadeComponent.prototype.paste = function (event) {
var _this = this;
paste(event, this.model, this, function () { return _this.context.getCopyViewModel(); }, function () { return _this.context.setCopyViewModel(null); });
};
AutoCompleteFacadeComponent.prototype.clear = function () {
this.model.clear();
this.control.reset();
};
Object.defineProperty(AutoCompleteFacadeComponent.prototype, "subject", {
get: function () {
var _this = this;
if (!this.bSubject) {
var initialValue = this.control.value;
this.bSubject = new BehaviorSubject(initialValue);
this.control.valueChanges.subscribe(function (data) {
_this.bSubject.next(data);
});
}
return this.bSubject;
},
enumerable: true,
configurable: true
});
AutoCompleteFacadeComponent.prototype.focus = function () {
return focus(this.renderer, this.inputField);
};
return AutoCompleteFacadeComponent;
}());
__decorate([
Input(),
__metadata("design:type", FieldViewModel),
__metadata("design:paramtypes", [FieldViewModel])
], AutoCompleteFacadeComponent.prototype, "model", null);
__decorate([
Input(),
__metadata("design:type", FormGroup)
], AutoCompleteFacadeComponent.prototype, "form", void 0);
__decorate([
ViewChild("focus"),
__metadata("design:type", ElementRef)
], AutoCompleteFacadeComponent.prototype, "inputField", void 0);
AutoCompleteFacadeComponent = __decorate([
Component({
selector: 'nof-auto-complete-facade',
template: require('./auto-complete-facade.component.html'),
styles: [require('./auto-complete-facade.component.css')]
}),
__metadata("design:paramtypes", [ContextService,
Renderer])
], AutoCompleteFacadeComponent);
export { AutoCompleteFacadeComponent };
//# sourceMappingURL=auto-complete-facade.component.js.map