"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. 2019, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * @interface ContentAPI * @hideconstructor * @classdesc API class that is used to control canvas content. * @example dashboard.getFeature('Canvas').getContent() * @example dashboard.getFeature('Canvas').findContent() */ define([], function () { var ContentAPI = function () { function ContentAPI() { _classCallCheck(this, ContentAPI); } /** * @function ContentAPI#getId * @description Returns the internal ID of the widget. * @return {String} Internal ID of the widget */ ContentAPI.prototype.getId = function getId() {}; /** * @function ContentAPI#getType * @description Returns the type of the canvas content. * @return {String} Type of the canvas content */ ContentAPI.prototype.getType = function getType() {}; /** * @function ContentAPI#getPropertyLayoutList * @description 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. */ ContentAPI.prototype.getPropertyLayoutList = function getPropertyLayoutList() {}; /** * @function ContentAPI#getPropertiesNameList * @description Returns an array of property names. * @return {String[]} Array of property objects */ ContentAPI.prototype.getPropertyNameList = function getPropertyNameList() {}; /** * @function ContentAPI#getPropertyList * @description get the list of all properties * @return {Object[]} */ ContentAPI.prototype.getPropertyList = function getPropertyList() {}; /** * @function ContentAPI#setPropertyValue * @description Sets the value of a property. * @param {String} name - Name of the property to set * @param {Object} value - Value to set * @param {SetOptions} options */ ContentAPI.prototype.setPropertyValue = function setPropertyValue() {}; /** * @function ContentAPI#getPropertyValue * @description Returns the value of a property. * @param {String} name - Name of the property * @return {Object} Value of the property */ ContentAPI.prototype.getPropertyValue = function getPropertyValue() {}; /** * @function ContentAPI#getFeature * @description Returns a content-level feature. Features are extensions to the widget. * @param {String} featureId[.type] - featureId is the ID of the feature to get, while .type is the type of the feature. * @return {Promise} Promise resolved with the feature or with undefined, if the feature does not exist. * @example * content.getFeature('state') will return a public renderState API. * content.getFeature('state.internal') will return a private renderState API. */ ContentAPI.prototype.getFeature = function getFeature() {}; /** * @function ContentAPI#setFeatureEnabled * @description Determines whether a content-level feature is enabled or disabled at runtime. * @param {String} featureId - ID of the feature to update * @param {Boolean} isEnabled - Set to true to enable the feature. Default is true. */ ContentAPI.prototype.setFeatureEnabled = function setFeatureEnabled() {}; /** * @description Register a content event handler. * @function ContentAPI#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 * content.on('all', (event) => { console.log(event); }); * content.on('change:selections', (event) => { console.log(event.info.events); }); * content.on('change:selections:clearAll', (event) => { console.log(event); }); */ ContentAPI.prototype.on = function on() {}; /** * @function ContentAPI#off * @description Unregisters an event handler that was registered with {@link ContentAPI#on}. * @param {String} eventName Name of the dashboard event * @param {function} handler Event handler to be called when the event occurs. * @param {object} context Context of the event */ ContentAPI.prototype.off = function off() {}; /** * Returns the content that matches the given ID. * @function ContentAPI#getContent * @param {String} id - ID of the content * @return {ContentAPI} */ ContentAPI.prototype.getContent = function getContent() {}; /** * Returns a list of content that matches the provided selector. * @function ContentAPI#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 * content.findContent({ * properties: { * title: 'My page' * } * }); * content.findContent({ * type: 'page' * }); */ ContentAPI.prototype.findContent = function findContent() {}; /** * Returns the parent container. * @function ContentAPI#getContainer * @return {ContentAPI} Content container */ ContentAPI.prototype.getContainer = function getContainer() {}; /** * Returns the children content. * @function ContentAPI#getChildren * @return {ContentAPI[]} Array of contents */ ContentAPI.prototype.getChildren = function getChildren() {}; /** * @function ContentAPI#addContent * @description Adds content with the specified spec. * @param {Object} options Contains the options for adding content to this contentApi. * @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 this contentApi. * @param {TransactionToken} [transactionToken] - Optional transaction token. * @return {Promise} Promise resolved with the new content instance. */ ContentAPI.prototype.addContent = function addContent() {}; /** * Removes the content with the specified ID. * @function ContentAPI#removeContent * @param {String} id - ID of the content * * @param {TransactionToken} [transactionToken] - Optional transaction token */ ContentAPI.prototype.removeContent = function removeContent() {}; return ContentAPI; }(); return ContentAPI; }); //# sourceMappingURL=ContentAPI.js.map