123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- '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, 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- /**
- * @class SlideoutDOM
- * @hideconstructor
- * @classdesc API class that is used to manage Slideout functionality
- * (including the corrsponding view) across API calls
- */
- define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', 'underscore', './PropertiesPaneDOMAPI'], function (APIFactory, _, PropertiesPaneDOMAPI) {
- var PropertiesPaneDOM = function () {
- function PropertiesPaneDOM(_ref) {
- var features = _ref.features;
- _classCallCheck(this, PropertiesPaneDOM);
- this._dashboard = features.API;
- this._properties = features.PropertiesPane;
- this._slideout = features.InAppSlideoutDOM;
- this._api = null;
- }
- PropertiesPaneDOM.prototype.getAPI = function getAPI() {
- return this._api;
- };
- PropertiesPaneDOM.prototype.getProviderId = function getProviderId() {
- return this._properties.getProviderId();
- };
- PropertiesPaneDOM.prototype.initialize = function initialize() {
- this._api = APIFactory.createAPI(this, [PropertiesPaneDOMAPI]);
- this._slideout.registerView(this._properties.getProviderId(), this._api);
- };
- PropertiesPaneDOM.prototype.getPropertiesView = function getPropertiesView() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- this._renderNode = options.parentNode;
- var viewRenderedPromise = void 0;
- var propertiesManager = this._dashboard.getFeature('propertiesManager');
- if (options.isChild) {
- viewRenderedPromise = propertiesManager.updateChildPropertiesView(options);
- } else {
- var selectedContentIds = this._getSelectedContentIds();
- var contentId = void 0;
- if (selectedContentIds && selectedContentIds.length > 0) {
- contentId = selectedContentIds[0];
- }
- viewRenderedPromise = propertiesManager.getPropertiesView(contentId);
- }
- return viewRenderedPromise;
- };
- PropertiesPaneDOM.prototype._getSelectedContentIds = function _getSelectedContentIds() {
- return this._dashboard.getCanvas().getSelectedContentList().map(function (content) {
- return content.getId();
- });
- };
- PropertiesPaneDOM.prototype.getRenderNode = function getRenderNode() {
- return this._renderNode;
- };
- PropertiesPaneDOM.prototype.render = function render(theOptions) {
- var propertiesManager = this._dashboard.getFeature('propertiesManager');
- var options = propertiesManager.getMostRecentChildOptions(theOptions);
- return this.getPropertiesView(options).then(function (view) {
- if (options && options.childPanelId) {
- view.$el.get(0).dataset.childPanelId = options.childPanelId;
- }
- return view.$el.get(0);
- });
- };
- PropertiesPaneDOM.prototype.close = function close() {
- var propertiesManager = this._dashboard.getFeature('propertiesManager');
- if (propertiesManager) {
- propertiesManager.closeAllChild();
- }
- this._renderNode = null;
- };
- PropertiesPaneDOM.prototype.destroy = function destroy() {
- this.close();
- this._api = null;
- this._dashboard = null;
- this._properties = null;
- this._slideout = null;
- };
- return PropertiesPaneDOM;
- }();
- return PropertiesPaneDOM;
- });
- //# sourceMappingURL=PropertiesPaneDOM.js.map
|