@progress/kendo-angular-common 21.2.0-develop.9 → 21.3.0-develop.1
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/index.mjs +1 -1
- package/esm2022/toggle-button-tab-stop/toggle-button-tab-stop.directive.mjs +3 -3
- package/esm2022/utils/keys-normalizer.mjs +95 -0
- package/fesm2022/progress-kendo-angular-common.mjs +60 -5
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/utils/keys-normalizer.d.ts +23 -0
- package/esm2022/utils/numpad-keys-normalizer.mjs +0 -40
- package/utils/numpad-keys-normalizer.d.ts +0 -10
package/esm2022/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ export * from './utils';
|
|
|
11
11
|
export * from './enums';
|
|
12
12
|
export * from './utils/focusable-selectors';
|
|
13
13
|
export * from './utils/ng-class-parser';
|
|
14
|
-
export * from './utils/
|
|
14
|
+
export * from './utils/keys-normalizer';
|
|
15
15
|
export * from './utils/getter';
|
|
16
16
|
export * from './utils/setter';
|
|
17
17
|
export * from './watermark';
|
|
@@ -8,7 +8,7 @@ import { MultiTabStop } from "./toggle-button-tab-stop";
|
|
|
8
8
|
import { Subscription } from "rxjs";
|
|
9
9
|
import { take } from "rxjs/operators";
|
|
10
10
|
import { Keys } from "../enums";
|
|
11
|
-
import {
|
|
11
|
+
import { normalizeKeys } from "../utils/keys-normalizer";
|
|
12
12
|
import * as i0 from "@angular/core";
|
|
13
13
|
import * as i1 from "./toggle-button-tab-stop";
|
|
14
14
|
const tags = ['kendo-splitbutton', 'kendo-combobox', 'kendo-multicolumncombobox', 'kendo-datepicker', 'kendo-timepicker', 'kendo-datetimepicker'];
|
|
@@ -158,7 +158,7 @@ export class ToggleButtonTabStopDirective {
|
|
|
158
158
|
this.renderer.removeStyle(this.button, 'box-shadow');
|
|
159
159
|
};
|
|
160
160
|
onClick = (e) => {
|
|
161
|
-
const code =
|
|
161
|
+
const code = normalizeKeys(e);
|
|
162
162
|
const splitButtonToggleEnter = e instanceof KeyboardEvent && code === Keys.Enter;
|
|
163
163
|
const isClick = e instanceof PointerEvent;
|
|
164
164
|
if (splitButtonToggleEnter || isClick) {
|
|
@@ -166,7 +166,7 @@ export class ToggleButtonTabStopDirective {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
onKeyDown = (e) => {
|
|
169
|
-
const code =
|
|
169
|
+
const code = normalizeKeys(e);
|
|
170
170
|
if (code === Keys.ArrowDown && e.altKey) {
|
|
171
171
|
e.stopImmediatePropagation();
|
|
172
172
|
this.focusButton = true;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Keys } from "../enums";
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*
|
|
9
|
+
* Maps keyCode values (65-90) to Keys enum values (KeyA-KeyZ).
|
|
10
|
+
* Used to handle letter keys correctly across different keyboard layouts.
|
|
11
|
+
*/
|
|
12
|
+
const keyCodeToKeysMap = {
|
|
13
|
+
65: Keys.KeyA,
|
|
14
|
+
66: Keys.KeyB,
|
|
15
|
+
67: Keys.KeyC,
|
|
16
|
+
68: Keys.KeyD,
|
|
17
|
+
69: Keys.KeyE,
|
|
18
|
+
70: Keys.KeyF,
|
|
19
|
+
71: Keys.KeyG,
|
|
20
|
+
72: Keys.KeyH,
|
|
21
|
+
73: Keys.KeyI,
|
|
22
|
+
74: Keys.KeyJ,
|
|
23
|
+
75: Keys.KeyK,
|
|
24
|
+
76: Keys.KeyL,
|
|
25
|
+
77: Keys.KeyM,
|
|
26
|
+
78: Keys.KeyN,
|
|
27
|
+
79: Keys.KeyO,
|
|
28
|
+
80: Keys.KeyP,
|
|
29
|
+
81: Keys.KeyQ,
|
|
30
|
+
82: Keys.KeyR,
|
|
31
|
+
83: Keys.KeyS,
|
|
32
|
+
84: Keys.KeyT,
|
|
33
|
+
85: Keys.KeyU,
|
|
34
|
+
86: Keys.KeyV,
|
|
35
|
+
87: Keys.KeyW,
|
|
36
|
+
88: Keys.KeyX,
|
|
37
|
+
89: Keys.KeyY,
|
|
38
|
+
90: Keys.KeyZ
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*
|
|
43
|
+
* Normalizes keyboard events to ensure consistent key handling across different keyboard layouts.
|
|
44
|
+
*
|
|
45
|
+
* This function addresses the following scenarios:
|
|
46
|
+
* 1. On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
|
|
47
|
+
* 2. For letter keys (KeyA-KeyZ), checks the deprecated keyCode property to handle non-QWERTY layouts
|
|
48
|
+
* (e.g., AZERTY, QWERTZ) where event.code may not match the expected letter
|
|
49
|
+
*
|
|
50
|
+
* @param event - The keyboard event to normalize
|
|
51
|
+
* @returns The normalized key code string (e.g., 'KeyA', 'ArrowDown', 'Enter')
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // On an AZERTY layout, pressing Ctrl+A (where 'A' is physically at 'Q' position)
|
|
55
|
+
* // event.code = 'KeyQ', event.keyCode = 65
|
|
56
|
+
* const code = normalizeKeys(event); // Returns 'KeyA'
|
|
57
|
+
*/
|
|
58
|
+
export const normalizeKeys = (event) => {
|
|
59
|
+
const keyCode = event.keyCode;
|
|
60
|
+
if (keyCode >= 65 && keyCode <= 90) {
|
|
61
|
+
const normalizedKey = keyCodeToKeysMap[keyCode];
|
|
62
|
+
if (normalizedKey) {
|
|
63
|
+
return normalizedKey;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Handle numpad keys that may be mapped to navigation keys
|
|
67
|
+
if (event.code === Keys.Numpad1 && event.key === Keys.End) {
|
|
68
|
+
return Keys.End;
|
|
69
|
+
}
|
|
70
|
+
if (event.code === Keys.Numpad2 && event.key === Keys.ArrowDown) {
|
|
71
|
+
return Keys.ArrowDown;
|
|
72
|
+
}
|
|
73
|
+
if (event.code === Keys.Numpad3 && event.key === Keys.PageDown) {
|
|
74
|
+
return Keys.PageDown;
|
|
75
|
+
}
|
|
76
|
+
if (event.code === Keys.Numpad4 && event.key === Keys.ArrowLeft) {
|
|
77
|
+
return Keys.ArrowLeft;
|
|
78
|
+
}
|
|
79
|
+
if (event.code === Keys.Numpad6 && event.key === Keys.ArrowRight) {
|
|
80
|
+
return Keys.ArrowRight;
|
|
81
|
+
}
|
|
82
|
+
if (event.code === Keys.Numpad7 && event.key === Keys.Home) {
|
|
83
|
+
return Keys.Home;
|
|
84
|
+
}
|
|
85
|
+
if (event.code === Keys.Numpad8 && event.key === Keys.ArrowUp) {
|
|
86
|
+
return Keys.ArrowUp;
|
|
87
|
+
}
|
|
88
|
+
if (event.code === Keys.Numpad9 && event.key === Keys.PageUp) {
|
|
89
|
+
return Keys.PageUp;
|
|
90
|
+
}
|
|
91
|
+
if (event.code === Keys.NumpadEnter) {
|
|
92
|
+
return Keys.Enter;
|
|
93
|
+
}
|
|
94
|
+
return event.code;
|
|
95
|
+
};
|
|
@@ -891,9 +891,64 @@ const focusableSelector = [
|
|
|
891
891
|
/**
|
|
892
892
|
* @hidden
|
|
893
893
|
*
|
|
894
|
-
*
|
|
894
|
+
* Maps keyCode values (65-90) to Keys enum values (KeyA-KeyZ).
|
|
895
|
+
* Used to handle letter keys correctly across different keyboard layouts.
|
|
895
896
|
*/
|
|
896
|
-
const
|
|
897
|
+
const keyCodeToKeysMap = {
|
|
898
|
+
65: Keys.KeyA,
|
|
899
|
+
66: Keys.KeyB,
|
|
900
|
+
67: Keys.KeyC,
|
|
901
|
+
68: Keys.KeyD,
|
|
902
|
+
69: Keys.KeyE,
|
|
903
|
+
70: Keys.KeyF,
|
|
904
|
+
71: Keys.KeyG,
|
|
905
|
+
72: Keys.KeyH,
|
|
906
|
+
73: Keys.KeyI,
|
|
907
|
+
74: Keys.KeyJ,
|
|
908
|
+
75: Keys.KeyK,
|
|
909
|
+
76: Keys.KeyL,
|
|
910
|
+
77: Keys.KeyM,
|
|
911
|
+
78: Keys.KeyN,
|
|
912
|
+
79: Keys.KeyO,
|
|
913
|
+
80: Keys.KeyP,
|
|
914
|
+
81: Keys.KeyQ,
|
|
915
|
+
82: Keys.KeyR,
|
|
916
|
+
83: Keys.KeyS,
|
|
917
|
+
84: Keys.KeyT,
|
|
918
|
+
85: Keys.KeyU,
|
|
919
|
+
86: Keys.KeyV,
|
|
920
|
+
87: Keys.KeyW,
|
|
921
|
+
88: Keys.KeyX,
|
|
922
|
+
89: Keys.KeyY,
|
|
923
|
+
90: Keys.KeyZ
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* @hidden
|
|
927
|
+
*
|
|
928
|
+
* Normalizes keyboard events to ensure consistent key handling across different keyboard layouts.
|
|
929
|
+
*
|
|
930
|
+
* This function addresses the following scenarios:
|
|
931
|
+
* 1. On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
|
|
932
|
+
* 2. For letter keys (KeyA-KeyZ), checks the deprecated keyCode property to handle non-QWERTY layouts
|
|
933
|
+
* (e.g., AZERTY, QWERTZ) where event.code may not match the expected letter
|
|
934
|
+
*
|
|
935
|
+
* @param event - The keyboard event to normalize
|
|
936
|
+
* @returns The normalized key code string (e.g., 'KeyA', 'ArrowDown', 'Enter')
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* // On an AZERTY layout, pressing Ctrl+A (where 'A' is physically at 'Q' position)
|
|
940
|
+
* // event.code = 'KeyQ', event.keyCode = 65
|
|
941
|
+
* const code = normalizeKeys(event); // Returns 'KeyA'
|
|
942
|
+
*/
|
|
943
|
+
const normalizeKeys = (event) => {
|
|
944
|
+
const keyCode = event.keyCode;
|
|
945
|
+
if (keyCode >= 65 && keyCode <= 90) {
|
|
946
|
+
const normalizedKey = keyCodeToKeysMap[keyCode];
|
|
947
|
+
if (normalizedKey) {
|
|
948
|
+
return normalizedKey;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
// Handle numpad keys that may be mapped to navigation keys
|
|
897
952
|
if (event.code === Keys.Numpad1 && event.key === Keys.End) {
|
|
898
953
|
return Keys.End;
|
|
899
954
|
}
|
|
@@ -1531,7 +1586,7 @@ class ToggleButtonTabStopDirective {
|
|
|
1531
1586
|
this.renderer.removeStyle(this.button, 'box-shadow');
|
|
1532
1587
|
};
|
|
1533
1588
|
onClick = (e) => {
|
|
1534
|
-
const code =
|
|
1589
|
+
const code = normalizeKeys(e);
|
|
1535
1590
|
const splitButtonToggleEnter = e instanceof KeyboardEvent && code === Keys.Enter;
|
|
1536
1591
|
const isClick = e instanceof PointerEvent;
|
|
1537
1592
|
if (splitButtonToggleEnter || isClick) {
|
|
@@ -1539,7 +1594,7 @@ class ToggleButtonTabStopDirective {
|
|
|
1539
1594
|
}
|
|
1540
1595
|
};
|
|
1541
1596
|
onKeyDown = (e) => {
|
|
1542
|
-
const code =
|
|
1597
|
+
const code = normalizeKeys(e);
|
|
1543
1598
|
if (code === Keys.ArrowDown && e.altKey) {
|
|
1544
1599
|
e.stopImmediatePropagation();
|
|
1545
1600
|
this.focusButton = true;
|
|
@@ -1731,5 +1786,5 @@ const replaceMessagePlaceholder = (message, name, value) => (message ?? '').repl
|
|
|
1731
1786
|
* Generated bundle index. Do not edit.
|
|
1732
1787
|
*/
|
|
1733
1788
|
|
|
1734
|
-
export { DraggableDirective, EventsOutsideAngularDirective, KENDO_ADORNMENTS, KENDO_COMMON, KENDO_DRAGGABLE, KENDO_EVENTS, KENDO_RESIZESENSOR, KENDO_TEMPLATE_CONTEXT, KENDO_TOGGLEBUTTONTABSTOP, KENDO_WATERMARK, KendoInput, Keys, MultiTabStop, PrefixTemplateDirective, PreventableEvent, ResizeBatchService, ResizeCompatService, ResizeObserverService, ResizeSensorComponent, ScrollbarWidthService, SeparatorComponent, SuffixTemplateDirective, TemplateContextDirective, ToggleButtonTabStopDirective, WatermarkOverlayComponent, anyChanged, applyAttributes, areObjectsEqual, closest, closestBySelector, closestInScope, contains, findElement, findFocusable, findFocusableChild, firefoxMaxHeight, focusableSelector, getLicenseMessage, getter, guid, hasClasses, hasObservers, isChanged, isControlRequired, isDocumentAvailable, isFirefox, isFocusable, isFocusableWithTabKey, isObject, isObjectPresent, isPresent, isSafari, isString, isVisible, matchesClasses, matchesNodeName,
|
|
1789
|
+
export { DraggableDirective, EventsOutsideAngularDirective, KENDO_ADORNMENTS, KENDO_COMMON, KENDO_DRAGGABLE, KENDO_EVENTS, KENDO_RESIZESENSOR, KENDO_TEMPLATE_CONTEXT, KENDO_TOGGLEBUTTONTABSTOP, KENDO_WATERMARK, KendoInput, Keys, MultiTabStop, PrefixTemplateDirective, PreventableEvent, ResizeBatchService, ResizeCompatService, ResizeObserverService, ResizeSensorComponent, ScrollbarWidthService, SeparatorComponent, SuffixTemplateDirective, TemplateContextDirective, ToggleButtonTabStopDirective, WatermarkOverlayComponent, anyChanged, applyAttributes, areObjectsEqual, closest, closestBySelector, closestInScope, contains, findElement, findFocusable, findFocusableChild, firefoxMaxHeight, focusableSelector, getLicenseMessage, getter, guid, hasClasses, hasObservers, isChanged, isControlRequired, isDocumentAvailable, isFirefox, isFocusable, isFocusableWithTabKey, isObject, isObjectPresent, isPresent, isSafari, isString, isVisible, matchesClasses, matchesNodeName, normalizeKeys, parseAttributes, parseCSSClassNames, processCssValue, removeHTMLAttributes, replaceMessagePlaceholder, rtlScrollPosition, scrollbarWidth, setHTMLAttributes, setter, shouldShowValidationUI, splitStringToArray };
|
|
1735
1790
|
|
package/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export * from './utils';
|
|
|
11
11
|
export * from './enums';
|
|
12
12
|
export * from './utils/focusable-selectors';
|
|
13
13
|
export * from './utils/ng-class-parser';
|
|
14
|
-
export * from './utils/
|
|
14
|
+
export * from './utils/keys-normalizer';
|
|
15
15
|
export * from './utils/getter';
|
|
16
16
|
export * from './utils/setter';
|
|
17
17
|
export * from './watermark';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-common",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.3.0-develop.1",
|
|
4
4
|
"description": "Kendo UI for Angular - Utility Package",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@progress/kendo-common": "^1.0.1",
|
|
24
24
|
"@progress/kendo-draggable": "^3.0.2",
|
|
25
25
|
"tslib": "^2.3.1",
|
|
26
|
-
"@progress/kendo-angular-schematics": "21.
|
|
26
|
+
"@progress/kendo-angular-schematics": "21.3.0-develop.1"
|
|
27
27
|
},
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*
|
|
8
|
+
* Normalizes keyboard events to ensure consistent key handling across different keyboard layouts.
|
|
9
|
+
*
|
|
10
|
+
* This function addresses the following scenarios:
|
|
11
|
+
* 1. On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
|
|
12
|
+
* 2. For letter keys (KeyA-KeyZ), checks the deprecated keyCode property to handle non-QWERTY layouts
|
|
13
|
+
* (e.g., AZERTY, QWERTZ) where event.code may not match the expected letter
|
|
14
|
+
*
|
|
15
|
+
* @param event - The keyboard event to normalize
|
|
16
|
+
* @returns The normalized key code string (e.g., 'KeyA', 'ArrowDown', 'Enter')
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // On an AZERTY layout, pressing Ctrl+A (where 'A' is physically at 'Q' position)
|
|
20
|
+
* // event.code = 'KeyQ', event.keyCode = 65
|
|
21
|
+
* const code = normalizeKeys(event); // Returns 'KeyA'
|
|
22
|
+
*/
|
|
23
|
+
export declare const normalizeKeys: (event: KeyboardEvent) => string;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Keys } from "../enums";
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*
|
|
9
|
-
* On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
|
|
10
|
-
*/
|
|
11
|
-
export const normalizeNumpadKeys = (event) => {
|
|
12
|
-
if (event.code === Keys.Numpad1 && event.key === Keys.End) {
|
|
13
|
-
return Keys.End;
|
|
14
|
-
}
|
|
15
|
-
if (event.code === Keys.Numpad2 && event.key === Keys.ArrowDown) {
|
|
16
|
-
return Keys.ArrowDown;
|
|
17
|
-
}
|
|
18
|
-
if (event.code === Keys.Numpad3 && event.key === Keys.PageDown) {
|
|
19
|
-
return Keys.PageDown;
|
|
20
|
-
}
|
|
21
|
-
if (event.code === Keys.Numpad4 && event.key === Keys.ArrowLeft) {
|
|
22
|
-
return Keys.ArrowLeft;
|
|
23
|
-
}
|
|
24
|
-
if (event.code === Keys.Numpad6 && event.key === Keys.ArrowRight) {
|
|
25
|
-
return Keys.ArrowRight;
|
|
26
|
-
}
|
|
27
|
-
if (event.code === Keys.Numpad7 && event.key === Keys.Home) {
|
|
28
|
-
return Keys.Home;
|
|
29
|
-
}
|
|
30
|
-
if (event.code === Keys.Numpad8 && event.key === Keys.ArrowUp) {
|
|
31
|
-
return Keys.ArrowUp;
|
|
32
|
-
}
|
|
33
|
-
if (event.code === Keys.Numpad9 && event.key === Keys.PageUp) {
|
|
34
|
-
return Keys.PageUp;
|
|
35
|
-
}
|
|
36
|
-
if (event.code === Keys.NumpadEnter) {
|
|
37
|
-
return Keys.Enter;
|
|
38
|
-
}
|
|
39
|
-
return event.code;
|
|
40
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*
|
|
8
|
-
* On some keyboards, PageUp/Down, Home/End, and arrow keys are mapped to Numpad keys
|
|
9
|
-
*/
|
|
10
|
-
export declare const normalizeNumpadKeys: (event: KeyboardEvent) => string;
|