'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 * 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', './api/SlotActionsAPI', 'underscore'], function (APIFactory, SlotActionsAPI, _) { var SlotActions = function () { function SlotActions() { _classCallCheck(this, SlotActions); this.api = APIFactory.createAPI(this, [SlotActionsAPI]); this.providers = []; } SlotActions.prototype.registerProvider = function registerProvider(name, provider) { this.providers[name] = provider; }; SlotActions.prototype.getSlotActionList = function getSlotActionList(dataSlotId, itemIndex, options) { var actionOptions = options && options.actionOptions || {}; var actionsToKeep = options && options.actionsToKeep || []; var actions = []; for (var actionName in this.providers) { var feature = this.providers[actionName]; if (feature.getSlotActionList) { var slotAction = null; try { slotAction = feature.getSlotActionList(dataSlotId, itemIndex, actionOptions[actionName]); } catch (e) { console.log(e); } if (!_.isEmpty(slotAction)) { var _actions; (_actions = actions).push.apply(_actions, slotAction); } } } // Filter actions if needed if (actionsToKeep.length) { actions = actions.filter(function (action) { // TODO We need to check all three of them for now because of some inconsistencies we have in our code. // New API's should use *name* to identify an action. return _.contains(actionsToKeep, action.id || action.group || action.name) || action.name === 'delete'; }); } return actions; }; SlotActions.prototype.getAPI = function getAPI() { return this.api; }; return SlotActions; }(); return SlotActions; }); //# sourceMappingURL=SlotActions.js.map