UNPKG

@gooddata/react-components

Version:

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

74 lines 6.25 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_intl_1 = require("react-intl"); var Bubble_1 = require("@gooddata/goodstrap/lib/Bubble/Bubble"); var BubbleHoverTrigger_1 = require("@gooddata/goodstrap/lib/Bubble/BubbleHoverTrigger"); var classNames = require("classnames"); var ConfigurationPanelContent_1 = require("./ConfigurationPanelContent"); var LabelSubsection_1 = require("../configurationControls/axis/LabelSubsection"); var NameSubsection_1 = require("../configurationControls/axis/NameSubsection"); var ConfigSection_1 = require("../configurationControls/ConfigSection"); var CheckboxControl_1 = require("../configurationControls/CheckboxControl"); var MinMaxControl_1 = require("../configurationControls//MinMaxControl"); var mdObjectHelper_1 = require("../../utils/mdObjectHelper"); var bubble_1 = require("../../constants/bubble"); var BulletChartConfigurationPanel = /** @class */ (function (_super) { __extends(BulletChartConfigurationPanel, _super); function BulletChartConfigurationPanel() { return _super !== null && _super.apply(this, arguments) || this; } BulletChartConfigurationPanel.prototype.renderConfigurationPanel = function () { var _a = this.props, featureFlags = _a.featureFlags, propertiesMeta = _a.propertiesMeta, properties = _a.properties, pushData = _a.pushData, type = _a.type, mdObject = _a.mdObject; var controls = (properties && properties.controls) || {}; var xaxis = controls.xaxis, yaxis = controls.yaxis, grid = controls.grid; var xAxisVisible = xaxis && typeof xaxis.visible !== "undefined" ? xaxis.visible : true; var yAxisVisible = yaxis && typeof yaxis.visible !== "undefined" ? yaxis.visible : true; var gridEnabled = grid && typeof grid.enabled !== "undefined" ? grid.enabled : true; var controlsDisabled = this.isControlDisabled(); var _b = mdObjectHelper_1.countItemsOnAxes(type, controls, mdObject), itemsOnXAxis = _b.xaxis, itemsOnYAxis = _b.yaxis; var xAxisNameSectionDisabled = controlsDisabled || itemsOnXAxis !== 1; var isNameSubsectionVisible = featureFlags.enableAxisNameConfiguration; return (React.createElement(BubbleHoverTrigger_1.default, { showDelay: bubble_1.SHOW_DELAY_DEFAULT, hideDelay: bubble_1.HIDE_DELAY_DEFAULT }, React.createElement("div", null, this.renderColorSection(), React.createElement(ConfigSection_1.default, { id: "xaxis_section", title: "properties.xaxis.title", valuePath: "xaxis.visible", canBeToggled: true, toggledOn: xAxisVisible, toggleDisabled: controlsDisabled, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData }, isNameSubsectionVisible && (React.createElement(NameSubsection_1.default, { disabled: xAxisNameSectionDisabled, configPanelDisabled: controlsDisabled, axis: "xaxis", properties: properties, pushData: pushData })), React.createElement(LabelSubsection_1.default, { disabled: controlsDisabled, configPanelDisabled: controlsDisabled, axis: "xaxis", properties: properties, pushData: pushData }), this.renderMinMax("xaxis")), React.createElement(ConfigSection_1.default, { id: "yaxis_section", title: "properties.yaxis.title", valuePath: "yaxis.visible", canBeToggled: true, toggledOn: yAxisVisible, toggleDisabled: controlsDisabled, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData }, isNameSubsectionVisible && (React.createElement(NameSubsection_1.default, { disabled: controlsDisabled || itemsOnYAxis !== 1, configPanelDisabled: controlsDisabled, axis: "yaxis", properties: properties, pushData: pushData })), React.createElement(LabelSubsection_1.default, { disabled: controlsDisabled || itemsOnYAxis === 0, configPanelDisabled: controlsDisabled, axis: "yaxis", properties: properties, pushData: pushData })), this.renderLegendSection(), React.createElement(ConfigSection_1.default, { id: "canvas_section", title: "properties.canvas.title", propertiesMeta: propertiesMeta, properties: properties, pushData: pushData }, React.createElement(CheckboxControl_1.default, { valuePath: "grid.enabled", labelText: "properties.canvas.gridline", properties: properties, checked: gridEnabled, disabled: controlsDisabled, pushData: pushData }))), React.createElement(Bubble_1.default, { className: this.getBubbleClassNames(), arrowOffsets: { "tc bc": [bubble_1.BUBBLE_ARROW_OFFSET_X, bubble_1.BUBBLE_ARROW_OFFSET_Y] }, alignPoints: [{ align: "tc bc" }] }, React.createElement(react_intl_1.FormattedMessage, { id: "properties.config.not_applicable" })))); }; BulletChartConfigurationPanel.prototype.renderMinMax = function (basePath) { var _a = this.props, pushData = _a.pushData, properties = _a.properties, propertiesMeta = _a.propertiesMeta; return (React.createElement(MinMaxControl_1.default, { isDisabled: this.isControlDisabled(), basePath: basePath, pushData: pushData, properties: properties, propertiesMeta: propertiesMeta })); }; BulletChartConfigurationPanel.prototype.getBubbleClassNames = function () { return classNames("bubble-primary", { invisible: !this.isControlDisabled(), }); }; return BulletChartConfigurationPanel; }(ConfigurationPanelContent_1.default)); exports.default = BulletChartConfigurationPanel; //# sourceMappingURL=BulletChartConfigurationPanel.js.map