all files / grid/renderer/ virtual-footer-renderer.js

100% Statements 56/56
90.48% Branches 19/21
100% Functions 16/16
100% Lines 52/52
11 statements, 6 functions, 9 branches Ignored     
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                                             
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "../base/constant", "./footer-renderer", "./virtual-content-renderer", "../services/virtual-row-model-generator", "../base/util"], function (require, exports, constant_1, footer_renderer_1, virtual_content_renderer_1, virtual_row_model_generator_1, util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var VirtualFooterRenderer = (function (_super) {
        __extends(VirtualFooterRenderer, _super);
        function VirtualFooterRenderer(parent, serviceLocator) {
            var _this = _super.call(this, parent, serviceLocator) || this;
            _this.virtualElement = new virtual_content_renderer_1.VirtualElementHandler();
            _this.rowModelGenerator = new virtual_row_model_generator_1.VirtualRowModelGenerator(_this.parent);
            _this.parent.on(constant_1.refreshVirtualBlock, function (e) { return e.virtualInfo.sentinelInfo.axis === 'X' ? _this.refresh() : null; }, _this);
            return _this;
        }
        VirtualFooterRenderer.prototype.renderPanel = function () {
            _super.prototype.renderPanel.call(this);
        };
        VirtualFooterRenderer.prototype.renderTable = function () {
            this.rowModelGenerator.refreshColOffsets();
            var contentElement = this.getPanel().querySelector('.e-summarycontent');
            if (contentElement) {
                this.parent.setColumnIndexesInView(this.rowModelGenerator.getColumnIndexes(contentElement));
                _super.prototype.renderTable.call(this);
                var footerTable = this.getTable();
                this.virtualElement.table = footerTable;
                this.virtualElement.content = contentElement;
                this.virtualElement.content.style.position = 'relative';
                this.virtualElement.renderWrapper();
                this.virtualElement.renderPlaceHolder('absolute');
            }
        };
        VirtualFooterRenderer.prototype.refresh = function (e) {
            this.rowModelGenerator.refreshColOffsets();
            var contentElement = this.getPanel().querySelector('.e-summarycontent');
            if (contentElement) {
                this.parent.setColumnIndexesInView(this.rowModelGenerator.getColumnIndexes(contentElement));
                _super.prototype.refresh.call(this, e);
            }
        };
        VirtualFooterRenderer.prototype.updateColGroup = function () {
            if (this.getColGroup()) {
                var colGroup = this.getHeaderColGroup();
                this.getTable().replaceChild(colGroup, this.getColGroup());
                this.setColGroup(colGroup);
            }
        };
        VirtualFooterRenderer.prototype.addEventListener = function () {
            this.evtHandlers = [
                { event: constant_1.columnWidthChanged, handler: _super.prototype.onWidthChange },
                { event: constant_1.columnVisibilityChanged, handler: _super.prototype.columnVisibilityChanged },
                { event: constant_1.refreshFooterRenderer, handler: _super.prototype.refreshFooterRenderer },
                { event: constant_1.colGroupRefresh, handler: this.updateColGroup }
            ];
            util_1.addRemoveEventListener(this.parent, this.evtHandlers, true, this);
        };
        VirtualFooterRenderer.prototype.removeEventListener = function () {
            util_1.addRemoveEventListener(this.parent, this.evtHandlers, false);
        };
        return VirtualFooterRenderer;
    }(footer_renderer_1.FooterRenderer));
    exports.VirtualFooterRenderer = VirtualFooterRenderer;
});