@elastic/charts 65.0.0 → 65.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart_types/metric/renderer/dom/sparkline.js +8 -6
- package/dist/chart_types/metric/renderer/dom/sparkline.js.map +1 -1
- package/dist/chart_types/metric/renderer/dom/text.js +1 -1
- package/dist/chart_types/metric/renderer/dom/text.js.map +1 -1
- package/dist/chart_types/partition_chart/layout/viewmodel/hierarchy_of_arrays.js +2 -1
- package/dist/chart_types/partition_chart/layout/viewmodel/hierarchy_of_arrays.js.map +1 -1
- package/dist/chart_types/partition_chart/layout/viewmodel/viewmodel.js +4 -1
- package/dist/chart_types/partition_chart/layout/viewmodel/viewmodel.js.map +1 -1
- package/dist/chart_types/partition_chart/state/selectors/compute_legend.js +4 -2
- package/dist/chart_types/partition_chart/state/selectors/compute_legend.js.map +1 -1
- package/dist/chart_types/xy_chart/legend/legend.js +6 -23
- package/dist/chart_types/xy_chart/legend/legend.js.map +1 -1
- package/dist/chart_types/xy_chart/state/utils/get_legend_values.d.ts +2 -0
- package/dist/chart_types/xy_chart/state/utils/get_legend_values.d.ts.map +1 -0
- package/dist/chart_types/xy_chart/state/utils/{get_last_value.js → get_legend_values.js} +13 -3
- package/dist/chart_types/xy_chart/state/utils/get_legend_values.js.map +1 -0
- package/dist/chart_types/xy_chart/tooltip/tooltip.js +2 -1
- package/dist/chart_types/xy_chart/tooltip/tooltip.js.map +1 -1
- package/dist/common/legend.d.ts +1 -1
- package/dist/common/legend.d.ts.map +1 -1
- package/dist/common/legend.js +24 -2
- package/dist/common/legend.js.map +1 -1
- package/dist/components/chart.d.ts +1 -1
- package/dist/components/legend/label.js +42 -25
- package/dist/components/legend/label.js.map +1 -1
- package/dist/components/legend/legend.js +52 -12
- package/dist/components/legend/legend.js.map +1 -1
- package/dist/components/legend/legend_color_picker.d.ts +2 -0
- package/dist/components/legend/legend_color_picker.d.ts.map +1 -0
- package/dist/components/legend/legend_color_picker.js +42 -0
- package/dist/components/legend/legend_color_picker.js.map +1 -0
- package/dist/components/legend/legend_item.js +48 -103
- package/dist/components/legend/legend_item.js.map +1 -1
- package/dist/components/legend/legend_table/index.d.ts +2 -0
- package/dist/components/legend/legend_table/index.d.ts.map +1 -0
- package/dist/components/legend/legend_table/index.js +6 -0
- package/dist/components/legend/legend_table/index.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table.d.ts +2 -0
- package/dist/components/legend/legend_table/legend_table.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table.js +31 -0
- package/dist/components/legend/legend_table/legend_table.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table_body.d.ts +2 -0
- package/dist/components/legend/legend_table/legend_table_body.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table_body.js +13 -0
- package/dist/components/legend/legend_table/legend_table_body.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table_cell.d.ts +9 -0
- package/dist/components/legend/legend_table/legend_table_cell.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table_cell.js +16 -0
- package/dist/components/legend/legend_table/legend_table_cell.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table_header.d.ts +2 -0
- package/dist/components/legend/legend_table/legend_table_header.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table_header.js +24 -0
- package/dist/components/legend/legend_table/legend_table_header.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table_item.d.ts +2 -0
- package/dist/components/legend/legend_table/legend_table_item.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table_item.js +75 -0
- package/dist/components/legend/legend_table/legend_table_item.js.map +1 -0
- package/dist/components/legend/legend_table/legend_table_row.d.ts +7 -0
- package/dist/components/legend/legend_table/legend_table_row.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_table_row.js +14 -0
- package/dist/components/legend/legend_table/legend_table_row.js.map +1 -0
- package/dist/components/legend/legend_table/legend_value.d.ts +2 -0
- package/dist/components/legend/legend_table/legend_value.d.ts.map +1 -0
- package/dist/components/legend/legend_table/legend_value.js +13 -0
- package/dist/components/legend/legend_table/legend_value.js.map +1 -0
- package/dist/components/legend/types.d.ts +2 -0
- package/dist/components/legend/types.d.ts.map +1 -0
- package/dist/components/legend/types.js +3 -0
- package/dist/components/legend/types.js.map +1 -0
- package/dist/components/legend/utils.js +4 -4
- package/dist/components/legend/utils.js.map +1 -1
- package/dist/components/tooltip/components/tooltip_container.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_container.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_divider.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_divider.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_footer.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_footer.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_header.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_header.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_metric_row.d.ts +1 -1
- package/dist/components/tooltip/components/tooltip_metric_row.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table_body.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table_body.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table_cell.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table_cell.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table_footer.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table_footer.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table_header.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table_header.d.ts.map +1 -1
- package/dist/components/tooltip/components/tooltip_table_row.d.ts +2 -2
- package/dist/components/tooltip/components/tooltip_table_row.d.ts.map +1 -1
- package/dist/specs/constants.d.ts +1 -1
- package/dist/specs/constants.d.ts.map +1 -1
- package/dist/specs/settings.d.ts +4 -0
- package/dist/specs/settings.d.ts.map +1 -1
- package/dist/specs/settings.js.map +1 -1
- package/dist/state/selectors/get_legend_config_selector.js +2 -1
- package/dist/state/selectors/get_legend_config_selector.js.map +1 -1
- package/dist/state/selectors/get_legend_size.js +14 -8
- package/dist/state/selectors/get_legend_size.js.map +1 -1
- package/dist/state/selectors/get_legend_table_size.d.ts +2 -0
- package/dist/state/selectors/get_legend_table_size.d.ts.map +1 -0
- package/dist/state/selectors/get_legend_table_size.js +79 -0
- package/dist/state/selectors/get_legend_table_size.js.map +1 -0
- package/dist/theme.scss +301 -10
- package/dist/theme_dark.css +1 -1
- package/dist/theme_dark.css.map +1 -1
- package/dist/theme_light.css +1 -1
- package/dist/theme_light.css.map +1 -1
- package/dist/theme_only_dark.css +1 -1
- package/dist/theme_only_dark.css.map +1 -1
- package/dist/theme_only_light.css +1 -1
- package/dist/theme_only_light.css.map +1 -1
- package/package.json +5 -1
- package/dist/chart_types/xy_chart/state/utils/get_last_value.d.ts +0 -2
- package/dist/chart_types/xy_chart/state/utils/get_last_value.d.ts.map +0 -1
- package/dist/chart_types/xy_chart/state/utils/get_last_value.js.map +0 -1
|
@@ -26,53 +26,70 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Label = void 0;
|
|
29
|
+
exports.NonInteractiveLabel = exports.Label = void 0;
|
|
30
30
|
const classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
32
|
const common_1 = require("../../utils/common");
|
|
33
33
|
const isAppleDevice = typeof window !== 'undefined' && /Mac|iPhone|iPad/.test(window.navigator.userAgent);
|
|
34
|
-
const modifierKey = isAppleDevice ? '⌘
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const hideSeriesMessage = 'hide series';
|
|
34
|
+
const modifierKey = isAppleDevice ? '⌘' : 'Ctrl';
|
|
35
|
+
const showAllSeriesMessage = 'to show all';
|
|
36
|
+
const showSeriesMessage = 'to show';
|
|
37
|
+
const hideSeriesMessage = 'to hide';
|
|
39
38
|
function getInteractivityTitle(isSeriesVisible, hiddenSeries, allSeries) {
|
|
40
39
|
if (isSeriesVisible) {
|
|
41
40
|
if (allSeries - hiddenSeries === 1) {
|
|
42
41
|
return `
|
|
43
|
-
Click
|
|
44
|
-
${modifierKey} +
|
|
42
|
+
Click ${showAllSeriesMessage}
|
|
43
|
+
${modifierKey} + Click ${hideSeriesMessage}`;
|
|
45
44
|
}
|
|
46
45
|
if (hiddenSeries > 0) {
|
|
47
46
|
return `
|
|
48
|
-
Click
|
|
49
|
-
${modifierKey} + click: ${hideSeriesMessage}`;
|
|
47
|
+
Click ${hideSeriesMessage}`;
|
|
50
48
|
}
|
|
51
49
|
return `
|
|
52
|
-
Click
|
|
53
|
-
${modifierKey} +
|
|
50
|
+
Click ${showSeriesMessage}
|
|
51
|
+
${modifierKey} + Click ${hideSeriesMessage}`;
|
|
54
52
|
}
|
|
55
53
|
return `
|
|
56
|
-
Click
|
|
57
|
-
${modifierKey} + click: ${showSeriesMessage}`;
|
|
54
|
+
Click ${showSeriesMessage}`;
|
|
58
55
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
function getInteractivityAriaLabel(isSeriesVisible, hiddenSeries, allSeries) {
|
|
57
|
+
if (isSeriesVisible) {
|
|
58
|
+
if (allSeries - hiddenSeries === 1) {
|
|
59
|
+
return `Click: ${showAllSeriesMessage}, ${modifierKey} + Click: ${hideSeriesMessage}`;
|
|
60
|
+
}
|
|
61
|
+
if (hiddenSeries > 0) {
|
|
62
|
+
return `Click: ${hideSeriesMessage}, ${modifierKey} + Click: ${hideSeriesMessage}`;
|
|
63
|
+
}
|
|
64
|
+
return `Click: ${showSeriesMessage}, ${modifierKey} + Click: ${hideSeriesMessage}`;
|
|
65
|
+
}
|
|
66
|
+
return `Click: ${showSeriesMessage}, ${modifierKey} + Click: ${showSeriesMessage}`;
|
|
67
|
+
}
|
|
68
|
+
function Label({ label, onToggle, isToggleable, isSeriesHidden, options, hiddenSeriesCount, totalSeriesCount, }) {
|
|
69
|
+
const { className, dir, clampStyles } = getSharedProps(label, options, !!onToggle);
|
|
66
70
|
const onClick = (0, react_1.useCallback)(({ metaKey, ctrlKey }) => onToggle === null || onToggle === void 0 ? void 0 : onToggle(isAppleDevice ? metaKey : ctrlKey), [onToggle]);
|
|
67
71
|
const onKeyDown = (0, react_1.useCallback)(({ key, metaKey, ctrlKey }) => {
|
|
68
72
|
if (key === ' ' || key === 'Enter')
|
|
69
73
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle(isAppleDevice ? metaKey : ctrlKey);
|
|
70
74
|
}, [onToggle]);
|
|
71
|
-
const dir = (0, common_1.isRTLString)(label) ? 'rtl' : 'ltr';
|
|
72
75
|
const title = options.maxLines > 0 ? label : '';
|
|
73
|
-
|
|
74
|
-
const interactionsGuidanceText = getInteractivityTitle(!isSeriesHidden, hiddenSeriesCount, totalSeriesCount);
|
|
75
|
-
return isToggleable ? (react_1.default.createElement("div", { role: "button", tabIndex: 0, dir: dir, className: labelClassNames, title: `${title}${interactionsGuidanceText}`, onClick: onClick, onKeyDown: onKeyDown, "aria-pressed": isSeriesHidden, style: clampStyles, "aria-label": `${label}; ${interactionsGuidanceText.replace('\n', '')}` }, label)) : (react_1.default.createElement("div", { dir: dir, className: labelClassNames, title: label, style: clampStyles }, label));
|
|
76
|
+
return isToggleable ? (react_1.default.createElement("div", { role: "button", tabIndex: 0, dir: dir, className: className, title: `${title}\n${getInteractivityTitle(!isSeriesHidden, hiddenSeriesCount, totalSeriesCount)}`, onClick: onClick, onKeyDown: onKeyDown, "aria-pressed": isSeriesHidden, style: clampStyles, "aria-label": `${label}; ${getInteractivityAriaLabel(!isSeriesHidden, hiddenSeriesCount, totalSeriesCount)}` }, label)) : (react_1.default.createElement("div", { dir: dir, className: className, title: label, style: clampStyles }, label));
|
|
76
77
|
}
|
|
77
78
|
exports.Label = Label;
|
|
79
|
+
function NonInteractiveLabel({ label, options }) {
|
|
80
|
+
const { className, dir, clampStyles } = getSharedProps(label, options);
|
|
81
|
+
return (react_1.default.createElement("div", { dir: dir, className: className, title: label, style: clampStyles }, label));
|
|
82
|
+
}
|
|
83
|
+
exports.NonInteractiveLabel = NonInteractiveLabel;
|
|
84
|
+
function getSharedProps(label, options, isToggleable) {
|
|
85
|
+
const maxLines = Math.abs(options.maxLines);
|
|
86
|
+
const className = (0, classnames_1.default)('echLegendItem__label', {
|
|
87
|
+
'echLegendItem__label--clickable': Boolean(isToggleable),
|
|
88
|
+
'echLegendItem__label--singleline': maxLines === 1,
|
|
89
|
+
'echLegendItem__label--multiline': maxLines > 1,
|
|
90
|
+
});
|
|
91
|
+
const dir = (0, common_1.isRTLString)(label) ? 'rtl' : 'ltr';
|
|
92
|
+
const clampStyles = maxLines > 1 ? { WebkitLineClamp: maxLines } : {};
|
|
93
|
+
return { className, dir, clampStyles };
|
|
94
|
+
}
|
|
78
95
|
//# sourceMappingURL=label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/components/legend/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,4DAAoC;AACpC,+CAAoF;AAEpF,+CAAiD;AAajD,MAAM,aAAa,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AAE1G,MAAM,WAAW,GAAG,aAAa,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/components/legend/label.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.Legend = void 0;
|
|
7
30
|
const classnames_1 = __importDefault(require("classnames"));
|
|
8
|
-
const react_1 =
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
9
32
|
const react_redux_1 = require("react-redux");
|
|
10
33
|
const redux_1 = require("redux");
|
|
11
34
|
const custom_legend_1 = require("./custom_legend");
|
|
12
35
|
const legend_item_1 = require("./legend_item");
|
|
36
|
+
const legend_table_1 = require("./legend_table");
|
|
13
37
|
const position_style_1 = require("./position_style");
|
|
14
38
|
const style_utils_1 = require("./style_utils");
|
|
39
|
+
const legend_1 = require("../../common/legend");
|
|
15
40
|
const specs_1 = require("../../specs");
|
|
16
41
|
const colors_1 = require("../../state/actions/colors");
|
|
17
|
-
const
|
|
42
|
+
const legend_2 = require("../../state/actions/legend");
|
|
18
43
|
const get_chart_theme_1 = require("../../state/selectors/get_chart_theme");
|
|
19
44
|
const get_internal_is_intialized_1 = require("../../state/selectors/get_internal_is_intialized");
|
|
20
45
|
const get_internal_main_projection_area_1 = require("../../state/selectors/get_internal_main_projection_area");
|
|
@@ -30,6 +55,20 @@ const light_theme_1 = require("../../utils/themes/light_theme");
|
|
|
30
55
|
function LegendComponent(props) {
|
|
31
56
|
var _a;
|
|
32
57
|
const { items, size, debug, isBrushing, chartTheme: { chartMargins, legend }, chartDimensions, containerDimensions, config, } = props;
|
|
58
|
+
const { onLegendItemOut, onLegendItemOver } = config;
|
|
59
|
+
const { onItemOutAction, onItemOverAction } = props;
|
|
60
|
+
const onLegendItemMouseOver = (0, react_1.useCallback)((seriesIdentifiers, path) => {
|
|
61
|
+
if (onLegendItemOver) {
|
|
62
|
+
onLegendItemOver(seriesIdentifiers);
|
|
63
|
+
}
|
|
64
|
+
onItemOverAction(path);
|
|
65
|
+
}, [onItemOverAction, onLegendItemOver]);
|
|
66
|
+
const onLegendItemMouseOut = (0, react_1.useCallback)(() => {
|
|
67
|
+
if (onLegendItemOut) {
|
|
68
|
+
onLegendItemOut();
|
|
69
|
+
}
|
|
70
|
+
onItemOutAction();
|
|
71
|
+
}, [onLegendItemOut, onItemOutAction]);
|
|
33
72
|
if (items.every(({ isItemHidden }) => isItemHidden)) {
|
|
34
73
|
return null;
|
|
35
74
|
}
|
|
@@ -54,21 +93,21 @@ function LegendComponent(props) {
|
|
|
54
93
|
hiddenItems: items.filter(({ isSeriesHidden }) => isSeriesHidden).length,
|
|
55
94
|
extraValues: props.extraValues,
|
|
56
95
|
legendValues: config.legendValues,
|
|
57
|
-
|
|
58
|
-
|
|
96
|
+
onLegendItemMouseOver,
|
|
97
|
+
onLegendItemMouseOut,
|
|
59
98
|
onClick: config.onLegendItemClick,
|
|
60
99
|
clearTemporaryColorsAction: props.clearTemporaryColors,
|
|
61
100
|
setPersistedColorAction: props.setPersistedColor,
|
|
62
101
|
setTemporaryColorAction: props.setTemporaryColor,
|
|
63
|
-
mouseOutAction: props.onItemOutAction,
|
|
64
|
-
mouseOverAction: props.onItemOverAction,
|
|
65
102
|
toggleDeselectSeriesAction: props.onToggleDeselectSeriesAction,
|
|
66
103
|
colorPicker: config.legendColorPicker,
|
|
67
104
|
action: config.legendAction,
|
|
68
105
|
labelOptions: legend.labelOptions,
|
|
69
106
|
flatLegend: (_a = config.flatLegend) !== null && _a !== void 0 ? _a : specs_1.DEFAULT_LEGEND_CONFIG.flatLegend,
|
|
107
|
+
legendTitle: config.legendTitle,
|
|
70
108
|
};
|
|
71
109
|
const positionStyle = (0, position_style_1.legendPositionStyle)(config, size, chartDimensions, containerDimensions);
|
|
110
|
+
const isTableView = (0, legend_1.shouldDisplayTable)(itemProps.legendValues);
|
|
72
111
|
return (react_1.default.createElement("div", { className: legendClasses, style: positionStyle, dir: isMostlyRTL ? 'rtl' : 'ltr' }, config.customLegend ? (react_1.default.createElement("div", { style: containerStyle },
|
|
73
112
|
react_1.default.createElement(custom_legend_1.CustomLegend, { component: config.customLegend, items: items.map(({ seriesIdentifiers, childId, path, ...customProps }) => {
|
|
74
113
|
var _a, _b, _c;
|
|
@@ -77,17 +116,18 @@ function LegendComponent(props) {
|
|
|
77
116
|
seriesIdentifiers,
|
|
78
117
|
path,
|
|
79
118
|
extraValue: (_c = itemProps.extraValues.get((_b = (_a = seriesIdentifiers[0]) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : '')) === null || _c === void 0 ? void 0 : _c.get(childId !== null && childId !== void 0 ? childId : ''),
|
|
80
|
-
onItemOutAction
|
|
81
|
-
onItemOverActon: () =>
|
|
119
|
+
onItemOutAction,
|
|
120
|
+
onItemOverActon: () => onItemOverAction(path),
|
|
82
121
|
onItemClickAction: (negate) => itemProps.toggleDeselectSeriesAction(seriesIdentifiers, negate),
|
|
83
122
|
});
|
|
84
|
-
}) }))) : (react_1.default.createElement("div", { style: containerStyle, className: "
|
|
123
|
+
}) }))) : isTableView ? (react_1.default.createElement("div", { style: containerStyle, className: "echLegendTable__container" },
|
|
124
|
+
react_1.default.createElement(legend_table_1.LegendTable, { items: items, ...itemProps, seriesWidth: size.seriesWidth }))) : (react_1.default.createElement("div", { style: containerStyle, className: "echLegendListContainer" },
|
|
85
125
|
react_1.default.createElement("ul", { style: listStyle, className: "echLegendList" }, items.map((item, index) => (react_1.default.createElement(legend_item_1.LegendListItem, { key: `${index}`, item: item, ...itemProps }))))))));
|
|
86
126
|
}
|
|
87
127
|
const mapDispatchToProps = (dispatch) => (0, redux_1.bindActionCreators)({
|
|
88
|
-
onToggleDeselectSeriesAction:
|
|
89
|
-
onItemOutAction:
|
|
90
|
-
onItemOverAction:
|
|
128
|
+
onToggleDeselectSeriesAction: legend_2.onToggleDeselectSeriesAction,
|
|
129
|
+
onItemOutAction: legend_2.onLegendItemOutAction,
|
|
130
|
+
onItemOverAction: legend_2.onLegendItemOverAction,
|
|
91
131
|
clearTemporaryColors: colors_1.clearTemporaryColors,
|
|
92
132
|
setTemporaryColor: colors_1.setTemporaryColor,
|
|
93
133
|
setPersistedColor: colors_1.setPersistedColor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../../src/components/legend/legend.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../../src/components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ClC,KAAK,EAAE,IAAA,yCAAsB,EAAC,KAAK,CAAC;QACpC,WAAW,EAAE,IAAA,sDAA4B,EAAC,KAAK,CAAC;QAChD,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AAGW,QAAA,MAAM,GAAG,IAAA,qBAAO,EAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend_color_picker.d.ts","sourceRoot":"","sources":["../../../src/components/legend/legend_color_picker.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useLegendColorPicker = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const color_1 = require("./color");
|
|
9
|
+
const useLegendColorPicker = ({ item: { color, isSeriesHidden, label, pointStyle, seriesIdentifiers }, colorPicker: ColorPickerRenderer, clearTemporaryColorsAction, setTemporaryColorAction, setPersistedColorAction, }) => {
|
|
10
|
+
const [isOpen, setIsOpen] = react_1.default.useState(false);
|
|
11
|
+
const colorRef = react_1.default.useRef(null);
|
|
12
|
+
const shouldClearPersistedColor = react_1.default.useRef(false);
|
|
13
|
+
const toggleIsOpen = () => {
|
|
14
|
+
setIsOpen((prevIsOpen) => !prevIsOpen);
|
|
15
|
+
};
|
|
16
|
+
const handleColorClick = (changeable) => changeable
|
|
17
|
+
? (event) => {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
toggleIsOpen();
|
|
20
|
+
}
|
|
21
|
+
: undefined;
|
|
22
|
+
const handleColorPickerClose = () => {
|
|
23
|
+
const seriesKeys = seriesIdentifiers.map(({ key }) => key);
|
|
24
|
+
setPersistedColorAction(seriesKeys, shouldClearPersistedColor.current ? null : color);
|
|
25
|
+
clearTemporaryColorsAction();
|
|
26
|
+
requestAnimationFrame(() => { var _a; return (_a = colorRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
27
|
+
toggleIsOpen();
|
|
28
|
+
};
|
|
29
|
+
const handleColorPickerChange = (c) => {
|
|
30
|
+
const seriesKeys = seriesIdentifiers.map(({ key }) => key);
|
|
31
|
+
shouldClearPersistedColor.current = c === null;
|
|
32
|
+
setTemporaryColorAction(seriesKeys, c);
|
|
33
|
+
};
|
|
34
|
+
const hasColorPicker = Boolean(ColorPickerRenderer);
|
|
35
|
+
const renderItemColor = () => (react_1.default.createElement(color_1.Color, { ref: colorRef, color: color, seriesName: label, isSeriesHidden: isSeriesHidden, hasColorPicker: hasColorPicker, onClick: handleColorClick(hasColorPicker), pointStyle: pointStyle }));
|
|
36
|
+
const renderColorPickerPopup = () => ColorPickerRenderer &&
|
|
37
|
+
isOpen &&
|
|
38
|
+
colorRef.current && (react_1.default.createElement(ColorPickerRenderer, { anchor: colorRef.current, color: color, onClose: handleColorPickerClose, onChange: handleColorPickerChange, seriesIdentifiers: seriesIdentifiers }));
|
|
39
|
+
return { renderItemColor, renderColorPickerPopup };
|
|
40
|
+
};
|
|
41
|
+
exports.useLegendColorPicker = useLegendColorPicker;
|
|
42
|
+
//# sourceMappingURL=legend_color_picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend_color_picker.js","sourceRoot":"","sources":["../../../src/components/legend/legend_color_picker.tsx"],"names":[],"mappings":";;;;;;AAQA,kDAA0B;AAE1B,mCAA6C;AAKtC,MAAM,oBAAoB,GAAG,CAAC,EACnC,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,EACrE,WAAW,EAAE,mBAAmB,EAChC,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,GACP,EAAE,EAAE;IACpB,MAAM,CAAC,M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,UAAU,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEpD,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,CAC5B,8BAAC,aAAS,IACR,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,KAAK,EACjB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,gBAAgB,CAAC,cAAc,CAAC,EACzC,UAAU,EAAE,UAAU,GACtB,CACH,CAAC;IAEF,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAClC,mBAAmB;QACnB,MAAM;QACN,QAAQ,CAAC,OAAO,IAAI,CAClB,8BAAC,mBAAmB,IAClB,MAAM,EAAE,QAAQ,CAAC,OAAO,EACxB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,uBAAuB,EACjC,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CAAC;IAEJ,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC;AACrD,CAAC,CAAC;AAhEW,QAAA,oBAAoB,wBAgE/B"}
|
|
@@ -26,117 +26,62 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.LegendListItem = exports.LEGEND_HIERARCHY_MARGIN = void 0;
|
|
29
|
+
exports.LegendListItem = exports.prepareLegendValues = exports.LEGEND_HIERARCHY_MARGIN = void 0;
|
|
30
30
|
const classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
const color_1 = require("./color");
|
|
33
32
|
const label_1 = require("./label");
|
|
33
|
+
const legend_color_picker_1 = require("./legend_color_picker");
|
|
34
34
|
const utils_1 = require("./utils");
|
|
35
35
|
const legend_1 = require("../../common/legend");
|
|
36
36
|
const common_1 = require("../../utils/common");
|
|
37
|
-
const fast_deep_equal_1 = require("../../utils/fast_deep_equal");
|
|
38
37
|
exports.LEGEND_HIERARCHY_MARGIN = 10;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
onMouseOver(item.seriesIdentifiers);
|
|
61
|
-
}
|
|
62
|
-
mouseOverAction(item.path);
|
|
63
|
-
};
|
|
64
|
-
this.onLegendItemMouseOut = () => {
|
|
65
|
-
const { onMouseOut, mouseOutAction } = this.props;
|
|
66
|
-
if (onMouseOut) {
|
|
67
|
-
onMouseOut();
|
|
68
|
-
}
|
|
69
|
-
mouseOutAction();
|
|
70
|
-
};
|
|
71
|
-
this.onLabelToggle = (legendItemId) => {
|
|
72
|
-
const { item, onClick, toggleDeselectSeriesAction, totalItems } = this.props;
|
|
73
|
-
if (totalItems <= 1 || (!item.isToggleable && !onClick)) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
return (negate) => {
|
|
77
|
-
if (onClick) {
|
|
78
|
-
onClick(legendItemId);
|
|
79
|
-
}
|
|
80
|
-
if (item.isToggleable) {
|
|
81
|
-
toggleDeselectSeriesAction(legendItemId, negate);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
87
|
-
return !(0, fast_deep_equal_1.deepEqual)(this.props, nextProps) || !(0, fast_deep_equal_1.deepEqual)(this.state, nextState);
|
|
88
|
-
}
|
|
89
|
-
renderColorPicker() {
|
|
90
|
-
const { colorPicker: ColorPicker, item, clearTemporaryColorsAction, setTemporaryColorAction, setPersistedColorAction, } = this.props;
|
|
91
|
-
const { seriesIdentifiers, color } = item;
|
|
92
|
-
const seriesKeys = seriesIdentifiers.map(({ key }) => key);
|
|
93
|
-
const handleClose = () => {
|
|
94
|
-
setPersistedColorAction(seriesKeys, this.shouldClearPersistedColor ? null : color);
|
|
95
|
-
clearTemporaryColorsAction();
|
|
96
|
-
requestAnimationFrame(() => { var _a, _b; return (_b = (_a = this.colorRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus(); });
|
|
97
|
-
this.toggleIsOpen();
|
|
98
|
-
};
|
|
99
|
-
const handleChange = (c) => {
|
|
100
|
-
this.shouldClearPersistedColor = c === null;
|
|
101
|
-
setTemporaryColorAction(seriesKeys, c);
|
|
38
|
+
const prepareLegendValues = (item, legendValues, totalItems, extraValues) => {
|
|
39
|
+
return legendValues.map((legendValue) => {
|
|
40
|
+
if (legendValue === legend_1.LegendValue.Value || legendValue === legend_1.LegendValue.CurrentAndLastValue) {
|
|
41
|
+
return (0, utils_1.getExtra)(extraValues, item, totalItems);
|
|
42
|
+
}
|
|
43
|
+
return item.values.find(({ type }) => type === legendValue);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.prepareLegendValues = prepareLegendValues;
|
|
47
|
+
const LegendListItem = (props) => {
|
|
48
|
+
const { extraValues, item, legendValues, totalItems, action: Action, positionConfig, labelOptions, isMostlyRTL, flatLegend, onClick, toggleDeselectSeriesAction, hiddenItems, onLegendItemMouseOver, onLegendItemMouseOut, } = props;
|
|
49
|
+
const { color, isSeriesHidden, isItemHidden, seriesIdentifiers, label, depth, path, isToggleable } = item;
|
|
50
|
+
const itemClassNames = (0, classnames_1.default)('echLegendItem', {
|
|
51
|
+
'echLegendItem--hidden': isSeriesHidden,
|
|
52
|
+
'echLegendItem--vertical': positionConfig.direction === common_1.LayoutDirection.Vertical,
|
|
53
|
+
});
|
|
54
|
+
const legendValueItems = (0, exports.prepareLegendValues)(item, legendValues, totalItems, extraValues).filter(common_1.isDefined);
|
|
55
|
+
const style = flatLegend
|
|
56
|
+
? {}
|
|
57
|
+
: {
|
|
58
|
+
[isMostlyRTL ? 'marginRight' : 'marginLeft']: exports.LEGEND_HIERARCHY_MARGIN * (depth !== null && depth !== void 0 ? depth : 0),
|
|
102
59
|
};
|
|
103
|
-
|
|
104
|
-
|
|
60
|
+
const onLabelToggle = (0, react_1.useCallback)((legendItemId) => (negate) => {
|
|
61
|
+
if (totalItems <= 1 || (!isToggleable && !onClick)) {
|
|
62
|
+
return;
|
|
105
63
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
:
|
|
121
|
-
|
|
122
|
-
:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
129
|
-
react_1.default.createElement("li", { className: itemClassNames, onMouseEnter: this.onLegendItemMouseOver, onMouseLeave: this.onLegendItemMouseOut, style: style, dir: isMostlyRTL ? 'rtl' : 'ltr', "data-ech-series-name": label },
|
|
130
|
-
react_1.default.createElement("div", { className: "background" }),
|
|
131
|
-
react_1.default.createElement("div", { className: "colorWrapper" },
|
|
132
|
-
react_1.default.createElement(color_1.Color, { ref: this.colorRef, color: color, seriesName: label, isSeriesHidden: isSeriesHidden, hasColorPicker: hasColorPicker, onClick: this.handleColorClick(hasColorPicker), pointStyle: pointStyle })),
|
|
133
|
-
react_1.default.createElement(label_1.Label, { label: label, options: labelOptions, isToggleable: totalItems > 1 && item.isToggleable, onToggle: this.onLabelToggle(seriesIdentifiers), isSeriesHidden: isSeriesHidden, totalSeriesCount: totalItems, hiddenSeriesCount: hiddenItems }),
|
|
134
|
-
legendValue && !isSeriesHidden && (react_1.default.createElement("div", { className: "echLegendItem__extra", title: `${legendValue.label}` }, legendValue.label)),
|
|
135
|
-
Action && (react_1.default.createElement("div", { className: "echLegendItem__action" },
|
|
136
|
-
react_1.default.createElement(Action, { series: seriesIdentifiers, color: color, label: label })))),
|
|
137
|
-
this.renderColorPicker()));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
64
|
+
if (onClick) {
|
|
65
|
+
onClick(legendItemId);
|
|
66
|
+
}
|
|
67
|
+
if (isToggleable) {
|
|
68
|
+
toggleDeselectSeriesAction(legendItemId, negate);
|
|
69
|
+
}
|
|
70
|
+
}, [onClick, toggleDeselectSeriesAction, isToggleable, totalItems]);
|
|
71
|
+
const { renderItemColor, renderColorPickerPopup } = (0, legend_color_picker_1.useLegendColorPicker)(props);
|
|
72
|
+
if (isItemHidden)
|
|
73
|
+
return null;
|
|
74
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
75
|
+
react_1.default.createElement("li", { className: itemClassNames, onMouseEnter: () => onLegendItemMouseOver(seriesIdentifiers, path), onMouseLeave: onLegendItemMouseOut, style: style, dir: isMostlyRTL ? 'rtl' : 'ltr', "data-ech-series-name": label },
|
|
76
|
+
react_1.default.createElement("div", { className: "background" }),
|
|
77
|
+
react_1.default.createElement("div", { className: "echLegend__colorWrapper" }, renderItemColor()),
|
|
78
|
+
react_1.default.createElement(label_1.Label, { label: label, options: labelOptions, isToggleable: totalItems > 1 && item.isToggleable, onToggle: onLabelToggle(seriesIdentifiers), isSeriesHidden: isSeriesHidden, totalSeriesCount: totalItems, hiddenSeriesCount: hiddenItems }),
|
|
79
|
+
!isSeriesHidden
|
|
80
|
+
? legendValueItems.map((legendValueItem) => legendValueItem.label !== '' ? (react_1.default.createElement("div", { key: legendValueItem.label, className: "echLegendItem__legendValue" }, legendValueItem.label)) : null)
|
|
81
|
+
: null,
|
|
82
|
+
Action && (react_1.default.createElement("div", { className: "echLegendItem__action" },
|
|
83
|
+
react_1.default.createElement(Action, { series: seriesIdentifiers, color: color, label: label })))),
|
|
84
|
+
renderColorPickerPopup()));
|
|
85
|
+
};
|
|
140
86
|
exports.LegendListItem = LegendListItem;
|
|
141
|
-
LegendListItem.displayName = 'LegendItem';
|
|
142
87
|
//# sourceMappingURL=legend_item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend_item.js","sourceRoot":"","sources":["../../../src/components/legend/legend_item.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,4DAAoC;AACpC,+
|
|
1
|
+
{"version":3,"file":"legend_item.js","sourceRoot":"","sources":["../../../src/components/legend/legend_item.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,4DAAoC;AACpC,+CAA0D;AAE1D,mCAA6C;AAC7C,+DAA6D;AAE7D,mCAAmC;AACnC,gDAAqF;AAErF,+CAAgE;AAGnD,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAQnC,MAAM,mBAAmB,GAAG,CACjC,IAAgB,EAChB,YAA2B,EAC3B,UAAkB,EAClB,WAA+C,EAC/C,EAAE;IACF,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;QACtC,IAAI,WAAW,KAAK,oBAAW,CAAC,KAAK,IAAI,WAAW,KAAK,oBAAW,CAAC,mBAAmB,EAAE,CAAC;YACzF,OAAO,IAAA,gBAAQ,EAAC,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B;AAGK,MAAM,cAAc,GAA8B,CAAC,KAAK,EAAE,EAAE;IACjE,MAAM,EACJ,WA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B,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAI,CAC7D,CACP,CACE;QACJ,sBAAsB,EAAE,CACxB,CACJ,CAAC;AACJ,CAAC,CAAC;AA3FW,QAAA,cAAc,kBA2FzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/legend/legend_table/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LegendTable = void 0;
|
|
4
|
+
var legend_table_1 = require("./legend_table");
|
|
5
|
+
Object.defineProperty(exports, "LegendTable", { enumerable: true, get: function () { return legend_table_1.LegendTable; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/legend/legend_table/index.tsx"],"names":[],"mappings":";;;AAQA,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend_table.d.ts","sourceRoot":"","sources":["../../../../src/components/legend/legend_table/legend_table.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LegendTable = exports.MIN_LABEL_WIDTH = exports.GRID_ACTION_WIDTH = exports.GRID_COLOR_WIDTH = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const legend_table_body_1 = require("./legend_table_body");
|
|
9
|
+
const legend_table_header_1 = require("./legend_table_header");
|
|
10
|
+
const common_1 = require("../../../utils/common");
|
|
11
|
+
exports.GRID_COLOR_WIDTH = 10;
|
|
12
|
+
exports.GRID_ACTION_WIDTH = 26;
|
|
13
|
+
exports.MIN_LABEL_WIDTH = 24;
|
|
14
|
+
function LegendTable({ items, seriesWidth = exports.MIN_LABEL_WIDTH, ...itemProps }) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const legendValuesLength = ((_a = items === null || items === void 0 ? void 0 : items[0]) === null || _a === void 0 ? void 0 : _a.values.length) ? `repeat(${(_b = items === null || items === void 0 ? void 0 : items[0]) === null || _b === void 0 ? void 0 : _b.values.length}, auto)` : '';
|
|
17
|
+
const actionComponentWidth = itemProps.action ? `${exports.GRID_ACTION_WIDTH}px` : '';
|
|
18
|
+
const gridTemplateColumns = {
|
|
19
|
+
vertical: `${exports.GRID_COLOR_WIDTH}px minmax(${seriesWidth}px, 1fr) ${legendValuesLength} ${actionComponentWidth}`,
|
|
20
|
+
horizontal: `${exports.GRID_COLOR_WIDTH}px minmax(50%, 1fr) ${legendValuesLength} ${actionComponentWidth}`,
|
|
21
|
+
};
|
|
22
|
+
return (react_1.default.createElement("div", { className: "echLegendTable", role: "table", style: {
|
|
23
|
+
gridTemplateColumns: itemProps.positionConfig.direction === common_1.LayoutDirection.Horizontal
|
|
24
|
+
? gridTemplateColumns.horizontal
|
|
25
|
+
: gridTemplateColumns.vertical,
|
|
26
|
+
} },
|
|
27
|
+
react_1.default.createElement(legend_table_header_1.LegendTableHeader, { isMostlyRTL: itemProps.isMostlyRTL, hasAction: !!itemProps.action, legendValues: itemProps.legendValues, legendTitle: itemProps.legendTitle, labelOptions: itemProps.labelOptions }),
|
|
28
|
+
react_1.default.createElement(legend_table_body_1.LegendTableBody, { items: items, ...itemProps })));
|
|
29
|
+
}
|
|
30
|
+
exports.LegendTable = LegendTable;
|
|
31
|
+
//# sourceMappingURL=legend_table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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E,CAAC,CAAC,SAAS,CAAC,MAAM,EAC7B,YAAY,EAAE,SAAS,CAAC,YAAY,EACpC,WAAW,EAAE,SAAS,CAAC,WAAW,EAClC,YAAY,EAAE,SAAS,CAAC,YAAY,GACpC;QACF,8BAAC,mCAAe,IAAC,KAAK,EAAE,KAAK,KAAM,SAAS,GAAI,CAC5C,CACP,CAAC;AACJ,CAAC;AA5BD,kCA4BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend_table_body.d.ts","sourceRoot":"","sources":["../../../../src/components/legend/legend_table/legend_table_body.tsx"],"names":[],"mappings":""}
|