"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 Business Analytics (C) Copyright IBM Corp. 2018, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @interface CanvasAPI * @hideconstructor * @classdesc API class that is used to control the content and behavior of a dashboard canvas. * @example dashboard.getFeature('Canvas') */ define([], function () { var CanvasAPI = function () { function CanvasAPI() { _classCallCheck(this, CanvasAPI); } /** * @description Registers a canvas event handler. * @function CanvasAPI#on * @param {String} name Event name * @param {Function} handler Event handler * @return {Object} Object that has a remove function to remove the event handler. * @example * canvas.on('all', (event) => { console.log(event); }); * canvas.on('change:content:selections', (event) => { console.log(event.info.events); }); * canvas.on('change:content:selections:clearAll', (event) => { console.log(event); }); */ CanvasAPI.prototype.on = function on() {}; /** * @description Deregisters a canvas event handler. * @function CanvasAPI#off * @public * * @param {String} name Event name * @param {Function} name Event handler * */ CanvasAPI.prototype.off = function off() {}; /** * @function CanvasAPI#addContent * @description Adds content options to the canvas. * @param {Object} options Contains the options for adding content to the canvas. * @param {String} options.containerId Container ID specifying where to add the content. By default, the system selects the position. * @param {Number} options.position Index specifying where to add the content. By default, the system selects the position. * @param {Object} options.properties An object of property names and values to apply to the content. * @param {String} options.type Content provider type to use. Must provide a spec or content, if not defined. * @param {Object} options.spec Layout, widget, or fragment spec. * @param {ContentAPI} options.content ContentAPI object to be added to the canvas. * @param {TransactionToken} transactionToken * @return {Promise} new content */ CanvasAPI.prototype.addContent = function addContent() {}; /** * @function CanvasAPI#moveContent * @description Moves the contents specified in @contentIdList to new container @containerId. * @param {String} containerId Specifies the container ID. * @param {*} contentIdList Contains the content ID list. * @param {*} transactionToken Transaction token for this action. * @return {ContentAPI[]} the list of contentAPIs correnponding to @contentIdList */ CanvasAPI.prototype.moveContent = function moveContent() {}; /** * @description Returns the content that matches the specified ID. * @function CanvasAPI#getContent * @param {String} id - ID of the content * @return {ContentAPI} */ CanvasAPI.prototype.getContent = function getContent() {}; /** * @description Returns a list of toolbar actions. * @param {String[]} idList * @return {Object[]} Array of actions * @example * { * name: 'group', * label: stringResources.get('toolbarActionGroup'), * icon: 'dashboard-group', * type: 'Button', * action: () => {} * } */ CanvasAPI.prototype.getContentActionList = function getContentActionList() /* idList */{}; /** * Selects the content that matches the specified IDs. * @function CanvasAPI#selectContent * @param {String[]} idList- Array of IDs to select */ CanvasAPI.prototype.selectContent = function selectContent() {}; /** * Deselects the content that matches the specified IDs. * @function CanvasAPI#deselectContent * @param {String[]} idList- Array of IDs to deselect */ CanvasAPI.prototype.deselectContent = function deselectContent() {}; /** * Returns the list of content that is selected. * @function CanvasAPI#getSelectedContentList * @param {Object} selector - Optional, returns groups and widgets by default. * @param {String} selector.type - Selector string * @return {ContentAPI[]} contentList - Array of content */ CanvasAPI.prototype.getSelectedContentList = function getSelectedContentList() {}; /** * Removes the content with the specified ID. * @function CanvasAPI#removeContent * @param {String} id - ID of the content * @param {TransactionToken} transactionToken - Transaction token for this action */ CanvasAPI.prototype.removeContent = function removeContent() {}; /** * Returns a list of content that matches the specified selector. * @function CanvasAPI#findContent * @param {Object} selector - Selector object; returns all widgets if undefined. * @param {String} selector.type - Selector type * @param {Object} selector.properties * @return {ContentAPI[]} Array of content * @example * canvas.findContent({ * properties: { * title: 'My page' * } * }); * canvas.findContent({ * type: 'page' * }); */ CanvasAPI.prototype.findContent = function findContent() {}; /** * @function DashboardAPI#copy * @description Copies the currently selected widget(s) on the dashboard. * @private */ CanvasAPI.prototype.copy = function copy() {}; /** * @function DashboardAPI#paste * @description Pastes the copied widget(s) to the dashboard. * @private * @return {Promise} Promise, which is resolved once the widget(s) are successfully pasted. */ CanvasAPI.prototype.paste = function paste() {}; /** * @function CanvasAPI#getPropertyLayoutList * @descrpition Returns a list of layout and properties used to render the properties UI. * @return {Object[]} Array of layout and properties used to render the properties UI. */ CanvasAPI.prototype.getPropertyLayoutList = function getPropertyLayoutList() {}; /** * @function CanvasAPI#getPropertiesNameList * @description Returns an object of property objects. * @return {String[]} Array of property objects */ CanvasAPI.prototype.getPropertyNameList = function getPropertyNameList() {}; /** * @function CanvasAPI#setPropertyValue * @description Sets the value for a property. * @param {String} name - Name of the property to set * @param {Object} value - Value to set * @param {TransactionToken} transactionToken */ CanvasAPI.prototype.setPropertyValue = function setPropertyValue() {}; /** * @function CanvasAPI#getPropertyValue * @description Gets the value for a property. * @param {String} name - Name of the property * @return {Object} Value of the property */ CanvasAPI.prototype.getPropertyValue = function getPropertyValue() {}; return CanvasAPI; }(); return CanvasAPI; }); //# sourceMappingURL=CanvasAPI.js.map