123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- '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.
- */
- /**
- * Create a public API to a decorator for the n-th vipr dataset
- *
- * @class DecoratorAPI
- * @hideconstructor
- * @classdesc
- */
- define([], function () {
- var Events = function () {
- function Events(options) {
- _classCallCheck(this, Events);
- this.transaction = options.dashboardFeatures.getFeature('Transaction');
- }
- Events.prototype.getAPISpec = function getAPISpec() {
- var _this = this;
- if (!this.apiSpec) {
- this.apiSpec = {
- name: 'canvas api',
- features: {
- 'Dashboard.Transaction': this.transaction
- },
- events: {
- propagationInfo: {
- namespace: 'canvas',
- callStack: {
- name: 'getCanvas'
- }
- },
- actions: {
- selectContent: {
- eventName: 'selections:select',
- getInfo: function getInfo(args) {
- return {
- value: args[0]
- };
- },
- getUndoActions: function getUndoActions(args) {
- return [{
- name: 'deselectContent',
- params: [args[0]]
- }];
- }
- },
- deselectContent: {
- eventName: 'selections:deselect',
- getInfo: function getInfo(args) {
- return {
- value: args[0]
- };
- },
- getUndoActions: function getUndoActions(args) {
- return [{
- name: 'selectContent',
- params: [args[0]]
- }];
- }
- },
- moveContent: {
- type: 'move',
- eventName: 'content',
- transactionParamIndex: 2,
- transactionAPI: this.transaction,
- autoCreateTransaction: true,
- getInfo: function getInfo(args) {
- return {
- containerId: args[0],
- contentIdList: args[1],
- supportsUndoRedo: true
- };
- },
- getUndoActions: function getUndoActions(args) {
- var contentIdList = args[1];
- var undoActions = [];
- if (contentIdList) {
- contentIdList.forEach(function (id) {
- // get the current parent
- undoActions.push({
- name: 'moveContent',
- params: [_this.getContent(id).getContainer().getId(), [id]]
- });
- });
- }
- return undoActions;
- }
- },
- setPropertyValue: {
- eventName: 'property',
- getEventName: function getEventName(args) {
- return 'property:' + args[0];
- },
- getInfo: function getInfo(args) {
- var property = _this._propertiesMap && _this._propertiesMap[args[0]];
- if (!property) {
- property = _this._getProperty(args[0]);
- }
- var info = {
- name: args[0],
- value: args[1],
- supportsUndoRedo: !!(property && property.supportsUndoRedo)
- };
- if (args[2]) {
- info.options = JSON.parse(JSON.stringify(args[2]));
- }
- return info;
- },
- getUndoActions: function getUndoActions(args) {
- return [{ params: [args[0], _this.getPropertyValue(args[0])] }];
- }
- }
- }
- }
- };
- }
- return this.apiSpec;
- };
- return Events;
- }();
- return Events;
- });
- //# sourceMappingURL=CanvasAPISpec.js.map
|