import { CommonModule } from '@angular/common';
import { ChangeDetectionStrategy, Component, EventEmitter, Injectable, Input, NgModule, Output, ViewChild, booleanAttribute, forwardRef, numberAttribute } from '@angular/core';
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
import { AutoFocusModule } from 'primeng/autofocus';
import * as i0 from "@angular/core";
import * as i1 from "primeng/api";
import * as i2 from "@angular/common";
import * as i3 from "primeng/autofocus";
export const RADIO_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => RadioButton),
multi: true
};
export class RadioControlRegistry {
accessors = [];
add(control, accessor) {
this.accessors.push([control, accessor]);
}
remove(accessor) {
this.accessors = this.accessors.filter((c) => {
return c[1] !== accessor;
});
}
select(accessor) {
this.accessors.forEach((c) => {
if (this.isSameGroup(c, accessor) && c[1] !== accessor) {
c[1].writeValue(accessor.value);
}
});
}
isSameGroup(controlPair, accessor) {
if (!controlPair[0].control) {
return false;
}
return controlPair[0].control.root === accessor.control.control.root && controlPair[1].name === accessor.name;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioControlRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioControlRegistry, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioControlRegistry, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}] });
/**
* RadioButton is an extension to standard radio button element with theming.
* @group Components
*/
export class RadioButton {
cd;
injector;
registry;
config;
/**
* Value of the radiobutton.
* @group Props
*/
value;
/**
* The name of the form control.
* @group Props
*/
formControlName;
/**
* Name of the radiobutton group.
* @group Props
*/
name;
/**
* When present, it specifies that the element should be disabled.
* @group Props
*/
disabled;
/**
* Label of the radiobutton.
* @group Props
*/
label;
/**
* Specifies the input variant of the component.
* @group Props
*/
variant = 'outlined';
/**
* Index of the element in tabbing order.
* @group Props
*/
tabindex;
/**
* Identifier of the focus input to match a label defined for the component.
* @group Props
*/
inputId;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
*/
ariaLabelledBy;
/**
* Used to define a string that labels the input element.
* @group Props
*/
ariaLabel;
/**
* Inline style of the component.
* @group Props
*/
style;
/**
* Style class of the component.
* @group Props
*/
styleClass;
/**
* Style class of the label.
* @group Props
*/
labelStyleClass;
/**
* When present, it specifies that the component should automatically get focus on load.
* @group Props
*/
autofocus;
/**
* Callback to invoke on radio button click.
* @param {RadioButtonClickEvent} event - Custom click event.
* @group Emits
*/
onClick = new EventEmitter();
/**
* Callback to invoke when the receives focus.
* @param {Event} event - Browser event.
* @group Emits
*/
onFocus = new EventEmitter();
/**
* Callback to invoke when the loses focus.
* @param {Event} event - Browser event.
* @group Emits
*/
onBlur = new EventEmitter();
inputViewChild;
onModelChange = () => { };
onModelTouched = () => { };
checked;
focused;
control;
constructor(cd, injector, registry, config) {
this.cd = cd;
this.injector = injector;
this.registry = registry;
this.config = config;
}
ngOnInit() {
this.control = this.injector.get(NgControl);
this.checkName();
this.registry.add(this.control, this);
}
handleClick(event, radioButton, focus) {
event.preventDefault();
if (this.disabled) {
return;
}
this.select(event);
if (focus) {
radioButton.focus();
}
}
select(event) {
if (!this.disabled) {
this.inputViewChild.nativeElement.checked = true;
this.checked = true;
this.onModelChange(this.value);
this.registry.select(this);
this.onClick.emit({ originalEvent: event, value: this.value });
}
}
writeValue(value) {
this.checked = value == this.value;
if (this.inputViewChild && this.inputViewChild.nativeElement) {
this.inputViewChild.nativeElement.checked = this.checked;
}
this.cd.markForCheck();
}
registerOnChange(fn) {
this.onModelChange = fn;
}
registerOnTouched(fn) {
this.onModelTouched = fn;
}
setDisabledState(val) {
this.disabled = val;
this.cd.markForCheck();
}
onInputFocus(event) {
this.focused = true;
this.onFocus.emit(event);
}
onInputBlur(event) {
this.focused = false;
this.onModelTouched();
this.onBlur.emit(event);
}
/**
* Applies focus to input field.
* @group Method
*/
focus() {
this.inputViewChild.nativeElement.focus();
}
ngOnDestroy() {
this.registry.remove(this);
}
checkName() {
if (this.name && this.formControlName && this.name !== this.formControlName) {
this.throwNameError();
}
if (!this.name && this.formControlName) {
this.name = this.formControlName;
}
}
throwNameError() {
throw new Error(`
If you define both a name and a formControlName attribute on your radio button, their values
must match. Ex:
`);
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioButton, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: RadioControlRegistry }, { token: i1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: RadioButton, selector: "p-radioButton", inputs: { value: "value", formControlName: "formControlName", name: "name", disabled: ["disabled", "disabled", booleanAttribute], label: "label", variant: "variant", tabindex: ["tabindex", "tabindex", numberAttribute], inputId: "inputId", ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", style: "style", styleClass: "styleClass", labelStyleClass: "labelStyleClass", autofocus: ["autofocus", "autofocus", booleanAttribute] }, outputs: { onClick: "onClick", onFocus: "onFocus", onBlur: "onBlur" }, host: { classAttribute: "p-element" }, providers: [RADIO_VALUE_ACCESSOR], viewQueries: [{ propertyName: "inputViewChild", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: `
`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.AutoFocus, selector: "[pAutoFocus]", inputs: ["autofocus"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioButton, decorators: [{
type: Component,
args: [{
selector: 'p-radioButton',
template: `
`,
providers: [RADIO_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'p-element'
}
}]
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: RadioControlRegistry }, { type: i1.PrimeNGConfig }], propDecorators: { value: [{
type: Input
}], formControlName: [{
type: Input
}], name: [{
type: Input
}], disabled: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], label: [{
type: Input
}], variant: [{
type: Input
}], tabindex: [{
type: Input,
args: [{ transform: numberAttribute }]
}], inputId: [{
type: Input
}], ariaLabelledBy: [{
type: Input
}], ariaLabel: [{
type: Input
}], style: [{
type: Input
}], styleClass: [{
type: Input
}], labelStyleClass: [{
type: Input
}], autofocus: [{
type: Input,
args: [{ transform: booleanAttribute }]
}], onClick: [{
type: Output
}], onFocus: [{
type: Output
}], onBlur: [{
type: Output
}], inputViewChild: [{
type: ViewChild,
args: ['input']
}] } });
export class RadioButtonModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: RadioButtonModule, declarations: [RadioButton], imports: [CommonModule, AutoFocusModule], exports: [RadioButton] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioButtonModule, imports: [CommonModule, AutoFocusModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: RadioButtonModule, decorators: [{
type: NgModule,
args: [{
imports: [CommonModule, AutoFocusModule],
exports: [RadioButton],
declarations: [RadioButton]
}]
}] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uI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gpID09PSAnZmlsbGVkJ1xuICAgICAgICAgICAgfVwiXG4gICAgICAgICAgICBbY2xhc3NdPVwic3R5bGVDbGFzc1wiXG4gICAgICAgICAgICBbYXR0ci5kYXRhLXBjLW5hbWVdPVwiJ3JhZGlvYnV0dG9uJ1wiXG4gICAgICAgICAgICBbYXR0ci5kYXRhLXBjLXNlY3Rpb25dPVwiJ3Jvb3QnXCJcbiAgICAgICAgICAgIChjbGljayk9XCJoYW5kbGVDbGljaygkZXZlbnQsIGlucHV0LCB0cnVlKVwiXG4gICAgICAgID5cbiAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJwLWhpZGRlbi1hY2Nlc3NpYmxlXCIgW2F0dHIuZGF0YS1wYy1zZWN0aW9uXT1cIidoaWRkZW5JbnB1dFdyYXBwZXInXCI+XG4gICAgICAgICAgICAgICAgPGlucHV0XG4gICAgICAgICAgICAgICAgICAgICNpbnB1dFxuICAgICAgICAgICAgICAgICAgICBbYXR0ci5pZF09XCJpbnB1dElkXCJcbiAgICAgICAgICAgICAgICAgICAgdHlwZT1cInJhZGlvXCJcbiAgICAgICAgICAgICAgICAgICAgW2F0dHIubmFtZV09XCJuYW1lXCJcbiAgICAgICAgICAgICAgICAgICAgW2NoZWNrZWRdPVwiY2hlY2tlZFwiXG4gICAgICAgICAgICAgICAgICAgIFtkaXNhYmxlZF09XCJkaXNhYmxlZFwiXG4gICAgICAgICAgICAgICAgICAgIFt2YWx1ZV09XCJ2YWx1ZVwiXG4gICAgICAgICAgICAgICAgICAgIFthdHRyLmFyaWEtbGFiZWxsZWRieV09XCJhcmlhTGFiZWxsZWRCeVwiXG4gICAgICAgICAgICAgICAgICAgIFthdHRyLmFyaWEtbGFiZWxdPVwiYXJpYUxhYmVsXCJcbiAgICAgICAgICAgICAgICAgICAgW2F0dHIudGFiaW5kZXhdPVwidGFiaW5kZXhcIlxuICAgICAgICAgICAgICAgICAgICBbYXR0ci5hcmlhLWNoZWNrZWRdPVwiY2hlY2tlZFwiXG4gIC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