@ngx-formly/material 10.0.1 → 11.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +107 -177
  2. package/fesm2022/ngx-formly-material-checkbox.mjs +234 -127
  3. package/fesm2022/ngx-formly-material-checkbox.mjs.map +1 -1
  4. package/fesm2022/ngx-formly-material-datepicker.mjs +264 -118
  5. package/fesm2022/ngx-formly-material-datepicker.mjs.map +1 -1
  6. package/fesm2022/ngx-formly-material-form-field.mjs +440 -226
  7. package/fesm2022/ngx-formly-material-form-field.mjs.map +1 -1
  8. package/fesm2022/ngx-formly-material-input.mjs +199 -89
  9. package/fesm2022/ngx-formly-material-input.mjs.map +1 -1
  10. package/fesm2022/ngx-formly-material-multicheckbox.mjs +203 -106
  11. package/fesm2022/ngx-formly-material-multicheckbox.mjs.map +1 -1
  12. package/fesm2022/ngx-formly-material-native-select.mjs +204 -73
  13. package/fesm2022/ngx-formly-material-native-select.mjs.map +1 -1
  14. package/fesm2022/ngx-formly-material-radio.mjs +247 -104
  15. package/fesm2022/ngx-formly-material-radio.mjs.map +1 -1
  16. package/fesm2022/ngx-formly-material-select.mjs +318 -133
  17. package/fesm2022/ngx-formly-material-select.mjs.map +1 -1
  18. package/fesm2022/ngx-formly-material-slider.mjs +195 -85
  19. package/fesm2022/ngx-formly-material-slider.mjs.map +1 -1
  20. package/fesm2022/ngx-formly-material-textarea.mjs +203 -86
  21. package/fesm2022/ngx-formly-material-textarea.mjs.map +1 -1
  22. package/fesm2022/ngx-formly-material-toggle.mjs +208 -86
  23. package/fesm2022/ngx-formly-material-toggle.mjs.map +1 -1
  24. package/fesm2022/ngx-formly-material.mjs +84 -62
  25. package/fesm2022/ngx-formly-material.mjs.map +1 -1
  26. package/package.json +3 -3
  27. package/types/ngx-formly-material-checkbox.d.ts +41 -46
  28. package/types/ngx-formly-material-datepicker.d.ts +62 -67
  29. package/types/ngx-formly-material-form-field.d.ts +71 -77
  30. package/types/ngx-formly-material-input.d.ts +22 -28
  31. package/types/ngx-formly-material-multicheckbox.d.ts +33 -38
  32. package/types/ngx-formly-material-native-select.d.ts +23 -29
  33. package/types/ngx-formly-material-radio.d.ts +34 -39
  34. package/types/ngx-formly-material-select.d.ts +45 -48
  35. package/types/ngx-formly-material-slider.d.ts +32 -37
  36. package/types/ngx-formly-material-textarea.d.ts +28 -33
  37. package/types/ngx-formly-material-toggle.d.ts +30 -35
  38. package/types/ngx-formly-material.d.ts +16 -19
