@progress/kendo-angular-dateinputs 19.3.0-develop.8 → 19.3.0
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/calendar/multiview-calendar.component.d.ts +4 -5
- package/calendar/services/navigation.service.d.ts +1 -2
- package/common/utils.d.ts +1 -11
- package/dateinput/dateinput.component.d.ts +0 -1
- package/datepicker/datepicker.component.d.ts +0 -1
- package/daterange/date-range-popup.component.d.ts +3 -4
- package/esm2022/calendar/calendar.component.mjs +7 -6
- package/esm2022/calendar/multiview-calendar.component.mjs +10 -9
- package/esm2022/calendar/services/navigation.service.mjs +14 -11
- package/esm2022/common/utils.mjs +5 -12
- package/esm2022/dateinput/dateinput.component.mjs +4 -5
- package/esm2022/datepicker/datepicker.component.mjs +8 -8
- package/esm2022/daterange/date-range-input.mjs +7 -5
- package/esm2022/daterange/date-range-popup.component.mjs +4 -3
- package/esm2022/daterange/date-range.component.mjs +4 -3
- package/esm2022/datetimepicker/datetimepicker.component.mjs +6 -5
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/timepicker/services/dom.service.mjs +39 -13
- package/esm2022/timepicker/timelist.component.mjs +9 -8
- package/esm2022/timepicker/timepicker.component.mjs +7 -6
- package/esm2022/timepicker/timeselector.component.mjs +10 -9
- package/fesm2022/progress-kendo-angular-dateinputs.mjs +131 -102
- package/index.d.ts +2 -0
- package/package.json +13 -13
- package/timepicker/services/dom.service.d.ts +1 -0
- package/calendar/models/keydown.interface.d.ts +0 -37
- package/esm2022/calendar/models/keydown.interface.mjs +0 -5
|
@@ -7,7 +7,7 @@ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
|
|
|
7
7
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { PopupService } from '@progress/kendo-angular-popup';
|
|
9
9
|
import { cloneDate, isEqual } from '@progress/kendo-date-math';
|
|
10
|
-
import { hasObservers, isControlRequired, KendoInput, Keys, MultiTabStop, ResizeSensorComponent, EventsOutsideAngularDirective } from '@progress/kendo-angular-common';
|
|
10
|
+
import { hasObservers, isControlRequired, KendoInput, Keys, MultiTabStop, ResizeSensorComponent, EventsOutsideAngularDirective, normalizeNumpadKeys } from '@progress/kendo-angular-common';
|
|
11
11
|
import { AdaptiveService } from '@progress/kendo-angular-utils';
|
|
12
12
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
13
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -136,7 +136,7 @@ export class TimePickerComponent extends MultiTabStop {
|
|
|
136
136
|
* [placeholders]({% slug placeholders_timepicker %}).
|
|
137
137
|
* @default null
|
|
138
138
|
*/
|
|
139
|
-
placeholder
|
|
139
|
+
placeholder;
|
|
140
140
|
/**
|
|
141
141
|
* Specifies the smallest valid time value
|
|
142
142
|
* ([see example]({% slug timeranges_timepicker %})).
|
|
@@ -551,8 +551,9 @@ export class TimePickerComponent extends MultiTabStop {
|
|
|
551
551
|
* @hidden
|
|
552
552
|
*/
|
|
553
553
|
handleKeydown(event) {
|
|
554
|
-
const { altKey
|
|
555
|
-
|
|
554
|
+
const { altKey } = event;
|
|
555
|
+
const code = normalizeNumpadKeys(event);
|
|
556
|
+
if (code === Keys.Escape) {
|
|
556
557
|
this.focusInput();
|
|
557
558
|
this.show = false;
|
|
558
559
|
hasObservers(this.escape) && this.escape.emit();
|
|
@@ -560,13 +561,13 @@ export class TimePickerComponent extends MultiTabStop {
|
|
|
560
561
|
return;
|
|
561
562
|
}
|
|
562
563
|
if (altKey) {
|
|
563
|
-
if (
|
|
564
|
+
if (code === Keys.ArrowUp) {
|
|
564
565
|
event.preventDefault();
|
|
565
566
|
this.focusInput();
|
|
566
567
|
this.show = false;
|
|
567
568
|
this.cdr.detectChanges();
|
|
568
569
|
}
|
|
569
|
-
if (
|
|
570
|
+
if (code === Keys.ArrowDown && !this.show) {
|
|
570
571
|
event.preventDefault();
|
|
571
572
|
this.show = true;
|
|
572
573
|
}
|
|
@@ -6,7 +6,7 @@ import { Component, ChangeDetectorRef, ChangeDetectionStrategy, ElementRef, Even
|
|
|
6
6
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
7
|
import { IntlService } from '@progress/kendo-angular-intl';
|
|
8
8
|
import { cloneDate, getDate } from '@progress/kendo-date-math';
|
|
9
|
-
import { Keys, EventsOutsideAngularDirective } from '@progress/kendo-angular-common';
|
|
9
|
+
import { Keys, EventsOutsideAngularDirective, normalizeNumpadKeys } from '@progress/kendo-angular-common';
|
|
10
10
|
import { MIDNIGHT_DATE, MIN_TIME, MAX_TIME } from '../defaults';
|
|
11
11
|
import { TimeListComponent } from './timelist.component';
|
|
12
12
|
import { TimePickerDOMService } from './services/dom.service';
|
|
@@ -300,8 +300,8 @@ export class TimeSelectorComponent {
|
|
|
300
300
|
* @hidden
|
|
301
301
|
*/
|
|
302
302
|
handleTabOut(event) {
|
|
303
|
-
const {
|
|
304
|
-
if (event.target === this.now?.nativeElement &&
|
|
303
|
+
const { code, shiftKey } = event;
|
|
304
|
+
if (event.target === this.now?.nativeElement && code === Keys.Tab && shiftKey) {
|
|
305
305
|
event.preventDefault();
|
|
306
306
|
if (this.isDateTimePicker) {
|
|
307
307
|
this.tabOutNow.emit();
|
|
@@ -311,7 +311,7 @@ export class TimeSelectorComponent {
|
|
|
311
311
|
}
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
if (
|
|
314
|
+
if (code === Keys.Tab && !shiftKey && event.target !== this.now?.nativeElement) {
|
|
315
315
|
event.preventDefault();
|
|
316
316
|
if (document.activeElement === this.accept.nativeElement) {
|
|
317
317
|
if (this.cancel) {
|
|
@@ -377,17 +377,18 @@ export class TimeSelectorComponent {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
handleKeydown(args) {
|
|
380
|
-
const {
|
|
380
|
+
const { altKey } = args;
|
|
381
|
+
const code = normalizeNumpadKeys(args);
|
|
381
382
|
// reserve the alt + arrow key commands for the picker
|
|
382
|
-
const arrowKeyPressed = [Keys.ArrowLeft, Keys.ArrowRight].indexOf(
|
|
383
|
+
const arrowKeyPressed = [Keys.ArrowLeft, Keys.ArrowRight].indexOf(code) !== -1;
|
|
383
384
|
if (isPresent(this.pickerService) && arrowKeyPressed && altKey) {
|
|
384
385
|
return;
|
|
385
386
|
}
|
|
386
|
-
if (
|
|
387
|
+
if (code === Keys.Enter && !this.hasActiveButton()) {
|
|
387
388
|
this.handleAccept();
|
|
388
389
|
}
|
|
389
|
-
else if (
|
|
390
|
-
this.focusList(
|
|
390
|
+
else if (code === Keys.ArrowLeft || code === Keys.ArrowRight) {
|
|
391
|
+
this.focusList(code === Keys.ArrowLeft ? Direction.Left : Direction.Right);
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
emitBlur(args) {
|
|
@@ -9,7 +9,7 @@ import * as i1$1 from '@progress/kendo-angular-l10n';
|
|
|
9
9
|
import { ComponentMessages, LocalizationService, L10N_PREFIX, RTL } from '@progress/kendo-angular-l10n';
|
|
10
10
|
import { cloneDate, MS_PER_HOUR, MS_PER_MINUTE, addDays, getDate, isEqual, addDecades, addCenturies, firstDecadeOfCentury, lastDecadeOfCentury, lastYearOfDecade, firstYearOfDecade, createDate, lastMonthOfYear, lastDayOfMonth, durationInCenturies, addYears, durationInDecades, addWeeks, addMonths, firstDayOfMonth, dayOfWeek, durationInMonths, firstMonthOfYear, durationInYears, weekInYear } from '@progress/kendo-date-math';
|
|
11
11
|
import * as i19 from '@progress/kendo-angular-common';
|
|
12
|
-
import { isDocumentAvailable, EventsOutsideAngularDirective, guid,
|
|
12
|
+
import { normalizeNumpadKeys, Keys, isDocumentAvailable, EventsOutsideAngularDirective, guid, hasObservers, isObject, KendoInput, ResizeSensorComponent, isObjectPresent, removeHTMLAttributes, parseAttributes, anyChanged, isControlRequired, setHTMLAttributes, MultiTabStop, ToggleButtonTabStopDirective, ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
|
|
13
13
|
export { ToggleButtonTabStopDirective } from '@progress/kendo-angular-common';
|
|
14
14
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
15
15
|
import * as i1 from '@progress/kendo-angular-intl';
|
|
@@ -36,8 +36,8 @@ const packageMetadata = {
|
|
|
36
36
|
productName: 'Kendo UI for Angular',
|
|
37
37
|
productCode: 'KENDOUIANGULAR',
|
|
38
38
|
productCodes: ['KENDOUIANGULAR'],
|
|
39
|
-
publishDate:
|
|
40
|
-
version: '19.3.0
|
|
39
|
+
publishDate: 1755030481,
|
|
40
|
+
version: '19.3.0',
|
|
41
41
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -128,18 +128,10 @@ const isDateArray = (value) => Array.isArray(value) && value.length > 0 && value
|
|
|
128
128
|
/**
|
|
129
129
|
* @hidden
|
|
130
130
|
*/
|
|
131
|
-
const isArrowWithShiftPressed = (args) =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
*/
|
|
136
|
-
var Keys;
|
|
137
|
-
(function (Keys) {
|
|
138
|
-
Keys[Keys["ArrowDown"] = 40] = "ArrowDown";
|
|
139
|
-
Keys[Keys["ArrowLeft"] = 37] = "ArrowLeft";
|
|
140
|
-
Keys[Keys["ArrowRight"] = 39] = "ArrowRight";
|
|
141
|
-
Keys[Keys["ArrowUp"] = 38] = "ArrowUp";
|
|
142
|
-
})(Keys || (Keys = {}));
|
|
131
|
+
const isArrowWithShiftPressed = (args) => {
|
|
132
|
+
const code = normalizeNumpadKeys(args);
|
|
133
|
+
return args.shiftKey && (code === Keys.ArrowRight || code === Keys.ArrowLeft || code === Keys.ArrowDown || code === Keys.ArrowUp);
|
|
134
|
+
};
|
|
143
135
|
/**
|
|
144
136
|
* @hidden
|
|
145
137
|
*/
|
|
@@ -3352,16 +3344,16 @@ const disabledDatesRangeValidator = (isDateDisabled) => {
|
|
|
3352
3344
|
};
|
|
3353
3345
|
|
|
3354
3346
|
const KEY_TO_ACTION = {
|
|
3355
|
-
'
|
|
3356
|
-
'
|
|
3357
|
-
'
|
|
3358
|
-
'
|
|
3359
|
-
'
|
|
3360
|
-
'
|
|
3361
|
-
'
|
|
3362
|
-
'
|
|
3363
|
-
'meta+
|
|
3364
|
-
'meta+
|
|
3347
|
+
'PageUp': Action.PrevView,
|
|
3348
|
+
'PageDown': Action.NextView,
|
|
3349
|
+
'End': Action.LastInView,
|
|
3350
|
+
'Home': Action.FirstInView,
|
|
3351
|
+
'ArrowLeft': Action.Left,
|
|
3352
|
+
'ArrowUp': Action.Up,
|
|
3353
|
+
'ArrowRight': Action.Right,
|
|
3354
|
+
'ArrowDown': Action.Down,
|
|
3355
|
+
'meta+ArrowUp': Action.UpperView,
|
|
3356
|
+
'meta+ArrowDown': Action.LowerView
|
|
3365
3357
|
};
|
|
3366
3358
|
/**
|
|
3367
3359
|
* @hidden
|
|
@@ -3372,7 +3364,9 @@ class NavigationService {
|
|
|
3372
3364
|
this.bus = bus;
|
|
3373
3365
|
}
|
|
3374
3366
|
action(event) {
|
|
3375
|
-
|
|
3367
|
+
// on some keyboards arrow keys, PageUp/Down, and Home/End are mapped to Numpad keys
|
|
3368
|
+
const code = normalizeNumpadKeys(event);
|
|
3369
|
+
const action = `${event.ctrlKey || event.metaKey ? 'meta+' : ''}${code}`;
|
|
3376
3370
|
return KEY_TO_ACTION[action];
|
|
3377
3371
|
}
|
|
3378
3372
|
move(value, action, activeView) {
|
|
@@ -4269,16 +4263,17 @@ class MultiViewCalendarComponent {
|
|
|
4269
4263
|
* @hidden
|
|
4270
4264
|
*/
|
|
4271
4265
|
keydown(event) {
|
|
4272
|
-
const
|
|
4266
|
+
const code = normalizeNumpadKeys(event);
|
|
4267
|
+
const arrowUpOrDownKeyPressed = [Keys.ArrowUp, Keys.ArrowDown].indexOf(code) !== -1;
|
|
4273
4268
|
const ctrlKey = event.ctrlKey || event.metaKey;
|
|
4274
|
-
const onArrowRightAndControl =
|
|
4275
|
-
const onArrowLeftAndControl =
|
|
4276
|
-
const onTKeyPress =
|
|
4277
|
-
const onEnterKeyPress =
|
|
4278
|
-
const onArrowUpPress =
|
|
4269
|
+
const onArrowRightAndControl = code === Keys.ArrowRight && ctrlKey;
|
|
4270
|
+
const onArrowLeftAndControl = code === Keys.ArrowLeft && ctrlKey;
|
|
4271
|
+
const onTKeyPress = code === Keys.KeyT;
|
|
4272
|
+
const onEnterKeyPress = code === Keys.Enter;
|
|
4273
|
+
const onArrowUpPress = code === Keys.ArrowUp;
|
|
4279
4274
|
const altKey = event.altKey;
|
|
4280
|
-
const escKey =
|
|
4281
|
-
const tabKeyPress =
|
|
4275
|
+
const escKey = code === Keys.Escape;
|
|
4276
|
+
const tabKeyPress = code === Keys.Tab;
|
|
4282
4277
|
const shiftKeyPress = event.shiftKey;
|
|
4283
4278
|
if (onArrowRightAndControl) {
|
|
4284
4279
|
event.preventDefault();
|
|
@@ -7714,7 +7709,7 @@ class CalendarComponent {
|
|
|
7714
7709
|
*/
|
|
7715
7710
|
handleMultiViewCalendarKeydown(args) {
|
|
7716
7711
|
// Prevent form from submitting on enter if used in datepicker (classic view)
|
|
7717
|
-
if (isPresent(this.pickerService) && args.
|
|
7712
|
+
if (isPresent(this.pickerService) && (args.code === Keys.Enter || args.code === Keys.NumpadEnter)) {
|
|
7718
7713
|
args.preventDefault();
|
|
7719
7714
|
}
|
|
7720
7715
|
}
|
|
@@ -7795,7 +7790,8 @@ class CalendarComponent {
|
|
|
7795
7790
|
if (this.type === 'infinite') {
|
|
7796
7791
|
// reserve the alt + arrow key commands for the picker
|
|
7797
7792
|
const ctrlKey = args.ctrlKey || args.metaKey;
|
|
7798
|
-
const
|
|
7793
|
+
const code = normalizeNumpadKeys(args);
|
|
7794
|
+
const arrowKeyPressed = [Keys.ArrowUp, Keys.ArrowRight, Keys.ArrowDown, Keys.ArrowLeft].indexOf(code) !== -1;
|
|
7799
7795
|
const reserveKeyCommandsForPicker = isPresent(this.pickerService) && arrowKeyPressed && args.altKey;
|
|
7800
7796
|
if (reserveKeyCommandsForPicker) {
|
|
7801
7797
|
return;
|
|
@@ -7804,7 +7800,7 @@ class CalendarComponent {
|
|
|
7804
7800
|
args.preventDefault();
|
|
7805
7801
|
}
|
|
7806
7802
|
// Prevent form from submitting on enter if used in datepicker (infinite view)
|
|
7807
|
-
const preventSubmitInDatePicker = isPresent(this.pickerService) &&
|
|
7803
|
+
const preventSubmitInDatePicker = isPresent(this.pickerService) && code === Keys.Enter;
|
|
7808
7804
|
if (preventSubmitInDatePicker) {
|
|
7809
7805
|
args.preventDefault();
|
|
7810
7806
|
}
|
|
@@ -7814,7 +7810,7 @@ class CalendarComponent {
|
|
|
7814
7810
|
this.detectChanges();
|
|
7815
7811
|
args.preventDefault();
|
|
7816
7812
|
}
|
|
7817
|
-
if (
|
|
7813
|
+
if (code === Keys.Enter) {
|
|
7818
7814
|
this.selectionService.lastClicked = this.focusedDate;
|
|
7819
7815
|
if (this.selection !== 'range') {
|
|
7820
7816
|
this.performSelection(this.focusedDate, args);
|
|
@@ -7823,7 +7819,7 @@ class CalendarComponent {
|
|
|
7823
7819
|
this.performRangeSelection(this.focusedDate);
|
|
7824
7820
|
}
|
|
7825
7821
|
}
|
|
7826
|
-
if (
|
|
7822
|
+
if (code === Keys.KeyT) {
|
|
7827
7823
|
this.focusToday();
|
|
7828
7824
|
}
|
|
7829
7825
|
if (isArrowWithShiftPressed(args) && this.selection !== 'range') {
|
|
@@ -8640,9 +8636,8 @@ class DateInputComponent {
|
|
|
8640
8636
|
* Specifies the hint the DateInput displays when its value is `null`.
|
|
8641
8637
|
* For more information, refer to the article on
|
|
8642
8638
|
* [placeholders]({% slug placeholders_dateinput %}).
|
|
8643
|
-
* @default null
|
|
8644
8639
|
*/
|
|
8645
|
-
placeholder
|
|
8640
|
+
placeholder;
|
|
8646
8641
|
/**
|
|
8647
8642
|
* Configures the incremental steps of the DateInput.
|
|
8648
8643
|
* For more information, refer to the article on
|
|
@@ -9078,7 +9073,7 @@ class DateInputComponent {
|
|
|
9078
9073
|
this.control = formControl;
|
|
9079
9074
|
this.subs.add(this.formControl?.statusChanges.subscribe(() => this.setAriaInvalid()));
|
|
9080
9075
|
this.setAriaInvalid();
|
|
9081
|
-
this.subs.add(this.dateInput?.nativeElement
|
|
9076
|
+
this.subs.add(this.renderer.listen(this.dateInput?.nativeElement, 'keydown', this.handleKeyDown));
|
|
9082
9077
|
}
|
|
9083
9078
|
ngOnDestroy() {
|
|
9084
9079
|
this.subs.unsubscribe();
|
|
@@ -9352,7 +9347,7 @@ class DateInputComponent {
|
|
|
9352
9347
|
[tabindex]="tabindex"
|
|
9353
9348
|
[disabled]="disabled"
|
|
9354
9349
|
[readonly]="readonly"
|
|
9355
|
-
[placeholder]="placeholder"
|
|
9350
|
+
[attr.placeholder]="placeholder"
|
|
9356
9351
|
[attr.aria-expanded]="isPopupOpen"
|
|
9357
9352
|
[attr.aria-haspopup]="hasPopup"
|
|
9358
9353
|
[kendoEventsOutsideAngular]="{
|
|
@@ -9455,7 +9450,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
9455
9450
|
[tabindex]="tabindex"
|
|
9456
9451
|
[disabled]="disabled"
|
|
9457
9452
|
[readonly]="readonly"
|
|
9458
|
-
[placeholder]="placeholder"
|
|
9453
|
+
[attr.placeholder]="placeholder"
|
|
9459
9454
|
[attr.aria-expanded]="isPopupOpen"
|
|
9460
9455
|
[attr.aria-haspopup]="hasPopup"
|
|
9461
9456
|
[kendoEventsOutsideAngular]="{
|
|
@@ -10195,9 +10190,8 @@ class DatePickerComponent extends MultiTabStop {
|
|
|
10195
10190
|
/**
|
|
10196
10191
|
* Specifies the hint the DatePicker displays when its value is `null`.
|
|
10197
10192
|
* ([more information and exaples]({% slug placeholders_datepicker %})).
|
|
10198
|
-
* @default null
|
|
10199
10193
|
*/
|
|
10200
|
-
placeholder
|
|
10194
|
+
placeholder;
|
|
10201
10195
|
/**
|
|
10202
10196
|
* Sets the `tabindex` of the DatePicker.
|
|
10203
10197
|
* This property is used to set the order in which the DatePicker will receive focus when navigating through the page using the Tab key.
|
|
@@ -10720,22 +10714,23 @@ class DatePickerComponent extends MultiTabStop {
|
|
|
10720
10714
|
* @hidden
|
|
10721
10715
|
*/
|
|
10722
10716
|
handleKeydown(e) {
|
|
10723
|
-
const { altKey, shiftKey,
|
|
10724
|
-
|
|
10717
|
+
const { altKey, shiftKey, target } = e;
|
|
10718
|
+
const code = normalizeNumpadKeys(e);
|
|
10719
|
+
if (code === Keys.Escape) {
|
|
10725
10720
|
this.dateInput.focus();
|
|
10726
10721
|
this.show = false;
|
|
10727
10722
|
hasObservers(this.escape) && this.escape.emit();
|
|
10728
10723
|
}
|
|
10729
10724
|
if (altKey) {
|
|
10730
|
-
if (
|
|
10725
|
+
if (code === Keys.ArrowDown && !this.show) {
|
|
10731
10726
|
this.show = true;
|
|
10732
10727
|
}
|
|
10733
|
-
if (
|
|
10728
|
+
if (code === Keys.ArrowUp) {
|
|
10734
10729
|
this.dateInput.focus();
|
|
10735
10730
|
this.show = false;
|
|
10736
10731
|
}
|
|
10737
10732
|
}
|
|
10738
|
-
if (
|
|
10733
|
+
if (code === Keys.Tab && this.show && this.calendar.isActive && isTabExitingCalendar(this.calendarType, target, shiftKey)) {
|
|
10739
10734
|
this.dateInput.focus();
|
|
10740
10735
|
this.show = false;
|
|
10741
10736
|
}
|
|
@@ -11554,13 +11549,18 @@ const listTitle = () => span('hour', 'k-title k-timeselector-title');
|
|
|
11554
11549
|
const listItem = () => li('<span>02</span>', 'k-item');
|
|
11555
11550
|
const list = () => ul([listItem()], 'k-reset');
|
|
11556
11551
|
const scrollable = () => (div([list()], 'k-time-container k-flex k-content k-scrollable'));
|
|
11557
|
-
const actionSheetContent = (isDateTimePicker) =>
|
|
11552
|
+
const actionSheetContent = (isDateTimePicker) => [
|
|
11558
11553
|
isDateTimePicker ? div([div('button', 'k-button k-button-lg')], 'k-datetime-buttongroup') : null,
|
|
11559
11554
|
div([
|
|
11560
|
-
div([span('
|
|
11561
|
-
|
|
11562
|
-
|
|
11563
|
-
|
|
11555
|
+
div([span('04:08:48:49 AM', 'k-title k-timeselector-title'),
|
|
11556
|
+
div('now', 'k-button k-button-md')
|
|
11557
|
+
], 'k-time-header'),
|
|
11558
|
+
div([
|
|
11559
|
+
span('', 'k-time-highlight'),
|
|
11560
|
+
div([listTitle(), div([scrollable()], 'k-time-list')], 'k-time-list-wrapper'),
|
|
11561
|
+
], 'k-time-list-container'),
|
|
11562
|
+
], 'k-timeselector k-timeselector-lg'),
|
|
11563
|
+
];
|
|
11564
11564
|
const timeListWrapper = (isAdaptiveEnabled = false, windowSize, isDateTimePicker) => {
|
|
11565
11565
|
if (!isDocumentAvailable()) {
|
|
11566
11566
|
return null;
|
|
@@ -11568,13 +11568,24 @@ const timeListWrapper = (isAdaptiveEnabled = false, windowSize, isDateTimePicker
|
|
|
11568
11568
|
if (!isAdaptiveEnabled) {
|
|
11569
11569
|
return div([listTitle(), div([scrollable()], 'k-time-list')], 'k-time-list-wrapper', { left: '-10000px', position: 'absolute' });
|
|
11570
11570
|
}
|
|
11571
|
-
return div([
|
|
11571
|
+
return div([
|
|
11572
11572
|
div([
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11573
|
+
div([div([
|
|
11574
|
+
div([], 'k-actionsheet-title'),
|
|
11575
|
+
div([
|
|
11576
|
+
div([
|
|
11577
|
+
div([div('', 'k-i-check k-button-icon k-icon k-font-icon')], 'k-icon-wrapper-host'),
|
|
11578
|
+
], 'k-button k-icon-button k-button-lg'),
|
|
11579
|
+
], 'k-actionsheet-actions'),
|
|
11580
|
+
], 'k-actionsheet-titlebar-group')], 'k-actionsheet-titlebar'),
|
|
11581
|
+
div([
|
|
11582
|
+
isDateTimePicker
|
|
11583
|
+
? div([...actionSheetContent(isDateTimePicker)], 'k-datetime-wrap k-time-tab')
|
|
11584
|
+
: actionSheetContent(isDateTimePicker)[1],
|
|
11585
|
+
], 'k-actionsheet-content'),
|
|
11586
|
+
div([div('button', 'k-button k-button-lg')], 'k-actions k-actions-stretched k-actions-horizontal k-actionsheet-footer'),
|
|
11587
|
+
], 'k-actionsheet-view'),
|
|
11588
|
+
], `k-actionsheet k-adaptive-actionsheet ${windowSize === 'small' ? 'k-actionsheet-fullscreen' : ''}`, { height: windowSize === 'small' ? '100%' : '60vh', left: '-10000px', position: 'absolute', top: 0 });
|
|
11578
11589
|
};
|
|
11579
11590
|
/**
|
|
11580
11591
|
* @hidden
|
|
@@ -11597,6 +11608,9 @@ class TimePickerDOMService {
|
|
|
11597
11608
|
}
|
|
11598
11609
|
this.calculateHeights();
|
|
11599
11610
|
}
|
|
11611
|
+
sumCSSProperties(style, ...properties) {
|
|
11612
|
+
return properties.reduce((sum, property) => sum + parseFloat(style.getPropertyValue(property)), 0) || 0;
|
|
11613
|
+
}
|
|
11600
11614
|
calculateHeights(container) {
|
|
11601
11615
|
if (!isDocumentAvailable()) {
|
|
11602
11616
|
return;
|
|
@@ -11612,8 +11626,15 @@ class TimePickerDOMService {
|
|
|
11612
11626
|
hostContainer = document.body;
|
|
11613
11627
|
wrapper = hostContainer.appendChild(timeListWrapper(true, this.windowSize, this.isDateTimePicker));
|
|
11614
11628
|
}
|
|
11615
|
-
|
|
11616
|
-
|
|
11629
|
+
const itemStyle = getComputedStyle(wrapper.querySelector('li'));
|
|
11630
|
+
const listStyle = getComputedStyle(wrapper.querySelector('.k-scrollable'));
|
|
11631
|
+
if (this.isAdaptiveEnabled && this.windowSize !== 'large') {
|
|
11632
|
+
this.itemHeight = parseFloat(itemStyle.getPropertyValue('height'));
|
|
11633
|
+
}
|
|
11634
|
+
else {
|
|
11635
|
+
this.itemHeight = this.sumCSSProperties(itemStyle, 'height', 'padding-top', 'padding-bottom');
|
|
11636
|
+
}
|
|
11637
|
+
this.timeListHeight = parseFloat(listStyle.getPropertyValue('height'));
|
|
11617
11638
|
hostContainer.removeChild(wrapper);
|
|
11618
11639
|
}
|
|
11619
11640
|
isActive(element) {
|
|
@@ -12237,10 +12258,10 @@ const SNAP_THRESHOLD = 0.05; //% of the item height
|
|
|
12237
12258
|
const SCROLL_THRESHOLD = 2; //< 2px threshold
|
|
12238
12259
|
const nil = () => (null);
|
|
12239
12260
|
const getters = {
|
|
12240
|
-
|
|
12241
|
-
|
|
12242
|
-
|
|
12243
|
-
|
|
12261
|
+
[Keys.End]: (data, _) => data[data.length - 1],
|
|
12262
|
+
[Keys.Home]: (data, _) => data[0],
|
|
12263
|
+
[Keys.ArrowUp]: (data, index) => data[index - 1],
|
|
12264
|
+
[Keys.ArrowDown]: (data, index) => data[index + 1]
|
|
12244
12265
|
};
|
|
12245
12266
|
const services = {
|
|
12246
12267
|
[TIME_PART.dayperiod]: DayPeriodService,
|
|
@@ -12463,15 +12484,16 @@ class TimeListComponent {
|
|
|
12463
12484
|
return oldData && newData && oldData.text !== newData.text;
|
|
12464
12485
|
}
|
|
12465
12486
|
handleKeyDown(e) {
|
|
12466
|
-
|
|
12487
|
+
const code = normalizeNumpadKeys(e);
|
|
12488
|
+
if (code === Keys.Tab && !e.shiftKey && this.isLast) {
|
|
12467
12489
|
e.preventDefault();
|
|
12468
12490
|
this.tabOutLastPart.emit();
|
|
12469
12491
|
}
|
|
12470
|
-
if (
|
|
12492
|
+
if (code === Keys.Tab && e.shiftKey && this.isFirst) {
|
|
12471
12493
|
e.preventDefault();
|
|
12472
12494
|
this.tabOutFirstPart.emit();
|
|
12473
12495
|
}
|
|
12474
|
-
const getter = getters[
|
|
12496
|
+
const getter = getters[code] || nil;
|
|
12475
12497
|
const dataItem = getter(this.data, this.service.selectedIndex(this.value));
|
|
12476
12498
|
if (dataItem) {
|
|
12477
12499
|
this.handleChange(dataItem);
|
|
@@ -13066,8 +13088,8 @@ class TimeSelectorComponent {
|
|
|
13066
13088
|
* @hidden
|
|
13067
13089
|
*/
|
|
13068
13090
|
handleTabOut(event) {
|
|
13069
|
-
const {
|
|
13070
|
-
if (event.target === this.now?.nativeElement &&
|
|
13091
|
+
const { code, shiftKey } = event;
|
|
13092
|
+
if (event.target === this.now?.nativeElement && code === Keys.Tab && shiftKey) {
|
|
13071
13093
|
event.preventDefault();
|
|
13072
13094
|
if (this.isDateTimePicker) {
|
|
13073
13095
|
this.tabOutNow.emit();
|
|
@@ -13077,7 +13099,7 @@ class TimeSelectorComponent {
|
|
|
13077
13099
|
}
|
|
13078
13100
|
return;
|
|
13079
13101
|
}
|
|
13080
|
-
if (
|
|
13102
|
+
if (code === Keys.Tab && !shiftKey && event.target !== this.now?.nativeElement) {
|
|
13081
13103
|
event.preventDefault();
|
|
13082
13104
|
if (document.activeElement === this.accept.nativeElement) {
|
|
13083
13105
|
if (this.cancel) {
|
|
@@ -13143,17 +13165,18 @@ class TimeSelectorComponent {
|
|
|
13143
13165
|
}
|
|
13144
13166
|
}
|
|
13145
13167
|
handleKeydown(args) {
|
|
13146
|
-
const {
|
|
13168
|
+
const { altKey } = args;
|
|
13169
|
+
const code = normalizeNumpadKeys(args);
|
|
13147
13170
|
// reserve the alt + arrow key commands for the picker
|
|
13148
|
-
const arrowKeyPressed = [Keys
|
|
13171
|
+
const arrowKeyPressed = [Keys.ArrowLeft, Keys.ArrowRight].indexOf(code) !== -1;
|
|
13149
13172
|
if (isPresent(this.pickerService) && arrowKeyPressed && altKey) {
|
|
13150
13173
|
return;
|
|
13151
13174
|
}
|
|
13152
|
-
if (
|
|
13175
|
+
if (code === Keys.Enter && !this.hasActiveButton()) {
|
|
13153
13176
|
this.handleAccept();
|
|
13154
13177
|
}
|
|
13155
|
-
else if (
|
|
13156
|
-
this.focusList(
|
|
13178
|
+
else if (code === Keys.ArrowLeft || code === Keys.ArrowRight) {
|
|
13179
|
+
this.focusList(code === Keys.ArrowLeft ? Direction.Left : Direction.Right);
|
|
13157
13180
|
}
|
|
13158
13181
|
}
|
|
13159
13182
|
emitBlur(args) {
|
|
@@ -13660,7 +13683,7 @@ class TimePickerComponent extends MultiTabStop {
|
|
|
13660
13683
|
* [placeholders]({% slug placeholders_timepicker %}).
|
|
13661
13684
|
* @default null
|
|
13662
13685
|
*/
|
|
13663
|
-
placeholder
|
|
13686
|
+
placeholder;
|
|
13664
13687
|
/**
|
|
13665
13688
|
* Specifies the smallest valid time value
|
|
13666
13689
|
* ([see example]({% slug timeranges_timepicker %})).
|
|
@@ -14075,8 +14098,9 @@ class TimePickerComponent extends MultiTabStop {
|
|
|
14075
14098
|
* @hidden
|
|
14076
14099
|
*/
|
|
14077
14100
|
handleKeydown(event) {
|
|
14078
|
-
const { altKey
|
|
14079
|
-
|
|
14101
|
+
const { altKey } = event;
|
|
14102
|
+
const code = normalizeNumpadKeys(event);
|
|
14103
|
+
if (code === Keys.Escape) {
|
|
14080
14104
|
this.focusInput();
|
|
14081
14105
|
this.show = false;
|
|
14082
14106
|
hasObservers(this.escape) && this.escape.emit();
|
|
@@ -14084,13 +14108,13 @@ class TimePickerComponent extends MultiTabStop {
|
|
|
14084
14108
|
return;
|
|
14085
14109
|
}
|
|
14086
14110
|
if (altKey) {
|
|
14087
|
-
if (
|
|
14111
|
+
if (code === Keys.ArrowUp) {
|
|
14088
14112
|
event.preventDefault();
|
|
14089
14113
|
this.focusInput();
|
|
14090
14114
|
this.show = false;
|
|
14091
14115
|
this.cdr.detectChanges();
|
|
14092
14116
|
}
|
|
14093
|
-
if (
|
|
14117
|
+
if (code === Keys.ArrowDown && !this.show) {
|
|
14094
14118
|
event.preventDefault();
|
|
14095
14119
|
this.show = true;
|
|
14096
14120
|
}
|
|
@@ -16339,22 +16363,23 @@ class DateTimePickerComponent extends MultiTabStop {
|
|
|
16339
16363
|
if (this.disabled || this.readonly) {
|
|
16340
16364
|
return;
|
|
16341
16365
|
}
|
|
16342
|
-
const {
|
|
16343
|
-
|
|
16344
|
-
|
|
16345
|
-
case Keys
|
|
16366
|
+
const { altKey } = event;
|
|
16367
|
+
const code = normalizeNumpadKeys(event);
|
|
16368
|
+
switch (code) {
|
|
16369
|
+
case altKey && Keys.ArrowUp:
|
|
16370
|
+
case Keys.Escape:
|
|
16346
16371
|
this.handleCancel();
|
|
16347
16372
|
break;
|
|
16348
|
-
case !this.isOpen && altKey && Keys
|
|
16373
|
+
case !this.isOpen && altKey && Keys.ArrowDown:
|
|
16349
16374
|
this.ngZone.run(() => this.toggleDateTime(true));
|
|
16350
16375
|
break;
|
|
16351
|
-
case altKey && Keys
|
|
16376
|
+
case altKey && Keys.ArrowRight:
|
|
16352
16377
|
this.changeActiveTab('time');
|
|
16353
16378
|
break;
|
|
16354
|
-
case altKey && Keys
|
|
16379
|
+
case altKey && Keys.ArrowLeft:
|
|
16355
16380
|
this.changeActiveTab('date');
|
|
16356
16381
|
break;
|
|
16357
|
-
case this.isOpen && this.timeSelector.isActive && isPresent(this.calendarValue) && Keys
|
|
16382
|
+
case this.isOpen && this.timeSelector.isActive && isPresent(this.calendarValue) && Keys.Enter:
|
|
16358
16383
|
this.handleAccept();
|
|
16359
16384
|
break;
|
|
16360
16385
|
default: return;
|
|
@@ -16595,8 +16620,8 @@ class DateTimePickerComponent extends MultiTabStop {
|
|
|
16595
16620
|
this.popupRef.popupAnchorViewportLeave.subscribe(() => this.handleCancel());
|
|
16596
16621
|
if (this.calendar.type === 'infinite') {
|
|
16597
16622
|
this.subscriptions.add(fromEvent(this.calendar.monthView.list.nativeElement, 'keydown').subscribe((event) => {
|
|
16598
|
-
const {
|
|
16599
|
-
if (
|
|
16623
|
+
const { code, shiftKey } = event;
|
|
16624
|
+
if (code === Keys.Tab && !shiftKey) {
|
|
16600
16625
|
event.preventDefault();
|
|
16601
16626
|
if (!this.calendarValue && !this.cancelButton) {
|
|
16602
16627
|
this.dateTabButton.focus();
|
|
@@ -18774,8 +18799,9 @@ class DateRangePopupComponent {
|
|
|
18774
18799
|
this.dateRangeService.setRange(this.dateRangeService.selectionRange);
|
|
18775
18800
|
}
|
|
18776
18801
|
handleKeydown(event) {
|
|
18777
|
-
const { altKey
|
|
18778
|
-
|
|
18802
|
+
const { altKey } = event;
|
|
18803
|
+
const code = normalizeNumpadKeys(event);
|
|
18804
|
+
if (code === Keys.Escape || (altKey && code === Keys.ArrowUp)) {
|
|
18779
18805
|
this.zone.run(() => this.cancelPopup());
|
|
18780
18806
|
}
|
|
18781
18807
|
}
|
|
@@ -19304,11 +19330,12 @@ class DateRangeComponent {
|
|
|
19304
19330
|
* @hidden
|
|
19305
19331
|
*/
|
|
19306
19332
|
keydown(event) {
|
|
19307
|
-
const
|
|
19333
|
+
const code = normalizeNumpadKeys(event);
|
|
19334
|
+
const shouldOpenPopup = code === Keys.ArrowDown && event.altKey;
|
|
19308
19335
|
if (shouldOpenPopup) {
|
|
19309
19336
|
this.dateRangeService.activatePopup();
|
|
19310
19337
|
}
|
|
19311
|
-
const shouldClosePopup = (
|
|
19338
|
+
const shouldClosePopup = (code === Keys.ArrowUp && event.altKey) || code === Keys.Escape;
|
|
19312
19339
|
if (shouldClosePopup) {
|
|
19313
19340
|
this.dateRangeService.deactivatePopup();
|
|
19314
19341
|
}
|
|
@@ -19414,7 +19441,7 @@ class DateRangeInput {
|
|
|
19414
19441
|
this.dateRangeService.range$.subscribe(range => this.updateInputValue(range)),
|
|
19415
19442
|
fromEvent(this.element.nativeElement, 'click').subscribe(() => this.activate()),
|
|
19416
19443
|
fromEvent(this.element.nativeElement, 'keydown').subscribe((event) => this.togglePopup(event || {}))
|
|
19417
|
-
].
|
|
19444
|
+
].forEach(s => this.subscriptions.add(s));
|
|
19418
19445
|
}
|
|
19419
19446
|
destroy() {
|
|
19420
19447
|
this.subscriptions.unsubscribe();
|
|
@@ -19462,11 +19489,13 @@ class DateRangeInput {
|
|
|
19462
19489
|
this.dateRangeService.setRange(range);
|
|
19463
19490
|
}
|
|
19464
19491
|
}
|
|
19465
|
-
togglePopup(
|
|
19466
|
-
|
|
19492
|
+
togglePopup(e) {
|
|
19493
|
+
const code = normalizeNumpadKeys(e);
|
|
19494
|
+
const altKey = e.altKey;
|
|
19495
|
+
if (code === Keys.Escape) {
|
|
19467
19496
|
this.dateRangeService.cancelPopup();
|
|
19468
19497
|
}
|
|
19469
|
-
else if (altKey &&
|
|
19498
|
+
else if (altKey && code === Keys.ArrowDown) {
|
|
19470
19499
|
this.dateRangeService.activatePopup();
|
|
19471
19500
|
}
|
|
19472
19501
|
}
|
package/index.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export { DateInputFormatPlaceholder, DateInputCustomFormatPlaceholder } from './
|
|
|
69
69
|
export { AutoCorrectOn } from './daterange/auto-correct-on.type';
|
|
70
70
|
export { SelectionRangeEnd } from './calendar/models/selection-range-end.type';
|
|
71
71
|
export { SelectionRange } from './calendar/models/selection-range.interface';
|
|
72
|
+
export { CalendarSelection } from './calendar/models/selection';
|
|
73
|
+
export { CalendarOrientation } from './calendar/models/orientation';
|
|
72
74
|
export { FormatSettings } from './dateinput/models/format-settings.model';
|
|
73
75
|
export { PopupSettings } from './popup-settings.model';
|
|
74
76
|
export { PreventableEvent } from './preventable-event';
|