WidgetAPI.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. "use strict";
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. /**
  9. * @class WidgetAPI
  10. * @hideconstructor
  11. * @classdesc API class that is used to control a widget behaviour.
  12. */
  13. define([], function () {
  14. var WidgetAPI = function () {
  15. function WidgetAPI() {
  16. _classCallCheck(this, WidgetAPI);
  17. }
  18. /**
  19. * @function WidgetAPI#getId
  20. * @description Get the internal ID of the widget
  21. * @return {String} Internal ID of the widget
  22. */
  23. WidgetAPI.prototype.getId = function getId() {};
  24. /**
  25. * @function WidgetAPI#getEventGroupId
  26. * @description Get the ID for the event group this widget is a part of
  27. * @return {String} Group ID this widget belongs to. Undefined if the widget is not part of a group
  28. */
  29. WidgetAPI.prototype.getEventGroupId = function getEventGroupId() {};
  30. /**
  31. * @function WidgetAPI#getScope
  32. * @description Get the container page ID for which the widget belongs to
  33. * @return {String} ccontainer page ID for which the widget belongs to
  34. */
  35. WidgetAPI.prototype.getScope = function getScope() {};
  36. /**
  37. * @function WidgetAPI#getLayoutAPI
  38. * @deprecated APIs should not know about their parent
  39. */
  40. WidgetAPI.prototype.getLayoutAPI = function getLayoutAPI() {};
  41. /**
  42. * @function WidgetAPI#getType
  43. * @description Get the type of the widget
  44. * @return {String} The type of the widget
  45. */
  46. WidgetAPI.prototype.getType = function getType() {};
  47. /**
  48. * @deprecated
  49. * @function WidgetAPI#getProperties
  50. * @description Get all the properties for the widget
  51. * @returns {PropertiesAPI}
  52. */
  53. WidgetAPI.prototype.getProperties = function getProperties() {};
  54. /**
  55. * @deprecated
  56. * @function WidgetAPI#getProperty
  57. * @param {String} propertyName name of the property
  58. * @descrpition Get the property for the widget
  59. * @return {Object} property object
  60. */
  61. WidgetAPI.prototype.getProperty = function getProperty() /* propertyName */{};
  62. /**
  63. * @function WidgetAPI#getPropertyLayoutList
  64. * @descrpition Returns a list of layout list
  65. * @return {Object[]} Array of layout list
  66. */
  67. WidgetAPI.prototype.getPropertyLayoutList = function getPropertyLayoutList() {};
  68. /**
  69. * @function WidgetAPI#getPropertyList
  70. * @descrpition Returns a list of properties list
  71. * @return {Object[]} Array of properties
  72. */
  73. WidgetAPI.prototype.getPropertyList = function getPropertyList() {};
  74. /**
  75. * @function WidgetAPI#getFeature
  76. * @description Get a widget level feature. Features are extensions to the widget
  77. * @param {String} featureId - The ID of the feature to get
  78. * @return {Promise} Promise resolved with the feature or with undefined if feature does not exist
  79. */
  80. WidgetAPI.prototype.getFeature = function getFeature() {};
  81. /**
  82. * @function WidgetAPI#getContextToolbarItems
  83. * @description Get the toolbar actions for the widget
  84. * @return {WidgetAction[]} An array of {@link WidgetAction} objects
  85. */
  86. WidgetAPI.prototype.getContextToolbarItems = function getContextToolbarItems() {};
  87. /**
  88. * @function WidgetAPI#getError
  89. * @deprecated use {@link WidgetAPI#getErrorDetails}
  90. */
  91. WidgetAPI.prototype.getError = function getError() {};
  92. /**
  93. * @function WidgetAPI#getErrorDetails
  94. * @description Get error information for the widget
  95. * @return {WidgetErrorDetails} Returns the error details for the widget. Returns null if the widget isn't in an error state
  96. */
  97. WidgetAPI.prototype.getErrorDetails = function getErrorDetails() {};
  98. /**
  99. * @function WidgetAPI#hasError
  100. * @description Used to check if the widget is currently in an error state
  101. * @return {Boolean} - Returns true if the widget is currently in an error state
  102. */
  103. WidgetAPI.prototype.hasError = function hasError() {};
  104. /**
  105. * @function WidgetAPI#hasWarning
  106. * @description Used to check if the widget is currently in an warning state
  107. * @return {Boolean} - Returns true if the widget is currently in an warning state
  108. */
  109. WidgetAPI.prototype.hasWarning = function hasWarning() {};
  110. /**
  111. * @function WidgetAPI#clearError
  112. * @deprecated Clearing of the error should be handled by a render call and the render sequence
  113. */
  114. WidgetAPI.prototype.clearError = function clearError() {};
  115. /**
  116. * @function WidgetAPI#on
  117. * @description Register an event handler for the widget
  118. * @param {String} eventName Name of the event
  119. * @param {function} handler Event handler to be called when the event occurrs.
  120. * @param {object} context Context of the event
  121. * Multiple handlers can be registered with the same <strong>eventName</strong>.
  122. * Each handlers needs to be registered and unregistered individually.
  123. */
  124. WidgetAPI.prototype.on = function on() {};
  125. /**
  126. * @function WidgetAPI#off
  127. * @description Unregister an event handler that was registered with {@link WidgetAPI#on}
  128. * @param {String} eventName Name of the dashboard event
  129. * @param {function} handler Event handler to be called when the event occurrs
  130. * @param {object} context Context of the event
  131. */
  132. WidgetAPI.prototype.off = function off() {};
  133. /**
  134. * @function WidgetAPI#isWidgetMaximized
  135. * @description Used to know if the widget is in maximized mode
  136. * @return {Boolean} true if the widget is currently maximize
  137. */
  138. WidgetAPI.prototype.isWidgetMaximized = function isWidgetMaximized() {};
  139. /**
  140. * @function WidgetAPI#isContextualGridEnabled
  141. * @description Check if contextual grid is supported for this widget
  142. * @return {Promise<Boolean>} promise resolves with true if enabled
  143. */
  144. WidgetAPI.prototype.isContextualGridEnabled = function isContextualGridEnabled() {};
  145. /**
  146. * @function WidgetAPI#setFeatureEnabled
  147. * @description Allows for a widget level feature to be enabled or disabled at runtime
  148. * @param {String} featureId - The ID of the feature to update
  149. * @param {Boolean} isEnabled - Is the feature enabled or not
  150. */
  151. WidgetAPI.prototype.setFeatureEnabled = function setFeatureEnabled() {};
  152. return WidgetAPI;
  153. }();
  154. return WidgetAPI;
  155. });
  156. //# sourceMappingURL=WidgetAPI.js.map