all files / spreadsheet/actions/ keyboard-navigation.js

83.05% Statements 696/838
76.82% Branches 729/949
100% Functions 19/19
83.05% Lines 696/838
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 13041×   1× 1× 1× 1445× 1445×   1× 1445×   1× 1445× 37×     1× 806× 806× 806× 806× 806× 1× 1×   805× 1× 1×   804×         804× 804× 804× 18× 1× 1×   17× 1× 1×   16× 1× 1× 1×   1× 1× 1× 1× 1×     1× 1× 1×             1×       1× 1× 1× 1×   1× 1×   1× 1×     786×       801×     801× 801× 801×       244× 151× 132×         19× 5×                                             5×                       5× 1× 1×   1× 1× 1× 1× 1× 1× 1× 1×           1× 1×                           4×               4×                               93× 1×   244× 244× 244× 244× 1×   244×   557× 557× 557× 50× 44×     44× 44× 44× 44×     6×                               513×     513×     513× 129×   513× 513× 513× 8× 8× 8× 2× 2× 1×     1× 1×   2× 2× 1×   2× 2× 1×     6× 2× 2× 1×     1×   2×     4× 4×     4× 4×   8×   505× 149× 2× 2× 2× 2× 2× 2× 1× 1×   2× 2× 2× 2×   147× 2× 2× 2×   149× 34× 16× 3×   13× 4×   9× 4×     5×   16× 16×     18× 5×   13× 4×   9× 5×     4×   18× 18×     115× 9× 9× 3×   6× 2×   4× 2×   2× 2×         356× 80× 2× 2× 2× 2×   80× 80×   2× 2× 2× 2× 2× 1× 1× 1× 1×           1× 1× 1×       1× 1×       1× 1× 1×     1× 1× 1× 1× 1×                 1×   1× 1×               276× 42× 42× 1×   42× 39× 39×   3× 3× 3× 3× 3×     234× 105× 105× 2×   105× 102× 102×   3× 2× 2× 2× 2×     129×   2× 2× 2× 2× 2× 2× 1× 1× 1× 1×           1× 1×       1×                 2× 2× 1×   2× 2× 2× 2× 1× 1×               1× 1× 1× 1×   2×   2× 2×             355× 39× 13× 13×   26× 1× 1× 1× 1×   39× 28× 28×         316× 9× 9× 6× 6×   3× 1× 1× 1× 1×   9× 5× 5×             512×       125× 108× 3× 1×   3× 2× 2× 1×         124× 17× 3× 1×   3× 2× 2× 1×         123× 123× 1×   123× 1×   123× 123× 123× 121×     121× 121×     121× 121× 121× 121×     121× 121× 119×     123× 117× 2×   115×     6×     387× 62× 62× 26× 12× 4×     8×     14× 7× 3×     4×     7× 7× 5×     2×       36×               36× 36× 18× 18×   6× 6× 1×   5× 4×     1× 1× 1×       12× 2×   10× 10× 10× 10×       10×         18× 18× 3×   15×     15× 3×   12× 12× 12× 12× 2× 2× 2×       10×           508× 1×     1× 9× 3× 1× 1×             2× 2×             6× 2× 1× 1×       1× 1×             4× 2× 1× 1×             1× 1×             2× 2× 1× 1×           1× 1×       1× 72× 72×           72× 72× 72× 1× 1× 1×   71× 39× 39× 8× 8×       39×     32×       1× 31×           31×     1× 34× 34× 315× 315×   34× 34× 34× 7× 7× 7× 7× 111× 1×   110× 20× 4×       90× 90× 2×           27× 8× 8× 8× 8× 8× 24× 2×   22× 16× 2×       6× 6× 2×       2×   19× 9× 9× 9× 9× 122× 1×   121× 28× 6×       93× 93× 2×             10× 10× 10× 10× 10× 32× 4×   28× 26× 2×       2× 2× 2×       2×     1× 7× 7× 7× 7× 3× 3× 3× 3× 3× 3× 13× 13×     13× 77× 77× 77× 3×     10× 1× 1× 1×     9×       4× 1× 1× 1× 1× 1× 1× 2× 2×     2× 6× 6× 6× 1×     1×           1×       3× 2× 2× 2× 2× 2× 2× 9× 9×     9× 71× 71× 71× 2×     7× 1× 1× 1×     6×         1× 1× 1× 1× 1× 1× 7× 7×     7× 63× 63× 63× 1×     6× 1× 1× 1×     5×           1× 81× 81× 81× 81× 81× 81× 5× 5× 5× 1× 1× 1×     5× 4×   5× 5× 2×     79× 8× 110× 110× 1× 1× 1×     8× 7×   8× 1× 1×         79× 6× 7× 7× 1× 1× 1×     6× 5×   6× 1× 1×         79× 5× 5× 5× 1× 1× 1×     5× 4×   5× 5× 2×     77×                                                                                 77× 20× 20× 1× 1× 1× 1×     19×   20×       1× 185× 5×   180× 180× 180× 180× 180× 180× 180× 180× 180× 180× 180× 180× 21× 1×       1× 1×     20× 1× 1×     179× 23×                 23× 2× 2×     177× 177× 18× 18× 1× 1× 1× 1×         1×     17×       159× 1× 1×   1× 1×       177× 177× 6× 6× 1× 1× 1× 1×           1×     5× 5× 2× 2× 1×     5×       171× 9× 1×   9×   9× 5×       1× 220144×   1× 1445× 1445×   1×   1×    
define(["require", "exports", "../common/index", "../../workbook/index", "../../workbook/index", "../../workbook/index", "../common/index", "@syncfusion/ej2-base"], function (require, exports, index_1, index_2, index_3, index_4, index_5, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var KeyboardNavigation = (function () {
        function KeyboardNavigation(parent) {
            this.parent = parent;
            this.addEventListener();
        }
        KeyboardNavigation.prototype.addEventListener = function () {
            this.parent.on(index_1.keyDown, this.keyDownHandler, this);
        };
        KeyboardNavigation.prototype.removeEventListener = function () {
            if (!this.parent.isDestroyed) {
                this.parent.off(index_1.keyDown, this.keyDownHandler);
            }
        };
        KeyboardNavigation.prototype.keyDownHandler = function (e) {
            var _this = this;
            var target = e.target;
            var isRtl = this.parent.enableRtl;
            var isKeyboardShortcut = this.parent.enableKeyboardShortcut;
            if (e.altKey && (e.keyCode === 38 || e.keyCode === 40) && !isKeyboardShortcut) {
                e.preventDefault();
                return;
            }
            if (e.altKey && e.keyCode === 38 && this.parent.element.lastElementChild.classList.contains('e-filter-popup')) {
                this.parent.notify(index_1.filterCellKeyDown, { closePopup: true });
                return;
            }
            Iif (this.parent.allowPrint && e.ctrlKey && e.keyCode === 80 && isKeyboardShortcut) {
                e.preventDefault();
                this.parent.print();
                return;
            }
            var textarea = e.target;
            Eif (!ej2_base_1.isNullOrUndefined(textarea)) {
                if ((e.key === 'Escape' || e.keyCode === 27)) {
                    if (textarea.classList.contains('e-comment-input') || textarea.classList.contains('e-assist-textarea')) {
                        textarea.blur();
                        return;
                    }
                    else if (textarea.classList.contains('e-comment-container')) {
                        this.parent.notify(index_1.removeCommentContainer, null);
                        return;
                    }
                    else if (textarea.classList.contains('e-addNoteContainer')) {
                        var noteModule = this.parent.spreadsheetNoteModule;
                        var isNoteCellIndex = this.parent.enableNotes && !ej2_base_1.isNullOrUndefined(noteModule.activeNoteCell);
                        var cellIndexes = isNoteCellIndex ? this.parent.spreadsheetNoteModule.activeNoteCell :
                            index_2.getCellIndexes(this.parent.getActiveSheet().activeCell);
                        var noteModel = noteModule.getNoteByCellIndex(cellIndexes[0], cellIndexes[1]);
                        var cell = index_3.getCell(cellIndexes[0], cellIndexes[1], this.parent.getActiveSheet());
                        var targetElement = this.parent.getCell(cellIndexes[0], cellIndexes[1]);
                        var address = index_4.getSheetName(this.parent, this.parent.activeSheetIndex) + '!' + index_2.getRangeAddress(cellIndexes);
                        Eif (!ej2_base_1.isNullOrUndefined(textarea) && !ej2_base_1.isNullOrUndefined(textarea.value) && ((ej2_base_1.isNullOrUndefined(cell)
                            || ej2_base_1.isNullOrUndefined(cell.notes)) || (cell.notes.text !== textarea.value))
                            && document.activeElement.className.indexOf('e-addNoteContainer') > -1) {
                            var eventAction = !ej2_base_1.isNullOrUndefined(cell) && cell.notes ? 'editNote' : 'addNote';
                            this.parent.notify(index_5.setActionData, { args: { action: 'beforeCellSave', eventArgs: { address: address } } });
                            var updatedNote = {
                                id: noteModel.id,
                                rowIdx: cellIndexes[0],
                                colIdx: cellIndexes[1],
                                text: textarea.value,
                                isVisible: noteModel.isVisible
                            };
                            index_4.updateCell(this.parent, this.parent.getActiveSheet(), {
                                rowIdx: cellIndexes[0], colIdx: cellIndexes[1], preventEvt: true,
                                cell: { notes: updatedNote, isNoteEditable: false }
                            });
                            var sheetExt = this.parent.getActiveSheet();
                            noteModule.syncNoteToSheetArray(sheetExt, cellIndexes[0], cellIndexes[1], updatedNote);
                            var eventArgs = { notes: updatedNote, address: address };
                            this.parent.notify(index_5.completeAction, { eventArgs: eventArgs, action: eventAction });
                        }
                        Eif (cell && !cell.notes.isVisible) {
                            this.parent.notify(index_5.removeNoteContainer, { rowIndex: cellIndexes[0], columnIndex: cellIndexes[1] });
                        }
                        index_1.focus(targetElement);
                        return;
                    }
                }
                else Iif (textarea.classList.contains('e-addNoteContainer')) {
                    return;
                }
            }
            Iif (ej2_base_1.closest(target, '.e-ai-assist-panel')) {
                return;
            }
            var dlgInst = this.parent.serviceLocator.getService(index_1.dialog).dialogInstance;
            var isNameBox = target.id === this.parent.element.id + "_name_box";
            if (this.parent.selectionSettings.mode === 'None' || dlgInst || this.parent.isEdit || (target.classList.contains('e-ss-ddb') &&
                e.keyCode !== 117 && e.keyCode !== 9) || (isNameBox && e.keyCode !== 117) || target.classList.contains('e-sheet-rename') ||
                target.id === this.parent.element.id + "_SearchBox" || target.classList.contains('e-chk-hidden') || (target.classList.contains('e-ddl') &&
                target.classList.contains('e-input-focus'))) {
                if (dlgInst) {
                    if (e.keyCode === 13) {
                        Iif (dlgInst.element.classList.contains('e-spreadsheet-function-dlg') &&
                            (target.classList.contains('e-formula-list') || target.classList.contains('e-list-item'))) {
                            index_1.focus(dlgInst.element.querySelector('.e-footer-content .e-primary'));
                        }
                    }
                    else if (e.keyCode === 9) {
                        Iif (dlgInst.element.classList.contains('e-find-dlg')) {
                            var footerBtns = dlgInst.element.querySelectorAll('.e-footer-content .e-btn:not(:disabled)');
                            var cls = footerBtns.length ? footerBtns[footerBtns.length - 1].className :
                                'e-findnreplace-checkmatch';
                            if (e.shiftKey) {
                                if (document.activeElement.classList.contains('e-dlg-closeicon-btn')) {
                                    e.preventDefault();
                                    if (footerBtns.length) {
                                        index_1.focus(footerBtns[footerBtns.length - 1]);
                                    }
                                    else {
                                        var cBoxWrapper = dlgInst.element.querySelector('.e-findnreplace-exactmatchcheckbox');
                                        if (cBoxWrapper) {
                                            index_1.focus(cBoxWrapper.querySelector('.e-findnreplace-checkmatch'));
                                            cBoxWrapper.classList.add('e-focus');
                                        }
                                    }
                                }
                            }
                            else if (document.activeElement.className.includes(cls)) {
                                index_1.focus(dlgInst.element);
                            }
                        }
                        else Iif (dlgInst.element.classList.contains('e-protect-dlg')) {
                            if (e.shiftKey ? document.activeElement.classList.contains('e-primary') :
                                document.activeElement.id === this.parent.element.id + "_protect_check") {
                                var listWrapper = dlgInst.element.querySelector('.e-protect-option-list');
                                if (listWrapper && !listWrapper.querySelector('.e-list-item.e-focused')) {
                                    var listEle = listWrapper.querySelector('.e-list-item');
                                    if (listEle) {
                                        listEle.classList.add('e-focused');
                                    }
                                }
                            }
                        }
                        else if (dlgInst.element.classList.contains('e-custom-format-dlg')) {
                            Eif (!e.shiftKey) {
                                Eif (document.activeElement.classList.contains('e-btn') &&
                                    document.activeElement.parentElement.classList.contains('e-input-button')) {
                                    var listWrapper = dlgInst.element.querySelector('.e-custom-listview');
                                    var listObj = ej2_base_1.getComponent(listWrapper, 'listview');
                                    Eif (listWrapper) {
                                        var listEle = listWrapper.querySelector('.e-list-item.e-active');
                                        Eif (!listEle) {
                                            listEle = listWrapper.querySelector('.e-list-item');
                                            Eif (listEle) {
                                                listObj.selectItem(listEle);
                                            }
                                            else {
                                                return;
                                            }
                                        }
                                        e.preventDefault();
                                        listEle.focus();
                                    }
                                }
                                else if (document.activeElement.classList.contains('e-list-item')) {
                                    index_1.focus(dlgInst.element);
                                }
                            }
                            else if (document.activeElement.className.includes('e-list-item e-active')) {
                                var listWrapper = ej2_base_1.closest(document.activeElement, '.e-custom-listview');
                                if (listWrapper) {
                                    index_1.focus(listWrapper);
                                }
                            }
                        }
                        else Iif (dlgInst.element.classList.contains('e-spreadsheet-function-dlg')) {
                            if (e.shiftKey && document.activeElement.className.includes('e-list-item e-active')) {
                                var listWrapper = ej2_base_1.closest(document.activeElement, '.e-formula-list');
                                if (listWrapper) {
                                    index_1.focus(listWrapper);
                                }
                            }
                        }
                        else Iif (dlgInst.element.classList.contains('e-goto-dlg') && !dlgInst.element.classList.contains('e-dlg-modal')) {
                            if (e.shiftKey) {
                                if (document.activeElement.className.includes('e-dlg-closeicon-btn')) {
                                    var footerOkBtn = dlgInst.element.querySelector('.e-footer-content .e-btn');
                                    if (footerOkBtn) {
                                        e.preventDefault();
                                        index_1.focus(footerOkBtn);
                                    }
                                }
                            }
                            else if (document.activeElement.className.includes('e-btn-goto-ok')) {
                                index_1.focus(dlgInst.element);
                            }
                        }
                    }
                }
                else if (isNameBox && e.keyCode === 9 && e.shiftKey) {
                    this.focusEle(e, '.e-formula-bar', false, true);
                }
                var eventArgs = { action: 'getCurrentEditValue', editedValue: '' };
                this.parent.notify(index_1.editOperation, eventArgs);
                var isFormulaEdit = index_2.checkIsFormula(eventArgs.editedValue, true);
                if (this.parent.isEdit && isFormulaEdit && e.shiftKey && !e.ctrlKey && index_1.isNavigationKey(e.keyCode)) {
                    this.shiftSelection(e);
                }
                return;
            }
            var sheet = this.parent.getActiveSheet();
            var actIdxes = index_2.getCellIndexes(sheet.activeCell);
            if (e.altKey) {
                if (e.keyCode === 40) {
                    Iif (target.classList.contains('e-dropdown-btn') || target.classList.contains('e-split-btn')) {
                        return;
                    }
                    var filterArgs = { e: e, isFilterCell: false };
                    this.parent.notify(index_1.filterCellKeyDown, filterArgs);
                    Eif (filterArgs.isFilterCell) {
                        return;
                    }
                }
                Iif (e.keyCode === 40 && !document.getElementById(this.parent.element.id + 'listValid_popup')) {
                    var cell = this.parent.getCell(actIdxes[0], actIdxes[1]);
                    if (cell) {
                        var listValidation = cell.querySelector('.e-validation-list .e-ddl');
                        if (listValidation) {
                            index_1.focus(listValidation);
                            var ddlEle = listValidation.querySelector('.e-dropdownlist') || listValidation;
                            var listObj = ej2_base_1.getComponent(ddlEle, 'dropdownlist');
                            if (listObj) {
                                listObj.showPopup();
                            }
                            return;
                        }
                    }
                }
            }
            Iif (target.id === this.parent.element.id + "_File") {
                index_1.focus(this.parent.element);
            }
            var isSheetTabFocus = target.classList.contains('e-add-sheet-tab') || target.classList.contains('e-sheets-list') ||
                (target.classList.contains('e-tab-wrap') && !!ej2_base_1.closest(target, '.e-sheet-tabs-items')) ||
                target.classList.contains('e-aggregate-list') || target.classList.contains('e-scroll-nav');
            if ([9, 37, 38, 39, 40, 33, 34, 35, 36].indexOf(e.keyCode) > -1 && !isSheetTabFocus) {
                e.preventDefault();
            }
            var isNavigate;
            var selectIdx = index_3.getRangeIndexes(sheet.selectedRange);
            if (e.keyCode === 36) {
                var frozenCol = this.parent.frozenColCount(sheet);
                var selectIdxes = void 0;
                if (e.ctrlKey || e.metaKey) {
                    var frozenRow = index_3.skipHiddenIdx(sheet, this.parent.frozenRowCount(sheet), true);
                    if (e.shiftKey) {
                        selectIdxes = [actIdxes[0], actIdxes[1], frozenRow, index_3.skipHiddenIdx(sheet, frozenCol, true, 'columns')];
                    }
                    else {
                        selectIdxes = [frozenRow, index_3.skipHiddenIdx(sheet, frozenCol, true, 'columns'), frozenRow];
                        selectIdxes[3] = selectIdxes[1];
                    }
                    var mainPanel = this.parent.element.querySelector('.e-main-panel');
                    if (mainPanel.scrollTop) {
                        mainPanel.scrollTop = 0;
                    }
                    var hCont = this.parent.getScrollElement();
                    if (hCont.scrollLeft) {
                        hCont.scrollLeft = 0;
                    }
                }
                else if (e.shiftKey) {
                    var startCol = index_3.skipHiddenIdx(sheet, frozenCol, true, 'columns');
                    if (sheet.frozenColumns && index_3.skipHiddenIdx(sheet, actIdxes[1], true, 'columns') === startCol) {
                        selectIdxes = [selectIdx[0], actIdxes[1], selectIdx[2], index_3.skipHiddenIdx(sheet, 0, true, 'columns')];
                    }
                    else {
                        selectIdxes = [selectIdx[0], actIdxes[1], selectIdx[2], startCol];
                    }
                    this.scrollNavigation([selectIdxes[2], selectIdxes[3]], true);
                }
                else {
                    var startCol = index_3.skipHiddenIdx(sheet, frozenCol, true, 'columns');
                    Iif (sheet.frozenColumns && (startCol === actIdxes[1] || frozenCol === actIdxes[1])) {
                        startCol = index_3.skipHiddenIdx(sheet, 0, true, 'columns');
                    }
                    selectIdxes = [actIdxes[0], startCol, actIdxes[0], startCol];
                    this.scrollNavigation([selectIdxes[0], selectIdxes[1]], true);
                }
                this.updateSelection(sheet, selectIdxes, e);
            }
            else if (e.ctrlKey || e.metaKey) {
                if (e.keyCode === 35) {
                    e.preventDefault();
                    var lastRow = index_3.skipHiddenIdx(sheet, sheet.usedRange.rowIndex, false);
                    lastRow = lastRow > -1 ? lastRow : sheet.usedRange.rowIndex;
                    var lastCol = index_3.skipHiddenIdx(sheet, sheet.usedRange.colIndex, false, 'columns');
                    lastCol = lastCol > -1 ? lastCol : sheet.usedRange.colIndex;
                    if (!e.shiftKey) {
                        actIdxes[0] = lastRow;
                        actIdxes[1] = lastCol;
                    }
                    actIdxes[2] = lastRow;
                    actIdxes[3] = lastCol;
                    this.updateSelection(sheet, actIdxes.concat(actIdxes), e);
                    this.scrollNavigation([lastRow, lastCol], true);
                }
                else if (e.keyCode === 32 && !e.shiftKey && isKeyboardShortcut) {
                    selectIdx[0] = 0;
                    selectIdx[2] = sheet.rowCount - 1;
                    this.updateSelection(sheet, selectIdx, { shiftKey: true });
                }
                if (e.keyCode === 40 || e.keyCode === 39 || e.keyCode === 38 || e.keyCode === 37) {
                    if (e.shiftKey) {
                        if (e.keyCode === 40) {
                            selectIdx[2] = this.getNextNonEmptyCell(selectIdx[2], actIdxes[1], 'down');
                        }
                        else if ((e.keyCode === 39 && !isRtl) || (e.keyCode === 37 && isRtl)) {
                            selectIdx[3] = this.getNextNonEmptyCell(actIdxes[0], selectIdx[3], 'right');
                        }
                        else if (e.keyCode === 38) {
                            selectIdx[2] = this.getNextNonEmptyCell(selectIdx[2], actIdxes[1], 'top');
                        }
                        else {
                            selectIdx[3] = this.getNextNonEmptyCell(actIdxes[0], selectIdx[3], 'left');
                        }
                        this.updateSelection(sheet, selectIdx, e);
                        this.scrollNavigation([selectIdx[2], selectIdx[3]], true);
                    }
                    else {
                        if ((e.keyCode === 37 && !isRtl) || (e.keyCode === 39 && isRtl)) {
                            actIdxes[1] = this.getNextNonEmptyCell(actIdxes[0], actIdxes[1], 'left');
                        }
                        else if (e.keyCode === 38) {
                            actIdxes[0] = this.getNextNonEmptyCell(actIdxes[0], actIdxes[1], 'top');
                        }
                        else if ((e.keyCode === 39 && !isRtl) || (e.keyCode === 37 && isRtl)) {
                            actIdxes[1] = this.getNextNonEmptyCell(actIdxes[0], actIdxes[1], 'right');
                        }
                        else {
                            actIdxes[0] = this.getNextNonEmptyCell(actIdxes[0], actIdxes[1], 'down');
                        }
                        this.parent.selectRange(index_2.getRangeAddress(actIdxes));
                        this.scrollNavigation([actIdxes[0], actIdxes[1]], true);
                    }
                }
                else if (e.keyCode === 117) {
                    var activeEle = document.activeElement;
                    if (activeEle.classList.contains('e-spreadsheet') || ej2_base_1.closest(activeEle, '.e-sheet')) {
                        this.setFocus('Sheet', e, true);
                    }
                    else if (isSheetTabFocus) {
                        this.setFocus('SheetTabs', e);
                    }
                    else if (ej2_base_1.closest(activeEle, '.e-ribbon')) {
                        this.setFocus('Ribbon', e);
                    }
                    else Eif (isNameBox || activeEle.classList.contains('e-insert-function')) {
                        this.setFocus('FormulaBar', e);
                    }
                }
            }
            else {
                if (e.shiftKey) {
                    if (e.keyCode === 32 && isKeyboardShortcut) {
                        e.preventDefault();
                        selectIdx[1] = 0;
                        selectIdx[3] = sheet.colCount - 1;
                        this.updateSelection(sheet, selectIdx, e);
                    }
                    this.shiftSelection(e);
                    if ((e.keyCode === 34 || e.keyCode === 33) && (this.parent.scrollModule &&
                        this.parent.scrollModule.isKeyScroll)) {
                        var scrollTop = 0;
                        var mainPanel = this.parent.element.querySelector('.e-main-panel');
                        var topRow = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.paneTopLeftCell)[0], true);
                        var viewportHgt = index_5.getBottomOffset(this.parent, topRow).height;
                        if (e.keyCode === 34) {
                            scrollTop = viewportHgt + this.parent.scrollModule.offset.top.size;
                            Eif (!this.parent.scrollSettings.isFinite) {
                                var vTrack = this.parent.getMainContent().querySelector('.e-virtualtrack');
                                Iif (vTrack && parseFloat(vTrack.style.height) < scrollTop + viewportHgt) {
                                    vTrack.style.height = scrollTop + viewportHgt + "px";
                                }
                            }
                        }
                        else {
                            scrollTop = this.parent.scrollModule.offset.top.size - viewportHgt;
                            Eif (Math.round(scrollTop) < 0) {
                                Iif (mainPanel.scrollTop) {
                                    scrollTop = 0;
                                }
                                else {
                                    this.parent.selectRange(index_2.getRangeAddress([selectIdx[0], selectIdx[1], topRow, selectIdx[3]]));
                                    return;
                                }
                            }
                        }
                        var aRowIdx = index_3.skipHiddenIdx(sheet, index_3.getRangeIndexes(sheet.selectedRange)[2], true);
                        var selectDiff_1 = topRow > aRowIdx ? 0 : aRowIdx - topRow;
                        Iif (this.parent.scrollModule && mainPanel.scrollTop) {
                            this.parent.scrollModule.isKeyScroll = false;
                        }
                        mainPanel.scrollTop = scrollTop;
                        var updateFn = function () {
                            Eif (e.keyCode === 34) {
                                selectIdx[2] = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.paneTopLeftCell)[0] + selectDiff_1, true);
                                Iif (_this.parent.scrollSettings.isFinite && selectIdx[2] > sheet.rowCount - 1) {
                                    selectIdx[2] = index_3.skipHiddenIdx(sheet, sheet.rowCount - 1, false);
                                    selectIdx[2] = selectIdx[2] < 0 ? 0 : selectIdx[2];
                                }
                            }
                            else {
                                selectIdx[2] = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.paneTopLeftCell)[0] + selectDiff_1, false);
                                selectIdx[2] = selectIdx[2] < 0 ? 0 : selectIdx[2];
                            }
                            _this.updateSelection(sheet, selectIdx, e);
                        };
                        Eif (ej2_base_1.animationMode === 'Disable') {
                            setTimeout(updateFn);
                        }
                        else {
                            index_1.getUpdateUsingRaf(updateFn);
                        }
                    }
                }
                else {
                    if (e.keyCode === 9 || (this.parent.enableRtl ? e.keyCode === 37 : e.keyCode === 39)) {
                        var cell = index_3.getCell(actIdxes[0], actIdxes[1], sheet);
                        if (cell && cell.colSpan > 1) {
                            actIdxes[1] += (cell.colSpan - 1);
                        }
                        if (actIdxes[1] < sheet.colCount - 1 && (!sheet.isProtected || sheet.protectSettings.selectCells)) {
                            actIdxes[1] += 1;
                            isNavigate = true;
                        }
                        else Eif (sheet.protectSettings.selectUnLockedCells) {
                            var idx = this.getNextUnlockedCell('right', actIdxes);
                            isNavigate = actIdxes[1] !== idx[1] || actIdxes[0] !== idx[0];
                            actIdxes[1] = idx[1];
                            actIdxes[0] = idx[0];
                        }
                    }
                    else if (e.keyCode === 13 || e.keyCode === 40) {
                        var cell = index_3.getCell(actIdxes[0], actIdxes[1], sheet);
                        if (cell && cell.rowSpan > 1) {
                            actIdxes[0] += (cell.rowSpan - 1);
                        }
                        if (actIdxes[0] < sheet.rowCount - 1 && (!sheet.isProtected || sheet.protectSettings.selectCells)) {
                            isNavigate = true;
                            actIdxes[0] += 1;
                        }
                        else if (sheet.protectSettings.selectUnLockedCells) {
                            var idx = this.getNextUnlockedCell('down', actIdxes);
                            isNavigate = actIdxes[0] !== idx[0] || actIdxes[1] !== idx[1];
                            actIdxes[1] = idx[1];
                            actIdxes[0] = idx[0];
                        }
                    }
                    else if ((e.keyCode === 34 || e.keyCode === 33) && (this.parent.scrollModule &&
                        this.parent.scrollModule.isKeyScroll)) {
                        var mainPanel = this.parent.element.querySelector('.e-main-panel');
                        var scrollTop = 0;
                        var topRow_1 = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.paneTopLeftCell)[0], true);
                        var aRowIdx_1 = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.activeCell)[0], true);
                        var viewportHgt = index_5.getBottomOffset(this.parent, topRow_1).height;
                        if (e.keyCode === 34) {
                            scrollTop = this.parent.scrollModule.offset.top.size + viewportHgt;
                            Eif (!this.parent.scrollSettings.isFinite) {
                                var vTrack = this.parent.getMainContent().querySelector('.e-virtualtrack');
                                Iif (vTrack && parseFloat(vTrack.style.height) < scrollTop + viewportHgt) {
                                    vTrack.style.height = scrollTop + viewportHgt + "px";
                                }
                            }
                        }
                        else {
                            scrollTop = this.parent.scrollModule.offset.top.size - viewportHgt;
                            Iif (sheet.frozenRows && actIdxes[0] < this.parent.frozenRowCount(sheet)) {
                                this.parent.selectRange(index_2.getRangeAddress([topRow_1, selectIdx[1], topRow_1, selectIdx[1]]));
                                return;
                            }
                            Iif (Math.round(scrollTop) < 0) {
                                if (mainPanel.scrollTop) {
                                    scrollTop = 0;
                                }
                                else {
                                    return;
                                }
                            }
                        }
                        var selectDiff_2 = topRow_1 > aRowIdx_1 ? 0 : aRowIdx_1 - topRow_1;
                        if (this.parent.scrollModule && mainPanel.scrollTop) {
                            this.parent.scrollModule.isKeyScroll = false;
                        }
                        mainPanel.scrollTop = scrollTop;
                        var updateFn = function () {
                            var activeRow;
                            if (e.keyCode === 34) {
                                activeRow = index_3.skipHiddenIdx(sheet, index_2.getCellIndexes(sheet.paneTopLeftCell)[0] + selectDiff_2, true);
                                Iif (_this.parent.scrollSettings.isFinite) {
                                    if (activeRow > sheet.rowCount - 1) {
                                        activeRow = index_3.skipHiddenIdx(sheet, sheet.rowCount - 1, false);
                                        activeRow = activeRow < 0 ? 0 : activeRow;
                                    }
                                }
                            }
                            else {
                                activeRow = index_2.getCellIndexes(sheet.paneTopLeftCell)[0] + selectDiff_2;
                                activeRow -= _this.parent.hiddenCount(topRow_1, aRowIdx_1);
                                activeRow = index_3.skipHiddenIdx(sheet, activeRow, false);
                                activeRow = activeRow < 0 ? 0 : activeRow;
                            }
                            _this.parent.notify(index_1.cellNavigate, { range: [activeRow, actIdxes[1], activeRow, actIdxes[1]], preventAnimation: true });
                        };
                        Eif (ej2_base_1.animationMode === 'Disable') {
                            setTimeout(updateFn);
                        }
                        else {
                            index_1.getUpdateUsingRaf(updateFn);
                        }
                    }
                }
                if (e.shiftKey ? e.keyCode === 9 : (this.parent.enableRtl ? e.keyCode === 39 : e.keyCode === 37)) {
                    if (actIdxes[1] > 0 && (!sheet.isProtected || sheet.protectSettings.selectCells)) {
                        actIdxes[1] -= 1;
                        isNavigate = true;
                    }
                    else if (sheet.protectSettings.selectUnLockedCells) {
                        var idx = this.getNextUnlockedCell('left', actIdxes);
                        isNavigate = actIdxes[1] !== idx[1] || actIdxes[0] !== idx[0];
                        actIdxes[1] = idx[1];
                        actIdxes[0] = idx[0];
                    }
                    if (actIdxes[1] <= 0) {
                        var content = this.parent.getMainContent();
                        Iif (actIdxes[1] === 0 && content.scrollLeft && !this.parent.enableRtl) {
                            content.scrollLeft = 0;
                        }
                    }
                }
                else if (e.shiftKey ? e.keyCode === 13 : e.keyCode === 38) {
                    Eif (!this.parent.element.querySelector('.e-find-toolbar')) {
                        if (actIdxes[0] > 0 && (!sheet.isProtected || sheet.protectSettings.selectCells)) {
                            actIdxes[0] -= 1;
                            isNavigate = true;
                        }
                        else if (sheet.protectSettings.selectUnLockedCells) {
                            var cellIdx = this.getNextUnlockedCell('up', actIdxes);
                            isNavigate = actIdxes[0] !== cellIdx[0] || actIdxes[1] !== cellIdx[1];
                            actIdxes[1] = cellIdx[1];
                            actIdxes[0] = cellIdx[0];
                        }
                        if (actIdxes[0] <= 0) {
                            var contentEle = this.parent.getMainContent().parentElement;
                            Iif (actIdxes[0] === 0 && contentEle.scrollTop) {
                                contentEle.scrollTop = 0;
                            }
                        }
                    }
                }
            }
            if (isNavigate && (!this.parent.scrollModule || this.parent.scrollModule.isKeyScroll) && !isSheetTabFocus &&
                !ej2_base_1.closest(document.activeElement, '.e-ribbon') && !target.classList.contains('e-insert-function') &&
                !target.classList.contains('e-comment-input') && (!target.classList.contains('e-formula-bar') ||
                (target.classList.contains('e-formula-bar') && target.nodeName === 'TEXTAREA' && e.keyCode === 13))) {
                if (e.keyCode === 40 || e.keyCode === 38 || e.keyCode === 13) {
                    while (index_3.isHiddenRow(sheet, actIdxes[0])) {
                        if (e.keyCode === 40 || (!e.shiftKey && e.keyCode === 13)) {
                            actIdxes[0] = actIdxes[0] + 1;
                        }
                        if (e.keyCode === 38 || (e.shiftKey && e.keyCode === 13)) {
                            actIdxes[0] = actIdxes[0] - 1;
                            if (actIdxes[0] < 0) {
                                return;
                            }
                        }
                    }
                }
                if (e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 9) {
                    while (index_2.isHiddenCol(sheet, actIdxes[1])) {
                        if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {
                            actIdxes[1] = actIdxes[1] + 1;
                        }
                        if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {
                            actIdxes[1] = actIdxes[1] - 1;
                            if (actIdxes[1] < 0) {
                                return;
                            }
                        }
                    }
                }
                var topLeftIdx = index_3.getRangeIndexes(sheet.topLeftCell);
                if (sheet.frozenRows && actIdxes[0] < topLeftIdx[0]) {
                    actIdxes[0] = index_3.skipHiddenIdx(sheet, topLeftIdx[0], true);
                }
                if (sheet.frozenColumns && actIdxes[1] < topLeftIdx[1]) {
                    actIdxes[1] = index_3.skipHiddenIdx(sheet, topLeftIdx[1], true, 'columns');
                }
                this.scrollNavigation(actIdxes);
                var range_1 = index_2.getRangeAddress(actIdxes);
                var navigateFn = function (preventAnimation) {
                    Iif (range_1 === sheet.selectedRange) {
                        return;
                    }
                    _this.parent.selectionModule.previousActiveCell = sheet.activeCell;
                    Iif (document.getElementsByClassName('e-addNoteContainer') && document.getElementsByClassName('e-addNoteContainer').length > 0) {
                        _this.parent.notify(index_5.removeNoteContainer, '');
                    }
                    _this.parent.setSheetPropertyOnMute(sheet, 'activeCell', range_1);
                    _this.parent.notify(index_1.cellNavigate, { range: actIdxes.concat(actIdxes), preventAnimation: preventAnimation });
                    var ele;
                    Iif (ej2_base_1.Browser.isDevice && ej2_base_1.Browser.info.name === 'safari' && (ej2_base_1.Browser.isIos || ej2_base_1.Browser.isIos7)) {
                        ele = _this.parent.element.querySelector('.e-ss-focus-edit');
                    }
                    ele = ele || _this.parent.getCell(actIdxes[0], actIdxes[1]);
                    if (ele) {
                        index_1.focus(ele);
                    }
                };
                if (this.parent.scrollModule && this.parent.scrollModule.isKeyScroll) {
                    if (range_1 === sheet.selectedRange) {
                        return;
                    }
                    index_1.getUpdateUsingRaf(navigateFn.bind(this, true));
                }
                else {
                    navigateFn();
                }
            }
            else if (e.keyCode === 9) {
                var ribbon = this.parent.showRibbon && ej2_base_1.closest(document.activeElement, '.e-ribbon');
                if (ribbon) {
                    if (ej2_base_1.closest(document.activeElement, '.e-tab-header')) {
                        if (e.shiftKey || ribbon.classList.contains('e-collapsed')) {
                            this.focusEle(e, '.e-ribbon .e-drop-icon');
                        }
                        else {
                            this.focusEle(e, '.e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay):not(.e-hide) .e-btn');
                        }
                    }
                    else if (ej2_base_1.closest(document.activeElement, '.e-content')) {
                        if (e.shiftKey) {
                            this.focusEle(e, '.e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap', true);
                        }
                        else {
                            this.focusEle(e, '.e-ribbon .e-drop-icon');
                        }
                    }
                    else Eif (document.activeElement.classList.contains('e-drop-icon')) {
                        if (e.shiftKey && !ribbon.classList.contains('e-collapsed')) {
                            this.focusEle(e, '.e-ribbon .e-content .e-toolbar-item:not(.e-separator):not(.e-overlay):not(.e-hide) .e-btn');
                        }
                        else {
                            this.focusEle(e, '.e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap', true);
                        }
                    }
                }
                else Iif (target.classList.contains('e-insert-function')) {
                    if (e.shiftKey) {
                        this.focusEle(e, '.e-formula-bar-panel .e-combobox');
                    }
                    else {
                        this.focusEle(e, '.e-formula-bar', false, true);
                    }
                }
                else Eif (isSheetTabFocus) {
                    if (e.shiftKey) {
                        var isNavOrAggregate = target.classList.contains('e-aggregate-list') || target.classList.contains('e-scroll-left-nav');
                        if (target.classList.contains('e-add-sheet-tab') || isNavOrAggregate || (target.classList.contains('e-sheets-list') &&
                            target.previousElementSibling && target.previousElementSibling.disabled)) {
                            var focusEle = !isNavOrAggregate && this.parent.element.querySelector('.e-aggregate-list');
                            if (focusEle) {
                                this.focusEle(e, null, false, false, focusEle);
                            }
                            else if (!target.classList.contains('e-scroll-left-nav') && this.parent.element.querySelector('.e-sheet-tab-panel .e-scroll-nav')) {
                                this.focusEle(e, '.e-sheet-tab-panel .e-scroll-right-nav', true);
                            }
                            else {
                                var items = [].slice.call(this.parent.element.querySelectorAll('.e-sheet-tab-panel .e-toolbar-item'));
                                Eif (items[items.length - 1]) {
                                    this.focusEle(e, null, true, false, items[items.length - 1].querySelector('.e-tab-wrap'));
                                }
                            }
                        }
                        else if (target.classList.contains('e-scroll-right-nav')) {
                            this.focusEle(e, '.e-sheet-tab-panel .e-scroll-left-nav', true);
                        }
                        else Eif (target.classList.contains('e-tab-wrap')) {
                            var items = [].slice.call(this.parent.element.querySelectorAll('.e-sheet-tab-panel .e-toolbar-item'));
                            var idx = items.indexOf(target.parentElement);
                            Iif (idx === 0) {
                                this.focusEle(e, '.e-sheet-tab-panel .e-sheets-list');
                            }
                            else {
                                this.focusEle(e, null, true, false, items[idx - 1].querySelector('.e-tab-wrap'));
                            }
                        }
                    }
                    else {
                        var isAggAvail = !!this.parent.element.querySelector('.e-aggregate-list');
                        if (target.classList.contains('e-aggregate-list') || (!isAggAvail && target.classList.contains('e-scroll-right-nav'))) {
                            this.focusEle(e, '.e-sheet-tab-panel .e-icon-btn:not(:disabled)');
                        }
                        else Iif (target.classList.contains('e-sheets-list')) {
                            this.focusEle(e, '.e-sheet-tab-panel .e-toolbar-item .e-tab-wrap', true);
                        }
                        else if (target.classList.contains('e-scroll-left-nav')) {
                            this.focusEle(e, '.e-sheet-tab-panel .e-scroll-right-nav', true);
                        }
                        else Eif (target.classList.contains('e-tab-wrap')) {
                            var items = [].slice.call(this.parent.element.querySelectorAll('.e-sheet-tab-panel .e-toolbar-item'));
                            var index = items.indexOf(target.parentElement);
                            if (index === items.length - 1) {
                                var isNav = !!this.parent.element.querySelector('.e-sheet-tab-panel .e-scroll-nav');
                                Eif (isNav || !isAggAvail) {
                                    this.focusEle(e, ".e-sheet-tab-panel ." + (isNav ? 'e-scroll-nav' : 'e-icon-btn:not(:disabled)'), isNav);
                                }
                            }
                            else {
                                this.focusEle(e, null, true, false, items[index + 1].querySelector('.e-tab-wrap'));
                            }
                        }
                    }
                }
            }
            if (e.keyCode === 121 && e.shiftKey && !this.parent.enableKeyboardShortcut) {
                e.preventDefault();
            }
        };
        KeyboardNavigation.prototype.setFocus = function (layout, e, isSheetArea) {
            if (layout === 'Sheet') {
                if (e.shiftKey) {
                    Eif (this.parent.showFormulaBar) {
                        this.focusEle(e, '.e-formula-bar-panel .e-combobox');
                    }
                    else {
                        this.setFocus('FormulaBar', e, isSheetArea);
                    }
                }
                else {
                    Eif (this.parent.showSheetTabs) {
                        this.focusEle(e, '.e-sheet-tab-panel .e-icon-btn:not(:disabled)');
                    }
                    else {
                        this.setFocus('SheetTabs', e, isSheetArea);
                    }
                }
            }
            else if (layout === 'SheetTabs') {
                if (e.shiftKey) {
                    Eif (!isSheetArea) {
                        this.focusEle(e, '.e-selectall');
                    }
                }
                else {
                    Eif (this.parent.showRibbon) {
                        this.focusEle(e, '.e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap', true);
                    }
                    else {
                        this.setFocus('Ribbon', e, isSheetArea);
                    }
                }
            }
            else if (layout === 'Ribbon') {
                if (e.shiftKey) {
                    Eif (this.parent.showSheetTabs) {
                        this.focusEle(e, '.e-sheet-tab-panel .e-icon-btn:not(:disabled)');
                    }
                    else if (!isSheetArea) {
                        this.focusEle(e, '.e-selectall');
                    }
                }
                else {
                    Eif (this.parent.showFormulaBar) {
                        this.focusEle(e, '.e-formula-bar-panel .e-combobox');
                    }
                    else {
                        this.setFocus('FormulaBar', e, isSheetArea);
                    }
                }
            }
            else Eif (layout === 'FormulaBar') {
                if (e.shiftKey) {
                    Eif (this.parent.showRibbon) {
                        this.focusEle(e, '.e-ribbon .e-toolbar-items .e-toolbar-item.e-active .e-tab-wrap', true);
                    }
                    else {
                        this.setFocus('Ribbon', e, isSheetArea);
                    }
                }
                else Eif (!isSheetArea) {
                    this.focusEle(e, '.e-selectall');
                }
            }
        };
        KeyboardNavigation.prototype.focusEle = function (e, selector, setTabIndex, startEdit, focusEle) {
            focusEle = focusEle || this.parent.element.querySelector(selector);
            Iif (setTabIndex && !focusEle) {
                var tabEle = this.parent.element.querySelector('.e-ribbon .e-tab');
                var selectedTab = (tabEle && ej2_base_1.getComponent(tabEle, 'tab').selectedItem) || 0;
                focusEle = this.parent.element.querySelector('.e-tab-header').getElementsByClassName('e-toolbar-item')[selectedTab];
                focusEle = focusEle && focusEle.querySelector('.e-tab-wrap');
            }
            Eif (focusEle) {
                e.preventDefault();
                if (startEdit) {
                    focusEle.click();
                    index_1.focus(focusEle);
                    focusEle.setSelectionRange(focusEle.value.length, focusEle.value.length);
                }
                else if (setTabIndex) {
                    focusEle.setAttribute('tabindex', '0');
                    if (focusEle.parentElement.classList.contains('e-active') && focusEle.parentElement.classList.contains('e-toolbar-item')) {
                        var tabEle = this.parent.element.querySelector('.e-sheet-tab-panel .e-sheet-tab');
                        Iif (!tabEle && tabEle.classList.contains('e-focused')) {
                            tabEle.classList.add('e-focused');
                        }
                    }
                    focusEle.focus();
                }
                else {
                    index_1.focus(focusEle);
                }
            }
        };
        KeyboardNavigation.prototype.updateSelection = function (sheet, range, e) {
            Iif (sheet.isProtected && !sheet.protectSettings.selectCells && sheet.protectSettings.selectUnLockedCells) {
                if (!index_1.isLockedCells(this.parent, index_3.getSwapRange(range))) {
                    this.parent.notify(index_1.cellNavigate, { range: range, shiftKey: e.shiftKey });
                }
            }
            else {
                this.parent.notify(index_1.cellNavigate, { range: range, shiftKey: e.shiftKey });
            }
        };
        KeyboardNavigation.prototype.getNextNonEmptyCell = function (rowIdx, colIdx, position) {
            var sheet = this.parent.getActiveSheet();
            var isNonEmptyCell = function (rowIdx, colIdx) {
                var cellVal = index_3.getCell(rowIdx, colIdx, sheet, null, true).value;
                return !ej2_base_1.isNullOrUndefined(cellVal) && cellVal !== '';
            };
            var checkForEmptyCell;
            var visibleIdx;
            if (position === 'down') {
                var startRow = index_3.skipHiddenIdx(sheet, rowIdx + 1, true);
                checkForEmptyCell = isNonEmptyCell(startRow, colIdx);
                var lastRow = index_3.skipHiddenIdx(sheet, sheet.rowCount - 1, false);
                for (var rowIdx_1 = startRow; rowIdx_1 < sheet.rowCount; rowIdx_1++) {
                    if (rowIdx_1 === lastRow) {
                        return rowIdx_1;
                    }
                    if (checkForEmptyCell) {
                        if (!isNonEmptyCell(index_3.skipHiddenIdx(sheet, rowIdx_1, true), colIdx)) {
                            return index_3.skipHiddenIdx(sheet, rowIdx_1 - 1, false);
                        }
                    }
                    else {
                        visibleIdx = index_3.skipHiddenIdx(sheet, rowIdx_1 + 1, true);
                        if (isNonEmptyCell(visibleIdx, colIdx)) {
                            return visibleIdx;
                        }
                    }
                }
                return rowIdx;
            }
            else if (position === 'top') {
                var startRow = index_3.skipHiddenIdx(sheet, rowIdx - 1, false);
                checkForEmptyCell = isNonEmptyCell(startRow, colIdx);
                var startIdx = this.parent.frozenRowCount(sheet) ? index_3.getRangeIndexes(sheet.topLeftCell)[0] : 0;
                var endIdx = index_3.skipHiddenIdx(sheet, startIdx, true);
                for (var rowIdx_2 = startRow; rowIdx_2 >= 0; rowIdx_2--) {
                    if (rowIdx_2 === endIdx) {
                        return rowIdx_2;
                    }
                    if (checkForEmptyCell) {
                        if (!isNonEmptyCell(index_3.skipHiddenIdx(sheet, rowIdx_2, false), colIdx)) {
                            return index_3.skipHiddenIdx(sheet, rowIdx_2 + 1, true);
                        }
                    }
                    else {
                        visibleIdx = index_3.skipHiddenIdx(sheet, rowIdx_2 - 1, false);
                        if (isNonEmptyCell(visibleIdx, colIdx)) {
                            return visibleIdx;
                        }
                    }
                }
                return rowIdx;
            }
            else if (position === 'right') {
                var startCol = index_3.skipHiddenIdx(sheet, colIdx + 1, true, 'columns');
                checkForEmptyCell = isNonEmptyCell(rowIdx, startCol);
                var lastCol = index_3.skipHiddenIdx(sheet, sheet.colCount - 1, false, 'columns');
                for (var colIdx_1 = startCol; colIdx_1 < sheet.colCount; colIdx_1++) {
                    if (colIdx_1 === lastCol) {
                        return colIdx_1;
                    }
                    if (checkForEmptyCell) {
                        if (!isNonEmptyCell(rowIdx, index_3.skipHiddenIdx(sheet, colIdx_1, true, 'columns'))) {
                            return index_3.skipHiddenIdx(sheet, colIdx_1 - 1, false, 'columns');
                        }
                    }
                    else {
                        visibleIdx = index_3.skipHiddenIdx(sheet, colIdx_1 + 1, true, 'columns');
                        if (isNonEmptyCell(rowIdx, visibleIdx)) {
                            return visibleIdx;
                        }
                    }
                }
                return colIdx;
            }
            else {
                var startCol = index_3.skipHiddenIdx(sheet, colIdx - 1, false, 'columns');
                checkForEmptyCell = isNonEmptyCell(rowIdx, startCol);
                var startIdx = this.parent.frozenColCount(sheet) ? index_3.getRangeIndexes(sheet.topLeftCell)[1] : 0;
                var endIdx = index_3.skipHiddenIdx(sheet, startIdx, true, 'columns');
                for (var colIdx_2 = startCol; colIdx_2 >= 0; colIdx_2--) {
                    if (colIdx_2 === endIdx) {
                        return colIdx_2;
                    }
                    if (checkForEmptyCell) {
                        if (!isNonEmptyCell(rowIdx, index_3.skipHiddenIdx(sheet, colIdx_2, false, 'columns'))) {
                            return index_3.skipHiddenIdx(sheet, colIdx_2 + 1, true, 'columns');
                        }
                    }
                    else {
                        visibleIdx = index_3.skipHiddenIdx(sheet, colIdx_2 - 1, false, 'columns');
                        Eif (isNonEmptyCell(rowIdx, visibleIdx)) {
                            return visibleIdx;
                        }
                    }
                }
                return colIdx;
            }
        };
        KeyboardNavigation.prototype.getNextUnlockedCell = function (position, actCellIdx) {
            var sheet = this.parent.getActiveSheet();
            var cell;
            var col;
            if (position === 'right') {
                var rowIdx = actCellIdx[0];
                var colIdx = void 0;
                var secIteration = void 0;
                var rowLen = sheet.usedRange.rowIndex;
                var colLen = sheet.usedRange.colIndex;
                while (rowIdx <= rowLen) {
                    colIdx = colIdx === undefined ? actCellIdx[1] + 1 : 0;
                    Iif (secIteration && rowIdx === actCellIdx[0]) {
                        colLen = actCellIdx[1] - 1;
                    }
                    for (colIdx; colIdx <= colLen; colIdx++) {
                        cell = index_3.getCell(rowIdx, colIdx, sheet);
                        col = index_4.getColumn(sheet, colIdx) || {};
                        if (!index_4.isLocked(cell, col) && !col.hidden && !index_3.isHiddenRow(sheet, rowIdx)) {
                            return [rowIdx, colIdx];
                        }
                    }
                    if (rowIdx === sheet.usedRange.rowIndex && !secIteration) {
                        rowIdx = 0;
                        rowLen = actCellIdx[0];
                        secIteration = true;
                    }
                    else {
                        rowIdx++;
                    }
                }
            }
            else if (position === 'left') {
                var rowIdx = actCellIdx[0];
                var colIdx = void 0;
                var secIteration = void 0;
                var rowLen = 0;
                var colLen = 0;
                while (rowIdx >= rowLen) {
                    colIdx = colIdx === undefined ? actCellIdx[1] - 1 : sheet.usedRange.colIndex;
                    Iif (secIteration && rowIdx === actCellIdx[0]) {
                        colLen = actCellIdx[1] + 1;
                    }
                    for (colIdx; colIdx >= colLen; colIdx--) {
                        cell = index_3.getCell(rowIdx, colIdx, sheet);
                        col = index_4.getColumn(sheet, colIdx) || {};
                        if (!index_4.isLocked(cell, col) && !col.hidden && !index_3.isHiddenRow(sheet, rowIdx)) {
                            return [rowIdx, colIdx];
                        }
                    }
                    Iif (rowIdx === 0 && !secIteration) {
                        rowIdx = sheet.usedRange.rowIndex;
                        rowLen = actCellIdx[0];
                        secIteration = true;
                    }
                    else {
                        rowIdx--;
                    }
                }
            }
            else if (position === 'down') {
                var colIdx = actCellIdx[1];
                var rowIdx = void 0;
                var secIteration = void 0;
                var colLen = sheet.usedRange.colIndex;
                var rowLen = sheet.usedRange.rowIndex;
                while (colIdx <= colLen) {
                    rowIdx = rowIdx === undefined ? actCellIdx[0] + 1 : 0;
                    Iif (secIteration && colIdx === actCellIdx[1]) {
                        rowLen = actCellIdx[0] - 1;
                    }
                    for (rowIdx; rowIdx <= rowLen; rowIdx++) {
                        cell = index_3.getCell(rowIdx, colIdx, sheet);
                        col = index_4.getColumn(sheet, colIdx) || {};
                        if (!index_4.isLocked(cell, col) && !col.hidden && !index_3.isHiddenRow(sheet, rowIdx)) {
                            return [rowIdx, colIdx];
                        }
                    }
                    if (colIdx === sheet.usedRange.colIndex && !secIteration) {
                        colIdx = 0;
                        colLen = actCellIdx[1];
                        secIteration = true;
                    }
                    else {
                        colIdx++;
                    }
                }
            }
            else {
                var colIdx = actCellIdx[1];
                var rowIdx = void 0;
                var secIteration = void 0;
                var colLen = 0;
                var rowLen = 0;
                while (colIdx >= colLen) {
                    rowIdx = rowIdx === undefined ? actCellIdx[0] - 1 : sheet.usedRange.rowIndex;
                    Iif (secIteration && colIdx === actCellIdx[1]) {
                        rowLen = actCellIdx[0] + 1;
                    }
                    for (rowIdx; rowIdx >= rowLen; rowIdx--) {
                        cell = index_3.getCell(rowIdx, colIdx, sheet);
                        col = index_4.getColumn(sheet, colIdx) || {};
                        if (!index_4.isLocked(cell, col) && !col.hidden && !index_3.isHiddenRow(sheet, rowIdx)) {
                            return [rowIdx, colIdx];
                        }
                    }
                    if (colIdx === 0 && !secIteration) {
                        colIdx = sheet.usedRange.colIndex;
                        colLen = actCellIdx[1];
                        secIteration = true;
                    }
                    else {
                        colIdx--;
                    }
                }
            }
            return actCellIdx;
        };
        KeyboardNavigation.prototype.shiftSelection = function (e) {
            var sheet = this.parent.getActiveSheet();
            var selectedRange = index_3.getRangeIndexes(sheet.selectedRange);
            var swapRange = index_3.getSwapRange(selectedRange);
            var noHidden = true;
            var isRtl = this.parent.enableRtl;
            if (e.keyCode === 38) {
                for (var i = swapRange[1]; i <= swapRange[3]; i++) {
                    var cell = index_3.getCell(selectedRange[2], i, sheet);
                    if (!ej2_base_1.isNullOrUndefined(cell) && cell.rowSpan && cell.rowSpan < 0) {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, selectedRange[2] - (Math.abs(cell.rowSpan) + 1), false);
                        noHidden = false;
                        break;
                    }
                }
                if (noHidden) {
                    selectedRange[2] = index_3.skipHiddenIdx(sheet, selectedRange[2] - 1, false);
                }
                var startIdx = this.parent.frozenRowCount(sheet) ? index_3.getRangeIndexes(sheet.topLeftCell)[0] : 0;
                if (selectedRange[2] < startIdx) {
                    return;
                }
            }
            if (e.keyCode === 40) {
                for (var i = swapRange[1]; i <= swapRange[3]; i++) {
                    var cell = index_3.getCell(selectedRange[2], i, sheet);
                    if (!ej2_base_1.isNullOrUndefined(cell) && cell.rowSpan && cell.rowSpan > 0) {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, selectedRange[2] + Math.abs(cell.rowSpan), true);
                        noHidden = false;
                        break;
                    }
                }
                if (noHidden) {
                    selectedRange[2] = index_3.skipHiddenIdx(sheet, selectedRange[2] + 1, true);
                }
                if (selectedRange[2] >= sheet.rowCount) {
                    selectedRange[2] = index_3.skipHiddenIdx(sheet, sheet.rowCount - 1, false);
                    Iif (selectedRange[2] < 0) {
                        return;
                    }
                }
            }
            if ((e.keyCode === 39 && !isRtl) || (e.keyCode === 37 && isRtl)) {
                for (var i = swapRange[0]; i <= swapRange[2]; i++) {
                    var cell = index_3.getCell(i, selectedRange[3], sheet);
                    if (!ej2_base_1.isNullOrUndefined(cell) && cell.colSpan && cell.colSpan > 0) {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, selectedRange[3] + Math.abs(cell.colSpan), true, 'columns');
                        noHidden = false;
                        break;
                    }
                }
                if (noHidden) {
                    selectedRange[3] = index_3.skipHiddenIdx(sheet, selectedRange[3] + 1, true, 'columns');
                }
                if (selectedRange[3] >= sheet.colCount) {
                    selectedRange[3] = index_3.skipHiddenIdx(sheet, sheet.colCount - 1, false, 'columns');
                    Iif (selectedRange[3] < 0) {
                        return;
                    }
                }
            }
            if ((e.keyCode === 37 && !isRtl) || (e.keyCode === 39 && isRtl)) {
                for (var i = swapRange[0]; i <= swapRange[2]; i++) {
                    var cell = index_3.getCell(i, selectedRange[3], sheet);
                    if (!ej2_base_1.isNullOrUndefined(cell) && cell.colSpan && cell.colSpan < 0) {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, selectedRange[3] - (Math.abs(cell.colSpan) + 1), false, 'columns');
                        noHidden = false;
                        break;
                    }
                }
                if (noHidden) {
                    selectedRange[3] = index_3.skipHiddenIdx(sheet, selectedRange[3] - 1, false, 'columns');
                }
                var startIdx = this.parent.frozenColCount(sheet) ? index_3.getRangeIndexes(sheet.topLeftCell)[1] : 0;
                if (selectedRange[3] < startIdx) {
                    return;
                }
            }
            Iif (!this.parent.scrollSettings.enableVirtualization && e.shiftKey && e.ctrlKey) {
                var usedRange = [sheet.usedRange.rowIndex, sheet.usedRange.colIndex];
                if (e.keyCode === 37) {
                    if (selectedRange[3] <= usedRange[1]) {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, 0, true, 'columns');
                    }
                    else {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, usedRange[1], true, 'columns');
                    }
                }
                if (e.keyCode === 38) {
                    if (selectedRange[2] <= usedRange[0]) {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, 0, true);
                    }
                    else {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, usedRange[0], true);
                    }
                }
                if (e.keyCode === 39) {
                    if (selectedRange[3] <= usedRange[1]) {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, usedRange[1], false, 'columns');
                    }
                    else {
                        selectedRange[3] = index_3.skipHiddenIdx(sheet, sheet.colCount, false, 'columns');
                    }
                    if (selectedRange[3] < 0) {
                        return;
                    }
                }
                if (e.keyCode === 40) {
                    if (selectedRange[2] <= usedRange[0]) {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, usedRange[0], false);
                    }
                    else {
                        selectedRange[2] = index_3.skipHiddenIdx(sheet, sheet.rowCount, false);
                    }
                    if (selectedRange[2] < 0) {
                        return;
                    }
                }
            }
            if (e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 38 || e.keyCode === 40) {
                var activeIdxes = index_2.getCellIndexes(sheet.activeCell);
                if (this.parent.isEdit && e.shiftKey) {
                    e.preventDefault();
                    this.parent.notify(index_1.rangeSelectionByKeydown, { range: selectedRange, e: e });
                    this.parent.notify(index_1.addressHandle, { range: index_2.getRangeAddress(index_3.getSwapRange(selectedRange)), isSelect: false });
                    this.parent.notify(index_1.initiateCur, {});
                }
                else {
                    this.parent.notify(index_1.cellNavigate, { range: selectedRange, shiftKey: e.shiftKey });
                }
                this.scrollNavigation([index_3.isColumnSelected(sheet, selectedRange) ? activeIdxes[0] : selectedRange[2],
                    index_3.isRowSelected(sheet, selectedRange) ? activeIdxes[1] : selectedRange[3]]);
            }
        };
        KeyboardNavigation.prototype.scrollNavigation = function (actIdxes, scrollToCell) {
            if (!this.parent.allowScrolling) {
                return;
            }
            var x = this.parent.enableRtl ? -1 : 1;
            var cont = this.parent.getMainContent().parentElement;
            var hCont = this.parent.getScrollElement();
            var sheet = this.parent.getActiveSheet();
            var selectedRange = index_3.getSwapRange(index_3.getRangeIndexes(sheet.selectedRange));
            var topLeftIdxes = index_2.getCellIndexes(sheet.topLeftCell);
            var frozenRow = this.parent.frozenRowCount(sheet);
            var frozenCol = this.parent.frozenColCount(sheet);
            var paneTopLeftIdxes = index_2.getCellIndexes(sheet.paneTopLeftCell);
            var topIdx = index_3.skipHiddenIdx(sheet, actIdxes[0] < frozenRow ? topLeftIdxes[0] : paneTopLeftIdxes[0], true);
            var offsetTopSize = this.parent.scrollModule.offset.top.size;
            if (cont.scrollTop) {
                if (frozenRow && actIdxes[0] !== selectedRange[2]) {
                    Iif (actIdxes[0] === frozenRow) {
                        cont.scrollTop = 0;
                        return;
                    }
                    Eif (actIdxes[0] === frozenRow - 1) {
                        cont.scrollTop = 0;
                    }
                }
                else if (actIdxes[0] === index_3.skipHiddenIdx(sheet, 0, true)) {
                    cont.scrollTop = 0;
                    return;
                }
            }
            if (hCont && hCont.scrollLeft) {
                Iif (frozenCol && actIdxes[1] !== selectedRange[3]) {
                    if (actIdxes[1] === frozenCol) {
                        hCont.scrollLeft = 0;
                        return;
                    }
                    if (actIdxes[1] === frozenCol - 1) {
                        hCont.scrollLeft = 0;
                    }
                }
                else if (actIdxes[1] === index_3.skipHiddenIdx(sheet, 0, true, 'columns')) {
                    hCont.scrollLeft = 0;
                    return;
                }
            }
            var viewportBtmIdx = index_5.getBottomOffset(this.parent, topIdx).index;
            if (viewportBtmIdx <= actIdxes[0]) {
                Eif (actIdxes[0] >= frozenRow) {
                    if (scrollToCell) {
                        var viewPortHeight = cont.getBoundingClientRect().height;
                        var rowsHeight = index_4.getRowsHeight(sheet, paneTopLeftIdxes[0], actIdxes[0], true);
                        Eif (rowsHeight > viewPortHeight * 2) {
                            cont.scrollTop = offsetTopSize + rowsHeight - viewPortHeight;
                        }
                        else {
                            cont.scrollTop = offsetTopSize + rowsHeight - index_2.getRowHeight(sheet, actIdxes[0], true);
                        }
                        index_1.focus(this.parent.element);
                    }
                    else {
                        cont.scrollTop = offsetTopSize + index_4.getRowsHeight(sheet, viewportBtmIdx, actIdxes[0], true);
                    }
                }
            }
            else if (topIdx > actIdxes[0]) {
                Eif (cont.scrollTop) {
                    this.parent.scrollModule.isKeyScroll = false;
                }
                cont.scrollTop = offsetTopSize - Math.ceil(index_4.getRowsHeight(sheet, actIdxes[0], topIdx - 1, true));
                Iif (scrollToCell) {
                    index_1.focus(this.parent.element);
                }
            }
            var scrollLeftIdx = index_1.getRightIdx(this.parent, paneTopLeftIdxes[1]);
            if (scrollLeftIdx <= actIdxes[1] && hCont) {
                Eif (actIdxes[1] >= frozenCol) {
                    if (scrollToCell) {
                        var contWidth = hCont.getBoundingClientRect().width;
                        var scrollWidth = index_4.getColumnsWidth(sheet, paneTopLeftIdxes[1], actIdxes[1], true);
                        Eif (scrollWidth > contWidth * 2) {
                            hCont.scrollLeft = (this.parent.scrollModule.offset.left.size + scrollWidth - contWidth) * x;
                        }
                        else {
                            hCont.scrollLeft = (this.parent.scrollModule.offset.left.size +
                                (scrollWidth - index_2.getColumnWidth(sheet, actIdxes[0], null, true))) * x;
                        }
                        index_1.focus(this.parent.element);
                    }
                    else {
                        var threshold = 0;
                        if (scrollLeftIdx !== actIdxes[1]) {
                            var contWidth = hCont.clientWidth - this.parent.sheetModule.getScrollSize();
                            if (index_2.getColumnWidth(sheet, scrollLeftIdx) > contWidth) {
                                threshold++;
                            }
                        }
                        hCont.scrollLeft = (this.parent.scrollModule.offset.left.size + (index_4.getColumnsWidth(sheet, scrollLeftIdx, actIdxes[1], true) - threshold)) * x;
                    }
                }
            }
            else if (paneTopLeftIdxes[1] > actIdxes[1] && hCont) {
                if (hCont.scrollLeft) {
                    this.parent.scrollModule.isKeyScroll = false;
                }
                hCont.scrollLeft = (this.parent.scrollModule.offset.left.size -
                    index_4.getColumnsWidth(sheet, actIdxes[1], paneTopLeftIdxes[1] - 1, true)) * x;
                if (scrollToCell) {
                    index_1.focus(this.parent.element);
                }
            }
        };
        KeyboardNavigation.prototype.getModuleName = function () {
            return 'keyboardNavigation';
        };
        KeyboardNavigation.prototype.destroy = function () {
            this.removeEventListener();
            this.parent = null;
        };
        return KeyboardNavigation;
    }());
    exports.KeyboardNavigation = KeyboardNavigation;
});