@ng-forge/dynamic-forms-ionic 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-ionic-ionic-field-errors-wrapper.component-Dl3heov4.mjs +26 -0
  2. package/fesm2022/ng-forge-dynamic-forms-ionic-ionic-field-errors-wrapper.component-Dl3heov4.mjs.map +1 -0
  3. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-addon-button.mjs +75 -0
  4. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-addon-button.mjs.map +1 -0
  5. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-addon-icon.mjs +36 -0
  6. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-addon-icon.mjs.map +1 -0
  7. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-button.mjs +70 -0
  8. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-button.mjs.map +1 -0
  9. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-checkbox.mjs +67 -0
  10. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-checkbox.mjs.map +1 -0
  11. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-datepicker.mjs +195 -0
  12. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-datepicker.mjs.map +1 -0
  13. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-input.mjs +211 -0
  14. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-input.mjs.map +1 -0
  15. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-multi-checkbox.mjs +139 -0
  16. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-multi-checkbox.mjs.map +1 -0
  17. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-radio.mjs +98 -0
  18. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-radio.mjs.map +1 -0
  19. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-select.mjs +92 -0
  20. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-select.mjs.map +1 -0
  21. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-slider.mjs +76 -0
  22. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-slider.mjs.map +1 -0
  23. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-textarea.mjs +96 -0
  24. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-textarea.mjs.map +1 -0
  25. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-toggle.mjs +146 -0
  26. package/fesm2022/ng-forge-dynamic-forms-ionic-lazy-toggle.mjs.map +1 -0
  27. package/fesm2022/ng-forge-dynamic-forms-ionic-shared.mjs +83 -0
  28. package/fesm2022/ng-forge-dynamic-forms-ionic-shared.mjs.map +1 -0
  29. package/fesm2022/ng-forge-dynamic-forms-ionic.mjs +43 -158
  30. package/fesm2022/ng-forge-dynamic-forms-ionic.mjs.map +1 -1
  31. package/package.json +55 -3
  32. package/types/ng-forge-dynamic-forms-ionic-lazy-addon-button.d.ts +29 -0
  33. package/types/ng-forge-dynamic-forms-ionic-lazy-addon-icon.d.ts +18 -0
  34. package/types/ng-forge-dynamic-forms-ionic-lazy-button.d.ts +119 -0
  35. package/types/ng-forge-dynamic-forms-ionic-lazy-checkbox.d.ts +23 -0
  36. package/types/ng-forge-dynamic-forms-ionic-lazy-datepicker.d.ts +39 -0
  37. package/types/ng-forge-dynamic-forms-ionic-lazy-input.d.ts +70 -0
  38. package/types/ng-forge-dynamic-forms-ionic-lazy-multi-checkbox.d.ts +28 -0
  39. package/types/ng-forge-dynamic-forms-ionic-lazy-radio.d.ts +25 -0
  40. package/types/ng-forge-dynamic-forms-ionic-lazy-select.d.ts +31 -0
  41. package/types/ng-forge-dynamic-forms-ionic-lazy-slider.d.ts +43 -0
  42. package/types/ng-forge-dynamic-forms-ionic-lazy-textarea.d.ts +28 -0
  43. package/types/ng-forge-dynamic-forms-ionic-lazy-toggle.d.ts +66 -0
  44. package/types/ng-forge-dynamic-forms-ionic-shared.d.ts +116 -0
  45. package/types/ng-forge-dynamic-forms-ionic.d.ts +10 -164
