@softpak/components 0.0.0-beta.7 → 0.0.0-beta.71
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-input-box.component.mjs +51 -44
- package/esm2022/spx-inputs/spx-input-text.component.mjs +11 -6
- package/esm2022/spx-inputs/spx-input-type.enum.mjs +14 -0
- package/esm2022/spx-inputs/spx-input.component.mjs +24 -9
- package/esm2022/spx-navigation/spx-home-tile.component.mjs +26 -9
- package/esm2022/spx-navigation/spx-navigation-item.interface.mjs +1 -1
- package/esm2022/spx-navigation/spx-navigation.component.mjs +3 -3
- 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 +95 -55
- package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-navigation.mjs +27 -10
- 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 +19 -1
- 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-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 +5 -2
- package/spx-navigation/spx-home-tile.component.d.ts +2 -1
- package/spx-navigation/spx-navigation-item.interface.d.ts +1 -0
- 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;AACD,QAAA,OAAO,KAAK,CAAC;KACd;IAED,OAAO,gBAAgB,CAAC,QAA2B,EAAA;QACjD,MAAM,UAAU,GAAQ,EAAE,CAAC;AAC3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A;AACrB,iBAAA,CAAA;gFAEU,YAAY,EAAA,CAAA;sBAApB,KAAK;gBACG,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBACG,cAAc,EAAA,CAAA;sBAAtB,KAAK;;;AClER;;AAEG;;;;"}
|
|
@@ -1,54 +1,36 @@
|
|
|
1
1
|
import { NgIf, NgFor } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { EventEmitter, Component, Input, Output, HostListener } from '@angular/core';
|
|
3
|
+
import { EventEmitter, Component, Input, Output, HostListener, ViewChild } from '@angular/core';
|
|
4
4
|
import { SpxButtonComponent } from '@softpak/components/spx-button';
|
|
5
5
|
import * as i1 from '@fortawesome/angular-fontawesome';
|
|
6
6
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
7
|
-
import { faEdit
|
|
7
|
+
import { faEdit } from '@fortawesome/free-solid-svg-icons/faEdit';
|
|
8
|
+
import { faQuestion } from '@fortawesome/free-solid-svg-icons/faQuestion';
|
|
9
|
+
import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';
|
|
10
|
+
import { faTimes } from '@fortawesome/free-solid-svg-icons/faTimes';
|
|
8
11
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
12
|
import { SpxSuggestionComponent } from '@softpak/components/spx-suggestion';
|
|
10
13
|
import { DateTime } from 'luxon';
|
|
11
14
|
|
|
12
15
|
class SpxInputBoxComponent {
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
this.faSearch = faSearch;
|
|
16
|
-
this.faQuestion = faQuestion;
|
|
17
|
-
this.faTimes = faTimes;
|
|
18
|
-
this.spxReadonly = false;
|
|
19
|
-
this.spxShowClear = true;
|
|
20
|
-
this.spxClear = new EventEmitter();
|
|
21
|
-
this.spxSearchOutput = new EventEmitter();
|
|
22
|
-
this.spxFocus = new EventEmitter();
|
|
23
|
-
this.spxFocusOut = new EventEmitter();
|
|
24
|
-
this.spxEdit = new EventEmitter();
|
|
25
|
-
this.spxHelp = new EventEmitter();
|
|
26
|
-
this.spxFocused = false;
|
|
16
|
+
handleFocusOut() {
|
|
17
|
+
this.spxFocusOut.emit();
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// this.spxFocused = true;
|
|
38
|
-
// this.spxFocus.emit();
|
|
39
|
-
// }
|
|
40
|
-
// } else {
|
|
41
|
-
// this.spxFocused = false;
|
|
42
|
-
// }
|
|
43
|
-
// }
|
|
44
|
-
async spxSetFocus() {
|
|
45
|
-
this.spxFocused = true;
|
|
19
|
+
handleWindowClick(ev) {
|
|
20
|
+
if (ev.composedPath().includes(this.elRef.nativeElement)) {
|
|
21
|
+
if (!this.spxFocused) {
|
|
22
|
+
this.spxFocus.emit();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.spxFocused = false;
|
|
27
|
+
}
|
|
46
28
|
}
|
|
47
29
|
onClear() {
|
|
48
30
|
this.spxClear.emit();
|
|
49
31
|
}
|
|
50
32
|
onSearch() {
|
|
51
|
-
this.
|
|
33
|
+
this.spxSearch.emit();
|
|
52
34
|
}
|
|
53
35
|
onEdit() {
|
|
54
36
|
this.spxEdit.emit();
|
|
@@ -56,8 +38,25 @@ class SpxInputBoxComponent {
|
|
|
56
38
|
onHelp() {
|
|
57
39
|
this.spxHelp.emit();
|
|
58
40
|
}
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
constructor(elRef) {
|
|
42
|
+
this.elRef = elRef;
|
|
43
|
+
this.faEdit = faEdit;
|
|
44
|
+
this.faSearch = faSearch;
|
|
45
|
+
this.faQuestion = faQuestion;
|
|
46
|
+
this.faTimes = faTimes;
|
|
47
|
+
// @Element() el: HTMLElement;
|
|
48
|
+
this.spxFocused = false;
|
|
49
|
+
this.spxReadonly = false;
|
|
50
|
+
this.spxShowClear = true;
|
|
51
|
+
this.spxClear = new EventEmitter();
|
|
52
|
+
this.spxSearch = new EventEmitter();
|
|
53
|
+
this.spxFocus = new EventEmitter();
|
|
54
|
+
this.spxFocusOut = new EventEmitter();
|
|
55
|
+
this.spxEdit = new EventEmitter();
|
|
56
|
+
this.spxHelp = new EventEmitter();
|
|
57
|
+
}
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputBoxComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
59
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: { spxFocused: "spxFocused", spxLabel: "spxLabel", spxRequired: "spxRequired", spxReadonly: "spxReadonly", spxShowHelp: "spxShowHelp", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowEdit: "spxShowEdit", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxValue: "spxValue" }, outputs: { spxClear: "spxClear", spxSearch: "spxSearch", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, host: { listeners: { "focusout": "handleFocusOut()", "document:click": "handleWindowClick($event)" } }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
|
|
61
60
|
[class.rounded-none]="this.spxShowValidationMessages"
|
|
62
61
|
[class.rounded-t]="this.spxShowValidationMessages"
|
|
63
62
|
[class.outline-none]="this.spxFocused && !this.spxReadonly"
|
|
@@ -84,7 +83,6 @@ class SpxInputBoxComponent {
|
|
|
84
83
|
(spxClick)="onEdit()"
|
|
85
84
|
[spxFullHeight]="true"
|
|
86
85
|
[spxSize]="'xl'"
|
|
87
|
-
[spxTabIndex]="-1"
|
|
88
86
|
[spxType]="'button'">
|
|
89
87
|
<fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
|
|
90
88
|
</spx-button>
|
|
@@ -92,6 +90,7 @@ class SpxInputBoxComponent {
|
|
|
92
90
|
*ngIf="this.spxShowHelp"
|
|
93
91
|
(spxClick)="onHelp()"
|
|
94
92
|
[spxFullHeight]="true"
|
|
93
|
+
[spxDisabled]="this.spxReadonly"
|
|
95
94
|
[spxSize]="'xl'"
|
|
96
95
|
[spxTabIndex]="-1"
|
|
97
96
|
[spxType]="'button'">
|
|
@@ -101,6 +100,7 @@ class SpxInputBoxComponent {
|
|
|
101
100
|
*ngIf="this.spxShowSearch"
|
|
102
101
|
(spxClick)="onSearch()"
|
|
103
102
|
[spxFullHeight]="true"
|
|
103
|
+
[spxDisabled]="this.spxReadonly"
|
|
104
104
|
[spxSize]="'xl'"
|
|
105
105
|
[spxTabIndex]="-1"
|
|
106
106
|
[spxType]="'button'">
|
|
@@ -159,7 +159,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
159
159
|
(spxClick)="onEdit()"
|
|
160
160
|
[spxFullHeight]="true"
|
|
161
161
|
[spxSize]="'xl'"
|
|
162
|
-
[spxTabIndex]="-1"
|
|
163
162
|
[spxType]="'button'">
|
|
164
163
|
<fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
|
|
165
164
|
</spx-button>
|
|
@@ -167,6 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
167
166
|
*ngIf="this.spxShowHelp"
|
|
168
167
|
(spxClick)="onHelp()"
|
|
169
168
|
[spxFullHeight]="true"
|
|
169
|
+
[spxDisabled]="this.spxReadonly"
|
|
170
170
|
[spxSize]="'xl'"
|
|
171
171
|
[spxTabIndex]="-1"
|
|
172
172
|
[spxType]="'button'">
|
|
@@ -176,6 +176,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
176
176
|
*ngIf="this.spxShowSearch"
|
|
177
177
|
(spxClick)="onSearch()"
|
|
178
178
|
[spxFullHeight]="true"
|
|
179
|
+
[spxDisabled]="this.spxReadonly"
|
|
179
180
|
[spxSize]="'xl'"
|
|
180
181
|
[spxTabIndex]="-1"
|
|
181
182
|
[spxType]="'button'">
|
|
@@ -197,7 +198,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
197
198
|
<ng-content select="[validation-messages]"></ng-content>
|
|
198
199
|
</div>`,
|
|
199
200
|
}]
|
|
200
|
-
}], propDecorators: {
|
|
201
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxFocused: [{
|
|
202
|
+
type: Input
|
|
203
|
+
}], spxLabel: [{
|
|
201
204
|
type: Input
|
|
202
205
|
}], spxRequired: [{
|
|
203
206
|
type: Input
|
|
@@ -219,7 +222,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
219
222
|
type: Input
|
|
220
223
|
}], spxClear: [{
|
|
221
224
|
type: Output
|
|
222
|
-
}],
|
|
225
|
+
}], spxSearch: [{
|
|
223
226
|
type: Output
|
|
224
227
|
}], spxFocus: [{
|
|
225
228
|
type: Output
|
|
@@ -229,8 +232,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
229
232
|
type: Output
|
|
230
233
|
}], spxHelp: [{
|
|
231
234
|
type: Output
|
|
232
|
-
}],
|
|
233
|
-
type:
|
|
235
|
+
}], handleFocusOut: [{
|
|
236
|
+
type: HostListener,
|
|
237
|
+
args: ['focusout']
|
|
238
|
+
}], handleWindowClick: [{
|
|
239
|
+
type: HostListener,
|
|
240
|
+
args: ['document:click', ["$event"]]
|
|
234
241
|
}] } });
|
|
235
242
|
|
|
236
243
|
class SpxInputTextComponent {
|
|
@@ -247,7 +254,7 @@ class SpxInputTextComponent {
|
|
|
247
254
|
this.spxWasInternalUpdate = false;
|
|
248
255
|
}
|
|
249
256
|
async spxSetFocus() {
|
|
250
|
-
|
|
257
|
+
this.inputRef?.nativeElement?.focus();
|
|
251
258
|
}
|
|
252
259
|
componentDidLoad() {
|
|
253
260
|
if (this.spxAutofocus) {
|
|
@@ -279,8 +286,9 @@ class SpxInputTextComponent {
|
|
|
279
286
|
this.spxFocused = true;
|
|
280
287
|
}
|
|
281
288
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
282
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputTextComponent, isStandalone: true, selector: "spx-input-text", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxSuggestions: "spxSuggestions", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused", spxType: "spxType", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate" }, outputs: { spxBlurFromChild: "spxBlurFromChild", spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="relative text-black">
|
|
289
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputTextComponent, isStandalone: true, selector: "spx-input-text", inputs: { spxName: "spxName", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxSuggestions: "spxSuggestions", spxReadonly: "spxReadonly", spxValidators: "spxValidators", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused", spxType: "spxType", value: "value", spxWasInternalUpdate: "spxWasInternalUpdate" }, outputs: { spxBlurFromChild: "spxBlurFromChild", spxChange: "spxChange", spxFocus: "spxFocus" }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: `<div class="relative text-black">
|
|
283
290
|
<input
|
|
291
|
+
#input
|
|
284
292
|
class="font-bold text-lg w-full outline-none"
|
|
285
293
|
[class.bg-white]="!this.spxReadonly"
|
|
286
294
|
[class.bg-gray-300]="this.spxReadonly"
|
|
@@ -292,7 +300,7 @@ class SpxInputTextComponent {
|
|
|
292
300
|
[attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
|
|
293
301
|
[attr.name]="this.spxName"
|
|
294
302
|
[attr.type]="this.spxType"
|
|
295
|
-
[
|
|
303
|
+
[value]="this.value?.description ? this.value?.description : this.value?.value"
|
|
296
304
|
(blur)="this.handleBlur()"
|
|
297
305
|
(keyUp)="this.handleKeyUp()"
|
|
298
306
|
(focus)="this.handleFocus()"
|
|
@@ -326,6 +334,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
326
334
|
],
|
|
327
335
|
template: `<div class="relative text-black">
|
|
328
336
|
<input
|
|
337
|
+
#input
|
|
329
338
|
class="font-bold text-lg w-full outline-none"
|
|
330
339
|
[class.bg-white]="!this.spxReadonly"
|
|
331
340
|
[class.bg-gray-300]="this.spxReadonly"
|
|
@@ -337,7 +346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
337
346
|
[attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
|
|
338
347
|
[attr.name]="this.spxName"
|
|
339
348
|
[attr.type]="this.spxType"
|
|
340
|
-
[
|
|
349
|
+
[value]="this.value?.description ? this.value?.description : this.value?.value"
|
|
341
350
|
(blur)="this.handleBlur()"
|
|
342
351
|
(keyUp)="this.handleKeyUp()"
|
|
343
352
|
(focus)="this.handleFocus()"
|
|
@@ -389,6 +398,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
389
398
|
type: Output
|
|
390
399
|
}], spxWasInternalUpdate: [{
|
|
391
400
|
type: Input
|
|
401
|
+
}], inputRef: [{
|
|
402
|
+
type: ViewChild,
|
|
403
|
+
args: ['input', { static: true }]
|
|
392
404
|
}] } });
|
|
393
405
|
|
|
394
406
|
class SpxInputDateComponent {
|
|
@@ -968,6 +980,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
968
980
|
type: Output
|
|
969
981
|
}] } });
|
|
970
982
|
|
|
983
|
+
var SpxInputTypeEnum;
|
|
984
|
+
(function (SpxInputTypeEnum) {
|
|
985
|
+
SpxInputTypeEnum["autocomplete"] = "autocomplete";
|
|
986
|
+
SpxInputTypeEnum["date"] = "date";
|
|
987
|
+
SpxInputTypeEnum["float"] = "float";
|
|
988
|
+
SpxInputTypeEnum["overlay"] = "overlay";
|
|
989
|
+
SpxInputTypeEnum["overlayNumber"] = "overlaynumber";
|
|
990
|
+
SpxInputTypeEnum["radio"] = "radio";
|
|
991
|
+
SpxInputTypeEnum["number"] = "number";
|
|
992
|
+
SpxInputTypeEnum["password"] = "password";
|
|
993
|
+
SpxInputTypeEnum["text"] = "text";
|
|
994
|
+
SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
|
|
995
|
+
})(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
|
|
996
|
+
|
|
971
997
|
class SpxInputComponent {
|
|
972
998
|
constructor() {
|
|
973
999
|
this.spxLabel = 'label';
|
|
@@ -983,7 +1009,7 @@ class SpxInputComponent {
|
|
|
983
1009
|
this.spxShowSearch = false;
|
|
984
1010
|
this.spxShowValidationMessages = false;
|
|
985
1011
|
this.spxSuggestions = [];
|
|
986
|
-
this.spxType =
|
|
1012
|
+
this.spxType = SpxInputTypeEnum.text;
|
|
987
1013
|
this.spxCapitalize = false;
|
|
988
1014
|
this.spxBlur = new EventEmitter();
|
|
989
1015
|
this.spxClear = new EventEmitter();
|
|
@@ -996,7 +1022,7 @@ class SpxInputComponent {
|
|
|
996
1022
|
this.onChange = () => { };
|
|
997
1023
|
this.onTouched = () => { };
|
|
998
1024
|
}
|
|
999
|
-
|
|
1025
|
+
spxSetFocus() {
|
|
1000
1026
|
this.passFocusToControl();
|
|
1001
1027
|
}
|
|
1002
1028
|
handleBlur() {
|
|
@@ -1007,6 +1033,7 @@ class SpxInputComponent {
|
|
|
1007
1033
|
this.spxChange.emit(this.value);
|
|
1008
1034
|
}
|
|
1009
1035
|
handleClear() {
|
|
1036
|
+
this.spxClear.emit();
|
|
1010
1037
|
this.spxFocused = true;
|
|
1011
1038
|
this.passFocusToControl();
|
|
1012
1039
|
this.value = {
|
|
@@ -1016,6 +1043,7 @@ class SpxInputComponent {
|
|
|
1016
1043
|
this.spxChange.emit(this.value);
|
|
1017
1044
|
}
|
|
1018
1045
|
handleFocus() {
|
|
1046
|
+
this.spxFocus.emit();
|
|
1019
1047
|
this.spxFocused = true;
|
|
1020
1048
|
// this.elBox.spxSetFocus();
|
|
1021
1049
|
}
|
|
@@ -1030,15 +1058,22 @@ class SpxInputComponent {
|
|
|
1030
1058
|
this.spxFocused = false;
|
|
1031
1059
|
}
|
|
1032
1060
|
handleEdit() {
|
|
1061
|
+
this.spxEdit.emit();
|
|
1033
1062
|
this.spxFocused = true;
|
|
1034
1063
|
}
|
|
1035
1064
|
handleHelp() {
|
|
1065
|
+
this.spxHelp.emit();
|
|
1036
1066
|
this.spxFocused = true;
|
|
1037
1067
|
}
|
|
1038
1068
|
passFocusToControl() {
|
|
1069
|
+
switch (this.spxType) {
|
|
1070
|
+
case SpxInputTypeEnum.text:
|
|
1071
|
+
this.textInput?.spxSetFocus();
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1039
1074
|
}
|
|
1040
1075
|
writeValue(value) {
|
|
1041
|
-
this.value = this.lastValue = value
|
|
1076
|
+
this.value = this.lastValue = value;
|
|
1042
1077
|
}
|
|
1043
1078
|
handleChangeEvent(value) {
|
|
1044
1079
|
if (value !== this.lastValue) {
|
|
@@ -1062,7 +1097,8 @@ class SpxInputComponent {
|
|
|
1062
1097
|
useExisting: SpxInputComponent,
|
|
1063
1098
|
multi: true
|
|
1064
1099
|
}
|
|
1065
|
-
], ngImport: i0, template: `<spx-input-box
|
|
1100
|
+
], viewQueries: [{ propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
|
|
1101
|
+
[spxFocused]="this.spxFocused"
|
|
1066
1102
|
[spxLabel]="this.spxLabel"
|
|
1067
1103
|
[spxReadonly]="this.spxReadonly"
|
|
1068
1104
|
[spxRequired]="this.spxRequired"
|
|
@@ -1078,7 +1114,7 @@ class SpxInputComponent {
|
|
|
1078
1114
|
(spxHelp)="this.handleHelp()"
|
|
1079
1115
|
(spxFocus)="this.setFocus()"
|
|
1080
1116
|
(spxFocusOut)="this.setFocusOut()"
|
|
1081
|
-
(
|
|
1117
|
+
(spxSearch)="this.handleSearch()">
|
|
1082
1118
|
<div controls>
|
|
1083
1119
|
<spx-input-text
|
|
1084
1120
|
*ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
|
|
@@ -1151,7 +1187,7 @@ class SpxInputComponent {
|
|
|
1151
1187
|
<div validation-messages>
|
|
1152
1188
|
<ng-content></ng-content>
|
|
1153
1189
|
</div>
|
|
1154
|
-
</spx-input-box>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxInputBoxComponent, selector: "spx-input-box", inputs: ["spxLabel", "spxRequired", "spxReadonly", "spxShowHelp", "spxCompact", "spxShowClear", "spxShowEdit", "spxShowSearch", "spxShowValidationMessages", "spxValue"
|
|
1190
|
+
</spx-input-box>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxInputBoxComponent, selector: "spx-input-box", inputs: ["spxFocused", "spxLabel", "spxRequired", "spxReadonly", "spxShowHelp", "spxCompact", "spxShowClear", "spxShowEdit", "spxShowSearch", "spxShowValidationMessages", "spxValue"], outputs: ["spxClear", "spxSearch", "spxFocus", "spxFocusOut", "spxEdit", "spxHelp"] }, { kind: "component", type: SpxInputDateComponent, selector: "spx-input-date", inputs: ["spxMax", "spxMin", "spxName", "spxReadonly", "spxValidators", "spxFocused", "spxSelectMonth", "spxSelectDay", "value", "spxLastKeyPressed", "spxSelectStep", "spxInternalValue", "spxSuggestions", "spxWasInternalUpdate"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputFloatComponent, selector: "spx-input-float", inputs: ["spxName", "spxAutofocus", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value", "spxWasInternalUpdate", "tick"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputNumberComponent, selector: "spx-input-number", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxReadonly", "spxValidators", "spxFocused", "spxStep", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputRadioComponent, selector: "spx-input-radio", inputs: ["spxName", "spxValidators", "spxFocused", "spxReadonly", "spxSuggestions", "value"], outputs: ["spxChange", "spxFocus"] }, { kind: "component", type: SpxInputTextComponent, selector: "spx-input-text", inputs: ["spxName", "spxAutofocus", "spxInputMode", "spxPattern", "spxSuggestions", "spxReadonly", "spxValidators", "spxCapitalize", "spxFocused", "spxType", "value", "spxWasInternalUpdate"], outputs: ["spxBlurFromChild", "spxChange", "spxFocus"] }] }); }
|
|
1155
1191
|
}
|
|
1156
1192
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
|
|
1157
1193
|
type: Component,
|
|
@@ -1178,6 +1214,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1178
1214
|
}
|
|
1179
1215
|
],
|
|
1180
1216
|
template: `<spx-input-box
|
|
1217
|
+
[spxFocused]="this.spxFocused"
|
|
1181
1218
|
[spxLabel]="this.spxLabel"
|
|
1182
1219
|
[spxReadonly]="this.spxReadonly"
|
|
1183
1220
|
[spxRequired]="this.spxRequired"
|
|
@@ -1193,7 +1230,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1193
1230
|
(spxHelp)="this.handleHelp()"
|
|
1194
1231
|
(spxFocus)="this.setFocus()"
|
|
1195
1232
|
(spxFocusOut)="this.setFocusOut()"
|
|
1196
|
-
(
|
|
1233
|
+
(spxSearch)="this.handleSearch()">
|
|
1197
1234
|
<div controls>
|
|
1198
1235
|
<spx-input-text
|
|
1199
1236
|
*ngIf="this.spxType === 'autocomplete' || this.spxType === 'overlay' || this.spxType === 'overlaynumber' || this.spxType === 'text' || this.spxType === 'password'"
|
|
@@ -1328,6 +1365,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1328
1365
|
type: Output
|
|
1329
1366
|
}], spxSearch: [{
|
|
1330
1367
|
type: Output
|
|
1368
|
+
}], textInput: [{
|
|
1369
|
+
type: ViewChild,
|
|
1370
|
+
args: [SpxInputTextComponent]
|
|
1331
1371
|
}], spxFocused: [{
|
|
1332
1372
|
type: Input
|
|
1333
1373
|
}], _handleBlurEvent: [{
|
|
@@ -1339,5 +1379,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1339
1379
|
* Generated bundle index. Do not edit.
|
|
1340
1380
|
*/
|
|
1341
1381
|
|
|
1342
|
-
export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent };
|
|
1382
|
+
export { SpxInputBoxComponent, SpxInputComponent, SpxInputTextComponent, SpxInputTypeEnum };
|
|
1343
1383
|
//# sourceMappingURL=softpak-components-spx-inputs.mjs.map
|