@perses-dev/components 0.55.0-rc.1 → 0.56.0-beta.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/AlignSelector/AlignSelector.js +115 -25
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/CodeEditor/CodeEditor.d.ts +19 -0
- package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/dist/CodeEditor/CodeEditor.js +122 -0
- package/dist/CodeEditor/CodeEditor.js.map +1 -0
- package/dist/ColorPicker/ColorPicker.js +153 -61
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +147 -52
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +144 -41
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.js +53 -20
- package/dist/DensitySelector/DensitySelector.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +3 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +202 -49
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +79 -27
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +184 -113
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +131 -52
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +51 -26
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js +75 -15
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +179 -90
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +14 -4
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +463 -190
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +82 -50
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FormEditor/FormActions.js +88 -14
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.js +246 -99
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.js +90 -25
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +105 -42
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/JSONEditor.d.ts +2 -6
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +24 -37
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +77 -27
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +184 -82
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +54 -9
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +46 -16
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +184 -48
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +90 -48
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +2 -2
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +148 -67
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +61 -19
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +20 -9
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +130 -54
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +17 -6
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +76 -28
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.js +71 -27
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +96 -38
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RepeatGrid/RepeatGrid.js +117 -45
- package/dist/RepeatGrid/RepeatGrid.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +99 -38
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelector.js +51 -18
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +109 -25
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/Table/InnerTable.js +46 -15
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +3 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +410 -158
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +15 -4
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +284 -107
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +101 -32
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +15 -4
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +15 -4
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js +119 -62
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +33 -9
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +5 -4
- package/dist/Table/TableToolbar.d.ts.map +1 -1
- package/dist/Table/TableToolbar.js +172 -100
- package/dist/Table/TableToolbar.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +11 -11
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +387 -219
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +27 -7
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +6 -5
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.js +57 -32
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +115 -74
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +74 -53
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +44 -15
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +33 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +137 -47
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +341 -174
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +368 -162
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +580 -209
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +189 -65
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +168 -78
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +38 -11
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +229 -72
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +73 -27
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +221 -121
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +44 -38
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeZoneSelector.js +131 -36
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +18 -7
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +830 -334
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +252 -90
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +170 -59
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +800 -322
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +218 -91
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/YAMLEditor/YAMLEditor.d.ts +12 -0
- package/dist/YAMLEditor/YAMLEditor.d.ts.map +1 -0
- package/dist/YAMLEditor/YAMLEditor.js +41 -0
- package/dist/YAMLEditor/YAMLEditor.js.map +1 -0
- package/dist/YAMLEditor/index.d.ts +2 -0
- package/dist/YAMLEditor/index.d.ts.map +1 -0
- package/dist/YAMLEditor/index.js +15 -0
- package/dist/YAMLEditor/index.js.map +1 -0
- package/dist/YAMLEditor/yaml-utils.d.ts +11 -0
- package/dist/YAMLEditor/yaml-utils.d.ts.map +1 -0
- package/dist/YAMLEditor/yaml-utils.js +52 -0
- package/dist/YAMLEditor/yaml-utils.js.map +1 -0
- package/dist/YAxisLabel.js +64 -20
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/context/ChartsProvider.js +32 -16
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.js +110 -61
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.js +170 -66
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js +101 -44
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +35 -14
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.js +86 -25
- package/dist/controls/TextField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/browser-storage.js +64 -34
- package/dist/utils/browser-storage.js.map +1 -1
- package/dist/utils/time-series-data.d.ts.map +1 -1
- package/dist/utils/time-series-data.js +5 -2
- package/dist/utils/time-series-data.js.map +1 -1
- package/package.json +13 -7
|
@@ -11,23 +11,50 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
14
15
|
import { Box } from "@mui/material";
|
|
15
16
|
import { combineSx } from "../utils/index.js";
|
|
16
17
|
export function SeriesMarker(props) {
|
|
18
|
+
const $ = _c(7);
|
|
17
19
|
const { markerColor, sx } = props;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
let t0;
|
|
21
|
+
if ($[0] !== sx) {
|
|
22
|
+
t0 = combineSx({
|
|
23
|
+
display: "inline-block",
|
|
24
|
+
width: "11px",
|
|
25
|
+
height: "11px",
|
|
26
|
+
borderRadius: "2px",
|
|
24
27
|
marginRight: 1,
|
|
25
|
-
verticalAlign:
|
|
26
|
-
}, sx)
|
|
27
|
-
|
|
28
|
+
verticalAlign: "top"
|
|
29
|
+
}, sx);
|
|
30
|
+
$[0] = sx;
|
|
31
|
+
$[1] = t0;
|
|
32
|
+
} else {
|
|
33
|
+
t0 = $[1];
|
|
34
|
+
}
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[2] !== markerColor) {
|
|
37
|
+
t1 = {
|
|
28
38
|
backgroundColor: markerColor
|
|
29
|
-
}
|
|
30
|
-
|
|
39
|
+
};
|
|
40
|
+
$[2] = markerColor;
|
|
41
|
+
$[3] = t1;
|
|
42
|
+
} else {
|
|
43
|
+
t1 = $[3];
|
|
44
|
+
}
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[4] !== t0 || $[5] !== t1) {
|
|
47
|
+
t2 = /*#__PURE__*/ _jsx(Box, {
|
|
48
|
+
sx: t0,
|
|
49
|
+
style: t1
|
|
50
|
+
});
|
|
51
|
+
$[4] = t0;
|
|
52
|
+
$[5] = t1;
|
|
53
|
+
$[6] = t2;
|
|
54
|
+
} else {
|
|
55
|
+
t2 = $[6];
|
|
56
|
+
}
|
|
57
|
+
return t2;
|
|
31
58
|
}
|
|
32
59
|
|
|
33
60
|
//# sourceMappingURL=SeriesMarker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { BoxProps } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps): ReactElement {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx,\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx"
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/SeriesMarker.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { BoxProps } from '@mui/material';\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport { combineSx } from '../utils';\n\ninterface SeriesMarkerProps extends BoxProps<'div'> {\n markerColor: string;\n}\n\nexport function SeriesMarker(props: SeriesMarkerProps): ReactElement {\n const { markerColor, sx } = props;\n return (\n <Box\n sx={combineSx(\n {\n display: 'inline-block',\n width: '11px',\n height: '11px',\n borderRadius: '2px',\n marginRight: 1,\n verticalAlign: 'top',\n },\n sx,\n )}\n style={{ backgroundColor: markerColor }}\n ></Box>\n );\n}\n"],"names":["Box","combineSx"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAGjC,SAASA,GAAG,QAAQ,gBAAgB;AAGpC,SAASC,SAAS,QAAQ,oBAAW;AAMrC,OAAO"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c as _c } from "react-compiler-runtime";
|
|
2
3
|
// Copyright The Perses Authors
|
|
3
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
5
|
// you may not use this file except in compliance with the License.
|
|
@@ -12,100 +13,256 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
13
|
// See the License for the specific language governing permissions and
|
|
13
14
|
// limitations under the License.
|
|
14
15
|
import { Box, Portal, Stack } from "@mui/material";
|
|
15
|
-
import { memo,
|
|
16
|
-
import useResizeObserver from "use-resize-observer";
|
|
16
|
+
import { memo, useLayoutEffect, useRef, useState } from "react";
|
|
17
|
+
import { useResizeObserver } from "use-resize-observer";
|
|
17
18
|
import { getNearbySeriesData } from "./nearby-series.js";
|
|
18
19
|
import { useMousePosition } from "./tooltip-model.js";
|
|
19
20
|
import { TooltipContent } from "./TooltipContent.js";
|
|
20
21
|
import { TooltipHeader } from "./TooltipHeader.js";
|
|
21
22
|
import { assembleTransform, getTooltipStyles } from "./utils.js";
|
|
22
|
-
export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip(
|
|
23
|
+
export const TimeChartTooltip = /*#__PURE__*/ memo(function TimeChartTooltip(t0) {
|
|
24
|
+
const $ = _c(54);
|
|
25
|
+
const { containerId, chartRef, data, seriesMapping, enablePinning: t1, wrapLabels, format, seriesFormatMap, onUnpinClick, pinnedPos } = t0;
|
|
26
|
+
const enablePinning = t1 === undefined ? true : t1;
|
|
23
27
|
const [showAllSeries, setShowAllSeries] = useState(false);
|
|
24
|
-
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t2 = [];
|
|
31
|
+
$[0] = t2;
|
|
32
|
+
} else {
|
|
33
|
+
t2 = $[0];
|
|
34
|
+
}
|
|
35
|
+
const [nearbySeries, setNearbySeries] = useState(t2);
|
|
25
36
|
const tooltipElementRef = useRef(null);
|
|
26
37
|
const mousePos = useMousePosition();
|
|
27
38
|
const { height, width, ref: tooltipRef } = useResizeObserver();
|
|
28
39
|
const isTooltipPinned = pinnedPos !== null && enablePinning;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[1] !== tooltipRef) {
|
|
42
|
+
t3 = (node)=>{
|
|
43
|
+
tooltipElementRef.current = node;
|
|
44
|
+
tooltipRef(node);
|
|
45
|
+
};
|
|
46
|
+
$[1] = tooltipRef;
|
|
47
|
+
$[2] = t3;
|
|
48
|
+
} else {
|
|
49
|
+
t3 = $[2];
|
|
50
|
+
}
|
|
51
|
+
const setTooltipRef = t3;
|
|
52
|
+
let t4;
|
|
53
|
+
if ($[3] !== containerId) {
|
|
54
|
+
t4 = containerId ? document.querySelector(containerId) : undefined;
|
|
55
|
+
$[3] = containerId;
|
|
56
|
+
$[4] = t4;
|
|
57
|
+
} else {
|
|
58
|
+
t4 = $[4];
|
|
59
|
+
}
|
|
60
|
+
const containerElement = t4;
|
|
61
|
+
let t5;
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[5] !== chartRef || $[6] !== data || $[7] !== format || $[8] !== mousePos || $[9] !== pinnedPos || $[10] !== seriesFormatMap || $[11] !== seriesMapping || $[12] !== showAllSeries) {
|
|
64
|
+
t5 = ()=>{
|
|
65
|
+
const chart = chartRef.current;
|
|
66
|
+
setNearbySeries(getNearbySeriesData({
|
|
67
|
+
mousePos,
|
|
68
|
+
data,
|
|
69
|
+
seriesMapping,
|
|
70
|
+
pinnedPos,
|
|
71
|
+
chart,
|
|
72
|
+
format,
|
|
73
|
+
seriesFormatMap,
|
|
74
|
+
showAllSeries
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
t6 = [
|
|
78
|
+
chartRef,
|
|
41
79
|
mousePos,
|
|
42
80
|
data,
|
|
43
81
|
seriesMapping,
|
|
44
82
|
pinnedPos,
|
|
45
|
-
chart,
|
|
46
83
|
format,
|
|
47
84
|
seriesFormatMap,
|
|
48
85
|
showAllSeries
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
];
|
|
87
|
+
$[5] = chartRef;
|
|
88
|
+
$[6] = data;
|
|
89
|
+
$[7] = format;
|
|
90
|
+
$[8] = mousePos;
|
|
91
|
+
$[9] = pinnedPos;
|
|
92
|
+
$[10] = seriesFormatMap;
|
|
93
|
+
$[11] = seriesMapping;
|
|
94
|
+
$[12] = showAllSeries;
|
|
95
|
+
$[13] = t5;
|
|
96
|
+
$[14] = t6;
|
|
97
|
+
} else {
|
|
98
|
+
t5 = $[13];
|
|
99
|
+
t6 = $[14];
|
|
100
|
+
}
|
|
101
|
+
useLayoutEffect(t5, t6);
|
|
102
|
+
let t7;
|
|
103
|
+
if ($[15] !== containerElement || $[16] !== mousePos || $[17] !== pinnedPos) {
|
|
104
|
+
t7 = ()=>{
|
|
105
|
+
if (mousePos === null) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const node_0 = tooltipElementRef.current;
|
|
109
|
+
if (!node_0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const rect = node_0.getBoundingClientRect();
|
|
113
|
+
if (rect.height === 0 || rect.width === 0) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const nextTransform = assembleTransform(mousePos, pinnedPos, rect.height, rect.width, containerElement);
|
|
117
|
+
if (nextTransform && nextTransform !== node_0.style.transform) {
|
|
118
|
+
node_0.style.transform = nextTransform;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
$[15] = containerElement;
|
|
122
|
+
$[16] = mousePos;
|
|
123
|
+
$[17] = pinnedPos;
|
|
124
|
+
$[18] = t7;
|
|
125
|
+
} else {
|
|
126
|
+
t7 = $[18];
|
|
127
|
+
}
|
|
128
|
+
useLayoutEffect(t7);
|
|
129
|
+
if (mousePos === null || mousePos.target === null || data === null) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
if (pinnedPos === null && mousePos.target.tagName !== "CANVAS") {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
let t8;
|
|
136
|
+
if ($[19] !== containerElement) {
|
|
137
|
+
t8 = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
138
|
+
$[19] = containerElement;
|
|
139
|
+
$[20] = t8;
|
|
140
|
+
} else {
|
|
141
|
+
t8 = $[20];
|
|
142
|
+
}
|
|
143
|
+
const maxHeight = t8;
|
|
144
|
+
const t9 = height ?? 0;
|
|
145
|
+
const t10 = width ?? 0;
|
|
146
|
+
let t11;
|
|
147
|
+
if ($[21] !== containerElement || $[22] !== mousePos || $[23] !== pinnedPos || $[24] !== t10 || $[25] !== t9) {
|
|
148
|
+
t11 = assembleTransform(mousePos, pinnedPos, t9, t10, containerElement);
|
|
149
|
+
$[21] = containerElement;
|
|
150
|
+
$[22] = mousePos;
|
|
151
|
+
$[23] = pinnedPos;
|
|
152
|
+
$[24] = t10;
|
|
153
|
+
$[25] = t9;
|
|
154
|
+
$[26] = t11;
|
|
155
|
+
} else {
|
|
156
|
+
t11 = $[26];
|
|
157
|
+
}
|
|
158
|
+
const transform = t11;
|
|
77
159
|
if (nearbySeries.length === 0) {
|
|
78
160
|
return null;
|
|
79
161
|
}
|
|
80
162
|
const totalSeries = data.length;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
163
|
+
let t12;
|
|
164
|
+
if ($[27] !== maxHeight || $[28] !== pinnedPos) {
|
|
165
|
+
t12 = (theme)=>getTooltipStyles(theme, pinnedPos, maxHeight);
|
|
166
|
+
$[27] = maxHeight;
|
|
167
|
+
$[28] = pinnedPos;
|
|
168
|
+
$[29] = t12;
|
|
169
|
+
} else {
|
|
170
|
+
t12 = $[29];
|
|
171
|
+
}
|
|
172
|
+
let t13;
|
|
173
|
+
if ($[30] !== transform) {
|
|
174
|
+
t13 = {
|
|
175
|
+
transform
|
|
176
|
+
};
|
|
177
|
+
$[30] = transform;
|
|
178
|
+
$[31] = t13;
|
|
179
|
+
} else {
|
|
180
|
+
t13 = $[31];
|
|
181
|
+
}
|
|
182
|
+
let t14;
|
|
183
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
|
+
t14 = (checked)=>setShowAllSeries(checked);
|
|
185
|
+
$[32] = t14;
|
|
186
|
+
} else {
|
|
187
|
+
t14 = $[32];
|
|
188
|
+
}
|
|
189
|
+
let t15;
|
|
190
|
+
if ($[33] !== enablePinning || $[34] !== isTooltipPinned || $[35] !== nearbySeries || $[36] !== onUnpinClick || $[37] !== showAllSeries || $[38] !== totalSeries) {
|
|
191
|
+
t15 = /*#__PURE__*/ _jsx(TooltipHeader, {
|
|
192
|
+
nearbySeries: nearbySeries,
|
|
193
|
+
totalSeries: totalSeries,
|
|
194
|
+
enablePinning: enablePinning,
|
|
195
|
+
isTooltipPinned: isTooltipPinned,
|
|
196
|
+
showAllSeries: showAllSeries,
|
|
197
|
+
onShowAllClick: t14,
|
|
198
|
+
onUnpinClick: onUnpinClick
|
|
199
|
+
});
|
|
200
|
+
$[33] = enablePinning;
|
|
201
|
+
$[34] = isTooltipPinned;
|
|
202
|
+
$[35] = nearbySeries;
|
|
203
|
+
$[36] = onUnpinClick;
|
|
204
|
+
$[37] = showAllSeries;
|
|
205
|
+
$[38] = totalSeries;
|
|
206
|
+
$[39] = t15;
|
|
207
|
+
} else {
|
|
208
|
+
t15 = $[39];
|
|
209
|
+
}
|
|
210
|
+
let t16;
|
|
211
|
+
if ($[40] !== nearbySeries || $[41] !== wrapLabels) {
|
|
212
|
+
t16 = /*#__PURE__*/ _jsx(TooltipContent, {
|
|
213
|
+
series: nearbySeries,
|
|
214
|
+
wrapLabels: wrapLabels
|
|
215
|
+
});
|
|
216
|
+
$[40] = nearbySeries;
|
|
217
|
+
$[41] = wrapLabels;
|
|
218
|
+
$[42] = t16;
|
|
219
|
+
} else {
|
|
220
|
+
t16 = $[42];
|
|
221
|
+
}
|
|
222
|
+
let t17;
|
|
223
|
+
if ($[43] !== t15 || $[44] !== t16) {
|
|
224
|
+
t17 = /*#__PURE__*/ _jsxs(Stack, {
|
|
225
|
+
spacing: 0.5,
|
|
226
|
+
children: [
|
|
227
|
+
t15,
|
|
228
|
+
t16
|
|
229
|
+
]
|
|
230
|
+
});
|
|
231
|
+
$[43] = t15;
|
|
232
|
+
$[44] = t16;
|
|
233
|
+
$[45] = t17;
|
|
234
|
+
} else {
|
|
235
|
+
t17 = $[45];
|
|
236
|
+
}
|
|
237
|
+
let t18;
|
|
238
|
+
if ($[46] !== setTooltipRef || $[47] !== t12 || $[48] !== t13 || $[49] !== t17) {
|
|
239
|
+
t18 = /*#__PURE__*/ _jsx(Box, {
|
|
84
240
|
ref: setTooltipRef,
|
|
85
|
-
sx:
|
|
86
|
-
style:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
241
|
+
sx: t12,
|
|
242
|
+
style: t13,
|
|
243
|
+
children: t17
|
|
244
|
+
});
|
|
245
|
+
$[46] = setTooltipRef;
|
|
246
|
+
$[47] = t12;
|
|
247
|
+
$[48] = t13;
|
|
248
|
+
$[49] = t17;
|
|
249
|
+
$[50] = t18;
|
|
250
|
+
} else {
|
|
251
|
+
t18 = $[50];
|
|
252
|
+
}
|
|
253
|
+
let t19;
|
|
254
|
+
if ($[51] !== containerElement || $[52] !== t18) {
|
|
255
|
+
t19 = /*#__PURE__*/ _jsx(Portal, {
|
|
256
|
+
container: containerElement,
|
|
257
|
+
children: t18
|
|
258
|
+
});
|
|
259
|
+
$[51] = containerElement;
|
|
260
|
+
$[52] = t18;
|
|
261
|
+
$[53] = t19;
|
|
262
|
+
} else {
|
|
263
|
+
t19 = $[53];
|
|
264
|
+
}
|
|
265
|
+
return t19;
|
|
109
266
|
});
|
|
110
267
|
|
|
111
268
|
//# sourceMappingURL=TimeChartTooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport type { TimeSeries } from '@perses-dev/spec';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\nimport type { MutableRefObject } from 'react';\nimport { memo, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport useResizeObserver from 'use-resize-observer';\n\nimport type { FormatOptions, TimeChartSeriesMapping } from '../model';\nimport type { NearbySeriesArray } from './nearby-series';\nimport { getNearbySeriesData } from './nearby-series';\nimport type { CursorCoordinates } from './tooltip-model';\nimport { useMousePosition } from './tooltip-model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { assembleTransform, getTooltipStyles } from './utils';\n\nexport interface TimeChartTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n enablePinning?: boolean;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n onUnpinClick?: () => void;\n format?: FormatOptions;\n /**\n * Map of series ID to format options for per-series formatting (used with multiple Y axes)\n */\n seriesFormatMap?: Map<string, FormatOptions>;\n wrapLabels?: boolean;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n containerId,\n chartRef,\n data,\n seriesMapping,\n enablePinning = true,\n wrapLabels,\n format,\n seriesFormatMap,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const [nearbySeries, setNearbySeries] = useState<NearbySeriesArray>([]);\n const tooltipElementRef = useRef<HTMLDivElement | null>(null);\n\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n // Stable callback — prevents the ResizeObserver from disconnecting/reconnecting on every render.\n const setTooltipRef = useCallback(\n (node: HTMLDivElement | null): void => {\n tooltipElementRef.current = node;\n tooltipRef(node);\n },\n [tooltipRef],\n );\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n\n // Chart reads and highlight actions synchronize with ECharts after commit.\n useLayoutEffect(() => {\n const chart = chartRef.current;\n setNearbySeries(\n getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n format,\n seriesFormatMap,\n showAllSeries,\n }),\n );\n }, [chartRef, mousePos, data, seriesMapping, pinnedPos, format, seriesFormatMap, showAllSeries]);\n\n // Synchronously reposition after every render to prevent one-frame viewport overflow.\n useLayoutEffect(() => {\n if (mousePos === null) return;\n const node = tooltipElementRef.current;\n if (!node) return;\n const rect = node.getBoundingClientRect();\n if (rect.height === 0 || rect.width === 0) return;\n const nextTransform = assembleTransform(mousePos, pinnedPos, rect.height, rect.width, containerElement);\n if (nextTransform && nextTransform !== node.style.transform) {\n node.style.transform = nextTransform;\n }\n });\n\n if (mousePos === null || mousePos.target === null || data === null) return null;\n\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n // Cap height to container so the tooltip is not cut off.\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n const transform = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={setTooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)}\n style={{\n transform,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/TimeChartTooltip.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Portal, Stack } from '@mui/material';\nimport type { TimeSeries } from '@perses-dev/spec';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\nimport type { MutableRefObject } from 'react';\nimport { memo, useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { useResizeObserver } from 'use-resize-observer';\n\nimport type { FormatOptions, TimeChartSeriesMapping } from '../model';\nimport type { NearbySeriesArray } from './nearby-series';\nimport { getNearbySeriesData } from './nearby-series';\nimport type { CursorCoordinates } from './tooltip-model';\nimport { useMousePosition } from './tooltip-model';\nimport { TooltipContent } from './TooltipContent';\nimport { TooltipHeader } from './TooltipHeader';\nimport { assembleTransform, getTooltipStyles } from './utils';\n\nexport interface TimeChartTooltipProps {\n chartRef: MutableRefObject<EChartsInstance | undefined>;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n enablePinning?: boolean;\n pinnedPos: CursorCoordinates | null;\n /**\n * The id of the container that will have the chart tooltip appended to it.\n * By default, the chart tooltip is attached to document.body.\n */\n containerId?: string;\n onUnpinClick?: () => void;\n format?: FormatOptions;\n /**\n * Map of series ID to format options for per-series formatting (used with multiple Y axes)\n */\n seriesFormatMap?: Map<string, FormatOptions>;\n wrapLabels?: boolean;\n}\n\nexport const TimeChartTooltip = memo(function TimeChartTooltip({\n containerId,\n chartRef,\n data,\n seriesMapping,\n enablePinning = true,\n wrapLabels,\n format,\n seriesFormatMap,\n onUnpinClick,\n pinnedPos,\n}: TimeChartTooltipProps) {\n const [showAllSeries, setShowAllSeries] = useState(false);\n const [nearbySeries, setNearbySeries] = useState<NearbySeriesArray>([]);\n const tooltipElementRef = useRef<HTMLDivElement | null>(null);\n\n const mousePos = useMousePosition();\n const { height, width, ref: tooltipRef } = useResizeObserver();\n\n const isTooltipPinned = pinnedPos !== null && enablePinning;\n\n // Stable callback — prevents the ResizeObserver from disconnecting/reconnecting on every render.\n const setTooltipRef = useCallback(\n (node: HTMLDivElement | null): void => {\n tooltipElementRef.current = node;\n tooltipRef(node);\n },\n [tooltipRef],\n );\n\n const containerElement = containerId ? document.querySelector(containerId) : undefined;\n\n // Chart reads and highlight actions synchronize with ECharts after commit.\n useLayoutEffect(() => {\n const chart = chartRef.current;\n setNearbySeries(\n getNearbySeriesData({\n mousePos,\n data,\n seriesMapping,\n pinnedPos,\n chart,\n format,\n seriesFormatMap,\n showAllSeries,\n }),\n );\n }, [chartRef, mousePos, data, seriesMapping, pinnedPos, format, seriesFormatMap, showAllSeries]);\n\n // Synchronously reposition after every render to prevent one-frame viewport overflow.\n useLayoutEffect(() => {\n if (mousePos === null) return;\n const node = tooltipElementRef.current;\n if (!node) return;\n const rect = node.getBoundingClientRect();\n if (rect.height === 0 || rect.width === 0) return;\n const nextTransform = assembleTransform(mousePos, pinnedPos, rect.height, rect.width, containerElement);\n if (nextTransform && nextTransform !== node.style.transform) {\n node.style.transform = nextTransform;\n }\n });\n\n if (mousePos === null || mousePos.target === null || data === null) return null;\n\n if (pinnedPos === null && (mousePos.target as HTMLElement).tagName !== 'CANVAS') return null;\n\n // Cap height to container so the tooltip is not cut off.\n const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;\n\n const transform = assembleTransform(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);\n\n if (nearbySeries.length === 0) {\n return null;\n }\n\n const totalSeries = data.length;\n\n return (\n <Portal container={containerElement}>\n <Box\n ref={setTooltipRef}\n sx={(theme) => getTooltipStyles(theme, pinnedPos, maxHeight)}\n style={{\n transform,\n }}\n >\n <Stack spacing={0.5}>\n <TooltipHeader\n nearbySeries={nearbySeries}\n totalSeries={totalSeries}\n enablePinning={enablePinning}\n isTooltipPinned={isTooltipPinned}\n showAllSeries={showAllSeries}\n onShowAllClick={(checked) => setShowAllSeries(checked)}\n onUnpinClick={onUnpinClick}\n />\n <TooltipContent series={nearbySeries} wrapLabels={wrapLabels} />\n </Stack>\n </Box>\n </Portal>\n );\n});\n"],"names":["Box","Portal","Stack","memo","useLayoutEffect","useRef","useState","useResizeObserver","getNearbySeriesData","useMousePosition","TooltipContent","TooltipHeader","assembleTransform","getTooltipStyles","TimeChartTooltip"],"mappings":";;AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAInD,SAASC,IAAI,EAAeC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC7E,SAASC,iBAAiB,QAAQ,sBAAsB;AAIxD,SAASC,mBAAmB,QAAQ,qBAAkB;AAEtD,SAASC,gBAAgB,QAAQ,qBAAkB;AACnD,SAASC,cAAc,QAAQ,sBAAmB;AAClD,SAASC,aAAa,QAAQ,qBAAkB;AAChD,SAASC,iBAAiB,EAAEC,gBAAgB,QAAQ,aAAU;AAsB9D,OAAO,MAAMC,iCAAmBX,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGlC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as _c } from "react-compiler-runtime";
|
|
2
3
|
// Copyright The Perses Authors
|
|
3
4
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
5
|
// you may not use this file except in compliance with the License.
|
|
@@ -12,39 +13,84 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
13
|
// See the License for the specific language governing permissions and
|
|
13
14
|
// limitations under the License.
|
|
14
15
|
import { Box } from "@mui/material";
|
|
15
|
-
import { useMemo } from "react";
|
|
16
16
|
import { SeriesInfo } from "./SeriesInfo.js";
|
|
17
17
|
export function TooltipContent(props) {
|
|
18
|
+
const $ = _c(10);
|
|
18
19
|
const { series, wrapLabels } = props;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
let t0;
|
|
21
|
+
bb0: {
|
|
22
|
+
if (series === null) {
|
|
23
|
+
t0 = null;
|
|
24
|
+
break bb0;
|
|
25
|
+
}
|
|
26
|
+
let t1;
|
|
27
|
+
if ($[0] !== series) {
|
|
28
|
+
t1 = series.toSorted(_temp);
|
|
29
|
+
$[0] = series;
|
|
30
|
+
$[1] = t1;
|
|
31
|
+
} else {
|
|
32
|
+
t1 = $[1];
|
|
33
|
+
}
|
|
34
|
+
t0 = t1;
|
|
35
|
+
}
|
|
36
|
+
const sortedFocusedSeries = t0;
|
|
25
37
|
if (series === null || sortedFocusedSeries === null) {
|
|
26
38
|
return null;
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
let t1;
|
|
41
|
+
if ($[2] !== sortedFocusedSeries || $[3] !== wrapLabels) {
|
|
42
|
+
let t2;
|
|
43
|
+
if ($[5] !== sortedFocusedSeries.length || $[6] !== wrapLabels) {
|
|
44
|
+
t2 = (t3)=>{
|
|
45
|
+
const { datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor } = t3;
|
|
46
|
+
if (datumIdx === null || seriesIdx === null) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const key = seriesIdx.toString() + datumIdx.toString();
|
|
50
|
+
return /*#__PURE__*/ _jsx(SeriesInfo, {
|
|
51
|
+
seriesName: seriesName,
|
|
52
|
+
y: y,
|
|
53
|
+
formattedY: formattedY,
|
|
54
|
+
markerColor: markerColor,
|
|
55
|
+
totalSeries: sortedFocusedSeries.length,
|
|
56
|
+
wrapLabels: wrapLabels,
|
|
57
|
+
emphasizeText: isClosestToCursor
|
|
58
|
+
}, key);
|
|
59
|
+
};
|
|
60
|
+
$[5] = sortedFocusedSeries.length;
|
|
61
|
+
$[6] = wrapLabels;
|
|
62
|
+
$[7] = t2;
|
|
63
|
+
} else {
|
|
64
|
+
t2 = $[7];
|
|
65
|
+
}
|
|
66
|
+
t1 = sortedFocusedSeries.map(t2);
|
|
67
|
+
$[2] = sortedFocusedSeries;
|
|
68
|
+
$[3] = wrapLabels;
|
|
69
|
+
$[4] = t1;
|
|
70
|
+
} else {
|
|
71
|
+
t1 = $[4];
|
|
72
|
+
}
|
|
73
|
+
let t2;
|
|
74
|
+
if ($[8] !== t1) {
|
|
75
|
+
t2 = /*#__PURE__*/ _jsx(Box, {
|
|
76
|
+
sx: _temp2,
|
|
77
|
+
children: t1
|
|
78
|
+
});
|
|
79
|
+
$[8] = t1;
|
|
80
|
+
$[9] = t2;
|
|
81
|
+
} else {
|
|
82
|
+
t2 = $[9];
|
|
83
|
+
}
|
|
84
|
+
return t2;
|
|
85
|
+
}
|
|
86
|
+
function _temp2(theme) {
|
|
87
|
+
return {
|
|
88
|
+
display: "table",
|
|
89
|
+
padding: theme.spacing(0.5, 2)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function _temp(a, b) {
|
|
93
|
+
return a.y > b.y ? -1 : 1;
|
|
48
94
|
}
|
|
49
95
|
|
|
50
96
|
//# sourceMappingURL=TooltipContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { SeriesInfo } from './SeriesInfo';\nimport type { NearbySeriesArray } from './types';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps): ReactElement | null {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.toSorted((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["Box","
|
|
1
|
+
{"version":3,"sources":["../../src/TimeSeriesTooltip/TooltipContent.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { SeriesInfo } from './SeriesInfo';\nimport type { NearbySeriesArray } from './types';\n\nexport interface TooltipContentProps {\n series: NearbySeriesArray | null;\n wrapLabels?: boolean;\n}\n\nexport function TooltipContent(props: TooltipContentProps): ReactElement | null {\n const { series, wrapLabels } = props;\n\n const sortedFocusedSeries = useMemo(() => {\n if (series === null) return null;\n return series.toSorted((a, b) => (a.y > b.y ? -1 : 1));\n }, [series]);\n\n if (series === null || sortedFocusedSeries === null) {\n return null;\n }\n // TODO: use react-virtuoso to improve performance\n return (\n <Box\n sx={(theme) => ({\n display: 'table',\n padding: theme.spacing(0.5, 2),\n })}\n >\n {sortedFocusedSeries.map(({ datumIdx, seriesIdx, seriesName, y, formattedY, markerColor, isClosestToCursor }) => {\n if (datumIdx === null || seriesIdx === null) return null;\n const key = seriesIdx.toString() + datumIdx.toString();\n\n return (\n <SeriesInfo\n key={key}\n seriesName={seriesName}\n y={y}\n formattedY={formattedY}\n markerColor={markerColor}\n totalSeries={sortedFocusedSeries.length}\n wrapLabels={wrapLabels}\n emphasizeText={isClosestToCursor}\n />\n );\n })}\n </Box>\n );\n}\n"],"names":["Box","SeriesInfo"],"mappings":";;AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AAIpC,SAASC,UAAU,QAAQ,kBAAe;AAQ1C,OAAO"}
|