@softpak/components 0.0.0-beta.9 → 0.0.0-beta.90
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/esm2022/spx-alert/spx-alert.component.mjs +9 -4
- package/esm2022/spx-change-details/public-api.mjs +2 -0
- package/esm2022/spx-change-details/softpak-components-spx-change-details.mjs +5 -0
- package/esm2022/spx-change-details/spx-change-details-value.interface.mjs +2 -0
- package/esm2022/spx-change-details/spx-change-details.component.mjs +118 -0
- package/esm2022/spx-channel-selection/src/spx-channel-selection.component.mjs +5 -4
- package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +5 -4
- package/esm2022/spx-check-digit/spx-check-digit.component.mjs +6 -4
- package/esm2022/spx-form-section/spx-form-section.component.mjs +7 -7
- package/esm2022/spx-form-view/public-api.mjs +4 -0
- package/esm2022/spx-form-view/softpak-components-spx-form-view.mjs +5 -0
- package/esm2022/spx-form-view/spx-form-field.interface.mjs +2 -0
- package/esm2022/spx-form-view/spx-form-section.interface.mjs +2 -0
- package/esm2022/spx-form-view/spx-form-view.component.mjs +163 -0
- package/esm2022/spx-inputs/public-api.mjs +2 -1
- package/esm2022/spx-inputs/spx-dropdown.component.mjs +95 -0
- package/esm2022/spx-inputs/spx-input-box.component.mjs +51 -44
- package/esm2022/spx-inputs/spx-input-text.component.mjs +20 -31
- package/esm2022/spx-inputs/spx-input-type.enum.mjs +14 -0
- package/esm2022/spx-inputs/spx-input.component.mjs +21 -11
- package/esm2022/spx-navigation/spx-home-tile.component.mjs +29 -10
- package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
- package/esm2022/spx-navigation/spx-navigation.component.mjs +11 -5
- package/esm2022/spx-number-check/public-api.mjs +2 -0
- package/esm2022/spx-number-check/softpak-components-spx-number-check.mjs +5 -0
- package/esm2022/spx-number-check/spx-number-check.component.mjs +262 -0
- package/esm2022/spx-progress-bar/spx-progress-bar.component.mjs +3 -3
- package/esm2022/spx-spinner/spx-spinner.component.mjs +5 -5
- package/esm2022/spx-suggestion/spx-suggestion.component.mjs +10 -6
- package/esm2022/spx-toaster/src/spx-toaster.component.mjs +33 -21
- package/fesm2022/softpak-components-spx-alert.mjs +8 -3
- package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-change-details.mjs +125 -0
- package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -0
- package/fesm2022/softpak-components-spx-channel-selection.mjs +7 -5
- package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-check-digit.mjs +5 -3
- package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-form-section.mjs +6 -6
- package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-form-view.mjs +170 -0
- package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -0
- package/fesm2022/softpak-components-spx-inputs.mjs +190 -81
- package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-navigation.mjs +37 -12
- package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-number-check.mjs +269 -0
- package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -0
- package/fesm2022/softpak-components-spx-progress-bar.mjs +2 -2
- package/fesm2022/softpak-components-spx-progress-bar.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
- package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-suggestion.mjs +9 -5
- package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toaster.mjs +32 -20
- package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
- package/package.json +29 -11
- package/spx-change-details/index.d.ts +5 -0
- package/spx-change-details/public-api.d.ts +1 -0
- package/spx-change-details/spx-change-details-value.interface.d.ts +7 -0
- package/spx-change-details/spx-change-details.component.d.ts +40 -0
- package/spx-channel-selection/src/spx-channel-selection.component.d.ts +2 -1
- package/spx-channel-selection/src/spx-company-selection.component.d.ts +2 -1
- package/spx-check-digit/spx-check-digit.component.d.ts +3 -0
- package/spx-form-view/index.d.ts +5 -0
- package/spx-form-view/public-api.d.ts +3 -0
- package/spx-form-view/spx-form-field.interface.d.ts +16 -0
- package/spx-form-view/spx-form-section.interface.d.ts +9 -0
- package/spx-form-view/spx-form-view.component.d.ts +27 -0
- package/spx-inputs/public-api.d.ts +1 -0
- package/spx-inputs/spx-dropdown.component.d.ts +18 -0
- package/spx-inputs/spx-input-box.component.d.ts +8 -5
- package/spx-inputs/spx-input-text.component.d.ts +2 -1
- package/spx-inputs/spx-input-type.enum.d.ts +12 -0
- package/spx-inputs/spx-input.component.d.ts +4 -2
- package/spx-navigation/spx-home-tile.component.d.ts +5 -1
- package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
- package/spx-navigation/spx-navigation.component.d.ts +4 -1
- package/spx-number-check/index.d.ts +5 -0
- package/spx-number-check/public-api.d.ts +1 -0
- package/spx-number-check/spx-number-check.component.d.ts +48 -0
- package/spx-suggestion/spx-suggestion.component.d.ts +1 -0
- package/spx-toaster/src/spx-toaster.component.d.ts +1 -1
- package/tailwind.css +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { NgIf, NgFor, JsonPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Component, Input } from '@angular/core';
|
|
4
|
+
import { SpxFormSectionComponent } from '@softpak/components/spx-form-section';
|
|
5
|
+
import { SpxInputTypeEnum, SpxInputComponent } from '@softpak/components/spx-inputs';
|
|
6
|
+
import { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';
|
|
7
|
+
import * as i1 from '@angular/forms';
|
|
8
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
|
|
10
|
+
class SpxFormViewComponent {
|
|
11
|
+
onBlur(field) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
getRawValidators(formControl) {
|
|
15
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
16
|
+
return formControl._rawValidators;
|
|
17
|
+
}
|
|
18
|
+
hasRequiredField(abstractControl) {
|
|
19
|
+
if (abstractControl.validator) {
|
|
20
|
+
const validator = abstractControl.validator({});
|
|
21
|
+
if (validator && validator['required']) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (abstractControl['controls']) {
|
|
26
|
+
for (const controlName in abstractControl['controls']) {
|
|
27
|
+
if (abstractControl['controls'][controlName]) {
|
|
28
|
+
if (this.hasRequiredField(abstractControl['controls'][controlName])) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
static initialFormValue(sections) {
|
|
37
|
+
const formObject = {};
|
|
38
|
+
sections.forEach(section => {
|
|
39
|
+
section.fields.forEach(field => {
|
|
40
|
+
formObject[field.key] = [field.defaultValue ? field.defaultValue() : null, field.validators ? [...field.validators()] : []];
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return formObject;
|
|
44
|
+
}
|
|
45
|
+
static createForm(formBuilder, sections) {
|
|
46
|
+
return formBuilder.group(this.initialFormValue(sections));
|
|
47
|
+
}
|
|
48
|
+
constructor(formBuilder) {
|
|
49
|
+
this.formBuilder = formBuilder;
|
|
50
|
+
this.typeAutocomplete = SpxInputTypeEnum.autocomplete;
|
|
51
|
+
this.typeFloat = SpxInputTypeEnum.float;
|
|
52
|
+
this.typeNumber = SpxInputTypeEnum.number;
|
|
53
|
+
this.typeRadio = SpxInputTypeEnum.radio;
|
|
54
|
+
this.typeText = SpxInputTypeEnum.text;
|
|
55
|
+
this.typeNumericKeyboard = SpxInputTypeEnum.textNumericKeyboard;
|
|
56
|
+
this.typeOverlay = SpxInputTypeEnum.overlay;
|
|
57
|
+
this.typeOverlayNumber = SpxInputTypeEnum.overlayNumber;
|
|
58
|
+
}
|
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxFormViewComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
60
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxFormViewComponent, isStandalone: true, selector: "spx-form-view", inputs: { spxFormGroup: "spxFormGroup", spxSections: "spxSections", spxSuggestions: "spxSuggestions" }, ngImport: i0, template: `<spx-form-section
|
|
61
|
+
*ngFor="let spxSection of spxSections; let spxSectionIndex = index;"
|
|
62
|
+
[spxShowTitle]="!spxSection.showTitle || spxSection.showTitle()"
|
|
63
|
+
[spxIndex]="spxSectionIndex + 1"
|
|
64
|
+
[spxTitle]="spxSection.title ? spxSection.title() : undefined">
|
|
65
|
+
<ng-container *ngFor="let spxField of spxSection.fields; let spxFieldIndex = index;">
|
|
66
|
+
<ng-container *ngIf="spxField.show === undefined || spxField.show()">
|
|
67
|
+
<spx-input
|
|
68
|
+
*ngIf="spxField.type() === typeOverlay || spxField.type() === typeOverlayNumber || spxField.type() === typeFloat || spxField.type() === typeNumber || spxField.type() === typeText || spxField.type() === typeAutocomplete || spxField.type() === typeNumericKeyboard"
|
|
69
|
+
[formControl]="$any(this.spxFormGroup.get(spxField.key))"
|
|
70
|
+
[spxAutofocus]="spxField.autofocus ? spxField.autofocus() : false"
|
|
71
|
+
[spxCapitalize]="spxField.capitalize ? spxField.capitalize() : false"
|
|
72
|
+
[spxLabel]="(spxField.label ? spxField.label() : spxField.key) | capitalize"
|
|
73
|
+
[spxPattern]="spxField.type() === typeNumericKeyboard ? '\\d*' : undefined"
|
|
74
|
+
[spxReadonly]="spxField.readonly ? spxField.readonly() : false"
|
|
75
|
+
[spxRequired]="hasRequiredField(this.spxFormGroup.get(spxField.key)!)"
|
|
76
|
+
[spxShowHelp]="false"
|
|
77
|
+
[spxShowValidationMessages]="this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched"
|
|
78
|
+
[spxStep]="spxField.step ? spxField.step() : undefined"
|
|
79
|
+
[spxType]="spxField.type()"
|
|
80
|
+
[spxValidators]="getRawValidators(this.spxFormGroup.get(spxField.key)!)"
|
|
81
|
+
[spxSuggestions]="spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]"
|
|
82
|
+
(spxBlur)="onBlur(spxField)">
|
|
83
|
+
</spx-input>
|
|
84
|
+
|
|
85
|
+
<spx-input
|
|
86
|
+
*ngIf="spxField.type() === typeRadio"
|
|
87
|
+
[formControl]="$any(this.spxFormGroup.get(spxField.key))"
|
|
88
|
+
[spxLabel]="(spxField.label ? spxField.label() : spxField.key) | capitalize"
|
|
89
|
+
[spxReadonly]="spxField.readonly ? spxField.readonly() : false"
|
|
90
|
+
[spxRequired]="hasRequiredField(this.spxFormGroup.get(spxField.key)!)"
|
|
91
|
+
[spxShowHelp]="false"
|
|
92
|
+
[spxShowValidationMessages]="this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched"
|
|
93
|
+
[spxSuggestions]="spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]"
|
|
94
|
+
[spxType]="typeRadio"
|
|
95
|
+
[spxValidators]="getRawValidators(this.spxFormGroup.get(spxField.key)!)">
|
|
96
|
+
</spx-input>
|
|
97
|
+
</ng-container>
|
|
98
|
+
</ng-container>
|
|
99
|
+
</spx-form-section>`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "pipe", type: SpxCapitalizePipe, name: "capitalize" }, { kind: "component", type: SpxFormSectionComponent, selector: "spx-form-section", inputs: ["spxIndex", "spxIndexSecondary", "spxTitle", "spxShowTitle"] }, { kind: "component", type: SpxInputComponent, selector: "spx-input", inputs: ["spxLabel", "spxMax", "spxMin", "spxName", "spxReadonly", "spxAutofocus", "spxInputMode", "spxPattern", "spxRequired", "spxSelectMonth", "spxSelectDay", "spxShowEdit", "spxShowHelp", "spxCompact", "spxShowClear", "spxShowSearch", "spxShowValidationMessages", "spxStep", "spxSuggestions", "spxType", "spxValidators", "value", "spxCapitalize", "spxFocused"], outputs: ["spxBlur", "spxClear", "spxChange", "spxFocus", "spxEdit", "spxHelp", "spxSearch"] }] }); }
|
|
100
|
+
}
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxFormViewComponent, decorators: [{
|
|
102
|
+
type: Component,
|
|
103
|
+
args: [{
|
|
104
|
+
selector: 'spx-form-view',
|
|
105
|
+
standalone: true,
|
|
106
|
+
imports: [
|
|
107
|
+
FormsModule,
|
|
108
|
+
ReactiveFormsModule,
|
|
109
|
+
JsonPipe,
|
|
110
|
+
NgIf,
|
|
111
|
+
NgFor,
|
|
112
|
+
SpxCapitalizePipe,
|
|
113
|
+
SpxFormSectionComponent,
|
|
114
|
+
SpxInputComponent,
|
|
115
|
+
],
|
|
116
|
+
template: `<spx-form-section
|
|
117
|
+
*ngFor="let spxSection of spxSections; let spxSectionIndex = index;"
|
|
118
|
+
[spxShowTitle]="!spxSection.showTitle || spxSection.showTitle()"
|
|
119
|
+
[spxIndex]="spxSectionIndex + 1"
|
|
120
|
+
[spxTitle]="spxSection.title ? spxSection.title() : undefined">
|
|
121
|
+
<ng-container *ngFor="let spxField of spxSection.fields; let spxFieldIndex = index;">
|
|
122
|
+
<ng-container *ngIf="spxField.show === undefined || spxField.show()">
|
|
123
|
+
<spx-input
|
|
124
|
+
*ngIf="spxField.type() === typeOverlay || spxField.type() === typeOverlayNumber || spxField.type() === typeFloat || spxField.type() === typeNumber || spxField.type() === typeText || spxField.type() === typeAutocomplete || spxField.type() === typeNumericKeyboard"
|
|
125
|
+
[formControl]="$any(this.spxFormGroup.get(spxField.key))"
|
|
126
|
+
[spxAutofocus]="spxField.autofocus ? spxField.autofocus() : false"
|
|
127
|
+
[spxCapitalize]="spxField.capitalize ? spxField.capitalize() : false"
|
|
128
|
+
[spxLabel]="(spxField.label ? spxField.label() : spxField.key) | capitalize"
|
|
129
|
+
[spxPattern]="spxField.type() === typeNumericKeyboard ? '\\d*' : undefined"
|
|
130
|
+
[spxReadonly]="spxField.readonly ? spxField.readonly() : false"
|
|
131
|
+
[spxRequired]="hasRequiredField(this.spxFormGroup.get(spxField.key)!)"
|
|
132
|
+
[spxShowHelp]="false"
|
|
133
|
+
[spxShowValidationMessages]="this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched"
|
|
134
|
+
[spxStep]="spxField.step ? spxField.step() : undefined"
|
|
135
|
+
[spxType]="spxField.type()"
|
|
136
|
+
[spxValidators]="getRawValidators(this.spxFormGroup.get(spxField.key)!)"
|
|
137
|
+
[spxSuggestions]="spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]"
|
|
138
|
+
(spxBlur)="onBlur(spxField)">
|
|
139
|
+
</spx-input>
|
|
140
|
+
|
|
141
|
+
<spx-input
|
|
142
|
+
*ngIf="spxField.type() === typeRadio"
|
|
143
|
+
[formControl]="$any(this.spxFormGroup.get(spxField.key))"
|
|
144
|
+
[spxLabel]="(spxField.label ? spxField.label() : spxField.key) | capitalize"
|
|
145
|
+
[spxReadonly]="spxField.readonly ? spxField.readonly() : false"
|
|
146
|
+
[spxRequired]="hasRequiredField(this.spxFormGroup.get(spxField.key)!)"
|
|
147
|
+
[spxShowHelp]="false"
|
|
148
|
+
[spxShowValidationMessages]="this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched"
|
|
149
|
+
[spxSuggestions]="spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]"
|
|
150
|
+
[spxType]="typeRadio"
|
|
151
|
+
[spxValidators]="getRawValidators(this.spxFormGroup.get(spxField.key)!)">
|
|
152
|
+
</spx-input>
|
|
153
|
+
</ng-container>
|
|
154
|
+
</ng-container>
|
|
155
|
+
</spx-form-section>`,
|
|
156
|
+
}]
|
|
157
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { spxFormGroup: [{
|
|
158
|
+
type: Input
|
|
159
|
+
}], spxSections: [{
|
|
160
|
+
type: Input
|
|
161
|
+
}], spxSuggestions: [{
|
|
162
|
+
type: Input
|
|
163
|
+
}] } });
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Generated bundle index. Do not edit.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
export { SpxFormViewComponent };
|
|
170
|
+
//# sourceMappingURL=softpak-components-spx-form-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-form-view.mjs","sources":["../../../../projects/softpak/components/spx-form-view/spx-form-view.component.ts","../../../../projects/softpak/components/spx-form-view/softpak-components-spx-form-view.ts"],"sourcesContent":["import { JsonPipe, NgFor, NgIf } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { SpxFormSectionI } from './spx-form-section.interface';\nimport { SpxFormSectionComponent } from '@softpak/components/spx-form-section';\nimport { SpxInputComponent, SpxInputTypeEnum } from '@softpak/components/spx-inputs';\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\nimport { AbstractControl, FormBuilder, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { SpxFormFieldI } from './spx-form-field.interface';\n\n@Component({\n selector: 'spx-form-view',\n standalone: true,\n imports: [\n FormsModule,\n ReactiveFormsModule,\n JsonPipe,\n NgIf,\n NgFor,\n SpxCapitalizePipe,\n SpxFormSectionComponent,\n SpxInputComponent,\n ],\n template: `<spx-form-section\n *ngFor=\"let spxSection of spxSections; let spxSectionIndex = index;\"\n [spxShowTitle]=\"!spxSection.showTitle || spxSection.showTitle()\"\n [spxIndex]=\"spxSectionIndex + 1\"\n [spxTitle]=\"spxSection.title ? spxSection.title() : undefined\">\n <ng-container *ngFor=\"let spxField of spxSection.fields; let spxFieldIndex = index;\">\n <ng-container *ngIf=\"spxField.show === undefined || spxField.show()\">\n <spx-input\n *ngIf=\"spxField.type() === typeOverlay || spxField.type() === typeOverlayNumber || spxField.type() === typeFloat || spxField.type() === typeNumber || spxField.type() === typeText || spxField.type() === typeAutocomplete || spxField.type() === typeNumericKeyboard\"\n [formControl]=\"$any(this.spxFormGroup.get(spxField.key))\"\n [spxAutofocus]=\"spxField.autofocus ? spxField.autofocus() : false\"\n [spxCapitalize]=\"spxField.capitalize ? spxField.capitalize() : false\"\n [spxLabel]=\"(spxField.label ? spxField.label() : spxField.key) | capitalize\"\n [spxPattern]=\"spxField.type() === typeNumericKeyboard ? '\\\\d*' : undefined\"\n [spxReadonly]=\"spxField.readonly ? spxField.readonly() : false\"\n [spxRequired]=\"hasRequiredField(this.spxFormGroup.get(spxField.key)!)\"\n [spxShowHelp]=\"false\"\n [spxShowValidationMessages]=\"this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched\"\n [spxStep]=\"spxField.step ? spxField.step() : undefined\"\n [spxType]=\"spxField.type()\"\n [spxValidators]=\"getRawValidators(this.spxFormGroup.get(spxField.key)!)\"\n [spxSuggestions]=\"spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]\"\n (spxBlur)=\"onBlur(spxField)\">\n </spx-input>\n\n <spx-input\n *ngIf=\"spxField.type() === typeRadio\"\n [formControl]=\"$any(this.spxFormGroup.get(spxField.key))\"\n [spxLabel]=\"(spxField.label ? spxField.label() : spxField.key) | capitalize\"\n [spxReadonly]=\"spxField.readonly ? spxField.readonly() : false\"\n [spxRequired]=\"hasRequiredField(this.spxFormGroup.get(spxField.key)!)\"\n [spxShowHelp]=\"false\"\n [spxShowValidationMessages]=\"this.spxFormGroup.get(spxField.key)! && this.spxFormGroup.get(spxField.key)!.errors && this.spxFormGroup.get(spxField.key)!.touched\"\n [spxSuggestions]=\"spxField.suggestionsFixed ? spxField.suggestionsFixed() : this.spxSuggestions[spxField.key]\"\n [spxType]=\"typeRadio\"\n [spxValidators]=\"getRawValidators(this.spxFormGroup.get(spxField.key)!)\">\n </spx-input>\n </ng-container>\n </ng-container>\n </spx-form-section>`,\n})\nexport class SpxFormViewComponent {\n @Input() spxFormGroup!: FormGroup;\n @Input() spxSections!: SpxFormSectionI[];\n @Input() spxSuggestions!: any;\n\n typeAutocomplete = SpxInputTypeEnum.autocomplete;\n typeFloat = SpxInputTypeEnum.float;\n typeNumber = SpxInputTypeEnum.number;\n typeRadio = SpxInputTypeEnum.radio;\n typeText = SpxInputTypeEnum.text;\n typeNumericKeyboard = SpxInputTypeEnum.textNumericKeyboard;\n typeOverlay = SpxInputTypeEnum.overlay;\n typeOverlayNumber = SpxInputTypeEnum.overlayNumber;\n\n onBlur(field: SpxFormFieldI) {\n return;\n }\n\n getRawValidators(formControl: AbstractControl) {\n // eslint-disable-next-line no-underscore-dangle\n return (formControl as any)._rawValidators;\n }\n\n hasRequiredField(abstractControl: AbstractControl): boolean {\n if (abstractControl.validator) {\n const validator = abstractControl.validator({} as AbstractControl);\n if (validator && validator['required']) {\n return true;\n }\n }\n if ((abstractControl as any)['controls']) {\n for (const controlName in (abstractControl as any)['controls']) {\n if ((abstractControl as any)['controls'][controlName]) {\n if (this.hasRequiredField((abstractControl as any)['controls'][controlName])) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n static initialFormValue(sections: SpxFormSectionI[]) {\n const formObject: any = {};\n sections.forEach(section => {\n section.fields.forEach(field => {\n formObject[field.key] = [field.defaultValue ? field.defaultValue() : null, field.validators ? [...field.validators()] : []];\n });\n });\n return formObject;\n }\n\n static createForm(formBuilder: FormBuilder, sections: SpxFormSectionI[]): FormGroup {\n return formBuilder.group(this.initialFormValue(sections));\n }\n\n constructor(readonly formBuilder: FormBuilder) {\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MA+Da,oBAAoB,CAAA;AAc/B,IAAA,MAAM,CAAC,KAAoB,EAAA;QACzB,OAAO;KACR;AAED,IAAA,gBAAgB,CAAC,WAA4B,EAAA;;QAE3C,OAAQ,WAAmB,CAAC,cAAc,CAAC;KAC5C;AAED,IAAA,gBAAgB,CAAC,eAAgC,EAAA;AAC/C,QAAA,IAAI,eAAe,CAAC,SAAS,EAAE;YAC7B,MAAM,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,EAAqB,CAAC,CAAC;AACnE,YAAA,IAAI,SAAS,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE;AACtC,gBAAA,OAAO,IAAI,CAAC;aACb;SACF;AACD,QAAA,IAAK,eAAuB,CAAC,UAAU,CAAC,EAAE;YACxC,KAAK,MAAM,WAAW,IAAK,eAAuB,CAAC,UAAU,CAAC,EAAE;gBAC9D,IAAK,eAAuB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EAAE;AACrD,oBAAA,IAAI,IAAI,CAAC,gBAAgB,CAAE,eAAuB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE;AAC5E,wBAAA,OAAO,IAAI,CAAC;qBACb;iBACF;aACF;SACF;AAC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