Skip to content

Commit 7bcdba0

Browse files
authored
Merge pull request #635 from bettercodepaul/feature/touch-optimization
refactor(schusszettel): unify numeric input flow and adjust auto-focu…
2 parents 18aec17 + cad5722 commit 7bcdba0

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

bogenliga/src/app/modules/schusszettel/components/maske2eingabe/passe-eingabe.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ <h2>Passe {{ currentPasse }}</h2>
4242
<input
4343
#inputField
4444
id="schuss1-{{ i }}"
45-
type="number"
45+
type="text"
4646
inputmode="numeric"
47+
pattern="[0-9]*"
48+
maxlength="2"
4749
formControlName="schuss1"
4850
min="0"
4951
max="10"

bogenliga/src/app/modules/schusszettel/components/maske2eingabe/passe-eingabe.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,8 @@ form { width: 100%; max-width: 800px;}
192192
.cdk-drop-list-dragging .draggable-row:not(.cdk-drag-placeholder) {
193193
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
194194
}
195+
196+
input::-webkit-outer-spin-button {
197+
appearance: none;
198+
}
199+

bogenliga/src/app/modules/schusszettel/components/maske2eingabe/passe-eingabe.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class PasseEingabeComponent implements OnInit, OnDestroy {
2828
form!: FormGroup;
2929
activeRow = -1;
3030
private destroy$ = new Subject<void>();
31+
private readonly autoFocusDelayMs = 2000;
3132
timeoutId: any = null;
3233

3334
orderedShooters: SchuetzeStammdatenDTO[] = [];
@@ -117,8 +118,8 @@ export class PasseEingabeComponent implements OnInit, OnDestroy {
117118
const groups = this.orderedShooters.map((schuetze, index) => {
118119
console.log(`Creating form group ${index} for shooter ${schuetze.schuetzenId}`);
119120
return this.fb.group({
120-
schuss1: [null, [Validators.required, Validators.min(0), Validators.max(10)]],
121-
schuss2: [null, [Validators.required, Validators.min(0), Validators.max(10)]],
121+
schuss1: [null, [Validators.required, Validators.pattern(/^(10|[0-9])$/)]],
122+
schuss2: [null, [Validators.required, Validators.pattern(/^(10|[0-9])$/)]],
122123
});
123124
});
124125

@@ -193,8 +194,8 @@ export class PasseEingabeComponent implements OnInit, OnDestroy {
193194
const grp = this.schuesse.at(i) as FormGroup;
194195
return {
195196
schuetzenId: s.schuetzenId,
196-
schuss1: grp.value.schuss1,
197-
schuss2: grp.value.schuss2,
197+
schuss1: parseInt(grp.value.schuss1, 10),
198+
schuss2: parseInt(grp.value.schuss2, 10),
198199
// No schuss3 - only 2 arrows per shooter to match backend ARROWS_PER_SHOOTER = 2
199200
};
200201
});
@@ -224,7 +225,7 @@ export class PasseEingabeComponent implements OnInit, OnDestroy {
224225
} else {
225226
console.warn('Ungültiger Wert – kein automatischer Wechsel:', value);
226227
}
227-
}, 700);
228+
}, this.autoFocusDelayMs);
228229
}
229230

230231
focusNextField(i: number, field: 'schuss1' | 'schuss2') {

0 commit comments

Comments
 (0)