@ng-forge/dynamic-forms-material 1.2.0-next.5 → 1.2.0-next.7

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 (45) hide show
  1. package/fesm2022/ng-forge-dynamic-forms-material-lazy-addon-button.mjs +106 -0
  2. package/fesm2022/ng-forge-dynamic-forms-material-lazy-addon-button.mjs.map +1 -0
  3. package/fesm2022/ng-forge-dynamic-forms-material-lazy-addon-icon.mjs +34 -0
  4. package/fesm2022/ng-forge-dynamic-forms-material-lazy-addon-icon.mjs.map +1 -0
  5. package/fesm2022/ng-forge-dynamic-forms-material-lazy-button.mjs +60 -0
  6. package/fesm2022/ng-forge-dynamic-forms-material-lazy-button.mjs.map +1 -0
  7. package/fesm2022/ng-forge-dynamic-forms-material-lazy-checkbox.mjs +76 -0
  8. package/fesm2022/ng-forge-dynamic-forms-material-lazy-checkbox.mjs.map +1 -0
  9. package/fesm2022/ng-forge-dynamic-forms-material-lazy-datepicker.mjs +124 -0
  10. package/fesm2022/ng-forge-dynamic-forms-material-lazy-datepicker.mjs.map +1 -0
  11. package/fesm2022/ng-forge-dynamic-forms-material-lazy-input.mjs +196 -0
  12. package/fesm2022/ng-forge-dynamic-forms-material-lazy-input.mjs.map +1 -0
  13. package/fesm2022/ng-forge-dynamic-forms-material-lazy-multi-checkbox.mjs +136 -0
  14. package/fesm2022/ng-forge-dynamic-forms-material-lazy-multi-checkbox.mjs.map +1 -0
  15. package/fesm2022/ng-forge-dynamic-forms-material-lazy-radio.mjs +92 -0
  16. package/fesm2022/ng-forge-dynamic-forms-material-lazy-radio.mjs.map +1 -0
  17. package/fesm2022/ng-forge-dynamic-forms-material-lazy-select.mjs +106 -0
  18. package/fesm2022/ng-forge-dynamic-forms-material-lazy-select.mjs.map +1 -0
  19. package/fesm2022/ng-forge-dynamic-forms-material-lazy-slider.mjs +76 -0
  20. package/fesm2022/ng-forge-dynamic-forms-material-lazy-slider.mjs.map +1 -0
  21. package/fesm2022/ng-forge-dynamic-forms-material-lazy-textarea.mjs +92 -0
  22. package/fesm2022/ng-forge-dynamic-forms-material-lazy-textarea.mjs.map +1 -0
  23. package/fesm2022/ng-forge-dynamic-forms-material-lazy-toggle.mjs +76 -0
  24. package/fesm2022/ng-forge-dynamic-forms-material-lazy-toggle.mjs.map +1 -0
  25. package/fesm2022/ng-forge-dynamic-forms-material-mat-field-errors-wrapper.component-QsDJRuUx.mjs +26 -0
  26. package/fesm2022/ng-forge-dynamic-forms-material-mat-field-errors-wrapper.component-QsDJRuUx.mjs.map +1 -0
  27. package/fesm2022/ng-forge-dynamic-forms-material-shared.mjs +14 -0
  28. package/fesm2022/ng-forge-dynamic-forms-material-shared.mjs.map +1 -0
  29. package/fesm2022/ng-forge-dynamic-forms-material.mjs +42 -93
  30. package/fesm2022/ng-forge-dynamic-forms-material.mjs.map +1 -1
  31. package/package.json +55 -3
  32. package/types/ng-forge-dynamic-forms-material-lazy-addon-button.d.ts +18 -0
  33. package/types/ng-forge-dynamic-forms-material-lazy-addon-icon.d.ts +17 -0
  34. package/types/ng-forge-dynamic-forms-material-lazy-button.d.ts +114 -0
  35. package/types/ng-forge-dynamic-forms-material-lazy-checkbox.d.ts +26 -0
  36. package/types/ng-forge-dynamic-forms-material-lazy-datepicker.d.ts +37 -0
  37. package/types/ng-forge-dynamic-forms-material-lazy-input.d.ts +55 -0
  38. package/types/ng-forge-dynamic-forms-material-lazy-multi-checkbox.d.ts +29 -0
  39. package/types/ng-forge-dynamic-forms-material-lazy-radio.d.ts +24 -0
  40. package/types/ng-forge-dynamic-forms-material-lazy-select.d.ts +35 -0
  41. package/types/ng-forge-dynamic-forms-material-lazy-slider.d.ts +27 -0
  42. package/types/ng-forge-dynamic-forms-material-lazy-textarea.d.ts +31 -0
  43. package/types/ng-forge-dynamic-forms-material-lazy-toggle.d.ts +28 -0
  44. package/types/ng-forge-dynamic-forms-material-shared.d.ts +91 -0
  45. package/types/ng-forge-dynamic-forms-material.d.ts +10 -161
