'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([], function () { var APISpec = function () { function APISpec() { _classCallCheck(this, APISpec); } APISpec.prototype.getAPISpec = function getAPISpec() { var _this = this; if (!this.apiSpec) { this.apiSpec = { name: 'slot API', features: { 'Dashboard.Transaction': this.transaction }, events: { propagationInfo: { info: { slotId: this.getId() }, callStack: { name: 'getSlot', params: [this.getId()] } }, actions: { 'removeDataItemsMapping': { eventName: 'dataitems:removeMapping', getInfo: function getInfo(args) { return { dataItemIdList: args[0] }; }, getUndoActions: function getUndoActions(args) { var undoActions = []; var ids = args[0]; if (ids) { var lastIndex = void 0; ids.forEach(function (id) { var dataItem = _this.getDataItem(id); if (dataItem) { var currentIndex = _this.getDataItemIndex(id); // add an addColumn reverse action if (currentIndex !== lastIndex + 1) { undoActions.push({ name: 'addDataItemsMapping', params: [[], currentIndex] }); } var lastAction = undoActions[undoActions.length - 1]; // add the column id to column ids param lastAction.params[0].push(dataItem.getId()); lastIndex = currentIndex; } }); } return undoActions; } }, 'addDataItemsMapping': { eventName: 'dataitems:addMapping', isResolvePostResponse: true, getInfo: function getInfo(args) { return { dataItemIdList: args[0], position: args[1] || 0 }; }, getUndoActions: function getUndoActions(args) { return [{ name: 'removeDataItemsMapping', params: [args[0]] }]; } } } } }; } return this.apiSpec; }; return APISpec; }(); return APISpec; }); //# sourceMappingURL=SlotAPISpec.js.map