primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("primeng/radiobutton",["exports","@angular/core","@angular/common","@angular/forms"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).primeng=t.primeng||{},t.primeng.radiobutton={}),t.ng.core,t.ng.common,t.ng.forms)}(this,(function(t,e,o,n){"use strict";var i={provide:n.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return s})),multi:!0},r=function(){function t(){this.accessors=[]}return t.prototype.add=function(t,e){this.accessors.push([t,e])},t.prototype.remove=function(t){this.accessors=this.accessors.filter((function(e){return e[1]!==t}))},t.prototype.select=function(t){var e=this;this.accessors.forEach((function(o){e.isSameGroup(o,t)&&o[1]!==t&&o[1].writeValue(t.value)}))},t.prototype.isSameGroup=function(t,e){return!!t[0].control&&(t[0].control.root===e.control.control.root&&t[1].name===e.name)},t}();r.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new r},token:r,providedIn:"root"}),r.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}];var s=function(){function t(t,o,n){this.cd=t,this.injector=o,this.registry=n,this.onClick=new e.EventEmitter,this.onFocus=new e.EventEmitter,this.onBlur=new e.EventEmitter,this.onModelChange=function(){},this.onModelTouched=function(){}}return t.prototype.ngOnInit=function(){this.formControlName&&(this.control=this.injector.get(n.NgControl),this.checkName(),this.registry.add(this.control,this))},t.prototype.handleClick=function(t,e,o){t.preventDefault(),this.disabled||(this.select(t),o&&e.focus())},t.prototype.select=function(t){this.disabled||(this.inputViewChild.nativeElement.checked=!0,this.checked=!0,this.onModelChange(this.value),this.formControlName&&this.registry.select(this),this.onClick.emit(t))},t.prototype.writeValue=function(t){this.checked=t==this.value,this.inputViewChild&&this.inputViewChild.nativeElement&&(this.inputViewChild.nativeElement.checked=this.checked),this.cd.markForCheck()},t.prototype.registerOnChange=function(t){this.onModelChange=t},t.prototype.registerOnTouched=function(t){this.onModelTouched=t},t.prototype.setDisabledState=function(t){this.disabled=t,this.cd.markForCheck()},t.prototype.onInputFocus=function(t){this.focused=!0,this.onFocus.emit(t)},t.prototype.onInputBlur=function(t){this.focused=!1,this.onModelTouched(),this.onBlur.emit(t)},t.prototype.onChange=function(t){this.select(t)},t.prototype.focus=function(){this.inputViewChild.nativeElement.focus()},t.prototype.ngOnDestroy=function(){this.formControlName&&this.registry.remove(this)},t.prototype.checkName=function(){this.name&&this.formControlName&&this.name!==this.formControlName&&this.throwNameError(),!this.name&&this.formControlName&&(this.name=this.formControlName)},t.prototype.throwNameError=function(){throw new Error('\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: <p-radioButton formControlName="food" name="food"></p-radioButton>\n ')},t}();s.decorators=[{type:e.Component,args:[{selector:"p-radioButton",template:'\n <div [ngStyle]="style" [ngClass]="{\'p-radiobutton p-component\':true,\'p-radiobutton-checked\': checked, \'p-radiobutton-disabled\': disabled, \'p-radiobutton-focused\': focused}" [class]="styleClass">\n <div class="p-hidden-accessible">\n <input #rb type="radio" [attr.id]="inputId" [attr.name]="name" [attr.value]="value" [attr.tabindex]="tabindex" [attr.aria-labelledby]="ariaLabelledBy"\n [checked]="checked" (change)="onChange($event)" (focus)="onInputFocus($event)" (blur)="onInputBlur($event)" [disabled]="disabled">\n </div>\n <div (click)="handleClick($event, rb, true)" role="radio" [attr.aria-checked]="checked"\n [ngClass]="{\'p-radiobutton-box\':true,\n \'p-highlight\': checked, \'p-disabled\': disabled, \'p-focus\': focused}">\n <span class="p-radiobutton-icon"></span>\n </div>\n </div>\n <label (click)="select($event)" [class]="labelStyleClass"\n [ngClass]="{\'p-radiobutton-label\':true, \'p-radiobutton-label-active\':rb.checked, \'p-disabled\':disabled, \'p-radiobutton-label-focus\':focused}"\n *ngIf="label" [attr.for]="inputId">{{label}}</label>\n ',providers:[i],changeDetection:e.ChangeDetectionStrategy.OnPush}]}],s.ctorParameters=function(){return[{type:e.ChangeDetectorRef},{type:e.Injector},{type:r}]},s.propDecorators={value:[{type:e.Input}],formControlName:[{type:e.Input}],name:[{type:e.Input}],disabled:[{type:e.Input}],label:[{type:e.Input}],tabindex:[{type:e.Input}],inputId:[{type:e.Input}],ariaLabelledBy:[{type:e.Input}],style:[{type:e.Input}],styleClass:[{type:e.Input}],labelStyleClass:[{type:e.Input}],onClick:[{type:e.Output}],onFocus:[{type:e.Output}],onBlur:[{type:e.Output}],inputViewChild:[{type:e.ViewChild,args:["rb"]}]};var a=function(){};a.decorators=[{type:e.NgModule,args:[{imports:[o.CommonModule],exports:[s],declarations:[s]}]}],t.RADIO_VALUE_ACCESSOR=i,t.RadioButton=s,t.RadioButtonModule=a,t.RadioControlRegistry=r,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-radiobutton.umd.min.js.map