UNPKG

6.91 kBSource Map (JSON)View Raw
1{"version":3,"sources":["ng://primeng/radiobutton/radiobutton.ts"],"names":["RADIO_VALUE_ACCESSOR","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","RadioButton","multi","cd","this","onClick","EventEmitter","onFocus","onBlur","onModelChange","onModelTouched","prototype","handleClick","event","radioButton","focus","preventDefault","disabled","select","inputViewChild","nativeElement","checked","value","emit","writeValue","markForCheck","registerOnChange","fn","registerOnTouched","setDisabledState","val","onInputFocus","focused","onInputBlur","onChange","ChangeDetectorRef","__decorate","Input","Output","ViewChild","Component","selector","template","providers","changeDetection","ChangeDetectionStrategy","Default","RadioButtonModule","NgModule","imports","CommonModule","exports","declarations"],"mappings":"0wBAIaA,EAA4B,CACrCC,QAASC,EAAAA,kBACTC,YAAaC,EAAAA,YAAW,WAAM,OAAAC,KAC9BC,OAAO,GAwBXD,EAAA,WAsCI,SAAAA,EAAoBE,GAAAC,KAAAD,GAAAA,EAhBVC,KAAAC,QAA6B,IAAIC,EAAAA,aAEjCF,KAAAG,QAA6B,IAAID,EAAAA,aAEjCF,KAAAI,OAA4B,IAAIF,EAAAA,aAInCF,KAAAK,cAA0B,aAE1BL,KAAAM,eAA2B,aAuEtC,OA/DIT,EAAAU,UAAAC,YAAA,SAAYC,EAAOC,EAAaC,GAC5BF,EAAMG,iBAEFZ,KAAKa,WAITb,KAAKc,OAAOL,GAERE,GACAD,EAAYC,UAIpBd,EAAAU,UAAAO,OAAA,SAAOL,GACET,KAAKa,WACNb,KAAKe,eAAeC,cAAcC,SAAU,EAC5CjB,KAAKiB,SAAU,EACfjB,KAAKK,cAAcL,KAAKkB,OACxBlB,KAAKC,QAAQkB,KAAKV,KAI1BZ,EAAAU,UAAAa,WAAA,SAAWF,GACPlB,KAAKiB,QAAWC,GAASlB,KAAKkB,MAE1BlB,KAAKe,gBAAkBf,KAAKe,eAAeC,gBAC3ChB,KAAKe,eAAeC,cAAcC,QAAUjB,KAAKiB,SAGrDjB,KAAKD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input,Output,ElementRef,EventEmitter,forwardRef,ViewChild,ChangeDetectorRef,ChangeDetectionStrategy} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';\n\nexport const RADIO_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RadioButton),\n multi: true\n};\n\n@Component({\n selector: 'p-radioButton',\n template: `\n <div [ngStyle]=\"style\" [ngClass]=\"'ui-radiobutton ui-widget'\" [class]=\"styleClass\">\n <div class=\"ui-helper-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]=\"{'ui-radiobutton-box ui-widget ui-state-default':true,\n 'ui-state-active':rb.checked,'ui-state-disabled':disabled,'ui-state-focus':focused}\">\n <span class=\"ui-radiobutton-icon ui-clickable\" [ngClass]=\"{'pi pi-circle-on':rb.checked}\"></span>\n </div>\n </div>\n <label (click)=\"select($event)\" [class]=\"labelStyleClass\"\n [ngClass]=\"{'ui-radiobutton-label':true, 'ui-label-active':rb.checked, 'ui-label-disabled':disabled, 'ui-label-focus':focused}\"\n *ngIf=\"label\" [attr.for]=\"inputId\">{{label}}</label>\n `,\n providers: [RADIO_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.Default\n})\nexport class RadioButton implements ControlValueAccessor {\n\n @Input() value: any;\n\n @Input() name: string;\n\n @Input() disabled: boolean;\n \n @Input() label: string;\n\n @Input() tabindex: number;\n\n @Input() inputId: string;\n\n @Input() ariaLabelledBy: string;\n \n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() labelStyleClass: string;\n\n @Output() onClick: EventEmitter<any> = new EventEmitter();\n\n @Output() onFocus: EventEmitter<any> = new EventEmitter();\n\n @Output() onBlur: EventEmitter<any> = new EventEmitter();\n \n @ViewChild('rb') inputViewChild: ElementRef;\n \n public onModelChange: Function = () => {};\n \n public onModelTouched: Function = () => {};\n \n public checked: boolean;\n \n public focused: boolean;\n\n constructor(private cd: ChangeDetectorRef) {}\n \n handleClick(event, radioButton, focus) {\n event.preventDefault();\n\n if (this.disabled) {\n return;\n }\n\n this.select(event);\n\n if (focus) {\n radioButton.focus();\n }\n }\n \n select(event) {\n if (!this.disabled) {\n this.inputViewChild.nativeElement.checked = true;\n this.checked = true;\n this.onModelChange(this.value);\n this.onClick.emit(event);\n }\n }\n \n writeValue(value: any) : void {\n this.checked = (value == this.value);\n\n if (this.inputViewChild && this.inputViewChild.nativeElement) {\n this.inputViewChild.nativeElement.checked = this.checked;\n }\n \n this.cd.markForCheck();\n }\n \n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n \n setDisabledState(val: boolean): void {\n this.disabled = val;\n }\n \n onInputFocus(event) {\n this.focused = true;\n this.onFocus.emit(event);\n }\n\n onInputBlur(event) {\n this.focused = false;\n this.onModelTouched();\n this.onBlur.emit(event);\n }\n \n onChange(event) {\n this.select(event);\n }\n\n focus() {\n this.inputViewChild.nativeElement.focus();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [RadioButton],\n declarations: [RadioButton]\n})\nexport class RadioButtonModule { }"]}
\No newline at end of file