@@ -0,0 +1,196 @@
1
+ import { AsyncPipe } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, input, computed, signal, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
4
+ import { FormField } from '@angular/forms/signals';
5
+ import { MatFormField, MatLabel, MatError, MatPrefix, MatSuffix } from '@angular/material/form-field';
6
+ import { MatInput, MatHint } from '@angular/material/input';
7
+ import { DynamicFormLogger } from '@ng-forge/dynamic-forms';
8
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
9
+ import { injectNgForgeField, injectNgForgeAddons, NgForgeControl, DfAddonSlot, DynamicTextPipe, ADDON_PRESET_HANDLER, FIELD_SIGNAL_CONTEXT, NgForgeFieldHost, NgForgeAddons } from '@ng-forge/dynamic-forms/integration';
10
+ import { MATERIAL_CONFIG, MAT_INPUT_TYPE_OVERRIDE, runMatPresetAction } from '@ng-forge/dynamic-forms-material/shared';
11
+
12
+ class MatInputFieldComponent {
13
+ materialConfig = inject(MATERIAL_CONFIG, { optional: true });
14
+ ngf = injectNgForgeField();
15
+ ngfa = injectNgForgeAddons();
16
+ props = input(/* @ts-ignore */
17
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
18
+ fieldInputs = input(/* @ts-ignore */
19
+ ...(ngDevMode ? [undefined, { debugName: "fieldInputs" }] : /* istanbul ignore next */ []));
20
+ typeOverride = inject(MAT_INPUT_TYPE_OVERRIDE);
21
+ appearance = computed(() => this.props()?.appearance ?? this.materialConfig?.appearance ?? 'outline', /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
23
+ subscriptSizing = computed(() => this.props()?.subscriptSizing ?? this.materialConfig?.subscriptSizing ?? 'dynamic', /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "subscriptSizing" }] : /* istanbul ignore next */ []));
25
+ floatLabel = computed(() => this.props()?.floatLabel ?? this.materialConfig?.floatLabel ?? 'auto', /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "floatLabel" }] : /* istanbul ignore next */ []));
27
+ hideRequiredMarker = computed(() => this.props()?.hideRequiredMarker ?? this.materialConfig?.hideRequiredMarker ?? false, /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "hideRequiredMarker" }] : /* istanbul ignore next */ []));
29
+ type = computed(() => this.typeOverride() ?? this.props()?.type ?? 'text', /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
31
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatInputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
32
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: MatInputFieldComponent, isStandalone: true, selector: "df-mat-input", inputs: { props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, fieldInputs: { classPropertyName: "fieldInputs", publicName: "fieldInputs", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
33
+ {
34
+ provide: MAT_INPUT_TYPE_OVERRIDE,
35
+ useFactory: () => signal(undefined),
36
+ },
37
+ {
38
+ provide: ADDON_PRESET_HANDLER,
39
+ useFactory: () => {
40
+ const typeOverride = inject(MAT_INPUT_TYPE_OVERRIDE);
41
+ const fsc = inject(FIELD_SIGNAL_CONTEXT, { optional: true });
42
+ const logger = inject(DynamicFormLogger);
43
+ const host = inject(forwardRef(() => MatInputFieldComponent));
44
+ return {
45
+ run: (preset, ctx) => {
46
+ const fieldKey = ctx.field.key;
47
+ return runMatPresetAction(preset, ctx, {
48
+ typeOverride,
49
+ fieldValueSetter: ctx.setValue,
50
+ fieldDefaultValueGetter: fsc && fieldKey ? () => fsc.defaultValues()?.[fieldKey] : undefined,
51
+ baselineType: () => host.props()?.type,
52
+ logger,
53
+ });
54
+ },
55
+ };
56
+ },
57
+ },
58
+ ], hostDirectives: [{ directive: i1.NgForgeFieldHost }, { directive: i1.NgForgeAddons }], ngImport: i0, template: `
59
+ @let inputId = ngf.key() + '-input';
60
+
61
+ <mat-form-field
62
+ [appearance]="appearance()"
63
+ [subscriptSizing]="subscriptSizing()"
64
+ [floatLabel]="floatLabel()"
65
+ [hideRequiredMarker]="hideRequiredMarker()"
66
+ >
67
+ @if (ngf.label()) {
68
+ <mat-label>{{ ngf.label() | dynamicText | async }}</mat-label>
69
+ }
70
+ @for (a of ngfa.prefixAddons(); track $index) {
71
+ <df-addon-slot
72
+ matPrefix
73
+ [class.df-mat-addon-text]="a.type === 'text'"
74
+ [addon]="a"
75
+ [fieldInputs]="fieldInputs()"
76
+ [hidden]="ngfa.hiddenSignalCache().get(a)"
77
+ />
78
+ }
79
+ <input
80
+ matInput
81
+ ngForgeControl
82
+ [id]="inputId"
83
+ [formField]="ngf.field()"
84
+ [type]="type()"
85
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
86
+ [attr.tabindex]="ngf.tabIndex()"
87
+ />
88
+ @for (a of ngfa.suffixAddons(); track $index) {
89
+ <df-addon-slot
90
+ matSuffix
91
+ [class.df-mat-addon-text]="a.type === 'text'"
92
+ [addon]="a"
93
+ [fieldInputs]="fieldInputs()"
94
+ [hidden]="ngfa.hiddenSignalCache().get(a)"
95
+ />
96
+ }
97
+ @if (ngf.errorsToDisplay()[0]; as error) {
98
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
99
+ } @else if (props()?.hint; as hint) {
100
+ <mat-hint [id]="ngf.hintId()">{{ hint | dynamicText | async }}</mat-hint>
101
+ }
102
+ </mat-form-field>
103
+ `, isInline: true, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n", "mat-form-field{width:100%}:host([hidden]){display:none!important}:host{--df-mat-addon-prefix-outer-padding: .75em;--df-mat-addon-prefix-inner-padding: .5em;--df-mat-addon-suffix-inner-padding: .5em;--df-mat-addon-suffix-outer-padding: .75em;--df-mat-addon-prefix-text-outer-padding: 1em;--df-mat-addon-prefix-text-inner-padding: 1em;--df-mat-addon-suffix-text-inner-padding: 1em;--df-mat-addon-suffix-text-outer-padding: 1em}df-addon-slot[matprefix]{padding-left:var(--df-mat-addon-prefix-outer-padding);padding-right:var(--df-mat-addon-prefix-inner-padding)}df-addon-slot[matsuffix]{padding-left:var(--df-mat-addon-suffix-inner-padding);padding-right:var(--df-mat-addon-suffix-outer-padding)}df-addon-slot[matprefix].df-mat-addon-text{padding-left:var(--df-mat-addon-prefix-text-outer-padding);padding-right:var(--df-mat-addon-prefix-text-inner-padding)}df-addon-slot[matsuffix].df-mat-addon-text{padding-left:var(--df-mat-addon-suffix-text-inner-padding);padding-right:var(--df-mat-addon-suffix-text-outer-padding)}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "component", type: DfAddonSlot, selector: "df-addon-slot", inputs: ["addon", "fieldInputs", "hidden"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
104
+ }
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatInputFieldComponent, decorators: [{
106
+ type: Component,
107
+ args: [{ selector: 'df-mat-input', imports: [
108
+ MatFormField,
109
+ MatLabel,
110
+ MatInput,
111
+ MatHint,
112
+ MatError,
113
+ MatPrefix,
114
+ MatSuffix,
115
+ FormField,
116
+ DynamicTextPipe,
117
+ AsyncPipe,
118
+ NgForgeControl,
119
+ DfAddonSlot,
120
+ ], hostDirectives: [NgForgeFieldHost, NgForgeAddons], template: `
121
+ @let inputId = ngf.key() + '-input';
122
+
123
+ <mat-form-field
124
+ [appearance]="appearance()"
125
+ [subscriptSizing]="subscriptSizing()"
126
+ [floatLabel]="floatLabel()"
127
+ [hideRequiredMarker]="hideRequiredMarker()"
128
+ >
129
+ @if (ngf.label()) {
130
+ <mat-label>{{ ngf.label() | dynamicText | async }}</mat-label>
131
+ }
132
+ @for (a of ngfa.prefixAddons(); track $index) {
133
+ <df-addon-slot
134
+ matPrefix
135
+ [class.df-mat-addon-text]="a.type === 'text'"
136
+ [addon]="a"
137
+ [fieldInputs]="fieldInputs()"
138
+ [hidden]="ngfa.hiddenSignalCache().get(a)"
139
+ />
140
+ }
141
+ <input
142
+ matInput
143
+ ngForgeControl
144
+ [id]="inputId"
145
+ [formField]="ngf.field()"
146
+ [type]="type()"
147
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
148
+ [attr.tabindex]="ngf.tabIndex()"
149
+ />
150
+ @for (a of ngfa.suffixAddons(); track $index) {
151
+ <df-addon-slot
152
+ matSuffix
153
+ [class.df-mat-addon-text]="a.type === 'text'"
154
+ [addon]="a"
155
+ [fieldInputs]="fieldInputs()"
156
+ [hidden]="ngfa.hiddenSignalCache().get(a)"
157
+ />
158
+ }
159
+ @if (ngf.errorsToDisplay()[0]; as error) {
160
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
161
+ } @else if (props()?.hint; as hint) {
162
+ <mat-hint [id]="ngf.hintId()">{{ hint | dynamicText | async }}</mat-hint>
163
+ }
164
+ </mat-form-field>
165
+ `, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
166
+ {
167
+ provide: MAT_INPUT_TYPE_OVERRIDE,
168
+ useFactory: () => signal(undefined),
169
+ },
170
+ {
171
+ provide: ADDON_PRESET_HANDLER,
172
+ useFactory: () => {
173
+ const typeOverride = inject(MAT_INPUT_TYPE_OVERRIDE);
174
+ const fsc = inject(FIELD_SIGNAL_CONTEXT, { optional: true });
175
+ const logger = inject(DynamicFormLogger);
176
+ const host = inject(forwardRef(() => MatInputFieldComponent));
177
+ return {
178
+ run: (preset, ctx) => {
179
+ const fieldKey = ctx.field.key;
180
+ return runMatPresetAction(preset, ctx, {
181
+ typeOverride,
182
+ fieldValueSetter: ctx.setValue,
183
+ fieldDefaultValueGetter: fsc && fieldKey ? () => fsc.defaultValues()?.[fieldKey] : undefined,
184
+ baselineType: () => host.props()?.type,
185
+ logger,
186
+ });
187
+ },
188
+ };
189
+ },
190
+ },
191
+ ], styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n", "mat-form-field{width:100%}:host([hidden]){display:none!important}:host{--df-mat-addon-prefix-outer-padding: .75em;--df-mat-addon-prefix-inner-padding: .5em;--df-mat-addon-suffix-inner-padding: .5em;--df-mat-addon-suffix-outer-padding: .75em;--df-mat-addon-prefix-text-outer-padding: 1em;--df-mat-addon-prefix-text-inner-padding: 1em;--df-mat-addon-suffix-text-inner-padding: 1em;--df-mat-addon-suffix-text-outer-padding: 1em}df-addon-slot[matprefix]{padding-left:var(--df-mat-addon-prefix-outer-padding);padding-right:var(--df-mat-addon-prefix-inner-padding)}df-addon-slot[matsuffix]{padding-left:var(--df-mat-addon-suffix-inner-padding);padding-right:var(--df-mat-addon-suffix-outer-padding)}df-addon-slot[matprefix].df-mat-addon-text{padding-left:var(--df-mat-addon-prefix-text-outer-padding);padding-right:var(--df-mat-addon-prefix-text-inner-padding)}df-addon-slot[matsuffix].df-mat-addon-text{padding-left:var(--df-mat-addon-suffix-text-inner-padding);padding-right:var(--df-mat-addon-suffix-text-outer-padding)}\n"] }]
192
+ }], propDecorators: { props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], fieldInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "fieldInputs", required: false }] }] } });
193
+
194
+
195
+ export { MatInputFieldComponent };
196
+ //# sourceMappingURL=ng-forge-dynamic-forms-material-lazy-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-material-lazy-input.mjs","mappings":";;;;;;;;;;;AAwKc;;;;AAMH;;AAET,IAKS;;IAGQ;AAER;;AAEA;;AAEA;;AAEA;;IAGU;;;AA3BA;AAlCjB;AACE;AACA;AACD;AACD;gFAME;;AAEE;AACA;AACA;oBAEA;;AAEE;AACE;AACA;;;;;;AAOC;;;;AAIR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA/IO;;;;;;;;;;;;;AAcT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGC;AACE;AACA;AACD;AACD;4IAME;;AAEE;AACA;AACA;;;AAIE;AACE;AACA;;;;;;AAOC;;;;AAIR;AACF","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-material/src/lib/fields/input/mat-input.component.ts"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, forwardRef, inject, input, signal } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { MatError, MatFormField, MatLabel, MatPrefix, MatSuffix } from '@angular/material/form-field';\nimport { MatHint, MatInput } from '@angular/material/input';\nimport { AddonActionContext, AddonActionPreset, DynamicFormLogger } from '@ng-forge/dynamic-forms';\nimport { DfAddonSlot } from '@ng-forge/dynamic-forms/integration';\nimport { WrapperFieldInputs } from '@ng-forge/dynamic-forms/integration';\nimport { DynamicTextPipe, FIELD_SIGNAL_CONTEXT } from '@ng-forge/dynamic-forms/integration';\nimport {\n ADDON_PRESET_HANDLER,\n AddonPresetHandler,\n injectNgForgeAddons,\n injectNgForgeField,\n NgForgeAddons,\n NgForgeControl,\n NgForgeFieldHost,\n} from '@ng-forge/dynamic-forms/integration';\nimport { MATERIAL_CONFIG, MAT_INPUT_TYPE_OVERRIDE, runMatPresetAction } from '@ng-forge/dynamic-forms-material/shared';\nimport { MatInputAddon, MatInputProps } from './mat-input.type';\n\n@Component({\n selector: 'df-mat-input',\n imports: [\n MatFormField,\n MatLabel,\n MatInput,\n MatHint,\n MatError,\n MatPrefix,\n MatSuffix,\n FormField,\n DynamicTextPipe,\n AsyncPipe,\n NgForgeControl,\n DfAddonSlot,\n ],\n hostDirectives: [NgForgeFieldHost, NgForgeAddons],\n template: `\n @let inputId = ngf.key() + '-input';\n\n <mat-form-field\n [appearance]=\"appearance()\"\n [subscriptSizing]=\"subscriptSizing()\"\n [floatLabel]=\"floatLabel()\"\n [hideRequiredMarker]=\"hideRequiredMarker()\"\n >\n @if (ngf.label()) {\n <mat-label>{{ ngf.label() | dynamicText | async }}</mat-label>\n }\n @for (a of ngfa.prefixAddons(); track $index) {\n <df-addon-slot\n matPrefix\n [class.df-mat-addon-text]=\"a.type === 'text'\"\n [addon]=\"a\"\n [fieldInputs]=\"fieldInputs()\"\n [hidden]=\"ngfa.hiddenSignalCache().get(a)\"\n />\n }\n <input\n matInput\n ngForgeControl\n [id]=\"inputId\"\n [formField]=\"ngf.field()\"\n [type]=\"type()\"\n [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n />\n @for (a of ngfa.suffixAddons(); track $index) {\n <df-addon-slot\n matSuffix\n [class.df-mat-addon-text]=\"a.type === 'text'\"\n [addon]=\"a\"\n [fieldInputs]=\"fieldInputs()\"\n [hidden]=\"ngfa.hiddenSignalCache().get(a)\"\n />\n }\n @if (ngf.errorsToDisplay()[0]; as error) {\n <mat-error [id]=\"ngf.errorId()\">{{ error.message }}</mat-error>\n } @else if (props()?.hint; as hint) {\n <mat-hint [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</mat-hint>\n }\n </mat-form-field>\n `,\n styleUrl: '../../styles/_form-field.scss',\n styles: [\n `\n mat-form-field {\n width: 100%;\n }\n :host([hidden]) {\n display: none !important;\n }\n /* matPrefix/matSuffix elements have no default Material spacing.\n All four sides + the text-type variants are independent CSS custom\n properties so consumers can tune each individually:\n prefix-outer = prefix slot's left (border-facing) padding\n prefix-inner = prefix slot's right (text-facing) padding\n suffix-inner = suffix slot's left (text-facing) padding\n suffix-outer = suffix slot's right (border-facing) padding\n Text variants override only the INNER side because <mat-icon> has\n ~4-6px optical padding inside its glyph box (so it looks \"padded\"\n even with a small CSS value) while text glyphs sit flush against\n their bounding box and need the extra room to match. */\n :host {\n --df-mat-addon-prefix-outer-padding: 0.75em;\n --df-mat-addon-prefix-inner-padding: 0.5em;\n --df-mat-addon-suffix-inner-padding: 0.5em;\n --df-mat-addon-suffix-outer-padding: 0.75em;\n --df-mat-addon-prefix-text-outer-padding: 1em;\n --df-mat-addon-prefix-text-inner-padding: 1em;\n --df-mat-addon-suffix-text-inner-padding: 1em;\n --df-mat-addon-suffix-text-outer-padding: 1em;\n }\n df-addon-slot[matprefix] {\n padding-left: var(--df-mat-addon-prefix-outer-padding);\n padding-right: var(--df-mat-addon-prefix-inner-padding);\n }\n df-addon-slot[matsuffix] {\n padding-left: var(--df-mat-addon-suffix-inner-padding);\n padding-right: var(--df-mat-addon-suffix-outer-padding);\n }\n df-addon-slot[matprefix].df-mat-addon-text {\n padding-left: var(--df-mat-addon-prefix-text-outer-padding);\n padding-right: var(--df-mat-addon-prefix-text-inner-padding);\n }\n df-addon-slot[matsuffix].df-mat-addon-text {\n padding-left: var(--df-mat-addon-suffix-text-inner-padding);\n padding-right: var(--df-mat-addon-suffix-text-outer-padding);\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: MAT_INPUT_TYPE_OVERRIDE,\n useFactory: () => signal<string | undefined>(undefined),\n },\n {\n // Adapter-specific preset semantics for `mat-button` addons (clear /\n // reset / paste / copy / toggle-password-visibility). The directive\n // (`NgForgeAddonAction`) delegates here when an addon configures a\n // `preset`. Per-mat-input-instance so the `typeOverride` signal is\n // scoped to one field.\n provide: ADDON_PRESET_HANDLER,\n useFactory: (): AddonPresetHandler => {\n const typeOverride = inject(MAT_INPUT_TYPE_OVERRIDE);\n const fsc = inject(FIELD_SIGNAL_CONTEXT, { optional: true });\n const logger = inject(DynamicFormLogger);\n // forwardRef for baselineType only — host.props()?.type gates toggle-password-visibility.\n const host = inject(forwardRef(() => MatInputFieldComponent));\n return {\n run: (preset: string, ctx: AddonActionContext) => {\n const fieldKey = ctx.field.key;\n return runMatPresetAction(preset as AddonActionPreset, ctx, {\n typeOverride,\n fieldValueSetter: ctx.setValue,\n fieldDefaultValueGetter:\n fsc && fieldKey ? () => (fsc.defaultValues() as Record<string, unknown> | undefined)?.[fieldKey] : undefined,\n baselineType: () => host.props()?.type,\n logger,\n });\n },\n };\n },\n },\n ],\n})\nexport default class MatInputFieldComponent {\n private materialConfig = inject(MATERIAL_CONFIG, { optional: true });\n\n protected readonly ngf = injectNgForgeField<string>();\n protected readonly ngfa = injectNgForgeAddons<MatInputAddon>();\n\n readonly props = input<MatInputProps>();\n\n /**\n * Wrapper-style host bag pushed by `DfFieldOutlet`. Declared at the\n * component level so `setInputIfDeclared` (which uses\n * `reflectComponentType`) can write it.\n */\n readonly fieldInputs = input<WrapperFieldInputs | undefined>();\n\n /** Per-instance type override populated by `toggle-password-visibility` preset. */\n private readonly typeOverride = inject(MAT_INPUT_TYPE_OVERRIDE);\n\n readonly appearance = computed(() => this.props()?.appearance ?? this.materialConfig?.appearance ?? 'outline');\n\n readonly subscriptSizing = computed(() => this.props()?.subscriptSizing ?? this.materialConfig?.subscriptSizing ?? 'dynamic');\n\n readonly floatLabel = computed(() => this.props()?.floatLabel ?? this.materialConfig?.floatLabel ?? 'auto');\n\n readonly hideRequiredMarker = computed(() => this.props()?.hideRequiredMarker ?? this.materialConfig?.hideRequiredMarker ?? false);\n\n /** Override (set by `toggle-password-visibility` preset) wins over `props().type`. */\n protected readonly type = computed(() => this.typeOverride() ?? this.props()?.type ?? 'text');\n}\n"]}
@@ -0,0 +1,136 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, linkedSignal, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { MatCheckbox } from '@angular/material/checkbox';
4
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
5
+ import { injectNgForgeField, isEqual, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
6
+ import { explicitEffect } from 'ngxtension/explicit-effect';
7
+ import { MatError } from '@angular/material/input';
8
+ import { AsyncPipe } from '@angular/common';
9
+
10
+ class MatMultiCheckboxFieldComponent {
11
+ ngf = injectNgForgeField();
12
+ options = input([], /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
14
+ props = input(/* @ts-ignore */
15
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
16
+ valueViewModel = linkedSignal(() => {
17
+ const currentValues = this.ngf.field()().value();
18
+ return this.options().filter((option) => currentValues.includes(option.value));
19
+ }, { ...(ngDevMode ? { debugName: "valueViewModel" } : /* istanbul ignore next */ {}), equal: isEqual });
20
+ checkedValuesMap = computed(() => {
21
+ const map = {};
22
+ for (const opt of this.valueViewModel()) {
23
+ map[String(opt.value)] = true;
24
+ }
25
+ return map;
26
+ }, /* @ts-ignore */
27
+ ...(ngDevMode ? [{ debugName: "checkedValuesMap" }] : /* istanbul ignore next */ []));
28
+ constructor() {
29
+ explicitEffect([this.valueViewModel], ([selectedOptions]) => {
30
+ const selectedValues = selectedOptions.map((option) => option.value);
31
+ if (!isEqual(selectedValues, this.ngf.field()().value())) {
32
+ this.ngf.field()().value.set(selectedValues);
33
+ }
34
+ });
35
+ explicitEffect([this.options], ([options]) => {
36
+ const values = options.map((option) => option.value);
37
+ const uniqueValues = new Set(values);
38
+ if (values.length !== uniqueValues.size) {
39
+ const duplicates = values.filter((value, index) => values.indexOf(value) !== index);
40
+ throw new Error(`Duplicate option values detected in mat-multi-checkbox: ${duplicates.join(', ')}`);
41
+ }
42
+ });
43
+ }
44
+ onCheckboxChange(option, checked) {
45
+ this.valueViewModel.update((currentOptions) => {
46
+ if (checked) {
47
+ return currentOptions.some((opt) => opt.value === option.value) ? currentOptions : [...currentOptions, option];
48
+ }
49
+ else {
50
+ return currentOptions.filter((opt) => opt.value !== option.value);
51
+ }
52
+ });
53
+ }
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatMultiCheckboxFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
55
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: MatMultiCheckboxFieldComponent, isStandalone: true, selector: "df-mat-multi-checkbox", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
56
+ @let f = ngf.field();
57
+ @let checkboxGroupId = ngf.key() + '-checkbox-group';
58
+ @let checked = checkedValuesMap();
59
+
60
+ @if (ngf.label(); as label) {
61
+ <div class="checkbox-group-label">{{ label | dynamicText | async }}</div>
62
+ }
63
+
64
+ <div
65
+ [id]="checkboxGroupId"
66
+ class="checkbox-group"
67
+ role="group"
68
+ [attr.aria-invalid]="ngf.ariaInvalid()"
69
+ [attr.aria-required]="ngf.ariaRequired()"
70
+ [attr.aria-describedby]="ngf.ariaDescribedBy()"
71
+ >
72
+ @for (option of options(); track option.value) {
73
+ <mat-checkbox
74
+ ngForgeControl="input[type='checkbox']"
75
+ [checked]="checked['' + option.value]"
76
+ [disabled]="f().disabled() || option.disabled"
77
+ [color]="props()?.color || 'primary'"
78
+ [labelPosition]="props()?.labelPosition || 'after'"
79
+ (change)="onCheckboxChange(option, $event.checked)"
80
+ >
81
+ {{ option.label | dynamicText | async }}
82
+ </mat-checkbox>
83
+ }
84
+ </div>
85
+
86
+ @if (ngf.errorsToDisplay()[0]; as error) {
87
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
88
+ } @else if (props()?.hint; as hint) {
89
+ <div class="mat-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
90
+ }
91
+ `, isInline: true, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n"], dependencies: [{ kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
92
+ }
93
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatMultiCheckboxFieldComponent, decorators: [{
94
+ type: Component,
95
+ args: [{ selector: 'df-mat-multi-checkbox', imports: [MatCheckbox, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
96
+ @let f = ngf.field();
97
+ @let checkboxGroupId = ngf.key() + '-checkbox-group';
98
+ @let checked = checkedValuesMap();
99
+
100
+ @if (ngf.label(); as label) {
101
+ <div class="checkbox-group-label">{{ label | dynamicText | async }}</div>
102
+ }
103
+
104
+ <div
105
+ [id]="checkboxGroupId"
106
+ class="checkbox-group"
107
+ role="group"
108
+ [attr.aria-invalid]="ngf.ariaInvalid()"
109
+ [attr.aria-required]="ngf.ariaRequired()"
110
+ [attr.aria-describedby]="ngf.ariaDescribedBy()"
111
+ >
112
+ @for (option of options(); track option.value) {
113
+ <mat-checkbox
114
+ ngForgeControl="input[type='checkbox']"
115
+ [checked]="checked['' + option.value]"
116
+ [disabled]="f().disabled() || option.disabled"
117
+ [color]="props()?.color || 'primary'"
118
+ [labelPosition]="props()?.labelPosition || 'after'"
119
+ (change)="onCheckboxChange(option, $event.checked)"
120
+ >
121
+ {{ option.label | dynamicText | async }}
122
+ </mat-checkbox>
123
+ }
124
+ </div>
125
+
126
+ @if (ngf.errorsToDisplay()[0]; as error) {
127
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
128
+ } @else if (props()?.hint; as hint) {
129
+ <div class="mat-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
130
+ }
131
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n"] }]
132
+ }], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
133
+
134
+
135
+ export { MatMultiCheckboxFieldComponent };
136
+ //# sourceMappingURL=ng-forge-dynamic-forms-material-lazy-multi-checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-material-lazy-multi-checkbox.mjs","mappings":";;;;;;;;;AAsDc;;;;AAIH;;AAET;AAEI;;AAEF;IAKO;;;;;AAKP;;;AAGF;AACE;AACE;AAEA;AACE;;AAEJ;AAEA;AACE;AACA;;;AAIE;;AAEJ;;;;;AAMI;;;AAEA;;AAEJ;;;AAlDiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA3CT","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-material/src/lib/fields/multi-checkbox/mat-multi-checkbox.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, linkedSignal } from '@angular/core';\nimport { MatCheckbox } from '@angular/material/checkbox';\nimport { FieldOption, ValueType } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { injectNgForgeField, NgForgeFieldHost, isEqual, NgForgeControl } from '@ng-forge/dynamic-forms/integration';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { MatMultiCheckboxProps } from './mat-multi-checkbox.type';\nimport { MatError } from '@angular/material/input';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-mat-multi-checkbox',\n imports: [MatCheckbox, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl],\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field();\n @let checkboxGroupId = ngf.key() + '-checkbox-group';\n @let checked = checkedValuesMap();\n\n @if (ngf.label(); as label) {\n <div class=\"checkbox-group-label\">{{ label | dynamicText | async }}</div>\n }\n\n <div\n [id]=\"checkboxGroupId\"\n class=\"checkbox-group\"\n role=\"group\"\n [attr.aria-invalid]=\"ngf.ariaInvalid()\"\n [attr.aria-required]=\"ngf.ariaRequired()\"\n [attr.aria-describedby]=\"ngf.ariaDescribedBy()\"\n >\n @for (option of options(); track option.value) {\n <mat-checkbox\n ngForgeControl=\"input[type='checkbox']\"\n [checked]=\"checked['' + option.value]\"\n [disabled]=\"f().disabled() || option.disabled\"\n [color]=\"props()?.color || 'primary'\"\n [labelPosition]=\"props()?.labelPosition || 'after'\"\n (change)=\"onCheckboxChange(option, $event.checked)\"\n >\n {{ option.label | dynamicText | async }}\n </mat-checkbox>\n }\n </div>\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <mat-error [id]=\"ngf.errorId()\">{{ error.message }}</mat-error>\n } @else if (props()?.hint; as hint) {\n <div class=\"mat-hint\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</div>\n }\n `,\n styleUrl: '../../styles/_form-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class MatMultiCheckboxFieldComponent {\n protected readonly ngf = injectNgForgeField<ValueType[]>();\n\n readonly options = input<FieldOption<ValueType>[]>([]);\n readonly props = input<MatMultiCheckboxProps>();\n\n valueViewModel = linkedSignal<FieldOption<ValueType>[]>(\n () => {\n const currentValues = this.ngf.field()().value();\n return this.options().filter((option) => currentValues.includes(option.value));\n },\n { equal: isEqual },\n );\n\n /** Computed map of checked option values for O(1) lookup in template */\n readonly checkedValuesMap = computed(() => {\n const map: Record<string, boolean> = {};\n for (const opt of this.valueViewModel()) {\n map[String(opt.value)] = true;\n }\n return map;\n });\n\n constructor() {\n explicitEffect([this.valueViewModel], ([selectedOptions]) => {\n const selectedValues = selectedOptions.map((option) => option.value);\n\n if (!isEqual(selectedValues, this.ngf.field()().value())) {\n this.ngf.field()().value.set(selectedValues);\n }\n });\n\n explicitEffect([this.options], ([options]) => {\n const values = options.map((option) => option.value);\n const uniqueValues = new Set(values);\n\n if (values.length !== uniqueValues.size) {\n const duplicates = values.filter((value, index) => values.indexOf(value) !== index);\n throw new Error(`Duplicate option values detected in mat-multi-checkbox: ${duplicates.join(', ')}`);\n }\n });\n }\n\n onCheckboxChange(option: FieldOption<ValueType>, checked: boolean): void {\n this.valueViewModel.update((currentOptions) => {\n if (checked) {\n return currentOptions.some((opt) => opt.value === option.value) ? currentOptions : [...currentOptions, option];\n } else {\n return currentOptions.filter((opt) => opt.value !== option.value);\n }\n });\n }\n}\n"]}
@@ -0,0 +1,92 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { FormField } from '@angular/forms/signals';
4
+ import { MatRadioGroup, MatRadioButton } from '@angular/material/radio';
5
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
6
+ import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
7
+ import { MatError } from '@angular/material/input';
8
+ import { AsyncPipe } from '@angular/common';
9
+
10
+ class MatRadioFieldComponent {
11
+ ngf = injectNgForgeField();
12
+ options = input([], /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
14
+ props = input(/* @ts-ignore */
15
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
16
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatRadioFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: MatRadioFieldComponent, isStandalone: true, selector: "df-mat-radio", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
18
+ @let f = ngf.field();
19
+ @let radioGroupId = ngf.key() + '-radio-group';
20
+
21
+ @if (ngf.label()) {
22
+ <div class="radio-label">{{ ngf.label() | dynamicText | async }}</div>
23
+ }
24
+
25
+ <mat-radio-group
26
+ [id]="radioGroupId"
27
+ [formField]="f"
28
+ [attr.aria-invalid]="ngf.ariaInvalid()"
29
+ [attr.aria-required]="ngf.ariaRequired()"
30
+ [attr.aria-describedby]="ngf.ariaDescribedBy()"
31
+ >
32
+ @for (option of options(); track option.value) {
33
+ <mat-radio-button
34
+ ngForgeControl="input[type='radio']"
35
+ [value]="option.value"
36
+ [disabled]="option.disabled || false"
37
+ [color]="props()?.color || 'primary'"
38
+ [labelPosition]="props()?.labelPosition || 'after'"
39
+ >
40
+ {{ option.label | dynamicText | async }}
41
+ </mat-radio-button>
42
+ }
43
+ </mat-radio-group>
44
+
45
+ @if (ngf.errorsToDisplay()[0]; as error) {
46
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
47
+ } @else if (props()?.hint; as hint) {
48
+ <div class="mat-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
49
+ }
50
+ `, isInline: true, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n"], dependencies: [{ kind: "directive", type: MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: 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: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
51
+ }
52
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatRadioFieldComponent, decorators: [{
53
+ type: Component,
54
+ args: [{ selector: 'df-mat-radio', imports: [MatRadioGroup, MatRadioButton, FormField, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
55
+ @let f = ngf.field();
56
+ @let radioGroupId = ngf.key() + '-radio-group';
57
+
58
+ @if (ngf.label()) {
59
+ <div class="radio-label">{{ ngf.label() | dynamicText | async }}</div>
60
+ }
61
+
62
+ <mat-radio-group
63
+ [id]="radioGroupId"
64
+ [formField]="f"
65
+ [attr.aria-invalid]="ngf.ariaInvalid()"
66
+ [attr.aria-required]="ngf.ariaRequired()"
67
+ [attr.aria-describedby]="ngf.ariaDescribedBy()"
68
+ >
69
+ @for (option of options(); track option.value) {
70
+ <mat-radio-button
71
+ ngForgeControl="input[type='radio']"
72
+ [value]="option.value"
73
+ [disabled]="option.disabled || false"
74
+ [color]="props()?.color || 'primary'"
75
+ [labelPosition]="props()?.labelPosition || 'after'"
76
+ >
77
+ {{ option.label | dynamicText | async }}
78
+ </mat-radio-button>
79
+ }
80
+ </mat-radio-group>
81
+
82
+ @if (ngf.errorsToDisplay()[0]; as error) {
83
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
84
+ } @else if (props()?.hint; as hint) {
85
+ <div class="mat-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
86
+ }
87
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n"] }]
88
+ }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
89
+
90
+
91
+ export { MatRadioFieldComponent };
92
+ //# sourceMappingURL=ng-forge-dynamic-forms-material-lazy-radio.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-material-lazy-radio.mjs","mappings":";;;;;;;;;AAmDc;;;;AAIH;;;AAJU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAJlB","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-material/src/lib/fields/radio/mat-radio.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { MatRadioButton, MatRadioGroup } from '@angular/material/radio';\nimport { FieldOption, ValueType } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { MatRadioProps } from './mat-radio.type';\nimport { MatError } from '@angular/material/input';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-mat-radio',\n imports: [MatRadioGroup, MatRadioButton, FormField, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl],\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field();\n @let radioGroupId = ngf.key() + '-radio-group';\n\n @if (ngf.label()) {\n <div class=\"radio-label\">{{ ngf.label() | dynamicText | async }}</div>\n }\n\n <mat-radio-group\n [id]=\"radioGroupId\"\n [formField]=\"f\"\n [attr.aria-invalid]=\"ngf.ariaInvalid()\"\n [attr.aria-required]=\"ngf.ariaRequired()\"\n [attr.aria-describedby]=\"ngf.ariaDescribedBy()\"\n >\n @for (option of options(); track option.value) {\n <mat-radio-button\n ngForgeControl=\"input[type='radio']\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled || false\"\n [color]=\"props()?.color || 'primary'\"\n [labelPosition]=\"props()?.labelPosition || 'after'\"\n >\n {{ option.label | dynamicText | async }}\n </mat-radio-button>\n }\n </mat-radio-group>\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <mat-error [id]=\"ngf.errorId()\">{{ error.message }}</mat-error>\n } @else if (props()?.hint; as hint) {\n <div class=\"mat-hint\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</div>\n }\n `,\n styleUrl: '../../styles/_form-field.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class MatRadioFieldComponent {\n protected readonly ngf = injectNgForgeField<ValueType>();\n\n readonly options = input<FieldOption<ValueType>[]>([]);\n readonly props = input<MatRadioProps>();\n}\n"]}
@@ -0,0 +1,106 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { FormField } from '@angular/forms/signals';
4
+ import { MatFormField, MatLabel, MatError } from '@angular/material/form-field';
5
+ import { MatSelect, MatOption } from '@angular/material/select';
6
+ import { MatHint } from '@angular/material/input';
7
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
8
+ import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
9
+ import { AsyncPipe } from '@angular/common';
10
+ import { MATERIAL_CONFIG } from '@ng-forge/dynamic-forms-material/shared';
11
+
12
+ class MatSelectFieldComponent {
13
+ materialConfig = inject(MATERIAL_CONFIG, { optional: true });
14
+ ngf = injectNgForgeField();
15
+ options = input([], /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
17
+ props = input(/* @ts-ignore */
18
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
19
+ appearance = computed(() => this.props()?.appearance ?? this.materialConfig?.appearance ?? 'outline', /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
21
+ subscriptSizing = computed(() => this.props()?.subscriptSizing ?? this.materialConfig?.subscriptSizing ?? 'dynamic', /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "subscriptSizing" }] : /* istanbul ignore next */ []));
23
+ floatLabel = computed(() => this.props()?.floatLabel ?? this.materialConfig?.floatLabel ?? 'auto', /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "floatLabel" }] : /* istanbul ignore next */ []));
25
+ hideRequiredMarker = computed(() => this.props()?.hideRequiredMarker ?? this.materialConfig?.hideRequiredMarker ?? false, /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "hideRequiredMarker" }] : /* istanbul ignore next */ []));
27
+ defaultCompare = Object.is;
28
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatSelectFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
29
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: MatSelectFieldComponent, isStandalone: true, selector: "df-mat-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
30
+ @let selectId = ngf.key() + '-select';
31
+
32
+ <mat-form-field
33
+ [appearance]="appearance()"
34
+ [subscriptSizing]="subscriptSizing()"
35
+ [floatLabel]="floatLabel()"
36
+ [hideRequiredMarker]="hideRequiredMarker()"
37
+ >
38
+ @if (ngf.label(); as label) {
39
+ <mat-label>{{ label | dynamicText | async }}</mat-label>
40
+ }
41
+
42
+ <mat-select
43
+ ngForgeControl
44
+ [id]="selectId"
45
+ [formField]="ngf.field()"
46
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
47
+ [multiple]="props()?.multiple || false"
48
+ [compareWith]="props()?.compareWith || defaultCompare"
49
+ >
50
+ @for (option of options(); track option.value) {
51
+ <mat-option [value]="option.value" [disabled]="option.disabled || false">
52
+ {{ option.label | dynamicText | async }}
53
+ </mat-option>
54
+ }
55
+ </mat-select>
56
+
57
+ @if (ngf.errorsToDisplay()[0]; as error) {
58
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
59
+ } @else if (props()?.hint; as hint) {
60
+ <mat-hint [id]="ngf.hintId()">{{ hint | dynamicText | async }}</mat-hint>
61
+ }
62
+ </mat-form-field>
63
+ `, isInline: true, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n", "mat-form-field{width:100%}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
64
+ }
65
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: MatSelectFieldComponent, decorators: [{
66
+ type: Component,
67
+ args: [{ selector: 'df-mat-select', imports: [MatFormField, MatLabel, MatSelect, MatOption, MatHint, FormField, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
68
+ @let selectId = ngf.key() + '-select';
69
+
70
+ <mat-form-field
71
+ [appearance]="appearance()"
72
+ [subscriptSizing]="subscriptSizing()"
73
+ [floatLabel]="floatLabel()"
74
+ [hideRequiredMarker]="hideRequiredMarker()"
75
+ >
76
+ @if (ngf.label(); as label) {
77
+ <mat-label>{{ label | dynamicText | async }}</mat-label>
78
+ }
79
+
80
+ <mat-select
81
+ ngForgeControl
82
+ [id]="selectId"
83
+ [formField]="ngf.field()"
84
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
85
+ [multiple]="props()?.multiple || false"
86
+ [compareWith]="props()?.compareWith || defaultCompare"
87
+ >
88
+ @for (option of options(); track option.value) {
89
+ <mat-option [value]="option.value" [disabled]="option.disabled || false">
90
+ {{ option.label | dynamicText | async }}
91
+ </mat-option>
92
+ }
93
+ </mat-select>
94
+
95
+ @if (ngf.errorsToDisplay()[0]; as error) {
96
+ <mat-error [id]="ngf.errorId()">{{ error.message }}</mat-error>
97
+ } @else if (props()?.hint; as hint) {
98
+ <mat-hint [id]="ngf.hintId()">{{ hint | dynamicText | async }}</mat-hint>
99
+ }
100
+ </mat-form-field>
101
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;width:100%}:host([hidden]){display:none!important}.df-mat-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-mat-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-mat-hint{color:var(--df-hint-color, rgba(0, 0, 0, .6));font-size:var(--df-hint-font-size, .875rem)}.df-mat-error{color:var(--df-error-color, #f44336);font-size:var(--df-error-font-size, .875rem)}\n", "mat-form-field{width:100%}\n"] }]
102
+ }], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
103
+
104
+
105
+ export { MatSelectFieldComponent };
106
+ //# sourceMappingURL=ng-forge-dynamic-forms-material-lazy-select.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-material-lazy-select.mjs","mappings":";;;;;;;;;;;AA6Dc;;;;;AAMH;;AAEA;;AAEA;;AAEA;;AAEA;;AAET;;AAhBmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAXlB","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-material/src/lib/fields/select/mat-select.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { MatError, MatFormField, MatLabel } from '@angular/material/form-field';\nimport { MatOption, MatSelect } from '@angular/material/select';\nimport { MatHint } from '@angular/material/input';\nimport { FieldOption, ValueType } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { MatSelectProps } from './mat-select.type';\nimport { AsyncPipe } from '@angular/common';\nimport { MATERIAL_CONFIG } from '@ng-forge/dynamic-forms-material/shared';\n\n@Component({\n selector: 'df-mat-select',\n imports: [MatFormField, MatLabel, MatSelect, MatOption, MatHint, FormField, MatError, DynamicTextPipe, AsyncPipe, NgForgeControl],\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let selectId = ngf.key() + '-select';\n\n <mat-form-field\n [appearance]=\"appearance()\"\n [subscriptSizing]=\"subscriptSizing()\"\n [floatLabel]=\"floatLabel()\"\n [hideRequiredMarker]=\"hideRequiredMarker()\"\n >\n @if (ngf.label(); as label) {\n <mat-label>{{ label | dynamicText | async }}</mat-label>\n }\n\n <mat-select\n ngForgeControl\n [id]=\"selectId\"\n [formField]=\"ngf.field()\"\n [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n [multiple]=\"props()?.multiple || false\"\n [compareWith]=\"props()?.compareWith || defaultCompare\"\n >\n @for (option of options(); track option.value) {\n <mat-option [value]=\"option.value\" [disabled]=\"option.disabled || false\">\n {{ option.label | dynamicText | async }}\n </mat-option>\n }\n </mat-select>\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <mat-error [id]=\"ngf.errorId()\">{{ error.message }}</mat-error>\n } @else if (props()?.hint; as hint) {\n <mat-hint [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</mat-hint>\n }\n </mat-form-field>\n `,\n styleUrl: '../../styles/_form-field.scss',\n styles: [\n `\n mat-form-field {\n width: 100%;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class MatSelectFieldComponent {\n private materialConfig = inject(MATERIAL_CONFIG, { optional: true });\n\n protected readonly ngf = injectNgForgeField<ValueType>();\n\n readonly options = input<FieldOption<ValueType>[]>([]);\n readonly props = input<MatSelectProps>();\n\n readonly appearance = computed(() => this.props()?.appearance ?? this.materialConfig?.appearance ?? 'outline');\n\n readonly subscriptSizing = computed(() => this.props()?.subscriptSizing ?? this.materialConfig?.subscriptSizing ?? 'dynamic');\n\n readonly floatLabel = computed(() => this.props()?.floatLabel ?? this.materialConfig?.floatLabel ?? 'auto');\n\n readonly hideRequiredMarker = computed(() => this.props()?.hideRequiredMarker ?? this.materialConfig?.hideRequiredMarker ?? false);\n\n defaultCompare = Object.is;\n}\n"]}