/
KeyboardKey.ts
61 lines (58 loc) · 1.69 KB
/
KeyboardKey.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Utilities
*/
/** Enumeration for Function Keys
* @public @deprecated in 4.3. Please use the `ts-key-enum` npm package or string literals.
*/
export enum FunctionKey {
F1 = "F1",
F2 = "F2",
F3 = "F3",
F4 = "F4",
F5 = "F5",
F6 = "F6",
F7 = "F7",
F8 = "F8",
F9 = "F9",
F10 = "F10",
F11 = "F11",
F12 = "F12",
}
/** Enumeration for Special Keys
* @public @deprecated in 4.3. Please use the `ts-key-enum` npm package or string literals.
*/
export enum SpecialKey {
Home = "Home",
End = "End",
PageUp = "PageUp",
PageDown = "PageDown",
Escape = "Escape",
Delete = "Delete",
Insert = "Insert",
Tab = "Tab",
ArrowLeft = "ArrowLeft",
ArrowRight = "ArrowRight",
ArrowUp = "ArrowUp",
ArrowDown = "ArrowDown",
Enter = "Enter",
Return = "Enter",
Space = " ",
Backspace = "Backspace",
Clear = "Clear",
Divide = "Divide",
Multiply = "Multiply",
Subtract = "Subtract",
Add = "Add",
Decimal = "Decimal",
}
/** Determines if a KeyboardEvent.key is an Arrow key
* @public @deprecated in 4.3. Please use a custom implementation moving forward.
*/
export function isArrowKey(key: string): boolean {
// eslint-disable-next-line deprecation/deprecation
return (key === SpecialKey.ArrowLeft || key === SpecialKey.ArrowRight || key === SpecialKey.ArrowUp || key === SpecialKey.ArrowDown);
}