@@ -1,53 +1,74 @@
1
- import * as i0 from '@angular/core';
2
- import { ViewChild, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
- import * as i3 from '@ngx-formly/core';
4
- import { ɵobserve as _observe, FormlyModule } from '@ngx-formly/core';
5
- import { FieldType, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';
6
- import * as i2 from '@angular/material/radio';
7
- import { MatRadioGroup, MatRadioModule } from '@angular/material/radio';
8
- import * as i1 from '@angular/forms';
9
- import { ReactiveFormsModule } from '@angular/forms';
10
- import * as i4 from '@angular/common';
11
- import { CommonModule } from '@angular/common';
12
- import * as i5 from '@ngx-formly/core/select';
13
- import { FormlySelectModule } from '@ngx-formly/core/select';
14
-
15
- class FormlyFieldRadio extends FieldType {
16
- constructor() {
17
- super(...arguments);
18
- this.defaultOptions = {
19
- props: {
20
- hideFieldUnderline: true,
21
- floatLabel: 'always',
22
- tabindex: -1,
23
- },
24
- };
25
- }
26
- ngAfterViewInit() {
27
- this.focusObserver = _observe(this.field, ['focus'], ({ currentValue }) => {
28
- if (this.props.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) {
29
- // https://github.com/ngx-formly/ngx-formly/issues/2498
30
- setTimeout(() => {
31
- const radio = this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first;
32
- radio.focus();
33
- });
34
- }
35
- });
36
- }
37
- // TODO: find a solution to prevent scroll on focus
38
- onContainerClick() { }
39
- ngOnDestroy() {
40
- super.ngOnDestroy();
41
- this.focusObserver && this.focusObserver.unsubscribe();
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, NgModule, ViewChild } from "@angular/core";
3
+ import * as i2 from "@angular/material/radio";
4
+ import { MatRadioGroup, MatRadioModule } from "@angular/material/radio";
5
+ import * as i3 from "@ngx-formly/core";
6
+ import { FormlyModule, ɵobserve } from "@ngx-formly/core";
7
+ import { FieldType, FormlyMatFormFieldModule } from "@ngx-formly/material/form-field";
8
+ import * as i1 from "@angular/forms";
9
+ import { ReactiveFormsModule } from "@angular/forms";
10
+ import * as i4 from "@angular/common";
11
+ import { CommonModule } from "@angular/common";
12
+ import * as i5 from "@ngx-formly/core/select";
13
+ import { FormlySelectModule } from "@ngx-formly/core/select";
14
+ var FormlyFieldRadio = class FormlyFieldRadio extends FieldType {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.defaultOptions = { props: {
18
+ hideFieldUnderline: true,
19
+ floatLabel: "always",
20
+ tabindex: -1
21
+ } };
22
+ }
23
+ ngAfterViewInit() {
24
+ this.focusObserver = ɵobserve(this.field, ["focus"], ({ currentValue }) => {
25
+ if (this.props.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) setTimeout(() => {
26
+ (this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first).focus();
27
+ });
28
+ });
29
+ }
30
+ onContainerClick() {}
31
+ ngOnDestroy() {
32
+ super.ngOnDestroy();
33
+ this.focusObserver && this.focusObserver.unsubscribe();
34
+ }
35
+ static {
36
+ this.ɵfac = i0.ɵɵngDeclareFactory({
37
+ minVersion: "12.0.0",
38
+ version: "22.2.2",
39
+ ngImport: i0,
40
+ type: FormlyFieldRadio,
41
+ deps: null,
42
+ target: i0.ɵɵFactoryTarget.Component
43
+ });
44
+ }
45
+ static {
46
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
47
+ minVersion: "17.0.0",
48
+ version: "22.2.2",
49
+ type: FormlyFieldRadio,
50
+ isStandalone: false,
51
+ selector: "formly-field-mat-radio",
52
+ viewQueries: [{
53
+ propertyName: "radioGroup",
54
+ first: true,
55
+ predicate: MatRadioGroup,
56
+ descendants: true,
57
+ static: true
58
+ }],
59
+ usesInheritance: true,
60
+ ngImport: i0,
61
+ template: `
62
+ @if (props.allowHtml) {
63
+ <span [id]="id + '-label'" hidden [innerHTML]="props.label"></span>
42
64
  }
43
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyFieldRadio, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
44
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: FormlyFieldRadio, isStandalone: false, selector: "formly-field-mat-radio", viewQueries: [{ propertyName: "radioGroup", first: true, predicate: MatRadioGroup, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
45
65
  <mat-radio-group
46
66
  [formControl]="formControl"
47
67
  [formlyAttributes]="field"
48
68
  [required]="required"
49
69
  [tabindex]="props.tabindex"
50
- [attr.aria-label]="props.label"
70
+ [attr.aria-label]="props.allowHtml ? null : props.label"
71
+ [attr.aria-labelledby]="props.allowHtml ? id + '-label' : null"
51
72
  >
52
73
  @for (option of props.options | formlySelectOptions: field | async; track $index; let i = $index) {
53
74
  <mat-radio-button
@@ -61,19 +82,112 @@ class FormlyFieldRadio extends FieldType {
61
82
  </mat-radio-button>
62
83
  }
63
84
  </mat-radio-group>
64
- `, isInline: true, dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i2.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
65
- }
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyFieldRadio, decorators: [{
67
- type: Component,
68
- args: [{
69
- selector: 'formly-field-mat-radio',
70
- template: `
85
+ `,
86
+ isInline: true,
87
+ dependencies: [
88
+ {
89
+ kind: "directive",
90
+ type: i1.NgControlStatus,
91
+ selector: "[formControlName],[ngModel],[formControl]"
92
+ },
93
+ {
94
+ kind: "directive",
95
+ type: i1.RequiredValidator,
96
+ selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
97
+ inputs: ["required"]
98
+ },
99
+ {
100
+ kind: "directive",
101
+ type: i1.FormControlDirective,
102
+ selector: "[formControl]",
103
+ inputs: [
104
+ "formControl",
105
+ "disabled",
106
+ "ngModel"
107
+ ],
108
+ outputs: ["ngModelChange"],
109
+ exportAs: ["ngForm"]
110
+ },
111
+ {
112
+ kind: "directive",
113
+ type: i2.MatRadioGroup,
114
+ selector: "mat-radio-group",
115
+ inputs: [
116
+ "color",
117
+ "name",
118
+ "labelPosition",
119
+ "value",
120
+ "selected",
121
+ "disabled",
122
+ "required",
123
+ "disabledInteractive"
124
+ ],
125
+ outputs: ["change"],
126
+ exportAs: ["matRadioGroup"]
127
+ },
128
+ {
129
+ kind: "component",
130
+ type: i2.MatRadioButton,
131
+ selector: "mat-radio-button",
132
+ inputs: [
133
+ "id",
134
+ "name",
135
+ "aria-label",
136
+ "aria-labelledby",
137
+ "aria-describedby",
138
+ "disableRipple",
139
+ "tabIndex",
140
+ "checked",
141
+ "value",
142
+ "labelPosition",
143
+ "disabled",
144
+ "required",
145
+ "color",
146
+ "disabledInteractive"
147
+ ],
148
+ outputs: ["change"],
149
+ exportAs: ["matRadioButton"]
150
+ },
151
+ {
152
+ kind: "directive",
153
+ type: i3.LegacyFormlyAttributes,
154
+ selector: "[formlyAttributes]"
155
+ },
156
+ {
157
+ kind: "pipe",
158
+ type: i4.AsyncPipe,
159
+ name: "async"
160
+ },
161
+ {
162
+ kind: "pipe",
163
+ type: i5.LegacyFormlySelectOptionsPipe,
164
+ name: "formlySelectOptions"
165
+ }
166
+ ],
167
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
168
+ });
169
+ }
170
+ };
171
+ i0.ɵɵngDeclareClassMetadata({
172
+ minVersion: "12.0.0",
173
+ version: "22.2.2",
174
+ ngImport: i0,
175
+ type: FormlyFieldRadio,
176
+ decorators: [{
177
+ type: Component,
178
+ args: [{
179
+ selector: "formly-field-mat-radio",
180
+ template: `
181
+ @if (props.allowHtml) {
182
+ <span [id]="id + '-label'" hidden [innerHTML]="props.label"></span>
183
+ }
71
184
  <mat-radio-group
72
185
  [formControl]="formControl"
73
186
  [formlyAttributes]="field"
74
187
  [required]="required"
75
188
  [tabindex]="props.tabindex"
76
- [attr.aria-label]="props.label"
189
+ [attr.aria-label]="props.allowHtml ? null : props.label"
190
+ [attr.aria-labelledby]="props.allowHtml ? id + '-label' : null"
77
191
  >
78
192
  @for (option of props.options | formlySelectOptions: field | async; track $index; let i = $index) {
79
193
  <mat-radio-button
@@ -88,58 +202,87 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
88
202
  }
89
203
  </mat-radio-group>
90
204
  `,
91
- changeDetection: ChangeDetectionStrategy.OnPush,
92
- standalone: false,
93
- }]
94
- }], propDecorators: { radioGroup: [{
95
- type: ViewChild,
96
- args: [MatRadioGroup, { static: true }]
97
- }] } });
98
-
205
+ changeDetection: ChangeDetectionStrategy.OnPush,
206
+ standalone: false
207
+ }]
208
+ }],
209
+ propDecorators: { radioGroup: [{
210
+ type: ViewChild,
211
+ args: [MatRadioGroup, { static: true }]
212
+ }] }
213
+ });
99
214
  function withFormlyFieldRadio() {
100
- return {
101
- types: [
102
- {
103
- name: 'radio',
104
- component: FormlyFieldRadio,
105
- wrappers: ['form-field'],
106
- },
107
- ],
108
- };
109
- }
110
-
111
- class FormlyMatRadioModule {
112
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyMatRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
113
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.25", ngImport: i0, type: FormlyMatRadioModule, declarations: [FormlyFieldRadio], imports: [CommonModule,
114
- ReactiveFormsModule,
115
- MatRadioModule,
116
- FormlyMatFormFieldModule,
117
- FormlySelectModule, i3.FormlyModule] }); }
118
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyMatRadioModule, imports: [CommonModule,
119
- ReactiveFormsModule,
120
- MatRadioModule,
121
- FormlyMatFormFieldModule,
122
- FormlySelectModule,
123
- FormlyModule.forChild(withFormlyFieldRadio())] }); }
215
+ return { types: [{
216
+ name: "radio",
217
+ component: FormlyFieldRadio,
218
+ wrappers: ["form-field"]
219
+ }] };
124
220
  }
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: FormlyMatRadioModule, decorators: [{
126
- type: NgModule,
127
- args: [{
128
- declarations: [FormlyFieldRadio],
129
- imports: [
130
- CommonModule,
131
- ReactiveFormsModule,
132
- MatRadioModule,
133
- FormlyMatFormFieldModule,
134
- FormlySelectModule,
135
- FormlyModule.forChild(withFormlyFieldRadio()),
136
- ],
137
- }]
138
- }] });
139
-
140
- /**
141
- * Generated bundle index. Do not edit.
142
- */
143
-
221
+ var FormlyMatRadioModule = class FormlyMatRadioModule {
222
+ static {
223
+ this.ɵfac = i0.ɵɵngDeclareFactory({
224
+ minVersion: "12.0.0",
225
+ version: "22.2.2",
226
+ ngImport: i0,
227
+ type: FormlyMatRadioModule,
228
+ deps: [],
229
+ target: i0.ɵɵFactoryTarget.NgModule
230
+ });
231
+ }
232
+ static {
233
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
234
+ minVersion: "14.0.0",
235
+ version: "22.2.2",
236
+ ngImport: i0,
237
+ type: FormlyMatRadioModule,
238
+ declarations: [FormlyFieldRadio],
239
+ imports: [
240
+ CommonModule,
241
+ ReactiveFormsModule,
242
+ MatRadioModule,
243
+ FormlyMatFormFieldModule,
244
+ FormlySelectModule,
245
+ i3.FormlyModule
246
+ ]
247
+ });
248
+ }
249
+ static {
250
+ this.ɵinj = i0.ɵɵngDeclareInjector({
251
+ minVersion: "12.0.0",
252
+ version: "22.2.2",
253
+ ngImport: i0,
254
+ type: FormlyMatRadioModule,
255
+ imports: [
256
+ CommonModule,
257
+ ReactiveFormsModule,
258
+ MatRadioModule,
259
+ FormlyMatFormFieldModule,
260
+ FormlySelectModule,
261
+ FormlyModule.forChild(withFormlyFieldRadio())
262
+ ]
263
+ });
264
+ }
265
+ };
266
+ i0.ɵɵngDeclareClassMetadata({
267
+ minVersion: "12.0.0",
268
+ version: "22.2.2",
269
+ ngImport: i0,
270
+ type: FormlyMatRadioModule,
271
+ decorators: [{
272
+ type: NgModule,
273
+ args: [{
274
+ declarations: [FormlyFieldRadio],
275
+ imports: [
276
+ CommonModule,
277
+ ReactiveFormsModule,
278
+ MatRadioModule,
279
+ FormlyMatFormFieldModule,
280
+ FormlySelectModule,
281
+ FormlyModule.forChild(withFormlyFieldRadio())
282
+ ]
283
+ }]
284
+ }]
285
+ });
144
286
  export { FormlyFieldRadio, FormlyMatRadioModule, withFormlyFieldRadio };
