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

90.56% Statements 307/339
86.55% Branches 341/394
100% Functions 14/14
90.53% Lines 306/338
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   884× 884×   884× 884×   884× 12× 12×     119× 119×       569× 22× 22× 22×   20×   18×   17×   16×   14×       14×                           19×               81×       77×           557× 557× 557× 557× 557× 557×   556× 117× 117×   113×     117× 117×         117×     113×   112×             107× 12× 12× 12×     95×     94× 11× 11× 11× 11× 11× 11×                   11×                 115× 115×   115× 107×   103×   102×   99×   107×     115× 111×   109×   107×   105×       554× 11×   554×       554× 117×       114×         554× 103×                 103×   100×   99× 11× 11× 11×       554× 13×   12×     554× 34× 34× 34× 34×   33×   31×   30×   29×   28×   27×   26×   34×     34×       554×       554×     11× 11× 11× 11× 11×     11×                                                                                                                                       11× 11×     126650×   884× 884×        
define(["require", "exports", "../common/index", "../common/index", "../../workbook/common/index", "../../workbook/index", "../../workbook/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 KeyboardShortcut = (function () {
        function KeyboardShortcut(parent) {
            this.parent = parent;
            this.addEventListener();
        }
        KeyboardShortcut.prototype.addEventListener = function () {
            this.parent.on(index_1.keyDown, this.keyDownHandler, this);
            this.parent.on(index_1.keyUp, this.keyUpHandler, this);
        };
        KeyboardShortcut.prototype.removeEventListener = function () {
            if (!this.parent.isDestroyed) {
                this.parent.off(index_1.keyDown, this.keyDownHandler);
                this.parent.off(index_1.keyUp, this.keyUpHandler);
            }
        };
        KeyboardShortcut.prototype.isTrgtNotInput = function (e) {
            var trgt = e.target;
            return (!ej2_base_1.closest(trgt, '.e-filter-popup')
                && !ej2_base_1.closest(trgt, '.e-find-dlg') && !ej2_base_1.closest(trgt, '.e-hyperlink-dlg') &&
                !ej2_base_1.closest(trgt, '.e-sheet-tab') && !ej2_base_1.closest(trgt, '.e-name-box') && !ej2_base_1.closest(trgt, '.e-link-dialog'));
        };
        KeyboardShortcut.prototype.ribbonShortCuts = function (e) {
            if (this.parent.showRibbon && e.altKey && !e.ctrlKey && !e.shiftKey) {
                var tabObj = ej2_base_1.getComponent(this.parent.element.querySelector('.e-ribbon .e-tab'), 'tab');
                var tabIdx = void 0;
                if (e.keyCode === 72) {
                    tabIdx = 1;
                }
                else if (e.keyCode === 78) {
                    tabIdx = 2;
                }
                else if (e.keyCode === 65) {
                    tabIdx = 4;
                }
                else if (e.keyCode === 87) {
                    tabIdx = 5;
                }
                else if (e.keyCode === 77) {
                    tabIdx = 3;
                }
                else Iif (e.keyCode === 70) {
                    e.preventDefault();
                    ej2_base_1.select('#' + this.parent.element.id + '_File', this.parent.element).click();
                }
                else if (e.keyCode === 18) {
                    e.preventDefault();
                    var activeCell = index_3.getCellIndexes(this.parent.getActiveSheet().activeCell);
                    var args = { sheetIdx: this.parent.activeSheetIndex };
                    this.parent.notify(index_2.getFilterRange, args);
                    if (!(args.hasFilter && args.filterRange && args.filterRange[0] === activeCell[0] && args.filterRange[1] <= activeCell[1] &&
                        args.filterRange[3] >= activeCell[1])) {
                        var actEle = document.activeElement;
                        Eif (!actEle.classList.contains('e-spreadsheet-edit') && !actEle.classList.contains('e-sheet-rename') &&
                            actEle.id !== this.parent.element.id + "_name_box" && !ej2_base_1.closest(actEle, '.e-dropdown-btn') &&
                            !ej2_base_1.closest(actEle, '.e-split-btn') && !ej2_base_1.closest(actEle, '.e-popup-open')) {
                            var cell = this.parent.getCell(activeCell[0], activeCell[1]);
                            Iif (cell && cell.querySelector('.e-validation-list')) {
                                return;
                            }
                            Iif (ej2_base_1.closest(actEle, '.e-ribbon')) {
                                index_2.focus(this.parent.element);
                                return;
                            }
                            for (var i = 0; i <= this.parent.ribbonModule.ribbon.items.length; i++) {
                                if (i === this.parent.ribbonModule.ribbon.selectedTab) {
                                    var focusEle = this.parent.element.querySelector('.e-toolbar-items').children[i + 2].children[0];
                                    focusEle.setAttribute('tabindex', '0');
                                    index_2.focus(focusEle);
                                    return;
                                }
                            }
                        }
                    }
                }
                if (tabIdx) {
                    Eif (!tabObj.items[tabIdx].disabled && !tabObj.items[tabIdx].cssClass.includes('e-hide')) {
                        e.preventDefault();
                        tabObj.select(tabIdx, Object.assign(e, { isShortcut: true }));
                    }
                    else {
                        index_2.focus(this.parent.element);
                    }
                }
            }
        };
        KeyboardShortcut.prototype.keyUpHandler = function (e) {
            if (e.keyCode === 37 || e.keyCode === 39) {
                var activeEle = document.activeElement;
                if (activeEle.classList.contains('e-colorpicker-wrapper') || activeEle.classList.contains('e-split-btn-wrapper')) {
                    var colorPickerBtn = activeEle.querySelector('.e-split-btn');
                    Eif (colorPickerBtn) {
                        index_2.focus(colorPickerBtn);
                    }
                }
            }
            else if (e.keyCode === 13) {
                var target_1 = e.target;
                if (target_1.classList.contains('e-scroll-nav')) {
                    var focusScroll_1 = function () {
                        Eif (!target_1.getAttribute('tabindex')) {
                            target_1.setAttribute('tabindex', '0');
                            index_2.focus(target_1);
                        }
                        ej2_base_1.EventHandler.remove(target_1, 'blur', focusScroll_1);
                    };
                    ej2_base_1.EventHandler.add(target_1, 'blur', focusScroll_1, this);
                }
            }
        };
        KeyboardShortcut.prototype.keyDownHandler = function (e) {
            var isSelectionNone = this.parent.selectionSettings.mode === 'None';
            this.ribbonShortCuts(e);
            var sheet = this.parent.getActiveSheet();
            var target = e.target;
            var textarea = e.target;
            if (!ej2_base_1.isNullOrUndefined(textarea) && textarea.classList.contains('e-addNoteContainer')) {
                return;
            }
            if ((e.ctrlKey || e.metaKey) && this.isTrgtNotInput(e)) {
                Eif (!ej2_base_1.closest(target, '.e-find-dlg') && !isSelectionNone) {
                    if ([79, 83].indexOf(e.keyCode) > -1) {
                        e.preventDefault();
                    }
                    else if (e.keyCode === 65 && !this.parent.isEdit) {
                        e.preventDefault();
                    }
                }
                var indexes = index_3.getCellIndexes(sheet.activeCell);
                Iif (e.keyCode === 79) {
                    if (this.parent.allowOpen && this.parent.openUrl) {
                        ej2_base_1.select('#' + this.parent.element.id + '_fileUpload', this.parent.element).click();
                    }
                }
                else if (e.keyCode === 83) {
                    Eif (this.parent.saveUrl && this.parent.allowSave) {
                        this.parent.notify(index_4.exportDialog, null);
                    }
                }
                else if (e.keyCode === 67 && !isSelectionNone) {
                    this.parent.notify(index_1.copy, { promise: Promise });
                }
                else if (e.keyCode === 75 && !isSelectionNone) {
                    var row = sheet.rows[indexes[0]];
                    var cell = void 0;
                    e.preventDefault();
                    Eif (!ej2_base_1.isNullOrUndefined(row)) {
                        cell = row.cells[indexes[1]];
                    }
                    if (ej2_base_1.isNullOrUndefined(cell)) {
                        index_5.setCell(indexes[0], indexes[1], sheet, cell, false);
                    }
                    if (cell && cell.hyperlink) {
                        this.parent.notify(index_1.editHyperlink, null);
                    }
                    else {
                        this.parent.notify(index_1.initiateHyperlink, null);
                    }
                }
                else if (e.keyCode === 90 && !isSelectionNone) {
                    Eif (!this.parent.isEdit) {
                        e.preventDefault();
                        this.parent.notify(index_1.performUndoRedo, { isUndo: true });
                    }
                }
                else if (e.keyCode === 89 && !isSelectionNone) {
                    Eif (!this.parent.isEdit) {
                        e.preventDefault();
                        this.parent.notify(index_1.performUndoRedo, { isUndo: false });
                    }
                }
                else if ((e.keyCode === 82 || e.keyCode === 68) && !isSelectionNone) {
                    e.preventDefault();
                    var selectRange = index_3.getSwapRange(index_3.getRangeIndexes(sheet.selectedRange));
                    var startCell = { colIndex: selectRange[1], rowIndex: selectRange[0] };
                    var direction = void 0;
                    var dataRange = void 0;
                    if (e.keyCode === 68) {
                        if (selectRange[0] === selectRange[2]) {
                            startCell.rowIndex = selectRange[0] - 1;
                        }
                        else {
                            selectRange[0] += 1;
                        }
                        dataRange = index_3.getRangeAddress([startCell.rowIndex, startCell.colIndex, startCell.rowIndex, selectRange[3]]);
                        direction = 'Down';
                    }
                    else {
                        if (selectRange[1] === selectRange[3]) {
                            startCell.colIndex = selectRange[1] - 1;
                        }
                        else {
                            selectRange[1] += 1;
                        }
                        direction = 'Right';
                        dataRange = index_3.getRangeAddress([startCell.rowIndex, startCell.colIndex, selectRange[2], startCell.colIndex]);
                    }
                    if (startCell.rowIndex < 0 || startCell.colIndex < 0) {
                        return;
                    }
                    this.parent.notify(index_2.performAutoFill, {
                        fillType: index_5.getCell(startCell.rowIndex, startCell.colIndex, sheet, false, true).formula ? 'FillSeries' : 'CopyCells',
                        dAutoFillCell: dataRange, rangeInfo: {
                            direction: direction, startCell: startCell,
                            endCell: { rowIndex: selectRange[2], colIndex: selectRange[3] }, fillRange: selectRange
                        }
                    });
                    this.parent.notify(index_5.selectionComplete, { type: 'mousedown' });
                    this.parent.notify(index_5.refreshRibbonIcons, null);
                }
                var isLocked = sheet.isProtected && index_4.isLocked(index_5.getCell(indexes[0], indexes[1], sheet), index_4.getColumn(sheet, indexes[1]));
                if (e.keyCode === 70 && !isSelectionNone && this.parent.allowFindAndReplace) {
                    e.preventDefault();
                    this.parent.notify(index_3.findToolDlg, {});
                }
                if ((!isLocked || !sheet.isProtected || e.keyCode === 86) && e.keyCode !== 70 && !isSelectionNone) {
                    if (e.keyCode === 71) {
                        e.preventDefault();
                        this.parent.notify(index_2.gotoDlg, null);
                    }
                    else if (e.keyCode === 72) {
                        e.preventDefault();
                        this.parent.notify(index_2.findDlg, null);
                    }
                    else if (e.keyCode === 88) {
                        this.parent.notify(index_1.cut, { promise: Promise });
                    }
                    else if (e.keyCode === 86) {
                        this.parent.notify(index_1.paste, { isAction: true });
                    }
                    if (e.shiftKey && e.keyCode === 76 && !this.parent.isEdit && !sheet.isProtected) {
                        e.preventDefault();
                        this.parent.notify(index_2.initiateFilterUI, {});
                    }
                }
                if (!isSelectionNone && (!sheet.isProtected || sheet.protectSettings.formatCells)) {
                    if (e.keyCode === 66) {
                        e.preventDefault();
                        var value = this.parent.getCellStyleValue(['fontWeight'], indexes).fontWeight;
                        value = value === 'bold' ? 'normal' : 'bold';
                        this.parent.notify(index_3.setCellFormat, { style: { fontWeight: value }, onActionUpdate: true, refreshRibbon: true });
                    }
                    else if (e.keyCode === 73) {
                        e.preventDefault();
                        var value = this.parent.getCellStyleValue(['fontStyle'], indexes).fontStyle;
                        value = value === 'italic' ? 'normal' : 'italic';
                        this.parent.notify(index_3.setCellFormat, { style: { fontStyle: value }, onActionUpdate: true, refreshRibbon: true });
                    }
                    else if (e.ctrlKey && e.keyCode === 85 && !e.shiftKey) {
                        e.preventDefault();
                        this.parent.notify(index_3.textDecorationUpdate, { style: { textDecoration: 'underline' }, refreshRibbon: true });
                    }
                    else if (e.ctrlKey && e.keyCode === 53 && !e.shiftKey) {
                        e.preventDefault();
                        this.parent.notify(index_3.textDecorationUpdate, { style: { textDecoration: 'line-through' }, refreshRibbon: true });
                    }
                }
            }
            if (e.keyCode === 27) {
                this.parent.notify(index_1.clearCopy, null);
            }
            if ((((e.ctrlKey || e.metaKey) && e.keyCode === 119) || (e.keyCode === 13 && target.classList.contains('e-drop-icon')))
                && this.parent.showRibbon) {
                e.preventDefault();
                var expandCollapseIcon = this.parent.element.querySelector('.e-drop-icon');
                Eif (expandCollapseIcon) {
                    expandCollapseIcon.click();
                }
            }
            if ((e.ctrlKey || e.metaKey) && !isSelectionNone) {
                if (e.keyCode === 57) {
                    Eif (!sheet.isProtected || sheet.protectSettings.formatColumns) {
                        e.preventDefault();
                        var indexes = index_3.getRangeIndexes(sheet.selectedRange);
                        this.parent.notify(index_3.hideShow, { startIndex: indexes[0], endIndex: indexes[2], hide: !e.shiftKey, isCol: false,
                            actionUpdate: true });
                    }
                }
                else if (e.keyCode === 48) {
                    Eif (!sheet.isProtected || sheet.protectSettings.formatRows) {
                        var indexes = index_3.getRangeIndexes(sheet.selectedRange);
                        this.parent.notify(index_3.hideShow, { startIndex: indexes[1], endIndex: indexes[3], hide: !e.shiftKey, isCol: true,
                            actionUpdate: true });
                    }
                }
            }
            if (e.shiftKey && !isSelectionNone) {
                Iif (e.keyCode === 113) {
                    e.preventDefault();
                    if (e.target.children.length > 0 && e.target.children[e.target.children.length - 1].className.indexOf('e-addNoteIndicator') > -1) {
                        this.parent.notify(index_2.editNote, null);
                    }
                    else {
                        this.parent.notify(index_2.addNote, null);
                    }
                }
                else if (e.keyCode === 114) {
                    e.preventDefault();
                    this.parent.notify(index_1.renderInsertDlg, null);
                }
                else if (e.keyCode === 116 && this.parent.allowFindAndReplace) {
                    e.preventDefault();
                    this.parent.notify(index_3.findToolDlg, {});
                }
                else if (e.keyCode === 121) {
                    var className_1 = document.activeElement.className;
                    Eif (['e-spreadsheet', 'e-cell', 'e-header-cell', 'e-clipboard', 'e-rowhdr-table', 'e-selectall-table', 'e-main-panel'].some(function (cls) { return className_1.includes(cls); })) {
                        this.focusTarget(sheet);
                    }
                }
            }
            if (e.altKey && !isSelectionNone) {
                if ((e.ctrlKey || e.metaKey) && e.keyCode === 78) {
                    e.preventDefault();
                    this.parent.refresh(true);
                }
                else if (e.keyCode === 113 && this.parent.saveUrl) {
                    e.preventDefault();
                    this.parent.notify(index_4.exportDialog, null);
                }
            }
            if ((e.ctrlKey || e.metaKey) && e.shiftKey && !isSelectionNone) {
                Eif (!sheet.isProtected || sheet.protectSettings.formatCells) {
                    var range = sheet.selectedRange;
                    var format = void 0;
                    if (e.keyCode === 192) {
                        format = 'General';
                    }
                    else if (e.keyCode === 52) {
                        format = index_4.getFormatFromType('CurrencyWithColorCode');
                    }
                    else if (e.keyCode === 53) {
                        format = '0%';
                    }
                    else if (e.keyCode === 54) {
                        format = index_4.getFormatFromType('Scientific');
                    }
                    else if (e.keyCode === 51) {
                        format = 'dd-mmm-yy';
                    }
                    else if (e.keyCode === 50) {
                        format = 'h:mm AM/PM';
                    }
                    else if (e.keyCode === 49) {
                        format = index_4.getFormatFromType('Number');
                    }
                    else if (e.keyCode === 55) {
                        e.preventDefault();
                        var border = '1px solid #000000';
                        this.parent.notify(index_3.setCellFormat, { style: { border: border }, onActionUpdate: true, borderType: 'Outer' });
                    }
                    if (format) {
                        this.parent.notify(index_3.applyNumberFormatting, { format: format, range: range });
                        this.parent.notify(index_5.selectionComplete, { type: 'mousedown' });
                        this.parent.notify(index_5.refreshRibbonIcons, null);
                    }
                }
                if (e.keyCode === 85) {
                    e.preventDefault();
                    var formulaExpand = this.parent.element.querySelector('.e-formula-bar-panel .e-drop-icon');
                    Eif (formulaExpand) {
                        formulaExpand.click();
                    }
                }
            }
            if (e.keyCode === 122 && e.shiftKey && !e.ctrlKey && !this.parent.isProtected) {
                this.parent.notify(index_3.insertModel, {
                    model: this.parent, start: this.parent.activeSheetIndex + 1, end: this.parent.activeSheetIndex + 1, modelType: 'Sheet', isAction: true, activeSheetIndex: this.parent.activeSheetIndex + 1
                });
            }
            if (e.shiftKey && e.altKey && e.keyCode === 75 && this.parent.showSheetTabs) {
                this.parent.element.querySelector('.e-sheets-list').click();
            }
        };
        KeyboardShortcut.prototype.focusTarget = function (sheet) {
            var indexes = index_3.getSwapRange(index_3.getRangeIndexes(sheet.selectedRange));
            var isRowSelected = (indexes[1] === 0 && indexes[3] === sheet.colCount - 1);
            var isColSelected = (indexes[0] === 0 && indexes[2] === sheet.rowCount - 1);
            var target;
            Iif (isRowSelected && isColSelected) {
                target = this.parent.element.querySelector('.e-selectall');
            }
            else if (isRowSelected) {
                var frozenRow = this.parent.frozenRowCount(sheet);
                if (indexes[0] < frozenRow) {
                    var freezeHdrRow = this.parent.getRow(indexes[0], this.parent.sheetModule.getSelectAllTable());
                    target = freezeHdrRow && freezeHdrRow.cells[0];
                }
                else {
                    indexes[0] = index_5.skipHiddenIdx(sheet, indexes[0], true);
                    var topIdx = index_5.skipHiddenIdx(sheet, index_3.getRangeIndexes(sheet.paneTopLeftCell)[0], true);
                    var bottomIdx = index_1.getBottomOffset(this.parent, topIdx).index;
                    var hdrRow = void 0;
                    if (indexes[0] > topIdx && indexes[0] < bottomIdx) {
                        hdrRow = this.parent.getRow(indexes[0], this.parent.getRowHeaderTable());
                    }
                    else Iif (indexes[0] >= bottomIdx) {
                        hdrRow = this.parent.getRow(bottomIdx - 1, this.parent.getRowHeaderTable());
                    }
                    else {
                        hdrRow = this.parent.getRow(topIdx + 1, this.parent.getRowHeaderTable());
                    }
                    target = hdrRow && hdrRow.cells[0];
                }
            }
            else if (isColSelected) {
                var frozenCol = this.parent.frozenColCount(sheet);
                if (indexes[1] < frozenCol) {
                    var freezeHdrRow = this.parent.element.querySelector('.e-selectall-container .e-header-row');
                    target = freezeHdrRow && this.parent.getCell(0, indexes[1], freezeHdrRow);
                }
                else {
                    indexes[1] = index_5.skipHiddenIdx(sheet, indexes[1], true, 'columns');
                    var leftIdx = index_5.skipHiddenIdx(sheet, index_3.getRangeIndexes(sheet.paneTopLeftCell)[1], true, 'columns');
                    var rightIdx = index_1.getRightIdx(this.parent, leftIdx);
                    var hdrRow = this.parent.element.querySelector('.e-column-header .e-header-row');
                    if (indexes[1] > leftIdx && indexes[1] < rightIdx) {
                        target = hdrRow && this.parent.getCell(0, indexes[1], hdrRow);
                    }
                    else Iif (indexes[1] >= rightIdx) {
                        target = hdrRow && this.parent.getCell(0, rightIdx - 1, hdrRow);
                    }
                    else {
                        target = hdrRow && this.parent.getCell(0, leftIdx + 1, hdrRow);
                    }
                }
            }
            else {
                var topLeftIdx = index_3.getRangeIndexes(sheet.paneTopLeftCell);
                target = this.parent.getCell(indexes[0], indexes[1]);
                var frozenRow = this.parent.frozenRowCount(sheet);
                var frozenCol = this.parent.frozenColCount(sheet);
                Iif (indexes[0] < frozenRow && indexes[1] < frozenCol) {
                    target = this.parent.getCell(indexes[0], indexes[1]);
                }
                else if (indexes[0] < frozenRow) {
                    var leftIdx = index_3.getRangeIndexes(sheet.paneTopLeftCell)[1];
                    var rightIdx = index_1.getRightIdx(this.parent, leftIdx);
                    Eif (indexes[1] > leftIdx && indexes[1] < rightIdx) {
                        target = this.parent.getCell(indexes[0], indexes[1]);
                    }
                    else if (indexes[1] >= rightIdx) {
                        target = this.parent.getCell(indexes[0], rightIdx - 1);
                    }
                    else {
                        target = this.parent.getCell(indexes[0], leftIdx + 1);
                    }
                }
                else if (indexes[1] < frozenCol) {
                    var topIdx = index_3.getRangeIndexes(sheet.paneTopLeftCell)[0];
                    var bottomIdx = index_1.getBottomOffset(this.parent, topIdx).index;
                    Eif (indexes[0] > topIdx && indexes[0] < bottomIdx) {
                        target = this.parent.getCell(indexes[0], indexes[1]);
                    }
                    else if (indexes[0] >= bottomIdx) {
                        target = this.parent.getCell(bottomIdx - 1, indexes[1]);
                    }
                    else {
                        target = this.parent.getCell(topIdx + 1, indexes[1]);
                    }
                }
                else {
                    var topIdx = index_3.getRangeIndexes(sheet.paneTopLeftCell)[0];
                    var bottomIdx = index_1.getBottomOffset(this.parent, topIdx).index;
                    var leftIdx = index_3.getRangeIndexes(sheet.paneTopLeftCell)[1];
                    var rightIdx = index_1.getRightIdx(this.parent, leftIdx);
                    if (indexes[0] > topIdx && indexes[0] < bottomIdx) {
                        if (indexes[1] > leftIdx && indexes[1] < rightIdx) {
                            target = this.parent.getCell(indexes[0], indexes[1]);
                        }
                        else Iif (indexes[1] >= rightIdx) {
                            target = this.parent.getCell(indexes[0], rightIdx - 1);
                        }
                        else {
                            target = this.parent.getCell(indexes[0], leftIdx + 1);
                        }
                    }
                    else Iif (indexes[0] >= bottomIdx) {
                        if (indexes[1] > leftIdx && indexes[1] < rightIdx) {
                            target = this.parent.getCell(bottomIdx - 1, indexes[1]);
                        }
                        else if (indexes[1] >= rightIdx) {
                            target = this.parent.getCell(bottomIdx - 1, rightIdx - 1);
                        }
                        else {
                            target = this.parent.getCell(bottomIdx - 1, leftIdx + 1);
                        }
                    }
                    else {
                        Eif (indexes[1] > leftIdx && indexes[1] < rightIdx) {
                            target = this.parent.getCell(topIdx + 1, indexes[1]);
                        }
                        else if (indexes[1] >= rightIdx) {
                            target = this.parent.getCell(topIdx + 1, rightIdx - 1);
                        }
                        else {
                            target = this.parent.getCell(topIdx + 1, leftIdx + 1);
                        }
                    }
                }
                Iif (!target) {
                    target = this.parent.getCell(topLeftIdx[0] + 1, topLeftIdx[1] + 1);
                }
            }
            Eif (target) {
                index_2.focus(target);
            }
        };
        KeyboardShortcut.prototype.getModuleName = function () {
            return 'keyboardShortcut';
        };
        KeyboardShortcut.prototype.destroy = function () {
            this.removeEventListener();
            this.parent = null;
        };
        return KeyboardShortcut;
    }());
    exports.KeyboardShortcut = KeyboardShortcut;
});