'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud * (C) Copyright IBM Corp. 2017, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../lib/@waca/core-client/js/core-client/ui/core/View', '../../lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl', '../../lib/@waca/core-client/js/core-client/utils/Deferred', 'jquery', 'react-dom', '../../lib/@waca/dashboard-common/dist/ui/CenterLoadingSpinner'], function (View, PropertyUIControl, Deferred, $, ReactDOM, CenterLoadingSpinner) { var WidgetsPanelView = View.extend({ init: function init(options) { WidgetsPanelView.inherited('init', this, arguments); this.glassContext = options.glassContext; this.dashboardApi = options.dashboardApi; this.services = options.services; this.hooks = { getEntries: options.getEntries || Promise.resolve({}) }; this.whenIsReadyDfd = new Deferred(); this._initialize(); }, whenIsReady: function whenIsReady() { return this.whenIsReadyDfd.promise; }, setFocus: function setFocus() { this.$el.find('.itemOption:first').focus(); }, remove: function remove() { if (this._dropZone) { this._dropZone.remove(); } WidgetsPanelView.inherited('remove', this, arguments); }, render: function render() { var _this = this; if (!this._$loadingIndicatorBlocker) { this._$loadingIndicatorBlocker = $('
'); } this.$el.empty().addClass(this.className + ' widgetsPanelView'); this.$el.append(this._$loadingIndicatorBlocker); ReactDOM.render(CenterLoadingSpinner({ size: 'normal', variant: 'circle' }), this._$loadingIndicatorBlocker[0]); return this.hooks.getEntries().then(this._createPropertyControl.bind(this)).then(this.whenIsReady.bind(this)).then(function () { _this._dropZone = _this._dndManager.addDropTarget(_this.$el[0], { accepts: _this._accepts.bind(_this) }); }); }, _initialize: function _initialize() { this._dndManager = this.dashboardApi.getFeature('DashboardDnd.internal'); this.whenIsReadyDfd.resolve(); }, _createPropertyControl: function _createPropertyControl(spec) { spec.el = this.$el; spec.primaryUIControl = false; spec.glassContext = this.glassContext; var uiControl = new PropertyUIControl(spec); return Promise.try(function () { var _this2 = this; return uiControl.render().then(function () { //this._ellipsifyLabels(); ReactDOM.unmountComponentAtNode(_this2._$loadingIndicatorBlocker[0]); _this2._$loadingIndicatorBlocker.remove(); _this2._$loadingIndicatorBlocker = null; }); }.bind(this)); }, _accepts: function _accepts() { return true; } }); return WidgetsPanelView; }); //# sourceMappingURL=WidgetsPanelView.js.map