all files / spreadsheet/actions/ virtual-scroll.js

91.71% Statements 531/579
88.32% Branches 295/334
100% Functions 33/33
91.81% Lines 527/574
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   856× 856× 856×   989× 989× 989× 989× 989× 989× 989× 989× 989× 737×   989× 989× 958×   958×     31× 15×   31×   989× 989× 989× 27× 27× 10×   27×   989× 989× 989× 989× 989×       985×   989× 973×     973× 973× 973×     16×     16× 16× 16×   989×     989×     989×   989× 987×   989× 970×   989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 989× 986× 986× 986×     768× 768× 962× 962×   962×     1931× 1931× 1660×     16× 16×     15× 15×     64× 64× 64× 64× 64× 45× 34×   11×   30× 27×     67× 67× 67× 67× 67× 67× 58× 58× 58× 58× 58× 12× 12× 11× 11× 11× 11× 11× 11× 11×                 11× 11×           12×     58× 41×   58×         57× 46× 46× 46×       46× 46× 28× 28× 28× 28×     23×   28× 14× 13× 13× 13× 13×     11× 11× 11× 11× 11× 11×       11× 11× 11× 11×                           14× 14× 14×     14×       14×   14×   14×   26× 26×     18× 18×     55×     69×             33× 33× 33× 33× 363× 12×     33×   22× 22×         22×   171× 171× 171× 171× 171× 171× 39× 39× 39× 39× 39× 20×                             39× 30×   39×                     39× 19× 19× 19×       19× 19× 18× 18× 18× 18×   18× 12× 11× 11× 11× 11×         11× 11× 11× 11× 11× 11× 11× 11×                                               18× 18×         39×     44× 43×     46× 46× 46× 46×     37×     19× 19× 19× 19× 11×         2304× 899×   1405× 1405× 1405× 906× 906×   1405× 234× 234×     844× 252× 252× 252× 252× 252× 252× 243× 243×     243× 243× 243×     240× 240× 240× 239×         592× 586× 586× 586× 586× 586× 11× 11×     575× 575× 575× 575×         3136× 11×   3125× 3125× 2205× 2115× 2115× 2115× 584× 508×     76×       1531× 1525×         2115× 1525×   590× 590× 590× 514×         920× 829× 829× 829× 78×       78×       751× 742×         829× 742×   87× 87× 87×         4896× 4896×           4896×     2654× 2654× 1952×   2654× 362× 362× 362× 362× 362× 287× 287×       86×     86× 86× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82×             2632× 2632× 2632× 87×     279× 279× 279× 279× 279×   67× 67× 67× 31×     51×     39× 31×                               856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856×   856× 856× 856× 856× 14×     856× 737× 737×   856× 737× 737×   856× 737× 737×   856× 856× 856× 856× 856× 856× 856×   856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856× 856×        
define(["require", "exports", "@syncfusion/ej2-base", "../common/index", "../common/index", "../common/index", "./../../workbook/index", "../../workbook/common/index"], function (require, exports, ej2_base_1, index_1, index_2, index_3, index_4, index_5) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var VirtualScroll = (function () {
        function VirtualScroll(parent) {
            this.scroll = [];
            this.parent = parent;
            this.addEventListener();
        }
        VirtualScroll.prototype.createVirtualElement = function (args) {
            var sheet = this.parent.getActiveSheet();
            var container = this.parent.getMainContent();
            this.content = this.parent.createElement('div', { className: 'e-virtualable' });
            this.content.appendChild(container.querySelector('.e-table'));
            container.appendChild(this.content);
            var vTrack = container.appendChild(this.parent.createElement('div', { className: 'e-virtualtrack' }));
            var height = 0;
            var width;
            if (this.parent.sheets.length > this.scroll.length) {
                this.initScroll();
            }
            var endIndex = this.parent.viewport.bottomIndex;
            if (sheet.rowCount > endIndex + 1 || sheet.usedRange.rowIndex > endIndex) {
                if (!this.parent.scrollSettings.isFinite && sheet.rowCount <= sheet.usedRange.rowIndex) {
                    this.parent.setSheetPropertyOnMute(sheet, 'rowCount', sheet.usedRange.rowIndex + 1);
                }
                this.setScrollCount(sheet.rowCount, 'row');
            }
            else {
                if (!this.parent.scrollSettings.isFinite) {
                    this.parent.setSheetPropertyOnMute(sheet, 'rowCount', endIndex + 1);
                }
                this.scroll[this.parent.activeSheetIndex].rowCount = sheet.rowCount;
            }
            var startIndex = this.parent.frozenRowCount(sheet);
            var indexes = index_5.getCellIndexes(sheet.topLeftCell);
            if (args.top) {
                height = args.top;
                if (sheet.frozenRows) {
                    height += index_4.getRowsHeight(sheet, indexes[0], startIndex - 1, true);
                }
                startIndex = index_5.getCellIndexes(sheet.paneTopLeftCell)[0];
            }
            height += index_4.getRowsHeight(sheet, startIndex, this.scroll[this.parent.activeSheetIndex].rowCount - 1, true);
            endIndex = this.parent.viewport.rightIndex;
            var size = 0;
            var frozenCol = this.parent.frozenColCount(sheet);
            if (args.left) {
                size = args.left;
                if (frozenCol) {
                    size += index_4.getColumnsWidth(sheet, indexes[1], frozenCol - 1, true);
                }
                startIndex = index_5.getCellIndexes(sheet.paneTopLeftCell)[1];
            }
            else {
                startIndex = frozenCol;
            }
            if (sheet.colCount > endIndex + 1 || sheet.usedRange.colIndex > endIndex) {
                Iif (!this.parent.scrollSettings.isFinite && sheet.colCount <= sheet.usedRange.colIndex) {
                    this.parent.setSheetPropertyOnMute(sheet, 'colCount', sheet.usedRange.colIndex + 1);
                }
                size += index_4.getColumnsWidth(sheet, startIndex, endIndex, true);
                this.setScrollCount(sheet.colCount, 'col');
                width = size + index_4.getColumnsWidth(sheet, endIndex + 1, this.scroll[this.parent.activeSheetIndex].colCount - 1, true);
            }
            else {
                Iif (!this.parent.scrollSettings.isFinite) {
                    this.parent.setSheetPropertyOnMute(sheet, 'colCount', endIndex + 1);
                }
                size += index_4.getColumnsWidth(sheet, startIndex, sheet.colCount - 1, true);
                this.scroll[this.parent.activeSheetIndex].colCount = sheet.colCount;
                width = size;
            }
            Iif (ej2_base_1.isNullOrUndefined(this.parent.viewport.leftIndex)) {
                this.parent.viewport.leftIndex = 0;
            }
            Iif (ej2_base_1.isNullOrUndefined(this.parent.viewport.topIndex)) {
                this.parent.viewport.topIndex = 0;
            }
            if (args.left) {
                size = index_4.getColumnsWidth(sheet, this.parent.viewport.leftIndex + frozenCol, endIndex, true);
            }
            if (ej2_base_1.isNullOrUndefined(this.translateX)) {
                this.translateX = 0;
            }
            if (ej2_base_1.isNullOrUndefined(this.translateY)) {
                this.translateY = 0;
            }
            container = this.parent.getRowHeaderContent();
            this.rowHeader = this.content.cloneNode();
            this.rowHeader.appendChild(container.querySelector('.e-table'));
            container.appendChild(this.rowHeader);
            var rowVTrack = container.appendChild(vTrack.cloneNode());
            this.rowHeader.style.transform = "translate(0px, " + this.translateY + "px)";
            container = this.parent.getColumnHeaderContent();
            this.colHeader = this.content.cloneNode();
            this.colHeader.appendChild(container.querySelector('.e-table'));
            container.appendChild(this.colHeader);
            var colVTrack = container.appendChild(vTrack.cloneNode());
            this.colHeader.style.width = size + "px";
            rowVTrack.style.height = height + "px";
            colVTrack.style.width = width + "px";
            this.colHeader.style.transform = "translate(" + this.translateX + "px, 0px)";
            this.content.style.transform = "translate(" + this.translateX + "px, " + this.translateY + "px)";
            this.content.style.width = size + "px";
            vTrack.style.height = height + "px";
            vTrack.style.width = width + "px";
            if (this.parent.allowScrolling) {
                var scrollVTrack = colVTrack.cloneNode(true);
                scrollVTrack.style.width = width + (this.parent.scrollSettings.isFinite ? this.parent.sheetModule.getScrollSize() : 0) + "px";
                this.parent.getScrollElement().appendChild(scrollVTrack);
            }
        };
        VirtualScroll.prototype.initScroll = function () {
            var i = 0;
            while (i < this.parent.sheets.length) {
                Eif (!this.scroll[i]) {
                    this.scroll.push({ rowCount: 0, colCount: 0 });
                }
                i++;
            }
        };
        VirtualScroll.prototype.setScrollCount = function (count, layout) {
            var activeSheetIdx = this.parent.activeSheetIndex;
            if (!this.scroll[activeSheetIdx][layout + 'Count'] || this.scroll[activeSheetIdx][layout + 'Count'] !== count) {
                this.scroll[activeSheetIdx][layout + 'Count'] = count;
            }
        };
        VirtualScroll.prototype.getRowAddress = function (indexes) {
            var sheet = this.parent.getActiveSheet();
            return index_5.getRangeAddress([indexes[0], sheet.frozenColumns ? index_5.getCellIndexes(sheet.topLeftCell)[1] : this.parent.viewport.leftIndex,
                indexes[1], this.parent.viewport.rightIndex]);
        };
        VirtualScroll.prototype.getColAddress = function (indexes) {
            var sheet = this.parent.getActiveSheet();
            return index_5.getRangeAddress([sheet.frozenRows ? index_5.getCellIndexes(sheet.topLeftCell)[0] : this.parent.viewport.topIndex, indexes[0],
                this.parent.viewport.bottomIndex, indexes[1]]);
        };
        VirtualScroll.prototype.updateScrollCount = function (idx, layout, threshold) {
            if (threshold === void 0) { threshold = idx; }
            var sheet = this.parent.getActiveSheet();
            var rowCount = idx + this.parent.viewport[layout + 'Count'] + 1 + threshold;
            var usedRangeCount = this.scroll[this.parent.activeSheetIndex][layout + 'Count'];
            if (rowCount < usedRangeCount) {
                if (sheet[layout + 'Count'] === usedRangeCount) {
                    return;
                }
                rowCount = usedRangeCount;
            }
            if (!this.parent.scrollSettings.isFinite) {
                this.parent.setSheetPropertyOnMute(sheet, layout + 'Count', rowCount);
            }
        };
        VirtualScroll.prototype.onVerticalScroll = function (args) {
            var idx = args.cur.idx;
            var height = args.cur.size;
            var prevIdx = args.prev.idx;
            var idxDiff = Math.abs(idx - prevIdx);
            var threshold = this.parent.getThreshold('row');
            if (idxDiff > Math.round(threshold / 2)) {
                var startIdx = void 0;
                var lastIdx = void 0;
                var prevTopIdx = void 0;
                var sheet = this.parent.getActiveSheet();
                if (idx <= threshold) {
                    Eif (!args.increase) {
                        if (this.translateY && prevIdx > threshold) {
                            this.translateY = 0;
                            var frozenCol = this.parent.frozenColCount(sheet);
                            var frozenRow = this.parent.frozenRowCount(sheet);
                            Eif (!args.preventScroll) {
                                var colIndex = frozenCol ? index_5.getCellIndexes(sheet.topLeftCell)[1] : this.parent.viewport.leftIndex;
                                var fIndexes = frozenCol ? [frozenRow, this.parent.viewport.leftIndex + frozenCol] : [];
                                if (idxDiff < this.parent.viewport.rowCount + threshold) {
                                    startIdx = index_4.skipHiddenIdx(sheet, frozenRow, true);
                                    lastIdx = index_4.skipHiddenIdx(sheet, (this.parent.viewport.topIndex + frozenRow) - 1, false);
                                    this.parent.viewport.topIndex = startIdx - frozenRow;
                                    var btmIdx = this.skipHiddenLastIdx(this.parent.viewport.bottomIndex - (((lastIdx - startIdx) + 1) - this.hiddenCount(startIdx, lastIdx)), this.parent.viewport.bottomIndex);
                                    this.parent.viewport.bottomIndex = index_4.skipHiddenIdx(sheet, btmIdx, false);
                                    this.parent.renderModule.refreshUI({
                                        colIndex: colIndex, rowIndex: startIdx, direction: 'last', refresh: 'RowPart',
                                        skipUpdateOnFirst: true, frozenIndexes: fIndexes
                                    }, this.getRowAddress([startIdx, index_4.skipHiddenIdx(sheet, lastIdx, false)]));
                                }
                                else {
                                    var prevColIndex = this.parent.viewport.leftIndex;
                                    this.parent.renderModule.refreshUI({ rowIndex: 0, colIndex: colIndex, refresh: 'Row', skipUpdateOnFirst: true,
                                        frozenIndexes: fIndexes, skipTranslate: true });
                                    if (frozenCol) {
                                        this.parent.viewport.leftIndex = prevColIndex;
                                    }
                                    this.translate({ refresh: 'Row' });
                                }
                                index_2.focus(this.parent.element);
                                idx = 0;
                            }
                            else {
                                this.parent.viewport.topIndex = prevIdx - (threshold - frozenRow);
                            }
                        }
                        this.updateScrollCount(threshold, 'row');
                    }
                }
                if (prevIdx < threshold) {
                    idxDiff = Math.abs(idx - threshold);
                }
                if (!args.increase && this.parent.scrollSettings.isFinite && this.parent.viewport.bottomIndex ===
                    index_4.skipHiddenIdx(sheet, sheet.rowCount - 1, false)) {
                    var frozenRow = this.parent.frozenRowCount(sheet);
                    var thresholdIdx = this.parent.viewport.topIndex + frozenRow + index_4.getRangeIndexes(sheet.paneTopLeftCell)[0] - 1;
                    Eif (idx + frozenRow > thresholdIdx) {
                        args.prev.idx = idx;
                        return;
                    }
                    idxDiff = thresholdIdx - (idx + frozenRow);
                }
                if (idx > threshold) {
                    prevTopIdx = this.parent.viewport.topIndex;
                    this.parent.viewport.topIndex = idx - threshold;
                    Iif (args.increase && prevTopIdx > this.parent.viewport.topIndex) {
                        this.parent.viewport.topIndex = prevTopIdx;
                        return;
                    }
                    var frozenRow = this.parent.frozenRowCount(sheet);
                    if (!args.preventScroll) {
                        var frozenCol = this.parent.frozenColCount(sheet);
                        var colIndex = void 0;
                        var frozenIndexes = [];
                        if (frozenCol) {
                            colIndex = index_5.getCellIndexes(sheet.topLeftCell)[1];
                            frozenIndexes.push(frozenRow);
                            frozenIndexes.push(this.parent.viewport.leftIndex + frozenCol);
                        }
                        else {
                            colIndex = this.parent.viewport.leftIndex;
                        }
                        if (idxDiff < this.parent.viewport.rowCount + threshold) {
                            if (args.increase) {
                                startIdx = this.parent.viewport.bottomIndex + 1;
                                lastIdx = this.parent.viewport.bottomIndex + (this.parent.viewport.topIndex - prevTopIdx);
                                lastIdx -= this.hiddenCount(prevTopIdx + frozenRow, this.parent.viewport.topIndex - 1 + frozenRow);
                                if (lastIdx <= this.parent.viewport.bottomIndex || (this.parent.scrollSettings.isFinite &&
                                    startIdx > index_4.skipHiddenIdx(sheet, sheet.rowCount - 1, false, 'rows'))) {
                                    this.parent.viewport.topIndex = prevTopIdx;
                                    return;
                                }
                                var indexes = this.parent.skipHidden(startIdx, lastIdx, 'rows', false);
                                var finiteProps = this.checkLastIdx(indexes[1], 'row');
                                startIdx = indexes[0];
                                lastIdx = finiteProps.index;
                                var topIdx = this.parent.viewport.topIndex + frozenRow;
                                Iif (finiteProps.diff) {
                                    var diffCount = ((lastIdx - startIdx) + 1) - this.hiddenCount(startIdx, lastIdx);
                                    topIdx = index_4.skipHiddenIdx(sheet, prevTopIdx, true, 'rows', diffCount) + frozenRow;
                                }
                                this.parent.viewport.topIndex = index_4.skipHiddenIdx(sheet, topIdx, !finiteProps.diff) - frozenRow;
                                this.setThresholdHeight(height, idx - this.parent.viewport.topIndex, frozenRow, !!finiteProps.diff, prevTopIdx === index_4.skipHiddenIdx(sheet, frozenRow, true));
                                this.parent.viewport.bottomIndex = lastIdx;
                                this.parent.renderModule.refreshUI({ colIndex: colIndex, rowIndex: startIdx, direction: 'first', refresh: 'RowPart',
                                    frozenIndexes: frozenIndexes }, this.getRowAddress([startIdx, lastIdx]));
                            }
                            else {
                                startIdx = index_4.skipHiddenIdx(sheet, this.parent.viewport.topIndex + frozenRow, false);
                                Iif (startIdx < frozenRow) {
                                    startIdx = frozenRow;
                                    startIdx = index_4.skipHiddenIdx(sheet, startIdx, true);
                                }
                                this.parent.viewport.topIndex = startIdx - frozenRow;
                                lastIdx = index_4.skipHiddenIdx(sheet, (prevTopIdx + frozenRow) - 1, false);
                                Iif (lastIdx < frozenRow || lastIdx < startIdx) {
                                    this.parent.viewport.topIndex = prevTopIdx;
                                    return;
                                }
                                var btmIdx = this.skipHiddenLastIdx(this.parent.viewport.bottomIndex - (((lastIdx - startIdx) + 1) - this.hiddenCount(startIdx, lastIdx)), this.parent.viewport.bottomIndex);
                                this.parent.viewport.bottomIndex = index_4.skipHiddenIdx(sheet, btmIdx, false);
                                this.setThresholdHeight(height, idx - this.parent.viewport.topIndex, frozenRow);
                                this.parent.renderModule.refreshUI({ colIndex: colIndex, rowIndex: startIdx, direction: 'last', refresh: 'RowPart',
                                    frozenIndexes: frozenIndexes }, this.getRowAddress([startIdx, lastIdx]));
                            }
                        }
                        else {
                            prevTopIdx = this.parent.viewport.leftIndex;
                            this.parent.viewport.topIndex = index_4.skipHiddenIdx(sheet, this.parent.viewport.topIndex + frozenRow, false) - frozenRow;
                            Iif (this.parent.viewport.topIndex < 0) {
                                this.parent.viewport.topIndex = index_4.skipHiddenIdx(sheet, frozenRow, true) - frozenRow;
                            }
                            this.parent.renderModule.refreshUI({
                                rowIndex: this.parent.viewport.topIndex, colIndex: colIndex, refresh: 'Row',
                                frozenIndexes: frozenIndexes, skipTranslate: true
                            });
                            if (frozenCol) {
                                this.parent.viewport.leftIndex = prevTopIdx;
                            }
                            this.setThresholdHeight(height, idx - this.parent.viewport.topIndex, frozenRow, this.parent.scrollSettings.isFinite && this.parent.viewport.bottomIndex ===
                                index_4.skipHiddenIdx(sheet, sheet.rowCount - 1, false));
                            this.translate({ refresh: 'Row' });
                        }
                        this.updateScrollCount(idx, 'row', threshold);
                        this.focusSheet();
                    }
                    else {
                        this.setThresholdHeight(height, threshold, frozenRow);
                        this.translate({ refresh: 'Row' });
                    }
                }
                args.prev.idx = idx;
            }
        };
        VirtualScroll.prototype.skipHiddenLastIdx = function (idx, prevIdx, layout) {
            if (layout === void 0) { layout = 'rows'; }
            var sheet = this.parent.getActiveSheet();
            var count = 0;
            for (var i = idx; i <= prevIdx; i++) {
                Iif ((sheet["" + layout])[i] && (sheet["" + layout])[i].hidden) {
                    count++;
                }
            }
            Iif (count) {
                idx = this.skipHiddenLastIdx(idx - count, idx - 1, layout);
            }
            return idx;
        };
        VirtualScroll.prototype.hiddenCount = function (startIdx, endIdx, layout) {
            if (layout === void 0) { layout = 'rows'; }
            var index = 0;
            var sheet = this.parent.getActiveSheet();
            for (var i = startIdx; i <= endIdx; i++) {
                if ((sheet["" + layout])[i] && (sheet["" + layout])[i].hidden) {
                    index++;
                }
            }
            return index;
        };
        VirtualScroll.prototype.checkLastIdx = function (idx, layout) {
            var diff = 0;
            if (this.parent.scrollSettings.isFinite) {
                var sheet = this.parent.getActiveSheet();
                var count = index_4.skipHiddenIdx(sheet, (sheet[layout + 'Count'] - 1), false);
                Iif (idx > count) {
                    diff = idx - count;
                    idx = count;
                }
            }
            return { index: idx, diff: diff };
        };
        VirtualScroll.prototype.onHorizontalScroll = function (args) {
            var idx = args.cur.idx;
            var width = args.cur.size;
            var prevIdx = args.prev.idx;
            var idxDiff = Math.abs(idx - prevIdx);
            var threshold = this.parent.getThreshold('col');
            if (idxDiff > Math.round(threshold / 2)) {
                var startIdx = void 0;
                var endIdx = void 0;
                var prevLeftIdx = void 0;
                var sheet = this.parent.getActiveSheet();
                if (idx <= threshold) {
                    if (!args.increase) {
                        Eif (this.translateX && prevIdx > threshold) {
                            this.translateX = 0;
                            var frozenCol = this.parent.frozenColCount(sheet);
                            var frozenRow = this.parent.frozenRowCount(sheet);
                            Eif (!args.preventScroll) {
                                var rowIndex = frozenRow ? index_5.getCellIndexes(sheet.topLeftCell)[0] : this.parent.viewport.topIndex;
                                var fIndexes = frozenRow ? [this.parent.viewport.topIndex + frozenRow, frozenCol] : [];
                                if (idxDiff < this.parent.viewport.colCount + threshold) {
                                    startIdx = index_4.skipHiddenIdx(sheet, frozenCol, true, 'columns');
                                    endIdx = index_4.skipHiddenIdx(sheet, (this.parent.viewport.leftIndex + frozenCol) - 1, false, 'columns');
                                    this.parent.viewport.leftIndex = startIdx - frozenCol;
                                    var rightIdx = this.skipHiddenLastIdx(this.parent.viewport.rightIndex - (((endIdx - startIdx) + 1) -
                                        this.hiddenCount(startIdx, endIdx, 'columns')), this.parent.viewport.rightIndex, 'columns');
                                    this.parent.viewport.rightIndex = index_4.skipHiddenIdx(sheet, rightIdx, false, 'columns');
                                    this.parent.renderModule.refreshUI({ rowIndex: rowIndex, colIndex: startIdx, direction: 'last', refresh: 'ColumnPart',
                                        skipUpdateOnFirst: true, frozenIndexes: fIndexes }, this.getColAddress([startIdx, index_4.skipHiddenIdx(sheet, endIdx, false, 'columns')]));
                                }
                                else {
                                    var prevRowIndex = this.parent.viewport.topIndex;
                                    this.parent.renderModule.refreshUI({ rowIndex: rowIndex, colIndex: 0, refresh: 'Column', skipUpdateOnFirst: true,
                                        frozenIndexes: fIndexes, skipTranslate: true });
                                    if (frozenRow) {
                                        this.parent.viewport.topIndex = prevRowIndex;
                                    }
                                    this.translate({ refresh: 'Column' });
                                }
                                index_2.focus(this.parent.element);
                                idx = 0;
                            }
                            else {
                                this.parent.viewport.leftIndex = prevIdx - (threshold - frozenCol);
                            }
                        }
                        this.updateScrollCount(threshold, 'col');
                    }
                }
                if (prevIdx < threshold) {
                    idxDiff = Math.abs(idx - threshold);
                }
                Iif (!args.increase && this.parent.scrollSettings.isFinite && this.parent.viewport.rightIndex ===
                    index_4.skipHiddenIdx(sheet, sheet.colCount - 1, false, 'columns')) {
                    var frozenCol = this.parent.frozenColCount(sheet);
                    var thresholdIdx = this.parent.viewport.leftIndex + frozenCol + index_4.getRangeIndexes(sheet.paneTopLeftCell)[1] - 1;
                    thresholdIdx += this.hiddenCount(this.parent.viewport.leftIndex + frozenCol, thresholdIdx);
                    if (idx + frozenCol > thresholdIdx) {
                        args.prev.idx = idx;
                        return;
                    }
                    idxDiff = thresholdIdx - (idx + frozenCol);
                }
                if (idx > threshold) {
                    prevLeftIdx = this.parent.viewport.leftIndex;
                    this.parent.viewport.leftIndex = idx - threshold;
                    Iif (args.increase && prevLeftIdx > this.parent.viewport.leftIndex) {
                        this.parent.viewport.leftIndex = prevLeftIdx;
                        return;
                    }
                    var frozenCol = this.parent.frozenColCount(sheet);
                    if (!args.preventScroll) {
                        var frozenRow = this.parent.frozenRowCount(sheet);
                        var rowIndex = frozenRow ? index_5.getCellIndexes(sheet.topLeftCell)[0] : this.parent.viewport.topIndex;
                        var frozenIndexes = [];
                        if (frozenRow) {
                            frozenIndexes = [frozenRow + this.parent.viewport.topIndex, frozenCol];
                        }
                        if (idxDiff < this.parent.viewport.colCount + threshold) {
                            if (args.increase) {
                                startIdx = this.parent.viewport.rightIndex + 1;
                                endIdx = this.parent.viewport.rightIndex + (this.parent.viewport.leftIndex - prevLeftIdx);
                                endIdx -= this.hiddenCount(prevLeftIdx + frozenCol, this.parent.viewport.leftIndex - 1 + frozenCol, 'columns');
                                Iif (endIdx <= this.parent.viewport.rightIndex || (this.parent.scrollSettings.isFinite &&
                                    startIdx > index_4.skipHiddenIdx(sheet, sheet.colCount - 1, false, 'columns'))) {
                                    this.parent.viewport.leftIndex = prevLeftIdx;
                                    return;
                                }
                                var indexes = this.parent.skipHidden(startIdx, endIdx, 'columns', false);
                                var finiteOffset = this.checkLastIdx(indexes[1], 'col');
                                startIdx = indexes[0];
                                endIdx = finiteOffset.index;
                                this.parent.viewport.leftIndex = index_4.skipHiddenIdx(sheet, (this.parent.viewport.leftIndex - finiteOffset.diff) + frozenCol, !finiteOffset.diff, 'columns') - frozenCol;
                                this.setThresholdWidth(width, idx - this.parent.viewport.leftIndex, frozenCol, !!finiteOffset.diff, prevLeftIdx === index_4.skipHiddenIdx(sheet, frozenCol, true, 'columns'));
                                this.parent.viewport.rightIndex = endIdx;
                                this.parent.renderModule.refreshUI({ rowIndex: rowIndex, colIndex: startIdx, direction: 'first', refresh: 'ColumnPart',
                                    frozenIndexes: frozenIndexes }, this.getColAddress([startIdx, endIdx]));
                            }
                            else {
                                startIdx = index_4.skipHiddenIdx(sheet, this.parent.viewport.leftIndex + frozenCol, false, 'columns');
                                Iif (startIdx < frozenCol) {
                                    startIdx = frozenCol;
                                    startIdx = index_4.skipHiddenIdx(sheet, startIdx, true, 'columns');
                                }
                                this.parent.viewport.leftIndex = startIdx - frozenCol;
                                endIdx = index_4.skipHiddenIdx(sheet, (prevLeftIdx + frozenCol) - 1, false, 'columns');
                                Iif (endIdx < frozenCol || endIdx < startIdx) {
                                    this.parent.viewport.leftIndex = prevLeftIdx;
                                    return;
                                }
                                var rightIdx = this.skipHiddenLastIdx(this.parent.viewport.rightIndex - (((endIdx - startIdx) + 1) -
                                    this.hiddenCount(startIdx, endIdx, 'columns')), this.parent.viewport.rightIndex, 'columns');
                                this.parent.viewport.rightIndex = index_4.skipHiddenIdx(sheet, rightIdx, false, 'columns');
                                this.setThresholdWidth(width, idx - this.parent.viewport.leftIndex, frozenCol);
                                this.parent.renderModule.refreshUI({ rowIndex: rowIndex, colIndex: startIdx, direction: 'last', refresh: 'ColumnPart',
                                    frozenIndexes: frozenIndexes }, this.getColAddress([startIdx, endIdx]));
                            }
                        }
                        else {
                            prevLeftIdx = this.parent.viewport.topIndex;
                            this.parent.viewport.leftIndex = index_4.skipHiddenIdx(sheet, this.parent.viewport.leftIndex + frozenCol, false, 'columns')
                                - frozenCol;
                            Iif (this.parent.viewport.leftIndex < 0) {
                                this.parent.viewport.leftIndex = index_4.skipHiddenIdx(sheet, frozenCol, true, 'columns') - frozenCol;
                            }
                            this.parent.renderModule.refreshUI({
                                rowIndex: rowIndex, colIndex: this.parent.viewport.leftIndex, refresh: 'Column', frozenIndexes: frozenIndexes,
                                skipTranslate: true
                            });
                            if (frozenRow) {
                                this.parent.viewport.topIndex = prevLeftIdx;
                            }
                            this.setThresholdWidth(width, idx - this.parent.viewport.leftIndex, frozenCol, this.parent.scrollSettings.isFinite && this.parent.viewport.rightIndex ===
                                index_4.skipHiddenIdx(sheet, sheet.colCount - 1, false, 'columns'));
                            this.translate({ refresh: 'Column' });
                        }
                        this.updateScrollCount(idx, 'col', threshold);
                        this.focusSheet();
                    }
                    else {
                        this.setThresholdWidth(width, threshold, frozenCol);
                        this.translate({ refresh: 'Column' });
                    }
                }
                args.prev.idx = idx;
            }
        };
        VirtualScroll.prototype.focusSheet = function () {
            if (!document.activeElement.classList.contains('e-text-findNext-short') || !ej2_base_1.closest(document.activeElement, '#' + this.parent.element.id)) {
                index_2.focus(this.parent.element);
            }
        };
        VirtualScroll.prototype.setThresholdHeight = function (scrollHeight, threshold, frozenRow, endReached, isInit) {
            var sheet = this.parent.getActiveSheet();
            var start = this.parent.viewport.topIndex + frozenRow;
            var end = (start + threshold) - 1;
            if (endReached || isInit || end < start) {
                this.translateY = start <= frozenRow ? 0 : index_4.getRowsHeight(sheet, frozenRow, start - 1, true);
            }
            else {
                this.translateY = scrollHeight - index_4.getRowsHeight(sheet, start, end, true);
            }
        };
        VirtualScroll.prototype.setThresholdWidth = function (scrollWidth, threshold, frozenCol, endReached, isInit) {
            var sheet = this.parent.getActiveSheet();
            var start = this.parent.viewport.leftIndex + frozenCol;
            var end = (start + threshold) - 1;
            if (endReached || isInit || end < start) {
                this.translateX = start <= frozenCol ? 0 : index_4.getColumnsWidth(sheet, frozenCol, start - 1, true);
            }
            else {
                this.translateX = scrollWidth - index_4.getColumnsWidth(sheet, start, end, true);
            }
        };
        VirtualScroll.prototype.translate = function (args) {
            if (args.skipTranslate || !this.content) {
                return;
            }
            var translateX = this.translateX || 0;
            translateX = this.parent.enableRtl ? -translateX : translateX;
            if (args.refresh === 'Row' || args.refresh === 'RowPart') {
                this.content.style.transform = "translate(" + translateX + "px, " + this.translateY + "px)";
                this.rowHeader.style.transform = "translate(0px, " + this.translateY + "px)";
            }
            if (args.refresh === 'Column' || args.refresh === 'ColumnPart') {
                this.content.style.transform = "translate(" + translateX + "px, " + this.translateY + "px)";
                this.colHeader.style.transform = "translate(" + translateX + "px, 0px)";
            }
        };
        VirtualScroll.prototype.updateColumnWidth = function (args) {
            if (args.refresh === 'Column') {
                this.content.style.width = '';
                var sheet = this.parent.getActiveSheet();
                var width = index_4.getColumnsWidth(sheet, this.parent.viewport.leftIndex + this.parent.frozenColCount(sheet), this.parent.viewport.rightIndex, true);
                this.colHeader.style.width = width + 'px';
                this.content.style.width = width + 'px';
                if (!this.parent.scrollSettings.isFinite || args.isUpdate) {
                    var scroll_1 = this.parent.element.querySelector('.e-scroller .e-virtualtrack');
                    Iif (!scroll_1) {
                        return;
                    }
                    var scrollWidth = parseInt(scroll_1.style.width, 10);
                    var newWidth = width + this.translateX + this.parent.viewport.beforeFreezeWidth;
                    if (newWidth > scrollWidth) {
                        var diff = newWidth - scrollWidth;
                        scroll_1.style.width = scrollWidth + diff + 'px';
                    }
                    else {
                        var diff = scrollWidth - newWidth;
                        var vTrack = this.parent.getMainContent().getElementsByClassName('e-virtualtrack')[0];
                        if (scrollWidth - diff < parseInt(vTrack.style.width, 10)) {
                            scroll_1.style.width = vTrack.style.width;
                        }
                    }
                }
            }
            else if (!this.parent.scrollSettings.isFinite) {
                var vTrack = this.parent.getMainContent().getElementsByClassName('e-virtualtrack')[0];
                var vTrackHeight = parseInt(vTrack.style.height, 10);
                var height = this.content.getBoundingClientRect().height;
                var newHeight = height + this.translateY + this.parent.viewport.beforeFreezeHeight;
                if (newHeight > vTrackHeight) {
                    var diff = newHeight - vTrackHeight;
                    vTrack.style.height = vTrackHeight + diff + 'px';
                }
                else {
                    var diff = vTrackHeight - newHeight;
                    var hVTrack = this.parent.getRowHeaderContent().getElementsByClassName('e-virtualtrack')[0];
                    Eif (vTrackHeight - diff < parseInt(hVTrack.style.height, 10)) {
                        vTrack.style.height = hVTrack.style.height;
                    }
                }
            }
        };
        VirtualScroll.prototype.updateRowColCount = function (args) {
            if (!this.scroll.length) {
                return;
            }
            var sheet = this.parent.getActiveSheet();
            if (args.update === 'row') {
                if (args.index !== this.scroll[this.parent.activeSheetIndex].rowCount - 1) {
                    var height = this.getVTrackHeight('height');
                    var newHeight = height;
                    if (args.index >= this.scroll[this.parent.activeSheetIndex].rowCount) {
                        if (args.start === undefined) {
                            newHeight += index_4.getRowsHeight(sheet, this.scroll[this.parent.activeSheetIndex].rowCount, args.index, true);
                        }
                        else {
                            newHeight += index_4.getRowsHeight(sheet, args.start, args.end, true);
                        }
                    }
                    else {
                        if (args.start === undefined) {
                            newHeight -= index_4.getRowsHeight(sheet, args.index + 1, this.scroll[this.parent.activeSheetIndex].rowCount - 1, true);
                        }
                        else {
                            newHeight -= index_4.getRowsHeight(sheet, args.start, args.end, true);
                        }
                    }
                    if (!args.isDelete && newHeight < height) {
                        return;
                    }
                    this.scroll[this.parent.activeSheetIndex].rowCount = args.index + 1;
                    this.updateVTrack(this.rowHeader, newHeight, 'height');
                    if (this.scroll[this.parent.activeSheetIndex].rowCount > sheet.rowCount) {
                        this.parent.setSheetPropertyOnMute(sheet, 'rowCount', this.scroll[this.parent.activeSheetIndex].rowCount);
                    }
                }
            }
            else {
                if (args.index !== this.scroll[this.parent.activeSheetIndex].colCount - 1) {
                    var width = this.getVTrackHeight('width');
                    var newWidth = width;
                    if (args.index >= this.scroll[this.parent.activeSheetIndex].colCount) {
                        Iif (args.start === undefined) {
                            newWidth += index_4.getColumnsWidth(sheet, this.scroll[this.parent.activeSheetIndex].colCount, args.index, true);
                        }
                        else {
                            newWidth += index_4.getColumnsWidth(sheet, args.start, args.end, true);
                        }
                    }
                    else {
                        if (args.start === undefined) {
                            newWidth -= index_4.getColumnsWidth(sheet, args.index + 1, this.scroll[this.parent.activeSheetIndex].colCount - 1, true);
                        }
                        else {
                            newWidth -= index_4.getColumnsWidth(sheet, args.start, args.end, true);
                        }
                    }
                    if (!args.isDelete && newWidth < width) {
                        return;
                    }
                    this.scroll[this.parent.activeSheetIndex].colCount = args.index + 1;
                    this.updateVTrack(this.colHeader, newWidth, 'width');
                    if (this.scroll[this.parent.activeSheetIndex].colCount > sheet.colCount) {
                        this.parent.setSheetPropertyOnMute(sheet, 'colCount', this.scroll[this.parent.activeSheetIndex].colCount);
                    }
                }
            }
        };
        VirtualScroll.prototype.getVTrackHeight = function (str) {
            var height = this.content.nextElementSibling.style["" + str];
            Iif (height.includes('e+')) {
                height = height.split('px')[0];
                var heightArr = height.split('e+');
                return Number(heightArr[0]) * Math.pow(10, Number(heightArr[1]));
            }
            else {
                return parseFloat(height);
            }
        };
        VirtualScroll.prototype.updateVTrackHeight = function (args) {
            var frozenRow = this.parent.frozenRowCount(this.parent.getActiveSheet());
            if (args.rowIdx < this.scroll[this.parent.activeSheetIndex].rowCount) {
                this.updateVTrack(this.rowHeader, this.getVTrackHeight('height') + args.threshold, 'height');
            }
            if (args.rowIdx >= frozenRow && args.rowIdx < this.parent.scrollModule.offset.top.idx) {
                var mainPanel = this.parent.element.getElementsByClassName('e-main-panel')[0];
                this.parent.scrollModule.prevScroll.scrollTop = mainPanel.scrollTop + args.threshold;
                mainPanel.scrollTop += args.threshold;
                this.parent.scrollModule.offset.top.size += args.threshold;
                if (args.rowIdx < this.parent.viewport.topIndex + frozenRow) {
                    this.translateY += args.threshold;
                    this.translate({ refresh: 'Row' });
                }
            }
        };
        VirtualScroll.prototype.updateVTrackWidth = function (args) {
            Iif (index_4.isHiddenCol(this.parent.getActiveSheet(), args.colIdx)) {
                return;
            }
            var frozenCol = this.parent.frozenColCount(this.parent.getActiveSheet());
            if (args.colIdx >= this.parent.viewport.leftIndex + frozenCol && args.colIdx <= this.parent.viewport.rightIndex) {
                var hdrVTrack = this.parent.getColumnHeaderContent().getElementsByClassName('e-virtualtrack')[0];
                hdrVTrack.style.width = parseFloat(hdrVTrack.style.width) + args.threshold + 'px';
                var cntVTrack = this.parent.getMainContent().getElementsByClassName('e-virtualtrack')[0];
                cntVTrack.style.width = parseFloat(cntVTrack.style.width) + args.threshold + 'px';
                var scrollVTrack = this.parent.getScrollElement().getElementsByClassName('e-virtualtrack')[0];
                scrollVTrack.style.width = parseFloat(scrollVTrack.style.width) + args.threshold + 'px';
                var hdrColumn = this.parent.getColumnHeaderContent().getElementsByClassName('e-virtualable')[0];
                hdrColumn.style.width = parseFloat(hdrColumn.style.width) + args.threshold + 'px';
                var cntColumn = this.parent.getMainContent().getElementsByClassName('e-virtualable')[0];
                cntColumn.style.width = parseFloat(cntColumn.style.width) + args.threshold + 'px';
            }
            else Iif (args.colIdx >= frozenCol && args.colIdx < this.parent.viewport.leftIndex + frozenCol) {
                this.parent.scrollModule.offset.left.size += args.threshold;
                this.translateX += args.threshold;
                this.translate({ refresh: 'Column' });
            }
        };
        VirtualScroll.prototype.updateVTrack = function (header, size, sizeStr) {
            header.nextElementSibling.style["" + sizeStr] = size + "px";
            this.content.nextElementSibling.style["" + sizeStr] = size + "px";
            if (sizeStr === 'width' && this.parent.allowScrolling) {
                this.parent.getScrollElement().firstElementChild.style.width = size + "px";
            }
        };
        VirtualScroll.prototype.deInitProps = function () {
            this.parent.viewport.leftIndex = null;
            this.parent.viewport.topIndex = null;
            this.parent.viewport.bottomIndex = null;
            this.translateX = null;
            this.translateY = null;
        };
        VirtualScroll.prototype.updateScrollProps = function (args) {
            var _this = this;
            Iif (args === void 0) { args = { sheetIndex: 0, sheets: this.parent.sheets }; }
            if (this.scroll.length === 0) {
                this.initScroll();
            }
            else {
                args.sheets.forEach(function () { _this.scroll.splice(args.sheetIndex, 0, { rowCount: 0, colCount: 0 }); });
            }
        };
        VirtualScroll.prototype.sliceScrollProps = function (args) {
            if (ej2_base_1.isNullOrUndefined(args.sheetIndex)) {
                this.scroll.length = 0;
            }
            else {
                this.scroll.splice(args.sheetIndex, 1);
            }
        };
        VirtualScroll.prototype.updateTranslate = function (args) {
            Eif (args.height) {
                if (args.isRender) {
                    this.translateY -= args.height;
                }
                else {
                    var height = parseInt(this.parent.getMainContent().getElementsByClassName('e-virtualtrack')[0].style.height, 10);
                    if (args.isHide) {
                        this.updateVTrack(this.rowHeader, height - args.height, 'height');
                        this.setThresholdHeight(this.translateY, ((args.prevSize - 1) - this.parent.viewport.topIndex) + 1, this.parent.frozenRowCount(this.parent.getActiveSheet()));
                    }
                    else {
                        this.updateVTrack(this.rowHeader, height + args.height, 'height');
                        this.translateY = this.translateY + args.size;
                    }
                }
                this.translate({ refresh: 'Row' });
            }
            Iif (args.width) {
                this.translateX -= args.width;
                this.translate({ refresh: 'Column' });
            }
        };
        VirtualScroll.prototype.addEventListener = function () {
            this.parent.on(index_1.beforeContentLoaded, this.createVirtualElement, this);
            this.parent.on(index_1.beforeVirtualContentLoaded, this.translate, this);
            this.parent.on(index_1.virtualContentLoaded, this.updateColumnWidth, this);
            this.parent.on(index_2.updateTableWidth, this.updateColumnWidth, this);
            this.parent.on(index_3.onVerticalScroll, this.onVerticalScroll, this);
            this.parent.on(index_3.onHorizontalScroll, this.onHorizontalScroll, this);
            this.parent.on(index_5.updateRowColCount, this.updateRowColCount, this);
            this.parent.on(index_3.rowHeightChanged, this.updateVTrackHeight, this);
            this.parent.on(index_2.colWidthChanged, this.updateVTrackWidth, this);
            this.parent.on(index_3.deInitProperties, this.deInitProps, this);
            this.parent.on(index_5.sheetsDestroyed, this.sliceScrollProps, this);
            this.parent.on(index_5.sheetCreated, this.updateScrollProps, this);
            this.parent.on(index_2.updateTranslate, this.updateTranslate, this);
            this.parent.on(index_1.spreadsheetDestroyed, this.destroy, this);
        };
        VirtualScroll.prototype.destroy = function () {
            this.removeEventListener();
            var noteIndicatorElement = document.querySelectorAll('.e-addNoteIndicator');
            Eif (noteIndicatorElement) {
                noteIndicatorElement.forEach(function (element) {
                    element.remove();
                });
            }
            if (this.rowHeader) {
                index_1.removeAllChildren(this.rowHeader);
                this.rowHeader.remove();
            }
            if (this.colHeader) {
                index_1.removeAllChildren(this.colHeader);
                this.colHeader.remove();
            }
            if (this.content) {
                index_1.removeAllChildren(this.content);
                this.content.remove();
            }
            this.rowHeader = null;
            this.colHeader = null;
            this.content = null;
            this.parent = null;
            this.scroll.length = 0;
            this.translateX = null;
            this.translateY = null;
        };
        VirtualScroll.prototype.removeEventListener = function () {
            this.parent.off(index_1.beforeContentLoaded, this.createVirtualElement);
            this.parent.off(index_1.beforeVirtualContentLoaded, this.translate);
            this.parent.off(index_1.virtualContentLoaded, this.updateColumnWidth);
            this.parent.off(index_2.updateTableWidth, this.updateColumnWidth);
            this.parent.off(index_3.onVerticalScroll, this.onVerticalScroll);
            this.parent.off(index_3.onHorizontalScroll, this.onHorizontalScroll);
            this.parent.off(index_5.updateRowColCount, this.updateRowColCount);
            this.parent.off(index_3.rowHeightChanged, this.updateVTrackHeight);
            this.parent.off(index_2.colWidthChanged, this.updateVTrackWidth);
            this.parent.off(index_5.sheetsDestroyed, this.sliceScrollProps);
            this.parent.off(index_5.sheetCreated, this.updateScrollProps);
            this.parent.off(index_2.updateTranslate, this.updateTranslate);
            this.parent.off(index_1.spreadsheetDestroyed, this.destroy);
        };
        return VirtualScroll;
    }());
    exports.VirtualScroll = VirtualScroll;
});