@softpak/components 0.0.0-beta.14 → 0.0.0-beta.141
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 +5 -2
- 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 +1 -1
- package/esm2022/spx-channel-selection/src/spx-company-selection.component.mjs +2 -2
- package/esm2022/spx-check-digit/spx-check-digit.component.mjs +4 -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/spx-dropdown.component.mjs +94 -0
- package/esm2022/spx-inputs/spx-input-box.component.mjs +74 -47
- package/esm2022/spx-inputs/spx-input-date.component.mjs +1 -1
- package/esm2022/spx-inputs/spx-input-radio.component.mjs +89 -27
- package/esm2022/spx-inputs/spx-input-text.component.mjs +21 -31
- package/esm2022/spx-inputs/spx-input-type.enum.mjs +2 -1
- package/esm2022/spx-inputs/spx-input.component.mjs +39 -13
- 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-spinner/spx-spinner.component.mjs +5 -5
- package/esm2022/spx-suggestion/spx-suggestion.component.mjs +26 -10
- package/esm2022/spx-toaster/src/spx-toaster.component.mjs +3 -3
- package/esm2022/spx-update/src/spx-update-info.component.mjs +1 -1
- package/fesm2022/softpak-components-spx-alert.mjs +4 -1
- 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 +2 -2
- package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-check-digit.mjs +3 -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 +306 -112
- 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-spinner.mjs +4 -4
- package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-suggestion.mjs +25 -9
- package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toaster.mjs +2 -2
- package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-update.mjs +1 -1
- package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
- package/package.json +59 -41
- 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-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/spx-dropdown.component.d.ts +18 -0
- package/spx-inputs/spx-input-box.component.d.ts +14 -7
- package/spx-inputs/spx-input-radio.component.d.ts +13 -5
- package/spx-inputs/spx-input-text.component.d.ts +2 -1
- package/spx-inputs/spx-input-type.enum.d.ts +2 -1
- package/spx-inputs/spx-input.component.d.ts +7 -3
- 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 +3 -1
- package/tailwind.css +1 -1
|
@@ -1,63 +1,79 @@
|
|
|
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';
|
|
11
|
+
import { fromEvent } from 'rxjs';
|
|
8
12
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
9
13
|
import { SpxSuggestionComponent } from '@softpak/components/spx-suggestion';
|
|
10
14
|
import { DateTime } from 'luxon';
|
|
15
|
+
import { valuePairToValue } from '@softpak/components/spx-helpers';
|
|
11
16
|
|
|
12
17
|
class SpxInputBoxComponent {
|
|
13
|
-
|
|
18
|
+
handleFocusIn(ev) {
|
|
19
|
+
this.emitFocusIn();
|
|
20
|
+
}
|
|
21
|
+
handleFocusOut(ev) {
|
|
22
|
+
const thisEl = this.elRef.nativeElement;
|
|
23
|
+
const relatedElement = ev.relatedTarget;
|
|
24
|
+
if (!relatedElement || !thisEl.contains(relatedElement)) {
|
|
25
|
+
this.emitFocusOut();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
handleWindowClick(ev) {
|
|
29
|
+
if (ev.composedPath().includes(this.elRef.nativeElement)) {
|
|
30
|
+
this.emitFocusIn();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.emitFocusOut();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onClear() {
|
|
37
|
+
this.spxClear.emit();
|
|
38
|
+
}
|
|
39
|
+
onSearch() {
|
|
40
|
+
this.spxSearch.emit();
|
|
41
|
+
}
|
|
42
|
+
onEdit() {
|
|
43
|
+
this.spxEdit.emit();
|
|
44
|
+
}
|
|
45
|
+
onHelp() {
|
|
46
|
+
this.spxHelp.emit();
|
|
47
|
+
}
|
|
48
|
+
constructor(elRef) {
|
|
49
|
+
this.elRef = elRef;
|
|
14
50
|
this.faEdit = faEdit;
|
|
15
51
|
this.faSearch = faSearch;
|
|
16
52
|
this.faQuestion = faQuestion;
|
|
17
53
|
this.faTimes = faTimes;
|
|
54
|
+
this.spxFocused = false;
|
|
18
55
|
this.spxReadonly = false;
|
|
19
56
|
this.spxShowClear = true;
|
|
57
|
+
this.spxShowLabel = true;
|
|
20
58
|
this.spxClear = new EventEmitter();
|
|
21
59
|
this.spxSearch = new EventEmitter();
|
|
22
60
|
this.spxFocus = new EventEmitter();
|
|
23
61
|
this.spxFocusOut = new EventEmitter();
|
|
24
62
|
this.spxEdit = new EventEmitter();
|
|
25
63
|
this.spxHelp = new EventEmitter();
|
|
26
|
-
this.spxFocused = false;
|
|
27
|
-
}
|
|
28
|
-
// @Listen('focusout', { capture: true })
|
|
29
|
-
// handleFocusOut() {
|
|
30
|
-
// this.spxFocused = false;
|
|
31
|
-
// this.spxFocusOut.emit();
|
|
32
|
-
// }
|
|
33
|
-
// @Listen('click', { target: 'window' })
|
|
34
|
-
// handleWindowClick(ev) {
|
|
35
|
-
// if (ev.composedPath().includes(this.el)) {
|
|
36
|
-
// if (!this.spxFocused) {
|
|
37
|
-
// this.spxFocused = true;
|
|
38
|
-
// this.spxFocus.emit();
|
|
39
|
-
// }
|
|
40
|
-
// } else {
|
|
41
|
-
// this.spxFocused = false;
|
|
42
|
-
// }
|
|
43
|
-
// }
|
|
44
|
-
async spxSetFocus() {
|
|
45
|
-
this.spxFocused = true;
|
|
46
|
-
}
|
|
47
|
-
onClear() {
|
|
48
|
-
this.spxClear.emit();
|
|
49
|
-
}
|
|
50
|
-
onSearch() {
|
|
51
|
-
this.spxSearch.emit();
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
65
|
+
emitFocusIn() {
|
|
66
|
+
if (!this.spxFocused) {
|
|
67
|
+
this.spxFocus.emit();
|
|
68
|
+
}
|
|
55
69
|
}
|
|
56
|
-
|
|
57
|
-
this.
|
|
70
|
+
emitFocusOut() {
|
|
71
|
+
if (this.spxFocused) {
|
|
72
|
+
this.spxFocusOut.emit();
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
60
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: {
|
|
75
|
+
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 }); }
|
|
76
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputBoxComponent, isStandalone: true, selector: "spx-input-box", inputs: { spxCompact: "spxCompact", spxFocused: "spxFocused", spxLabel: "spxLabel", spxReadonly: "spxReadonly", spxRequired: "spxRequired", spxShowClear: "spxShowClear", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxShowLabel: "spxShowLabel", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxValue: "spxValue" }, outputs: { spxClear: "spxClear", spxSearch: "spxSearch", spxFocus: "spxFocus", spxFocusOut: "spxFocusOut", spxEdit: "spxEdit", spxHelp: "spxHelp" }, host: { listeners: { "focusin": "handleFocusIn($event)", "focusout": "handleFocusOut($event)", "document:click": "handleWindowClick($event)" } }, ngImport: i0, template: `<div class="flex rounded w-full gap-3"
|
|
61
77
|
[class.rounded-none]="this.spxShowValidationMessages"
|
|
62
78
|
[class.rounded-t]="this.spxShowValidationMessages"
|
|
63
79
|
[class.outline-none]="this.spxFocused && !this.spxReadonly"
|
|
@@ -71,7 +87,7 @@ class SpxInputBoxComponent {
|
|
|
71
87
|
[class.p-0]="this.spxCompact"
|
|
72
88
|
[class.flex]="this.spxCompact"
|
|
73
89
|
[class.items-center]="this.spxCompact">
|
|
74
|
-
<div class="text-sm mb-1 text-gray-800"
|
|
90
|
+
<div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
|
|
75
91
|
[class.mb-0]="this.spxCompact"
|
|
76
92
|
[class.px-3]="this.spxCompact">
|
|
77
93
|
{{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
|
|
@@ -84,7 +100,6 @@ class SpxInputBoxComponent {
|
|
|
84
100
|
(spxClick)="onEdit()"
|
|
85
101
|
[spxFullHeight]="true"
|
|
86
102
|
[spxSize]="'xl'"
|
|
87
|
-
[spxTabIndex]="-1"
|
|
88
103
|
[spxType]="'button'">
|
|
89
104
|
<fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
|
|
90
105
|
</spx-button>
|
|
@@ -92,6 +107,7 @@ class SpxInputBoxComponent {
|
|
|
92
107
|
*ngIf="this.spxShowHelp"
|
|
93
108
|
(spxClick)="onHelp()"
|
|
94
109
|
[spxFullHeight]="true"
|
|
110
|
+
[spxDisabled]="this.spxReadonly"
|
|
95
111
|
[spxSize]="'xl'"
|
|
96
112
|
[spxTabIndex]="-1"
|
|
97
113
|
[spxType]="'button'">
|
|
@@ -101,6 +117,7 @@ class SpxInputBoxComponent {
|
|
|
101
117
|
*ngIf="this.spxShowSearch"
|
|
102
118
|
(spxClick)="onSearch()"
|
|
103
119
|
[spxFullHeight]="true"
|
|
120
|
+
[spxDisabled]="this.spxReadonly"
|
|
104
121
|
[spxSize]="'xl'"
|
|
105
122
|
[spxTabIndex]="-1"
|
|
106
123
|
[spxType]="'button'">
|
|
@@ -146,7 +163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
146
163
|
[class.p-0]="this.spxCompact"
|
|
147
164
|
[class.flex]="this.spxCompact"
|
|
148
165
|
[class.items-center]="this.spxCompact">
|
|
149
|
-
<div class="text-sm mb-1 text-gray-800"
|
|
166
|
+
<div *ngIf="this.spxShowLabel" class="font-bold text-sm mb-1 text-gray-800"
|
|
150
167
|
[class.mb-0]="this.spxCompact"
|
|
151
168
|
[class.px-3]="this.spxCompact">
|
|
152
169
|
{{this.spxLabel}} <span *ngIf="spxRequired" class="text-red-800">*</span>
|
|
@@ -159,7 +176,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
159
176
|
(spxClick)="onEdit()"
|
|
160
177
|
[spxFullHeight]="true"
|
|
161
178
|
[spxSize]="'xl'"
|
|
162
|
-
[spxTabIndex]="-1"
|
|
163
179
|
[spxType]="'button'">
|
|
164
180
|
<fa-icon [icon]="faEdit" class="block text-xl"></fa-icon>
|
|
165
181
|
</spx-button>
|
|
@@ -167,6 +183,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
167
183
|
*ngIf="this.spxShowHelp"
|
|
168
184
|
(spxClick)="onHelp()"
|
|
169
185
|
[spxFullHeight]="true"
|
|
186
|
+
[spxDisabled]="this.spxReadonly"
|
|
170
187
|
[spxSize]="'xl'"
|
|
171
188
|
[spxTabIndex]="-1"
|
|
172
189
|
[spxType]="'button'">
|
|
@@ -176,6 +193,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
176
193
|
*ngIf="this.spxShowSearch"
|
|
177
194
|
(spxClick)="onSearch()"
|
|
178
195
|
[spxFullHeight]="true"
|
|
196
|
+
[spxDisabled]="this.spxReadonly"
|
|
179
197
|
[spxSize]="'xl'"
|
|
180
198
|
[spxTabIndex]="-1"
|
|
181
199
|
[spxType]="'button'">
|
|
@@ -197,20 +215,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
197
215
|
<ng-content select="[validation-messages]"></ng-content>
|
|
198
216
|
</div>`,
|
|
199
217
|
}]
|
|
200
|
-
}], propDecorators: {
|
|
218
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { spxCompact: [{
|
|
201
219
|
type: Input
|
|
202
|
-
}],
|
|
220
|
+
}], spxFocused: [{
|
|
203
221
|
type: Input
|
|
204
|
-
}],
|
|
222
|
+
}], spxLabel: [{
|
|
205
223
|
type: Input
|
|
206
|
-
}],
|
|
224
|
+
}], spxReadonly: [{
|
|
207
225
|
type: Input
|
|
208
|
-
}],
|
|
226
|
+
}], spxRequired: [{
|
|
209
227
|
type: Input
|
|
210
228
|
}], spxShowClear: [{
|
|
211
229
|
type: Input
|
|
212
230
|
}], spxShowEdit: [{
|
|
213
231
|
type: Input
|
|
232
|
+
}], spxShowHelp: [{
|
|
233
|
+
type: Input
|
|
234
|
+
}], spxShowLabel: [{
|
|
235
|
+
type: Input
|
|
214
236
|
}], spxShowSearch: [{
|
|
215
237
|
type: Input
|
|
216
238
|
}], spxShowValidationMessages: [{
|
|
@@ -229,8 +251,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
229
251
|
type: Output
|
|
230
252
|
}], spxHelp: [{
|
|
231
253
|
type: Output
|
|
232
|
-
}],
|
|
254
|
+
}], handleFocusIn: [{
|
|
255
|
+
type: HostListener,
|
|
256
|
+
args: ['focusin', ["$event"]]
|
|
257
|
+
}], handleFocusOut: [{
|
|
258
|
+
type: HostListener,
|
|
259
|
+
args: ['focusout', ["$event"]]
|
|
260
|
+
}], handleWindowClick: [{
|
|
261
|
+
type: HostListener,
|
|
262
|
+
args: ['document:click', ["$event"]]
|
|
263
|
+
}] } });
|
|
264
|
+
|
|
265
|
+
class SpxDropdownComponent {
|
|
266
|
+
constructor() {
|
|
267
|
+
this.focusPosition = 0;
|
|
268
|
+
this.spxSuggestions = [];
|
|
269
|
+
this.spxSelect = new EventEmitter();
|
|
270
|
+
}
|
|
271
|
+
ngOnInit() {
|
|
272
|
+
this.listenToKeyUp();
|
|
273
|
+
}
|
|
274
|
+
ngOnChanges(changes) {
|
|
275
|
+
this.focusPosition = 0;
|
|
276
|
+
}
|
|
277
|
+
ngOnDestroy() {
|
|
278
|
+
this.subscriptionKeyUp?.unsubscribe();
|
|
279
|
+
}
|
|
280
|
+
handleSuggestionClick(valuePair) {
|
|
281
|
+
this.select(valuePair);
|
|
282
|
+
}
|
|
283
|
+
listenToKeyUp() {
|
|
284
|
+
this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
|
|
285
|
+
if (event.key === 'ArrowUp' && this.focusPosition > 0) {
|
|
286
|
+
this.focusPosition = this.focusPosition - 1;
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
}
|
|
289
|
+
if (event.key === 'ArrowDown' && this.focusPosition < this.spxSuggestions.length - 1) {
|
|
290
|
+
this.focusPosition = this.focusPosition + 1;
|
|
291
|
+
event.preventDefault();
|
|
292
|
+
}
|
|
293
|
+
if (event.key === 'Enter' && this.spxSuggestions.length > 0) {
|
|
294
|
+
this.select(this.spxSuggestions.at(this.focusPosition));
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
select(valuePair) {
|
|
300
|
+
this.focusPosition = 0;
|
|
301
|
+
this.spxSelect.emit(valuePair);
|
|
302
|
+
}
|
|
303
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
304
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxDropdownComponent, isStandalone: true, selector: "spx-dropdown", inputs: { spxSuggestions: "spxSuggestions" }, outputs: { spxSelect: "spxSelect" }, usesOnChanges: true, ngImport: i0, template: `<div class="relative text-black">
|
|
305
|
+
<div
|
|
306
|
+
class="absolute bg-gray-100 left-0 right-0 z-20">
|
|
307
|
+
<button
|
|
308
|
+
*ngFor="let valuePair of this.spxSuggestions; let i = index"
|
|
309
|
+
class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
|
|
310
|
+
[class.bg-gray-100]="i === this.focusPosition"
|
|
311
|
+
[class.bg-white]="i !== this.focusPosition"
|
|
312
|
+
(click)="this.handleSuggestionClick(valuePair)"
|
|
313
|
+
[attr.tabindex]="-1"
|
|
314
|
+
[attr.type]="'button'">
|
|
315
|
+
<div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
|
|
316
|
+
<spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
|
|
317
|
+
</button>
|
|
318
|
+
</div>
|
|
319
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }] }); }
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxDropdownComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{
|
|
324
|
+
selector: 'spx-dropdown',
|
|
325
|
+
standalone: true,
|
|
326
|
+
imports: [
|
|
327
|
+
NgIf,
|
|
328
|
+
NgFor,
|
|
329
|
+
SpxButtonComponent,
|
|
330
|
+
],
|
|
331
|
+
template: `<div class="relative text-black">
|
|
332
|
+
<div
|
|
333
|
+
class="absolute bg-gray-100 left-0 right-0 z-20">
|
|
334
|
+
<button
|
|
335
|
+
*ngFor="let valuePair of this.spxSuggestions; let i = index"
|
|
336
|
+
class="text-black block w-full p-2 border border-gray-200 rounded-lg shadow hover:bg-gray-200 flex items-center text-left"
|
|
337
|
+
[class.bg-gray-100]="i === this.focusPosition"
|
|
338
|
+
[class.bg-white]="i !== this.focusPosition"
|
|
339
|
+
(click)="this.handleSuggestionClick(valuePair)"
|
|
340
|
+
[attr.tabindex]="-1"
|
|
341
|
+
[attr.type]="'button'">
|
|
342
|
+
<div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
|
|
343
|
+
<spx-button (spxClick)="this.handleSuggestionClick(valuePair)" [spxType]="'button'" [spxTabIndex]="-1">Select</spx-button>
|
|
344
|
+
</button>
|
|
345
|
+
</div>
|
|
346
|
+
</div>`,
|
|
347
|
+
}]
|
|
348
|
+
}], propDecorators: { spxSuggestions: [{
|
|
233
349
|
type: Input
|
|
350
|
+
}], spxSelect: [{
|
|
351
|
+
type: Output
|
|
234
352
|
}] } });
|
|
235
353
|
|
|
236
354
|
class SpxInputTextComponent {
|
|
@@ -247,7 +365,7 @@ class SpxInputTextComponent {
|
|
|
247
365
|
this.spxWasInternalUpdate = false;
|
|
248
366
|
}
|
|
249
367
|
async spxSetFocus() {
|
|
250
|
-
|
|
368
|
+
this.inputRef?.nativeElement?.focus();
|
|
251
369
|
}
|
|
252
370
|
componentDidLoad() {
|
|
253
371
|
if (this.spxAutofocus) {
|
|
@@ -266,6 +384,7 @@ class SpxInputTextComponent {
|
|
|
266
384
|
description: event.target ? event.target.value : null,
|
|
267
385
|
value: event.target ? event.target.value : null,
|
|
268
386
|
};
|
|
387
|
+
console.log('spxInput: spxChange', this.value);
|
|
269
388
|
this.spxChange.emit(this.value);
|
|
270
389
|
}
|
|
271
390
|
handleSuggestionClick(value) {
|
|
@@ -279,8 +398,9 @@ class SpxInputTextComponent {
|
|
|
279
398
|
this.spxFocused = true;
|
|
280
399
|
}
|
|
281
400
|
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">
|
|
401
|
+
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
402
|
<input
|
|
403
|
+
#input
|
|
284
404
|
class="font-bold text-lg w-full outline-none"
|
|
285
405
|
[class.bg-white]="!this.spxReadonly"
|
|
286
406
|
[class.bg-gray-300]="this.spxReadonly"
|
|
@@ -292,27 +412,18 @@ class SpxInputTextComponent {
|
|
|
292
412
|
[attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
|
|
293
413
|
[attr.name]="this.spxName"
|
|
294
414
|
[attr.type]="this.spxType"
|
|
295
|
-
[
|
|
415
|
+
[value]="this.value?.description ? this.value?.description : this.value?.value"
|
|
296
416
|
(blur)="this.handleBlur()"
|
|
297
417
|
(keyUp)="this.handleKeyUp()"
|
|
298
418
|
(focus)="this.handleFocus()"
|
|
299
419
|
(input)="this.handleDescriptionInput($event)"
|
|
300
420
|
/>
|
|
301
421
|
<span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
|
|
302
|
-
<
|
|
422
|
+
<spx-dropdown
|
|
303
423
|
*ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
|
|
308
|
-
(click)="this.handleSuggestionClick($event)"
|
|
309
|
-
[attr.tabindex]="0"
|
|
310
|
-
>
|
|
311
|
-
<div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
|
|
312
|
-
<spx-button spxType="button">Select</spx-button>
|
|
313
|
-
</div>
|
|
314
|
-
</div>
|
|
315
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }] }); }
|
|
424
|
+
[spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
|
|
425
|
+
</spx-dropdown>
|
|
426
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SpxDropdownComponent, selector: "spx-dropdown", inputs: ["spxSuggestions"], outputs: ["spxSelect"] }] }); }
|
|
316
427
|
}
|
|
317
428
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputTextComponent, decorators: [{
|
|
318
429
|
type: Component,
|
|
@@ -323,9 +434,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
323
434
|
NgIf,
|
|
324
435
|
NgFor,
|
|
325
436
|
SpxButtonComponent,
|
|
437
|
+
SpxDropdownComponent,
|
|
326
438
|
],
|
|
327
439
|
template: `<div class="relative text-black">
|
|
328
440
|
<input
|
|
441
|
+
#input
|
|
329
442
|
class="font-bold text-lg w-full outline-none"
|
|
330
443
|
[class.bg-white]="!this.spxReadonly"
|
|
331
444
|
[class.bg-gray-300]="this.spxReadonly"
|
|
@@ -337,26 +450,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
337
450
|
[attr.pattern]="this.spxPattern ? this.spxPattern : undefined"
|
|
338
451
|
[attr.name]="this.spxName"
|
|
339
452
|
[attr.type]="this.spxType"
|
|
340
|
-
[
|
|
453
|
+
[value]="this.value?.description ? this.value?.description : this.value?.value"
|
|
341
454
|
(blur)="this.handleBlur()"
|
|
342
455
|
(keyUp)="this.handleKeyUp()"
|
|
343
456
|
(focus)="this.handleFocus()"
|
|
344
457
|
(input)="this.handleDescriptionInput($event)"
|
|
345
458
|
/>
|
|
346
459
|
<span *ngIf="this.value?.description && this.value?.value && this.value?.description?.valueOf() !== this.value?.value?.valueOf()">{{this.value?.value}}</span>
|
|
347
|
-
<
|
|
460
|
+
<spx-dropdown
|
|
348
461
|
*ngIf="this.spxFocused && (this.spxType === 'overlay' || this.spxType === 'overlaynumber')"
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*ngFor="let valuePair of this.spxSuggestions"
|
|
352
|
-
class="text-black block w-full p-2 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 flex items-center"
|
|
353
|
-
(click)="this.handleSuggestionClick($event)"
|
|
354
|
-
[attr.tabindex]="0"
|
|
355
|
-
>
|
|
356
|
-
<div class="flex-1 p-1 font-bold text-lg">{{valuePair?.description}}</div>
|
|
357
|
-
<spx-button spxType="button">Select</spx-button>
|
|
358
|
-
</div>
|
|
359
|
-
</div>
|
|
462
|
+
[spxSuggestions]="this.spxSuggestions" (spxSelect)="this.handleSuggestionClick($event)">
|
|
463
|
+
</spx-dropdown>
|
|
360
464
|
</div>`,
|
|
361
465
|
}]
|
|
362
466
|
}], propDecorators: { spxName: [{
|
|
@@ -389,6 +493,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
389
493
|
type: Output
|
|
390
494
|
}], spxWasInternalUpdate: [{
|
|
391
495
|
type: Input
|
|
496
|
+
}], inputRef: [{
|
|
497
|
+
type: ViewChild,
|
|
498
|
+
args: ['input', { static: true }]
|
|
392
499
|
}] } });
|
|
393
500
|
|
|
394
501
|
class SpxInputDateComponent {
|
|
@@ -593,7 +700,7 @@ class SpxInputDateComponent {
|
|
|
593
700
|
<spx-suggestion
|
|
594
701
|
*ngFor="let valuePair of spxSuggestions[spxSelectStep]"
|
|
595
702
|
(click)="this.handleSuggestionClick(valuePair.value)">{{valuePair?.description}}</spx-suggestion>
|
|
596
|
-
</div>`, isInline: true, styles: [":host{display:block}.spx-input-date__input{background-color:transparent;border:1px solid #979797;border-radius:4px;color:var(--spx-input--color, rgba(0, 0, 0, .9));box-sizing:border-box;font-size:16px;margin-right:10px;padding:6px;text-align:center;width:100%}.spx-input-date__input:active{transform:scale(.95)}.spx-input-date__input:focus{border:var(--spx-input-box--focus--border, 1px solid rgb(115, 168, 210));border-radius:4px;outline:none}.spx-input-date__control-label{align-items:center;color:#000000b3;display:inline-grid;font-size:13px;letter-spacing:1px}.spx-input-date__input::-webkit-outer-spin-button,.spx-input-date__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.spx-input-date__input[type=number]{-moz-appearance:textfield}.spx-input-date__suggestions,.spx-input-date__controls{display:grid;grid-gap:8px;grid-template-columns:repeat(4,1fr);margin-top:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxSelected"] }] }); }
|
|
703
|
+
</div>`, isInline: true, styles: [":host{display:block}.spx-input-date__input{background-color:transparent;border:1px solid #979797;border-radius:4px;color:var(--spx-input--color, rgba(0, 0, 0, .9));box-sizing:border-box;font-size:16px;margin-right:10px;padding:6px;text-align:center;width:100%}.spx-input-date__input:active{transform:scale(.95)}.spx-input-date__input:focus{border:var(--spx-input-box--focus--border, 1px solid rgb(115, 168, 210));border-radius:4px;outline:none}.spx-input-date__control-label{align-items:center;color:#000000b3;display:inline-grid;font-size:13px;letter-spacing:1px}.spx-input-date__input::-webkit-outer-spin-button,.spx-input-date__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.spx-input-date__input[type=number]{-moz-appearance:textfield}.spx-input-date__suggestions,.spx-input-date__controls{display:grid;grid-gap:8px;grid-template-columns:repeat(4,1fr);margin-top:8px}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxFocused", "spxSelected", "spxTabbable"] }] }); }
|
|
597
704
|
}
|
|
598
705
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputDateComponent, decorators: [{
|
|
599
706
|
type: Component,
|
|
@@ -911,51 +1018,111 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
911
1018
|
|
|
912
1019
|
class SpxInputRadioComponent {
|
|
913
1020
|
constructor() {
|
|
914
|
-
this.
|
|
1021
|
+
this.focusPosition = 0;
|
|
1022
|
+
this.spxFocused = false;
|
|
1023
|
+
this.spxShowLabel = true;
|
|
915
1024
|
this.spxReadonly = false;
|
|
916
1025
|
this.spxSuggestions = [];
|
|
917
1026
|
this.spxChange = new EventEmitter();
|
|
918
1027
|
this.spxFocus = new EventEmitter();
|
|
919
|
-
this.spxWasInternalUpdate = false;
|
|
920
1028
|
}
|
|
921
|
-
|
|
922
|
-
|
|
1029
|
+
spxFocusIn() {
|
|
1030
|
+
this.listenToKeys();
|
|
1031
|
+
this.determineFocusPosition();
|
|
923
1032
|
}
|
|
924
|
-
|
|
925
|
-
this.
|
|
926
|
-
this.
|
|
1033
|
+
spxFocusOut() {
|
|
1034
|
+
this.subscriptionKeyDown?.unsubscribe();
|
|
1035
|
+
this.subscriptionKeyUp?.unsubscribe();
|
|
1036
|
+
}
|
|
1037
|
+
ngOnChanges(changes) {
|
|
1038
|
+
if ((changes['spxSuggestions'] && changes['spxSuggestions'].previousValue !== changes['spxSuggestions'].currentValue) ||
|
|
1039
|
+
(changes['value'] && changes['value'].previousValue !== changes['value'].currentValue)) {
|
|
1040
|
+
this.determineFocusPosition();
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
handleSuggestionClick(valuePair) {
|
|
1044
|
+
this.select(valuePair);
|
|
1045
|
+
}
|
|
1046
|
+
determineFocusPosition() {
|
|
1047
|
+
if (this.value && this.spxSuggestions?.length) {
|
|
1048
|
+
const index = this.spxSuggestions.findIndex(valuePair => valuePairToValue(valuePair) === valuePairToValue(this.value));
|
|
1049
|
+
this.focusPosition = index >= 0 ? index : 0;
|
|
1050
|
+
}
|
|
1051
|
+
else {
|
|
1052
|
+
this.focusPosition = 0;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
select(valuePair) {
|
|
1056
|
+
this.focusPosition = 0;
|
|
1057
|
+
this.value = valuePair;
|
|
1058
|
+
this.spxChange.emit(valuePair);
|
|
1059
|
+
}
|
|
1060
|
+
listenToKeys() {
|
|
1061
|
+
this.subscriptionKeyUp = fromEvent(window, 'keyup').subscribe((event) => {
|
|
1062
|
+
if ((event.key === 'ArrowUp' || event.key === 'ArrowLeft') && this.focusPosition > 0) {
|
|
1063
|
+
this.focusPosition = this.focusPosition - 1;
|
|
1064
|
+
this.select(this.spxSuggestions.at(this.focusPosition));
|
|
1065
|
+
event.preventDefault();
|
|
1066
|
+
}
|
|
1067
|
+
if ((event.key === 'ArrowDown' || event.key === 'ArrowRight') && this.focusPosition < this.spxSuggestions.length - 1) {
|
|
1068
|
+
this.focusPosition = this.focusPosition + 1;
|
|
1069
|
+
this.select(this.spxSuggestions.at(this.focusPosition));
|
|
1070
|
+
event.preventDefault();
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
this.subscriptionKeyDown = fromEvent(window, 'keydown').subscribe((event) => {
|
|
1074
|
+
if (event.key === 'ArrowDown' ||
|
|
1075
|
+
event.key === 'ArrowLeft' ||
|
|
1076
|
+
event.key === 'ArrowRight' ||
|
|
1077
|
+
event.key === 'ArrowUp') {
|
|
1078
|
+
event.preventDefault();
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
927
1081
|
}
|
|
928
1082
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
929
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputRadioComponent, isStandalone: true, selector: "spx-input-radio", inputs: { spxName: "spxName", spxValidators: "spxValidators", spxFocused: "spxFocused", spxReadonly: "spxReadonly", spxSuggestions: "spxSuggestions", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, ngImport: i0, template: `<div class="
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
1083
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputRadioComponent, isStandalone: true, selector: "spx-input-radio", inputs: { spxName: "spxName", spxValidators: "spxValidators", spxFocused: "spxFocused", spxShowLabel: "spxShowLabel", spxReadonly: "spxReadonly", spxSuggestions: "spxSuggestions", value: "value" }, outputs: { spxChange: "spxChange", spxFocus: "spxFocus" }, usesOnChanges: true, ngImport: i0, template: `<div class="grid grid-cols-2 gap-2"
|
|
1084
|
+
[class.mt-3]="this.spxShowLabel">
|
|
1085
|
+
<spx-suggestion
|
|
1086
|
+
*ngFor="let valuePair of this.spxSuggestions; let i = index"
|
|
1087
|
+
[spxDisabled]="this.spxReadonly"
|
|
1088
|
+
[spxFocused]="this.spxFocused && i === this.focusPosition"
|
|
1089
|
+
[spxSelected]="this.value?.value === this.valuePair?.value"
|
|
1090
|
+
[spxTabbable]="this.focusPosition === i"
|
|
1091
|
+
(click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
|
|
1092
|
+
{{this.valuePair?.description}}
|
|
1093
|
+
</spx-suggestion>
|
|
1094
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: SpxSuggestionComponent, selector: "spx-suggestion", inputs: ["spxDisabled", "spxFocused", "spxSelected", "spxTabbable"] }] }); }
|
|
938
1095
|
}
|
|
939
1096
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputRadioComponent, decorators: [{
|
|
940
1097
|
type: Component,
|
|
941
|
-
args: [{
|
|
1098
|
+
args: [{
|
|
1099
|
+
selector: 'spx-input-radio',
|
|
1100
|
+
standalone: true,
|
|
1101
|
+
imports: [
|
|
942
1102
|
NgFor,
|
|
943
1103
|
SpxSuggestionComponent,
|
|
944
|
-
],
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1104
|
+
],
|
|
1105
|
+
template: `<div class="grid grid-cols-2 gap-2"
|
|
1106
|
+
[class.mt-3]="this.spxShowLabel">
|
|
1107
|
+
<spx-suggestion
|
|
1108
|
+
*ngFor="let valuePair of this.spxSuggestions; let i = index"
|
|
1109
|
+
[spxDisabled]="this.spxReadonly"
|
|
1110
|
+
[spxFocused]="this.spxFocused && i === this.focusPosition"
|
|
1111
|
+
[spxSelected]="this.value?.value === this.valuePair?.value"
|
|
1112
|
+
[spxTabbable]="this.focusPosition === i"
|
|
1113
|
+
(click)="this.spxReadonly ? undefined : this.handleSuggestionClick(valuePair)">
|
|
1114
|
+
{{this.valuePair?.description}}
|
|
1115
|
+
</spx-suggestion>
|
|
1116
|
+
</div>`,
|
|
1117
|
+
}]
|
|
953
1118
|
}], propDecorators: { spxName: [{
|
|
954
1119
|
type: Input
|
|
955
1120
|
}], spxValidators: [{
|
|
956
1121
|
type: Input
|
|
957
1122
|
}], spxFocused: [{
|
|
958
1123
|
type: Input
|
|
1124
|
+
}], spxShowLabel: [{
|
|
1125
|
+
type: Input
|
|
959
1126
|
}], spxReadonly: [{
|
|
960
1127
|
type: Input
|
|
961
1128
|
}], spxSuggestions: [{
|
|
@@ -979,6 +1146,7 @@ var SpxInputTypeEnum;
|
|
|
979
1146
|
SpxInputTypeEnum["number"] = "number";
|
|
980
1147
|
SpxInputTypeEnum["password"] = "password";
|
|
981
1148
|
SpxInputTypeEnum["text"] = "text";
|
|
1149
|
+
SpxInputTypeEnum["textNumericKeyboard"] = "textNumericKeyboard";
|
|
982
1150
|
})(SpxInputTypeEnum || (SpxInputTypeEnum = {}));
|
|
983
1151
|
|
|
984
1152
|
class SpxInputComponent {
|
|
@@ -991,6 +1159,7 @@ class SpxInputComponent {
|
|
|
991
1159
|
this.spxSelectDay = true;
|
|
992
1160
|
this.spxShowEdit = false;
|
|
993
1161
|
this.spxShowHelp = false;
|
|
1162
|
+
this.spxShowLabel = true;
|
|
994
1163
|
this.spxCompact = false;
|
|
995
1164
|
this.spxShowClear = true;
|
|
996
1165
|
this.spxShowSearch = false;
|
|
@@ -1009,9 +1178,6 @@ class SpxInputComponent {
|
|
|
1009
1178
|
this.onChange = () => { };
|
|
1010
1179
|
this.onTouched = () => { };
|
|
1011
1180
|
}
|
|
1012
|
-
async spxSetFocus() {
|
|
1013
|
-
this.passFocusToControl();
|
|
1014
|
-
}
|
|
1015
1181
|
handleBlur() {
|
|
1016
1182
|
this.spxBlur.emit();
|
|
1017
1183
|
}
|
|
@@ -1032,17 +1198,19 @@ class SpxInputComponent {
|
|
|
1032
1198
|
handleFocus() {
|
|
1033
1199
|
this.spxFocus.emit();
|
|
1034
1200
|
this.spxFocused = true;
|
|
1035
|
-
// this.elBox.spxSetFocus();
|
|
1036
1201
|
}
|
|
1037
1202
|
handleSearch() {
|
|
1038
1203
|
this.spxSearch.emit();
|
|
1039
1204
|
}
|
|
1040
|
-
|
|
1205
|
+
setFocusIn() {
|
|
1041
1206
|
this.spxFocused = true;
|
|
1042
1207
|
this.passFocusToControl();
|
|
1043
1208
|
}
|
|
1044
1209
|
setFocusOut() {
|
|
1045
1210
|
this.spxFocused = false;
|
|
1211
|
+
if (this.spxType === SpxInputTypeEnum.radio) {
|
|
1212
|
+
this.radioInput?.spxFocusOut();
|
|
1213
|
+
}
|
|
1046
1214
|
}
|
|
1047
1215
|
handleEdit() {
|
|
1048
1216
|
this.spxEdit.emit();
|
|
@@ -1053,9 +1221,19 @@ class SpxInputComponent {
|
|
|
1053
1221
|
this.spxFocused = true;
|
|
1054
1222
|
}
|
|
1055
1223
|
passFocusToControl() {
|
|
1224
|
+
switch (this.spxType) {
|
|
1225
|
+
case SpxInputTypeEnum.autocomplete:
|
|
1226
|
+
case SpxInputTypeEnum.text:
|
|
1227
|
+
case SpxInputTypeEnum.overlayNumber:
|
|
1228
|
+
this.textInput?.spxSetFocus();
|
|
1229
|
+
break;
|
|
1230
|
+
case SpxInputTypeEnum.radio:
|
|
1231
|
+
this.radioInput?.spxFocusIn();
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1056
1234
|
}
|
|
1057
1235
|
writeValue(value) {
|
|
1058
|
-
this.value = this.lastValue = value
|
|
1236
|
+
this.value = this.lastValue = value;
|
|
1059
1237
|
}
|
|
1060
1238
|
handleChangeEvent(value) {
|
|
1061
1239
|
if (value !== this.lastValue) {
|
|
@@ -1073,13 +1251,14 @@ class SpxInputComponent {
|
|
|
1073
1251
|
this.onTouched = fn;
|
|
1074
1252
|
}
|
|
1075
1253
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1076
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputComponent, isStandalone: true, selector: "spx-input", inputs: { spxLabel: "spxLabel", spxMax: "spxMax", spxMin: "spxMin", spxName: "spxName", spxReadonly: "spxReadonly", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxRequired: "spxRequired", spxSelectMonth: "spxSelectMonth", spxSelectDay: "spxSelectDay", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxStep: "spxStep", spxSuggestions: "spxSuggestions", spxType: "spxType", spxValidators: "spxValidators", value: "value", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused" }, outputs: { spxBlur: "spxBlur", spxClear: "spxClear", spxChange: "spxChange", spxFocus: "spxFocus", spxEdit: "spxEdit", spxHelp: "spxHelp", spxSearch: "spxSearch" }, host: { listeners: { "spxChange": "handleChangeEvent($event)", "focusout": "_handleBlurEvent()" } }, providers: [
|
|
1254
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", type: SpxInputComponent, isStandalone: true, selector: "spx-input", inputs: { spxLabel: "spxLabel", spxMax: "spxMax", spxMin: "spxMin", spxName: "spxName", spxReadonly: "spxReadonly", spxAutofocus: "spxAutofocus", spxInputMode: "spxInputMode", spxPattern: "spxPattern", spxRequired: "spxRequired", spxSelectMonth: "spxSelectMonth", spxSelectDay: "spxSelectDay", spxShowEdit: "spxShowEdit", spxShowHelp: "spxShowHelp", spxShowLabel: "spxShowLabel", spxCompact: "spxCompact", spxShowClear: "spxShowClear", spxShowSearch: "spxShowSearch", spxShowValidationMessages: "spxShowValidationMessages", spxStep: "spxStep", spxSuggestions: "spxSuggestions", spxType: "spxType", spxValidators: "spxValidators", value: "value", spxCapitalize: "spxCapitalize", spxFocused: "spxFocused" }, outputs: { spxBlur: "spxBlur", spxClear: "spxClear", spxChange: "spxChange", spxFocus: "spxFocus", spxEdit: "spxEdit", spxHelp: "spxHelp", spxSearch: "spxSearch" }, host: { listeners: { "spxChange": "handleChangeEvent($event)", "focusout": "_handleBlurEvent()" } }, providers: [
|
|
1077
1255
|
{
|
|
1078
1256
|
provide: NG_VALUE_ACCESSOR,
|
|
1079
1257
|
useExisting: SpxInputComponent,
|
|
1080
1258
|
multi: true
|
|
1081
1259
|
}
|
|
1082
|
-
], ngImport: i0, template: `<spx-input-box
|
|
1260
|
+
], viewQueries: [{ propertyName: "textInput", first: true, predicate: SpxInputTextComponent, descendants: true }, { propertyName: "radioInput", first: true, predicate: SpxInputRadioComponent, descendants: true }], ngImport: i0, template: `<spx-input-box
|
|
1261
|
+
[spxFocused]="this.spxFocused"
|
|
1083
1262
|
[spxLabel]="this.spxLabel"
|
|
1084
1263
|
[spxReadonly]="this.spxReadonly"
|
|
1085
1264
|
[spxRequired]="this.spxRequired"
|
|
@@ -1088,12 +1267,13 @@ class SpxInputComponent {
|
|
|
1088
1267
|
[spxCompact]="this.spxCompact"
|
|
1089
1268
|
[spxShowClear]="this.spxShowClear"
|
|
1090
1269
|
[spxShowEdit]="this.spxShowEdit"
|
|
1270
|
+
[spxShowLabel]="this.spxShowLabel"
|
|
1091
1271
|
[spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
|
|
1092
1272
|
[spxShowValidationMessages]="this.spxShowValidationMessages"
|
|
1093
1273
|
(spxClear)="this.handleClear()"
|
|
1094
1274
|
(spxEdit)="this.handleEdit()"
|
|
1095
1275
|
(spxHelp)="this.handleHelp()"
|
|
1096
|
-
(spxFocus)="this.
|
|
1276
|
+
(spxFocus)="this.setFocusIn()"
|
|
1097
1277
|
(spxFocusOut)="this.setFocusOut()"
|
|
1098
1278
|
(spxSearch)="this.handleSearch()">
|
|
1099
1279
|
<div controls>
|
|
@@ -1154,12 +1334,14 @@ class SpxInputComponent {
|
|
|
1154
1334
|
[value]="this.value"
|
|
1155
1335
|
></spx-input-number>
|
|
1156
1336
|
<spx-input-radio
|
|
1337
|
+
#radioInput
|
|
1157
1338
|
*ngIf="this.spxType === 'radio'"
|
|
1158
1339
|
(spxChange)="this.handleChange($event)"
|
|
1159
1340
|
(spxFocus)="this.handleFocus()"
|
|
1160
1341
|
[spxFocused]="this.spxFocused"
|
|
1161
1342
|
[spxName]="this.spxName"
|
|
1162
1343
|
[spxReadonly]="this.spxReadonly"
|
|
1344
|
+
[spxShowLabel]="this.spxShowLabel"
|
|
1163
1345
|
[spxSuggestions]="this.spxSuggestions"
|
|
1164
1346
|
[spxValidators]="this.spxValidators"
|
|
1165
1347
|
[value]="this.value"
|
|
@@ -1168,7 +1350,7 @@ class SpxInputComponent {
|
|
|
1168
1350
|
<div validation-messages>
|
|
1169
1351
|
<ng-content></ng-content>
|
|
1170
1352
|
</div>
|
|
1171
|
-
</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: ["
|
|
1353
|
+
</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: ["spxCompact", "spxFocused", "spxLabel", "spxReadonly", "spxRequired", "spxShowClear", "spxShowEdit", "spxShowHelp", "spxShowLabel", "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", "spxShowLabel", "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"] }] }); }
|
|
1172
1354
|
}
|
|
1173
1355
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: SpxInputComponent, decorators: [{
|
|
1174
1356
|
type: Component,
|
|
@@ -1195,6 +1377,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1195
1377
|
}
|
|
1196
1378
|
],
|
|
1197
1379
|
template: `<spx-input-box
|
|
1380
|
+
[spxFocused]="this.spxFocused"
|
|
1198
1381
|
[spxLabel]="this.spxLabel"
|
|
1199
1382
|
[spxReadonly]="this.spxReadonly"
|
|
1200
1383
|
[spxRequired]="this.spxRequired"
|
|
@@ -1203,12 +1386,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1203
1386
|
[spxCompact]="this.spxCompact"
|
|
1204
1387
|
[spxShowClear]="this.spxShowClear"
|
|
1205
1388
|
[spxShowEdit]="this.spxShowEdit"
|
|
1389
|
+
[spxShowLabel]="this.spxShowLabel"
|
|
1206
1390
|
[spxShowSearch]="this.spxShowSearch ? this.spxShowSearch : this.spxType === 'autocomplete'"
|
|
1207
1391
|
[spxShowValidationMessages]="this.spxShowValidationMessages"
|
|
1208
1392
|
(spxClear)="this.handleClear()"
|
|
1209
1393
|
(spxEdit)="this.handleEdit()"
|
|
1210
1394
|
(spxHelp)="this.handleHelp()"
|
|
1211
|
-
(spxFocus)="this.
|
|
1395
|
+
(spxFocus)="this.setFocusIn()"
|
|
1212
1396
|
(spxFocusOut)="this.setFocusOut()"
|
|
1213
1397
|
(spxSearch)="this.handleSearch()">
|
|
1214
1398
|
<div controls>
|
|
@@ -1269,12 +1453,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1269
1453
|
[value]="this.value"
|
|
1270
1454
|
></spx-input-number>
|
|
1271
1455
|
<spx-input-radio
|
|
1456
|
+
#radioInput
|
|
1272
1457
|
*ngIf="this.spxType === 'radio'"
|
|
1273
1458
|
(spxChange)="this.handleChange($event)"
|
|
1274
1459
|
(spxFocus)="this.handleFocus()"
|
|
1275
1460
|
[spxFocused]="this.spxFocused"
|
|
1276
1461
|
[spxName]="this.spxName"
|
|
1277
1462
|
[spxReadonly]="this.spxReadonly"
|
|
1463
|
+
[spxShowLabel]="this.spxShowLabel"
|
|
1278
1464
|
[spxSuggestions]="this.spxSuggestions"
|
|
1279
1465
|
[spxValidators]="this.spxValidators"
|
|
1280
1466
|
[value]="this.value"
|
|
@@ -1311,6 +1497,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1311
1497
|
type: Input
|
|
1312
1498
|
}], spxShowHelp: [{
|
|
1313
1499
|
type: Input
|
|
1500
|
+
}], spxShowLabel: [{
|
|
1501
|
+
type: Input
|
|
1314
1502
|
}], spxCompact: [{
|
|
1315
1503
|
type: Input
|
|
1316
1504
|
}], spxShowClear: [{
|
|
@@ -1345,6 +1533,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImpor
|
|
|
1345
1533
|
type: Output
|
|
1346
1534
|
}], spxSearch: [{
|
|
1347
1535
|
type: Output
|
|
1536
|
+
}], textInput: [{
|
|
1537
|
+
type: ViewChild,
|
|
1538
|
+
args: [SpxInputTextComponent]
|
|
1539
|
+
}], radioInput: [{
|
|
1540
|
+
type: ViewChild,
|
|
1541
|
+
args: [SpxInputRadioComponent]
|
|
1348
1542
|
}], spxFocused: [{
|
|
1349
1543
|
type: Input
|
|
1350
1544
|
}], _handleBlurEvent: [{
|