all files / pivotfieldlist/base/ field-list.js

91.72% Statements 266/290
82.58% Branches 147/178
94.59% Functions 35/37
91.55% Lines 260/284
5 statements, 2 functions, 11 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 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    26× 26× 26×       517× 517× 517× 517×     63× 63× 63× 63× 63× 63× 63× 63×   88× 88× 21×   88×   67× 67× 67× 67×                                                                                                                                                                                                                                                       67× 67× 67× 67×   111×   111× 111×   111× 111×               111×   67× 67× 67× 67× 67×     58×   67×     64×   67×   67×     67× 67×   69× 20×   49× 47×     20666×   18× 18× 18× 18×     10×       10× 10×   18× 10×       32× 32× 32× 32×             32× 32× 32×       32× 32× 32× 32× 32× 32×       67× 67× 32×     32× 32×       35× 35×     1007514× 1007514× 1007514×             77× 77×   77× 77×   77× 77×                     77× 77× 77×     241× 241× 241× 241× 964× 964× 1402× 1402× 1402× 148×     1254×                     241×   91× 91× 10×   91× 91× 79× 79× 79× 79× 79×   79× 79× 79× 79× 79× 79×                                     79×   78×     12× 12×   90×         90× 90× 90× 90× 90× 90× 90× 90× 37×   90× 78× 12× 12×   78×   12×       90× 90× 80×     10×       163× 163× 163× 163× 163× 163× 163×   163× 163× 163× 163× 163× 162×   163× 163×           98× 28× 28× 28× 28× 28×                 69× 67× 67×   67× 67×   67×     67× 67× 67× 67× 67× 67× 43× 43×   43× 41×                                                                                
/* 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 __());
    };
})();
/* istanbul ignore next */ 
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    Iif (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) Eif (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../../base/engine", "../../common/base/constant", "../../common/base/css-constant", "../../common/base/pivot-common", "../renderer/renderer", "../../pivotview/model/datasourcesettings", "@syncfusion/ej2-popups", "../../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_data_1, engine_1, events, cls, pivot_common_1, renderer_1, datasourcesettings_1, ej2_popups_1, util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PivotFieldList = (function (_super) {
        __extends(PivotFieldList, _super);
        function PivotFieldList(options, element) {
            var _this = _super.call(this, options, element) || this;
            _this.isRequiredUpdate = true;
            _this.lastSortInfo = {};
            _this.lastFilterInfo = {};
            _this.lastAggregationInfo = {};
            _this.lastCalcFieldInfo = {};
            _this.engineModule = new engine_1.PivotEngine();
            return _this;
        }
        PivotFieldList.prototype.requiredModules = function () {
            var modules = [];
            if (this.allowCalculatedField) {
                modules.push({ args: [this], member: 'calculatedfield' });
            }
            return modules;
        };
        PivotFieldList.prototype.preRender = function () {
            this.isAdaptive = ej2_base_2.Browser.isDevice;
            this.globalize = new ej2_base_1.Internationalization(this.locale);
            this.renderModule = new renderer_1.Render(this);
            this.defaultLocale = {
                staticFieldList: 'Pivot Field List',
                fieldList: 'Field List',
                dropFilterPrompt: 'Drop filter here',
                dropColPrompt: 'Drop column here',
                dropRowPrompt: 'Drop row here',
                dropValPrompt: 'Drop value here',
                addPrompt: 'Add field here',
                adaptiveFieldHeader: 'Choose field',
                centerHeader: 'Drag fields between axes below:',
                add: 'add',
                drag: 'Drag',
                filter: 'Filter',
                filtered: 'Filtered',
                sort: 'Sort',
                remove: 'Remove',
                filters: 'Filters',
                rows: 'Rows',
                columns: 'Columns',
                values: 'Values',
                calculatedField: 'Calculated Field',
                createCalculatedField: 'Create Calculated Field',
                fieldName: 'Enter the field name',
                error: 'Error',
                invalidFormula: 'Invalid formula.',
                dropText: 'Example: ("Sum(Order_Count)" + "Sum(In_Stock)") * 250',
                dropTextMobile: 'Add fields and edit formula here.',
                dropAction: 'Calculated field cannot be place in any other region except value axis.',
                search: 'Search',
                close: 'Close',
                cancel: 'Cancel',
                delete: 'Delete',
                alert: 'Alert',
                warning: 'Warning',
                ok: 'OK',
                sum: 'Sum',
                average: 'Average',
                count: 'Count',
                min: 'Min',
                max: 'Max',
                allFields: 'All Fields',
                formula: 'Formula',
                fieldExist: 'A field already exists in this name. Please enter a different name.',
                confirmText: 'A calculation field already exists in this name. Do you want to replace it?',
                noMatches: 'No matches',
                format: 'Summaries values by',
                edit: 'Edit',
                clear: 'Clear',
                formulaField: 'Drag and drop fields to formula',
                dragField: 'Drag field to formula',
                clearFilter: 'Clear',
                by: 'by',
                enterValue: 'Enter value',
                chooseDate: 'Enter date',
                all: 'All',
                multipleItems: 'Multiple items',
                Equals: 'Equals',
                DoesNotEquals: 'Does Not Equal',
                BeginWith: 'Begins With',
                DoesNotBeginWith: 'Does Not Begin With',
                EndsWith: 'Ends With',
                DoesNotEndsWith: 'Does Not End With',
                Contains: 'Contains',
                DoesNotContains: 'Does Not Contain',
                GreaterThan: 'Greater Than',
                GreaterThanOrEqualTo: 'Greater Than Or Equal To',
                LessThan: 'Less Than',
                LessThanOrEqualTo: 'Less Than Or Equal To',
                Between: 'Between',
                NotBetween: 'Not Between',
                Before: 'Before',
                BeforeOrEqualTo: 'Before Or Equal To',
                After: 'After',
                AfterOrEqualTo: 'After Or Equal To',
                member: 'Member',
                label: 'Label',
                date: 'Date',
                value: 'Value',
                labelTextContent: 'Show the items for which the label',
                dateTextContent: 'Show the items for which the date',
                valueTextContent: 'Show the items for which',
                And: 'and',
                Sum: 'Sum',
                Count: 'Count',
                DistinctCount: 'Distinct Count',
                Product: 'Product',
                Avg: 'Avg',
                Min: 'Min',
                Max: 'Max',
                Index: 'Index',
                SampleStDev: 'Sample StDev',
                PopulationStDev: 'Population StDev',
                SampleVar: 'Sample Var',
                PopulationVar: 'Population Var',
                RunningTotals: 'Running Totals',
                DifferenceFrom: 'Difference From',
                PercentageOfDifferenceFrom: '% of Difference From',
                PercentageOfGrandTotal: '% of Grand Total',
                PercentageOfColumnTotal: '% of Column Total',
                PercentageOfRowTotal: '% of Row Total',
                PercentageOfParentTotal: '% of Parent Total',
                PercentageOfParentColumnTotal: '% of Parent Column Total',
                PercentageOfParentRowTotal: '% of Parent Row Total',
                Years: 'Years',
                Quarters: 'Quarters',
                Months: 'Months',
                Days: 'Days',
                Hours: 'Hours',
                Minutes: 'Minutes',
                Seconds: 'Seconds',
                apply: 'APPLY',
                valueFieldSettings: 'Value field settings',
                sourceName: 'Field name :',
                sourceCaption: 'Field caption :',
                summarizeValuesBy: 'Summarize values by :',
                baseField: 'Base field :',
                baseItem: 'Base item :',
                example: 'e.g:',
                editorDataLimitMsg: ' more items. Search to refine further.',
                deferLayoutUpdate: 'Defer Layout Update',
                null: 'null',
                undefined: 'undefined',
                groupOutOfRange: 'Out of Range'
            };
            this.localeObj = new ej2_base_2.L10n(this.getModuleName(), this.defaultLocale, this.locale);
            this.isDragging = false;
            this.captionData = [];
            this.wireEvent();
        };
        PivotFieldList.prototype.frameCustomProperties = function () {
            if (this.pivotGridModule) {
                this.pivotGridModule.updatePageSettings(false);
            }
            var pageSettings = this.pivotGridModule ? this.pivotGridModule.pageSettings : undefined;
            var isDrillThrough = this.pivotGridModule ?
                (this.pivotGridModule.allowDrillThrough || this.pivotGridModule.editSettings.allowEditing) : true;
            var enableValueSorting = this.pivotGridModule ? this.pivotGridModule.enableValueSorting : undefined;
            var customProperties = {
                mode: '',
                savedFieldList: undefined,
                pageSettings: pageSettings,
                enableValueSorting: enableValueSorting,
                isDrillThrough: isDrillThrough,
                localeObj: this.localeObj
            };
            return customProperties;
        };
        PivotFieldList.prototype.render = function () {
            var _this = this;
            this.trigger(events.load, { dataSourceSettings: this.dataSourceSettings }, function (observedArgs) {
                _this.dataSourceSettings = observedArgs.dataSourceSettings;
                ej2_base_2.addClass([_this.element], cls.ROOT);
                if (_this.enableRtl) {
                    ej2_base_2.addClass([_this.element], cls.RTL);
                }
                else {
                    ej2_base_3.removeClass([_this.element], cls.RTL);
                }
                if (_this.isAdaptive) {
                    ej2_base_2.addClass([_this.element], cls.DEVICE);
                }
                else {
                    ej2_base_3.removeClass([_this.element], cls.DEVICE);
                }
                if (_this.cssClass) {
                    ej2_base_2.addClass([_this.element], _this.cssClass);
                }
                _this.notify(events.initialLoad, {});
            });
        };
        PivotFieldList.prototype.wireEvent = function () {
            this.on(events.initialLoad, this.generateData, this);
            this.on(events.dataReady, this.fieldListRender, this);
        };
        PivotFieldList.prototype.unWireEvent = function () {
            if (this.pivotGridModule && this.pivotGridModule.isDestroyed) {
                return;
            }
            this.off(events.initialLoad, this.generateData);
            this.off(events.dataReady, this.fieldListRender);
        };
        PivotFieldList.prototype.getPersistData = function () {
            var keyEntity = ['dataSourceSettings'];
            return this.addOnPersist(keyEntity);
        };
        PivotFieldList.prototype.getModuleName = function () {
            return 'pivotfieldlist';
        };
        PivotFieldList.prototype.onPropertyChanged = function (newProp, oldProp) {
            var requireRefresh = false;
            for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
                var prop = _a[_i];
                switch (prop) {
                    case 'locale':
                        this.refresh();
                        break;
                    case 'enableRtl':
                        if (this.enableRtl) {
                            ej2_base_2.addClass([this.element], cls.RTL);
                        }
                        else {
                            ej2_base_3.removeClass([this.element], cls.RTL);
                        }
                        requireRefresh = true;
                        break;
                }
                if (requireRefresh) {
                    this.fieldListRender();
                }
            }
        };
        PivotFieldList.prototype.initEngine = function () {
            var _this = this;
            this.trigger(events.enginePopulating, { dataSourceSettings: this.dataSourceSettings }, function (observedArgs) {
                _this.dataSourceSettings = observedArgs.dataSourceSettings;
                Iif (_this.dataSourceSettings.groupSettings && _this.dataSourceSettings.groupSettings.length > 0) {
                    var pivotDataSet = _this.dataSourceSettings.dataSource;
                    _this.clonedDataSet = _this.clonedDataSet ? _this.clonedDataSet : util_1.PivotUtil.getClonedData(pivotDataSet);
                    _this.setProperties({ dataSourceSettings: { dataSource: [] } }, true);
                    _this.clonedReport = _this.clonedReport ? _this.clonedReport : ej2_base_1.extend({}, _this.dataSourceSettings, null, true);
                    _this.setProperties({ dataSourceSettings: { dataSource: pivotDataSet } }, true);
                }
                _this.engineModule.renderEngine(_this.dataSourceSettings, _this.frameCustomProperties(), _this.getValueCellInfo.bind(_this));
                _this.pivotFieldList = _this.engineModule.fieldList;
                var eventArgs = {
                    pivotFieldList: _this.pivotFieldList,
                    pivotValues: _this.engineModule.pivotValues
                };
                var this$ = _this;
                _this.trigger(events.enginePopulated, eventArgs, function (observedArgs) {
                    this$.pivotFieldList = observedArgs.pivotFieldList;
                    this$.engineModule.pivotValues = observedArgs.pivotValues;
                    this$.notify(events.dataReady, {});
                    this$.trigger(events.dataBound);
                });
            });
        };
        PivotFieldList.prototype.generateData = function () {
            this.pivotFieldList = {};
            if (this.dataSourceSettings && this.dataSourceSettings.dataSource) {
                Iif (this.dataSourceSettings.dataSource instanceof ej2_data_1.DataManager) {
                    setTimeout(this.getData.bind(this), 100);
                }
                else Eif (this.dataSourceSettings.dataSource.length > 0) {
                    this.initEngine();
                }
            }
            else {
                this.notify(events.dataReady, {});
                this.trigger(events.dataBound);
            }
        };
        PivotFieldList.prototype.getValueCellInfo = function (aggregateObj) {
            var args = aggregateObj;
            this.trigger(events.aggregateCellInfo, args);
            return args;
        };
        PivotFieldList.prototype.getData = function () {
            this.dataSourceSettings.dataSource.executeQuery(new ej2_data_1.Query()).then(this.executeQuery.bind(this));
        };
        PivotFieldList.prototype.executeQuery = function (e) {
            this.setProperties({ dataSourceSettings: { dataSource: e.result } }, true);
            this.initEngine();
        };
        PivotFieldList.prototype.fieldListRender = function () {
            this.element.innerHTML = '';
            if (this.renderMode === 'Popup' && this.dialogRenderer.fieldListDialog && !this.dialogRenderer.fieldListDialog.isDestroyed) {
                this.dialogRenderer.fieldListDialog.destroy();
                ej2_base_2.remove(document.getElementById(this.element.id + '_Wrapper'));
            }
            this.renderModule.render();
            this.fieldListSpinnerElement = this.renderMode === 'Popup' ?
                this.dialogRenderer.fieldListDialog.element : this.element.querySelector('.e-pivotfieldlist-wrapper');
            ej2_popups_1.createSpinner({ target: this.fieldListSpinnerElement }, this.createElement);
            var args = {
                pivotEngine: this.engineModule,
                dataSourceSettings: this.dataSourceSettings,
                id: this.element.id,
                element: document.getElementById(this.element.id + '_Wrapper'),
                moduleName: this.getModuleName(),
                enableRtl: this.enableRtl,
                isAdaptive: this.isAdaptive,
                renderMode: this.renderMode,
                localeObj: this.localeObj
            };
            this.pivotCommon = new pivot_common_1.PivotCommon(args);
            this.pivotCommon.control = this;
            if (this.allowDeferLayoutUpdate) {
                this.clonedDataSource = ej2_base_1.extend({}, this.dataSourceSettings, null, true);
                this.clonedFieldList = ej2_base_1.extend({}, this.pivotFieldList, null, true);
            }
        };
        PivotFieldList.prototype.getFieldCaption = function (dataSource) {
            this.getFields(dataSource);
            Eif (this.captionData.length > 0) {
                var lnt = this.captionData.length;
                while (lnt--) {
                    Eif (this.captionData[lnt]) {
                        for (var _i = 0, _a = this.captionData[lnt]; _i < _a.length; _i++) {
                            var obj = _a[_i];
                            Eif (obj) {
                                if (this.engineModule.fieldList[obj.name] && obj.caption) {
                                    this.engineModule.fieldList[obj.name].caption = obj.caption;
                                }
                                else {
                                    this.engineModule.fieldList[obj.name].caption = obj.name;
                                }
                            }
                        }
                    }
                }
            }
            else {
                return;
            }
        };
        PivotFieldList.prototype.getFields = function (dataSource) {
            this.captionData = [dataSource.rows, dataSource.columns, dataSource.values, dataSource.filters];
        };
        PivotFieldList.prototype.updateDataSource = function (isTreeViewRefresh, isEngineRefresh) {
            var _this = this;
            if (this.pivotGridModule) {
                ej2_popups_1.showSpinner(this.pivotGridModule.element);
            }
            ej2_popups_1.showSpinner(this.fieldListSpinnerElement);
            if (ej2_base_3.isNullOrUndefined(isEngineRefresh)) {
                var pageSettings = this.pivotGridModule ? this.pivotGridModule.pageSettings : undefined;
                var customProperties = this.frameCustomProperties();
                customProperties.savedFieldList = this.pivotFieldList;
                var lastSortInfo = this.pivotGridModule ? this.pivotGridModule.lastSortInfo : this.lastSortInfo;
                if (this.pivotGridModule) {
                    this.pivotGridModule.lastSortInfo = {};
                }
                this.lastSortInfo = {};
                var isAggChange = Object.keys(this.lastAggregationInfo).length > 0 ? true : false;
                var isCalcChange = Object.keys(this.lastCalcFieldInfo).length > 0 ? true : false;
                var isSorted = Object.keys(lastSortInfo).length > 0 ? true : false;
                var isFiltered = Object.keys(this.lastFilterInfo).length > 0 ? true : false;
                Iif (pageSettings && (isSorted || isFiltered || isAggChange || isCalcChange)) {
                    if (isSorted) {
                        this.pivotGridModule.setProperties({ dataSourceSettings: { valueSortSettings: { headerText: '' } } }, true);
                        this.engineModule.onSort(lastSortInfo);
                    }
                    if (isFiltered) {
                        this.engineModule.onFilter(this.lastFilterInfo, this.dataSourceSettings);
                        this.lastFilterInfo = {};
                    }
                    if (isAggChange) {
                        this.engineModule.onAggregation(this.lastAggregationInfo);
                        this.lastAggregationInfo = {};
                    }
                    if (isCalcChange) {
                        this.engineModule.onCalcOperation(this.lastCalcFieldInfo);
                        this.lastCalcFieldInfo = {};
                    }
                }
                else {
                    this.engineModule.renderEngine(this.dataSourceSettings, customProperties, this.getValueCellInfo.bind(this));
                }
                this.getFieldCaption(this.dataSourceSettings);
            }
            else {
                this.axisFieldModule.render();
                this.isRequiredUpdate = false;
            }
            var eventArgs = {
                dataSourceSettings: this.dataSourceSettings,
                pivotFieldList: this.pivotFieldList,
                pivotValues: this.engineModule.pivotValues
            };
            this.trigger(events.enginePopulated, eventArgs, function (observedArgs) {
                _this.dataSourceSettings = observedArgs.dataSourceSettings;
                _this.pivotFieldList = observedArgs.pivotFieldList;
                _this.engineModule.pivotValues = observedArgs.pivotValues;
                _this.pivotCommon.engineModule = _this.engineModule;
                _this.pivotCommon.dataSourceSettings = _this.dataSourceSettings;
                _this.pivotFieldList = _this.engineModule.fieldList;
                if (!isTreeViewRefresh && _this.treeViewModule.fieldTable && !_this.isAdaptive) {
                    _this.notify(events.treeViewUpdate, {});
                }
                if (_this.isRequiredUpdate) {
                    if (_this.allowDeferLayoutUpdate) {
                        _this.clonedDataSource = ej2_base_1.extend({}, _this.dataSourceSettings, null, true);
                        _this.clonedFieldList = ej2_base_1.extend({}, _this.pivotFieldList, null, true);
                    }
                    _this.updateView(_this.pivotGridModule);
                }
                else if (_this.renderMode === 'Popup' && _this.allowDeferLayoutUpdate) {
                    _this.pivotGridModule.engineModule = _this.engineModule;
                    _this.pivotGridModule.setProperties({
                        dataSourceSettings: _this.dataSourceSettings.properties
                    }, true);
                    _this.pivotGridModule.notify(events.uiUpdate, _this);
                    ej2_popups_1.hideSpinner(_this.fieldListSpinnerElement);
                }
                _this.isRequiredUpdate = true;
                if (!_this.pivotGridModule) {
                    ej2_popups_1.hideSpinner(_this.fieldListSpinnerElement);
                }
                else {
                    _this.pivotGridModule.fieldListSpinnerElement = _this.fieldListSpinnerElement;
                }
            });
        };
        PivotFieldList.prototype.update = function (control) {
            Eif (control) {
                this.clonedDataSet = control.clonedDataSet;
                this.setProperties({ dataSourceSettings: control.dataSourceSettings }, true);
                this.engineModule = control.engineModule;
                this.pivotFieldList = control.engineModule.fieldList;
                Eif (this.renderMode === 'Popup') {
                    this.pivotGridModule = control;
                }
                this.getFieldCaption(control.dataSourceSettings);
                this.pivotCommon.engineModule = this.engineModule;
                this.pivotCommon.dataSourceSettings = this.dataSourceSettings;
                this.pivotCommon.control = control;
                if (this.treeViewModule.fieldTable && !this.isAdaptive) {
                    this.notify(events.treeViewUpdate, {});
                }
                this.axisFieldModule.render();
                Iif (this.renderMode === 'Fixed' && this.allowDeferLayoutUpdate) {
                    this.clonedDataSource = ej2_base_1.extend({}, this.dataSourceSettings, null, true);
                    this.clonedFieldList = ej2_base_1.extend({}, this.pivotFieldList, null, true);
                }
            }
        };
        PivotFieldList.prototype.updateView = function (control) {
            if (control) {
                control.clonedDataSet = this.clonedDataSet;
                control.setProperties({ dataSourceSettings: this.dataSourceSettings }, true);
                control.engineModule = this.engineModule;
                control.pivotValues = this.engineModule.pivotValues;
                control.dataBind();
            }
        };
        PivotFieldList.prototype.triggerPopulateEvent = function () {
            var _this = this;
            var eventArgs = {
                dataSourceSettings: this.dataSourceSettings,
                pivotFieldList: this.pivotFieldList,
                pivotValues: this.engineModule.pivotValues
            };
            this.trigger(events.enginePopulated, eventArgs, function (observedArgs) {
                _this.dataSourceSettings = observedArgs.dataSourceSettings;
                _this.pivotFieldList = observedArgs.pivotFieldList;
                _this.engineModule.pivotValues = observedArgs.pivotValues;
            });
        };
        PivotFieldList.prototype.destroy = function () {
            this.unWireEvent();
            Eif (this.treeViewModule) {
                this.treeViewModule.destroy();
            }
            Eif (this.pivotButtonModule) {
                this.pivotButtonModule.destroy();
            }
            if (this.allowDeferLayoutUpdate && this.dialogRenderer &&
                this.dialogRenderer.deferUpdateCheckBox && !this.dialogRenderer.deferUpdateCheckBox.isDestroyed) {
                this.dialogRenderer.deferUpdateCheckBox.destroy();
            }
            _super.prototype.destroy.call(this);
            this.element.innerHTML = '';
            ej2_base_3.removeClass([this.element], cls.ROOT);
            ej2_base_3.removeClass([this.element], cls.RTL);
            ej2_base_3.removeClass([this.element], cls.DEVICE);
            if (this.renderMode === 'Popup') {
                Eif (this.dialogRenderer.fieldListDialog && !this.dialogRenderer.fieldListDialog.isDestroyed) {
                    this.dialogRenderer.fieldListDialog.destroy();
                }
                if (document.getElementById(this.element.id + '_Wrapper')) {
                    ej2_base_2.remove(document.getElementById(this.element.id + '_Wrapper'));
                }
            }
        };
        __decorate([
            ej2_base_2.Complex({}, datasourcesettings_1.DataSourceSettings)
        ], PivotFieldList.prototype, "dataSourceSettings", void 0);
        __decorate([
            ej2_base_1.Property('Popup')
        ], PivotFieldList.prototype, "renderMode", void 0);
        __decorate([
            ej2_base_1.Property()
        ], PivotFieldList.prototype, "target", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], PivotFieldList.prototype, "cssClass", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], PivotFieldList.prototype, "allowCalculatedField", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], PivotFieldList.prototype, "showValuesButton", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], PivotFieldList.prototype, "allowDeferLayoutUpdate", void 0);
        __decorate([
            ej2_base_1.Property(1000)
        ], PivotFieldList.prototype, "maxNodeLimitInMemberEditor", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "load", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "enginePopulating", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "enginePopulated", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "onFieldDropped", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "aggregateCellInfo", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "dataBound", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "created", void 0);
        __decorate([
            ej2_base_1.Event()
        ], PivotFieldList.prototype, "destroyed", void 0);
        PivotFieldList = __decorate([
            ej2_base_3.NotifyPropertyChanges
        ], PivotFieldList);
        return PivotFieldList;
    }(ej2_base_1.Component));
    exports.PivotFieldList = PivotFieldList;
});