1 | import { NgModule, Component, Input, Output, EventEmitter, forwardRef, ViewChild, ChangeDetectionStrategy, Injectable } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
---|
4 | import * as i0 from "@angular/core";
|
---|
5 | import * as i1 from "@angular/common";
|
---|
6 | export const RADIO_VALUE_ACCESSOR = {
|
---|
7 | provide: NG_VALUE_ACCESSOR,
|
---|
8 | useExisting: forwardRef(() => RadioButton),
|
---|
9 | multi: true
|
---|
10 | };
|
---|
11 | export class RadioControlRegistry {
|
---|
12 | constructor() {
|
---|
13 | this.accessors = [];
|
---|
14 | }
|
---|
15 | add(control, accessor) {
|
---|
16 | this.accessors.push([control, accessor]);
|
---|
17 | }
|
---|
18 | remove(accessor) {
|
---|
19 | this.accessors = this.accessors.filter((c) => {
|
---|
20 | return c[1] !== accessor;
|
---|
21 | });
|
---|
22 | }
|
---|
23 | select(accessor) {
|
---|
24 | this.accessors.forEach((c) => {
|
---|
25 | if (this.isSameGroup(c, accessor) && c[1] !== accessor) {
|
---|
26 | c[1].writeValue(accessor.value);
|
---|
27 | }
|
---|
28 | });
|
---|
29 | }
|
---|
30 | isSameGroup(controlPair, accessor) {
|
---|
31 | if (!controlPair[0].control) {
|
---|
32 | return false;
|
---|
33 | }
|
---|
34 | return controlPair[0].control.root === accessor.control.control.root && controlPair[1].name === accessor.name;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | RadioControlRegistry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioControlRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
---|
38 | RadioControlRegistry.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioControlRegistry, providedIn: 'root' });
|
---|
39 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioControlRegistry, decorators: [{
|
---|
40 | type: Injectable,
|
---|
41 | args: [{
|
---|
42 | providedIn: 'root',
|
---|
43 | }]
|
---|
44 | }] });
|
---|
45 | export class RadioButton {
|
---|
46 | constructor(cd, injector, registry) {
|
---|
47 | this.cd = cd;
|
---|
48 | this.injector = injector;
|
---|
49 | this.registry = registry;
|
---|
50 | this.onClick = new EventEmitter();
|
---|
51 | this.onFocus = new EventEmitter();
|
---|
52 | this.onBlur = new EventEmitter();
|
---|
53 | this.onModelChange = () => { };
|
---|
54 | this.onModelTouched = () => { };
|
---|
55 | }
|
---|
56 | ngOnInit() {
|
---|
57 | this.control = this.injector.get(NgControl);
|
---|
58 | this.checkName();
|
---|
59 | this.registry.add(this.control, this);
|
---|
60 | }
|
---|
61 | handleClick(event, radioButton, focus) {
|
---|
62 | event.preventDefault();
|
---|
63 | if (this.disabled) {
|
---|
64 | return;
|
---|
65 | }
|
---|
66 | this.select(event);
|
---|
67 | if (focus) {
|
---|
68 | radioButton.focus();
|
---|
69 | }
|
---|
70 | }
|
---|
71 | select(event) {
|
---|
72 | if (!this.disabled) {
|
---|
73 | this.inputViewChild.nativeElement.checked = true;
|
---|
74 | this.checked = true;
|
---|
75 | this.onModelChange(this.value);
|
---|
76 | this.registry.select(this);
|
---|
77 | this.onClick.emit(event);
|
---|
78 | }
|
---|
79 | }
|
---|
80 | writeValue(value) {
|
---|
81 | this.checked = (value == this.value);
|
---|
82 | if (this.inputViewChild && this.inputViewChild.nativeElement) {
|
---|
83 | this.inputViewChild.nativeElement.checked = this.checked;
|
---|
84 | }
|
---|
85 | this.cd.markForCheck();
|
---|
86 | }
|
---|
87 | registerOnChange(fn) {
|
---|
88 | this.onModelChange = fn;
|
---|
89 | }
|
---|
90 | registerOnTouched(fn) {
|
---|
91 | this.onModelTouched = fn;
|
---|
92 | }
|
---|
93 | setDisabledState(val) {
|
---|
94 | this.disabled = val;
|
---|
95 | this.cd.markForCheck();
|
---|
96 | }
|
---|
97 | onInputFocus(event) {
|
---|
98 | this.focused = true;
|
---|
99 | this.onFocus.emit(event);
|
---|
100 | }
|
---|
101 | onInputBlur(event) {
|
---|
102 | this.focused = false;
|
---|
103 | this.onModelTouched();
|
---|
104 | this.onBlur.emit(event);
|
---|
105 | }
|
---|
106 | onChange(event) {
|
---|
107 | this.select(event);
|
---|
108 | }
|
---|
109 | focus() {
|
---|
110 | this.inputViewChild.nativeElement.focus();
|
---|
111 | }
|
---|
112 | ngOnDestroy() {
|
---|
113 | this.registry.remove(this);
|
---|
114 | }
|
---|
115 | checkName() {
|
---|
116 | if (this.name && this.formControlName && this.name !== this.formControlName) {
|
---|
117 | this.throwNameError();
|
---|
118 | }
|
---|
119 | if (!this.name && this.formControlName) {
|
---|
120 | this.name = this.formControlName;
|
---|
121 | }
|
---|
122 | }
|
---|
123 | throwNameError() {
|
---|
124 | throw new Error(`
|
---|
125 | If you define both a name and a formControlName attribute on your radio button, their values
|
---|
126 | must match. Ex: <p-radioButton formControlName="food" name="food"></p-radioButton>
|
---|
127 | `);
|
---|
128 | }
|
---|
129 | }
|
---|
130 | RadioButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButton, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: RadioControlRegistry }], target: i0.ɵɵFactoryTarget.Component });
|
---|
131 | RadioButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: RadioButton, selector: "p-radioButton", inputs: { value: "value", formControlName: "formControlName", name: "name", disabled: "disabled", label: "label", tabindex: "tabindex", inputId: "inputId", ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", style: "style", styleClass: "styleClass", labelStyleClass: "labelStyleClass" }, outputs: { onClick: "onClick", onFocus: "onFocus", onBlur: "onBlur" }, host: { classAttribute: "p-element" }, providers: [RADIO_VALUE_ACCESSOR], viewQueries: [{ propertyName: "inputViewChild", first: true, predicate: ["rb"], descendants: true }], ngImport: i0, template: `
|
---|
132 | <div [ngStyle]="style" [ngClass]="{'p-radiobutton p-component':true,'p-radiobutton-checked': checked, 'p-radiobutton-disabled': disabled, 'p-radiobutton-focused': focused}" [class]="styleClass">
|
---|
133 | <div class="p-hidden-accessible">
|
---|
134 | <input #rb type="radio" [attr.id]="inputId" [attr.name]="name" [attr.value]="value" [attr.tabindex]="tabindex" [attr.aria-checked]="checked" [attr.aria-label]="ariaLabel"
|
---|
135 | [attr.aria-labelledby]="ariaLabelledBy" [checked]="checked" (change)="onChange($event)" (focus)="onInputFocus($event)" (blur)="onInputBlur($event)" [disabled]="disabled">
|
---|
136 | </div>
|
---|
137 | <div (click)="handleClick($event, rb, true)" [ngClass]="{'p-radiobutton-box':true, 'p-highlight': checked, 'p-disabled': disabled, 'p-focus': focused}">
|
---|
138 | <span class="p-radiobutton-icon"></span>
|
---|
139 | </div>
|
---|
140 | </div>
|
---|
141 | <label (click)="select($event)" [class]="labelStyleClass"
|
---|
142 | [ngClass]="{'p-radiobutton-label':true, 'p-radiobutton-label-active':rb.checked, 'p-disabled':disabled, 'p-radiobutton-label-focus':focused}"
|
---|
143 | *ngIf="label" [attr.for]="inputId">{{label}}</label>
|
---|
144 | `, isInline: true, directives: [{ type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
---|
145 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButton, decorators: [{
|
---|
146 | type: Component,
|
---|
147 | args: [{
|
---|
148 | selector: 'p-radioButton',
|
---|
149 | template: `
|
---|
150 | <div [ngStyle]="style" [ngClass]="{'p-radiobutton p-component':true,'p-radiobutton-checked': checked, 'p-radiobutton-disabled': disabled, 'p-radiobutton-focused': focused}" [class]="styleClass">
|
---|
151 | <div class="p-hidden-accessible">
|
---|
152 | <input #rb type="radio" [attr.id]="inputId" [attr.name]="name" [attr.value]="value" [attr.tabindex]="tabindex" [attr.aria-checked]="checked" [attr.aria-label]="ariaLabel"
|
---|
153 | [attr.aria-labelledby]="ariaLabelledBy" [checked]="checked" (change)="onChange($event)" (focus)="onInputFocus($event)" (blur)="onInputBlur($event)" [disabled]="disabled">
|
---|
154 | </div>
|
---|
155 | <div (click)="handleClick($event, rb, true)" [ngClass]="{'p-radiobutton-box':true, 'p-highlight': checked, 'p-disabled': disabled, 'p-focus': focused}">
|
---|
156 | <span class="p-radiobutton-icon"></span>
|
---|
157 | </div>
|
---|
158 | </div>
|
---|
159 | <label (click)="select($event)" [class]="labelStyleClass"
|
---|
160 | [ngClass]="{'p-radiobutton-label':true, 'p-radiobutton-label-active':rb.checked, 'p-disabled':disabled, 'p-radiobutton-label-focus':focused}"
|
---|
161 | *ngIf="label" [attr.for]="inputId">{{label}}</label>
|
---|
162 | `,
|
---|
163 | providers: [RADIO_VALUE_ACCESSOR],
|
---|
164 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
165 | host: {
|
---|
166 | 'class': 'p-element'
|
---|
167 | }
|
---|
168 | }]
|
---|
169 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: RadioControlRegistry }]; }, propDecorators: { value: [{
|
---|
170 | type: Input
|
---|
171 | }], formControlName: [{
|
---|
172 | type: Input
|
---|
173 | }], name: [{
|
---|
174 | type: Input
|
---|
175 | }], disabled: [{
|
---|
176 | type: Input
|
---|
177 | }], label: [{
|
---|
178 | type: Input
|
---|
179 | }], tabindex: [{
|
---|
180 | type: Input
|
---|
181 | }], inputId: [{
|
---|
182 | type: Input
|
---|
183 | }], ariaLabelledBy: [{
|
---|
184 | type: Input
|
---|
185 | }], ariaLabel: [{
|
---|
186 | type: Input
|
---|
187 | }], style: [{
|
---|
188 | type: Input
|
---|
189 | }], styleClass: [{
|
---|
190 | type: Input
|
---|
191 | }], labelStyleClass: [{
|
---|
192 | type: Input
|
---|
193 | }], onClick: [{
|
---|
194 | type: Output
|
---|
195 | }], onFocus: [{
|
---|
196 | type: Output
|
---|
197 | }], onBlur: [{
|
---|
198 | type: Output
|
---|
199 | }], inputViewChild: [{
|
---|
200 | type: ViewChild,
|
---|
201 | args: ['rb']
|
---|
202 | }] } });
|
---|
203 | export class RadioButtonModule {
|
---|
204 | }
|
---|
205 | RadioButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
206 | RadioButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButtonModule, declarations: [RadioButton], imports: [CommonModule], exports: [RadioButton] });
|
---|
207 | RadioButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButtonModule, imports: [[CommonModule]] });
|
---|
208 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RadioButtonModule, decorators: [{
|
---|
209 | type: NgModule,
|
---|
210 | args: [{
|
---|
211 | imports: [CommonModule],
|
---|
212 | exports: [RadioButton],
|
---|
213 | declarations: [RadioButton]
|
---|
214 | }]
|
---|
215 | }] });
|
---|
216 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW9idXR0b24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXBwL2NvbXBvbmVudHMvcmFkaW9idXR0b24vcmFkaW9idXR0b24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQUMsS0FBSyxFQUFDLE1BQU0sRUFBWSxZQUFZLE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