@ng-forge/dynamic-forms-bootstrap 1.2.0-next.1 → 1.2.0-next.10
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.
- package/README.md +5 -5
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-bs-field-errors-wrapper.component-D4qTxFSp.mjs +25 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-bs-field-errors-wrapper.component-D4qTxFSp.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-addon-button.mjs +77 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-addon-button.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-addon-icon.mjs +35 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-addon-icon.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-button.mjs +74 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-button.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-checkbox.mjs +82 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-checkbox.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-datepicker.mjs +177 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-datepicker.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-input.mjs +339 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-input.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-multi-checkbox.mjs +141 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-multi-checkbox.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-radio.mjs +184 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-radio.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-select.mjs +102 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-select.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-slider.mjs +93 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-slider.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-textarea.mjs +150 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-textarea.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-toggle.mjs +82 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-lazy-toggle.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-shared.mjs +44 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap-shared.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-bootstrap.mjs +82 -178
- package/fesm2022/ng-forge-dynamic-forms-bootstrap.mjs.map +1 -1
- package/package.json +57 -5
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-addon-button.d.ts +19 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-addon-icon.d.ts +18 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-button.d.ts +121 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-checkbox.d.ts +23 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-datepicker.d.ts +33 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-input.d.ts +51 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-multi-checkbox.d.ts +28 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-radio.d.ts +24 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-select.d.ts +33 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-slider.d.ts +40 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-textarea.d.ts +23 -0
- package/types/ng-forge-dynamic-forms-bootstrap-lazy-toggle.d.ts +22 -0
- package/types/ng-forge-dynamic-forms-bootstrap-shared.d.ts +100 -0
- package/types/ng-forge-dynamic-forms-bootstrap.d.ts +9 -138
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, model, input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { FormField } from '@angular/forms/signals';
|
|
4
|
+
import * as i1 from '@ng-forge/dynamic-forms/integration';
|
|
5
|
+
import { NgForgeField, NgForgeControl, DynamicTextPipe, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
|
|
6
|
+
import { AsyncPipe } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class BsRadioGroupComponent {
|
|
9
|
+
parentField = inject(NgForgeField, { optional: true });
|
|
10
|
+
value = model(undefined, /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
12
|
+
disabled = input(false, /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
14
|
+
readonly = input(false, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
16
|
+
name = input('', /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
18
|
+
label = input(/* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
20
|
+
options = input.required(/* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
22
|
+
properties = input(/* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [undefined, { debugName: "properties" }] : /* istanbul ignore next */ []));
|
|
24
|
+
onRadioChange(newValue) {
|
|
25
|
+
if (!this.disabled() && !this.readonly()) {
|
|
26
|
+
this.value.set(newValue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsRadioGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
30
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: BsRadioGroupComponent, isStandalone: true, selector: "df-bs-radio-group", inputs: { value: { classPropertyName: "value", publicName: "value", 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 }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, properties: { classPropertyName: "properties", publicName: "properties", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "radiogroup" }, properties: { "attr.aria-invalid": "parentField?.ariaInvalid() || null", "attr.aria-required": "parentField?.ariaRequired()", "attr.aria-describedby": "parentField?.ariaDescribedBy()" } }, ngImport: i0, template: `
|
|
31
|
+
@let props = properties();
|
|
32
|
+
@if (props?.buttonGroup) {
|
|
33
|
+
<div class="btn-group" role="group" [attr.aria-label]="label() | dynamicText | async">
|
|
34
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
35
|
+
<input
|
|
36
|
+
ngForgeControl
|
|
37
|
+
type="radio"
|
|
38
|
+
[name]="name()"
|
|
39
|
+
[value]="option.value"
|
|
40
|
+
[checked]="value() === option.value"
|
|
41
|
+
(change)="onRadioChange(option.value)"
|
|
42
|
+
[disabled]="disabled() || option.disabled || false"
|
|
43
|
+
class="btn-check"
|
|
44
|
+
[id]="name() + '_' + i"
|
|
45
|
+
autocomplete="off"
|
|
46
|
+
/>
|
|
47
|
+
<label
|
|
48
|
+
class="btn btn-outline-primary"
|
|
49
|
+
[class.btn-sm]="props?.buttonSize === 'sm'"
|
|
50
|
+
[class.btn-lg]="props?.buttonSize === 'lg'"
|
|
51
|
+
[for]="name() + '_' + i"
|
|
52
|
+
>
|
|
53
|
+
{{ option.label | dynamicText | async }}
|
|
54
|
+
</label>
|
|
55
|
+
}
|
|
56
|
+
</div>
|
|
57
|
+
} @else {
|
|
58
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
59
|
+
<div class="form-check" [class.form-check-inline]="props?.inline" [class.form-check-reverse]="props?.reverse">
|
|
60
|
+
<input
|
|
61
|
+
ngForgeControl
|
|
62
|
+
type="radio"
|
|
63
|
+
[name]="name()"
|
|
64
|
+
[value]="option.value"
|
|
65
|
+
[checked]="value() === option.value"
|
|
66
|
+
(change)="onRadioChange(option.value)"
|
|
67
|
+
[disabled]="disabled() || option.disabled || false"
|
|
68
|
+
class="form-check-input"
|
|
69
|
+
[id]="name() + '_' + i"
|
|
70
|
+
/>
|
|
71
|
+
<label class="form-check-label" [for]="name() + '_' + i">
|
|
72
|
+
{{ option.label | dynamicText | async }}
|
|
73
|
+
</label>
|
|
74
|
+
</div>
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsRadioGroupComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{ selector: 'df-bs-radio-group', imports: [DynamicTextPipe, AsyncPipe, NgForgeControl], host: {
|
|
82
|
+
role: 'radiogroup',
|
|
83
|
+
'[attr.aria-invalid]': 'parentField?.ariaInvalid() || null',
|
|
84
|
+
'[attr.aria-required]': 'parentField?.ariaRequired()',
|
|
85
|
+
'[attr.aria-describedby]': 'parentField?.ariaDescribedBy()',
|
|
86
|
+
}, template: `
|
|
87
|
+
@let props = properties();
|
|
88
|
+
@if (props?.buttonGroup) {
|
|
89
|
+
<div class="btn-group" role="group" [attr.aria-label]="label() | dynamicText | async">
|
|
90
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
91
|
+
<input
|
|
92
|
+
ngForgeControl
|
|
93
|
+
type="radio"
|
|
94
|
+
[name]="name()"
|
|
95
|
+
[value]="option.value"
|
|
96
|
+
[checked]="value() === option.value"
|
|
97
|
+
(change)="onRadioChange(option.value)"
|
|
98
|
+
[disabled]="disabled() || option.disabled || false"
|
|
99
|
+
class="btn-check"
|
|
100
|
+
[id]="name() + '_' + i"
|
|
101
|
+
autocomplete="off"
|
|
102
|
+
/>
|
|
103
|
+
<label
|
|
104
|
+
class="btn btn-outline-primary"
|
|
105
|
+
[class.btn-sm]="props?.buttonSize === 'sm'"
|
|
106
|
+
[class.btn-lg]="props?.buttonSize === 'lg'"
|
|
107
|
+
[for]="name() + '_' + i"
|
|
108
|
+
>
|
|
109
|
+
{{ option.label | dynamicText | async }}
|
|
110
|
+
</label>
|
|
111
|
+
}
|
|
112
|
+
</div>
|
|
113
|
+
} @else {
|
|
114
|
+
@for (option of options(); track option.value; let i = $index) {
|
|
115
|
+
<div class="form-check" [class.form-check-inline]="props?.inline" [class.form-check-reverse]="props?.reverse">
|
|
116
|
+
<input
|
|
117
|
+
ngForgeControl
|
|
118
|
+
type="radio"
|
|
119
|
+
[name]="name()"
|
|
120
|
+
[value]="option.value"
|
|
121
|
+
[checked]="value() === option.value"
|
|
122
|
+
(change)="onRadioChange(option.value)"
|
|
123
|
+
[disabled]="disabled() || option.disabled || false"
|
|
124
|
+
class="form-check-input"
|
|
125
|
+
[id]="name() + '_' + i"
|
|
126
|
+
/>
|
|
127
|
+
<label class="form-check-label" [for]="name() + '_' + i">
|
|
128
|
+
{{ option.label | dynamicText | async }}
|
|
129
|
+
</label>
|
|
130
|
+
</div>
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block}\n"] }]
|
|
134
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], properties: [{ type: i0.Input, args: [{ isSignal: true, alias: "properties", required: false }] }] } });
|
|
135
|
+
|
|
136
|
+
class BsRadioFieldComponent {
|
|
137
|
+
ngf = injectNgForgeField();
|
|
138
|
+
options = input([], /* @ts-ignore */
|
|
139
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
140
|
+
props = input(/* @ts-ignore */
|
|
141
|
+
...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsRadioFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
143
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: BsRadioFieldComponent, isStandalone: true, selector: "df-bs-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: `
|
|
144
|
+
@let f = ngf.field();
|
|
145
|
+
|
|
146
|
+
<div class="mb-3">
|
|
147
|
+
@if (ngf.label(); as label) {
|
|
148
|
+
<div class="form-label">{{ label | dynamicText | async }}</div>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
<df-bs-radio-group [formField]="f" [label]="ngf.label()" [options]="options()" [properties]="props()" />
|
|
152
|
+
|
|
153
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
154
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
155
|
+
} @else if (props()?.hint; as hint) {
|
|
156
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
157
|
+
}
|
|
158
|
+
</div>
|
|
159
|
+
`, isInline: true, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"], dependencies: [{ kind: "component", type: BsRadioGroupComponent, selector: "df-bs-radio-group", inputs: ["value", "disabled", "readonly", "name", "label", "options", "properties"], outputs: ["valueChange"] }, { 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 });
|
|
160
|
+
}
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsRadioFieldComponent, decorators: [{
|
|
162
|
+
type: Component,
|
|
163
|
+
args: [{ selector: 'df-bs-radio', imports: [BsRadioGroupComponent, FormField, DynamicTextPipe, AsyncPipe], hostDirectives: [NgForgeFieldHost], template: `
|
|
164
|
+
@let f = ngf.field();
|
|
165
|
+
|
|
166
|
+
<div class="mb-3">
|
|
167
|
+
@if (ngf.label(); as label) {
|
|
168
|
+
<div class="form-label">{{ label | dynamicText | async }}</div>
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
<df-bs-radio-group [formField]="f" [label]="ngf.label()" [options]="options()" [properties]="props()" />
|
|
172
|
+
|
|
173
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
174
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
175
|
+
} @else if (props()?.hint; as hint) {
|
|
176
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
177
|
+
}
|
|
178
|
+
</div>
|
|
179
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"] }]
|
|
180
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
export { BsRadioFieldComponent };
|
|
184
|
+
//# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-lazy-radio.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-forge-dynamic-forms-bootstrap-lazy-radio.mjs","mappings":";;;;;;;;;;;;;;;;;IAuGW;;;;AAEA;;IAGC;AACR;AACE;;;;AAnBO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVV;;;;;AApDC;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACYU;;;;AAIH;;;AAJU;;;;;;;;;;;;;;;;AAdlB;;;;AApBS","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-bootstrap/src/lib/fields/radio/bs-radio-group.component.ts","../../../../packages/dynamic-forms-bootstrap/src/lib/fields/radio/bs-radio.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, inject, input, model } from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\nimport { DynamicText, FieldOption, ValueType } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, NgForgeField } from '@ng-forge/dynamic-forms/integration';\nimport { AsyncPipe } from '@angular/common';\n\nexport interface BsRadioGroupProps {\n /** Display radio buttons inline (horizontal) */\n inline?: boolean;\n /** Reverse the position of the radio button and label */\n reverse?: boolean;\n /** Display as button group instead of radio buttons */\n buttonGroup?: boolean;\n /** Button size when using button group */\n buttonSize?: 'sm' | 'lg';\n /** Hint text to display below the radio group */\n hint?: DynamicText;\n}\n\n/**\n * Bootstrap radio group implementing FormValueControl. Rendered inside\n * `df-bs-radio` — each `<input type=\"radio\">` carries `ngForgeControl`, so\n * the marker absorbs meta + aria from the ambient parent NgForgeField.\n */\n@Component({\n selector: 'df-bs-radio-group',\n imports: [DynamicTextPipe, AsyncPipe, NgForgeControl],\n host: {\n role: 'radiogroup',\n '[attr.aria-invalid]': 'parentField?.ariaInvalid() || null',\n '[attr.aria-required]': 'parentField?.ariaRequired()',\n '[attr.aria-describedby]': 'parentField?.ariaDescribedBy()',\n },\n template: `\n @let props = properties();\n @if (props?.buttonGroup) {\n <div class=\"btn-group\" role=\"group\" [attr.aria-label]=\"label() | dynamicText | async\">\n @for (option of options(); track option.value; let i = $index) {\n <input\n ngForgeControl\n type=\"radio\"\n [name]=\"name()\"\n [value]=\"option.value\"\n [checked]=\"value() === option.value\"\n (change)=\"onRadioChange(option.value)\"\n [disabled]=\"disabled() || option.disabled || false\"\n class=\"btn-check\"\n [id]=\"name() + '_' + i\"\n autocomplete=\"off\"\n />\n <label\n class=\"btn btn-outline-primary\"\n [class.btn-sm]=\"props?.buttonSize === 'sm'\"\n [class.btn-lg]=\"props?.buttonSize === 'lg'\"\n [for]=\"name() + '_' + i\"\n >\n {{ option.label | dynamicText | async }}\n </label>\n }\n </div>\n } @else {\n @for (option of options(); track option.value; let i = $index) {\n <div class=\"form-check\" [class.form-check-inline]=\"props?.inline\" [class.form-check-reverse]=\"props?.reverse\">\n <input\n ngForgeControl\n type=\"radio\"\n [name]=\"name()\"\n [value]=\"option.value\"\n [checked]=\"value() === option.value\"\n (change)=\"onRadioChange(option.value)\"\n [disabled]=\"disabled() || option.disabled || false\"\n class=\"form-check-input\"\n [id]=\"name() + '_' + i\"\n />\n <label class=\"form-check-label\" [for]=\"name() + '_' + i\">\n {{ option.label | dynamicText | async }}\n </label>\n </div>\n }\n }\n `,\n styles: [\n `\n :host {\n display: block;\n }\n `,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsRadioGroupComponent implements FormValueControl<ValueType | undefined> {\n protected readonly parentField = inject(NgForgeField, { optional: true });\n\n // Value model - FormField directive binds form value to this\n readonly value = model<ValueType | undefined>(undefined);\n\n // Optional FormValueControl properties - Field directive will bind these\n readonly disabled = input<boolean>(false);\n readonly readonly = input<boolean>(false);\n readonly name = input<string>('');\n\n // Component-specific inputs\n readonly label = input<DynamicText>();\n readonly options = input.required<FieldOption<ValueType>[]>();\n readonly properties = input<BsRadioGroupProps>();\n\n /** Handle radio button change event */\n protected onRadioChange(newValue: ValueType): void {\n if (!this.disabled() && !this.readonly()) {\n this.value.set(newValue);\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { FieldOption, ValueType } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { BsRadioProps } from './bs-radio.type';\nimport { AsyncPipe } from '@angular/common';\nimport { BsRadioGroupComponent } from './bs-radio-group.component';\n\n@Component({\n selector: 'df-bs-radio',\n imports: [BsRadioGroupComponent, FormField, DynamicTextPipe, AsyncPipe],\n styleUrl: '../../styles/_form-field.scss',\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field();\n\n <div class=\"mb-3\">\n @if (ngf.label(); as label) {\n <div class=\"form-label\">{{ label | dynamicText | async }}</div>\n }\n\n <df-bs-radio-group [formField]=\"f\" [label]=\"ngf.label()\" [options]=\"options()\" [properties]=\"props()\" />\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <div class=\"invalid-feedback d-block\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</div>\n } @else if (props()?.hint; as hint) {\n <div class=\"form-text\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</div>\n }\n </div>\n `,\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 BsRadioFieldComponent {\n protected readonly ngf = injectNgForgeField<ValueType>();\n\n readonly options = input<FieldOption<ValueType>[]>([]);\n readonly props = input<BsRadioProps>();\n}\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { FormField } from '@angular/forms/signals';
|
|
4
|
+
import * as i1 from '@ng-forge/dynamic-forms/integration';
|
|
5
|
+
import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
|
|
6
|
+
import { AsyncPipe } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class BsSelectFieldComponent {
|
|
9
|
+
ngf = injectNgForgeField();
|
|
10
|
+
options = input([], /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
12
|
+
props = input(/* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
14
|
+
defaultCompare = Object.is;
|
|
15
|
+
isSelected(optionValue, fieldValue) {
|
|
16
|
+
const compareWith = this.props()?.compareWith || this.defaultCompare;
|
|
17
|
+
if (Array.isArray(fieldValue)) {
|
|
18
|
+
return fieldValue.some((v) => compareWith(v, optionValue));
|
|
19
|
+
}
|
|
20
|
+
return fieldValue !== null && compareWith(fieldValue, optionValue);
|
|
21
|
+
}
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsSelectFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: BsSelectFieldComponent, isStandalone: true, selector: "df-bs-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: `
|
|
24
|
+
@let f = ngf.field(); @let selectId = ngf.key() + '-select';
|
|
25
|
+
|
|
26
|
+
<div class="mb-3">
|
|
27
|
+
@if (ngf.label(); as label) {
|
|
28
|
+
<label [for]="selectId" class="form-label">{{ label | dynamicText | async }}</label>
|
|
29
|
+
}
|
|
30
|
+
<select
|
|
31
|
+
ngForgeControl
|
|
32
|
+
[formField]="f"
|
|
33
|
+
[id]="selectId"
|
|
34
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
35
|
+
class="form-select"
|
|
36
|
+
[class.form-select-sm]="props()?.size === 'sm'"
|
|
37
|
+
[class.form-select-lg]="props()?.size === 'lg'"
|
|
38
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
39
|
+
[multiple]="props()?.multiple || false"
|
|
40
|
+
[attr.size]="props()?.htmlSize ?? null"
|
|
41
|
+
>
|
|
42
|
+
@if (ngf.placeholder(); as placeholder) {
|
|
43
|
+
<option value="" disabled [selected]="!f().value()">{{ placeholder | dynamicText | async }}</option>
|
|
44
|
+
}
|
|
45
|
+
@for (option of options(); track option.value) {
|
|
46
|
+
<option [value]="option.value" [disabled]="option.disabled || false" [selected]="isSelected(option.value, f().value())">
|
|
47
|
+
{{ option.label | dynamicText | async }}
|
|
48
|
+
</option>
|
|
49
|
+
}
|
|
50
|
+
</select>
|
|
51
|
+
|
|
52
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
53
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
54
|
+
} @else if (props()?.hint; as hint) {
|
|
55
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
56
|
+
}
|
|
57
|
+
</div>
|
|
58
|
+
`, isInline: true, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"], dependencies: [{ 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 });
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsSelectFieldComponent, decorators: [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{ selector: 'df-bs-select', imports: [FormField, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
|
|
63
|
+
@let f = ngf.field(); @let selectId = ngf.key() + '-select';
|
|
64
|
+
|
|
65
|
+
<div class="mb-3">
|
|
66
|
+
@if (ngf.label(); as label) {
|
|
67
|
+
<label [for]="selectId" class="form-label">{{ label | dynamicText | async }}</label>
|
|
68
|
+
}
|
|
69
|
+
<select
|
|
70
|
+
ngForgeControl
|
|
71
|
+
[formField]="f"
|
|
72
|
+
[id]="selectId"
|
|
73
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
74
|
+
class="form-select"
|
|
75
|
+
[class.form-select-sm]="props()?.size === 'sm'"
|
|
76
|
+
[class.form-select-lg]="props()?.size === 'lg'"
|
|
77
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
78
|
+
[multiple]="props()?.multiple || false"
|
|
79
|
+
[attr.size]="props()?.htmlSize ?? null"
|
|
80
|
+
>
|
|
81
|
+
@if (ngf.placeholder(); as placeholder) {
|
|
82
|
+
<option value="" disabled [selected]="!f().value()">{{ placeholder | dynamicText | async }}</option>
|
|
83
|
+
}
|
|
84
|
+
@for (option of options(); track option.value) {
|
|
85
|
+
<option [value]="option.value" [disabled]="option.disabled || false" [selected]="isSelected(option.value, f().value())">
|
|
86
|
+
{{ option.label | dynamicText | async }}
|
|
87
|
+
</option>
|
|
88
|
+
}
|
|
89
|
+
</select>
|
|
90
|
+
|
|
91
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
92
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
93
|
+
} @else if (props()?.hint; as hint) {
|
|
94
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
95
|
+
}
|
|
96
|
+
</div>
|
|
97
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"] }]
|
|
98
|
+
}], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
export { BsSelectFieldComponent };
|
|
102
|
+
//# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-lazy-select.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-forge-dynamic-forms-bootstrap-lazy-select.mjs","mappings":";;;;;;;AA0Dc;;;;AAIH;;AAET;;AAGE;AAEA;AACE;;;;;AAZe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVlB;;;;AAvCS","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-bootstrap/src/lib/fields/select/bs-select.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { FieldOption } from '@ng-forge/dynamic-forms';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { BsSelectProps } from './bs-select.type';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-bs-select',\n imports: [FormField, DynamicTextPipe, AsyncPipe, NgForgeControl],\n styleUrl: '../../styles/_form-field.scss',\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field(); @let selectId = ngf.key() + '-select';\n\n <div class=\"mb-3\">\n @if (ngf.label(); as label) {\n <label [for]=\"selectId\" class=\"form-label\">{{ label | dynamicText | async }}</label>\n }\n <select\n ngForgeControl\n [formField]=\"f\"\n [id]=\"selectId\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n class=\"form-select\"\n [class.form-select-sm]=\"props()?.size === 'sm'\"\n [class.form-select-lg]=\"props()?.size === 'lg'\"\n [class.is-invalid]=\"f().invalid() && f().touched()\"\n [multiple]=\"props()?.multiple || false\"\n [attr.size]=\"props()?.htmlSize ?? null\"\n >\n @if (ngf.placeholder(); as placeholder) {\n <option value=\"\" disabled [selected]=\"!f().value()\">{{ placeholder | dynamicText | async }}</option>\n }\n @for (option of options(); track option.value) {\n <option [value]=\"option.value\" [disabled]=\"option.disabled || false\" [selected]=\"isSelected(option.value, f().value())\">\n {{ option.label | dynamicText | async }}\n </option>\n }\n </select>\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <div class=\"invalid-feedback d-block\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</div>\n } @else if (props()?.hint; as hint) {\n <div class=\"form-text\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</div>\n }\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: [\n `\n :host([hidden]) {\n display: none !important;\n }\n `,\n ],\n})\nexport default class BsSelectFieldComponent {\n protected readonly ngf = injectNgForgeField<string>();\n\n readonly options = input<FieldOption<string>[]>([]);\n readonly props = input<BsSelectProps>();\n\n defaultCompare = Object.is;\n\n protected isSelected(optionValue: string, fieldValue: string | string[] | null): boolean {\n const compareWith = this.props()?.compareWith || this.defaultCompare;\n\n if (Array.isArray(fieldValue)) {\n return fieldValue.some((v) => compareWith(v, optionValue));\n }\n\n return fieldValue !== null && compareWith(fieldValue, optionValue);\n }\n}\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { FormField } from '@angular/forms/signals';
|
|
4
|
+
import * as i1 from '@ng-forge/dynamic-forms/integration';
|
|
5
|
+
import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
|
|
6
|
+
import { AsyncPipe } from '@angular/common';
|
|
7
|
+
import { InputConstraintsDirective } from '@ng-forge/dynamic-forms-bootstrap/shared';
|
|
8
|
+
|
|
9
|
+
class BsSliderFieldComponent {
|
|
10
|
+
ngf = injectNgForgeField();
|
|
11
|
+
min = input(0, /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
13
|
+
max = input(100, /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
15
|
+
step = input(/* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [undefined, { debugName: "step" }] : /* istanbul ignore next */ []));
|
|
17
|
+
props = input(/* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsSliderFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: BsSliderFieldComponent, isStandalone: true, selector: "df-bs-slider", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, 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 }], ngImport: i0, template: `
|
|
21
|
+
@let f = ngf.field(); @let inputId = ngf.key() + '-input';
|
|
22
|
+
|
|
23
|
+
<div class="mb-3">
|
|
24
|
+
@if (ngf.label(); as label) {
|
|
25
|
+
<label [for]="inputId" class="form-label">
|
|
26
|
+
{{ label | dynamicText | async }}
|
|
27
|
+
@if (props()?.showValue) {
|
|
28
|
+
<span class="ms-2 badge bg-secondary"> {{ props()?.valuePrefix }}{{ f().value() }}{{ props()?.valueSuffix }} </span>
|
|
29
|
+
}
|
|
30
|
+
</label>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
<input
|
|
34
|
+
ngForgeControl
|
|
35
|
+
type="range"
|
|
36
|
+
dfBsInputConstraints
|
|
37
|
+
[formField]="f"
|
|
38
|
+
[id]="inputId"
|
|
39
|
+
[dfMin]="f().min?.() ?? props()?.min ?? min()"
|
|
40
|
+
[dfMax]="f().max?.() ?? props()?.max ?? max()"
|
|
41
|
+
[dfStep]="step() ?? props()?.step ?? 1"
|
|
42
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
43
|
+
class="form-range"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
47
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
48
|
+
} @else if (props()?.hint; as hint) {
|
|
49
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
50
|
+
}
|
|
51
|
+
</div>
|
|
52
|
+
`, isInline: true, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"], dependencies: [{ kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "directive", type: InputConstraintsDirective, selector: "[dfBsInputConstraints]", inputs: ["dfMin", "dfMax", "dfStep"] }, { kind: "directive", type: NgForgeControl, selector: "[ngForgeControl]", inputs: ["ngForgeControl"] }, { kind: "pipe", type: DynamicTextPipe, name: "dynamicText" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsSliderFieldComponent, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{ selector: 'df-bs-slider', imports: [FormField, DynamicTextPipe, AsyncPipe, InputConstraintsDirective, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
|
|
57
|
+
@let f = ngf.field(); @let inputId = ngf.key() + '-input';
|
|
58
|
+
|
|
59
|
+
<div class="mb-3">
|
|
60
|
+
@if (ngf.label(); as label) {
|
|
61
|
+
<label [for]="inputId" class="form-label">
|
|
62
|
+
{{ label | dynamicText | async }}
|
|
63
|
+
@if (props()?.showValue) {
|
|
64
|
+
<span class="ms-2 badge bg-secondary"> {{ props()?.valuePrefix }}{{ f().value() }}{{ props()?.valueSuffix }} </span>
|
|
65
|
+
}
|
|
66
|
+
</label>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
<input
|
|
70
|
+
ngForgeControl
|
|
71
|
+
type="range"
|
|
72
|
+
dfBsInputConstraints
|
|
73
|
+
[formField]="f"
|
|
74
|
+
[id]="inputId"
|
|
75
|
+
[dfMin]="f().min?.() ?? props()?.min ?? min()"
|
|
76
|
+
[dfMax]="f().max?.() ?? props()?.max ?? max()"
|
|
77
|
+
[dfStep]="step() ?? props()?.step ?? 1"
|
|
78
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
79
|
+
class="form-range"
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
83
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
84
|
+
} @else if (props()?.hint; as hint) {
|
|
85
|
+
<div class="form-text" [id]="ngf.hintId()">{{ hint | dynamicText | async }}</div>
|
|
86
|
+
}
|
|
87
|
+
</div>
|
|
88
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host{display:block}:host([hidden]){display:none!important}\n"] }]
|
|
89
|
+
}], propDecorators: { min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
export { BsSliderFieldComponent };
|
|
93
|
+
//# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-lazy-slider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-forge-dynamic-forms-bootstrap-lazy-slider.mjs","mappings":";;;;;;;;AA2Dc;;;;;;AAKH;;AAEA;;;AAPU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAlDT","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-bootstrap/src/lib/fields/slider/bs-slider.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { BsSliderProps } from './bs-slider.type';\nimport { AsyncPipe } from '@angular/common';\nimport { InputConstraintsDirective } from '@ng-forge/dynamic-forms-bootstrap/shared';\n\n@Component({\n selector: 'df-bs-slider',\n imports: [FormField, DynamicTextPipe, AsyncPipe, InputConstraintsDirective, NgForgeControl],\n styleUrl: '../../styles/_form-field.scss',\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field(); @let inputId = ngf.key() + '-input';\n\n <div class=\"mb-3\">\n @if (ngf.label(); as label) {\n <label [for]=\"inputId\" class=\"form-label\">\n {{ label | dynamicText | async }}\n @if (props()?.showValue) {\n <span class=\"ms-2 badge bg-secondary\"> {{ props()?.valuePrefix }}{{ f().value() }}{{ props()?.valueSuffix }} </span>\n }\n </label>\n }\n\n <input\n ngForgeControl\n type=\"range\"\n dfBsInputConstraints\n [formField]=\"f\"\n [id]=\"inputId\"\n [dfMin]=\"f().min?.() ?? props()?.min ?? min()\"\n [dfMax]=\"f().max?.() ?? props()?.max ?? max()\"\n [dfStep]=\"step() ?? props()?.step ?? 1\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n class=\"form-range\"\n />\n\n @if (ngf.errorsToDisplay()[0]; as error) {\n <div class=\"invalid-feedback d-block\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</div>\n } @else if (props()?.hint; as hint) {\n <div class=\"form-text\" [id]=\"ngf.hintId()\">{{ hint | dynamicText | async }}</div>\n }\n </div>\n `,\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 BsSliderFieldComponent {\n protected readonly ngf = injectNgForgeField<number>();\n\n readonly min = input<number>(0);\n readonly max = input<number>(100);\n readonly step = input<number>();\n\n readonly props = input<BsSliderProps>();\n}\n"]}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { FormField } from '@angular/forms/signals';
|
|
4
|
+
import * as i1 from '@ng-forge/dynamic-forms/integration';
|
|
5
|
+
import { injectNgForgeField, NgForgeControl, DynamicTextPipe, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';
|
|
6
|
+
import { AsyncPipe } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
class BsTextareaFieldComponent {
|
|
9
|
+
ngf = injectNgForgeField();
|
|
10
|
+
props = input(/* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsTextareaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: BsTextareaFieldComponent, isStandalone: true, selector: "df-bs-textarea", inputs: { props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1.NgForgeFieldHost }], ngImport: i0, template: `
|
|
14
|
+
@let f = ngf.field(); @let p = props(); @let textareaId = ngf.key() + '-textarea';
|
|
15
|
+
@if (p?.floatingLabel) {
|
|
16
|
+
<!-- Floating label variant -->
|
|
17
|
+
<div class="form-floating mb-3">
|
|
18
|
+
<textarea
|
|
19
|
+
ngForgeControl
|
|
20
|
+
[formField]="f"
|
|
21
|
+
[id]="textareaId"
|
|
22
|
+
[placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
|
|
23
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
24
|
+
class="form-control"
|
|
25
|
+
[class.form-control-sm]="p?.size === 'sm'"
|
|
26
|
+
[class.form-control-lg]="p?.size === 'lg'"
|
|
27
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
28
|
+
[class.is-valid]="f().valid() && f().touched() && p?.validFeedback"
|
|
29
|
+
></textarea>
|
|
30
|
+
|
|
31
|
+
@if (ngf.label()) {
|
|
32
|
+
<label [for]="textareaId">{{ ngf.label() | dynamicText | async }}</label>
|
|
33
|
+
}
|
|
34
|
+
@if (p?.validFeedback && f().valid() && f().touched()) {
|
|
35
|
+
<div class="valid-feedback d-block">
|
|
36
|
+
{{ p?.validFeedback | dynamicText | async }}
|
|
37
|
+
</div>
|
|
38
|
+
}
|
|
39
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
40
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
41
|
+
} @else if (p?.hint) {
|
|
42
|
+
<div class="form-text" [id]="ngf.hintId()">{{ p?.hint | dynamicText | async }}</div>
|
|
43
|
+
}
|
|
44
|
+
</div>
|
|
45
|
+
} @else {
|
|
46
|
+
<!-- Standard variant -->
|
|
47
|
+
<div class="mb-3">
|
|
48
|
+
@if (ngf.label()) {
|
|
49
|
+
<label [for]="textareaId" class="form-label">{{ ngf.label() | dynamicText | async }}</label>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
<textarea
|
|
53
|
+
ngForgeControl
|
|
54
|
+
[formField]="f"
|
|
55
|
+
[id]="textareaId"
|
|
56
|
+
[placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
|
|
57
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
58
|
+
class="form-control"
|
|
59
|
+
[class.form-control-sm]="p?.size === 'sm'"
|
|
60
|
+
[class.form-control-lg]="p?.size === 'lg'"
|
|
61
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
62
|
+
[class.is-valid]="f().valid() && f().touched() && p?.validFeedback"
|
|
63
|
+
></textarea>
|
|
64
|
+
|
|
65
|
+
@if (p?.validFeedback && f().valid() && f().touched()) {
|
|
66
|
+
<div class="valid-feedback d-block">
|
|
67
|
+
{{ p?.validFeedback | dynamicText | async }}
|
|
68
|
+
</div>
|
|
69
|
+
}
|
|
70
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
71
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
72
|
+
} @else if (p?.hint) {
|
|
73
|
+
<div class="form-text" [id]="ngf.hintId()">{{ p?.hint | dynamicText | async }}</div>
|
|
74
|
+
}
|
|
75
|
+
</div>
|
|
76
|
+
}
|
|
77
|
+
`, isInline: true, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"], dependencies: [{ 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 });
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: BsTextareaFieldComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{ selector: 'df-bs-textarea', imports: [FormField, DynamicTextPipe, AsyncPipe, NgForgeControl], hostDirectives: [NgForgeFieldHost], template: `
|
|
82
|
+
@let f = ngf.field(); @let p = props(); @let textareaId = ngf.key() + '-textarea';
|
|
83
|
+
@if (p?.floatingLabel) {
|
|
84
|
+
<!-- Floating label variant -->
|
|
85
|
+
<div class="form-floating mb-3">
|
|
86
|
+
<textarea
|
|
87
|
+
ngForgeControl
|
|
88
|
+
[formField]="f"
|
|
89
|
+
[id]="textareaId"
|
|
90
|
+
[placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
|
|
91
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
92
|
+
class="form-control"
|
|
93
|
+
[class.form-control-sm]="p?.size === 'sm'"
|
|
94
|
+
[class.form-control-lg]="p?.size === 'lg'"
|
|
95
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
96
|
+
[class.is-valid]="f().valid() && f().touched() && p?.validFeedback"
|
|
97
|
+
></textarea>
|
|
98
|
+
|
|
99
|
+
@if (ngf.label()) {
|
|
100
|
+
<label [for]="textareaId">{{ ngf.label() | dynamicText | async }}</label>
|
|
101
|
+
}
|
|
102
|
+
@if (p?.validFeedback && f().valid() && f().touched()) {
|
|
103
|
+
<div class="valid-feedback d-block">
|
|
104
|
+
{{ p?.validFeedback | dynamicText | async }}
|
|
105
|
+
</div>
|
|
106
|
+
}
|
|
107
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
108
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
109
|
+
} @else if (p?.hint) {
|
|
110
|
+
<div class="form-text" [id]="ngf.hintId()">{{ p?.hint | dynamicText | async }}</div>
|
|
111
|
+
}
|
|
112
|
+
</div>
|
|
113
|
+
} @else {
|
|
114
|
+
<!-- Standard variant -->
|
|
115
|
+
<div class="mb-3">
|
|
116
|
+
@if (ngf.label()) {
|
|
117
|
+
<label [for]="textareaId" class="form-label">{{ ngf.label() | dynamicText | async }}</label>
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
<textarea
|
|
121
|
+
ngForgeControl
|
|
122
|
+
[formField]="f"
|
|
123
|
+
[id]="textareaId"
|
|
124
|
+
[placeholder]="(ngf.placeholder() | dynamicText | async) ?? ''"
|
|
125
|
+
[attr.tabindex]="ngf.tabIndex()"
|
|
126
|
+
class="form-control"
|
|
127
|
+
[class.form-control-sm]="p?.size === 'sm'"
|
|
128
|
+
[class.form-control-lg]="p?.size === 'lg'"
|
|
129
|
+
[class.is-invalid]="f().invalid() && f().touched()"
|
|
130
|
+
[class.is-valid]="f().valid() && f().touched() && p?.validFeedback"
|
|
131
|
+
></textarea>
|
|
132
|
+
|
|
133
|
+
@if (p?.validFeedback && f().valid() && f().touched()) {
|
|
134
|
+
<div class="valid-feedback d-block">
|
|
135
|
+
{{ p?.validFeedback | dynamicText | async }}
|
|
136
|
+
</div>
|
|
137
|
+
}
|
|
138
|
+
@if (ngf.errorsToDisplay()[0]; as error) {
|
|
139
|
+
<div class="invalid-feedback d-block" [id]="ngf.errorId()" role="alert">{{ error.message }}</div>
|
|
140
|
+
} @else if (p?.hint) {
|
|
141
|
+
<div class="form-text" [id]="ngf.hintId()">{{ p?.hint | dynamicText | async }}</div>
|
|
142
|
+
}
|
|
143
|
+
</div>
|
|
144
|
+
}
|
|
145
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".df-bs-field{display:flex;flex-direction:column;gap:var(--df-field-gap, .5rem);width:100%;margin-bottom:var(--df-bs-field-margin-bottom, 1rem)}.df-bs-label{font-weight:var(--df-label-font-weight, 500);color:var(--df-label-color, inherit);margin-bottom:0}.df-bs-hint{color:var(--df-hint-color, var(--bs-secondary-color, #6c757d));font-size:var(--df-hint-font-size, .875rem);margin-top:var(--df-bs-hint-margin-top, .25rem)}.df-bs-field:has(.df-bs-hint){margin-bottom:var(--df-bs-field-with-hint-margin-bottom, .5rem)}:host([hidden]){display:none!important}\n", ":host([hidden]){display:none!important}\n"] }]
|
|
146
|
+
}], propDecorators: { props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }] } });
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
export { BsTextareaFieldComponent };
|
|
150
|
+
//# sourceMappingURL=ng-forge-dynamic-forms-bootstrap-lazy-textarea.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-forge-dynamic-forms-bootstrap-lazy-textarea.mjs","mappings":";;;;;;;AAsFc;;AAGH;;;AAHU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVlB;;;;AApES","names":[],"ignoreList":[],"sources":["../../../../packages/dynamic-forms-bootstrap/src/lib/fields/textarea/bs-textarea.component.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { FormField } from '@angular/forms/signals';\nimport { DynamicTextPipe } from '@ng-forge/dynamic-forms/integration';\nimport { NgForgeControl, injectNgForgeField, NgForgeFieldHost } from '@ng-forge/dynamic-forms/integration';\nimport { BsTextareaProps } from './bs-textarea.type';\nimport { AsyncPipe } from '@angular/common';\n\n@Component({\n selector: 'df-bs-textarea',\n imports: [FormField, DynamicTextPipe, AsyncPipe, NgForgeControl],\n styleUrl: '../../styles/_form-field.scss',\n hostDirectives: [NgForgeFieldHost],\n template: `\n @let f = ngf.field(); @let p = props(); @let textareaId = ngf.key() + '-textarea';\n @if (p?.floatingLabel) {\n <!-- Floating label variant -->\n <div class=\"form-floating mb-3\">\n <textarea\n ngForgeControl\n [formField]=\"f\"\n [id]=\"textareaId\"\n [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n class=\"form-control\"\n [class.form-control-sm]=\"p?.size === 'sm'\"\n [class.form-control-lg]=\"p?.size === 'lg'\"\n [class.is-invalid]=\"f().invalid() && f().touched()\"\n [class.is-valid]=\"f().valid() && f().touched() && p?.validFeedback\"\n ></textarea>\n\n @if (ngf.label()) {\n <label [for]=\"textareaId\">{{ ngf.label() | dynamicText | async }}</label>\n }\n @if (p?.validFeedback && f().valid() && f().touched()) {\n <div class=\"valid-feedback d-block\">\n {{ p?.validFeedback | dynamicText | async }}\n </div>\n }\n @if (ngf.errorsToDisplay()[0]; as error) {\n <div class=\"invalid-feedback d-block\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</div>\n } @else if (p?.hint) {\n <div class=\"form-text\" [id]=\"ngf.hintId()\">{{ p?.hint | dynamicText | async }}</div>\n }\n </div>\n } @else {\n <!-- Standard variant -->\n <div class=\"mb-3\">\n @if (ngf.label()) {\n <label [for]=\"textareaId\" class=\"form-label\">{{ ngf.label() | dynamicText | async }}</label>\n }\n\n <textarea\n ngForgeControl\n [formField]=\"f\"\n [id]=\"textareaId\"\n [placeholder]=\"(ngf.placeholder() | dynamicText | async) ?? ''\"\n [attr.tabindex]=\"ngf.tabIndex()\"\n class=\"form-control\"\n [class.form-control-sm]=\"p?.size === 'sm'\"\n [class.form-control-lg]=\"p?.size === 'lg'\"\n [class.is-invalid]=\"f().invalid() && f().touched()\"\n [class.is-valid]=\"f().valid() && f().touched() && p?.validFeedback\"\n ></textarea>\n\n @if (p?.validFeedback && f().valid() && f().touched()) {\n <div class=\"valid-feedback d-block\">\n {{ p?.validFeedback | dynamicText | async }}\n </div>\n }\n @if (ngf.errorsToDisplay()[0]; as error) {\n <div class=\"invalid-feedback d-block\" [id]=\"ngf.errorId()\" role=\"alert\">{{ error.message }}</div>\n } @else if (p?.hint) {\n <div class=\"form-text\" [id]=\"ngf.hintId()\">{{ p?.hint | dynamicText | async }}</div>\n }\n </div>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: [\n `\n :host([hidden]) {\n display: none !important;\n }\n `,\n ],\n})\nexport default class BsTextareaFieldComponent {\n protected readonly ngf = injectNgForgeField<string>();\n\n readonly props = input<BsTextareaProps>();\n}\n"]}
|