i-tech-shared-components 1.4.72 → 1.4.73-alpha.1775088018357
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.
|
@@ -3048,9 +3048,13 @@ class TimeInputComponent {
|
|
|
3048
3048
|
setTimeout(() => this.timeFieldEl?.nativeElement.focus());
|
|
3049
3049
|
}
|
|
3050
3050
|
deactivate() {
|
|
3051
|
+
if (this.mode === '12h') {
|
|
3052
|
+
this.convertIfOver12Hours();
|
|
3053
|
+
}
|
|
3051
3054
|
this.activeSegment = null;
|
|
3052
3055
|
this.hourBuffer = '';
|
|
3053
3056
|
this.minuteBuffer = '';
|
|
3057
|
+
this.emitControlValue();
|
|
3054
3058
|
}
|
|
3055
3059
|
onKeyDown(event) {
|
|
3056
3060
|
if (this.activeSegment === null)
|
|
@@ -3086,14 +3090,14 @@ class TimeInputComponent {
|
|
|
3086
3090
|
const digit = parseInt(key, 10);
|
|
3087
3091
|
this.hourBuffer += key;
|
|
3088
3092
|
if (this.mode === '12h') {
|
|
3089
|
-
if (this.hourBuffer.length === 1 && digit >=
|
|
3093
|
+
if (this.hourBuffer.length === 1 && digit >= 3 && digit <= 9) {
|
|
3090
3094
|
this.hours = '0' + key;
|
|
3091
3095
|
this.hourBuffer = '';
|
|
3092
3096
|
this.activeSegment = 'minutes';
|
|
3093
3097
|
}
|
|
3094
3098
|
else if (this.hourBuffer.length === 2) {
|
|
3095
3099
|
const num = parseInt(this.hourBuffer, 10);
|
|
3096
|
-
if (num >= 1 && num <=
|
|
3100
|
+
if (num >= 1 && num <= 23) {
|
|
3097
3101
|
this.hours = this.hourBuffer;
|
|
3098
3102
|
}
|
|
3099
3103
|
else {
|
|
@@ -3187,8 +3191,10 @@ class TimeInputComponent {
|
|
|
3187
3191
|
if (this.minuteBuffer.length === 1 && digit >= 6) {
|
|
3188
3192
|
this.minutes = '0' + key;
|
|
3189
3193
|
this.minuteBuffer = '';
|
|
3190
|
-
if (this.mode === '12h')
|
|
3194
|
+
if (this.mode === '12h') {
|
|
3195
|
+
this.convertIfOver12Hours();
|
|
3191
3196
|
this.activeSegment = 'ampm';
|
|
3197
|
+
}
|
|
3192
3198
|
else
|
|
3193
3199
|
this.deactivate();
|
|
3194
3200
|
}
|
|
@@ -3201,8 +3207,10 @@ class TimeInputComponent {
|
|
|
3201
3207
|
this.minutes = '0' + this.minuteBuffer[1];
|
|
3202
3208
|
}
|
|
3203
3209
|
this.minuteBuffer = '';
|
|
3204
|
-
if (this.mode === '12h')
|
|
3210
|
+
if (this.mode === '12h') {
|
|
3211
|
+
this.convertIfOver12Hours();
|
|
3205
3212
|
this.activeSegment = 'ampm';
|
|
3213
|
+
}
|
|
3206
3214
|
else
|
|
3207
3215
|
this.deactivate();
|
|
3208
3216
|
}
|
|
@@ -3211,6 +3219,15 @@ class TimeInputComponent {
|
|
|
3211
3219
|
}
|
|
3212
3220
|
this.emitControlValue();
|
|
3213
3221
|
}
|
|
3222
|
+
convertIfOver12Hours() {
|
|
3223
|
+
if (this.hours === '--')
|
|
3224
|
+
return;
|
|
3225
|
+
const h = parseInt(this.hours, 10);
|
|
3226
|
+
if (h > 12) {
|
|
3227
|
+
this.hours = String(h - 12).padStart(2, '0');
|
|
3228
|
+
this.amPm = 'PM';
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3214
3231
|
adjustMinutes(delta) {
|
|
3215
3232
|
const current = this.minutes === '--' ? 0 : parseInt(this.minutes, 10);
|
|
3216
3233
|
let next = current + delta;
|