UNPKG

@gooddata/react-components

Version:

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

40 lines 2.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 GoodData Corporation var React = require("react"); var react_intl_1 = require("react-intl"); var LegendAxisIndicatorClass = /** @class */ (function (_super) { __extends(LegendAxisIndicatorClass, _super); function LegendAxisIndicatorClass() { return _super !== null && _super.apply(this, arguments) || this; } LegendAxisIndicatorClass.prototype.render = function () { var _a = this.props, labelKey = _a.labelKey, width = _a.width, data = _a.data, intl = _a.intl; var style = width ? { width: width + "px" } : {}; var values = (data || []).reduce(function (result, key, index) { result[index] = intl.formatMessage({ id: "visualizations.legend.text." + key }); return result; }, {}); return (React.createElement("div", { style: style, className: "series-axis-indicator" }, React.createElement("div", { className: "series-text" }, intl.formatMessage({ id: "visualizations.legend.text." + labelKey }, values), intl.formatMessage({ id: "visualizations.legend.text.colon" })))); }; return LegendAxisIndicatorClass; }(React.PureComponent)); exports.LegendAxisIndicatorClass = LegendAxisIndicatorClass; exports.LegendAxisIndicator = react_intl_1.injectIntl(LegendAxisIndicatorClass); //# sourceMappingURL=LegendAxisIndicator.js.map