all files / pdfviewer/base/ blazor-context-menu.js

42.31% Statements 11/26
0% Branches 0/8
25% Functions 2/8
42.31% Lines 11/26
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                                                            
define(["require", "exports"], function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BlazorContextMenu = (function () {
        function BlazorContextMenu(pdfViewer, pdfViewerBase) {
            this.pdfViewer = pdfViewer;
            this.pdfViewerBase = pdfViewerBase;
        }
        BlazorContextMenu.prototype.createContextMenu = function () {
            var htmlCollection = document.getElementsByClassName(this.pdfViewer.element.id + '_context_menu');
            if (htmlCollection) {
                this.contextMenuElement = htmlCollection[0];
                if (this.contextMenuElement.children && this.contextMenuElement.children.length > 0) {
                    var htmlElement = this.contextMenuElement.children[0];
                    htmlElement.className = htmlElement.className + ' ' + 'e-pv-context-menu';
                }
            }
        };
        BlazorContextMenu.prototype.open = function (top, left, target) {
            this.pdfViewer._dotnetInstance.invokeMethodAsync('OpenContextMenu', top, left);
        };
        BlazorContextMenu.prototype.close = function () {
            this.pdfViewer._dotnetInstance.invokeMethodAsync('CloseContextMenu');
        };
        BlazorContextMenu.prototype.destroy = function () {
            this.previousAction = '';
            this.contextMenuElement = null;
        };
        BlazorContextMenu.prototype.OnItemSelected = function (selectedMenu) {
            if (typeof selectedMenu === 'string') {
                this.pdfViewerBase.OnItemSelected(selectedMenu);
            }
            else {
                this.pdfViewerBase.OnItemSelected(selectedMenu[0]);
            }
        };
        return BlazorContextMenu;
    }());
    exports.BlazorContextMenu = BlazorContextMenu;
});