UNPKG

@gooddata/react-components

Version:

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

41 lines 2.55 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 ConfigSection_1 = require("../ConfigSection"); var LegendPositionControl_1 = require("./LegendPositionControl"); var get = require("lodash/get"); var LegendSection = /** @class */ (function (_super) { __extends(LegendSection, _super); function LegendSection() { return _super !== null && _super.apply(this, arguments) || this; } LegendSection.prototype.render = function () { var _a = this.props, controlsDisabled = _a.controlsDisabled, properties = _a.properties, pushData = _a.pushData; var legendEnabled = get(this.props, "properties.controls.legend.enabled", true); var legendPosition = get(this.props, "properties.controls.legend.position", "auto"); var legendToggleDisabledByVisualization = !get(this.props, "propertiesMeta.legend_enabled", true); var toggleDisabled = controlsDisabled || legendToggleDisabledByVisualization; var legendPositionControlDisabled = !legendEnabled || toggleDisabled; var showDisabledMessage = controlsDisabled || legendToggleDisabledByVisualization; return (React.createElement(ConfigSection_1.default, { id: "legend_section", valuePath: "legend.enabled", title: "properties.legend.title", propertiesMeta: this.props.propertiesMeta, properties: properties, canBeToggled: true, toggleDisabled: toggleDisabled, toggledOn: legendEnabled, pushData: pushData, showDisabledMessage: showDisabledMessage }, React.createElement(LegendPositionControl_1.default, { disabled: legendPositionControlDisabled, value: legendPosition, showDisabledMessage: showDisabledMessage, properties: properties, pushData: pushData }))); }; return LegendSection; }(React.PureComponent)); exports.LegendSection = LegendSection; exports.default = LegendSection; //# sourceMappingURL=LegendSection.js.map