@perses-dev/components 0.51.0-beta.1 → 0.51.0-rc.1
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/README.md +1 -8
- package/dist/EChart/EChart.d.ts +3 -2
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +19 -7
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +5 -6
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +14 -4
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableFoot.d.ts +4 -0
- package/dist/Table/TableFoot.d.ts.map +1 -0
- package/dist/{BarChart/index.js → Table/TableFoot.js} +11 -3
- package/dist/Table/TableFoot.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +3 -2
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +31 -2
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +10 -1
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -5
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.d.ts +0 -1
- package/dist/TimeSeriesTooltip/index.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +0 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -8
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +6 -16
- 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 +27 -23
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/cjs/EChart/EChart.js +17 -5
- package/dist/cjs/JSONEditor.js +4 -5
- package/dist/cjs/Table/Table.js +13 -3
- package/dist/cjs/{StatChart/utils/formatStatChartValue.js → Table/TableFoot.js} +12 -15
- package/dist/cjs/Table/VirtualizedTable.js +30 -1
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +1 -4
- package/dist/cjs/TimeSeriesTooltip/index.js +0 -1
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +6 -25
- package/dist/cjs/TimeSeriesTooltip/utils.js +26 -22
- package/dist/cjs/context/ChartsProvider.js +3 -1
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/test-utils/theme.js +1 -0
- package/dist/cjs/utils/axis.js +3 -18
- package/dist/cjs/utils/format.js +0 -21
- package/dist/context/ChartsProvider.d.ts +2 -0
- package/dist/context/ChartsProvider.d.ts.map +1 -1
- package/dist/context/ChartsProvider.js +3 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +1 -1
- package/dist/model/graph.d.ts +0 -1
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +1 -0
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/utils/axis.d.ts +0 -4
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +0 -9
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +0 -2
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +0 -20
- package/dist/utils/format.js.map +1 -1
- package/package.json +2 -7
- package/dist/BarChart/BarChart.d.ts +0 -16
- package/dist/BarChart/BarChart.d.ts.map +0 -1
- package/dist/BarChart/BarChart.js +0 -134
- package/dist/BarChart/BarChart.js.map +0 -1
- package/dist/BarChart/index.d.ts +0 -2
- package/dist/BarChart/index.d.ts.map +0 -1
- package/dist/BarChart/index.js.map +0 -1
- package/dist/GaugeChart/GaugeChart.d.ts +0 -23
- package/dist/GaugeChart/GaugeChart.d.ts.map +0 -1
- package/dist/GaugeChart/GaugeChart.js +0 -214
- package/dist/GaugeChart/GaugeChart.js.map +0 -1
- package/dist/GaugeChart/index.d.ts +0 -2
- package/dist/GaugeChart/index.d.ts.map +0 -1
- package/dist/GaugeChart/index.js +0 -15
- package/dist/GaugeChart/index.js.map +0 -1
- package/dist/LineChart/LineChart.d.ts +0 -22
- package/dist/LineChart/LineChart.d.ts.map +0 -1
- package/dist/LineChart/LineChart.js +0 -266
- package/dist/LineChart/LineChart.js.map +0 -1
- package/dist/LineChart/index.d.ts +0 -2
- package/dist/LineChart/index.d.ts.map +0 -1
- package/dist/LineChart/index.js +0 -15
- package/dist/LineChart/index.js.map +0 -1
- package/dist/PieChart/PieChart.d.ts +0 -14
- package/dist/PieChart/PieChart.d.ts.map +0 -1
- package/dist/PieChart/PieChart.js +0 -92
- package/dist/PieChart/PieChart.js.map +0 -1
- package/dist/PieChart/index.d.ts +0 -2
- package/dist/PieChart/index.d.ts.map +0 -1
- package/dist/PieChart/index.js +0 -15
- package/dist/PieChart/index.js.map +0 -1
- package/dist/StatChart/StatChart.d.ts +0 -21
- package/dist/StatChart/StatChart.d.ts.map +0 -1
- package/dist/StatChart/StatChart.js +0 -185
- package/dist/StatChart/StatChart.js.map +0 -1
- package/dist/StatChart/calculateFontSize.d.ts +0 -16
- package/dist/StatChart/calculateFontSize.d.ts.map +0 -1
- package/dist/StatChart/calculateFontSize.js +0 -49
- package/dist/StatChart/calculateFontSize.js.map +0 -1
- package/dist/StatChart/index.d.ts +0 -2
- package/dist/StatChart/index.d.ts.map +0 -1
- package/dist/StatChart/index.js +0 -15
- package/dist/StatChart/index.js.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.d.ts +0 -3
- package/dist/StatChart/utils/formatStatChartValue.d.ts.map +0 -1
- package/dist/StatChart/utils/formatStatChartValue.js +0 -26
- package/dist/StatChart/utils/formatStatChartValue.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +0 -27
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.js +0 -132
- package/dist/StatusHistoryChart/StatusHistoryChart.js.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +0 -13
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +0 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js +0 -47
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +0 -2
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +0 -1
- package/dist/StatusHistoryChart/get-formatted-axis-label.js +0 -41
- package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +0 -1
- package/dist/StatusHistoryChart/index.d.ts +0 -3
- package/dist/StatusHistoryChart/index.d.ts.map +0 -1
- package/dist/StatusHistoryChart/index.js +0 -16
- package/dist/StatusHistoryChart/index.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.d.ts +0 -6
- package/dist/StatusHistoryChart/utils/get-color.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-color.js +0 -100
- package/dist/StatusHistoryChart/utils/get-color.js.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +0 -3
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +0 -1
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js +0 -27
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +0 -1
- package/dist/TimeChart/TimeChart.d.ts +0 -24
- package/dist/TimeChart/TimeChart.d.ts.map +0 -1
- package/dist/TimeChart/TimeChart.js +0 -394
- package/dist/TimeChart/TimeChart.js.map +0 -1
- package/dist/TimeChart/index.d.ts +0 -2
- package/dist/TimeChart/index.d.ts.map +0 -1
- package/dist/TimeChart/index.js +0 -15
- package/dist/TimeChart/index.js.map +0 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +0 -21
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +0 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +0 -104
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +0 -1
- package/dist/cjs/BarChart/BarChart.js +0 -142
- package/dist/cjs/BarChart/index.js +0 -30
- package/dist/cjs/GaugeChart/GaugeChart.js +0 -227
- package/dist/cjs/GaugeChart/index.js +0 -30
- package/dist/cjs/LineChart/LineChart.js +0 -274
- package/dist/cjs/LineChart/index.js +0 -30
- package/dist/cjs/PieChart/PieChart.js +0 -100
- package/dist/cjs/PieChart/index.js +0 -30
- package/dist/cjs/StatChart/StatChart.js +0 -198
- package/dist/cjs/StatChart/calculateFontSize.js +0 -55
- package/dist/cjs/StatChart/index.js +0 -30
- package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +0 -140
- package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +0 -55
- package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +0 -48
- package/dist/cjs/StatusHistoryChart/index.js +0 -31
- package/dist/cjs/StatusHistoryChart/utils/get-color.js +0 -125
- package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +0 -35
- package/dist/cjs/TimeChart/TimeChart.js +0 -407
- package/dist/cjs/TimeChart/index.js +0 -30
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +0 -117
|
@@ -34,17 +34,27 @@ function _interop_require_default(obj) {
|
|
|
34
34
|
default: obj
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
// Loading the ECharts extensions should happen in the respective
|
|
37
|
+
// Loading the ECharts extensions should happen in the respective plugins.
|
|
38
38
|
// This is a workaround for https://github.com/perses/plugins/issues/83.
|
|
39
39
|
(0, _core.use)([
|
|
40
40
|
_components.DatasetComponent,
|
|
41
41
|
_components.DataZoomComponent,
|
|
42
42
|
_components.LegendComponent,
|
|
43
|
+
_charts.LineChart,
|
|
44
|
+
_charts.GaugeChart,
|
|
45
|
+
_charts.PieChart,
|
|
43
46
|
_charts.ScatterChart,
|
|
47
|
+
_charts.CustomChart,
|
|
48
|
+
_charts.HeatmapChart,
|
|
44
49
|
_components.GridComponent,
|
|
45
50
|
_components.TitleComponent,
|
|
51
|
+
_components.ToolboxComponent,
|
|
46
52
|
_components.TooltipComponent,
|
|
47
|
-
_renderers.CanvasRenderer
|
|
53
|
+
_renderers.CanvasRenderer,
|
|
54
|
+
_components.VisualMapComponent,
|
|
55
|
+
_components.MarkAreaComponent,
|
|
56
|
+
_components.MarkLineComponent,
|
|
57
|
+
_components.MarkPointComponent
|
|
48
58
|
]);
|
|
49
59
|
const mouseEvents = [
|
|
50
60
|
'click',
|
|
@@ -62,7 +72,7 @@ const batchEvents = [
|
|
|
62
72
|
'downplay',
|
|
63
73
|
'highlight'
|
|
64
74
|
];
|
|
65
|
-
const EChart = /*#__PURE__*/ (0, _react.memo)(function EChart({ option, theme, renderer, sx, onEvents, _instance, syncGroup, onChartInitialized }) {
|
|
75
|
+
const EChart = /*#__PURE__*/ (0, _react.memo)(function EChart({ option, theme, renderer, sx, style, onEvents, _instance, syncGroup, onChartInitialized }) {
|
|
66
76
|
const initialOption = (0, _react.useRef)(option);
|
|
67
77
|
const prevOption = (0, _react.useRef)(option);
|
|
68
78
|
const containerRef = (0, _react.useRef)(null);
|
|
@@ -152,11 +162,13 @@ const EChart = /*#__PURE__*/ (0, _react.memo)(function EChart({ option, theme, r
|
|
|
152
162
|
});
|
|
153
163
|
updateSize();
|
|
154
164
|
}, [
|
|
155
|
-
sx
|
|
165
|
+
sx,
|
|
166
|
+
style
|
|
156
167
|
]);
|
|
157
168
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
158
169
|
ref: containerRef,
|
|
159
|
-
sx: sx
|
|
170
|
+
sx: sx,
|
|
171
|
+
style: style
|
|
160
172
|
});
|
|
161
173
|
});
|
|
162
174
|
// Validate event config and bind custom events
|
package/dist/cjs/JSONEditor.js
CHANGED
|
@@ -36,11 +36,6 @@ function JSONEditor(props) {
|
|
|
36
36
|
const isDarkMode = theme.palette.mode === 'dark';
|
|
37
37
|
const [value, setValue] = (0, _react.useState)(()=>JSON.stringify(props.value, null, 2));
|
|
38
38
|
const [lastProcessedValue, setLastProcessedValue] = (0, _react.useState)(value);
|
|
39
|
-
(0, _react.useEffect)(()=>{
|
|
40
|
-
setValue(JSON.stringify(props.value, null, 2));
|
|
41
|
-
}, [
|
|
42
|
-
props.value
|
|
43
|
-
]);
|
|
44
39
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcodemirror.default, {
|
|
45
40
|
...props,
|
|
46
41
|
style: {
|
|
@@ -55,6 +50,10 @@ function JSONEditor(props) {
|
|
|
55
50
|
value: value,
|
|
56
51
|
onChange: (newValue)=>{
|
|
57
52
|
setValue(newValue);
|
|
53
|
+
// Trigger the provided onChange callback in real-time
|
|
54
|
+
if (props.onChange) {
|
|
55
|
+
props.onChange(newValue);
|
|
56
|
+
}
|
|
58
57
|
},
|
|
59
58
|
onBlur: ()=>{
|
|
60
59
|
// Don't trigger the provided onChange if the last processed value is equal to the current value.
|
package/dist/cjs/Table/Table.js
CHANGED
|
@@ -35,7 +35,7 @@ const DEFAULT_GET_ROW_ID = (data, index)=>{
|
|
|
35
35
|
// does not do deep equality checking for objects and arrays.
|
|
36
36
|
const DEFAULT_ROW_SELECTION = {};
|
|
37
37
|
const DEFAULT_SORTING = [];
|
|
38
|
-
function Table({ data, columns, cellConfigs, density = 'standard', defaultColumnWidth = _tablemodel.DEFAULT_COLUMN_WIDTH, defaultColumnHeight = 'auto', checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId = DEFAULT_GET_ROW_ID, rowSelection = DEFAULT_ROW_SELECTION, sorting = DEFAULT_SORTING, rowSelectionVariant = 'standard', ...otherProps }) {
|
|
38
|
+
function Table({ data, columns, cellConfigs, density = 'standard', defaultColumnWidth = _tablemodel.DEFAULT_COLUMN_WIDTH, defaultColumnHeight = 'auto', checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId = DEFAULT_GET_ROW_ID, rowSelection = DEFAULT_ROW_SELECTION, sorting = DEFAULT_SORTING, pagination, onPaginationChange, rowSelectionVariant = 'standard', ...otherProps }) {
|
|
39
39
|
const theme = (0, _material.useTheme)();
|
|
40
40
|
const handleRowSelectionChange = (rowSelectionUpdater)=>{
|
|
41
41
|
const newRowSelection = typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;
|
|
@@ -122,6 +122,10 @@ function Table({ data, columns, cellConfigs, density = 'standard', defaultColumn
|
|
|
122
122
|
getRowId,
|
|
123
123
|
getCoreRowModel: (0, _reacttable.getCoreRowModel)(),
|
|
124
124
|
getSortedRowModel: (0, _reacttable.getSortedRowModel)(),
|
|
125
|
+
getPaginationRowModel: pagination ? (0, _reacttable.getPaginationRowModel)() : undefined,
|
|
126
|
+
// without this setting, the getPaginationRowModel setting persists and it is not possible to switch from paginated to unpaginated
|
|
127
|
+
// can be removed once https://github.com/TanStack/table/pull/5974 is merged
|
|
128
|
+
manualPagination: !pagination,
|
|
125
129
|
enableRowSelection: !!checkboxSelection,
|
|
126
130
|
onRowSelectionChange: handleRowSelectionChange,
|
|
127
131
|
onSortingChange: handleSortingChange,
|
|
@@ -130,7 +134,10 @@ function Table({ data, columns, cellConfigs, density = 'standard', defaultColumn
|
|
|
130
134
|
sortDescFirst: true,
|
|
131
135
|
state: {
|
|
132
136
|
rowSelection,
|
|
133
|
-
sorting
|
|
137
|
+
sorting,
|
|
138
|
+
...pagination ? {
|
|
139
|
+
pagination
|
|
140
|
+
} : {}
|
|
134
141
|
}
|
|
135
142
|
});
|
|
136
143
|
const handleRowClick = (0, _react.useCallback)((e, rowId)=>{
|
|
@@ -150,6 +157,9 @@ function Table({ data, columns, cellConfigs, density = 'standard', defaultColumn
|
|
|
150
157
|
rows: table.getRowModel().rows,
|
|
151
158
|
columns: table.getAllFlatColumns(),
|
|
152
159
|
headers: table.getHeaderGroups(),
|
|
153
|
-
cellConfigs: cellConfigs
|
|
160
|
+
cellConfigs: cellConfigs,
|
|
161
|
+
pagination: pagination,
|
|
162
|
+
onPaginationChange: onPaginationChange,
|
|
163
|
+
rowCount: table.getRowCount()
|
|
154
164
|
});
|
|
155
165
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,21 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "TableFoot", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return TableFoot;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return value;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const TableFoot = /*#__PURE__*/ (0, _react.forwardRef)(function TableFoot(props, ref) {
|
|
27
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableFooter, {
|
|
28
|
+
...props,
|
|
29
|
+
ref: ref
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -33,7 +33,8 @@ const _TableHeaderCell = require("./TableHeaderCell");
|
|
|
33
33
|
const _TableCell = require("./TableCell");
|
|
34
34
|
const _VirtualizedTableContainer = require("./VirtualizedTableContainer");
|
|
35
35
|
const _useVirtualizedTableKeyboardNav = require("./hooks/useVirtualizedTableKeyboardNav");
|
|
36
|
-
|
|
36
|
+
const _TableFoot = require("./TableFoot");
|
|
37
|
+
function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultColumnHeight, onRowClick, onRowMouseOver, onRowMouseOut, rows, columns, headers, cellConfigs, pagination, onPaginationChange, rowCount }) {
|
|
37
38
|
const virtuosoRef = (0, _react.useRef)(null);
|
|
38
39
|
// Use a ref for these values because they are only needed for keyboard
|
|
39
40
|
// focus interactions and setting them on state will lead to a significant
|
|
@@ -70,6 +71,7 @@ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultC
|
|
|
70
71
|
});
|
|
71
72
|
},
|
|
72
73
|
TableHead: _TableHead.TableHead,
|
|
74
|
+
TableFoot: _TableFoot.TableFoot,
|
|
73
75
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
76
|
TableRow: ({ item, ...props })=>{
|
|
75
77
|
const index = props['data-index'];
|
|
@@ -104,6 +106,20 @@ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultC
|
|
|
104
106
|
rows,
|
|
105
107
|
width
|
|
106
108
|
]);
|
|
109
|
+
const handleChangePage = (_event, newPage)=>{
|
|
110
|
+
if (!pagination || !onPaginationChange) return;
|
|
111
|
+
onPaginationChange({
|
|
112
|
+
...pagination,
|
|
113
|
+
pageIndex: newPage
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const handleChangeRowsPerPage = (event)=>{
|
|
117
|
+
if (!pagination || !onPaginationChange) return;
|
|
118
|
+
onPaginationChange({
|
|
119
|
+
pageIndex: 0,
|
|
120
|
+
pageSize: parseInt(event.target.value, 10)
|
|
121
|
+
});
|
|
122
|
+
};
|
|
107
123
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
108
124
|
style: {
|
|
109
125
|
width,
|
|
@@ -151,6 +167,19 @@ function VirtualizedTable({ width, height, density, defaultColumnWidth, defaultC
|
|
|
151
167
|
})
|
|
152
168
|
});
|
|
153
169
|
},
|
|
170
|
+
fixedFooterContent: pagination ? ()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
|
|
171
|
+
sx: {
|
|
172
|
+
backgroundColor: (theme)=>theme.palette.background.default
|
|
173
|
+
},
|
|
174
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TablePagination, {
|
|
175
|
+
colSpan: columns.length,
|
|
176
|
+
count: rowCount,
|
|
177
|
+
page: pagination.pageIndex,
|
|
178
|
+
rowsPerPage: pagination.pageSize,
|
|
179
|
+
onPageChange: handleChangePage,
|
|
180
|
+
onRowsPerPageChange: handleChangeRowsPerPage
|
|
181
|
+
})
|
|
182
|
+
}) : undefined,
|
|
154
183
|
itemContent: (index)=>{
|
|
155
184
|
const row = rows[index];
|
|
156
185
|
if (!row) {
|
|
@@ -44,13 +44,10 @@ const TimeChartTooltip = /*#__PURE__*/ (0, _react.memo)(function TimeChartToolti
|
|
|
44
44
|
// Ensure user is hovering over a chart before checking for nearby series.
|
|
45
45
|
if (pinnedPos === null && mousePos.target.tagName !== 'CANVAS') return null;
|
|
46
46
|
const chart = chartRef.current;
|
|
47
|
-
const chartWidth = chart?.getWidth() ?? _tooltipmodel.FALLBACK_CHART_WIDTH; // Fallback width not likely to ever be needed.
|
|
48
47
|
const containerElement = containerId ? document.querySelector(containerId) : undefined;
|
|
49
48
|
// if tooltip is attached to a container, set max height to the height of the container so tooltip does not get cut off
|
|
50
49
|
const maxHeight = containerElement ? containerElement.getBoundingClientRect().height : undefined;
|
|
51
|
-
|
|
52
|
-
transform.current = (0, _utils.assembleTransform)(mousePos, chartWidth, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
53
|
-
}
|
|
50
|
+
transform.current = (0, _utils.assembleTransform)(mousePos, pinnedPos, height ?? 0, width ?? 0, containerElement);
|
|
54
51
|
// Get series nearby the cursor and pass into tooltip content children.
|
|
55
52
|
const nearbySeries = (0, _nearbyseries.getNearbySeriesData)({
|
|
56
53
|
mousePos,
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
_export_star(require("./LineChartTooltip"), exports);
|
|
18
17
|
_export_star(require("./SeriesInfo"), exports);
|
|
19
18
|
_export_star(require("./SeriesLabelsStack"), exports);
|
|
20
19
|
_export_star(require("./SeriesMarker"), exports);
|
|
@@ -66,18 +66,9 @@ _export(exports, {
|
|
|
66
66
|
UNPIN_TOOLTIP_HELP_TEXT: function() {
|
|
67
67
|
return UNPIN_TOOLTIP_HELP_TEXT;
|
|
68
68
|
},
|
|
69
|
-
browser: function() {
|
|
70
|
-
return browser;
|
|
71
|
-
},
|
|
72
69
|
defaultCursorData: function() {
|
|
73
70
|
return defaultCursorData;
|
|
74
71
|
},
|
|
75
|
-
pointerEventsSupported: function() {
|
|
76
|
-
return pointerEventsSupported;
|
|
77
|
-
},
|
|
78
|
-
trackingEventName: function() {
|
|
79
|
-
return trackingEventName;
|
|
80
|
-
},
|
|
81
72
|
useMousePosition: function() {
|
|
82
73
|
return useMousePosition;
|
|
83
74
|
}
|
|
@@ -117,14 +108,6 @@ const defaultCursorData = {
|
|
|
117
108
|
chartWidth: 0
|
|
118
109
|
};
|
|
119
110
|
const EMPTY_TOOLTIP_DATA = [];
|
|
120
|
-
const browser = {
|
|
121
|
-
// IE 11 Trident/7.0; rv:11.0
|
|
122
|
-
ie: navigator.userAgent.match(/MSIE\s([\d.]+)/) || navigator.userAgent.match(/Trident\/.+?rv:(([\d.]+))/),
|
|
123
|
-
// IE 12 and 12+
|
|
124
|
-
edge: navigator.userAgent.match(/Edge?\/([\d.]+)/)
|
|
125
|
-
};
|
|
126
|
-
const pointerEventsSupported = 'onpointerdown' in window && (browser.edge || browser.ie && browser.ie[1] && +browser.ie[1] >= 11);
|
|
127
|
-
const trackingEventName = pointerEventsSupported ? 'pointermove' : 'mousemove';
|
|
128
111
|
const useMousePosition = ()=>{
|
|
129
112
|
const [coords, setCoords] = (0, _react.useState)(null);
|
|
130
113
|
(0, _react.useEffect)(()=>{
|
|
@@ -139,22 +122,20 @@ const useMousePosition = ()=>{
|
|
|
139
122
|
y: e.clientY
|
|
140
123
|
},
|
|
141
124
|
plotCanvas: {
|
|
142
|
-
//
|
|
125
|
+
// Default to zrender mousemove coords since they handle browser inconsistencies for us
|
|
143
126
|
// ex: Firefox and Chrome have slightly different implementations of offsetX and offsetY
|
|
144
127
|
// more info: https://github.com/ecomfe/zrender/blob/5.5.0/src/core/event.ts#L46-L120
|
|
145
|
-
|
|
146
|
-
|
|
128
|
+
// Fallback to offsetX and offsetY to ensure tooltip works correctly in Edge
|
|
129
|
+
x: e.zrX ?? e.offsetX,
|
|
130
|
+
y: e.zrY ?? e.offsetY
|
|
147
131
|
},
|
|
148
132
|
// necessary to check whether cursor target matches correct chart canvas (since each chart has its own mousemove listener)
|
|
149
133
|
target: e.target
|
|
150
134
|
});
|
|
151
135
|
};
|
|
152
|
-
|
|
153
|
-
// which leads to missing zrender mousemove coordinates
|
|
154
|
-
// {@link https://github.com/ecomfe/zrender/blob/ae8cfaae186e6c1bf66b5dc431b2cdda5e67dacf/src/dom/HandlerProxy.ts#L423-L428 }
|
|
155
|
-
window.addEventListener(trackingEventName, setFromEvent);
|
|
136
|
+
window.addEventListener('mousemove', setFromEvent);
|
|
156
137
|
return ()=>{
|
|
157
|
-
window.removeEventListener(
|
|
138
|
+
window.removeEventListener('mousemove', setFromEvent);
|
|
158
139
|
};
|
|
159
140
|
}, []);
|
|
160
141
|
return coords;
|
|
@@ -29,7 +29,7 @@ _export(exports, {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
const _tooltipmodel = require("./tooltip-model");
|
|
32
|
-
function assembleTransform(mousePos,
|
|
32
|
+
function assembleTransform(mousePos, pinnedPos, tooltipHeight, tooltipWidth, containerElement) {
|
|
33
33
|
if (mousePos === null) {
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
@@ -39,33 +39,37 @@ function assembleTransform(mousePos, chartWidth, pinnedPos, tooltipHeight, toolt
|
|
|
39
39
|
mousePos = pinnedPos;
|
|
40
40
|
}
|
|
41
41
|
if (mousePos.plotCanvas.x === undefined) return undefined;
|
|
42
|
-
|
|
43
|
-
// Using page coordinates instead of viewport ensures the tooltip is
|
|
44
|
-
// absolutely positioned correctly as the user scrolls
|
|
45
|
-
let x = mousePos.page.x;
|
|
42
|
+
let x = mousePos.page.x + cursorPaddingX; // Default to right side of the cursor
|
|
46
43
|
let y = mousePos.page.y + cursorPaddingY;
|
|
47
|
-
// If containerElement is defined,
|
|
48
|
-
let containerRect;
|
|
44
|
+
// If containerElement is defined, adjust coordinates relative to the container
|
|
49
45
|
if (containerElement) {
|
|
50
|
-
|
|
51
|
-
containerRect = containerElement.getBoundingClientRect();
|
|
52
|
-
// calculate the mouse position relative to container
|
|
46
|
+
const containerRect = containerElement.getBoundingClientRect();
|
|
53
47
|
x = x - containerRect.left + containerElement.scrollLeft;
|
|
54
48
|
y = y - containerRect.top + containerElement.scrollTop;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
// Ensure tooltip does not go out of the container's bottom
|
|
50
|
+
const containerBottom = containerRect.top + containerElement.scrollHeight;
|
|
51
|
+
if (y + tooltipHeight > containerBottom) {
|
|
52
|
+
y = Math.max(containerBottom - tooltipHeight - cursorPaddingY, _tooltipmodel.TOOLTIP_PADDING / 2);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
// Ensure tooltip does not go out of the screen on the bottom
|
|
56
|
+
if (y + tooltipHeight > window.innerHeight + window.scrollY) {
|
|
57
|
+
y = Math.max(window.innerHeight + window.scrollY - tooltipHeight - cursorPaddingY, _tooltipmodel.TOOLTIP_PADDING / 2);
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
// Ensure tooltip does not go out of the screen on the right
|
|
61
|
+
if (x + tooltipWidth > window.innerWidth) {
|
|
62
|
+
x = mousePos.page.x - tooltipWidth - cursorPaddingX; // Move to the left of the cursor
|
|
63
|
+
}
|
|
64
|
+
// Ensure tooltip does not go out of the screen on the left
|
|
65
|
+
if (x < cursorPaddingX) {
|
|
66
|
+
x = cursorPaddingX;
|
|
67
|
+
}
|
|
68
|
+
// Ensure tooltip does not go out of the screen on the top
|
|
69
|
+
if (y < _tooltipmodel.TOOLTIP_PADDING / 2) {
|
|
70
|
+
y = _tooltipmodel.TOOLTIP_PADDING / 2;
|
|
71
|
+
}
|
|
72
|
+
return `translate3d(${x}px, ${y}px, 0)`;
|
|
69
73
|
}
|
|
70
74
|
function getTooltipStyles(theme, pinnedPos, maxHeight) {
|
|
71
75
|
const adjustedMaxHeight = maxHeight ? maxHeight - _tooltipmodel.TOOLTIP_PADDING : undefined;
|
|
@@ -78,18 +78,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
78
78
|
return newObj;
|
|
79
79
|
}
|
|
80
80
|
function ChartsProvider(props) {
|
|
81
|
-
const { children, chartsTheme, enablePinning = false } = props;
|
|
81
|
+
const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;
|
|
82
82
|
const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = (0, _react.useState)(null);
|
|
83
83
|
const ctx = (0, _react.useMemo)(()=>{
|
|
84
84
|
return {
|
|
85
85
|
chartsTheme,
|
|
86
86
|
enablePinning,
|
|
87
87
|
lastTooltipPinnedCoords,
|
|
88
|
+
enableSyncGrouping,
|
|
88
89
|
setLastTooltipPinnedCoords
|
|
89
90
|
};
|
|
90
91
|
}, [
|
|
91
92
|
chartsTheme,
|
|
92
93
|
enablePinning,
|
|
94
|
+
enableSyncGrouping,
|
|
93
95
|
lastTooltipPinnedCoords,
|
|
94
96
|
setLastTooltipPinnedCoords
|
|
95
97
|
]);
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./AlignSelector"), exports);
|
|
18
|
-
_export_star(require("./BarChart"), exports);
|
|
19
18
|
_export_star(require("./ColorPicker"), exports);
|
|
20
19
|
_export_star(require("./ContentWithLegend"), exports);
|
|
21
20
|
_export_star(require("./controls"), exports);
|
|
@@ -28,21 +27,17 @@ _export_star(require("./ErrorAlert"), exports);
|
|
|
28
27
|
_export_star(require("./ErrorBoundary"), exports);
|
|
29
28
|
_export_star(require("./FontSizeSelector"), exports);
|
|
30
29
|
_export_star(require("./FormEditor"), exports);
|
|
31
|
-
_export_star(require("./GaugeChart"), exports);
|
|
32
30
|
_export_star(require("./InfoTooltip"), exports);
|
|
33
31
|
_export_star(require("./JSONEditor"), exports);
|
|
34
32
|
_export_star(require("./Legend"), exports);
|
|
35
|
-
_export_star(require("./LineChart"), exports);
|
|
36
33
|
_export_star(require("./LinksEditor"), exports);
|
|
37
34
|
_export_star(require("./ModeSelector"), exports);
|
|
38
35
|
_export_star(require("./OptionsEditorLayout"), exports);
|
|
39
36
|
_export_star(require("./Overlay"), exports);
|
|
40
37
|
_export_star(require("./SettingsAutocomplete"), exports);
|
|
41
38
|
_export_star(require("./SortSelector"), exports);
|
|
42
|
-
_export_star(require("./StatChart"), exports);
|
|
43
39
|
_export_star(require("./Table"), exports);
|
|
44
40
|
_export_star(require("./ThresholdsEditor"), exports);
|
|
45
|
-
_export_star(require("./TimeChart"), exports);
|
|
46
41
|
_export_star(require("./TimeRangeSelector"), exports);
|
|
47
42
|
_export_star(require("./TimeSeriesTooltip"), exports);
|
|
48
43
|
_export_star(require("./ToolbarIconButton"), exports);
|
|
@@ -55,8 +50,6 @@ _export_star(require("./test-utils"), exports);
|
|
|
55
50
|
_export_star(require("./theme"), exports);
|
|
56
51
|
_export_star(require("./TransformsEditor"), exports);
|
|
57
52
|
_export_star(require("./RefreshIntervalPicker"), exports);
|
|
58
|
-
_export_star(require("./PieChart"), exports);
|
|
59
|
-
_export_star(require("./StatusHistoryChart"), exports);
|
|
60
53
|
_export_star(require("./ValueMappingEditor"), exports);
|
|
61
54
|
function _export_star(from, to) {
|
|
62
55
|
Object.keys(from).forEach(function(k) {
|
|
@@ -55,6 +55,7 @@ const testChartsTheme = (0, _utils.generateChartsTheme)((0, _material.createThem
|
|
|
55
55
|
const mockChartsContext = {
|
|
56
56
|
chartsTheme: testChartsTheme,
|
|
57
57
|
enablePinning: false,
|
|
58
|
+
enableSyncGrouping: true,
|
|
58
59
|
lastTooltipPinnedCoords: null,
|
|
59
60
|
setLastTooltipPinnedCoords: ()=>null
|
|
60
61
|
};
|
package/dist/cjs/utils/axis.js
CHANGED
|
@@ -14,17 +14,9 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
getDateRange: function() {
|
|
25
|
-
return getDateRange;
|
|
26
|
-
},
|
|
27
|
-
getFormattedAxis: function() {
|
|
17
|
+
Object.defineProperty(exports, "getFormattedAxis", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
28
20
|
return getFormattedAxis;
|
|
29
21
|
}
|
|
30
22
|
});
|
|
@@ -53,10 +45,3 @@ function getFormattedAxis(axis, unit) {
|
|
|
53
45
|
(0, _merge.default)(AXIS_DEFAULT, axis)
|
|
54
46
|
];
|
|
55
47
|
}
|
|
56
|
-
function getDateRange(data) {
|
|
57
|
-
const defaultRange = 3600000; // hour in ms
|
|
58
|
-
if (data.length === 0) return defaultRange;
|
|
59
|
-
const lastDatum = data[data.length - 1];
|
|
60
|
-
if (data[0] === undefined || lastDatum === undefined) return defaultRange;
|
|
61
|
-
return lastDatum - data[0];
|
|
62
|
-
}
|
package/dist/cjs/utils/format.js
CHANGED
|
@@ -32,9 +32,6 @@ _export(exports, {
|
|
|
32
32
|
},
|
|
33
33
|
getFormattedAxisLabel: function() {
|
|
34
34
|
return getFormattedAxisLabel;
|
|
35
|
-
},
|
|
36
|
-
getFormattedDate: function() {
|
|
37
|
-
return getFormattedDate;
|
|
38
35
|
}
|
|
39
36
|
});
|
|
40
37
|
const _datefnstz = require("date-fns-tz");
|
|
@@ -67,24 +64,6 @@ function formatWithTimeZone(date, formatString, timeZone) {
|
|
|
67
64
|
return (0, _datefnstz.formatInTimeZone)(date, lowerTimeZone === 'utc' ? 'UTC' : timeZone, formatString);
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
function getFormattedDate(value, rangeMs, timeZone) {
|
|
71
|
-
const dateFormatOptions = dateFormatOptionsWithTimeZone({
|
|
72
|
-
hour: 'numeric',
|
|
73
|
-
minute: 'numeric',
|
|
74
|
-
hourCycle: 'h23'
|
|
75
|
-
}, timeZone);
|
|
76
|
-
const thirtyMinMs = 1800000;
|
|
77
|
-
const dayMs = 86400000;
|
|
78
|
-
if (rangeMs <= thirtyMinMs) {
|
|
79
|
-
dateFormatOptions.second = 'numeric';
|
|
80
|
-
} else if (rangeMs >= dayMs) {
|
|
81
|
-
dateFormatOptions.month = 'numeric';
|
|
82
|
-
dateFormatOptions.day = 'numeric';
|
|
83
|
-
}
|
|
84
|
-
const DATE_FORMAT = new Intl.DateTimeFormat(undefined, dateFormatOptions);
|
|
85
|
-
// remove comma when month / day present
|
|
86
|
-
return DATE_FORMAT.format(value).replace(/, /g, ' ');
|
|
87
|
-
}
|
|
88
67
|
function getFormattedAxisLabel(rangeMs) {
|
|
89
68
|
const dayMs = 86400000;
|
|
90
69
|
const monthMs = 2629440000;
|
|
@@ -4,11 +4,13 @@ import { CursorCoordinates } from '../TimeSeriesTooltip';
|
|
|
4
4
|
export interface ChartsProviderProps {
|
|
5
5
|
chartsTheme: PersesChartsTheme;
|
|
6
6
|
enablePinning?: boolean;
|
|
7
|
+
enableSyncGrouping?: boolean;
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
}
|
|
9
10
|
export interface SharedChartsState {
|
|
10
11
|
chartsTheme: PersesChartsTheme;
|
|
11
12
|
enablePinning: boolean;
|
|
13
|
+
enableSyncGrouping: boolean;
|
|
12
14
|
lastTooltipPinnedCoords: CursorCoordinates | null;
|
|
13
15
|
setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsProvider.d.ts","sourceRoot":"","sources":["../../src/context/ChartsProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAiB,YAAY,EAAiC,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,uBAAuB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClD,0BAA0B,EAAE,CAAC,uBAAuB,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CACzF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"ChartsProvider.d.ts","sourceRoot":"","sources":["../../src/context/ChartsProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAiB,YAAY,EAAiC,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,uBAAuB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClD,0BAA0B,EAAE,CAAC,uBAAuB,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;CACzF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAgBvE;AAED,eAAO,MAAM,kBAAkB,8CAA0D,CAAC;AAE1F,wBAAgB,gBAAgB,IAAI,iBAAiB,CAMpD;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAGlD"}
|
|
@@ -13,18 +13,20 @@
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
15
15
|
export function ChartsProvider(props) {
|
|
16
|
-
const { children, chartsTheme, enablePinning = false } = props;
|
|
16
|
+
const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;
|
|
17
17
|
const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState(null);
|
|
18
18
|
const ctx = useMemo(()=>{
|
|
19
19
|
return {
|
|
20
20
|
chartsTheme,
|
|
21
21
|
enablePinning,
|
|
22
22
|
lastTooltipPinnedCoords,
|
|
23
|
+
enableSyncGrouping,
|
|
23
24
|
setLastTooltipPinnedCoords
|
|
24
25
|
};
|
|
25
26
|
}, [
|
|
26
27
|
chartsTheme,
|
|
27
28
|
enablePinning,
|
|
29
|
+
enableSyncGrouping,
|
|
28
30
|
lastTooltipPinnedCoords,
|
|
29
31
|
setLastTooltipPinnedCoords
|
|
30
32
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright 2023 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 React, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright 2023 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 React, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n enableSyncGrouping?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n enableSyncGrouping: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n enableSyncGrouping,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAmB1F,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAEC,qBAAqB,IAAI,EAAE,GAAGJ;IAEpF,MAAM,CAACK,yBAAyBC,2BAA2B,GAAGR,SAAmC;IAEjG,MAAMS,MAAMV,QAAQ;QAClB,OAAO;YACLK;YACAC;YACAE;YACAD;YACAE;QACF;IACF,GAAG;QAACJ;QAAaC;QAAeC;QAAoBC;QAAyBC;KAA2B;IAExG,qBAAO,KAACE,mBAAmBC,QAAQ;QAACC,OAAOH;kBAAMN;;AACnD;AAEA,OAAO,MAAMO,mCAAqBb,cAA6CgB,WAAW;AAE1F,OAAO,SAASC;IACd,MAAML,MAAMX,WAAWY;IACvB,IAAID,QAAQI,WAAW;QACrB,MAAM,IAAIE,MAAM;IAClB;IACA,OAAON;AACT;AAEA,OAAO,SAASO;IACd,MAAMP,MAAMK;IACZ,OAAOL,IAAIL,WAAW;AACxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './AlignSelector';
|
|
2
|
-
export * from './BarChart';
|
|
3
2
|
export * from './ColorPicker';
|
|
4
3
|
export * from './ContentWithLegend';
|
|
5
4
|
export * from './controls';
|
|
@@ -12,21 +11,17 @@ export * from './ErrorAlert';
|
|
|
12
11
|
export * from './ErrorBoundary';
|
|
13
12
|
export * from './FontSizeSelector';
|
|
14
13
|
export * from './FormEditor';
|
|
15
|
-
export * from './GaugeChart';
|
|
16
14
|
export * from './InfoTooltip';
|
|
17
15
|
export * from './JSONEditor';
|
|
18
16
|
export * from './Legend';
|
|
19
|
-
export * from './LineChart';
|
|
20
17
|
export * from './LinksEditor';
|
|
21
18
|
export * from './ModeSelector';
|
|
22
19
|
export * from './OptionsEditorLayout';
|
|
23
20
|
export * from './Overlay';
|
|
24
21
|
export * from './SettingsAutocomplete';
|
|
25
22
|
export * from './SortSelector';
|
|
26
|
-
export * from './StatChart';
|
|
27
23
|
export * from './Table';
|
|
28
24
|
export * from './ThresholdsEditor';
|
|
29
|
-
export * from './TimeChart';
|
|
30
25
|
export * from './TimeRangeSelector';
|
|
31
26
|
export * from './TimeSeriesTooltip';
|
|
32
27
|
export * from './ToolbarIconButton';
|
|
@@ -39,7 +34,5 @@ export * from './test-utils';
|
|
|
39
34
|
export * from './theme';
|
|
40
35
|
export * from './TransformsEditor';
|
|
41
36
|
export * from './RefreshIntervalPicker';
|
|
42
|
-
export * from './PieChart';
|
|
43
|
-
export * from './StatusHistoryChart';
|
|
44
37
|
export * from './ValueMappingEditor';
|
|
45
38
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|