'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(['../../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../../app/nls/StringResources', '../../../../lib/@waca/dashboard-common/dist/api/ContentActionsProviderAPI'], function (APIFactory, stringResources, ContentActionsProviderAPI) { var DockAction = function () { function DockAction(_ref) { var features = _ref.features; _classCallCheck(this, DockAction); if (features) { this._toolbarDock = features.ToolbarDock; this._dashboard = features.API; this._contentActions = features.ContentActions; this._dashboardState = features.DashboardState; this._icons = features.Icons; } } DockAction.prototype.initialize = function initialize() { if (this._toolbarDock) { this._api = APIFactory.createAPI(this, [ContentActionsProviderAPI]); this._contentActions.registerProvider('dockToolbarAction', this._api); } }; DockAction.prototype.getAPI = function getAPI() { return APIFactory.createAPI(this, [ContentActionsProviderAPI]); }; DockAction.prototype._isAvailable = function _isAvailable(idList) { var isExplore = this._dashboard.getType().toUpperCase() === 'EXPLORE'; return idList.length && !isExplore; }; DockAction.prototype._isDisabled = function _isDisabled() { return this._dashboardState.getUiState().focus; }; DockAction.prototype.getContentActionList = function getContentActionList(idList) { var contribution = void 0; if (this._isAvailable(idList)) { var icon = void 0, tooltip = void 0; if (this._toolbarDock.isContentToolbarDocked()) { icon = this._icons.getIcon('undock-icon').id; tooltip = stringResources.get('undockToolbar'); } else { icon = this._icons.getIcon('dock-icon').id; tooltip = stringResources.get('dockToolbar'); } contribution = [{ name: 'dockToolbarAction', label: tooltip, icon: icon, type: 'Button', disabled: this._isDisabled.bind(this), actions: { apply: function () { this._toolbarDock.toggle(); }.bind(this) } }]; } else { contribution = []; } return contribution; }; return DockAction; }(); return DockAction; }); //# sourceMappingURL=DockAction.js.map