SlotsAPI.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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, 2021
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. /**
  9. * @interface SlotsAPI
  10. * @classdesc API class that is used to control slots.
  11. * @example visualization.getSlots()
  12. */
  13. define([], function () {
  14. var SlotsAPI = function () {
  15. function SlotsAPI() {
  16. _classCallCheck(this, SlotsAPI);
  17. }
  18. /**
  19. * @function SlotsAPI#createDataItems
  20. * @description Creates data items that are not mapped to any slot.
  21. * @public
  22. *
  23. * @param {object[]} dataitems Array of a dataItem spec. The spec contains a columnsId and an optional ID.
  24. * @param {Object} transactionToken
  25. */
  26. SlotsAPI.prototype.createDataItems = function createDataItems() {};
  27. /**
  28. * @function SlotsAPI#deleteDataItems
  29. * @description Deletes data items that correspond to the given dataItem IDs.
  30. * @public
  31. *
  32. * @param {String[]} idList List of data items IDs to delete. This will not remove slot mappings to the deleted dataItem IDs.
  33. * To delete and remove the mappings, use {@link SlotAPI#removeDataItems} instead.
  34. * @param {Object} transactionToken
  35. */
  36. SlotsAPI.prototype.deleteDataItems = function deleteDataItems() {};
  37. /**
  38. * @function SlotsAPI#setDataItems
  39. * @description Changes the data items assigned to an existing slot. Supports reordering and deletion of existing items.
  40. * @public
  41. *
  42. * @param {string[]} dataItemtIds - Ordered array of dataItem IDs to assign to this slot.
  43. * @param {string} slotId
  44. * @param {Object} transactionToken
  45. * @return {DataItemAPI[]} Array of removed data items
  46. */
  47. SlotsAPI.prototype.setDataItems = function setDataItems() {};
  48. /**
  49. * @function SlotsAPI#swapSlots
  50. * @description Swaps data items between the two slots that are identified by their IDs.
  51. * The operation should be performed as one transaction.
  52. * @public
  53. *
  54. * @param {string} sourceSlotId ID of the source slot
  55. * @param {string} targetSlotId ID of the target slot
  56. * @param {Object} transactionToken
  57. */
  58. SlotsAPI.prototype.swapSlots = function swapSlots() {};
  59. /**
  60. * @function SlotsAPI#getSlot
  61. * @description Gets the slot with the given ID
  62. * @public
  63. *
  64. * @param {string} slotId
  65. * @return {SlotAPI} Slot
  66. */
  67. SlotsAPI.prototype.getSlot = function getSlot() {};
  68. /**
  69. * @function SlotsAPI#getSlotList
  70. * @description Returns the list of all slots.
  71. * @public
  72. *
  73. * @return {SlotAPI[]}
  74. */
  75. SlotsAPI.prototype.getSlotList = function getSlotList() {};
  76. /**
  77. * @function SlotsAPI#getMappedSlotList
  78. * @description Returns the list of the mapped slots.
  79. * @public
  80. *
  81. * @return {SlotAPI[]}
  82. */
  83. SlotsAPI.prototype.getMappedSlotList = function getMappedSlotList() {};
  84. /**
  85. * @function SlotsAPI#getDataItem
  86. * @description Returns the data item with the given ID.
  87. * @public
  88. *
  89. * @param {String} dataItemId Unique dataItem ID
  90. *
  91. * @returns {dataItemAPI} Associated data item (or null)
  92. */
  93. SlotsAPI.prototype.getDataItem = function getDataItem() {};
  94. /**
  95. * @function SlotsAPI#getDataItemList
  96. * @description Returns a list of all dataItems in this visualization including ones which are not mapped to any slot.
  97. * @public
  98. *
  99. * @return {DataItem[]} dataItemList
  100. */
  101. SlotsAPI.prototype.getDataItemList = function getDataItemList() {};
  102. /**
  103. * @function SlotsAPI#getMappingInfo
  104. * @description Returns the data item location in the slots for the supplied dataItemUniqueId.
  105. * @public
  106. *
  107. * @param {string} dataItemId - dataItemUniqueId to find in the set of slots.
  108. * @return {MappingInfo} dataItem slot location information (dataItemAPI, slotAPI, indexInSlot).
  109. * Returns null if the data item is not mapped.
  110. */
  111. SlotsAPI.prototype.getMappingInfo = function getMappingInfo() /* dataItemId */{};
  112. /**
  113. * @function SlotsAPI#getMappingInfoList
  114. * @description Returns an array of all the data item mapping information for all the slots.
  115. * @public
  116. *
  117. * @return {MappingInfo[]} Array of data item mapping information
  118. */
  119. SlotsAPI.prototype.getMappingInfoList = function getMappingInfoList() {};
  120. /**
  121. * @function SlotsAPI#isMappingComplete
  122. * @description Returns true if all of the required slots for the specified layer are mapped and this visualization can be rendered.
  123. * If no layer is specified, then returns true if at least one layer has all required slots mapped.
  124. * @public
  125. *
  126. * @param {string} layerId (optional)
  127. * @return {boolean} isMappingComplete
  128. */
  129. SlotsAPI.prototype.isMappingComplete = function isMappingComplete() {};
  130. /**
  131. * @function SlotsAPI#clearAllSlots
  132. * @description Clears all slots content
  133. * @public
  134. *
  135. * @param {SetOptions} options
  136. */
  137. SlotsAPI.prototype.clearAllSlots = function clearAllSlots() /* options */{};
  138. /**
  139. * handlers can be registered for api's that support them (eg createDataItems, deleteDataItems)
  140. * @param {String} eventName - the name of the event eg change:dataitems:create
  141. * @param {function} handler - the handler
  142. */
  143. SlotsAPI.prototype.on = function on() {};
  144. /**
  145. * External code (eg navigate) can register a handler that will be called at the beginning of the deleteDataItemsAPI.
  146. * Similar to an event handler for delete but allows for 2 things
  147. * 1) It is called before items are deleted rather than after
  148. * 2) It can contribute to a transaction involving data item deletion.
  149. * @param {function} handler - the handler to call.
  150. */
  151. SlotsAPI.prototype.registerDeleteDataItemsHandler = function registerDeleteDataItemsHandler() {};
  152. return SlotsAPI;
  153. }();
  154. return SlotsAPI;
  155. });
  156. //# sourceMappingURL=SlotsAPI.js.map