@@ -0,0 +1,76 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { FormField } from '@angular/forms/signals';
4
+ import { IonRange, IonNote } from '@ionic/angular/standalone';
5
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
6
+ import { injectNgForgeField, DynamicTextPipe, NgForgeFieldHost, NgForgeHostControl } from '@ng-forge/dynamic-forms/integration';
7
+ import { AsyncPipe } from '@angular/common';
8
+
9
+ class IonicSliderFieldComponent {
10
+ ngf = injectNgForgeField();
11
+ step = input(/* @ts-ignore */
12
+ ...(ngDevMode ? [undefined, { debugName: "step" }] : /* istanbul ignore next */ []));
13
+ props = input(/* @ts-ignore */
14
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
15
+ defaultPinFormatter = (value) => String(value);
16
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicSliderFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: IonicSliderFieldComponent, isStandalone: true, selector: "df-ion-slider", inputs: { step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }, { directive: i1.NgForgeHostControl }], ngImport: i0, template: `
18
+ @let f = ngf.field();
19
+ @let inputId = ngf.key() + '-input';
20
+
21
+ <ion-range
22
+ [id]="inputId"
23
+ [formField]="f"
24
+ [label]="(ngf.label() | dynamicText | async) ?? undefined"
25
+ [labelPlacement]="props()?.labelPlacement ?? 'stacked'"
26
+ [min]="f().min?.() ?? props()?.min ?? 0"
27
+ [max]="f().max?.() ?? props()?.max ?? 100"
28
+ [step]="step() ?? props()?.step ?? 1"
29
+ [dualKnobs]="props()?.dualKnobs ?? false"
30
+ [pin]="props()?.pin ?? false"
31
+ [pinFormatter]="props()?.pinFormatter ?? defaultPinFormatter"
32
+ [ticks]="props()?.ticks ?? false"
33
+ [snaps]="props()?.snaps ?? false"
34
+ [color]="props()?.color ?? 'primary'"
35
+ />
36
+
37
+ @if (ngf.errorsToDisplay()[0]; as error) {
38
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
39
+ } @else if (props()?.hint; as hint) {
40
+ <ion-note class="df-ion-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</ion-note>
41
+ }
42
+ `, isInline: true, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"], dependencies: [{ kind: "component", type: IonRange, selector: "ion-range", inputs: ["activeBarStart", "color", "debounce", "disabled", "dualKnobs", "label", "labelPlacement", "max", "min", "mode", "name", "pin", "pinFormatter", "snaps", "step", "ticks", "value"] }, { kind: "component", type: IonNote, selector: "ion-note", inputs: ["color", "mode"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
43
+ }
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicSliderFieldComponent, decorators: [{
45
+ type: Component,
46
+ args: [{ selector: 'df-ion-slider', imports: [IonRange, IonNote, FormField, DynamicTextPipe, AsyncPipe], hostDirectives: [NgForgeFieldHost, NgForgeHostControl], template: `
47
+ @let f = ngf.field();
48
+ @let inputId = ngf.key() + '-input';
49
+
50
+ <ion-range
51
+ [id]="inputId"
52
+ [formField]="f"
53
+ [label]="(ngf.label() | dynamicText | async) ?? undefined"
54
+ [labelPlacement]="props()?.labelPlacement ?? 'stacked'"
55
+ [min]="f().min?.() ?? props()?.min ?? 0"
56
+ [max]="f().max?.() ?? props()?.max ?? 100"
57
+ [step]="step() ?? props()?.step ?? 1"
58
+ [dualKnobs]="props()?.dualKnobs ?? false"
59
+ [pin]="props()?.pin ?? false"
60
+ [pinFormatter]="props()?.pinFormatter ?? defaultPinFormatter"
61
+ [ticks]="props()?.ticks ?? false"
62
+ [snaps]="props()?.snaps ?? false"
63
+ [color]="props()?.color ?? 'primary'"
64
+ />
65
+
66
+ @if (ngf.errorsToDisplay()[0]; as error) {
67
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
68
+ } @else if (props()?.hint; as hint) {
69
+ <ion-note class="df-ion-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</ion-note>
70
+ }
71
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"] }]
72
+ }], propDecorators: { step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
73
+
74
+
75
+ export { IonicSliderFieldComponent };
76
+ //# sourceMappingURL=ng-forge-dynamic-forms-ionic-lazy-slider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-ionic-lazy-slider.mjs","mappings":";;;;;;;;AAoDc;;AAGH;;AACA;;;;AAJU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA3CT","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-ionic/src/lib/fields/slider/ionic-slider.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { IonNote, IonRange } from '@ionic/angular/standalone';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeHostControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { IonicSliderProps } from './ionic-slider.type';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-ion-slider',\n imports: [IonRange, IonNote, FormField, DynamicTextPipe, AsyncPipe],\n hostDirectives: [NgForgeFieldHost, NgForgeHostControl],\n template: `\n @let f = ngf.field();\n @let inputId = ngf.key() + '-input';\n\n <ion-range\n [id]=\"inputId\"\n [formField]=\"f\"\n [label]=\"(ngf.label() | dynamicText | async) ?? undefined\"\n [labelPlacement]=\"props()?.labelPlacement ?? 'stacked'\"\n [min]=\"f().min?.() ?? props()?.min ?? 0\"\n [max]=\"f().max?.() ?? props()?.max ?? 100\"\n [step]=\"step() ?? props()?.step ?? 1\"\n [dualKnobs]=\"props()?.dualKnobs ?? false\"\n [pin]=\"props()?.pin ?? false\"\n [pinFormatter]=\"props()?.pinFormatter ?? defaultPinFormatter\"\n [ticks]=\"props()?.ticks ?? false\"\n [snaps]=\"props()?.snaps ?? false\"\n [color]=\"props()?.color ?? 'primary'\"\n />\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <ion-note color=\"danger\" class=\"df-ion-error\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</ion-note>\n } @else if (props()?.hint; as hint) {\n <ion-note class=\"df-ion-hint\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</ion-note>\n }\n `,\n styleUrl: '../../styles/_form-field.scss',\n styles: [\n `\n :host {\n display: block;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class IonicSliderFieldComponent {\n protected readonly ngf = injectNgForgeField<number>();\n\n readonly step = input<number>();\n readonly props = input<IonicSliderProps>();\n\n protected defaultPinFormatter = (value: number) => String(value);\n}\n"]}
@@ -0,0 +1,96 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, input, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { explicitEffect } from 'ngxtension/explicit-effect';
4
+ import { FormField } from '@angular/forms/signals';
5
+ import { IonTextarea, IonNote } from '@ionic/angular/standalone';
6
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
7
+ import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
8
+ import { AsyncPipe } from '@angular/common';
9
+
10
+ class IonicTextareaFieldComponent {
11
+ elementRef = inject((ElementRef));
12
+ ngf = injectNgForgeField();
13
+ props = input(/* @ts-ignore */
14
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
15
+ constructor() {
16
+ explicitEffect([this.ngf.ariaDescribedBy], ([describedBy]) => {
17
+ queueMicrotask(() => {
18
+ const ionTextarea = this.elementRef.nativeElement.querySelector('ion-textarea');
19
+ if (ionTextarea?.getInputElement) {
20
+ ionTextarea.getInputElement().then((textareaEl) => {
21
+ if (!textareaEl)
22
+ return;
23
+ if (describedBy) {
24
+ textareaEl.setAttribute('aria-describedby', describedBy);
25
+ }
26
+ else {
27
+ textareaEl.removeAttribute('aria-describedby');
28
+ }
29
+ });
30
+ }
31
+ });
32
+ });
33
+ }
34
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicTextareaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
35
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: IonicTextareaFieldComponent, isStandalone: true, selector: "df-ion-textarea", inputs: { props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
36
+ @let f = ngf.field();
37
+ @let textareaId = ngf.key() + '-textarea';
38
+
39
+ <ion-textarea
40
+ ngForgeControl
41
+ [id]="textareaId"
42
+ [formField]="f"
43
+ [label]="(ngf.label() | dynamicText | async) ?? undefined"
44
+ [labelPlacement]="props()?.labelPlacement ?? 'stacked'"
45
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
46
+ [rows]="props()?.rows ?? 4"
47
+ [autoGrow]="props()?.autoGrow ?? false"
48
+ [counter]="props()?.counter ?? false"
49
+ [minlength]="f().minLength?.()"
50
+ [maxlength]="f().maxLength?.()"
51
+ [color]="props()?.color"
52
+ [fill]="props()?.fill ?? 'outline'"
53
+ [shape]="props()?.shape"
54
+ [readonly]="f().readonly()"
55
+ [helperText]="ngf.errorsToDisplay().length === 0 ? ((props()?.hint | dynamicText | async) ?? undefined) : undefined"
56
+ [attr.tabindex]="ngf.tabIndex()"
57
+ />
58
+ @if (ngf.errorsToDisplay()[0]; as error) {
59
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
60
+ }
61
+ `, isInline: true, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"], dependencies: [{ kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }, { kind: "component", type: IonNote, selector: "ion-note", inputs: ["color", "mode"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicTextareaFieldComponent, decorators: [{
64
+ type: Component,
65
+ args: [{ selector: 'df-ion-textarea', imports: [IonTextarea, IonNote, FormField, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
66
+ @let f = ngf.field();
67
+ @let textareaId = ngf.key() + '-textarea';
68
+
69
+ <ion-textarea
70
+ ngForgeControl
71
+ [id]="textareaId"
72
+ [formField]="f"
73
+ [label]="(ngf.label() | dynamicText | async) ?? undefined"
74
+ [labelPlacement]="props()?.labelPlacement ?? 'stacked'"
75
+ [placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
76
+ [rows]="props()?.rows ?? 4"
77
+ [autoGrow]="props()?.autoGrow ?? false"
78
+ [counter]="props()?.counter ?? false"
79
+ [minlength]="f().minLength?.()"
80
+ [maxlength]="f().maxLength?.()"
81
+ [color]="props()?.color"
82
+ [fill]="props()?.fill ?? 'outline'"
83
+ [shape]="props()?.shape"
84
+ [readonly]="f().readonly()"
85
+ [helperText]="ngf.errorsToDisplay().length === 0 ? ((props()?.hint | dynamicText | async) ?? undefined) : undefined"
86
+ [attr.tabindex]="ngf.tabIndex()"
87
+ />
88
+ @if (ngf.errorsToDisplay()[0]; as error) {
89
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
90
+ }
91
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"] }]
92
+ }], ctorParameters: () => [], propDecorators: { props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
93
+
94
+
95
+ export { IonicTextareaFieldComponent };
96
+ //# sourceMappingURL=ng-forge-dynamic-forms-ionic-lazy-textarea.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-ionic-lazy-textarea.mjs","mappings":";;;;;;;;;AAkDc;AACK;;AAIR;;AAET;wBAIE;;AAEI;AACA;;AAEI;;;AAEE;;;AAEA;;AAEJ;;AAEJ;AACF;;;AAzBiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAxCT","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-ionic/src/lib/fields/textarea/ionic-textarea.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ElementRef, inject, input } from '@angular/core';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport { FormField } from '@angular/forms/signals';\nimport { IonNote, IonTextarea } from '@ionic/angular/standalone';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { IonicTextareaProps } from './ionic-textarea.type';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-ion-textarea',\n imports: [IonTextarea, IonNote, FormField, DynamicTextPipe, AsyncPipe, NgForgeControl],\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field();\n @let textareaId = ngf.key() + '-textarea';\n\n <ion-textarea\n ngForgeControl\n [id]=\"textareaId\"\n [formField]=\"f\"\n [label]=\"(ngf.label() | dynamicText | async) ?? undefined\"\n [labelPlacement]=\"props()?.labelPlacement ?? 'stacked'\"\n [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n [rows]=\"props()?.rows ?? 4\"\n [autoGrow]=\"props()?.autoGrow ?? false\"\n [counter]=\"props()?.counter ?? false\"\n [minlength]=\"f().minLength?.()\"\n [maxlength]=\"f().maxLength?.()\"\n [color]=\"props()?.color\"\n [fill]=\"props()?.fill ?? 'outline'\"\n [shape]=\"props()?.shape\"\n [readonly]=\"f().readonly()\"\n [helperText]=\"ngf.errorsToDisplay().length === 0 ? ((props()?.hint | dynamicText | async) ?? undefined) : undefined\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n />\n @if (ngf.errorsToDisplay()[0]; as error) {\n <ion-note color=\"danger\" class=\"df-ion-error\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</ion-note>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n styleUrl: '../../styles/_form-field.scss',\n styles: [\n `\n :host([hidden]) {\n display: none !important;\n }\n `,\n ],\n})\nexport default class IonicTextareaFieldComponent {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n protected readonly ngf = injectNgForgeField<string>();\n\n readonly props = input<IonicTextareaProps>();\n\n constructor() {\n // ion-textarea encapsulates a native <textarea> in shadow DOM and does not automatically\n // propagate aria-describedby to it. This effect imperatively syncs the attribute\n // after a microtask to ensure Ionic has resolved the internal element.\n explicitEffect([this.ngf.ariaDescribedBy], ([describedBy]) => {\n queueMicrotask(() => {\n const ionTextarea = this.elementRef.nativeElement.querySelector('ion-textarea') as HTMLIonTextareaElement | null;\n if (ionTextarea?.getInputElement) {\n ionTextarea.getInputElement().then((textareaEl) => {\n if (!textareaEl) return;\n if (describedBy) {\n textareaEl.setAttribute('aria-describedby', describedBy);\n } else {\n textareaEl.removeAttribute('aria-describedby');\n }\n });\n }\n });\n });\n }\n}\n"]}
@@ -0,0 +1,146 @@
1
+ import * as i0 from '@angular/core';
2
+ import { model, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { FormField } from '@angular/forms/signals';
4
+ import { IonToggle, IonNote } from '@ionic/angular/standalone';
5
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
6
+ import { NgForgeControl, injectNgForgeField, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
7
+ import { AsyncPipe } from '@angular/common';
8
+
9
+ class IonicToggleControlComponent {
10
+ checked = model(false, /* @ts-ignore */
11
+ ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
12
+ touched = model(false, /* @ts-ignore */
13
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
14
+ disabled = input(false, /* @ts-ignore */
15
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
16
+ readonly = input(false, /* @ts-ignore */
17
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
18
+ invalid = input(false, /* @ts-ignore */
19
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
20
+ required = input(false, /* @ts-ignore */
21
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
22
+ labelPlacement = input('end', /* @ts-ignore */
23
+ ...(ngDevMode ? [{ debugName: "labelPlacement" }] : /* istanbul ignore next */ []));
24
+ justify = input(undefined, /* @ts-ignore */
25
+ ...(ngDevMode ? [{ debugName: "justify" }] : /* istanbul ignore next */ []));
26
+ color = input('primary', /* @ts-ignore */
27
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
28
+ enableOnOffLabels = input(false, /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "enableOnOffLabels" }] : /* istanbul ignore next */ []));
30
+ tabIndex = input(undefined, /* @ts-ignore */
31
+ ...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
32
+ ariaReadonly = computed(() => (this.readonly() ? true : null), /* @ts-ignore */
33
+ ...(ngDevMode ? [{ debugName: "ariaReadonly" }] : /* istanbul ignore next */ []));
34
+ isChecked = computed(() => {
35
+ return this.checked() === true;
36
+ }, /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "isChecked" }] : /* istanbul ignore next */ []));
38
+ isEffectivelyDisabled = computed(() => {
39
+ return this.disabled() || this.readonly();
40
+ }, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "isEffectivelyDisabled" }] : /* istanbul ignore next */ []));
42
+ onToggleChange(event) {
43
+ this.checked.set(event.detail.checked);
44
+ }
45
+ onBlur() {
46
+ this.touched.set(true);
47
+ }
48
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicToggleControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
49
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.1", type: IonicToggleControlComponent, isStandalone: true, selector: "df-ion-toggle-control", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, labelPlacement: { classPropertyName: "labelPlacement", publicName: "labelPlacement", isSignal: true, isRequired: false, transformFunction: null }, justify: { classPropertyName: "justify", publicName: "justify", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, enableOnOffLabels: { classPropertyName: "enableOnOffLabels", publicName: "enableOnOffLabels", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", touched: "touchedChange" }, host: { styleAttribute: "display: block" }, ngImport: i0, template: `
50
+ <ion-toggle
51
+ ngForgeControl
52
+ [checked]="isChecked()"
53
+ (ionChange)="onToggleChange($event)"
54
+ (ionBlur)="onBlur()"
55
+ [labelPlacement]="labelPlacement()"
56
+ [justify]="justify()"
57
+ [color]="color()"
58
+ [enableOnOffLabels]="enableOnOffLabels()"
59
+ [disabled]="isEffectivelyDisabled()"
60
+ [attr.tabindex]="tabIndex()"
61
+ [attr.aria-readonly]="ariaReadonly()"
62
+ >
63
+ <ng-content />
64
+ </ion-toggle>
65
+ `, isInline: true, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n"], dependencies: [{ kind: "component", type: IonToggle, selector: "ion-toggle", inputs: ["checked", "color", "disabled", "enableOnOffLabels", "errorText", "helperText", "justify", "labelPlacement", "mode", "name", "value"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
66
+ }
67
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicToggleControlComponent, decorators: [{
68
+ type: Component,
69
+ args: [{ selector: 'df-ion-toggle-control', imports: [IonToggle, NgForgeControl], template: `
70
+ <ion-toggle
71
+ ngForgeControl
72
+ [checked]="isChecked()"
73
+ (ionChange)="onToggleChange($event)"
74
+ (ionBlur)="onBlur()"
75
+ [labelPlacement]="labelPlacement()"
76
+ [justify]="justify()"
77
+ [color]="color()"
78
+ [enableOnOffLabels]="enableOnOffLabels()"
79
+ [disabled]="isEffectivelyDisabled()"
80
+ [attr.tabindex]="tabIndex()"
81
+ [attr.aria-readonly]="ariaReadonly()"
82
+ >
83
+ <ng-content />
84
+ </ion-toggle>
85
+ `, host: {
86
+ style: 'display: block',
87
+ }, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n"] }]
88
+ }], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], labelPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPlacement", required: false }] }], justify: [{ type: i0.Input, args: [{ isSignal: true, alias: "justify", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], enableOnOffLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableOnOffLabels", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }] } });
89
+
90
+ class IonicToggleFieldComponent {
91
+ ngf = injectNgForgeField();
92
+ props = input(/* @ts-ignore */
93
+ ...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
94
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicToggleFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
95
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: IonicToggleFieldComponent, isStandalone: true, selector: "df-ion-toggle", inputs: { props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
96
+ @let f = ngf.field();
97
+ @let toggleId = ngf.key() + '-toggle';
98
+
99
+ <df-ion-toggle-control
100
+ [id]="toggleId"
101
+ [formField]="f"
102
+ [labelPlacement]="props()?.labelPlacement ?? 'end'"
103
+ [justify]="props()?.justify"
104
+ [color]="props()?.color ?? 'primary'"
105
+ [enableOnOffLabels]="props()?.enableOnOffLabels ?? false"
106
+ [tabIndex]="ngf.tabIndex()"
107
+ >
108
+ {{ ngf.label() | dynamicText | async }}
109
+ </df-ion-toggle-control>
110
+
111
+ @if (ngf.errorsToDisplay()[0]; as error) {
112
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
113
+ } @else if (props()?.hint; as hint) {
114
+ <ion-note class="df-ion-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</ion-note>
115
+ }
116
+ `, isInline: true, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"], dependencies: [{ kind: "component", type: IonicToggleControlComponent, selector: "df-ion-toggle-control", inputs: ["checked", "touched", "disabled", "readonly", "invalid", "required", "labelPlacement", "justify", "color", "enableOnOffLabels", "tabIndex"], outputs: ["checkedChange", "touchedChange"] }, { kind: "component", type: IonNote, selector: "ion-note", inputs: ["color", "mode"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
117
+ }
118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicToggleFieldComponent, decorators: [{
119
+ type: Component,
120
+ args: [{ selector: 'df-ion-toggle', imports: [IonicToggleControlComponent, IonNote, FormField, DynamicTextPipe, AsyncPipe], hostDirectives: [NgForgeFieldHost], template: `
121
+ @let f = ngf.field();
122
+ @let toggleId = ngf.key() + '-toggle';
123
+
124
+ <df-ion-toggle-control
125
+ [id]="toggleId"
126
+ [formField]="f"
127
+ [labelPlacement]="props()?.labelPlacement ?? 'end'"
128
+ [justify]="props()?.justify"
129
+ [color]="props()?.color ?? 'primary'"
130
+ [enableOnOffLabels]="props()?.enableOnOffLabels ?? false"
131
+ [tabIndex]="ngf.tabIndex()"
132
+ >
133
+ {{ ngf.label() | dynamicText | async }}
134
+ </df-ion-toggle-control>
135
+
136
+ @if (ngf.errorsToDisplay()[0]; as error) {
137
+ <ion-note color="danger" class="df-ion-error" [id]="ngf.errorId()" role="alert">{{ error.message }}</ion-note>
138
+ } @else if (props()?.hint; as hint) {
139
+ <ion-note class="df-ion-hint" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</ion-note>
140
+ }
141
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-ion-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%}.df-ion-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit)}.df-ion-hint{display:block;color:var(--df-hint-color, var(--ion-color-medium, #92949c));font-size:var(--df-hint-font-size, .875rem)}.df-ion-error{display:block;color:var(--df-error-color, var(--ion-color-danger, #eb445a));font-size:var(--df-error-font-size, .875rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"] }]
142
+ }], propDecorators: { props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
143
+
144
+
145
+ export { IonicToggleControlComponent, IonicToggleFieldComponent };
146
+ //# sourceMappingURL=ng-forge-dynamic-forms-ionic-lazy-toggle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-ionic-lazy-toggle.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuEqB;;IAGA;AACjB;;;AAGF,IAImB;;;;gBASnB;;;;AAME;;;AA7DS;;;;;;;;;;;;;;;;;;;;AAzBD;;;;;;;;;;;;;;;;;AAqBR;;;;ACiBU;;AAGH;;;AAHU;;;;;;;;;;;;;;;;;;;;;;;;;AAvCT","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-ionic/src/lib/fields/toggle/ionic-toggle-control.component.ts","../../../../packages/dynamic-forms-ionic/src/lib/fields/toggle/ionic-toggle.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input, model } from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\nimport { IonToggle } from '@ionic/angular/standalone';\nimport { NgForgeControl } from '@ng-forge/dynamic-forms/integration';\n\n/**\n * ion-toggle wrapper implementing FormCheckboxControl. Rendered inside\n * `df-ion-toggle`. `NgForgeControl` on `<ion-toggle>` claims the ambient\n * parent NgForgeField and routes meta + aria onto that element.\n */\n@Component({\n selector: 'df-ion-toggle-control',\n imports: [IonToggle, NgForgeControl],\n template: `\n <ion-toggle\n ngForgeControl\n [checked]=\"isChecked()\"\n (ionChange)=\"onToggleChange($event)\"\n (ionBlur)=\"onBlur()\"\n [labelPlacement]=\"labelPlacement()\"\n [justify]=\"justify()\"\n [color]=\"color()\"\n [enableOnOffLabels]=\"enableOnOffLabels()\"\n [disabled]=\"isEffectivelyDisabled()\"\n [attr.tabindex]=\"tabIndex()\"\n [attr.aria-readonly]=\"ariaReadonly()\"\n >\n <ng-content />\n </ion-toggle>\n `,\n styleUrl: '../../styles/_form-field.scss',\n host: {\n style: 'display: block',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IonicToggleControlComponent implements FormCheckboxControl {\n // ─────────────────────────────────────────────────────────────────────────────\n // FormCheckboxControl implementation\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** The checked state - required by FormCheckboxControl */\n readonly checked = model<boolean>(false);\n\n /** Tracks whether the field has been touched - used by Field directive */\n readonly touched = model<boolean>(false);\n\n /** Whether the field is disabled */\n readonly disabled = input<boolean>(false);\n\n /** Whether the field is readonly */\n readonly readonly = input<boolean>(false);\n\n /** Whether the field is invalid (from Field directive) */\n readonly invalid = input<boolean>(false);\n\n /** Whether the field is required (from Field directive) */\n readonly required = input<boolean>(false);\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Ionic-specific props\n // ─────────────────────────────────────────────────────────────────────────────\n\n readonly labelPlacement = input<'start' | 'end' | 'fixed' | 'stacked'>('end');\n readonly justify = input<'start' | 'end' | 'space-between' | undefined>(undefined);\n readonly color = input<string>('primary');\n readonly enableOnOffLabels = input<boolean>(false);\n readonly tabIndex = input<number | undefined>(undefined);\n\n // aria-invalid / aria-required / aria-describedby are written to <ion-toggle>\n // by NgForgeControl. aria-readonly is Ionic-specific and stays template-side.\n protected readonly ariaReadonly = computed(() => (this.readonly() ? true : null));\n\n /** Computed checked state - ensures proper boolean conversion for ion-toggle */\n protected readonly isChecked = computed(() => {\n return this.checked() === true;\n });\n\n /**\n * ion-toggle doesn't have a native readonly attribute.\n * When readonly, we disable the toggle to prevent changes while maintaining the visual state.\n */\n protected readonly isEffectivelyDisabled = computed(() => {\n return this.disabled() || this.readonly();\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Event Handlers\n // ─────────────────────────────────────────────────────────────────────────────\n\n /** Handle toggle change - sync ion-toggle's checked state to our checked model */\n onToggleChange(event: CustomEvent<{ checked: boolean; value: string }>): void {\n this.checked.set(event.detail.checked);\n }\n\n /** Marks the field as touched when toggle loses focus */\n onBlur(): void {\n this.touched.set(true);\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { IonNote } from '@ionic/angular/standalone';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { IonicToggleProps } from './ionic-toggle.type';\nimport { IonicToggleControlComponent } from './ionic-toggle-control.component';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-ion-toggle',\n imports: [IonicToggleControlComponent, IonNote, FormField, DynamicTextPipe, AsyncPipe],\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field();\n @let toggleId = ngf.key() + '-toggle';\n\n <df-ion-toggle-control\n [id]=\"toggleId\"\n [formField]=\"f\"\n [labelPlacement]=\"props()?.labelPlacement ?? 'end'\"\n [justify]=\"props()?.justify\"\n [color]=\"props()?.color ?? 'primary'\"\n [enableOnOffLabels]=\"props()?.enableOnOffLabels ?? false\"\n [tabIndex]=\"ngf.tabIndex()\"\n >\n {{ ngf.label() | dynamicText | async }}\n </df-ion-toggle-control>\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <ion-note color=\"danger\" class=\"df-ion-error\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</ion-note>\n } @else if (props()?.hint; as hint) {\n <ion-note class=\"df-ion-hint\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</ion-note>\n }\n `,\n styleUrl: '../../styles/_form-field.scss',\n styles: [\n `\n :host {\n display: block;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport default class IonicToggleFieldComponent {\n protected readonly ngf = injectNgForgeField<boolean>();\n\n readonly props = input<IonicToggleProps>();\n}\n"]}
@@ -0,0 +1,83 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, Injector, computed, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { AsyncPipe } from '@angular/common';
4
+ import { IonIcon, IonSpinner } from '@ionic/angular/standalone';
5
+ import * as i1 from '@ng-forge/dynamic-forms/integration';
6
+ import { injectNgForgeAddonAction, resolveDynamicValue, DynamicTextPipe, NgForgeAddonAction, runPresetAction } from '@ng-forge/dynamic-forms/integration';
7
+ import { explicitEffect } from 'ngxtension/explicit-effect';
8
+
9
+ const IONIC_CONFIG = new InjectionToken('IONIC_CONFIG');
10
+
11
+ const IONIC_INPUT_TYPE_OVERRIDE = new InjectionToken('IONIC_INPUT_TYPE_OVERRIDE');
12
+
13
+ class IonicInlineButtonAddonComponent {
14
+ injector = inject(Injector);
15
+ action = injectNgForgeAddonAction();
16
+ addon = this.action.addon;
17
+ label = computed(() => this.addon().label, /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
19
+ ariaLabel = computed(() => this.addon().ariaLabel, /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
21
+ icon = computed(() => this.addon().icon, /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
23
+ color = computed(() => this.addon().color, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
25
+ fill = computed(() => this.addon().fill ?? 'clear', /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []));
27
+ iconOnly = computed(() => !!this.icon() && !this.label(), /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []));
29
+ ariaLabelSignal = signal(undefined, /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "ariaLabelSignal" }] : /* istanbul ignore next */ []));
31
+ resolvedAriaLabel = computed(() => this.ariaLabelSignal()?.() ?? undefined, /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
33
+ constructor() {
34
+ explicitEffect([this.ariaLabel], ([raw]) => {
35
+ if (raw === undefined) {
36
+ this.ariaLabelSignal.set(undefined);
37
+ return;
38
+ }
39
+ this.ariaLabelSignal.set(resolveDynamicValue(raw, undefined, this.injector));
40
+ });
41
+ }
42
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicInlineButtonAddonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
43
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: IonicInlineButtonAddonComponent, isStandalone: true, selector: "ion-button[df-ion-button-addon]", host: { listeners: { "click": "action.dispatch()" }, properties: { "attr.color": "color() ?? null", "attr.fill": "fill()", "attr.disabled": "action.disabled() || action.loading() ? \"true\" : null", "attr.aria-label": "resolvedAriaLabel() ?? null", "attr.aria-busy": "action.loading() || null" } }, hostDirectives: [{ directive: i1.NgForgeAddonAction }], ngImport: i0, template: `
44
+ @if (action.loading()) {
45
+ <ion-spinner [slot]="iconOnly() ? 'icon-only' : 'start'" name="dots"></ion-spinner>
46
+ <span class="df-ion-sr-only" role="status">Loading…</span>
47
+ } @else if (icon(); as ic) {
48
+ <ion-icon [name]="ic" [slot]="iconOnly() ? 'icon-only' : 'start'"></ion-icon>
49
+ }
50
+ @if (label(); as lbl) {
51
+ {{ lbl | dynamicText | async }}
52
+ }
53
+ `, isInline: true, styles: [".df-ion-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"], dependencies: [{ kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
54
+ }
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: IonicInlineButtonAddonComponent, decorators: [{
56
+ type: Component,
57
+ args: [{ selector: 'ion-button[df-ion-button-addon]', imports: [IonIcon, IonSpinner, DynamicTextPipe, AsyncPipe], hostDirectives: [NgForgeAddonAction], template: `
58
+ @if (action.loading()) {
59
+ <ion-spinner [slot]="iconOnly() ? 'icon-only' : 'start'" name="dots"></ion-spinner>
60
+ <span class="df-ion-sr-only" role="status">Loading…</span>
61
+ } @else if (icon(); as ic) {
62
+ <ion-icon [name]="ic" [slot]="iconOnly() ? 'icon-only' : 'start'"></ion-icon>
63
+ }
64
+ @if (label(); as lbl) {
65
+ {{ lbl | dynamicText | async }}
66
+ }
67
+ `, host: {
68
+ '[attr.color]': 'color() ?? null',
69
+ '[attr.fill]': 'fill()',
70
+ '[attr.disabled]': 'action.disabled() || action.loading() ? "true" : null',
71
+ '[attr.aria-label]': 'resolvedAriaLabel() ?? null',
72
+ '[attr.aria-busy]': 'action.loading() || null',
73
+ '(click)': 'action.dispatch()',
74
+ }, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-ion-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
75
+ }], ctorParameters: () => [] });
76
+
77
+ function runIonicPresetAction(preset, context, collaborators) {
78
+ return runPresetAction(preset, context, collaborators, 'Ionic', 'ion-input');
79
+ }
80
+
81
+
82
+ export { IONIC_CONFIG, IONIC_INPUT_TYPE_OVERRIDE, IonicInlineButtonAddonComponent, runIonicPresetAction };
83
+ //# sourceMappingURL=ng-forge-dynamic-forms-ionic-shared.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-forge-dynamic-forms-ionic-shared.mjs","mappings":";;;;;;;;;;;;;AAsDmB;;AAGE;;;;;;;;;AAKA;;AACA;;;;AAGA;;AAEnB;AACE;AACE;AACE;;;AAGF;AACF;;;AAtBS;;;;;;;;;;AA1BV;;;;AAbS;;;;;;;;;;;AA8BR;AACA;AACA;AACA;AACA;AACA;;;;;ACtCF;AACF","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-ionic/shared/ionic-inline-button-addon.component.ts","../../../../packages/dynamic-forms-ionic/shared/preset-actions.ts"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, Injector, type Signal, signal } from '@angular/core';\nimport { IonIcon, IonSpinner } from '@ionic/angular/standalone';\nimport type { DynamicText } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe, injectNgForgeAddonAction, NgForgeAddonAction, resolveDynamicValue } from '@ng-forge/dynamic-forms/integration';\nimport { explicitEffect } from 'ngxtension/explicit-effect';\nimport type { IonicButtonAddon } from './addons';\n\n/**\n * Inline `ion-button` addon whose host is the slotted Ionic button itself.\n * It lives in the shared entry because the lazily loaded input component\n * consumes it while the primary package must not pull in field renderers.\n */\n@Component({\n selector: 'ion-button[df-ion-button-addon]',\n imports: [IonIcon, IonSpinner, DynamicTextPipe, AsyncPipe],\n hostDirectives: [NgForgeAddonAction],\n template: `\n @if (action.loading()) {\n <ion-spinner [slot]=\"iconOnly() ? 'icon-only' : 'start'\" name=\"dots\"></ion-spinner>\n <span class=\"df-ion-sr-only\" role=\"status\">Loading…</span>\n } @else if (icon(); as ic) {\n <ion-icon [name]=\"ic\" [slot]=\"iconOnly() ? 'icon-only' : 'start'\"></ion-icon>\n }\n @if (label(); as lbl) {\n {{ lbl | dynamicText | async }}\n }\n `,\n styles: [\n `\n .df-ion-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `,\n ],\n host: {\n '[attr.color]': 'color() ?? null',\n '[attr.fill]': 'fill()',\n '[attr.disabled]': 'action.disabled() || action.loading() ? \"true\" : null',\n '[attr.aria-label]': 'resolvedAriaLabel() ?? null',\n '[attr.aria-busy]': 'action.loading() || null',\n '(click)': 'action.dispatch()',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class IonicInlineButtonAddonComponent {\n private readonly injector = inject(Injector);\n protected readonly action = injectNgForgeAddonAction<IonicButtonAddon>();\n\n protected readonly addon = this.action.addon;\n protected readonly label = computed(() => this.addon().label);\n protected readonly ariaLabel = computed(() => this.addon().ariaLabel);\n protected readonly icon = computed(() => this.addon().icon);\n protected readonly color = computed(() => this.addon().color);\n protected readonly fill = computed(() => this.addon().fill ?? 'clear');\n protected readonly iconOnly = computed(() => !!this.icon() && !this.label());\n\n private readonly ariaLabelSignal = signal<Signal<string | undefined> | undefined>(undefined);\n protected readonly resolvedAriaLabel = computed(() => this.ariaLabelSignal()?.() ?? undefined);\n\n constructor() {\n explicitEffect([this.ariaLabel], ([raw]) => {\n if (raw === undefined) {\n this.ariaLabelSignal.set(undefined);\n return;\n }\n this.ariaLabelSignal.set(resolveDynamicValue<string | undefined>(raw as DynamicText, undefined, this.injector));\n });\n }\n}\n","import type { AddonActionContext, AddonActionPreset } from '@ng-forge/dynamic-forms';\nimport { runPresetAction, type PresetCollaborators } from '@ng-forge/dynamic-forms/integration';\n\nexport type { PresetCollaborators };\n\n/** Ionic adapter binding for the shared preset runner. */\nexport function runIonicPresetAction(\n preset: AddonActionPreset,\n context: AddonActionContext,\n collaborators: PresetCollaborators,\n): Promise<void> {\n return runPresetAction(preset, context, collaborators, 'Ionic', 'ion-input');\n}\n"]}