@perses-dev/components 0.0.0-snapshot-color-palette-gen-test-0ebddd6 → 0.0.0-snapshot-saving-defaults-refinements-1b25cec
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/ContentWithLegend/ContentWithLegend.d.ts +11 -0
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -0
- package/dist/ContentWithLegend/ContentWithLegend.js +65 -0
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -0
- package/dist/ContentWithLegend/index.d.ts +2 -0
- package/dist/ContentWithLegend/index.d.ts.map +1 -0
- package/dist/ContentWithLegend/index.js +15 -0
- package/dist/ContentWithLegend/index.js.map +1 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +68 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.js +90 -0
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +7 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +9 -1
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +6 -4
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js +4 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +11 -9
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +70 -21
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +5 -8
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +17 -103
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +8 -8
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +9 -12
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts +12 -0
- package/dist/Legend/TableLegend.d.ts.map +1 -0
- package/dist/Legend/TableLegend.js +61 -0
- package/dist/Legend/TableLegend.js.map +1 -0
- package/dist/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js +35 -3
- package/dist/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +2 -1
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +83 -36
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +23 -15
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/Table/InnerTable.d.ts +9 -0
- package/dist/Table/InnerTable.d.ts.map +1 -0
- package/dist/Table/InnerTable.js +38 -0
- package/dist/Table/InnerTable.js.map +1 -0
- package/dist/Table/Table.d.ts +10 -0
- package/dist/Table/Table.d.ts.map +1 -0
- package/dist/Table/Table.js +101 -0
- package/dist/Table/Table.js.map +1 -0
- package/dist/Table/TableBody.d.ts +6 -0
- package/dist/Table/TableBody.d.ts.map +1 -0
- package/dist/Table/TableBody.js +23 -0
- package/dist/Table/TableBody.js.map +1 -0
- package/dist/Table/TableCell.d.ts +18 -0
- package/dist/Table/TableCell.d.ts.map +1 -0
- package/dist/Table/TableCell.js +91 -0
- package/dist/Table/TableCell.js.map +1 -0
- package/dist/Table/TableCheckbox.d.ts +9 -0
- package/dist/Table/TableCheckbox.d.ts.map +1 -0
- package/dist/Table/TableCheckbox.js +49 -0
- package/dist/Table/TableCheckbox.js.map +1 -0
- package/dist/Table/TableHead.d.ts +6 -0
- package/dist/Table/TableHead.d.ts.map +1 -0
- package/dist/Table/TableHead.js +23 -0
- package/dist/Table/TableHead.js.map +1 -0
- package/dist/Table/TableRow.d.ts +9 -0
- package/dist/Table/TableRow.d.ts.map +1 -0
- package/dist/Table/TableRow.js +29 -0
- package/dist/Table/TableRow.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +11 -0
- package/dist/Table/VirtualizedTable.d.ts.map +1 -0
- package/dist/Table/VirtualizedTable.js +152 -0
- package/dist/Table/VirtualizedTable.js.map +1 -0
- package/dist/Table/VirtualizedTableContainer.d.ts +6 -0
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -0
- package/dist/Table/VirtualizedTableContainer.js +24 -0
- package/dist/Table/VirtualizedTableContainer.js.map +1 -0
- package/dist/Table/hooks/useTableKeyboardNav.d.ts +32 -0
- package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -0
- package/dist/Table/hooks/useTableKeyboardNav.js +98 -0
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -0
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +29 -0
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -0
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +89 -0
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -0
- package/dist/Table/index.d.ts +4 -0
- package/dist/Table/index.d.ts.map +1 -0
- package/dist/Table/index.js +16 -0
- package/dist/Table/index.js.map +1 -0
- package/dist/Table/model/table-model.d.ts +83 -0
- package/dist/Table/model/table-model.d.ts.map +1 -0
- package/dist/Table/model/table-model.js +73 -0
- package/dist/Table/model/table-model.js.map +1 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -0
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +11 -9
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts +5 -4
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js +50 -22
- package/dist/TimeSeriesTooltip/TimeSeriesTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts +3 -3
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +28 -67
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +12 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.js +160 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -0
- package/dist/TimeSeriesTooltip/index.d.ts +2 -1
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +2 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +46 -0
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -0
- package/dist/TimeSeriesTooltip/nearby-series.js +200 -0
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +17 -13
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +11 -2
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +9 -17
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/UnitSelector/UnitSelector.d.ts.map +1 -1
- package/dist/UnitSelector/UnitSelector.js +40 -17
- package/dist/UnitSelector/UnitSelector.js.map +1 -1
- package/dist/YAxisLabel.d.ts.map +1 -1
- package/dist/YAxisLabel.js +1 -0
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +70 -0
- package/dist/cjs/ContentWithLegend/index.js +28 -0
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +100 -0
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +7 -1
- package/dist/cjs/EChart/EChart.js +9 -1
- package/dist/cjs/Legend/CompactLegend.js +4 -1
- package/dist/cjs/Legend/Legend.js +70 -21
- package/dist/cjs/Legend/ListLegend.js +17 -103
- package/dist/cjs/Legend/ListLegendItem.js +8 -11
- package/dist/cjs/Legend/TableLegend.js +67 -0
- package/dist/cjs/LegendOptionsEditor/LegendOptionsEditor.js +34 -2
- package/dist/cjs/LineChart/LineChart.js +83 -36
- package/dist/cjs/StatChart/StatChart.js +23 -15
- package/dist/cjs/Table/InnerTable.js +44 -0
- package/dist/cjs/Table/Table.js +102 -0
- package/dist/cjs/Table/TableBody.js +29 -0
- package/dist/cjs/Table/TableCell.js +97 -0
- package/dist/cjs/Table/TableCheckbox.js +55 -0
- package/dist/cjs/Table/TableHead.js +29 -0
- package/dist/cjs/Table/TableRow.js +35 -0
- package/dist/cjs/Table/VirtualizedTable.js +155 -0
- package/dist/cjs/Table/VirtualizedTableContainer.js +30 -0
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +99 -0
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +93 -0
- package/dist/cjs/Table/index.js +33 -0
- package/dist/cjs/Table/model/table-model.js +80 -0
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +10 -8
- package/dist/cjs/TimeSeriesTooltip/TimeSeriesTooltip.js +54 -21
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +26 -65
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +171 -0
- package/dist/cjs/TimeSeriesTooltip/index.js +2 -1
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +206 -0
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +17 -3
- package/dist/cjs/TimeSeriesTooltip/utils.js +8 -16
- package/dist/cjs/UnitSelector/UnitSelector.js +39 -16
- package/dist/cjs/YAxisLabel.js +1 -0
- package/dist/cjs/context/SnackbarProvider.js +66 -0
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/model/legend.js +37 -2
- package/dist/cjs/model/units/bytes.js +25 -21
- package/dist/cjs/model/units/constants.js +3 -3
- package/dist/cjs/model/units/decimal.js +22 -19
- package/dist/cjs/model/units/percent.js +20 -11
- package/dist/cjs/model/units/time.js +26 -22
- package/dist/cjs/model/units/units.js +2 -2
- package/dist/cjs/model/units/utils.js +42 -0
- package/dist/cjs/theme/palette/grey.js +6 -2
- package/dist/cjs/utils/theme-gen.js +8 -13
- package/dist/context/SnackbarProvider.d.ts +23 -0
- package/dist/context/SnackbarProvider.d.ts.map +1 -0
- package/dist/context/SnackbarProvider.js +59 -0
- package/dist/context/SnackbarProvider.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/model/legend.d.ts +19 -5
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +31 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/units/bytes.d.ts +1 -1
- package/dist/model/units/bytes.d.ts.map +1 -1
- package/dist/model/units/bytes.js +26 -22
- package/dist/model/units/bytes.js.map +1 -1
- package/dist/model/units/constants.d.ts +1 -1
- package/dist/model/units/constants.js +1 -1
- package/dist/model/units/constants.js.map +1 -1
- package/dist/model/units/decimal.d.ts +2 -2
- package/dist/model/units/decimal.d.ts.map +1 -1
- package/dist/model/units/decimal.js +22 -19
- package/dist/model/units/decimal.js.map +1 -1
- package/dist/model/units/percent.d.ts +2 -2
- package/dist/model/units/percent.d.ts.map +1 -1
- package/dist/model/units/percent.js +20 -11
- package/dist/model/units/percent.js.map +1 -1
- package/dist/model/units/time.d.ts +2 -2
- package/dist/model/units/time.d.ts.map +1 -1
- package/dist/model/units/time.js +26 -22
- package/dist/model/units/time.js.map +1 -1
- package/dist/model/units/types.d.ts +9 -0
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.js +2 -2
- package/dist/model/units/units.js.map +1 -1
- package/dist/model/units/utils.d.ts +4 -0
- package/dist/model/units/utils.d.ts.map +1 -0
- package/dist/model/units/utils.js +32 -0
- package/dist/model/units/utils.js.map +1 -0
- package/dist/theme/palette/grey.d.ts.map +1 -1
- package/dist/theme/palette/grey.js +6 -2
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +8 -13
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +6 -6
- package/dist/TimeSeriesTooltip/focused-series.d.ts +0 -25
- package/dist/TimeSeriesTooltip/focused-series.d.ts.map +0 -1
- package/dist/TimeSeriesTooltip/focused-series.js +0 -111
- package/dist/TimeSeriesTooltip/focused-series.js.map +0 -1
- package/dist/cjs/TimeSeriesTooltip/focused-series.js +0 -117
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useTableKeyboardNav", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>useTableKeyboardNav
|
|
20
|
+
});
|
|
21
|
+
const _react = require("react");
|
|
22
|
+
const DEFAULT_ACTIVE_CELL = {
|
|
23
|
+
row: 0,
|
|
24
|
+
column: 0
|
|
25
|
+
};
|
|
26
|
+
const ARROW_KEYS = [
|
|
27
|
+
'ArrowRight',
|
|
28
|
+
'ArrowLeft',
|
|
29
|
+
'ArrowUp',
|
|
30
|
+
'ArrowDown'
|
|
31
|
+
];
|
|
32
|
+
function isArrowKey(key) {
|
|
33
|
+
return ARROW_KEYS.includes(key);
|
|
34
|
+
}
|
|
35
|
+
function useTableKeyboardNav({ maxRows , maxColumns , onActiveCellChange }) {
|
|
36
|
+
const [activeCell, setActiveCell] = (0, _react.useState)(DEFAULT_ACTIVE_CELL);
|
|
37
|
+
const [isActive, setIsActive] = (0, _react.useState)(false);
|
|
38
|
+
const handleCellFocus = (cellPosition)=>{
|
|
39
|
+
if (cellPosition.column === activeCell.column && cellPosition.row === activeCell.row && isActive) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setIsActive(true);
|
|
43
|
+
setActiveCell(cellPosition);
|
|
44
|
+
};
|
|
45
|
+
const handleKeyDown = (0, _react.useCallback)((e)=>{
|
|
46
|
+
// Including some of the basic a11y keyboard interaction patterns from:
|
|
47
|
+
// https://www.w3.org/WAI/ARIA/apg/patterns/grid/
|
|
48
|
+
// TODO: add other keyboard combos.
|
|
49
|
+
const key = e.key;
|
|
50
|
+
if (isArrowKey(key) || key === 'Home' || key === 'End' || key === 'PageDown' || key === 'PageUp') {
|
|
51
|
+
setActiveCell((curActiveCell)=>{
|
|
52
|
+
let nextRow = curActiveCell.row;
|
|
53
|
+
let nextColumn = curActiveCell.column;
|
|
54
|
+
if (key === 'ArrowRight' && nextColumn < maxColumns - 1) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
nextColumn += 1;
|
|
57
|
+
} else if (key === 'ArrowLeft' && nextColumn > 0) {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
nextColumn -= 1;
|
|
60
|
+
} else if (key === 'ArrowDown' && nextRow < maxRows - 1) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
nextRow += 1;
|
|
63
|
+
} else if (key === 'ArrowUp' && nextRow > 0) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
nextRow -= 1;
|
|
66
|
+
} else if (key === 'Home') {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
nextRow = 0;
|
|
69
|
+
nextColumn = 0;
|
|
70
|
+
} else if (key === 'End') {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
nextRow = maxRows - 1;
|
|
73
|
+
nextColumn = maxColumns - 1;
|
|
74
|
+
}
|
|
75
|
+
const defaultNewPosition = {
|
|
76
|
+
column: nextColumn,
|
|
77
|
+
row: nextRow
|
|
78
|
+
};
|
|
79
|
+
const newPosition = (onActiveCellChange === null || onActiveCellChange === void 0 ? void 0 : onActiveCellChange(e, curActiveCell, defaultNewPosition)) || defaultNewPosition;
|
|
80
|
+
if (newPosition.row === curActiveCell.row && newPosition.column === curActiveCell.column) {
|
|
81
|
+
// Return original to avoid creating a new object if nothing
|
|
82
|
+
// changed.
|
|
83
|
+
return curActiveCell;
|
|
84
|
+
}
|
|
85
|
+
return newPosition;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, [
|
|
89
|
+
maxColumns,
|
|
90
|
+
maxRows,
|
|
91
|
+
onActiveCellChange
|
|
92
|
+
]);
|
|
93
|
+
return {
|
|
94
|
+
activeCell,
|
|
95
|
+
isActive,
|
|
96
|
+
onTableKeyDown: handleKeyDown,
|
|
97
|
+
onCellFocus: handleCellFocus
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "useVirtualizedTableKeyboardNav", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>useVirtualizedTableKeyboardNav
|
|
20
|
+
});
|
|
21
|
+
const _useTableKeyboardNav = require("./useTableKeyboardNav");
|
|
22
|
+
function useVirtualizedTableKeyboardNav({ visibleRange , virtualTable , maxRows , maxColumns }) {
|
|
23
|
+
const baseKeyboard = (0, _useTableKeyboardNav.useTableKeyboardNav)({
|
|
24
|
+
maxRows,
|
|
25
|
+
maxColumns,
|
|
26
|
+
onActiveCellChange: (e, currentPosition, defaultNewPosition)=>{
|
|
27
|
+
const key = e.key;
|
|
28
|
+
const defaultValueChanged = defaultNewPosition && (currentPosition.column !== defaultNewPosition.column || currentPosition.row !== defaultNewPosition.row);
|
|
29
|
+
var ref;
|
|
30
|
+
const nextRow = (ref = defaultNewPosition === null || defaultNewPosition === void 0 ? void 0 : defaultNewPosition.row) !== null && ref !== void 0 ? ref : currentPosition.row;
|
|
31
|
+
if (key === 'ArrowDown' && defaultValueChanged) {
|
|
32
|
+
// Use default cell position. Shift the virtual table scroll position
|
|
33
|
+
// when needed to make the active cell visible.
|
|
34
|
+
if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
|
|
35
|
+
var ref1;
|
|
36
|
+
(ref1 = virtualTable.current) === null || ref1 === void 0 ? void 0 : ref1.scrollToIndex({
|
|
37
|
+
index: nextRow - 1,
|
|
38
|
+
align: 'end'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
} else if (key === 'ArrowUp' && defaultValueChanged) {
|
|
42
|
+
// Use default cell position. Shift the virtual table scroll position
|
|
43
|
+
// when needed to make the active cell visible.
|
|
44
|
+
if (nextRow - 1 < visibleRange.current.startIndex || nextRow - 1 > visibleRange.current.endIndex) {
|
|
45
|
+
var ref2;
|
|
46
|
+
(ref2 = virtualTable.current) === null || ref2 === void 0 ? void 0 : ref2.scrollToIndex({
|
|
47
|
+
index: nextRow - 1,
|
|
48
|
+
align: 'start'
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
} else if (defaultValueChanged && (key === 'Home' || key === 'End')) {
|
|
52
|
+
var // Use default cell position. Shift the virtual table scroll position
|
|
53
|
+
// when needed to make the active cell visible.
|
|
54
|
+
ref3;
|
|
55
|
+
(ref3 = virtualTable.current) === null || ref3 === void 0 ? void 0 : ref3.scrollToIndex({
|
|
56
|
+
index: Math.max(nextRow - 1, 0),
|
|
57
|
+
align: 'start'
|
|
58
|
+
});
|
|
59
|
+
} else if (key === 'PageDown') {
|
|
60
|
+
var ref4;
|
|
61
|
+
// Full handling of logic for `PageDown` because there is no default.
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
let nextRow1 = currentPosition.row;
|
|
64
|
+
// Add 1 to account for header
|
|
65
|
+
nextRow1 = Math.min(maxRows - 1, visibleRange.current.endIndex + 1);
|
|
66
|
+
(ref4 = virtualTable.current) === null || ref4 === void 0 ? void 0 : ref4.scrollToIndex({
|
|
67
|
+
index: nextRow1 - 1,
|
|
68
|
+
align: 'start'
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
row: nextRow1,
|
|
72
|
+
column: currentPosition.column
|
|
73
|
+
};
|
|
74
|
+
} else if (key === 'PageUp') {
|
|
75
|
+
var ref5;
|
|
76
|
+
// Full handling of logic for `PageUp` because there is no default.
|
|
77
|
+
let nextRow2 = currentPosition.row;
|
|
78
|
+
// Minus 1 to account for header
|
|
79
|
+
nextRow2 = Math.max(0, visibleRange.current.startIndex - 1);
|
|
80
|
+
(ref5 = virtualTable.current) === null || ref5 === void 0 ? void 0 : ref5.scrollToIndex({
|
|
81
|
+
index: nextRow2 - 1,
|
|
82
|
+
align: 'end'
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
row: nextRow2,
|
|
86
|
+
column: currentPosition.column
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return defaultNewPosition;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return baseKeyboard;
|
|
93
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getTableCellLayout", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>_tableModel.getTableCellLayout
|
|
20
|
+
});
|
|
21
|
+
_exportStar(require("./Table"), exports);
|
|
22
|
+
const _tableModel = require("./model/table-model");
|
|
23
|
+
function _exportStar(from, to) {
|
|
24
|
+
Object.keys(from).forEach(function(k) {
|
|
25
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function() {
|
|
28
|
+
return from[k];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return from;
|
|
33
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
getTableCellLayout: ()=>getTableCellLayout,
|
|
25
|
+
persesColumnsToTanstackColumns: ()=>persesColumnsToTanstackColumns
|
|
26
|
+
});
|
|
27
|
+
function calculateTableCellHeight(lineHeight, paddingY) {
|
|
28
|
+
// Doing a bunch of math to enforce height to avoid weirdness with mismatched
|
|
29
|
+
// heights based on customization of cell contents.
|
|
30
|
+
const lineHeightNum = typeof lineHeight === 'string' ? parseInt(lineHeight, 10) : lineHeight !== null && lineHeight !== void 0 ? lineHeight : 0;
|
|
31
|
+
const verticalPaddingNum = typeof paddingY === 'string' ? parseInt(paddingY, 10) : paddingY;
|
|
32
|
+
return lineHeightNum + verticalPaddingNum * 2;
|
|
33
|
+
}
|
|
34
|
+
function getTableCellLayout(theme, density) {
|
|
35
|
+
if (density === 'compact') {
|
|
36
|
+
const paddingY = theme.spacing(0.5);
|
|
37
|
+
const paddingX = theme.spacing(0.25);
|
|
38
|
+
const lineHeight = theme.typography.body2.lineHeight;
|
|
39
|
+
return {
|
|
40
|
+
padding: `${paddingY} ${paddingX}`,
|
|
41
|
+
height: calculateTableCellHeight(lineHeight, paddingY),
|
|
42
|
+
fontSize: theme.typography.body2.fontSize,
|
|
43
|
+
lineHeight: lineHeight
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// standard density
|
|
47
|
+
const paddingY1 = theme.spacing(1);
|
|
48
|
+
const paddingX1 = theme.spacing(1.25);
|
|
49
|
+
const lineHeight1 = theme.typography.body1.lineHeight;
|
|
50
|
+
return {
|
|
51
|
+
padding: `${paddingY1} ${paddingX1}`,
|
|
52
|
+
height: calculateTableCellHeight(lineHeight1, paddingY1),
|
|
53
|
+
fontSize: theme.typography.body1.fontSize,
|
|
54
|
+
lineHeight: lineHeight1
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function persesColumnsToTanstackColumns(columns) {
|
|
58
|
+
const tableCols = columns.map(({ width , ...otherProps })=>{
|
|
59
|
+
// Tanstack Table does not support an "auto" value to naturally size to fit
|
|
60
|
+
// the space in a table. We translate our custom "auto" setting to 0 size
|
|
61
|
+
// for these columns, so it is easy to fall back to auto when rendering.
|
|
62
|
+
// Taking from a recommendation in this github discussion:
|
|
63
|
+
// https://github.com/TanStack/table/discussions/4179#discussioncomment-3631326
|
|
64
|
+
const sizeProps = width === 'auto' || width === undefined ? {
|
|
65
|
+
// All zero values are used as shorthand for "auto" when rendering
|
|
66
|
+
// because it makes it easy to fall back. (e.g. `row.size || "auto"`)
|
|
67
|
+
size: 0,
|
|
68
|
+
minSize: 0,
|
|
69
|
+
maxSize: 0
|
|
70
|
+
} : {
|
|
71
|
+
size: width
|
|
72
|
+
};
|
|
73
|
+
const result = {
|
|
74
|
+
...otherProps,
|
|
75
|
+
...sizeProps
|
|
76
|
+
};
|
|
77
|
+
return result;
|
|
78
|
+
});
|
|
79
|
+
return tableCols;
|
|
80
|
+
}
|
|
@@ -24,7 +24,7 @@ const _seriesMarker = require("./SeriesMarker");
|
|
|
24
24
|
const _seriesLabelsStack = require("./SeriesLabelsStack");
|
|
25
25
|
const _tooltipModel = require("./tooltip-model");
|
|
26
26
|
function SeriesInfo(props) {
|
|
27
|
-
const { seriesName , formattedY , markerColor , totalSeries , wrapLabels =true } = props;
|
|
27
|
+
const { seriesName , formattedY , markerColor , totalSeries , emphasizeText =false , wrapLabels =true } = props;
|
|
28
28
|
// metric __name__ comes before opening curly brace, ignore if not populated
|
|
29
29
|
// ex with metric name: node_load15{env="demo",job="node"}
|
|
30
30
|
// ex without metric name: {env="demo",job="node"}
|
|
@@ -73,21 +73,23 @@ function SeriesInfo(props) {
|
|
|
73
73
|
maxWidth: _tooltipModel.TOOLTIP_LABELS_MAX_WIDTH,
|
|
74
74
|
overflow: 'hidden',
|
|
75
75
|
color: theme.palette.common.white,
|
|
76
|
+
fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular,
|
|
76
77
|
textOverflow: 'ellipsis',
|
|
77
78
|
whiteSpace: wrapLabels ? 'normal' : 'nowrap'
|
|
78
79
|
}),
|
|
80
|
+
"aria-label": emphasizeText ? _tooltipModel.EMPHASIZED_SERIES_DESCRIPTION : _tooltipModel.NEARBY_SERIES_DESCRIPTION,
|
|
79
81
|
children: formattedSeriesInfo
|
|
80
82
|
})
|
|
81
83
|
]
|
|
82
84
|
}),
|
|
83
85
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
84
|
-
sx: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
sx: (theme)=>({
|
|
87
|
+
display: 'table-cell',
|
|
88
|
+
paddingLeft: 1.5,
|
|
89
|
+
textAlign: 'right',
|
|
90
|
+
verticalAlign: 'top',
|
|
91
|
+
fontWeight: emphasizeText ? theme.typography.fontWeightBold : theme.typography.fontWeightRegular
|
|
92
|
+
}),
|
|
91
93
|
children: formattedY
|
|
92
94
|
})
|
|
93
95
|
]
|
|
@@ -19,12 +19,19 @@ Object.defineProperty(exports, "TimeSeriesTooltip", {
|
|
|
19
19
|
get: ()=>TimeSeriesTooltip
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
23
22
|
const _material = require("@mui/material");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
23
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
24
|
+
const _useResizeObserver = /*#__PURE__*/ _interopRequireDefault(require("use-resize-observer"));
|
|
26
25
|
const _tooltipContent = require("./TooltipContent");
|
|
26
|
+
const _tooltipHeader = require("./TooltipHeader");
|
|
27
|
+
const _nearbySeries = require("./nearby-series");
|
|
28
|
+
const _tooltipModel = require("./tooltip-model");
|
|
27
29
|
const _utils = require("./utils");
|
|
30
|
+
function _interopRequireDefault(obj) {
|
|
31
|
+
return obj && obj.__esModule ? obj : {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
28
35
|
function _getRequireWildcardCache(nodeInterop) {
|
|
29
36
|
if (typeof WeakMap !== "function") return null;
|
|
30
37
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -64,34 +71,46 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
64
71
|
}
|
|
65
72
|
return newObj;
|
|
66
73
|
}
|
|
67
|
-
const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels ,
|
|
68
|
-
const [
|
|
74
|
+
const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesTooltip({ chartRef , chartData , wrapLabels , unit , onUnpinClick , pinnedPos }) {
|
|
75
|
+
const [showAllSeries, setShowAllSeries] = (0, _react.useState)(false);
|
|
69
76
|
const mousePos = (0, _tooltipModel.useMousePosition)();
|
|
77
|
+
const { height , width , ref: tooltipRef } = (0, _useResizeObserver.default)();
|
|
78
|
+
const isTooltipPinned = pinnedPos !== null;
|
|
70
79
|
if (mousePos === null || mousePos.target === null) return null;
|
|
71
|
-
//
|
|
80
|
+
// Ensure user is hovering over a chart before checking for nearby series.
|
|
72
81
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
73
82
|
const chart = chartRef.current;
|
|
74
|
-
const focusedSeries = (0, _focusedSeries.getFocusedSeriesData)(mousePos, chartData, pinnedPos, chart, unit);
|
|
75
83
|
var ref;
|
|
76
|
-
const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref :
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
84
|
+
const chartWidth = (ref = chart === null || chart === void 0 ? void 0 : chart.getWidth()) !== null && ref !== void 0 ? ref : _tooltipModel.FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
85
|
+
const cursorTransform = (0, _utils.assembleTransform)(mousePos, chartWidth, pinnedPos, height !== null && height !== void 0 ? height : 0, width !== null && width !== void 0 ? width : 0);
|
|
86
|
+
// Get series nearby the cursor and pass into tooltip content children.
|
|
87
|
+
const nearbySeries = (0, _nearbySeries.getNearbySeriesData)({
|
|
88
|
+
mousePos,
|
|
89
|
+
chartData,
|
|
90
|
+
pinnedPos,
|
|
91
|
+
chart,
|
|
92
|
+
unit,
|
|
93
|
+
showAllSeries
|
|
94
|
+
});
|
|
95
|
+
if (nearbySeries.length === 0) {
|
|
81
96
|
return null;
|
|
82
97
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
98
|
+
const totalSeries = chartData.timeSeries.length;
|
|
99
|
+
var ref1;
|
|
86
100
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Portal, {
|
|
87
101
|
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
88
|
-
|
|
102
|
+
ref: tooltipRef,
|
|
103
|
+
sx: (theme)=>{
|
|
104
|
+
var ref;
|
|
105
|
+
return {
|
|
106
|
+
minWidth: _tooltipModel.TOOLTIP_MIN_WIDTH,
|
|
89
107
|
maxWidth: _tooltipModel.TOOLTIP_MAX_WIDTH,
|
|
90
108
|
maxHeight: _tooltipModel.TOOLTIP_MAX_HEIGHT,
|
|
109
|
+
padding: 0,
|
|
91
110
|
position: 'absolute',
|
|
92
111
|
top: 0,
|
|
93
112
|
left: 0,
|
|
94
|
-
backgroundColor:
|
|
113
|
+
backgroundColor: (ref1 = (ref = theme.palette.designSystem) === null || ref === void 0 ? void 0 : ref.grey[800]) !== null && ref1 !== void 0 ? ref1 : _tooltipModel.TOOLTIP_BG_COLOR_FALLBACK,
|
|
95
114
|
borderRadius: '6px',
|
|
96
115
|
color: '#fff',
|
|
97
116
|
fontSize: '11px',
|
|
@@ -103,13 +122,27 @@ const TimeSeriesTooltip = /*#__PURE__*/ _react.default.memo(function TimeSeriesT
|
|
|
103
122
|
'&:hover': {
|
|
104
123
|
overflowY: 'auto'
|
|
105
124
|
}
|
|
106
|
-
}
|
|
125
|
+
};
|
|
126
|
+
},
|
|
107
127
|
style: {
|
|
108
128
|
transform: cursorTransform
|
|
109
129
|
},
|
|
110
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.
|
|
111
|
-
|
|
112
|
-
|
|
130
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
131
|
+
spacing: 0.5,
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_tooltipHeader.TooltipHeader, {
|
|
134
|
+
nearbySeries: nearbySeries,
|
|
135
|
+
totalSeries: totalSeries,
|
|
136
|
+
isTooltipPinned: isTooltipPinned,
|
|
137
|
+
showAllSeries: showAllSeries,
|
|
138
|
+
onShowAllClick: (checked)=>setShowAllSeries(checked),
|
|
139
|
+
onUnpinClick: onUnpinClick
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_tooltipContent.TooltipContent, {
|
|
142
|
+
series: nearbySeries,
|
|
143
|
+
wrapLabels: wrapLabels
|
|
144
|
+
})
|
|
145
|
+
]
|
|
113
146
|
})
|
|
114
147
|
})
|
|
115
148
|
});
|
|
@@ -21,75 +21,36 @@ Object.defineProperty(exports, "TooltipContent", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _react = require("react");
|
|
23
23
|
const _material = require("@mui/material");
|
|
24
|
-
const _timeZoneProvider = require("../context/TimeZoneProvider");
|
|
25
24
|
const _seriesInfo = require("./SeriesInfo");
|
|
26
25
|
function TooltipContent(props) {
|
|
27
|
-
const {
|
|
28
|
-
const { formatWithUserTimeZone } = (0, _timeZoneProvider.useTimeZone)();
|
|
29
|
-
const seriesTime = focusedSeries && focusedSeries[0] && focusedSeries[0].date ? focusedSeries[0].date : null;
|
|
30
|
-
const formatTimeSeriesHeader = (timeString)=>{
|
|
31
|
-
const date = new Date(timeString);
|
|
32
|
-
const formattedDate = formatWithUserTimeZone(date, 'MMM dd, yyyy - ');
|
|
33
|
-
const formattedTime = formatWithUserTimeZone(date, 'HH:mm:ss');
|
|
34
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
35
|
-
children: [
|
|
36
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
37
|
-
variant: "caption",
|
|
38
|
-
sx: (theme)=>({
|
|
39
|
-
color: theme.palette.common.white
|
|
40
|
-
}),
|
|
41
|
-
children: formattedDate
|
|
42
|
-
}),
|
|
43
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
44
|
-
variant: "caption",
|
|
45
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)("strong", {
|
|
46
|
-
children: formattedTime
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
});
|
|
51
|
-
};
|
|
26
|
+
const { series , wrapLabels } = props;
|
|
52
27
|
const sortedFocusedSeries = (0, _react.useMemo)(()=>{
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
28
|
+
if (series === null) return null;
|
|
29
|
+
return series.sort((a, b)=>a.y > b.y ? -1 : 1);
|
|
55
30
|
}, [
|
|
56
|
-
|
|
31
|
+
series
|
|
57
32
|
]);
|
|
58
|
-
if (
|
|
59
|
-
return
|
|
60
|
-
py: 1,
|
|
61
|
-
px: 1.5,
|
|
62
|
-
spacing: 0.5,
|
|
63
|
-
children: [
|
|
64
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
65
|
-
variant: "caption",
|
|
66
|
-
children: formatTimeSeriesHeader(seriesTime)
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Divider, {
|
|
69
|
-
sx: (theme)=>({
|
|
70
|
-
borderColor: theme.palette.grey['500']
|
|
71
|
-
})
|
|
72
|
-
}),
|
|
73
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
74
|
-
sx: {
|
|
75
|
-
display: 'table'
|
|
76
|
-
},
|
|
77
|
-
children: sortedFocusedSeries.map(({ datumIdx , seriesIdx , seriesName , y , formattedY , markerColor })=>{
|
|
78
|
-
if (datumIdx === null || seriesIdx === null) return null;
|
|
79
|
-
const key = seriesIdx.toString() + datumIdx.toString();
|
|
80
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_seriesInfo.SeriesInfo, {
|
|
81
|
-
seriesName: seriesName,
|
|
82
|
-
y: y,
|
|
83
|
-
formattedY: formattedY,
|
|
84
|
-
markerColor: markerColor,
|
|
85
|
-
totalSeries: sortedFocusedSeries.length,
|
|
86
|
-
wrapLabels: wrapLabels
|
|
87
|
-
}, key);
|
|
88
|
-
})
|
|
89
|
-
})
|
|
90
|
-
]
|
|
91
|
-
});
|
|
92
|
-
} else {
|
|
93
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
33
|
+
if (series === null || sortedFocusedSeries === null) {
|
|
34
|
+
return null;
|
|
94
35
|
}
|
|
36
|
+
// TODO: use react-virtuoso to improve performance
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
38
|
+
sx: (theme)=>({
|
|
39
|
+
display: 'table',
|
|
40
|
+
padding: theme.spacing(0.5, 2)
|
|
41
|
+
}),
|
|
42
|
+
children: sortedFocusedSeries.map(({ datumIdx , seriesIdx , seriesName , y , formattedY , markerColor , isClosestToCursor })=>{
|
|
43
|
+
if (datumIdx === null || seriesIdx === null) return null;
|
|
44
|
+
const key = seriesIdx.toString() + datumIdx.toString();
|
|
45
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_seriesInfo.SeriesInfo, {
|
|
46
|
+
seriesName: seriesName,
|
|
47
|
+
y: y,
|
|
48
|
+
formattedY: formattedY,
|
|
49
|
+
markerColor: markerColor,
|
|
50
|
+
totalSeries: sortedFocusedSeries.length,
|
|
51
|
+
wrapLabels: wrapLabels,
|
|
52
|
+
emphasizeText: isClosestToCursor
|
|
53
|
+
}, key);
|
|
54
|
+
})
|
|
55
|
+
});
|
|
95
56
|
}
|