123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- '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);
- }
- // generate a list of action that will restore this union to its current stae
- APISpec.prototype.serializeActions = function serializeActions() {
- var actions = [];
- this.dataItemImplList.forEach(function (dataItemImpl) {
- var params = [];
- var resultActions = [];
- if (dataItemImpl) {
- params.push({ columnId: dataItemImpl.getColumnId(), id: dataItemImpl.getId() });
- resultActions.push(dataItemImpl.serializeActions());
- }
- actions.push({
- name: 'addDataItem',
- params: params,
- resultActions: resultActions
- });
- });
- return actions;
- };
- APISpec.prototype.getAPISpec = function getAPISpec() {
- var _this = this;
- if (!this.apiSpec) {
- this.apiSpec = {
- name: 'union API',
- events: {
- propagationInfo: {
- callStack: {
- name: 'getUnion',
- params: []
- }
- },
- actions: {
- addDataItem: {
- eventName: 'addUnionDataItem',
- isResolvePostResponse: true,
- getInfo: function getInfo(args) {
- return {
- columnId: args[0],
- supportsUndoRedo: true,
- refresh: {
- data: true
- }
- };
- },
- getUndoActions: function getUndoActions(args, returnValue) {
- var dataItemId = void 0;
- if (returnValue) {
- dataItemId = returnValue.getId();
- }
- return [{
- name: 'removeDataItem',
- params: [dataItemId]
- }];
- }
- },
- removeDataItem: {
- eventName: 'removeUnionDataItem',
- getInfo: function getInfo(args) {
- return {
- dataItemId: args[0],
- supportsUndoRedo: true,
- refresh: {
- data: true
- }
- };
- },
- getUndoActions: function getUndoActions(args) {
- var dataItemImpl = _this.getDataItemImpl(args[0]);
- var params = [];
- var resultActions = [];
- if (dataItemImpl) {
- params.push({ columnId: dataItemImpl.getColumnId(), id: dataItemImpl.getId() });
- resultActions.push(dataItemImpl.serializeActions());
- }
- return [{
- name: 'addDataItem',
- params: params,
- resultActions: resultActions
- }];
- }
- }
- }
- }
- };
- }
- return this.apiSpec;
- };
- return APISpec;
- }();
- return APISpec;
- });
- //# sourceMappingURL=UnionAPISpec.js.map
|