| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | '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: BI Cloud (C) Copyright IBM Corp. 2019, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */define(['../../../../widgets/livewidget/nls/StringResources', '../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI', '../../../../lib/@waca/dashboard-common/dist/core/APIFactory', 'jquery'], function (StringResources, ContentActionsProviderAPI, APIFactory, $) {	var HideShowSummariesAction = function () {		function HideShowSummariesAction(dashboard, dashboardState, icons) {			_classCallCheck(this, HideShowSummariesAction);			this._dashboard = dashboard;			this._dashboardState = dashboardState;			this._icons = icons;		}		HideShowSummariesAction.prototype.getContentActionList = function getContentActionList(idList) {			var contribution = [];			if (this._getSelectedContent(idList)) {				var contentId = idList[0];				var content = this._dashboard.getCanvas().getContent(contentId);				var summaryIcon = this._icons.getIcon('dashboard-hideshowsummaries');				if (this._supportAction(content)) {					contribution = [{						name: 'hideShowSummaries',						label: this._getLabel(content),						className: 'hideShowSummariesBtnToggle',						icon: summaryIcon.id,						actions: {							apply: this.execute.bind(this, content)						},						type: 'Button'					}];				}			}			return contribution;		};		HideShowSummariesAction.prototype._supportAction = function _supportAction(content) {			var isAllowed = false;			var uiState = this._dashboardState.getUiState();			var visualization = content.getFeature('Visualization');			if (visualization && !uiState.eventGroups) {				var visId = visualization.getDefinition().getId();				var mappingComplete = visualization.getSlots().isMappingComplete();				isAllowed = mappingComplete && (visId === 'crosstab' || visId === 'JQGrid');			}			return isAllowed;		};		HideShowSummariesAction.prototype._getLabel = function _getLabel(content) {			var hideSummaries = content.getPropertyValue('hideSummaries');			return hideSummaries ? StringResources.get('showSummariesLabel') : StringResources.get('hideSummariesLabel');		};		HideShowSummariesAction.prototype._getSelectedContent = function _getSelectedContent(idList) {			return idList.length === 1;		};		HideShowSummariesAction.prototype.execute = function execute(content, event) {			var currentValue = !content.getPropertyValue('hideSummaries');			content.setPropertyValue('hideSummaries', currentValue);			var $hideShowSummariesBtn = $(event.currentTarget).find('.hideShowSummariesBtnToggle').addBack();			var label = this._getLabel(content);			$hideShowSummariesBtn.attr('title', label);			$hideShowSummariesBtn.find('svg title').text(label);		};		HideShowSummariesAction.prototype.getAPI = function getAPI() {			if (!this._api) {				this._api = APIFactory.createAPI(this, [ContentActionsProviderAPI]);			}			return this._api;		};		return HideShowSummariesAction;	}();	return HideShowSummariesAction;});//# sourceMappingURL=HideShowSummariesAction.js.map
 |