nakedobjects.spa
Version:
Single Page Application client for a Naked Objects application.
110 lines • 4.77 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 { TimePickerComponent } from '../time-picker/time-picker.component';
import { FieldViewModel } from '../view-models/field-view-model';
import { ViewChild } from '@angular/core';
import { Component, Input, EventEmitter } from '@angular/core';
import { AbstractControl, FormGroup } from '@angular/forms';
import { ConfigService } from '../config.service';
import * as Msg from '../user-messages';
var TimePickerFacadeComponent = (function () {
function TimePickerFacadeComponent(configService) {
this.configService = configService;
this.inputEvents = new EventEmitter();
}
Object.defineProperty(TimePickerFacadeComponent.prototype, "id", {
get: function () {
return this.model.paneArgId;
},
enumerable: true,
configurable: true
});
TimePickerFacadeComponent.prototype.setValueIfChanged = function (time) {
var oldValue = this.control.value;
var newValue = time ? time : "";
if (newValue !== oldValue) {
this.model.resetMessage();
this.model.clientValid = true;
this.control.setValue(newValue);
}
};
TimePickerFacadeComponent.prototype.handleTimeChangedEvent = function (time) {
if (this.control) {
this.setValueIfChanged(time);
}
};
TimePickerFacadeComponent.prototype.handleTimeClearedEvent = function () {
if (this.control) {
this.model.resetMessage();
this.model.clientValid = true;
this.control.setValue("");
}
};
TimePickerFacadeComponent.prototype.handleInvalidTimeEvent = function (data) {
if (this.control) {
this.control.setValue("");
this.model.setMessage(Msg.invalidTime);
this.model.clientValid = false;
this.control.setErrors((_a = {}, _a[Msg.invalidTime] = true, _a));
}
var _a;
};
TimePickerFacadeComponent.prototype.handleEvents = function (e) {
switch (e.type) {
case ("timeChanged"):
this.handleTimeChangedEvent(e.data);
break;
case ("timeInvalid"):
this.handleInvalidTimeEvent(e.data);
break;
case ("timeCleared"):
this.handleTimeClearedEvent();
break;
default: //ignore
}
};
TimePickerFacadeComponent.prototype.ngAfterViewInit = function () {
var _this = this;
var existingValue = this.control && this.control.value;
if (existingValue && (existingValue instanceof String || typeof existingValue === "string")) {
setTimeout(function () { return _this.inputEvents.emit({ type: "setTime", data: existingValue }); });
}
};
TimePickerFacadeComponent.prototype.focus = function () {
return this.timepicker && this.timepicker.focus();
};
return TimePickerFacadeComponent;
}());
__decorate([
Input(),
__metadata("design:type", AbstractControl)
], TimePickerFacadeComponent.prototype, "control", void 0);
__decorate([
Input(),
__metadata("design:type", FormGroup)
], TimePickerFacadeComponent.prototype, "form", void 0);
__decorate([
Input(),
__metadata("design:type", FieldViewModel)
], TimePickerFacadeComponent.prototype, "model", void 0);
__decorate([
ViewChild("tp"),
__metadata("design:type", TimePickerComponent)
], TimePickerFacadeComponent.prototype, "timepicker", void 0);
TimePickerFacadeComponent = __decorate([
Component({
selector: 'nof-time-picker-facade',
template: require('./time-picker-facade.component.html'),
styles: [require('./time-picker-facade.component.css')]
}),
__metadata("design:paramtypes", [ConfigService])
], TimePickerFacadeComponent);
export { TimePickerFacadeComponent };
//# sourceMappingURL=time-picker-facade.component.js.map