"use strict"; 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); }; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var common_1 = require("@angular/common"); var forms_1 = require("@angular/forms"); exports.RADIO_VALUE_ACCESSOR = { provide: forms_1.NG_VALUE_ACCESSOR, useExisting: core_1.forwardRef(function () { return RadioButton; }), multi: true }; var RadioButton = /** @class */ (function () { function RadioButton(cd) { this.cd = cd; this.onClick = new core_1.EventEmitter(); this.onFocus = new core_1.EventEmitter(); this.onBlur = new core_1.EventEmitter(); this.onModelChange = function () { }; this.onModelTouched = function () { }; } RadioButton.prototype.handleClick = function (event, radioButton, focus) { event.preventDefault(); if (this.disabled) { return; } this.select(event); if (focus) { radioButton.focus(); } }; RadioButton.prototype.select = function (event) { if (!this.disabled) { this.inputViewChild.nativeElement.checked = true; this.checked = true; this.onModelChange(this.value); this.onClick.emit(event); } }; RadioButton.prototype.writeValue = function (value) { this.checked = (value == this.value); if (this.inputViewChild.nativeElement) { this.inputViewChild.nativeElement.checked = this.checked; } this.cd.markForCheck(); }; RadioButton.prototype.registerOnChange = function (fn) { this.onModelChange = fn; }; RadioButton.prototype.registerOnTouched = function (fn) { this.onModelTouched = fn; }; RadioButton.prototype.setDisabledState = function (val) { this.disabled = val; }; RadioButton.prototype.onInputFocus = function (event) { this.focused = true; this.onFocus.emit(event); }; RadioButton.prototype.onInputBlur = function (event) { this.focused = false; this.onModelTouched(); this.onBlur.emit(event); }; RadioButton.prototype.onChange = function (event) { this.select(event); }; __decorate([ core_1.Input(), __metadata("design:type", Object) ], RadioButton.prototype, "value", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], RadioButton.prototype, "name", void 0); __decorate([ core_1.Input(), __metadata("design:type", Boolean) ], RadioButton.prototype, "disabled", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], RadioButton.prototype, "label", void 0); __decorate([ core_1.Input(), __metadata("design:type", Number) ], RadioButton.prototype, "tabindex", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], RadioButton.prototype, "inputId", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) ], RadioButton.prototype, "style", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], RadioButton.prototype, "styleClass", void 0); __decorate([ core_1.Input(), __metadata("design:type", String) ], RadioButton.prototype, "labelStyleClass", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], RadioButton.prototype, "onClick", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], RadioButton.prototype, "onFocus", void 0); __decorate([ core_1.Output(), __metadata("design:type", core_1.EventEmitter) ], RadioButton.prototype, "onBlur", void 0); __decorate([ core_1.ViewChild('rb'), __metadata("design:type", core_1.ElementRef) ], RadioButton.prototype, "inputViewChild", void 0); RadioButton = __decorate([ core_1.Component({ selector: 'p-radioButton', template: "\n
\n
\n \n
\n
\n \n
\n
\n \n ", providers: [exports.RADIO_VALUE_ACCESSOR] }), __metadata("design:paramtypes", [core_1.ChangeDetectorRef]) ], RadioButton); return RadioButton; }()); exports.RadioButton = RadioButton; var RadioButtonModule = /** @class */ (function () { function RadioButtonModule() { } RadioButtonModule = __decorate([ core_1.NgModule({ imports: [common_1.CommonModule], exports: [RadioButton], declarations: [RadioButton] }) ], RadioButtonModule); return RadioButtonModule; }()); exports.RadioButtonModule = RadioButtonModule; //# sourceMappingURL=radiobutton.js.map