'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| IBM Cognos Products: Content Explorer *| (C) Copyright IBM Corp. 2019 *| *| US Government Users Restricted Rights - Use, duplication or disclosure *| restricted by GSA ADP Schedule Contract with IBM Corp. *+------------------------------------------------------------------------+ */ define(['jquery', '../../../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../AssetPrintAPI'], function ($, APIFactory, DashboardPrintAPI) { var DashboardPrint = function () { function DashboardPrint() { _classCallCheck(this, DashboardPrint); } DashboardPrint.prototype.getAPI = function getAPI() { return APIFactory.createAPI(this, [DashboardPrintAPI]); }; DashboardPrint.prototype.showContentsForPrint = function showContentsForPrint(content) { var _this = this; this.blocker = $('
', { 'class': 'printBlocker' }); var pageElement = content.pageElement; $(pageElement).append(this.blocker); $(pageElement).find('.tabPageHolder').css('display', 'block'); var isTab = content.layoutType === 'tab'; var holdDiv = $(pageElement).find('.tabPageHolder'); if (isTab) { this.originalParentMap = {}; } $.each(content.modelIds, function (i, modeId) { var page = $(pageElement).find('#' + modeId + '_tab'); if (!page.hasClass('selected')) { page.css('display', 'inline-block'); page.css('z-index', -1); } if (isTab) { _this.originalParentMap[modeId] = page.parent(); holdDiv.append(page); } }); return Promise.resolve(); }; DashboardPrint.prototype.hideContentsAfterPrint = function hideContentsAfterPrint(modelIds, pageElement) { var _this2 = this; $(pageElement).find('.tabPageHolder').css('display', ''); var isTab = !!this.originalParentMap; $.each(modelIds, function (i, modeId) { var page = $(pageElement).find('#' + modeId + '_tab'); if (!page.hasClass('selected')) { page.css('display', ''); page.css('z-index', ''); } if (isTab) { _this2.originalParentMap[modeId].append(page); } }); this.originalParentMap = null; if (this.blocker) { this.blocker.remove(); this.blocker = null; } return Promise.resolve(); }; /** * @description Get the minimum widget and height which can include all widgets on a page * @param {Element} pageElement * @returns {Object} An object which has the following structure: * { * width: 1234, * height: 4321 * } */ DashboardPrint.prototype.getOffScreenPageSize = function getOffScreenPageSize(pageElement) { var maxWidth = 0; var maxHeight = 0; var realDashboardSize = {}; $.each($(pageElement).find('.widget'), function (i, widget) { var positionx = $(widget).position().left; var positiony = $(widget).position().top; if (positionx + $(widget).outerWidth() > maxWidth) { maxWidth = positionx + $(widget).outerWidth(); } if (positiony + $(widget).outerHeight() > maxHeight) { maxHeight = positiony + $(widget).outerHeight(); } }.bind(this)); realDashboardSize = { 'width': maxWidth, 'height': maxHeight }; return realDashboardSize; }; return DashboardPrint; }(); return DashboardPrint; }); //# sourceMappingURL=DashboardPrint.js.map