UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

56 lines 3.04 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); // (C) 2019-2020 GoodData Corporation var React = require("react"); var react_dom_1 = require("react-dom"); var AbstractPluggableVisualization_1 = require("../AbstractPluggableVisualization"); var domHelper_1 = require("../../../utils/domHelper"); var UnsupportedConfigurationPanel_1 = require("../../configurationPanels/UnsupportedConfigurationPanel"); var propertiesHelper_1 = require("../../../utils/propertiesHelper"); var internalIntlProvider_1 = require("../../../utils/internalIntlProvider"); var localization_1 = require("../../../../constants/localization"); var PluggableBaseHeadline = /** @class */ (function (_super) { __extends(PluggableBaseHeadline, _super); function PluggableBaseHeadline(props) { var _this = _super.call(this) || this; _this.projectId = props.projectId; _this.element = props.element; _this.configPanelElement = props.configPanelElement; _this.locale = props.locale ? props.locale : localization_1.DEFAULT_LOCALE; _this.intl = internalIntlProvider_1.createInternalIntl(_this.locale); _this.callbacks = props.callbacks; _this.featureFlags = props.featureFlags; return _this; } PluggableBaseHeadline.prototype.update = function (options, visualizationProperties, mdObject) { this.renderVisualization(options, mdObject); this.renderConfigurationPanel(visualizationProperties); }; PluggableBaseHeadline.prototype.unmount = function () { domHelper_1.unmountComponentsAtNodes([this.element, this.configPanelElement]); }; PluggableBaseHeadline.prototype.renderConfigurationPanel = function (visualizationProperties) { if (document.querySelector(this.configPanelElement)) { var properties = visualizationProperties ? propertiesHelper_1.getSupportedProperties(visualizationProperties, this.supportedPropertiesList) : {}; react_dom_1.render(React.createElement(UnsupportedConfigurationPanel_1.default, { locale: this.locale, pushData: this.callbacks.pushData, properties: properties }), document.querySelector(this.configPanelElement)); } }; return PluggableBaseHeadline; }(AbstractPluggableVisualization_1.AbstractPluggableVisualization)); exports.PluggableBaseHeadline = PluggableBaseHeadline; //# sourceMappingURL=PluggableBaseHeadline.js.map