123456789101112131415161718192021222324252627282930313233343536373839404142 |
- "use strict";
- exports.__esModule = true;
- exports.default = DefaultLegendGroupRenderer;
- var _react = _interopRequireDefault(require("react"));
- var _DefaultLegendItem = _interopRequireDefault(require("./DefaultLegendItem"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
- const LEGEND_GROUP_STYLE = {
- display: 'flex',
- flexBasis: 'auto',
- flexDirection: 'row',
- flexGrow: 1,
- flexShrink: 1,
- flexWrap: 'wrap',
- fontSize: '0.8em',
- justifyContent: 'flex-end',
- padding: 8
- };
- function DefaultLegendGroupRenderer({
- items,
- ItemRenderer = _DefaultLegendItem.default,
- ItemMarkRenderer,
- ItemLabelRenderer,
- style
- }) {
- const combinedStyle = typeof style === 'undefined' ? LEGEND_GROUP_STYLE : _extends({}, LEGEND_GROUP_STYLE, {}, style);
- return _react.default.createElement("div", {
- style: combinedStyle
- }, items.map(item => _react.default.createElement(ItemRenderer, {
- key: "legend-item-" + item.field + "-" + item.value,
- item: item,
- MarkRenderer: ItemMarkRenderer,
- LabelRenderer: ItemLabelRenderer
- })));
- }
|