@perses-dev/components 0.55.0 → 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/package.json +12 -6
package/dist/YAxisLabel.js
CHANGED
|
@@ -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,31 +13,74 @@ 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, Typography } from "@mui/material";
|
|
15
|
-
export function YAxisLabel(
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export function YAxisLabel(t0) {
|
|
17
|
+
const $ = _c(10);
|
|
18
|
+
const { name, height } = t0;
|
|
19
|
+
const t1 = `calc(${height}px / 2)`;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== height || $[1] !== t1) {
|
|
22
|
+
t2 = {
|
|
18
23
|
maxWidth: height,
|
|
19
|
-
top:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
top: t1
|
|
25
|
+
};
|
|
26
|
+
$[0] = height;
|
|
27
|
+
$[1] = t1;
|
|
28
|
+
$[2] = t2;
|
|
29
|
+
} else {
|
|
30
|
+
t2 = $[2];
|
|
31
|
+
}
|
|
32
|
+
let t3;
|
|
33
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
34
|
+
t3 = {
|
|
35
|
+
display: "inline-block",
|
|
36
|
+
position: "absolute",
|
|
37
|
+
transform: "translateX(-50%) rotate(-90deg)",
|
|
38
|
+
transformOrigin: "top",
|
|
39
|
+
textAlign: "center",
|
|
27
40
|
zIndex: 1
|
|
28
|
-
}
|
|
29
|
-
|
|
41
|
+
};
|
|
42
|
+
$[3] = t3;
|
|
43
|
+
} else {
|
|
44
|
+
t3 = $[3];
|
|
45
|
+
}
|
|
46
|
+
let t4;
|
|
47
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
48
|
+
t4 = {
|
|
49
|
+
whiteSpace: "nowrap",
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
textOverflow: "ellipsis"
|
|
52
|
+
};
|
|
53
|
+
$[4] = t4;
|
|
54
|
+
} else {
|
|
55
|
+
t4 = $[4];
|
|
56
|
+
}
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[5] !== name) {
|
|
59
|
+
t5 = /*#__PURE__*/ _jsx(Typography, {
|
|
30
60
|
variant: "body1",
|
|
31
61
|
"aria-label": "y axis label",
|
|
32
|
-
sx:
|
|
33
|
-
whiteSpace: 'nowrap',
|
|
34
|
-
overflow: 'hidden',
|
|
35
|
-
textOverflow: 'ellipsis'
|
|
36
|
-
},
|
|
62
|
+
sx: t4,
|
|
37
63
|
children: name
|
|
38
|
-
})
|
|
39
|
-
|
|
64
|
+
});
|
|
65
|
+
$[5] = name;
|
|
66
|
+
$[6] = t5;
|
|
67
|
+
} else {
|
|
68
|
+
t5 = $[6];
|
|
69
|
+
}
|
|
70
|
+
let t6;
|
|
71
|
+
if ($[7] !== t2 || $[8] !== t5) {
|
|
72
|
+
t6 = /*#__PURE__*/ _jsx(Box, {
|
|
73
|
+
style: t2,
|
|
74
|
+
sx: t3,
|
|
75
|
+
children: t5
|
|
76
|
+
});
|
|
77
|
+
$[7] = t2;
|
|
78
|
+
$[8] = t5;
|
|
79
|
+
$[9] = t6;
|
|
80
|
+
} else {
|
|
81
|
+
t6 = $[9];
|
|
82
|
+
}
|
|
83
|
+
return t6;
|
|
40
84
|
}
|
|
41
85
|
|
|
42
86
|
//# sourceMappingURL=YAxisLabel.js.map
|
package/dist/YAxisLabel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/YAxisLabel.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, Typography } from '@mui/material';\nimport type { ReactElement } from 'react';\n\ninterface YAxisLabelProps {\n name: string;\n height: number;\n}\n\nexport function YAxisLabel({ name, height }: YAxisLabelProps): ReactElement {\n return (\n <Box\n style={{\n maxWidth: height, // allows rotated text to truncate instead of causing overlap\n top: `calc(${height}px / 2)`,\n }}\n sx={{\n display: 'inline-block',\n position: 'absolute',\n transform: 'translateX(-50%) rotate(-90deg)',\n transformOrigin: 'top',\n textAlign: 'center',\n zIndex: 1,\n }}\n >\n <Typography\n variant=\"body1\"\n aria-label=\"y axis label\"\n sx={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {name}\n </Typography>\n </Box>\n );\n}\n"],"names":["Box","Typography"
|
|
1
|
+
{"version":3,"sources":["../src/YAxisLabel.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, Typography } from '@mui/material';\nimport type { ReactElement } from 'react';\n\ninterface YAxisLabelProps {\n name: string;\n height: number;\n}\n\nexport function YAxisLabel({ name, height }: YAxisLabelProps): ReactElement {\n return (\n <Box\n style={{\n maxWidth: height, // allows rotated text to truncate instead of causing overlap\n top: `calc(${height}px / 2)`,\n }}\n sx={{\n display: 'inline-block',\n position: 'absolute',\n transform: 'translateX(-50%) rotate(-90deg)',\n transformOrigin: 'top',\n textAlign: 'center',\n zIndex: 1,\n }}\n >\n <Typography\n variant=\"body1\"\n aria-label=\"y axis label\"\n sx={{\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {name}\n </Typography>\n </Box>\n );\n}\n"],"names":["Box","Typography"],"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,UAAU,QAAQ,gBAAgB;AAQhD,OAAO"}
|
|
@@ -11,35 +11,51 @@
|
|
|
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
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
15
|
+
import React, { createContext, useContext, useState } from "react";
|
|
15
16
|
export function ChartsProvider(props) {
|
|
16
|
-
const
|
|
17
|
+
const $ = _c(8);
|
|
18
|
+
const { children, chartsTheme, enablePinning: t0, enableSyncGrouping: t1 } = props;
|
|
19
|
+
const enablePinning = t0 === undefined ? false : t0;
|
|
20
|
+
const enableSyncGrouping = t1 === undefined ? true : t1;
|
|
17
21
|
const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState(null);
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[0] !== chartsTheme || $[1] !== enablePinning || $[2] !== enableSyncGrouping || $[3] !== lastTooltipPinnedCoords) {
|
|
24
|
+
t2 = {
|
|
20
25
|
chartsTheme,
|
|
21
26
|
enablePinning,
|
|
22
27
|
lastTooltipPinnedCoords,
|
|
23
28
|
enableSyncGrouping,
|
|
24
29
|
setLastTooltipPinnedCoords
|
|
25
30
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
$[0] = chartsTheme;
|
|
32
|
+
$[1] = enablePinning;
|
|
33
|
+
$[2] = enableSyncGrouping;
|
|
34
|
+
$[3] = lastTooltipPinnedCoords;
|
|
35
|
+
$[4] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
t2 = $[4];
|
|
38
|
+
}
|
|
39
|
+
const ctx = t2;
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[5] !== children || $[6] !== ctx) {
|
|
42
|
+
t3 = /*#__PURE__*/ _jsx(ChartsThemeContext.Provider, {
|
|
43
|
+
value: ctx,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
$[5] = children;
|
|
47
|
+
$[6] = ctx;
|
|
48
|
+
$[7] = t3;
|
|
49
|
+
} else {
|
|
50
|
+
t3 = $[7];
|
|
51
|
+
}
|
|
52
|
+
return t3;
|
|
37
53
|
}
|
|
38
54
|
export const ChartsThemeContext = /*#__PURE__*/ createContext(undefined);
|
|
39
55
|
export function useChartsContext() {
|
|
40
56
|
const ctx = useContext(ChartsThemeContext);
|
|
41
57
|
if (ctx === undefined) {
|
|
42
|
-
throw new Error(
|
|
58
|
+
throw new Error("No ChartsThemeContext found. Did you forget a Provider?");
|
|
43
59
|
}
|
|
44
60
|
return ctx;
|
|
45
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/ChartsProvider.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 { ReactElement } from 'react';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nimport type { PersesChartsTheme } from '../model';\nimport type { 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","
|
|
1
|
+
{"version":3,"sources":["../../src/context/ChartsProvider.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 { ReactElement } from 'react';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nimport type { PersesChartsTheme } from '../model';\nimport type { 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","useState","ChartsThemeContext","undefined"],"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,OAAOA,SAASC,aAAa,EAAEC,UAAU,EAAWC,QAAQ,QAAQ,QAAQ;AAoB5E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBP,OAAO,MAAMC,mCAAqBH,cAA6CI,WAAW;AAE1F,OAAO;;;;;;;AAQP,OAAO"}
|
|
@@ -11,64 +11,101 @@
|
|
|
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 {
|
|
14
|
+
import { c as _c } from "react-compiler-runtime";
|
|
15
|
+
import { createContext, useContext, useState } from "react";
|
|
15
16
|
const ItemActionsContext = /*#__PURE__*/ createContext(undefined);
|
|
16
|
-
export function ItemActionsProvider(
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
export function ItemActionsProvider(t0) {
|
|
18
|
+
const $ = _c(8);
|
|
19
|
+
const { children } = t0;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
22
|
+
t1 = new Map();
|
|
23
|
+
$[0] = t1;
|
|
24
|
+
} else {
|
|
25
|
+
t1 = $[0];
|
|
26
|
+
}
|
|
27
|
+
const [actionStatuses, setActionStatuses] = useState(t1);
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t2 = (actionName, status, itemId)=>{
|
|
31
|
+
setActionStatuses((prev)=>{
|
|
32
|
+
const newMap = new Map(prev);
|
|
33
|
+
const existingStatus = newMap.get(actionName) || {
|
|
28
34
|
loading: false
|
|
29
35
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
if (itemId !== undefined) {
|
|
37
|
+
const itemStatuses = new Map(existingStatus.itemStatuses || new Map());
|
|
38
|
+
const existingItemStatus = itemStatuses.get(itemId) || {
|
|
39
|
+
loading: false
|
|
40
|
+
};
|
|
41
|
+
itemStatuses.set(itemId, {
|
|
42
|
+
...existingItemStatus,
|
|
43
|
+
...status
|
|
44
|
+
});
|
|
45
|
+
newMap.set(actionName, {
|
|
46
|
+
...existingStatus,
|
|
47
|
+
itemStatuses
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
newMap.set(actionName, {
|
|
51
|
+
...existingStatus,
|
|
52
|
+
...status
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return newMap;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
$[1] = t2;
|
|
59
|
+
} else {
|
|
60
|
+
t2 = $[1];
|
|
61
|
+
}
|
|
62
|
+
const setActionStatus = t2;
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
65
|
+
t3 = (actionName_0)=>{
|
|
66
|
+
setActionStatuses((prev_0)=>{
|
|
67
|
+
if (actionName_0 === undefined) {
|
|
68
|
+
return new Map();
|
|
69
|
+
}
|
|
70
|
+
if (!prev_0.has(actionName_0)) {
|
|
71
|
+
return prev_0;
|
|
72
|
+
}
|
|
73
|
+
const newMap_0 = new Map(prev_0);
|
|
74
|
+
newMap_0.delete(actionName_0);
|
|
75
|
+
return newMap_0;
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
$[2] = t3;
|
|
79
|
+
} else {
|
|
80
|
+
t3 = $[2];
|
|
81
|
+
}
|
|
82
|
+
const clearActionStatus = t3;
|
|
83
|
+
let t4;
|
|
84
|
+
if ($[3] !== actionStatuses) {
|
|
85
|
+
t4 = {
|
|
60
86
|
actionStatuses,
|
|
61
87
|
setActionStatus,
|
|
62
88
|
clearActionStatus
|
|
63
|
-
}
|
|
64
|
-
actionStatuses
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
};
|
|
90
|
+
$[3] = actionStatuses;
|
|
91
|
+
$[4] = t4;
|
|
92
|
+
} else {
|
|
93
|
+
t4 = $[4];
|
|
94
|
+
}
|
|
95
|
+
const ctx = t4;
|
|
96
|
+
let t5;
|
|
97
|
+
if ($[5] !== children || $[6] !== ctx) {
|
|
98
|
+
t5 = /*#__PURE__*/ _jsx(ItemActionsContext.Provider, {
|
|
99
|
+
value: ctx,
|
|
100
|
+
children: children
|
|
101
|
+
});
|
|
102
|
+
$[5] = children;
|
|
103
|
+
$[6] = ctx;
|
|
104
|
+
$[7] = t5;
|
|
105
|
+
} else {
|
|
106
|
+
t5 = $[7];
|
|
107
|
+
}
|
|
108
|
+
return t5;
|
|
72
109
|
}
|
|
73
110
|
const noOp = ()=>{};
|
|
74
111
|
const emptyActionStatuses = new Map();
|
|
@@ -79,16 +116,28 @@ const defaultState = {
|
|
|
79
116
|
hasContext: false
|
|
80
117
|
};
|
|
81
118
|
export function useItemActions() {
|
|
119
|
+
const $ = _c(2);
|
|
82
120
|
const ctx = useContext(ItemActionsContext);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
ctx
|
|
91
|
-
|
|
121
|
+
let t0;
|
|
122
|
+
bb0: {
|
|
123
|
+
if (!ctx) {
|
|
124
|
+
t0 = defaultState;
|
|
125
|
+
break bb0;
|
|
126
|
+
}
|
|
127
|
+
let t1;
|
|
128
|
+
if ($[0] !== ctx) {
|
|
129
|
+
t1 = {
|
|
130
|
+
...ctx,
|
|
131
|
+
hasContext: true
|
|
132
|
+
};
|
|
133
|
+
$[0] = ctx;
|
|
134
|
+
$[1] = t1;
|
|
135
|
+
} else {
|
|
136
|
+
t1 = $[1];
|
|
137
|
+
}
|
|
138
|
+
t0 = t1;
|
|
139
|
+
}
|
|
140
|
+
const memoizedResult = t0;
|
|
92
141
|
return memoizedResult;
|
|
93
142
|
}
|
|
94
143
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/ItemActionsProvider.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 { ReactElement, ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nexport interface ItemActionStatus {\n loading: boolean;\n error?: Error;\n success?: boolean;\n}\n\nexport interface ActionStatus {\n loading: boolean;\n error?: Error;\n success?: boolean;\n itemStatuses?: Map<unknown, ItemActionStatus>;\n}\n\nexport interface ActionState<Id = unknown> {\n actionStatuses: Map<string, ActionStatus>;\n setActionStatus: (actionName: string, status: Partial<ActionStatus>, itemId?: Id) => void;\n clearActionStatus: (actionName?: string) => void;\n}\n\nexport interface ItemActionsProviderProps {\n children: ReactNode;\n}\n\nconst ItemActionsContext = createContext<ActionState<unknown> | undefined>(undefined);\n\nexport function ItemActionsProvider({ children }: ItemActionsProviderProps): ReactElement {\n const [actionStatuses, setActionStatuses] = useState(new Map<string, ActionStatus>());\n\n const setActionStatus = useCallback((actionName: string, status: Partial<ActionStatus>, itemId?: unknown) => {\n setActionStatuses((prev) => {\n const newMap = new Map(prev);\n const existingStatus = newMap.get(actionName) || { loading: false };\n\n if (itemId !== undefined) {\n // Update item-level status for individual actions\n const itemStatuses = new Map(existingStatus.itemStatuses || new Map());\n const existingItemStatus = itemStatuses.get(itemId) || { loading: false };\n itemStatuses.set(itemId, { ...existingItemStatus, ...status } as ItemActionStatus);\n newMap.set(actionName, { ...existingStatus, itemStatuses });\n } else {\n // Update action-level status for batch actions\n newMap.set(actionName, { ...existingStatus, ...status });\n }\n\n return newMap;\n });\n }, []);\n\n const clearActionStatus = useCallback((actionName?: string) => {\n setActionStatuses((prev) => {\n if (actionName === undefined) {\n return new Map();\n }\n if (!prev.has(actionName)) return prev;\n const newMap = new Map(prev);\n newMap.delete(actionName);\n return newMap;\n });\n }, []);\n\n const ctx = useMemo<ActionState<unknown>>(\n () => ({\n actionStatuses,\n setActionStatus,\n clearActionStatus,\n }),\n [actionStatuses, setActionStatus, clearActionStatus],\n );\n\n return <ItemActionsContext.Provider value={ctx}>{children}</ItemActionsContext.Provider>;\n}\n\nconst noOp = (): void => {};\nconst emptyActionStatuses = new Map<string, ActionStatus>();\nconst defaultState: ActionState<unknown> & { hasContext: false } = {\n actionStatuses: emptyActionStatuses,\n setActionStatus: noOp,\n clearActionStatus: noOp,\n hasContext: false,\n};\n\nexport function useItemActions<Id = string | number>(): ActionState<Id> & { hasContext: boolean } {\n const ctx = useContext(ItemActionsContext);\n\n const memoizedResult = useMemo(() => {\n if (!ctx) return defaultState as ActionState<Id> & { hasContext: false };\n\n return { ...ctx, hasContext: true } as ActionState<Id> & { hasContext: true };\n }, [ctx]);\n\n return memoizedResult;\n}\n"],"names":["createContext","
|
|
1
|
+
{"version":3,"sources":["../../src/context/ItemActionsProvider.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 { ReactElement, ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nexport interface ItemActionStatus {\n loading: boolean;\n error?: Error;\n success?: boolean;\n}\n\nexport interface ActionStatus {\n loading: boolean;\n error?: Error;\n success?: boolean;\n itemStatuses?: Map<unknown, ItemActionStatus>;\n}\n\nexport interface ActionState<Id = unknown> {\n actionStatuses: Map<string, ActionStatus>;\n setActionStatus: (actionName: string, status: Partial<ActionStatus>, itemId?: Id) => void;\n clearActionStatus: (actionName?: string) => void;\n}\n\nexport interface ItemActionsProviderProps {\n children: ReactNode;\n}\n\nconst ItemActionsContext = createContext<ActionState<unknown> | undefined>(undefined);\n\nexport function ItemActionsProvider({ children }: ItemActionsProviderProps): ReactElement {\n const [actionStatuses, setActionStatuses] = useState(new Map<string, ActionStatus>());\n\n const setActionStatus = useCallback((actionName: string, status: Partial<ActionStatus>, itemId?: unknown) => {\n setActionStatuses((prev) => {\n const newMap = new Map(prev);\n const existingStatus = newMap.get(actionName) || { loading: false };\n\n if (itemId !== undefined) {\n // Update item-level status for individual actions\n const itemStatuses = new Map(existingStatus.itemStatuses || new Map());\n const existingItemStatus = itemStatuses.get(itemId) || { loading: false };\n itemStatuses.set(itemId, { ...existingItemStatus, ...status } as ItemActionStatus);\n newMap.set(actionName, { ...existingStatus, itemStatuses });\n } else {\n // Update action-level status for batch actions\n newMap.set(actionName, { ...existingStatus, ...status });\n }\n\n return newMap;\n });\n }, []);\n\n const clearActionStatus = useCallback((actionName?: string) => {\n setActionStatuses((prev) => {\n if (actionName === undefined) {\n return new Map();\n }\n if (!prev.has(actionName)) return prev;\n const newMap = new Map(prev);\n newMap.delete(actionName);\n return newMap;\n });\n }, []);\n\n const ctx = useMemo<ActionState<unknown>>(\n () => ({\n actionStatuses,\n setActionStatus,\n clearActionStatus,\n }),\n [actionStatuses, setActionStatus, clearActionStatus],\n );\n\n return <ItemActionsContext.Provider value={ctx}>{children}</ItemActionsContext.Provider>;\n}\n\nconst noOp = (): void => {};\nconst emptyActionStatuses = new Map<string, ActionStatus>();\nconst defaultState: ActionState<unknown> & { hasContext: false } = {\n actionStatuses: emptyActionStatuses,\n setActionStatus: noOp,\n clearActionStatus: noOp,\n hasContext: false,\n};\n\nexport function useItemActions<Id = string | number>(): ActionState<Id> & { hasContext: boolean } {\n const ctx = useContext(ItemActionsContext);\n\n const memoizedResult = useMemo(() => {\n if (!ctx) return defaultState as ActionState<Id> & { hasContext: false };\n\n return { ...ctx, hasContext: true } as ActionState<Id> & { hasContext: true };\n }, [ctx]);\n\n return memoizedResult;\n}\n"],"names":["createContext","useContext","useState","ItemActionsContext","undefined","noOp","emptyActionStatuses","Map","defaultState","actionStatuses","setActionStatus","clearActionStatus","hasContext"],"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,aAAa,EAAeC,UAAU,EAAWC,QAAQ,QAAQ,QAAQ;AAyBlF,MAAMC,mCAAqBH,cAAgDI;AAE3E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CP,MAAMC,OAAO,KAAa;AAC1B,MAAMC,sBAAsB,IAAIC;AAChC,MAAMC,eAA6D;IACjEC,gBAAgBH;IAChBI,iBAAiBL;IACjBM,mBAAmBN;IACnBO,YAAY;AACd;AAEA,OAAO"}
|