'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 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['react', 'react-dom', '../../../lib/@waca/dashboard-common/dist/core/APIFactory', './ToolbarDockDOMAPI', './ToolbarDockComponent'], function (React, ReactDOM, APIFactory, ToolbarDockDOMAPI, ToolbarDockComponent) { var ToolbarDockDOM = function () { function ToolbarDockDOM(_ref) { var features = _ref.features; _classCallCheck(this, ToolbarDockDOM); this._dashboard = features.API; this._toolbarDock = features.ToolbarDock; this._sections = {}; this._providers = {}; } ToolbarDockDOM.prototype.initialize = function initialize() { if (this._toolbarDock) { this._api = APIFactory.createAPI(this, [ToolbarDockDOMAPI]); var canvas = this._dashboard.getCurrentContentView().el; this._root = document.createElement('div'); canvas.insertBefore(this._root, canvas.firstChild); return this.render(); } else { this._api = undefined; return Promise.resolve(); } }; ToolbarDockDOM.prototype.getAPI = function getAPI() { return this._api; }; ToolbarDockDOM.prototype.destroy = function destroy() { this._root && ReactDOM.unmountComponentAtNode(this._root); this._root && this._root.parentNode && this._root.parentNode.removeChild(this._root); delete this._api; delete this._providers; delete this._node; }; /** API implementations */ ToolbarDockDOM.prototype.render = function render() { var _this = this; return new Promise(function (resolve) { ReactDOM.render(React.createElement(ToolbarDockComponent, { toolbarDockDOM: _this }), _this._root, resolve); }); }; ToolbarDockDOM.prototype.addProvider = function addProvider(providerID, provider) { this._providers[providerID] = provider; this.render(); }; ToolbarDockDOM.prototype.removeProvider = function removeProvider(providerID) { delete this._providers[providerID]; this.render(); }; ToolbarDockDOM.prototype.getProviders = function getProviders() { return this._providers; }; return ToolbarDockDOM; }(); return ToolbarDockDOM; }); //# sourceMappingURL=ToolbarDockDOM.js.map