all files / common/actions/ common.js

92.86% Statements 39/42
75% Branches 12/16
87.5% Functions 7/8
92.86% Lines 39/42
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   110× 110× 110×       728× 110×                             110×     618× 618×   618× 618×   618× 618× 618× 618× 618× 618× 618×   728×   110×     110× 110×   112×     112× 112×   112× 112× 110× 110×          
define(["require", "exports", "../../common/base/constant", "../../common/base/pivot-common", "@syncfusion/ej2-base"], function (require, exports, events, pivot_common_1, ej2_base_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Common = (function () {
        function Common(parent) {
            this.parent = parent;
            this.parent.commonModule = this;
            this.addEventListener();
        }
        Common.prototype.getModuleName = function () {
            return 'common';
        };
        Common.prototype.initiateCommonModule = function () {
            if (!this.parent.pivotCommon) {
                var args = {
                    pivotEngine: this.parent.dataType === 'olap' ? this.parent.olapEngineModule : this.parent.engineModule,
                    dataSourceSettings: this.parent.dataSourceSettings.properties ?
                        this.parent.dataSourceSettings.properties : this.parent.dataSourceSettings,
                    id: this.parent.element.id,
                    element: this.parent.element,
                    moduleName: this.parent.getModuleName(),
                    enableRtl: this.parent.enableRtl,
                    enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
                    isAdaptive: ej2_base_1.Browser.isDevice,
                    renderMode: 'Popup',
                    localeObj: this.parent.localeObj,
                    dataType: this.parent.dataType,
                    cssClass: this.parent.cssClass
                };
                this.parent.pivotCommon = new pivot_common_1.PivotCommon(args);
            }
            else {
                this.parent.pivotCommon.element = this.parent.element;
                this.parent.pivotCommon.engineModule = this.parent.dataType === 'olap' ?
                    this.parent.olapEngineModule : this.parent.engineModule;
                this.parent.pivotCommon.parentID = this.parent.element.id;
                this.parent.pivotCommon.dataSourceSettings = this.parent.dataSourceSettings.properties ?
                    this.parent.dataSourceSettings.properties : this.parent.dataSourceSettings;
                this.parent.pivotCommon.moduleName = this.parent.getModuleName();
                this.parent.pivotCommon.enableRtl = this.parent.enableRtl;
                this.parent.pivotCommon.isAdaptive = ej2_base_1.Browser.isDevice;
                this.parent.pivotCommon.renderMode = 'Popup';
                this.parent.pivotCommon.localeObj = this.parent.localeObj;
                this.parent.pivotCommon.dataType = this.parent.dataType;
                this.parent.pivotCommon.cssClass = this.parent.cssClass;
            }
            this.parent.pivotCommon.control = this.parent;
        };
        Common.prototype.addEventListener = function () {
            Iif (this.parent.isDestroyed) {
                return;
            }
            this.parent.on(events.initialLoad, this.initiateCommonModule, this);
            this.parent.on(events.uiUpdate, this.initiateCommonModule, this);
        };
        Common.prototype.removeEventListener = function () {
            Iif (this.parent.isDestroyed) {
                return;
            }
            this.parent.off(events.initialLoad, this.initiateCommonModule);
            this.parent.off(events.uiUpdate, this.initiateCommonModule);
        };
        Common.prototype.destroy = function () {
            this.removeEventListener();
            if (this.parent.pivotCommon) {
                this.parent.pivotCommon.destroy();
                this.parent.pivotCommon = null;
            }
        };
        return Common;
    }());
    exports.Common = Common;
});