@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
46 lines • 2.67 kB
JavaScript
;
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 get = require("lodash/get");
var DropdownControl_1 = require("../DropdownControl");
var translations_1 = require("../../../utils/translations");
var dropdowns_1 = require("../../../constants/dropdowns");
var LabelRotationControl = /** @class */ (function (_super) {
__extends(LabelRotationControl, _super);
function LabelRotationControl() {
return _super !== null && _super.apply(this, arguments) || this;
}
LabelRotationControl.prototype.render = function () {
var _a = this.getControlProperties(), axisVisible = _a.axisVisible, axisLabelsEnabled = _a.axisLabelsEnabled, axisRotation = _a.axisRotation;
var isDisabled = this.props.disabled || !axisVisible || !axisLabelsEnabled;
return (React.createElement(DropdownControl_1.default, { value: axisRotation, valuePath: this.props.axis + ".rotation", labelText: "properties.axis.rotation", disabled: isDisabled, showDisabledMessage: !this.props.configPanelDisabled && isDisabled, properties: this.props.properties, pushData: this.props.pushData, items: translations_1.getTranslatedDropdownItems(dropdowns_1.rotationDropdownItems, this.props.intl) }));
};
LabelRotationControl.prototype.getControlProperties = function () {
var axisVisible = get(this.props, "properties.controls." + this.props.axis + ".visible", true);
var axisLabelsEnabled = get(this.props, "properties.controls." + this.props.axis + ".labelsEnabled", true);
var axisRotation = get(this.props, "properties.controls." + this.props.axis + ".rotation", "auto");
return {
axisVisible: axisVisible,
axisLabelsEnabled: axisLabelsEnabled,
axisRotation: axisRotation,
};
};
return LabelRotationControl;
}(React.PureComponent));
exports.default = react_intl_1.injectIntl(LabelRotationControl);
//# sourceMappingURL=LabelRotationControl.js.map