OnDemandToolbarSectionDOM.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['react', '../../../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../ToolbarSectionDOMAPI', '../ToolbarSectionComponent', '../../ToolbarDockAPI'], function (React, APIFactory, ToolbarSectionDOMAPI, ToolbarSectionComponent, ToolbarDockAPI) {
  9. var OnDemandToolbarSectionDOM = function () {
  10. function OnDemandToolbarSectionDOM(_ref) {
  11. var features = _ref.features;
  12. _classCallCheck(this, OnDemandToolbarSectionDOM);
  13. this._toolbarDockDOM = features['ToolbarDockDOM'];
  14. this._toolbarDock = features['ToolbarDock'];
  15. }
  16. OnDemandToolbarSectionDOM.prototype.initialize = function initialize() {
  17. if (this._toolbarDockDOM) {
  18. this._api = APIFactory.createAPI(this, [ToolbarSectionDOMAPI]);
  19. this._toolbarDockDOM.addProvider(OnDemandToolbarSectionDOM.PROVIDER_ID, this);
  20. } else {
  21. this._api = undefined;
  22. }
  23. };
  24. OnDemandToolbarSectionDOM.prototype.getAPI = function getAPI() {
  25. return this._api;
  26. };
  27. OnDemandToolbarSectionDOM.prototype.destroy = function destroy() {
  28. delete this._api;
  29. delete this._node;
  30. };
  31. /** API implementations */
  32. OnDemandToolbarSectionDOM.prototype.setNode = function setNode(node) {
  33. this._node = node;
  34. };
  35. OnDemandToolbarSectionDOM.prototype.getNode = function getNode() {
  36. return this._node;
  37. };
  38. OnDemandToolbarSectionDOM.prototype.getReactElement = function getReactElement() {
  39. return React.createElement(ToolbarSectionComponent, {
  40. className: OnDemandToolbarSectionDOM.PROVIDER_ID,
  41. stateProvider: this._toolbarDock,
  42. stateEvent: ToolbarDockAPI.UPDATE_DOCKED_TOOLBAR_STATE,
  43. focusEvent: ToolbarDockAPI.FOCUS_DOCKED_TOOLBAR,
  44. toolbarSectionDOM: this
  45. });
  46. };
  47. OnDemandToolbarSectionDOM.prototype.getIndex = function getIndex() {
  48. return OnDemandToolbarSectionDOM.PROVIDER_INDEX;
  49. };
  50. return OnDemandToolbarSectionDOM;
  51. }();
  52. OnDemandToolbarSectionDOM.PROVIDER_ID = 'OnDemandToolbarSection';
  53. OnDemandToolbarSectionDOM.PROVIDER_INDEX = 0;
  54. return OnDemandToolbarSectionDOM;
  55. });
  56. //# sourceMappingURL=OnDemandToolbarSectionDOM.js.map