@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
79 lines • 6.04 kB
JavaScript
"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 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 get = require("lodash/get");
var classNames = require("classnames");
var ConfigurationPanelContent_1 = require("./ConfigurationPanelContent");
var ConfigSection_1 = require("../configurationControls/ConfigSection");
var DataLabelsControl_1 = require("../configurationControls/DataLabelsControl");
var NameSubsection_1 = require("../configurationControls/axis/NameSubsection");
var bubble_1 = require("../../constants/bubble");
var LabelSubsection_1 = require("../configurationControls/axis/LabelSubsection");
var bucketHelper_1 = require("../../utils/bucketHelper");
var HeatMapConfigurationPanel = /** @class */ (function (_super) {
__extends(HeatMapConfigurationPanel, _super);
function HeatMapConfigurationPanel() {
return _super !== null && _super.apply(this, arguments) || this;
}
HeatMapConfigurationPanel.prototype.renderConfigurationPanel = function () {
var _a = this.props, featureFlags = _a.featureFlags, propertiesMeta = _a.propertiesMeta, properties = _a.properties, pushData = _a.pushData;
var _b = this.getControlProperties(), xAxisVisible = _b.xAxisVisible, yAxisVisible = _b.yAxisVisible;
var controlsDisabled = this.isControlDisabled();
var xAxisDisabled = this.isAxisDisabled(controlsDisabled, "xaxis", this.props.mdObject);
var yAxisDisabled = this.isAxisDisabled(controlsDisabled, "yaxis", this.props.mdObject);
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: xAxisDisabled, showDisabledMessage: !controlsDisabled && xAxisDisabled, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData },
isNameSubsectionVisible && (React.createElement(NameSubsection_1.default, { disabled: xAxisDisabled, configPanelDisabled: controlsDisabled, axis: "xaxis", properties: properties, pushData: pushData })),
React.createElement(LabelSubsection_1.default, { disabled: xAxisDisabled, configPanelDisabled: controlsDisabled, axis: "xaxis", properties: properties, pushData: pushData })),
React.createElement(ConfigSection_1.default, { id: "yaxis_section", title: "properties.yaxis.title", valuePath: "yaxis.visible", canBeToggled: true, toggledOn: yAxisVisible, toggleDisabled: yAxisDisabled, showDisabledMessage: !controlsDisabled && yAxisDisabled, propertiesMeta: propertiesMeta, properties: properties, pushData: pushData },
isNameSubsectionVisible && (React.createElement(NameSubsection_1.default, { disabled: yAxisDisabled, configPanelDisabled: controlsDisabled, axis: "yaxis", properties: properties, pushData: pushData })),
React.createElement(LabelSubsection_1.default, { disabled: yAxisDisabled, 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(DataLabelsControl_1.default, { pushData: pushData, properties: properties, isDisabled: controlsDisabled, defaultValue: "auto" }))),
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" }))));
};
HeatMapConfigurationPanel.prototype.getBubbleClassNames = function () {
return classNames("bubble-primary", {
invisible: !this.isControlDisabled(),
});
};
HeatMapConfigurationPanel.prototype.getControlProperties = function () {
var xAxisVisible = get(this.props, "properties.controls.xaxis.visible", true);
var yAxisVisible = get(this.props, "properties.controls.yaxis.visible", true);
return {
xAxisVisible: xAxisVisible,
yAxisVisible: yAxisVisible,
};
};
HeatMapConfigurationPanel.prototype.isAxisDisabled = function (controlsDisabled, axis, mdObject) {
var isAxisDisabled = axis === "xaxis"
? bucketHelper_1.noColumnsAndHasOneMeasure(mdObject.buckets)
: bucketHelper_1.noRowsAndHasOneMeasure(mdObject.buckets);
return Boolean(controlsDisabled || isAxisDisabled);
};
return HeatMapConfigurationPanel;
}(ConfigurationPanelContent_1.default));
exports.default = HeatMapConfigurationPanel;
//# sourceMappingURL=HeatMapConfigurationPanel.js.map