all files / document-editor/implementation/list/ list.js

82.26% Statements 51/62
34.38% Branches 11/32
88.89% Functions 8/9
82.26% Lines 51/62
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   90× 90× 90× 90× 90× 90×   144830× 144830× 144830× 797×     144033×   144830×   144830× 1304× 1304× 1304× 909×       143921×               57× 57× 20× 20×   57×   57× 57× 57× 57×   57× 57× 57×                                        
define(["require", "exports", "@syncfusion/ej2-base", "./level-override"], function (require, exports, ej2_base_1, level_override_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var WList = (function () {
        function WList() {
            this.nsid = -1;
            this.listId = -1;
            this.sourceListId = -1;
            this.abstractListId = -1;
            this.abstractList = undefined;
            this.levelOverrides = [];
        }
        WList.prototype.getListLevel = function (levelNumber) {
            var listLevel = undefined;
            var levelOverride = this.getLevelOverride(levelNumber);
            if (!ej2_base_1.isNullOrUndefined(levelOverride) && !ej2_base_1.isNullOrUndefined(levelOverride.overrideListLevel)) {
                listLevel = levelOverride.overrideListLevel;
            }
            else {
                listLevel = this.abstractList.levels[parseInt(levelNumber.toString(), 10)];
            }
            return listLevel;
        };
        WList.prototype.getLevelOverride = function (levelNumber) {
            for (var i = 0; i < this.levelOverrides.length; i++) {
                Eif (this.levelOverrides[parseInt(i.toString(), 10)] instanceof level_override_1.WLevelOverride) {
                    var levelOverride = this.levelOverrides[parseInt(i.toString(), 10)];
                    if (levelOverride.levelNumber === levelNumber) {
                        return levelOverride;
                    }
                }
            }
            return undefined;
        };
        WList.prototype.clear = function () {
            Eif (!ej2_base_1.isNullOrUndefined(this.levelOverrides)) {
                for (var i = 0; i < this.levelOverrides.length; i++) {
                    var levelOverride = this.levelOverrides[parseInt(i.toString(), 10)];
                    levelOverride.clear();
                }
                this.levelOverrides = [];
            }
            Eif (this.abstractList) {
                this.abstractList.clear();
            }
            this.abstractList = undefined;
        };
        WList.prototype.destroy = function () {
            Eif (!ej2_base_1.isNullOrUndefined(this.levelOverrides)) {
                for (var i = 0; i < this.levelOverrides.length; i++) {
                    var levelOverride = this.levelOverrides[parseInt(i.toString(), 10)];
                    levelOverride.destroy();
                }
                this.levelOverrides = [];
            }
            this.levelOverrides = undefined;
            Eif (this.abstractList) {
                this.abstractList.destroy();
                this.abstractList = undefined;
            }
            this.abstractListId = undefined;
            this.listId = undefined;
            this.sourceListId = undefined;
        };
        WList.prototype.mergeList = function (list) {
            if (!ej2_base_1.isNullOrUndefined(this.abstractListId) && this.abstractListId !== -1) {
                this.abstractListId = list.abstractListId;
            }
            if (!ej2_base_1.isNullOrUndefined(this.listId) && this.listId !== -1) {
                this.listId = list.listId;
            }
            if (!ej2_base_1.isNullOrUndefined(this.sourceListId) && this.sourceListId !== -1) {
                this.sourceListId = list.sourceListId;
            }
            if (!ej2_base_1.isNullOrUndefined(this.levelOverrides) && this.levelOverrides.length !== 0) {
                this.levelOverrides = list.levelOverrides;
            }
        };
        WList.prototype.clone = function () {
            var list = new WList();
            for (var i = 0; i < this.levelOverrides.length; i++) {
                list.levelOverrides.push(this.levelOverrides[parseInt(i.toString(), 10)].clone());
            }
            return list;
        };
        return WList;
    }());
    exports.WList = WList;
});