@perses-dev/components 0.49.0 → 0.50.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/dist/AlignSelector/AlignSelector.d.ts +2 -1
- package/dist/AlignSelector/AlignSelector.d.ts.map +1 -1
- package/dist/AlignSelector/AlignSelector.js +0 -3
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/BarChart/BarChart.d.ts +2 -1
- package/dist/BarChart/BarChart.d.ts.map +1 -1
- package/dist/BarChart/BarChart.js +10 -5
- package/dist/BarChart/BarChart.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.d.ts +2 -1
- package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/ColorPicker.js +3 -3
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts +2 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +2 -2
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -1
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +8 -5
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.d.ts +2 -1
- package/dist/DensitySelector/DensitySelector.d.ts.map +1 -1
- package/dist/DensitySelector/DensitySelector.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +8 -8
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +0 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +2 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.d.ts +24 -0
- package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -0
- package/dist/DragAndDrop/DragAndDropList.js +153 -0
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -0
- package/dist/DragAndDrop/DragButton.d.ts +13 -0
- package/dist/DragAndDrop/DragButton.d.ts.map +1 -0
- package/dist/DragAndDrop/DragButton.js +97 -0
- package/dist/DragAndDrop/DragButton.js.map +1 -0
- package/dist/DragAndDrop/DropIndicator.d.ts +3 -0
- package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -0
- package/dist/DragAndDrop/DropIndicator.js +44 -0
- package/dist/DragAndDrop/DropIndicator.js.map +1 -0
- package/dist/DragAndDrop/index.d.ts +4 -0
- package/dist/DragAndDrop/index.d.ts.map +1 -0
- package/dist/DragAndDrop/index.js +17 -0
- package/dist/DragAndDrop/index.js.map +1 -0
- package/dist/DragAndDrop/model.d.ts +11 -0
- package/dist/DragAndDrop/model.d.ts.map +1 -0
- package/dist/DragAndDrop/model.js +17 -0
- package/dist/DragAndDrop/model.js.map +1 -0
- package/dist/Drawer/Drawer.d.ts +2 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.d.ts +2 -2
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +2 -2
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.d.ts +2 -1
- package/dist/ErrorAlert.d.ts.map +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.d.ts +2 -1
- package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FormEditor/FormActions.d.ts +16 -0
- package/dist/FormEditor/FormActions.d.ts.map +1 -0
- package/dist/FormEditor/FormActions.js +75 -0
- package/dist/FormEditor/FormActions.js.map +1 -0
- package/dist/FormEditor/index.d.ts +2 -0
- package/dist/FormEditor/index.d.ts.map +1 -0
- package/dist/FormEditor/index.js +15 -0
- package/dist/FormEditor/index.js.map +1 -0
- package/dist/FormatControls/FormatControls.d.ts +2 -1
- package/dist/FormatControls/FormatControls.d.ts.map +1 -1
- package/dist/FormatControls/FormatControls.js +2 -2
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/GaugeChart/GaugeChart.d.ts +2 -1
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +1 -1
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.d.ts +3 -3
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +0 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/JSONEditor.d.ts +2 -1
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +2 -1
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +2 -1
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +8 -4
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.d.ts +2 -2
- package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
- package/dist/Legend/LegendColorBadge.js +2 -2
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +2 -1
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +5 -5
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +5 -8
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts +2 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +1 -0
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +1 -1
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +2 -3
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.d.ts +2 -2
- package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +1 -1
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.d.ts +2 -1
- package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.d.ts +4 -3
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/PieChart/PieChart.d.ts +2 -1
- package/dist/PieChart/PieChart.d.ts.map +1 -1
- package/dist/PieChart/PieChart.js +4 -2
- package/dist/PieChart/PieChart.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +2 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelector.d.ts +2 -1
- package/dist/SortSelector/SortSelector.d.ts.map +1 -1
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.d.ts +2 -1
- package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +2 -5
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +2 -1
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.d.ts.map +1 -1
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +14 -0
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -0
- package/dist/StatusHistoryChart/StatusHistoryChart.js +149 -0
- package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -0
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +12 -0
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -0
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js +47 -0
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -0
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts +2 -0
- package/dist/StatusHistoryChart/get-formatted-axis-label.d.ts.map +1 -0
- package/dist/StatusHistoryChart/get-formatted-axis-label.js +41 -0
- package/dist/StatusHistoryChart/get-formatted-axis-label.js.map +1 -0
- package/dist/StatusHistoryChart/index.d.ts +3 -0
- package/dist/StatusHistoryChart/index.d.ts.map +1 -0
- package/dist/StatusHistoryChart/index.js +16 -0
- package/dist/StatusHistoryChart/index.js.map +1 -0
- package/dist/StatusHistoryChart/utils/get-color.d.ts +6 -0
- package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -0
- package/dist/StatusHistoryChart/utils/get-color.js +100 -0
- package/dist/StatusHistoryChart/utils/get-color.js.map +1 -0
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts +3 -0
- package/dist/StatusHistoryChart/utils/get-tooltip-position.d.ts.map +1 -0
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js +27 -0
- package/dist/StatusHistoryChart/utils/get-tooltip-position.js.map +1 -0
- package/dist/Table/Table.d.ts +2 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -2
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableCell.d.ts +2 -2
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +19 -2
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.d.ts +2 -1
- package/dist/Table/TableCheckbox.d.ts.map +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +2 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +3 -3
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +4 -4
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.d.ts +2 -2
- package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +10 -12
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/index.d.ts +1 -2
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +7 -1
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +1 -0
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeChart/TimeChart.js +1 -1
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +0 -2
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +2 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeRangeSelector/utils.d.ts.map +1 -1
- package/dist/TimeRangeSelector/utils.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +2 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +2 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +2 -4
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +1 -21
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts +2 -1
- package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +10 -9
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts +2 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts +2 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/YAxisLabel.d.ts +2 -1
- package/dist/YAxisLabel.d.ts.map +1 -1
- package/dist/YAxisLabel.js +4 -2
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/AlignSelector/AlignSelector.js +0 -3
- package/dist/cjs/BarChart/BarChart.js +11 -6
- package/dist/cjs/ColorPicker/ColorPicker.js +3 -44
- package/dist/cjs/ColorPicker/OptionsColorPicker.js +2 -2
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +8 -10
- package/dist/cjs/Dialog/Dialog.js +0 -1
- package/dist/cjs/DragAndDrop/DragAndDropList.js +159 -0
- package/dist/cjs/DragAndDrop/DragButton.js +121 -0
- package/dist/cjs/DragAndDrop/DropIndicator.js +52 -0
- package/dist/cjs/DragAndDrop/index.js +32 -0
- package/dist/cjs/DragAndDrop/model.js +25 -0
- package/dist/cjs/EChart/EChart.js +2 -43
- package/dist/cjs/FormEditor/FormActions.js +83 -0
- package/dist/cjs/FormEditor/index.js +30 -0
- package/dist/cjs/FormatControls/FormatControls.js +2 -2
- package/dist/cjs/GaugeChart/GaugeChart.js +2 -2
- package/dist/cjs/InfoTooltip/InfoTooltip.js +0 -6
- package/dist/cjs/Legend/Legend.js +8 -4
- package/dist/cjs/Legend/LegendColorBadge.js +2 -7
- package/dist/cjs/Legend/ListLegendItem.js +3 -46
- package/dist/cjs/Legend/TableLegend.js +1 -0
- package/dist/cjs/LineChart/LineChart.js +4 -5
- package/dist/cjs/LinksEditor/LinksEditor.js +1 -42
- package/dist/cjs/PieChart/PieChart.js +4 -2
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +5 -3
- package/dist/cjs/SortSelector/SortSelectorButtons.js +2 -5
- package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +157 -0
- package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +55 -0
- package/dist/cjs/StatusHistoryChart/get-formatted-axis-label.js +48 -0
- package/dist/cjs/StatusHistoryChart/index.js +31 -0
- package/dist/cjs/StatusHistoryChart/utils/get-color.js +125 -0
- package/dist/cjs/StatusHistoryChart/utils/get-tooltip-position.js +35 -0
- package/dist/cjs/Table/Table.js +2 -1
- package/dist/cjs/Table/TableCell.js +19 -2
- package/dist/cjs/Table/VirtualizedTable.js +4 -4
- package/dist/cjs/Table/index.js +1 -7
- package/dist/cjs/Table/model/table-model.js +4 -0
- package/dist/cjs/TimeChart/TimeChart.js +1 -1
- package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +0 -2
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +2 -4
- package/dist/cjs/TransformsEditor/TransformEditor.js +10 -9
- package/dist/cjs/YAxisLabel.js +4 -2
- package/dist/cjs/controls/TextField.js +54 -0
- package/dist/cjs/controls/index.js +30 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/theme/theme.js +3 -4
- package/dist/cjs/utils/format.js +18 -0
- package/dist/context/ChartsProvider.d.ts +2 -2
- package/dist/context/ChartsProvider.d.ts.map +1 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.d.ts +4 -4
- package/dist/context/TimeZoneProvider.d.ts.map +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.d.ts +9 -0
- package/dist/controls/TextField.d.ts.map +1 -0
- package/dist/controls/TextField.js +41 -0
- package/dist/controls/TextField.js.map +1 -0
- package/dist/controls/index.d.ts +2 -0
- package/dist/controls/index.d.ts.map +1 -0
- package/dist/controls/index.js +15 -0
- package/dist/controls/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/test/render.d.ts +3 -3
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +2 -3
- package/dist/theme/theme.js.map +1 -1
- package/dist/utils/axis.d.ts +1 -7
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/component-ids.d.ts.map +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/format.d.ts +10 -4
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +15 -0
- package/dist/utils/format.js.map +1 -1
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/StatChart/calculateFontSize.ts"],"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 { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext() {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize) {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"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,SAASA,cAAc,QAAQ,4BAA4B;AAa3D,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,aAAa,CAAC,UAAUC,UAAU,CAAC;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,YAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG,SAAS;QACvBD;IAAjB,MAAME,WAAWF,CAAAA,UAAAA,OAAOC,sBAAAA,gCAAAA,UAAWC,QAAQ,eAA1BF,qBAAAA,UAA+B;QAC7BC;IAAnB,MAAME,aAAaF,CAAAA,wBAAAA,sBAAAA,gCAAAA,UAAWE,UAAU,cAArBF,mCAAAA,wBAAyB;IAE5C,qCAAqC;IACrC,MAAMG,YAAY,CAAC,EAAEb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,WAAW,CAAC;IAC7DN,IAAIQ,IAAI,GAAGD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,WAAW,CAACjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,KAAK,GAAIU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,GAAG,CAACH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,GAAG,CAACF,eAAef,WAAWe;AACtD"}
|
|
1
|
+
{"version":3,"sources":["../../src/StatChart/calculateFontSize.ts"],"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 { useChartsTheme } from '../context/ChartsProvider';\nimport { FontSizeOption } from '../FontSizeSelector';\n\ninterface CalculateFontSize {\n text: string;\n fontWeight: number;\n width: number;\n height: number;\n lineHeight: number;\n maxSize?: number;\n fontSizeOverride?: FontSizeOption;\n}\n\nlet canvasContext: CanvasRenderingContext2D | null;\n\nfunction getGlobalCanvasContext(): CanvasRenderingContext2D {\n if (!canvasContext) {\n canvasContext = document.createElement('canvas').getContext('2d');\n if (canvasContext === null) {\n throw new Error('Canvas context is null.');\n }\n }\n return canvasContext;\n}\n\n/**\n * Find the optimal font size given available space\n */\nexport function useOptimalFontSize({\n text,\n fontWeight,\n width,\n height,\n lineHeight,\n maxSize,\n fontSizeOverride,\n}: CalculateFontSize): number {\n const ctx = getGlobalCanvasContext();\n const { echartsTheme } = useChartsTheme();\n\n // if user has selected a font size in the settings, use it instead of calculating the optimal size\n if (fontSizeOverride !== undefined) {\n return Number(fontSizeOverride);\n }\n\n const textStyle = echartsTheme.textStyle;\n const fontSize = Number(textStyle?.fontSize) ?? 12;\n const fontFamily = textStyle?.fontFamily ?? 'Lato';\n\n // set the font on the canvas context\n const fontStyle = `${fontWeight} ${fontSize}px ${fontFamily}`;\n ctx.font = fontStyle;\n // measure the width of the text with the given font style\n const textMetrics: TextMetrics = ctx.measureText(text);\n\n // check how much bigger we can make the font while staying within the width and height\n const fontSizeBasedOnWidth = (width / textMetrics.width) * fontSize;\n const fontSizeBasedOnHeight = height / lineHeight;\n\n // return the smaller font size\n const finalFontSize = Math.min(fontSizeBasedOnHeight, fontSizeBasedOnWidth);\n return maxSize ? Math.min(finalFontSize, maxSize) : finalFontSize;\n}\n"],"names":["useChartsTheme","canvasContext","getGlobalCanvasContext","document","createElement","getContext","Error","useOptimalFontSize","text","fontWeight","width","height","lineHeight","maxSize","fontSizeOverride","ctx","echartsTheme","undefined","Number","textStyle","fontSize","fontFamily","fontStyle","font","textMetrics","measureText","fontSizeBasedOnWidth","fontSizeBasedOnHeight","finalFontSize","Math","min"],"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,SAASA,cAAc,QAAQ,4BAA4B;AAa3D,IAAIC;AAEJ,SAASC;IACP,IAAI,CAACD,eAAe;QAClBA,gBAAgBE,SAASC,aAAa,CAAC,UAAUC,UAAU,CAAC;QAC5D,IAAIJ,kBAAkB,MAAM;YAC1B,MAAM,IAAIK,MAAM;QAClB;IACF;IACA,OAAOL;AACT;AAEA;;CAEC,GACD,OAAO,SAASM,mBAAmB,EACjCC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EACE;IAClB,MAAMC,MAAMb;IACZ,MAAM,EAAEc,YAAY,EAAE,GAAGhB;IAEzB,mGAAmG;IACnG,IAAIc,qBAAqBG,WAAW;QAClC,OAAOC,OAAOJ;IAChB;IAEA,MAAMK,YAAYH,aAAaG,SAAS;QACvBD;IAAjB,MAAME,WAAWF,CAAAA,UAAAA,OAAOC,sBAAAA,gCAAAA,UAAWC,QAAQ,eAA1BF,qBAAAA,UAA+B;QAC7BC;IAAnB,MAAME,aAAaF,CAAAA,wBAAAA,sBAAAA,gCAAAA,UAAWE,UAAU,cAArBF,mCAAAA,wBAAyB;IAE5C,qCAAqC;IACrC,MAAMG,YAAY,CAAC,EAAEb,WAAW,CAAC,EAAEW,SAAS,GAAG,EAAEC,WAAW,CAAC;IAC7DN,IAAIQ,IAAI,GAAGD;IACX,0DAA0D;IAC1D,MAAME,cAA2BT,IAAIU,WAAW,CAACjB;IAEjD,uFAAuF;IACvF,MAAMkB,uBAAuB,AAAChB,QAAQc,YAAYd,KAAK,GAAIU;IAC3D,MAAMO,wBAAwBhB,SAASC;IAEvC,+BAA+B;IAC/B,MAAMgB,gBAAgBC,KAAKC,GAAG,CAACH,uBAAuBD;IACtD,OAAOb,UAAUgB,KAAKC,GAAG,CAACF,eAAef,WAAWe;AACtD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LegendComponentOption } from 'echarts/components';
|
|
2
|
+
import { TimeScale } from '@perses-dev/core';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
export type StatusHistoryData = [number, number, number | undefined];
|
|
5
|
+
export interface StatusHistoryChartProps {
|
|
6
|
+
height: number;
|
|
7
|
+
data: StatusHistoryData[];
|
|
8
|
+
xAxisCategories: number[];
|
|
9
|
+
yAxisCategories: string[];
|
|
10
|
+
legend?: LegendComponentOption;
|
|
11
|
+
timeScale?: TimeScale;
|
|
12
|
+
}
|
|
13
|
+
export declare function StatusHistoryChart(props: StatusHistoryChartProps): ReactElement;
|
|
14
|
+
//# sourceMappingURL=StatusHistoryChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusHistoryChart.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/StatusHistoryChart.tsx"],"names":[],"mappings":"AAeA,OAAO,EAML,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAiB9C,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAErE,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,YAAY,CA+G/E"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { Box, useTheme } from '@mui/material';
|
|
15
|
+
import { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';
|
|
16
|
+
import { GridComponent, DatasetComponent, TitleComponent, TooltipComponent, VisualMapComponent } from 'echarts/components';
|
|
17
|
+
import { use } from 'echarts/core';
|
|
18
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
19
|
+
import { useMemo } from 'react';
|
|
20
|
+
import { useChartsTheme, useTimeZone } from '../context';
|
|
21
|
+
import { EChart } from '../EChart';
|
|
22
|
+
import { getColorsForValues } from './utils/get-color';
|
|
23
|
+
import { getFormattedStatusHistoryAxisLabel } from './get-formatted-axis-label';
|
|
24
|
+
import { generateTooltipHTML } from './StatusHistoryTooltip';
|
|
25
|
+
use([
|
|
26
|
+
EChartsHeatmapChart,
|
|
27
|
+
VisualMapComponent,
|
|
28
|
+
GridComponent,
|
|
29
|
+
DatasetComponent,
|
|
30
|
+
TitleComponent,
|
|
31
|
+
TooltipComponent,
|
|
32
|
+
CanvasRenderer
|
|
33
|
+
]);
|
|
34
|
+
export function StatusHistoryChart(props) {
|
|
35
|
+
const { height, data, xAxisCategories, yAxisCategories, timeScale } = props;
|
|
36
|
+
const { timeZone } = useTimeZone();
|
|
37
|
+
const chartsTheme = useChartsTheme();
|
|
38
|
+
const theme = useTheme();
|
|
39
|
+
const uniqueValues = useMemo(()=>[
|
|
40
|
+
...new Set(data.map((item)=>item[2]))
|
|
41
|
+
].filter((value)=>value !== undefined), [
|
|
42
|
+
data
|
|
43
|
+
]);
|
|
44
|
+
// get colors from theme and generate colors if not provided
|
|
45
|
+
const pieces = useMemo(()=>{
|
|
46
|
+
const themeColors = Array.isArray(chartsTheme.echartsTheme.color) ? chartsTheme.echartsTheme.color.filter((color)=>typeof color === 'string') : [];
|
|
47
|
+
return uniqueValues.map((value, index)=>({
|
|
48
|
+
value,
|
|
49
|
+
color: getColorsForValues(uniqueValues, themeColors)[index]
|
|
50
|
+
}));
|
|
51
|
+
}, [
|
|
52
|
+
uniqueValues,
|
|
53
|
+
chartsTheme.echartsTheme.color
|
|
54
|
+
]);
|
|
55
|
+
var _timeScale_rangeMs;
|
|
56
|
+
const option = {
|
|
57
|
+
tooltip: {
|
|
58
|
+
appendToBody: true,
|
|
59
|
+
formatter: (params)=>{
|
|
60
|
+
return generateTooltipHTML({
|
|
61
|
+
data: params.data,
|
|
62
|
+
marker: params.marker,
|
|
63
|
+
xAxisCategories,
|
|
64
|
+
yAxisCategories,
|
|
65
|
+
theme
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
grid: {
|
|
70
|
+
top: '5%',
|
|
71
|
+
bottom: '5%'
|
|
72
|
+
},
|
|
73
|
+
xAxis: {
|
|
74
|
+
type: 'category',
|
|
75
|
+
data: xAxisCategories,
|
|
76
|
+
axisLine: {
|
|
77
|
+
show: false
|
|
78
|
+
},
|
|
79
|
+
splitArea: {
|
|
80
|
+
show: false
|
|
81
|
+
},
|
|
82
|
+
axisLabel: {
|
|
83
|
+
hideOverlap: true,
|
|
84
|
+
formatter: getFormattedStatusHistoryAxisLabel((_timeScale_rangeMs = timeScale === null || timeScale === void 0 ? void 0 : timeScale.rangeMs) !== null && _timeScale_rangeMs !== void 0 ? _timeScale_rangeMs : 0, timeZone)
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
yAxis: {
|
|
88
|
+
type: 'category',
|
|
89
|
+
data: yAxisCategories,
|
|
90
|
+
axisLine: {
|
|
91
|
+
show: false
|
|
92
|
+
},
|
|
93
|
+
splitArea: {
|
|
94
|
+
show: false,
|
|
95
|
+
interval: 0
|
|
96
|
+
},
|
|
97
|
+
splitLine: {
|
|
98
|
+
show: false
|
|
99
|
+
},
|
|
100
|
+
axisLabel: {
|
|
101
|
+
interval: 0
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
visualMap: {
|
|
105
|
+
show: false,
|
|
106
|
+
type: 'piecewise',
|
|
107
|
+
pieces
|
|
108
|
+
},
|
|
109
|
+
series: [
|
|
110
|
+
{
|
|
111
|
+
name: 'Status history',
|
|
112
|
+
type: 'heatmap',
|
|
113
|
+
coordinateSystem: 'cartesian2d',
|
|
114
|
+
data: data,
|
|
115
|
+
label: {
|
|
116
|
+
show: false
|
|
117
|
+
},
|
|
118
|
+
itemStyle: {
|
|
119
|
+
borderWidth: 1,
|
|
120
|
+
borderType: 'solid',
|
|
121
|
+
borderColor: '#ffffff'
|
|
122
|
+
},
|
|
123
|
+
emphasis: {
|
|
124
|
+
itemStyle: {
|
|
125
|
+
opacity: 0.5
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
return /*#__PURE__*/ _jsx(Box, {
|
|
132
|
+
style: {
|
|
133
|
+
height: height
|
|
134
|
+
},
|
|
135
|
+
sx: {
|
|
136
|
+
overflow: 'auto'
|
|
137
|
+
},
|
|
138
|
+
children: /*#__PURE__*/ _jsx(EChart, {
|
|
139
|
+
sx: {
|
|
140
|
+
width: '100%',
|
|
141
|
+
height: height
|
|
142
|
+
},
|
|
143
|
+
option: option,
|
|
144
|
+
theme: chartsTheme.echartsTheme
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//# sourceMappingURL=StatusHistoryChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StatusHistoryChart/StatusHistoryChart.tsx"],"sourcesContent":["// Copyright 2024 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, useTheme } from '@mui/material';\nimport { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';\nimport {\n GridComponent,\n DatasetComponent,\n TitleComponent,\n TooltipComponent,\n VisualMapComponent,\n LegendComponentOption,\n} from 'echarts/components';\nimport { EChartsCoreOption, use } from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { TimeScale } from '@perses-dev/core';\nimport { ReactElement, useMemo } from 'react';\nimport { useChartsTheme, useTimeZone } from '../context';\nimport { EChart } from '../EChart';\nimport { getColorsForValues } from './utils/get-color';\nimport { getFormattedStatusHistoryAxisLabel } from './get-formatted-axis-label';\nimport { generateTooltipHTML } from './StatusHistoryTooltip';\n\nuse([\n EChartsHeatmapChart,\n VisualMapComponent,\n GridComponent,\n DatasetComponent,\n TitleComponent,\n TooltipComponent,\n CanvasRenderer,\n]);\n\nexport type StatusHistoryData = [number, number, number | undefined];\n\nexport interface StatusHistoryChartProps {\n height: number;\n data: StatusHistoryData[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n legend?: LegendComponentOption;\n timeScale?: TimeScale;\n}\n\nexport function StatusHistoryChart(props: StatusHistoryChartProps): ReactElement {\n const { height, data, xAxisCategories, yAxisCategories, timeScale } = props;\n const { timeZone } = useTimeZone();\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n\n const uniqueValues = useMemo(\n () => [...new Set(data.map((item) => item[2]))].filter((value): value is number => value !== undefined),\n [data]\n );\n\n // get colors from theme and generate colors if not provided\n const pieces = useMemo(() => {\n const themeColors = Array.isArray(chartsTheme.echartsTheme.color)\n ? chartsTheme.echartsTheme.color.filter((color): color is string => typeof color === 'string')\n : [];\n\n return uniqueValues.map((value, index) => ({\n value,\n color: getColorsForValues(uniqueValues, themeColors)[index],\n }));\n }, [uniqueValues, chartsTheme.echartsTheme.color]);\n\n const option: EChartsCoreOption = {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: StatusHistoryData; marker: string }) => {\n return generateTooltipHTML({\n data: params.data,\n marker: params.marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n });\n },\n },\n grid: {\n top: '5%',\n bottom: '5%',\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLine: {\n show: false,\n },\n splitArea: {\n show: false,\n },\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedStatusHistoryAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: {\n type: 'category',\n data: yAxisCategories,\n axisLine: {\n show: false,\n },\n splitArea: {\n show: false,\n interval: 0,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n interval: 0,\n },\n },\n visualMap: {\n show: false,\n type: 'piecewise',\n pieces,\n },\n series: [\n {\n name: 'Status history',\n type: 'heatmap',\n coordinateSystem: 'cartesian2d',\n data: data,\n label: {\n show: false,\n },\n itemStyle: {\n borderWidth: 1,\n borderType: 'solid',\n borderColor: '#ffffff',\n },\n emphasis: {\n itemStyle: {\n opacity: 0.5,\n },\n },\n },\n ],\n };\n\n return (\n <Box style={{ height: height }} sx={{ overflow: 'auto' }}>\n <EChart\n sx={{\n width: '100%',\n height: height,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n </Box>\n );\n}\n"],"names":["Box","useTheme","HeatmapChart","EChartsHeatmapChart","GridComponent","DatasetComponent","TitleComponent","TooltipComponent","VisualMapComponent","use","CanvasRenderer","useMemo","useChartsTheme","useTimeZone","EChart","getColorsForValues","getFormattedStatusHistoryAxisLabel","generateTooltipHTML","StatusHistoryChart","props","height","data","xAxisCategories","yAxisCategories","timeScale","timeZone","chartsTheme","theme","uniqueValues","Set","map","item","filter","value","undefined","pieces","themeColors","Array","isArray","echartsTheme","color","index","option","tooltip","appendToBody","formatter","params","marker","grid","top","bottom","xAxis","type","axisLine","show","splitArea","axisLabel","hideOverlap","rangeMs","yAxis","interval","splitLine","visualMap","series","name","coordinateSystem","label","itemStyle","borderWidth","borderType","borderColor","emphasis","opacity","style","sx","overflow","width"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { StatusHistoryData } from './StatusHistoryChart';
|
|
3
|
+
interface CustomTooltipProps {
|
|
4
|
+
data: StatusHistoryData;
|
|
5
|
+
marker: string;
|
|
6
|
+
xAxisCategories: number[];
|
|
7
|
+
yAxisCategories: string[];
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}
|
|
10
|
+
export declare function generateTooltipHTML({ data, marker, xAxisCategories, yAxisCategories, theme, }: CustomTooltipProps): string;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=StatusHistoryTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusHistoryTooltip.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/StatusHistoryTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,UAAU,kBAAkB;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;CACd;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,MAAM,EACN,eAAe,EACf,eAAe,EACf,KAAK,GACN,EAAE,kBAAkB,GAAG,MAAM,CAmC7B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { css } from '@mui/material';
|
|
14
|
+
import { getDateAndTime } from '../utils';
|
|
15
|
+
export function generateTooltipHTML({ data, marker, xAxisCategories, yAxisCategories, theme }) {
|
|
16
|
+
const [x, y, value] = data;
|
|
17
|
+
const xAxisLabel = xAxisCategories[x];
|
|
18
|
+
const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);
|
|
19
|
+
const tooltipHeader = css`
|
|
20
|
+
border-bottom: 1px solid ${theme.palette.grey[500]};
|
|
21
|
+
padding-bottom: 8px;
|
|
22
|
+
`;
|
|
23
|
+
const tooltipContentStyles = css`
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
padding-top: 8px;
|
|
27
|
+
`;
|
|
28
|
+
const labelStyles = css`
|
|
29
|
+
margin-right: 16px;
|
|
30
|
+
`;
|
|
31
|
+
return `
|
|
32
|
+
<div>
|
|
33
|
+
<div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
|
|
34
|
+
<div style="${tooltipContentStyles.styles}">
|
|
35
|
+
<div style="${labelStyles.styles}">
|
|
36
|
+
${marker}
|
|
37
|
+
<strong>${yAxisCategories[y]}</strong>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
${value}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=StatusHistoryTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StatusHistoryChart/StatusHistoryTooltip.ts"],"sourcesContent":["// Copyright 2024 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 { css, Theme } from '@mui/material';\nimport { getDateAndTime } from '../utils';\nimport { StatusHistoryData } from './StatusHistoryChart';\n\ninterface CustomTooltipProps {\n data: StatusHistoryData;\n marker: string;\n xAxisCategories: number[];\n yAxisCategories: string[];\n theme: Theme;\n}\n\nexport function generateTooltipHTML({\n data,\n marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n}: CustomTooltipProps): string {\n const [x, y, value] = data;\n const xAxisLabel = xAxisCategories[x];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${yAxisCategories[y]}</strong>\n </div>\n <div>\n ${value}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","getDateAndTime","generateTooltipHTML","data","marker","xAxisCategories","yAxisCategories","theme","x","y","value","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","styles"],"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,SAASA,GAAG,QAAe,gBAAgB;AAC3C,SAASC,cAAc,QAAQ,WAAW;AAW1C,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,MAAM,EACNC,eAAe,EACfC,eAAe,EACfC,KAAK,EACc;IACnB,MAAM,CAACC,GAAGC,GAAGC,MAAM,GAAGP;IACtB,MAAMQ,aAAaN,eAAe,CAACG,EAAE;IAErC,MAAM,EAAEI,aAAa,EAAEC,aAAa,EAAE,GAAGZ,eAAeU;IAExD,MAAMG,gBAAgBd,GAAG,CAAC;6BACC,EAAEO,MAAMQ,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBjB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMkB,cAAclB,GAAG,CAAC;;EAExB,CAAC;IAED,OAAO,CAAC;;kBAEQ,EAAEc,cAAcK,MAAM,CAAC,EAAE,EAAEP,cAAc,CAAC,EAAEC,cAAc;kBAC1D,EAAEI,qBAAqBE,MAAM,CAAC;oBAC5B,EAAED,YAAYC,MAAM,CAAC;UAC/B,EAAEf,OAAO;kBACD,EAAEE,eAAe,CAACG,EAAE,CAAC;;;UAG7B,EAAEC,MAAM;;;;EAIhB,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-formatted-axis-label.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/get-formatted-axis-label.ts"],"names":[],"mappings":"AAgBA,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAC1D,MAAM,KAAG,MAAM,CA6BxC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
import { formatWithTimeZone } from '../utils';
|
|
14
|
+
// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter
|
|
15
|
+
export function getFormattedStatusHistoryAxisLabel(rangeMs, timezone) {
|
|
16
|
+
return function(value) {
|
|
17
|
+
const dayMs = 86400000;
|
|
18
|
+
const monthMs = 2629440000;
|
|
19
|
+
const yearMs = 31536000000;
|
|
20
|
+
const timeStamp = new Date(Number(value));
|
|
21
|
+
// more than 5 years
|
|
22
|
+
if (rangeMs > yearMs * 5) {
|
|
23
|
+
return formatWithTimeZone(timeStamp, 'yyy', timezone);
|
|
24
|
+
}
|
|
25
|
+
// more than 2 years
|
|
26
|
+
if (rangeMs > yearMs * 2) {
|
|
27
|
+
return formatWithTimeZone(timeStamp, 'MMM yyy', timezone);
|
|
28
|
+
}
|
|
29
|
+
// between 5 days to 6 months
|
|
30
|
+
if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
|
|
31
|
+
return formatWithTimeZone(timeStamp, 'dd.MM', timezone); // 12-01
|
|
32
|
+
}
|
|
33
|
+
// between 2 and 10 days
|
|
34
|
+
if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
|
|
35
|
+
return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
|
|
36
|
+
}
|
|
37
|
+
return formatWithTimeZone(timeStamp, 'HH:mm', timezone);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=get-formatted-axis-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StatusHistoryChart/get-formatted-axis-label.ts"],"sourcesContent":["// Copyright 2024 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 { formatWithTimeZone } from '../utils';\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedStatusHistoryAxisLabel(rangeMs: number, timezone: string) {\n return function (value: number): string {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n const timeStamp = new Date(Number(value));\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return formatWithTimeZone(timeStamp, 'yyy', timezone);\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return formatWithTimeZone(timeStamp, 'MMM yyy', timezone);\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {\n return formatWithTimeZone(timeStamp, 'dd.MM', timezone); // 12-01\n }\n\n // between 2 and 10 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {\n return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30\n }\n\n return formatWithTimeZone(timeStamp, 'HH:mm', timezone);\n };\n}\n"],"names":["formatWithTimeZone","getFormattedStatusHistoryAxisLabel","rangeMs","timezone","value","dayMs","monthMs","yearMs","timeStamp","Date","Number"],"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,SAASA,kBAAkB,QAAQ,WAAW;AAE9C,sEAAsE;AACtE,OAAO,SAASC,mCAAmCC,OAAe,EAAEC,QAAgB;IAClF,OAAO,SAAUC,KAAa;QAC5B,MAAMC,QAAQ;QACd,MAAMC,UAAU;QAChB,MAAMC,SAAS;QAEf,MAAMC,YAAY,IAAIC,KAAKC,OAAON;QAElC,oBAAoB;QACpB,IAAIF,UAAUK,SAAS,GAAG;YACxB,OAAOP,mBAAmBQ,WAAW,OAAOL;QAC9C;QAEA,oBAAoB;QACpB,IAAID,UAAUK,SAAS,GAAG;YACxB,OAAOP,mBAAmBQ,WAAW,WAAWL;QAClD;QAEA,6BAA6B;QAC7B,IAAID,UAAUG,QAAQ,MAAMH,UAAUI,UAAU,GAAG;YACjD,OAAON,mBAAmBQ,WAAW,SAASL,WAAW,QAAQ;QACnE;QAEA,wBAAwB;QACxB,IAAID,UAAUG,QAAQ,KAAKH,WAAWG,QAAQ,IAAI;YAChD,OAAOL,mBAAmBQ,WAAW,eAAeL,WAAW,wBAAwB;QACzF;QAEA,OAAOH,mBAAmBQ,WAAW,SAASL;IAChD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/StatusHistoryChart/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export * from './StatusHistoryChart';
|
|
14
|
+
export * from './utils/get-color';
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/StatusHistoryChart/index.ts"],"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\nexport * from './StatusHistoryChart';\nexport * from './utils/get-color';\n"],"names":[],"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,cAAc,uBAAuB;AACrC,cAAc,oBAAoB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const fallbackColor = "#1f77b4";
|
|
2
|
+
export declare function getColorForValue(value: number | string, baseColor: string): string;
|
|
3
|
+
export declare function getColorsForValues(uniqueValues: Array<number | string>, themeColors: string[]): string[];
|
|
4
|
+
export declare function hexToHSL(hex: string): [number, number, number];
|
|
5
|
+
export declare function hslToHex(h: number, s: number, l: number): string;
|
|
6
|
+
//# sourceMappingURL=get-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-color.d.ts","sourceRoot":"","sources":["../../../src/StatusHistoryChart/utils/get-color.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA2ClF;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAaxG;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CA8B9D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAWhE"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export const fallbackColor = '#1f77b4';
|
|
14
|
+
export function getColorForValue(value, baseColor) {
|
|
15
|
+
// Validate base color
|
|
16
|
+
if (!baseColor.match(/^#[0-9A-Fa-f]{6}$/)) {
|
|
17
|
+
baseColor = fallbackColor;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const [baseH, baseS, baseL] = hexToHSL(baseColor);
|
|
21
|
+
// Ensure numeric values are valid
|
|
22
|
+
if (isNaN(baseH) || isNaN(baseS) || isNaN(baseL)) {
|
|
23
|
+
throw new Error('Invalid HSL values');
|
|
24
|
+
}
|
|
25
|
+
// Create deterministic hash
|
|
26
|
+
const hash = String(value).split('').reduce((acc, char)=>acc + char.charCodeAt(0), 0);
|
|
27
|
+
const hueStep = 60;
|
|
28
|
+
const lightnessVariation = 15;
|
|
29
|
+
const hueOffset = hash % 6 * hueStep; // 6 segments of 60° each
|
|
30
|
+
const newH = (baseH + hueOffset) % 360;
|
|
31
|
+
const newL = baseL + (hash % 2 ? lightnessVariation : -lightnessVariation);
|
|
32
|
+
// Keep saturation high for better distinction
|
|
33
|
+
const newS = Math.min(baseS + 10, 90);
|
|
34
|
+
const color = hslToHex(Math.abs(newH), Math.min(Math.max(newS, 50), 90), Math.min(Math.max(newL, 30), 70) // Keep lightness 30-70%
|
|
35
|
+
);
|
|
36
|
+
// Validate generated color
|
|
37
|
+
if (!color.match(/^#[0-9A-Fa-f]{6}$/)) {
|
|
38
|
+
throw new Error('Invalid generated color');
|
|
39
|
+
}
|
|
40
|
+
return color;
|
|
41
|
+
} catch (_) {
|
|
42
|
+
return fallbackColor;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function getColorsForValues(uniqueValues, themeColors) {
|
|
46
|
+
// If we have enough theme colors, use them
|
|
47
|
+
if (themeColors.length >= uniqueValues.length) {
|
|
48
|
+
return themeColors.slice(0, uniqueValues.length);
|
|
49
|
+
}
|
|
50
|
+
// Use theme colors first, then generate additional ones
|
|
51
|
+
return uniqueValues.map((value, index)=>{
|
|
52
|
+
if (index < themeColors.length) {
|
|
53
|
+
return themeColors[index] || fallbackColor;
|
|
54
|
+
}
|
|
55
|
+
return getColorForValue(value, themeColors[0] || fallbackColor);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function hexToHSL(hex) {
|
|
59
|
+
const r = parseInt(hex.slice(1, 3), 16) / 255;
|
|
60
|
+
const g = parseInt(hex.slice(3, 5), 16) / 255;
|
|
61
|
+
const b = parseInt(hex.slice(5, 7), 16) / 255;
|
|
62
|
+
const max = Math.max(r, g, b);
|
|
63
|
+
const min = Math.min(r, g, b);
|
|
64
|
+
let h = 0;
|
|
65
|
+
let s = 0;
|
|
66
|
+
const l = (max + min) / 2;
|
|
67
|
+
if (max !== min) {
|
|
68
|
+
const d = max - min;
|
|
69
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
70
|
+
switch(max){
|
|
71
|
+
case r:
|
|
72
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
73
|
+
break;
|
|
74
|
+
case g:
|
|
75
|
+
h = (b - r) / d + 2;
|
|
76
|
+
break;
|
|
77
|
+
case b:
|
|
78
|
+
h = (r - g) / d + 4;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
h /= 6;
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
h * 360,
|
|
85
|
+
s * 100,
|
|
86
|
+
l * 100
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
export function hslToHex(h, s, l) {
|
|
90
|
+
l /= 100;
|
|
91
|
+
const a = s * Math.min(l, 1 - l) / 100;
|
|
92
|
+
const f = (n)=>{
|
|
93
|
+
const k = (n + h / 30) % 12;
|
|
94
|
+
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
95
|
+
return Math.round(255 * color).toString(16).padStart(2, '0');
|
|
96
|
+
};
|
|
97
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=get-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/StatusHistoryChart/utils/get-color.ts"],"sourcesContent":["// Copyright 2024 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\nexport const fallbackColor = '#1f77b4';\n\nexport function getColorForValue(value: number | string, baseColor: string): string {\n // Validate base color\n if (!baseColor.match(/^#[0-9A-Fa-f]{6}$/)) {\n baseColor = fallbackColor;\n }\n\n try {\n const [baseH, baseS, baseL] = hexToHSL(baseColor);\n\n // Ensure numeric values are valid\n if (isNaN(baseH) || isNaN(baseS) || isNaN(baseL)) {\n throw new Error('Invalid HSL values');\n }\n\n // Create deterministic hash\n const hash = String(value)\n .split('')\n .reduce((acc, char) => acc + char.charCodeAt(0), 0);\n\n const hueStep = 60;\n const lightnessVariation = 15;\n\n const hueOffset = (hash % 6) * hueStep; // 6 segments of 60° each\n const newH = (baseH + hueOffset) % 360;\n const newL = baseL + (hash % 2 ? lightnessVariation : -lightnessVariation);\n\n // Keep saturation high for better distinction\n const newS = Math.min(baseS + 10, 90);\n const color = hslToHex(\n Math.abs(newH),\n Math.min(Math.max(newS, 50), 90), // Keep saturation 50-90%\n Math.min(Math.max(newL, 30), 70) // Keep lightness 30-70%\n );\n\n // Validate generated color\n if (!color.match(/^#[0-9A-Fa-f]{6}$/)) {\n throw new Error('Invalid generated color');\n }\n\n return color;\n } catch (_) {\n return fallbackColor;\n }\n}\n\nexport function getColorsForValues(uniqueValues: Array<number | string>, themeColors: string[]): string[] {\n // If we have enough theme colors, use them\n if (themeColors.length >= uniqueValues.length) {\n return themeColors.slice(0, uniqueValues.length);\n }\n\n // Use theme colors first, then generate additional ones\n return uniqueValues.map((value, index) => {\n if (index < themeColors.length) {\n return themeColors[index] || fallbackColor;\n }\n return getColorForValue(value, themeColors[0] || fallbackColor);\n });\n}\n\nexport function hexToHSL(hex: string): [number, number, number] {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const l = (max + min) / 2;\n\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n\n return [h * 360, s * 100, l * 100];\n}\n\nexport function hslToHex(h: number, s: number, l: number): string {\n l /= 100;\n const a = (s * Math.min(l, 1 - l)) / 100;\n const f = (n: number): string => {\n const k = (n + h / 30) % 12;\n const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return Math.round(255 * color)\n .toString(16)\n .padStart(2, '0');\n };\n return `#${f(0)}${f(8)}${f(4)}`;\n}\n"],"names":["fallbackColor","getColorForValue","value","baseColor","match","baseH","baseS","baseL","hexToHSL","isNaN","Error","hash","String","split","reduce","acc","char","charCodeAt","hueStep","lightnessVariation","hueOffset","newH","newL","newS","Math","min","color","hslToHex","abs","max","_","getColorsForValues","uniqueValues","themeColors","length","slice","map","index","hex","r","parseInt","g","b","h","s","l","d","a","f","n","k","round","toString","padStart"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tooltip-position.d.ts","sourceRoot":"","sources":["../../../src/StatusHistoryChart/utils/get-tooltip-position.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,kBAAkB,EAAE,sBAAsB,CAAC,UAAU,CAYjE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export const getTooltipPosition = (...data)=>{
|
|
14
|
+
const point = data[0];
|
|
15
|
+
const size = data[4];
|
|
16
|
+
// calculate the position to avoid overflow
|
|
17
|
+
const [x, y] = point;
|
|
18
|
+
const { contentSize, viewSize } = size;
|
|
19
|
+
const posX = x + contentSize[0] > viewSize[0] ? x - contentSize[0] : x;
|
|
20
|
+
const posY = y + contentSize[1] > viewSize[1] ? y - contentSize[1] : y;
|
|
21
|
+
return [
|
|
22
|
+
posX,
|
|
23
|
+
posY
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=get-tooltip-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/StatusHistoryChart/utils/get-tooltip-position.ts"],"sourcesContent":["// Copyright 2024 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 { TooltipComponentOption } from 'echarts';\n\nexport const getTooltipPosition: TooltipComponentOption['position'] = (...data) => {\n const point = data[0];\n const size = data[4];\n\n // calculate the position to avoid overflow\n const [x, y] = point;\n const { contentSize, viewSize } = size;\n\n const posX = x + contentSize[0] > viewSize[0] ? x - contentSize[0] : x;\n const posY = y + contentSize[1] > viewSize[1] ? y - contentSize[1] : y;\n\n return [posX, posY];\n};\n"],"names":["getTooltipPosition","data","point","size","x","y","contentSize","viewSize","posX","posY"],"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;AAIjC,OAAO,MAAMA,qBAAyD,CAAC,GAAGC;IACxE,MAAMC,QAAQD,IAAI,CAAC,EAAE;IACrB,MAAME,OAAOF,IAAI,CAAC,EAAE;IAEpB,2CAA2C;IAC3C,MAAM,CAACG,GAAGC,EAAE,GAAGH;IACf,MAAM,EAAEI,WAAW,EAAEC,QAAQ,EAAE,GAAGJ;IAElC,MAAMK,OAAOJ,IAAIE,WAAW,CAAC,EAAE,GAAGC,QAAQ,CAAC,EAAE,GAAGH,IAAIE,WAAW,CAAC,EAAE,GAAGF;IACrE,MAAMK,OAAOJ,IAAIC,WAAW,CAAC,EAAE,GAAGC,QAAQ,CAAC,EAAE,GAAGF,IAAIC,WAAW,CAAC,EAAE,GAAGD;IAErE,OAAO;QAACG;QAAMC;KAAK;AACrB,EAAE"}
|
package/dist/Table/Table.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
1
2
|
import { TableProps } from './model/table-model';
|
|
2
3
|
/**
|
|
3
4
|
* Component used to render tabular data in Perses use cases. This component is
|
|
@@ -5,5 +6,5 @@ import { TableProps } from './model/table-model';
|
|
|
5
6
|
*
|
|
6
7
|
* **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
|
|
7
8
|
*/
|
|
8
|
-
export declare function Table<TableData>({ data, columns, cellConfigs, density, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, rowSelectionVariant, ...otherProps }: TableProps<TableData>):
|
|
9
|
+
export declare function Table<TableData>({ data, columns, cellConfigs, density, defaultColumnWidth, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId, rowSelection, sorting, rowSelectionVariant, ...otherProps }: TableProps<TableData>): ReactElement;
|
|
9
10
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table/Table.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,YAAY,EAAwB,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAwD,MAAM,qBAAqB,CAAC;AAYvG;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,EAC/B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,OAAoB,EACpB,kBAAyC,EACzC,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,QAA6B,EAC7B,YAAoC,EACpC,OAAyB,EACzB,mBAAgC,EAChC,GAAG,UAAU,EACd,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,YAAY,CAiItC"}
|
package/dist/Table/Table.js
CHANGED
|
@@ -16,7 +16,7 @@ import { useTheme } from '@mui/material';
|
|
|
16
16
|
import { useCallback, useMemo } from 'react';
|
|
17
17
|
import { VirtualizedTable } from './VirtualizedTable';
|
|
18
18
|
import { TableCheckbox } from './TableCheckbox';
|
|
19
|
-
import { persesColumnsToTanstackColumns } from './model/table-model';
|
|
19
|
+
import { persesColumnsToTanstackColumns, DEFAULT_COLUMN_WIDTH } from './model/table-model';
|
|
20
20
|
const DEFAULT_GET_ROW_ID = (data, index)=>{
|
|
21
21
|
return `${index}`;
|
|
22
22
|
};
|
|
@@ -30,7 +30,7 @@ const DEFAULT_SORTING = [];
|
|
|
30
30
|
* **not** intended to be a general use data table for use cases unrelated to Perses.
|
|
31
31
|
*
|
|
32
32
|
* **Note: This component is currently experimental and is likely to have significant breaking changes in the near future. Use with caution outside of the core Perses codebase.**
|
|
33
|
-
*/ export function Table({ data, columns, cellConfigs, density = 'standard', checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId = DEFAULT_GET_ROW_ID, rowSelection = DEFAULT_ROW_SELECTION, sorting = DEFAULT_SORTING, rowSelectionVariant = 'standard', ...otherProps }) {
|
|
33
|
+
*/ export function Table({ data, columns, cellConfigs, density = 'standard', defaultColumnWidth = DEFAULT_COLUMN_WIDTH, checkboxSelection, onRowSelectionChange, onSortingChange, getCheckboxColor, getRowId = DEFAULT_GET_ROW_ID, rowSelection = DEFAULT_ROW_SELECTION, sorting = DEFAULT_SORTING, rowSelectionVariant = 'standard', ...otherProps }) {
|
|
34
34
|
const theme = useTheme();
|
|
35
35
|
const handleRowSelectionChange = (rowSelectionUpdater)=>{
|
|
36
36
|
const newRowSelection = typeof rowSelectionUpdater === 'function' ? rowSelectionUpdater(rowSelection) : rowSelectionUpdater;
|
|
@@ -139,6 +139,7 @@ const DEFAULT_SORTING = [];
|
|
|
139
139
|
return /*#__PURE__*/ _jsx(VirtualizedTable, {
|
|
140
140
|
...otherProps,
|
|
141
141
|
density: density,
|
|
142
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
142
143
|
onRowClick: handleRowClick,
|
|
143
144
|
rows: table.getRowModel().rows,
|
|
144
145
|
columns: table.getAllFlatColumns(),
|