all files / document-editor/implementation/search/ text-search-results.js

94.44% Statements 34/36
86.67% Branches 13/15
100% Functions 9/9
94.44% Lines 34/36
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   247× 247×     59×   51×                       15× 15×   15× 15×   11× 11× 14× 14×             101×   101×        
define(["require", "exports", "@syncfusion/ej2-base", "./text-search-result"], function (require, exports, ej2_base_1, text_search_result_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var TextSearchResults = (function () {
        function TextSearchResults(owner) {
            this.currentIndex = -1;
            this.owner = owner;
        }
        Object.defineProperty(TextSearchResults.prototype, "length", {
            get: function () {
                if (this.innerList === undefined) {
                    return 0;
                }
                return this.innerList.length;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TextSearchResults.prototype, "currentSearchResult", {
            get: function () {
                Iif (this.innerList === undefined || this.currentIndex < 0 || this.currentIndex >= this.length) {
                    return undefined;
                }
                return this.innerList[this.currentIndex];
            },
            enumerable: true,
            configurable: true
        });
        TextSearchResults.prototype.addResult = function () {
            var textSearchResult = new text_search_result_1.TextSearchResult(this.owner);
            if (ej2_base_1.isNullOrUndefined(this.innerList)) {
                this.innerList = [];
            }
            this.innerList.push(textSearchResult);
            return textSearchResult;
        };
        TextSearchResults.prototype.clearResults = function () {
            this.currentIndex = -1;
            if (!ej2_base_1.isNullOrUndefined(this.innerList)) {
                for (var i = this.innerList.length - 1; i >= 0; i--) {
                    this.innerList[parseInt(i.toString(), 10)].destroy();
                    this.innerList.splice(i, 1);
                }
            }
        };
        TextSearchResults.prototype.indexOf = function (result) {
            Iif (ej2_base_1.isNullOrUndefined(this.innerList)) {
                return -1;
            }
            return this.innerList.indexOf(result);
        };
        TextSearchResults.prototype.destroy = function () {
            if (!ej2_base_1.isNullOrUndefined(this.innerList)) {
                this.clearResults();
            }
            this.innerList = undefined;
        };
        return TextSearchResults;
    }());
    exports.TextSearchResults = TextSearchResults;
});