@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
45 lines • 2.19 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) 2007-2019 GoodData Corporation
var React = require("react");
var LegendItem_1 = require("./LegendItem");
var LegendAxisIndicator_1 = require("./LegendAxisIndicator");
var helpers_1 = require("./helpers");
exports.LegendSeparator = function () { return React.createElement("div", { className: "legend-separator" }); };
var LegendList = /** @class */ (function (_super) {
__extends(LegendList, _super);
function LegendList() {
return _super !== null && _super.apply(this, arguments) || this;
}
LegendList.prototype.render = function () {
var _a = this.props, series = _a.series, chartType = _a.chartType, onItemClick = _a.onItemClick, width = _a.width;
return series.map(function (item, index) {
var type = item.type, labelKey = item.labelKey, data = item.data;
if (type === helpers_1.LEGEND_AXIS_INDICATOR) {
return React.createElement(LegendAxisIndicator_1.LegendAxisIndicator, { key: index, labelKey: labelKey, data: data, width: width });
}
else if (type === helpers_1.LEGEND_SEPARATOR) {
return React.createElement(exports.LegendSeparator, { key: index });
}
else {
return (React.createElement(LegendItem_1.default, { chartType: chartType, key: index, item: item, width: width, onItemClick: onItemClick }));
}
});
};
return LegendList;
}(React.PureComponent));
exports.default = LegendList;
//# sourceMappingURL=LegendList.js.map