145
- //# sourceMappingURL=ngx-formly-material-radio.mjs.map
287
+
288
+ //# sourceMappingURL=ngx-formly-material-radio.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-formly-material-radio.mjs","sources":["../../../../src/ui/material/radio/src/radio.type.ts","../../../../src/ui/material/radio/src/radio.config.ts","../../../../src/ui/material/radio/src/radio.module.ts","../../../../src/ui/material/radio/src/ngx-formly-material-radio.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, ViewChild, AfterViewInit, OnDestroy, Type } from '@angular/core';\nimport { FieldTypeConfig, FormlyFieldConfig, ɵobserve as observe } from '@ngx-formly/core';\nimport { FieldType, FormlyFieldProps } from '@ngx-formly/material/form-field';\nimport { MatRadioGroup } from '@angular/material/radio';\n\ninterface RadioProps extends FormlyFieldProps {\n labelPosition?: 'before' | 'after';\n}\n\nexport interface FormlyRadioFieldConfig extends FormlyFieldConfig<RadioProps> {\n type: 'radio' | Type<FormlyFieldRadio>;\n}\n\n@Component({\n selector: 'formly-field-mat-radio',\n template: `\n <mat-radio-group\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [required]=\"required\"\n [tabindex]=\"props.tabindex\"\n [attr.aria-label]=\"props.label\"\n >\n @for (option of props.options | formlySelectOptions: field | async; track $index; let i = $index) {\n <mat-radio-button\n [id]=\"id + '_' + i\"\n [color]=\"props.color\"\n [labelPosition]=\"props.labelPosition\"\n [disabled]=\"option.disabled\"\n [value]=\"option.value\"\n >\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class FormlyFieldRadio extends FieldType<FieldTypeConfig<RadioProps>> implements AfterViewInit, OnDestroy {\n @ViewChild(MatRadioGroup, { static: true }) radioGroup!: MatRadioGroup;\n override defaultOptions = {\n props: {\n hideFieldUnderline: true,\n floatLabel: 'always' as const,\n tabindex: -1,\n },\n };\n\n private focusObserver!: ReturnType<typeof observe>;\n ngAfterViewInit() {\n this.focusObserver = observe(this.field, ['focus'], ({ currentValue }) => {\n if (this.props.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) {\n // https://github.com/ngx-formly/ngx-formly/issues/2498\n setTimeout(() => {\n const radio = this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first;\n radio.focus();\n });\n }\n });\n }\n\n // TODO: find a solution to prevent scroll on focus\n override onContainerClick() {}\n\n override ngOnDestroy() {\n super.ngOnDestroy();\n this.focusObserver && this.focusObserver.unsubscribe();\n }\n}\n","import { ConfigOption } from '@ngx-formly/core';\nimport { FormlyFieldRadio } from './radio.type';\n\nexport function withFormlyFieldRadio(): ConfigOption {\n return {\n types: [\n {\n name: 'radio',\n component: FormlyFieldRadio,\n wrappers: ['form-field'],\n },\n ],\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\n\nimport { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';\nimport { MatRadioModule } from '@angular/material/radio';\n\nimport { FormlyFieldRadio } from './radio.type';\nimport { withFormlyFieldRadio } from './radio.config';\n\n@NgModule({\n declarations: [FormlyFieldRadio],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatRadioModule,\n\n FormlyMatFormFieldModule,\n FormlySelectModule,\n FormlyModule.forChild(withFormlyFieldRadio()),\n ],\n})\nexport class FormlyMatRadioModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["observe","i1"],"mappings":";;;;;;;;;;;;;;AAuCM,MAAO,gBAAiB,SAAQ,SAAsC,CAAA;AA1B5E,IAAA,WAAA,GAAA;;AA4BW,QAAA,IAAA,CAAA,cAAc,GAAG;AACx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AIT,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAT7B,YAAY;YACZ,mBAAmB;YACnB,cAAc;YAEd,wBAAwB;YACxB,kBAAkB;AAClB,YAAA,YAAY,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAA,EAAA,CAAA,CAAA;;4FAGpC,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAZhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,gBAAgB,CAAC;AAChC,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,cAAc;wBAEd,wBAAwB;wBACxB,kBAAkB;AAClB,wBAAA,YAAY,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;AAC9C,qBAAA;AACF,iBAAA;;;ACvBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-formly-material-radio.mjs","names":[],"sources":["../../../../src/ui/material/radio/src/radio.type.ts","../../../../src/ui/material/radio/src/radio.config.ts","../../../../src/ui/material/radio/src/radio.module.ts"],"sourcesContent":["import { AfterViewInit, ChangeDetectionStrategy, Component, OnDestroy, Type, ViewChild } from '@angular/core';\nimport { MatRadioGroup } from '@angular/material/radio';\nimport { FieldTypeConfig, FormlyFieldConfig, ɵobserve as observe } from '@ngx-formly/core';\nimport { FieldType, FormlyFieldProps } from '@ngx-formly/material/form-field';\n\ninterface RadioProps extends FormlyFieldProps {\n labelPosition?: 'before' | 'after';\n}\n\nexport interface FormlyRadioFieldConfig extends FormlyFieldConfig<RadioProps> {\n type: 'radio' | Type<FormlyFieldRadio>;\n}\n\n@Component({\n selector: 'formly-field-mat-radio',\n template: `\n @if (props.allowHtml) {\n <span [id]=\"id + '-label'\" hidden [innerHTML]=\"props.label\"></span>\n }\n <mat-radio-group\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\"\n [required]=\"required\"\n [tabindex]=\"props.tabindex\"\n [attr.aria-label]=\"props.allowHtml ? null : props.label\"\n [attr.aria-labelledby]=\"props.allowHtml ? id + '-label' : null\"\n >\n @for (option of props.options | formlySelectOptions: field | async; track $index; let i = $index) {\n <mat-radio-button\n [id]=\"id + '_' + i\"\n [color]=\"props.color\"\n [labelPosition]=\"props.labelPosition\"\n [disabled]=\"option.disabled\"\n [value]=\"option.value\"\n >\n {{ option.label }}\n </mat-radio-button>\n }\n </mat-radio-group>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class FormlyFieldRadio extends FieldType<FieldTypeConfig<RadioProps>> implements AfterViewInit, OnDestroy {\n @ViewChild(MatRadioGroup, { static: true }) radioGroup!: MatRadioGroup;\n override defaultOptions = {\n props: {\n hideFieldUnderline: true,\n floatLabel: 'always' as const,\n tabindex: -1,\n },\n };\n\n private focusObserver!: ReturnType<typeof observe>;\n ngAfterViewInit() {\n this.focusObserver = observe(this.field, ['focus'], ({ currentValue }) => {\n if (this.props.tabindex === -1 && currentValue && this.radioGroup._radios.length > 0) {\n // https://github.com/ngx-formly/ngx-formly/issues/2498\n setTimeout(() => {\n const radio = this.radioGroup.selected ? this.radioGroup.selected : this.radioGroup._radios.first;\n radio.focus();\n });\n }\n });\n }\n\n // TODO: find a solution to prevent scroll on focus\n override onContainerClick() {}\n\n override ngOnDestroy() {\n super.ngOnDestroy();\n this.focusObserver && this.focusObserver.unsubscribe();\n }\n}\n","import { ConfigOption } from '@ngx-formly/core';\nimport { FormlyFieldRadio } from './radio.type';\n\nexport function withFormlyFieldRadio(): ConfigOption {\n return {\n types: [\n {\n name: 'radio',\n component: FormlyFieldRadio,\n wrappers: ['form-field'],\n },\n ],\n };\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\n\nimport { FormlyMatFormFieldModule } from '@ngx-formly/material/form-field';\nimport { MatRadioModule } from '@angular/material/radio';\n\nimport { FormlyFieldRadio } from './radio.type';\nimport { withFormlyFieldRadio } from './radio.config';\n\n@NgModule({\n declarations: [FormlyFieldRadio],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatRadioModule,\n\n FormlyMatFormFieldModule,\n FormlySelectModule,\n FormlyModule.forChild(withFormlyFieldRadio()),\n ],\n})\nexport class FormlyMatRadioModule {}\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAa,mBAAb,MAAa,yBAAyB,UAAsC;CA9B5E,cAAA;;EAgCW,KAAA,iBAAiB,EACxB,OAAO;GACL,oBAAoB;GACpB,YAAY;GACZ,UAAU;EACX,EACF;CAsBF;CAnBC,kBAAe;EACb,KAAK,gBAAgB,SAAQ,KAAK,OAAO,CAAC,OAAO,IAAI,EAAE,mBAAkB;GACvE,IAAI,KAAK,MAAM,aAAa,MAAM,gBAAgB,KAAK,WAAW,QAAQ,SAAS,GAEjF,iBAAgB;IAEd,CADc,KAAK,WAAW,WAAW,KAAK,WAAW,WAAW,KAAK,WAAW,QAAQ,MAC5F,CAAM,MAAK;GACb,CAAC;EAEL,CAAC;CACH;CAGS,mBAAgB,CAAI;CAEpB,cAAW;EAClB,MAAM,YAAW;EACjB,KAAK,iBAAiB,KAAK,cAAc,YAAW;CACtD;CA7BW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,MAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAgB,cAAA;GAAA,UAAA;GAAA,aAAA,CAAA;IAAA,cAAA;IAAA,OAAA;IAAA,WAChB;IAAa,aAAA;IAAA,QAAA;GAAA,CAAA;G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