1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var KeyCode = {
|
14 | |
15 |
|
16 |
|
17 | MAC_ENTER: 3,
|
18 | |
19 |
|
20 |
|
21 | BACKSPACE: 8,
|
22 | |
23 |
|
24 |
|
25 | TAB: 9,
|
26 | |
27 |
|
28 |
|
29 | NUM_CENTER: 12,
|
30 |
|
31 | |
32 |
|
33 |
|
34 | ENTER: 13,
|
35 | |
36 |
|
37 |
|
38 | SHIFT: 16,
|
39 | |
40 |
|
41 |
|
42 | CTRL: 17,
|
43 | |
44 |
|
45 |
|
46 | ALT: 18,
|
47 | |
48 |
|
49 |
|
50 | PAUSE: 19,
|
51 | |
52 |
|
53 |
|
54 | CAPS_LOCK: 20,
|
55 | |
56 |
|
57 |
|
58 | ESC: 27,
|
59 | |
60 |
|
61 |
|
62 | SPACE: 32,
|
63 | |
64 |
|
65 |
|
66 | PAGE_UP: 33,
|
67 |
|
68 | |
69 |
|
70 |
|
71 | PAGE_DOWN: 34,
|
72 |
|
73 | |
74 |
|
75 |
|
76 | END: 35,
|
77 |
|
78 | |
79 |
|
80 |
|
81 | HOME: 36,
|
82 |
|
83 | |
84 |
|
85 |
|
86 | LEFT: 37,
|
87 |
|
88 | |
89 |
|
90 |
|
91 | UP: 38,
|
92 |
|
93 | |
94 |
|
95 |
|
96 | RIGHT: 39,
|
97 |
|
98 | |
99 |
|
100 |
|
101 | DOWN: 40,
|
102 |
|
103 | |
104 |
|
105 |
|
106 | PRINT_SCREEN: 44,
|
107 | |
108 |
|
109 |
|
110 | INSERT: 45,
|
111 |
|
112 | |
113 |
|
114 |
|
115 | DELETE: 46,
|
116 |
|
117 | |
118 |
|
119 |
|
120 | ZERO: 48,
|
121 | |
122 |
|
123 |
|
124 | ONE: 49,
|
125 | |
126 |
|
127 |
|
128 | TWO: 50,
|
129 | |
130 |
|
131 |
|
132 | THREE: 51,
|
133 | |
134 |
|
135 |
|
136 | FOUR: 52,
|
137 | |
138 |
|
139 |
|
140 | FIVE: 53,
|
141 | |
142 |
|
143 |
|
144 | SIX: 54,
|
145 | |
146 |
|
147 |
|
148 | SEVEN: 55,
|
149 | |
150 |
|
151 |
|
152 | EIGHT: 56,
|
153 | |
154 |
|
155 |
|
156 | NINE: 57,
|
157 | |
158 |
|
159 |
|
160 | QUESTION_MARK: 63,
|
161 |
|
162 | |
163 |
|
164 |
|
165 | A: 65,
|
166 | |
167 |
|
168 |
|
169 | B: 66,
|
170 | |
171 |
|
172 |
|
173 | C: 67,
|
174 | |
175 |
|
176 |
|
177 | D: 68,
|
178 | |
179 |
|
180 |
|
181 | E: 69,
|
182 | |
183 |
|
184 |
|
185 | F: 70,
|
186 | |
187 |
|
188 |
|
189 | G: 71,
|
190 | |
191 |
|
192 |
|
193 | H: 72,
|
194 | |
195 |
|
196 |
|
197 | I: 73,
|
198 | |
199 |
|
200 |
|
201 | J: 74,
|
202 | |
203 |
|
204 |
|
205 | K: 75,
|
206 | |
207 |
|
208 |
|
209 | L: 76,
|
210 | |
211 |
|
212 |
|
213 | M: 77,
|
214 | |
215 |
|
216 |
|
217 | N: 78,
|
218 | |
219 |
|
220 |
|
221 | O: 79,
|
222 | |
223 |
|
224 |
|
225 | P: 80,
|
226 | |
227 |
|
228 |
|
229 | Q: 81,
|
230 | |
231 |
|
232 |
|
233 | R: 82,
|
234 | |
235 |
|
236 |
|
237 | S: 83,
|
238 | |
239 |
|
240 |
|
241 | T: 84,
|
242 | |
243 |
|
244 |
|
245 | U: 85,
|
246 | |
247 |
|
248 |
|
249 | V: 86,
|
250 | |
251 |
|
252 |
|
253 | W: 87,
|
254 | |
255 |
|
256 |
|
257 | X: 88,
|
258 | |
259 |
|
260 |
|
261 | Y: 89,
|
262 | |
263 |
|
264 |
|
265 | Z: 90,
|
266 | |
267 |
|
268 |
|
269 | META: 91,
|
270 |
|
271 | |
272 |
|
273 |
|
274 | WIN_KEY_RIGHT: 92,
|
275 | |
276 |
|
277 |
|
278 | CONTEXT_MENU: 93,
|
279 | |
280 |
|
281 |
|
282 | NUM_ZERO: 96,
|
283 | |
284 |
|
285 |
|
286 | NUM_ONE: 97,
|
287 | |
288 |
|
289 |
|
290 | NUM_TWO: 98,
|
291 | |
292 |
|
293 |
|
294 | NUM_THREE: 99,
|
295 | |
296 |
|
297 |
|
298 | NUM_FOUR: 100,
|
299 | |
300 |
|
301 |
|
302 | NUM_FIVE: 101,
|
303 | |
304 |
|
305 |
|
306 | NUM_SIX: 102,
|
307 | |
308 |
|
309 |
|
310 | NUM_SEVEN: 103,
|
311 | |
312 |
|
313 |
|
314 | NUM_EIGHT: 104,
|
315 | |
316 |
|
317 |
|
318 | NUM_NINE: 105,
|
319 | |
320 |
|
321 |
|
322 | NUM_MULTIPLY: 106,
|
323 | |
324 |
|
325 |
|
326 | NUM_PLUS: 107,
|
327 | |
328 |
|
329 |
|
330 | NUM_MINUS: 109,
|
331 | |
332 |
|
333 |
|
334 | NUM_PERIOD: 110,
|
335 | |
336 |
|
337 |
|
338 | NUM_DIVISION: 111,
|
339 | |
340 |
|
341 |
|
342 | F1: 112,
|
343 | |
344 |
|
345 |
|
346 | F2: 113,
|
347 | |
348 |
|
349 |
|
350 | F3: 114,
|
351 | |
352 |
|
353 |
|
354 | F4: 115,
|
355 | |
356 |
|
357 |
|
358 | F5: 116,
|
359 | |
360 |
|
361 |
|
362 | F6: 117,
|
363 | |
364 |
|
365 |
|
366 | F7: 118,
|
367 | |
368 |
|
369 |
|
370 | F8: 119,
|
371 | |
372 |
|
373 |
|
374 | F9: 120,
|
375 | |
376 |
|
377 |
|
378 | F10: 121,
|
379 | |
380 |
|
381 |
|
382 | F11: 122,
|
383 | |
384 |
|
385 |
|
386 | F12: 123,
|
387 | |
388 |
|
389 |
|
390 | NUMLOCK: 144,
|
391 | |
392 |
|
393 |
|
394 | SEMICOLON: 186,
|
395 |
|
396 | |
397 |
|
398 |
|
399 | DASH: 189,
|
400 |
|
401 | |
402 |
|
403 |
|
404 | EQUALS: 187,
|
405 |
|
406 | |
407 |
|
408 |
|
409 | COMMA: 188,
|
410 |
|
411 | |
412 |
|
413 |
|
414 | PERIOD: 190,
|
415 |
|
416 | |
417 |
|
418 |
|
419 | SLASH: 191,
|
420 |
|
421 | |
422 |
|
423 |
|
424 | APOSTROPHE: 192,
|
425 |
|
426 | |
427 |
|
428 |
|
429 | SINGLE_QUOTE: 222,
|
430 |
|
431 | |
432 |
|
433 |
|
434 | OPEN_SQUARE_BRACKET: 219,
|
435 |
|
436 | |
437 |
|
438 |
|
439 | BACKSLASH: 220,
|
440 |
|
441 | |
442 |
|
443 |
|
444 | CLOSE_SQUARE_BRACKET: 221,
|
445 |
|
446 | |
447 |
|
448 |
|
449 | WIN_KEY: 224,
|
450 | |
451 |
|
452 |
|
453 | MAC_FF_META: 224,
|
454 |
|
455 | |
456 |
|
457 |
|
458 | WIN_IME: 229,
|
459 |
|
460 | |
461 |
|
462 |
|
463 | isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
|
464 | var keyCode = e.keyCode;
|
465 | if (e.altKey && !e.ctrlKey || e.metaKey ||
|
466 |
|
467 | keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) {
|
468 | return false;
|
469 | }
|
470 |
|
471 |
|
472 |
|
473 | switch (keyCode) {
|
474 | case KeyCode.ALT:
|
475 | case KeyCode.CAPS_LOCK:
|
476 | case KeyCode.CONTEXT_MENU:
|
477 | case KeyCode.CTRL:
|
478 | case KeyCode.DOWN:
|
479 | case KeyCode.END:
|
480 | case KeyCode.ESC:
|
481 | case KeyCode.HOME:
|
482 | case KeyCode.INSERT:
|
483 | case KeyCode.LEFT:
|
484 | case KeyCode.MAC_FF_META:
|
485 | case KeyCode.META:
|
486 | case KeyCode.NUMLOCK:
|
487 | case KeyCode.NUM_CENTER:
|
488 | case KeyCode.PAGE_DOWN:
|
489 | case KeyCode.PAGE_UP:
|
490 | case KeyCode.PAUSE:
|
491 | case KeyCode.PRINT_SCREEN:
|
492 | case KeyCode.RIGHT:
|
493 | case KeyCode.SHIFT:
|
494 | case KeyCode.UP:
|
495 | case KeyCode.WIN_KEY:
|
496 | case KeyCode.WIN_KEY_RIGHT:
|
497 | return false;
|
498 | default:
|
499 | return true;
|
500 | }
|
501 | },
|
502 | |
503 |
|
504 |
|
505 | isCharacterKey: function isCharacterKey(keyCode) {
|
506 | if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) {
|
507 | return true;
|
508 | }
|
509 | if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) {
|
510 | return true;
|
511 | }
|
512 | if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) {
|
513 | return true;
|
514 | }
|
515 |
|
516 |
|
517 | if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) {
|
518 | return true;
|
519 | }
|
520 | switch (keyCode) {
|
521 | case KeyCode.SPACE:
|
522 | case KeyCode.QUESTION_MARK:
|
523 | case KeyCode.NUM_PLUS:
|
524 | case KeyCode.NUM_MINUS:
|
525 | case KeyCode.NUM_PERIOD:
|
526 | case KeyCode.NUM_DIVISION:
|
527 | case KeyCode.SEMICOLON:
|
528 | case KeyCode.DASH:
|
529 | case KeyCode.EQUALS:
|
530 | case KeyCode.COMMA:
|
531 | case KeyCode.PERIOD:
|
532 | case KeyCode.SLASH:
|
533 | case KeyCode.APOSTROPHE:
|
534 | case KeyCode.SINGLE_QUOTE:
|
535 | case KeyCode.OPEN_SQUARE_BRACKET:
|
536 | case KeyCode.BACKSLASH:
|
537 | case KeyCode.CLOSE_SQUARE_BRACKET:
|
538 | return true;
|
539 | default:
|
540 | return false;
|
541 | }
|
542 | }
|
543 | };
|
544 | var _default = exports.default = KeyCode; |
\ | No newline at end of file |