VisDefinitionAPI.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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, 2020
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. /** @typedef {Object} SlotDefinition
  9. * @property {String} dataset
  10. * @property {Boolean} group
  11. * @property {Boolean} hidden
  12. * @property {String} id
  13. * @property {Boolean} optional
  14. * @property {Boolean} repeats
  15. * @property {String} sort
  16. * @property {Number} sortOrder
  17. * @property {Boolean} sortable
  18. * @property {Boolean} stackItems
  19. * @property {String} type
  20. */
  21. /** @typedef {Object} Dataset
  22. * @property {String} id
  23. * @property {String} caption
  24. * @property {Boolean} optional
  25. * @property {Boolean} suppressMissing
  26. * @property {Boolean} needsSorted
  27. * @property {Boolean} requiresValues
  28. */
  29. /** @typedef {Object} PreferredSize
  30. * @property {Number} height
  31. * @property {Number} width
  32. */
  33. /** @typedef {Object} ThemeMappingEntry
  34. * @property {String} id
  35. * @property {Array} mapping
  36. */
  37. /** @typedef {Object} ThumbnailConfig
  38. * @property {String[]} unsupportedBrowsers
  39. */
  40. /**
  41. * Property Prefixes Object is dependent on the visualization but it contains visualization slots/definition with their
  42. * mapped values
  43. *
  44. * @typedef {Object} propertyPrefixes
  45. * @property {String} [categories]
  46. * @property {String} [color]
  47. * @property {String} [column]
  48. * @property {String|Array} [dataPoint]
  49. * @property {String} [legend]
  50. * @property {String} [row]
  51. * @property {String} [values]
  52. * @property {String} [x]
  53. * @property {String} [y]
  54. * @property {String} [grid_cols]
  55. * @property {String} [size]
  56. * @property {String} [width]
  57. * @property {String} [series]
  58. */
  59. /**
  60. * @class VisDefinitionAPI
  61. *
  62. * @classdesc
  63. *
  64. * The visualization definition describes what the definitions supports and how it behaves.
  65. * Each visualization has its definition where it defines the slots, properties, and other behavior.
  66. *
  67. * @property {String} caption
  68. * @property {String} control
  69. * @property {Number} dataRowLimit
  70. * @property {Number} dataRowLimitIE
  71. * @property {SlotDefinition[]} dataSlots
  72. * @property {Dataset[]} datasets
  73. * @property {String} icon
  74. * @property {String} id
  75. * @property {Boolean} isRecommendable
  76. * @property {String} label
  77. * @property {String} placeholderIcon
  78. * @property {PreferredSize} preferredSize
  79. * @property {Property[]} properties
  80. * @property {Object} propertyPrefixes
  81. * @property {String} renderer
  82. * @property {String} scope
  83. * @property {Object} specification
  84. * @property {Boolean} supportsAdvancedProperties
  85. * @property {ThemeMappingEntry[]} themeMapping
  86. * @property {ThumbnailConfig} thumbnailConfig
  87. * @property {String[]} usages
  88. * @property {Object} groupedProperty
  89. *
  90. *
  91. */
  92. define([], function () {
  93. var VisDefinitionAPI = function () {
  94. function VisDefinitionAPI() {
  95. _classCallCheck(this, VisDefinitionAPI);
  96. }
  97. /**
  98. * Return the visualization type
  99. * @function VisDefinitionAPI#getType
  100. * @returns {String} type
  101. */
  102. VisDefinitionAPI.prototype.getType = function getType() {};
  103. /**
  104. * Return the bundle ID
  105. * @function VisDefinitionAPI#getBundleId
  106. * @returns {String} bundleId
  107. */
  108. VisDefinitionAPI.prototype.getId = function getId() {};
  109. /**
  110. * Return the list of datasets
  111. * @function VisDefinitionAPI#getDatasetList
  112. * @returns {Dataset[]} array of datasets
  113. */
  114. VisDefinitionAPI.prototype.getDatasetList = function getDatasetList() {};
  115. /**
  116. * Return the label of visualization
  117. * @function VisDefinitionAPI#getLabel
  118. * @returns {String} label
  119. */
  120. VisDefinitionAPI.prototype.getLabel = function getLabel() {};
  121. /**
  122. * Returns an array of property used to render visualization property in UI
  123. * @function VisDefinitionAPI#getPreferredSize
  124. * @returns {PropertyLayoutSpec[]} properties
  125. */
  126. //getProperties() {}
  127. /**
  128. * Returns the preferred size of the visualization
  129. *
  130. * @returns {PreferredSize} PreferredSize
  131. */
  132. VisDefinitionAPI.prototype.getPreferredSize = function getPreferredSize() {};
  133. /**
  134. * Return the slot definition API
  135. * @param {String} slotId
  136. * @function VisDefinitionAPI#getSlot
  137. * @return {SlotDefinitionAPI} slot definition APIs
  138. */
  139. VisDefinitionAPI.prototype.getSlot = function getSlot() {};
  140. /**
  141. * Return the list slot definition APIs
  142. * @function VisDefinitionAPI#getSlotList
  143. * @return {SlotDefinitionAPI[]} array of slot definition APIs
  144. */
  145. VisDefinitionAPI.prototype.getSlotList = function getSlotList() {};
  146. /**
  147. * Return the icon of the visualization
  148. * @function VisDefinitionAPI#getIcon
  149. * @return {String} icon
  150. */
  151. VisDefinitionAPI.prototype.getIcon = function getIcon() {};
  152. /**
  153. * Return the uri of the icon of the visualization which is coming outside of the scope of dashboard
  154. * @function VisDefinitionAPI#getIconUri
  155. * @return {String} iconUri
  156. */
  157. VisDefinitionAPI.prototype.getIconUri = function getIconUri() {};
  158. /**
  159. * Returns the URI of the icon placeholder of the visualization
  160. * @function VisDefinitionAPI#getPlaceholderIconUri
  161. * @return {String} getPlaceholderIconUri
  162. */
  163. VisDefinitionAPI.prototype.getPlaceholderIconUri = function getPlaceholderIconUri() {};
  164. /**
  165. * @function VisDefinitionAPI#getMultiEdgeSort
  166. * @description Returns multiEdgeSort in visualization spec
  167. * @return {String} multiEdgeSort in visualization spec
  168. */
  169. VisDefinitionAPI.prototype.getMultiEdgeSort = function getMultiEdgeSort() {};
  170. /**
  171. * @function VisDefinitionAPI#getDefaultDatasetId
  172. * @description Return defaultDatasetId from the visualization spec. This allows a default dataset from a multi-dataset widget to be set for the visualization data pane.
  173. * @return {String} defaultDatasetId. Returns undefined for any empty/unset value.
  174. */
  175. VisDefinitionAPI.prototype.getDefaultDatasetId = function getDefaultDatasetId() {};
  176. /**
  177. * @function VisDefinitionAPI#refresh
  178. * @description Refresh the current visualization definition
  179. * @return {Promise} resolved when the definition has been refreshed
  180. */
  181. VisDefinitionAPI.prototype.refresh = function refresh() {};
  182. /**
  183. * @function VisDefinitionAPI#getState
  184. * @description Get the state of the vis definition.
  185. * @returns {VisDefinitionStateAPI} The vis definition state api {@link VisDefinitionStateAPI}
  186. */
  187. VisDefinitionAPI.prototype.getState = function getState() {};
  188. /**
  189. * @function VisDefinitionAPI#getProperty
  190. * @description Get a property value from the definition
  191. * @param {String} id
  192. * @returns {Object} Property value
  193. */
  194. VisDefinitionAPI.prototype.getProperty = function getProperty() {};
  195. return VisDefinitionAPI;
  196. }();
  197. return VisDefinitionAPI;
  198. });
  199. //# sourceMappingURL=VisDefinitionAPI.js.map