@perses-dev/components 0.38.0 → 0.40.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/BarChart/BarChart.d.ts +2 -2
- package/dist/BarChart/BarChart.d.ts.map +1 -1
- package/dist/BarChart/BarChart.js +16 -10
- package/dist/BarChart/BarChart.js.map +1 -1
- package/dist/BarChart/index.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/index.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +19 -19
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +6 -22
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -1
- package/dist/DateTimeRangePicker/index.js.map +1 -1
- package/dist/DateTimeRangePicker/utils.js.map +1 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/Dialog/index.js.map +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Drawer/index.js.map +1 -1
- package/dist/EChart/EChart.js +2 -2
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/EChart/index.js.map +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FontSizeSelector/index.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +9 -0
- package/dist/FormatControls/FormatControls.d.ts.map +1 -0
- package/dist/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +26 -26
- package/dist/FormatControls/FormatControls.js.map +1 -0
- package/dist/FormatControls/index.d.ts +2 -0
- package/dist/FormatControls/index.d.ts.map +1 -0
- package/dist/{UnitSelector → FormatControls}/index.js +1 -1
- package/dist/FormatControls/index.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.d.ts +3 -3
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +12 -12
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/GaugeChart/index.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +3 -3
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +2 -2
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LineChart/LineChart.d.ts +2 -2
- package/dist/LineChart/LineChart.d.ts.map +1 -1
- package/dist/LineChart/LineChart.js +17 -18
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LineChart/index.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/ModeSelector/index.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RefreshIntervalPicker/index.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SettingsAutocomplete/index.js.map +1 -1
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +2 -2
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +8 -8
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.js +7 -7
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/StatChart/index.js.map +1 -1
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +2 -2
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/VirtualizedTable.js +6 -6
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +20 -20
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.js +9 -9
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.js +2 -2
- package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +19 -18
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/ThresholdsEditor/index.js.map +1 -1
- package/dist/TimeChart/TimeChart.d.ts +3 -3
- package/dist/TimeChart/TimeChart.d.ts.map +1 -1
- package/dist/TimeChart/TimeChart.js +108 -61
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeChart/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts +3 -2
- package/dist/TimeSeriesTooltip/LineChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +9 -8
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +2 -2
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +3 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +6 -5
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +1 -0
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +11 -11
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +7 -7
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +35 -39
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +4 -0
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +6 -0
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +3 -3
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/BarChart/BarChart.js +24 -16
- package/dist/cjs/BarChart/index.js +10 -8
- package/dist/cjs/ColorPicker/ColorPicker.js +15 -13
- package/dist/cjs/ColorPicker/index.js +10 -8
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +12 -10
- package/dist/cjs/ContentWithLegend/index.js +10 -8
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +27 -23
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +29 -43
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +12 -10
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +13 -11
- package/dist/cjs/DateTimeRangePicker/index.js +12 -10
- package/dist/cjs/DateTimeRangePicker/utils.js +9 -5
- package/dist/cjs/Dialog/Dialog.js +15 -13
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +11 -9
- package/dist/cjs/Dialog/index.js +11 -9
- package/dist/cjs/Drawer/Drawer.js +5 -3
- package/dist/cjs/Drawer/index.js +10 -8
- package/dist/cjs/EChart/EChart.js +12 -10
- package/dist/cjs/EChart/index.js +10 -8
- package/dist/cjs/ErrorAlert.js +5 -3
- package/dist/cjs/ErrorBoundary.js +4 -2
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +8 -6
- package/dist/cjs/FontSizeSelector/index.js +10 -8
- package/dist/cjs/{UnitSelector/UnitSelector.js → FormatControls/FormatControls.js} +38 -36
- package/dist/cjs/{UnitSelector → FormatControls}/index.js +10 -8
- package/dist/cjs/GaugeChart/GaugeChart.js +22 -18
- package/dist/cjs/GaugeChart/index.js +10 -8
- package/dist/cjs/InfoTooltip/InfoTooltip.js +13 -11
- package/dist/cjs/InfoTooltip/index.js +10 -8
- package/dist/cjs/JSONEditor.js +10 -8
- package/dist/cjs/Legend/CompactLegend.js +9 -7
- package/dist/cjs/Legend/Legend.js +15 -13
- package/dist/cjs/Legend/LegendColorBadge.js +7 -5
- package/dist/cjs/Legend/ListLegend.js +10 -8
- package/dist/cjs/Legend/ListLegendItem.js +12 -10
- package/dist/cjs/Legend/TableLegend.js +7 -5
- package/dist/cjs/Legend/index.js +11 -9
- package/dist/cjs/Legend/legend-model.js +3 -1
- package/dist/cjs/LineChart/LineChart.js +26 -25
- package/dist/cjs/LineChart/index.js +10 -8
- package/dist/cjs/ModeSelector/ModeSelector.js +8 -6
- package/dist/cjs/ModeSelector/index.js +10 -8
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +6 -4
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +16 -14
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +5 -3
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +11 -9
- package/dist/cjs/OptionsEditorLayout/index.js +13 -11
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +8 -6
- package/dist/cjs/RefreshIntervalPicker/index.js +10 -8
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +12 -10
- package/dist/cjs/SettingsAutocomplete/index.js +10 -8
- package/dist/cjs/SortSelector/SortSelector.js +8 -6
- package/dist/cjs/SortSelector/index.js +10 -8
- package/dist/cjs/StatChart/StatChart.js +20 -18
- package/dist/cjs/StatChart/calculateFontSize.js +10 -8
- package/dist/cjs/StatChart/index.js +10 -8
- package/dist/cjs/Table/InnerTable.js +5 -3
- package/dist/cjs/Table/Table.js +15 -13
- package/dist/cjs/Table/TableBody.js +5 -3
- package/dist/cjs/Table/TableCell.js +10 -8
- package/dist/cjs/Table/TableCheckbox.js +5 -3
- package/dist/cjs/Table/TableHead.js +5 -3
- package/dist/cjs/Table/TableHeaderCell.js +8 -6
- package/dist/cjs/Table/TableRow.js +5 -3
- package/dist/cjs/Table/VirtualizedTable.js +32 -30
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -3
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +3 -1
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +23 -21
- package/dist/cjs/Table/index.js +14 -10
- package/dist/cjs/Table/model/table-model.js +15 -11
- package/dist/cjs/ThresholdsEditor/ThresholdColorPicker.js +15 -13
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +14 -12
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +44 -41
- package/dist/cjs/ThresholdsEditor/index.js +10 -8
- package/dist/cjs/TimeChart/TimeChart.js +121 -72
- package/dist/cjs/TimeChart/index.js +10 -8
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +30 -27
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +17 -15
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +15 -13
- package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +5 -3
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +24 -21
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +7 -5
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +36 -34
- package/dist/cjs/TimeSeriesTooltip/index.js +19 -17
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +61 -47
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +57 -14
- package/dist/cjs/TimeSeriesTooltip/utils.js +17 -13
- package/dist/cjs/YAxisLabel.js +6 -4
- package/dist/cjs/context/{ChartsThemeProvider.js → ChartsProvider.js} +38 -11
- package/dist/cjs/context/SnackbarProvider.js +6 -2
- package/dist/cjs/context/TimeZoneProvider.js +13 -7
- package/dist/cjs/context/index.js +32 -0
- package/dist/cjs/index.js +41 -41
- package/dist/cjs/model/graph.js +9 -3
- package/dist/cjs/model/index.js +12 -10
- package/dist/cjs/test/index.js +10 -8
- package/dist/cjs/test/render.js +7 -5
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/theme.js +36 -19
- package/dist/cjs/theme/component-overrides/alert.js +3 -1
- package/dist/cjs/theme/component-overrides/paper.js +3 -1
- package/dist/cjs/theme/index.js +10 -8
- package/dist/cjs/theme/palette/background.js +6 -2
- package/dist/cjs/theme/palette/colors/blue.js +3 -1
- package/dist/cjs/theme/palette/colors/common.js +6 -2
- package/dist/cjs/theme/palette/colors/green.js +3 -1
- package/dist/cjs/theme/palette/colors/grey.js +3 -1
- package/dist/cjs/theme/palette/colors/index.js +17 -15
- package/dist/cjs/theme/palette/colors/orange.js +3 -1
- package/dist/cjs/theme/palette/colors/purple.js +3 -1
- package/dist/cjs/theme/palette/colors/red.js +3 -1
- package/dist/cjs/theme/palette/error.js +3 -1
- package/dist/cjs/theme/palette/grey.js +3 -1
- package/dist/cjs/theme/palette/index.js +10 -8
- package/dist/cjs/theme/palette/palette-options.js +3 -1
- package/dist/cjs/theme/palette/primary.js +3 -1
- package/dist/cjs/theme/palette/secondary.js +3 -1
- package/dist/cjs/theme/palette/success.js +3 -1
- package/dist/cjs/theme/palette/text.js +3 -1
- package/dist/cjs/theme/palette/warning.js +3 -1
- package/dist/cjs/theme/theme.js +5 -3
- package/dist/cjs/theme/typography.js +3 -1
- package/dist/cjs/utils/axis.js +11 -7
- package/dist/cjs/utils/chart-actions.js +59 -5
- package/dist/cjs/utils/combine-sx.js +3 -1
- package/dist/cjs/utils/component-ids.js +3 -1
- package/dist/cjs/utils/format.js +16 -8
- package/dist/cjs/utils/index.js +15 -13
- package/dist/cjs/utils/mathjs.js +3 -1
- package/dist/cjs/utils/theme-gen.js +12 -10
- package/dist/context/ChartsProvider.d.ts +19 -0
- package/dist/context/ChartsProvider.d.ts.map +1 -0
- package/dist/context/{ChartsThemeProvider.js → ChartsProvider.js} +24 -6
- package/dist/context/ChartsProvider.js.map +1 -0
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +17 -0
- package/dist/context/index.js.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/theme.d.ts +2 -0
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +23 -16
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/component-overrides/alert.js.map +1 -1
- package/dist/theme/component-overrides/paper.js.map +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/palette/background.d.ts.map +1 -1
- package/dist/theme/palette/background.js +3 -1
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/common.js.map +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/error.js.map +1 -1
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/theme/palette/index.js.map +1 -1
- package/dist/theme/palette/palette-options.js.map +1 -1
- package/dist/theme/palette/primary.js.map +1 -1
- package/dist/theme/palette/secondary.js.map +1 -1
- package/dist/theme/palette/success.js.map +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +4 -4
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +4 -4
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +5 -1
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js +42 -0
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/theme-gen.js +7 -7
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +7 -6
- package/dist/UnitSelector/UnitSelector.d.ts +0 -9
- package/dist/UnitSelector/UnitSelector.d.ts.map +0 -1
- package/dist/UnitSelector/UnitSelector.js.map +0 -1
- package/dist/UnitSelector/index.d.ts +0 -2
- package/dist/UnitSelector/index.d.ts.map +0 -1
- package/dist/UnitSelector/index.js.map +0 -1
- package/dist/context/ChartsThemeProvider.d.ts +0 -10
- package/dist/context/ChartsThemeProvider.d.ts.map +0 -1
- package/dist/context/ChartsThemeProvider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DateTimeRangePicker/TimeRangeSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MenuItem, Select, SelectChangeEvent } from '@mui/material';\nimport Calendar from 'mdi-material-ui/Calendar';\nimport { TimeRangeValue, isRelativeTimeRange } from '@perses-dev/core';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { TimeOption } from '../model';\nimport { formatAbsoluteRange } from './utils';\n\nconst DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';\n\ninterface TimeRangeSelectorProps {\n value: TimeRangeValue;\n timeOptions: TimeOption[];\n onSelectChange: (event: SelectChangeEvent<string>) => void;\n onCustomClick: () => void;\n height?: string;\n}\n\nexport function TimeRangeSelector(props: TimeRangeSelectorProps) {\n const { value, timeOptions, onSelectChange, onCustomClick, height } = props;\n const { timeZone } = useTimeZone();\n const formattedValue = !isRelativeTimeRange(value)\n ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone)\n : value.pastDuration;\n return (\n <Select\n value={formattedValue}\n onChange={onSelectChange}\n IconComponent={Calendar}\n inputProps={{\n 'aria-label': `Select time range. Currently set to ${formattedValue}`,\n }}\n sx={{\n // `transform: none` prevents calendar icon from flipping over when menu is open\n '.MuiSelect-icon': {\n marginTop: '1px',\n transform: 'none',\n },\n // paddingRight creates more space for the calendar icon (it's a bigger icon)\n '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': {\n paddingRight: '36px',\n },\n '.MuiSelect-select': height ? { lineHeight: height, paddingY: 0 } : {},\n }}\n >\n {timeOptions.map((item, idx) => (\n <MenuItem key={idx} value={item.value.pastDuration}>\n {item.display}\n </MenuItem>\n ))}\n\n {isRelativeTimeRange(value) ? (\n <MenuItem\n onClick={() => {\n onCustomClick();\n }}\n >\n Custom time range\n </MenuItem>\n ) : (\n <MenuItem\n value={formattedValue}\n onClick={() => {\n onCustomClick();\n }}\n >\n {formattedValue}\n </MenuItem>\n )}\n </Select>\n );\n}\n"],"names":["MenuItem","Select","Calendar","isRelativeTimeRange","useTimeZone","formatAbsoluteRange","DATE_TIME_FORMAT","TimeRangeSelector","props","value","timeOptions","onSelectChange","onCustomClick","height","timeZone","formattedValue","pastDuration","onChange","IconComponent","inputProps","sx","marginTop","transform","paddingRight","lineHeight","paddingY","map","item","idx","display","onClick"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/DateTimeRangePicker/TimeRangeSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MenuItem, Select, SelectChangeEvent } from '@mui/material';\nimport Calendar from 'mdi-material-ui/Calendar';\nimport { TimeRangeValue, isRelativeTimeRange } from '@perses-dev/core';\nimport { useTimeZone } from '../context/TimeZoneProvider';\nimport { TimeOption } from '../model';\nimport { formatAbsoluteRange } from './utils';\n\nconst DATE_TIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';\n\ninterface TimeRangeSelectorProps {\n value: TimeRangeValue;\n timeOptions: TimeOption[];\n onSelectChange: (event: SelectChangeEvent<string>) => void;\n onCustomClick: () => void;\n height?: string;\n}\n\nexport function TimeRangeSelector(props: TimeRangeSelectorProps) {\n const { value, timeOptions, onSelectChange, onCustomClick, height } = props;\n const { timeZone } = useTimeZone();\n const formattedValue = !isRelativeTimeRange(value)\n ? formatAbsoluteRange(value, DATE_TIME_FORMAT, timeZone)\n : value.pastDuration;\n return (\n <Select\n value={formattedValue}\n onChange={onSelectChange}\n IconComponent={Calendar}\n inputProps={{\n 'aria-label': `Select time range. Currently set to ${formattedValue}`,\n }}\n sx={{\n // `transform: none` prevents calendar icon from flipping over when menu is open\n '.MuiSelect-icon': {\n marginTop: '1px',\n transform: 'none',\n },\n // paddingRight creates more space for the calendar icon (it's a bigger icon)\n '.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input': {\n paddingRight: '36px',\n },\n '.MuiSelect-select': height ? { lineHeight: height, paddingY: 0 } : {},\n }}\n >\n {timeOptions.map((item, idx) => (\n <MenuItem key={idx} value={item.value.pastDuration}>\n {item.display}\n </MenuItem>\n ))}\n\n {isRelativeTimeRange(value) ? (\n <MenuItem\n onClick={() => {\n onCustomClick();\n }}\n >\n Custom time range\n </MenuItem>\n ) : (\n <MenuItem\n value={formattedValue}\n onClick={() => {\n onCustomClick();\n }}\n >\n {formattedValue}\n </MenuItem>\n )}\n </Select>\n );\n}\n"],"names":["MenuItem","Select","Calendar","isRelativeTimeRange","useTimeZone","formatAbsoluteRange","DATE_TIME_FORMAT","TimeRangeSelector","props","value","timeOptions","onSelectChange","onCustomClick","height","timeZone","formattedValue","pastDuration","onChange","IconComponent","inputProps","sx","marginTop","transform","paddingRight","lineHeight","paddingY","map","item","idx","display","onClick"],"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,QAAQ,EAAEC,MAAM,QAA2B,gBAAgB;AACpE,OAAOC,cAAc,2BAA2B;AAChD,SAAyBC,mBAAmB,QAAQ,mBAAmB;AACvE,SAASC,WAAW,QAAQ,8BAA8B;AAE1D,SAASC,mBAAmB,QAAQ,UAAU;AAE9C,MAAMC,mBAAmB;AAUzB,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,MAAK,EAAEC,YAAW,EAAEC,eAAc,EAAEC,cAAa,EAAEC,OAAM,EAAE,GAAGL;IACtE,MAAM,EAAEM,SAAQ,EAAE,GAAGV;IACrB,MAAMW,iBAAiB,CAACZ,oBAAoBM,SACxCJ,oBAAoBI,OAAOH,kBAAkBQ,YAC7CL,MAAMO;IACV,qBACE,MAACf;QACCQ,OAAOM;QACPE,UAAUN;QACVO,eAAehB;QACfiB,YAAY;YACV,cAAc,CAAC,oCAAoC,EAAEJ,eAAe,CAAC;QACvE;QACAK,IAAI;YACF,gFAAgF;YAChF,mBAAmB;gBACjBC,WAAW;gBACXC,WAAW;YACb;YACA,6EAA6E;YAC7E,2DAA2D;gBACzDC,cAAc;YAChB;YACA,qBAAqBV,SAAS;gBAAEW,YAAYX;gBAAQY,UAAU;YAAE,IAAI,CAAC;QACvE;;YAECf,YAAYgB,IAAI,CAACC,MAAMC,oBACtB,KAAC5B;oBAAmBS,OAAOkB,KAAKlB,MAAMO;8BACnCW,KAAKE;mBADOD;YAKhBzB,oBAAoBM,uBACnB,KAACT;gBACC8B,SAAS;oBACPlB;gBACF;0BACD;+BAID,KAACZ;gBACCS,OAAOM;gBACPe,SAAS;oBACPlB;gBACF;0BAECG;;;;AAKX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DateTimeRangePicker/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 './DateTimeRangePicker';\nexport * from './TimeRangeSelector';\nexport * from './AbsoluteTimePicker';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/DateTimeRangePicker/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 './DateTimeRangePicker';\nexport * from './TimeRangeSelector';\nexport * from './AbsoluteTimePicker';\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,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DateTimeRangePicker/utils.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 { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\n/*\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date) {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string) {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n"],"names":["isBefore","isValid","formatWithTimeZone","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","timeZone","formattedStart","start","formattedEnd","end"],"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,QAAQ,EAAEC,OAAO,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/DateTimeRangePicker/utils.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 { isBefore, isValid } from 'date-fns';\nimport { AbsoluteTimeRange } from '@perses-dev/core';\nimport { formatWithTimeZone } from '../utils';\n\n/*\n * Date validation and check if end is after start\n */\nexport function validateDateRange(startDate: Date, endDate: Date) {\n // TODO: display error as helperText\n if (!isValid(startDate) || !isValid(endDate)) {\n console.error('Invalid Date');\n return false;\n }\n if (!isBefore(startDate, endDate)) {\n console.error('End Time is before Start Time');\n return false;\n }\n return true;\n}\n\n/**\n * Format start and end time based on provided date format\n */\nexport function formatAbsoluteRange(timeRange: AbsoluteTimeRange, dateFormat: string, timeZone?: string) {\n const formattedStart = formatWithTimeZone(timeRange.start, dateFormat, timeZone);\n const formattedEnd = formatWithTimeZone(timeRange.end, dateFormat, timeZone);\n return `${formattedStart} - ${formattedEnd}`;\n}\n"],"names":["isBefore","isValid","formatWithTimeZone","validateDateRange","startDate","endDate","console","error","formatAbsoluteRange","timeRange","dateFormat","timeZone","formattedStart","start","formattedEnd","end"],"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,QAAQ,EAAEC,OAAO,QAAQ,WAAW;AAE7C,SAASC,kBAAkB,QAAQ,WAAW;AAE9C;;CAEC,GACD,OAAO,SAASC,kBAAkBC,SAAe,EAAEC,OAAa;IAC9D,oCAAoC;IACpC,IAAI,CAACJ,QAAQG,cAAc,CAACH,QAAQI,UAAU;QAC5CC,QAAQC,MAAM;QACd,OAAO;IACT;IACA,IAAI,CAACP,SAASI,WAAWC,UAAU;QACjCC,QAAQC,MAAM;QACd,OAAO;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASC,oBAAoBC,SAA4B,EAAEC,UAAkB,EAAEC,QAAiB;IACrG,MAAMC,iBAAiBV,mBAAmBO,UAAUI,OAAOH,YAAYC;IACvE,MAAMG,eAAeZ,mBAAmBO,UAAUM,KAAKL,YAAYC;IACnE,OAAO,CAAC,EAAEC,eAAe,GAAG,EAAEE,aAAa,CAAC;AAC9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,SACEC,MAAM,EAENC,UAAUC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,SAAS,QAAQ,WAAW;AAkBrC,MAAMC,SAAS,CAAC,EAAEC,SAAQ,EAAEC,QAAO,EAAE,GAAGC,OAA0B;IAChE,qBACE;;0BACE,KAACR;gBAAa,GAAGQ,KAAK;0BAAGF;;YACxBC,yBACC,KAACN;gBAAWQ,cAAW;gBAAQC,SAASH;gBAASI,IAAIC;0BACnD,cAAA,KAACT;;;;AAKX;AAEA,MAAMU,UAAU,CAAC,EAAEP,SAAQ,EAAEQ,OAAQ,IAAG,EAAEH,GAAE,EAAE,GAAGH,OAA2B,iBAC1E,KAACT;QAAcgB,QAAQ;QAAE,GAAGP,KAAK;QAAEG,IAAIP,UAAU;YAAEU,OAAO,CAAC,EAAEA,MAAM,EAAE,CAAC;QAAC,GAAGH;kBACvEL;;AAIL,MAAMU,gBAAgB,CAAC,EAAEV,SAAQ,EAAE,GAAGE,OAA0B,iBAC9D,KAACb;QAAOsB,SAAQ;QAAYC,MAAK;QAAU,GAAGV,KAAK;kBAChDF;;AAIL,MAAMa,kBAAkB,CAAC,EAAEb,SAAQ,EAAE,GAAGE,OAA0B,iBAChE,KAACb;QAAOsB,SAAQ;QAAWG,OAAM;QAAa,GAAGZ,KAAK;kBACnDF;;AAIL;;;;;CAKC,GACD,MAAMe,OAAOnB,OAAO,QAAQ;IAC1BoB,WAAW;IACXC,SAAS;IACTC,eAAe;AACjB;AAEA;;;CAGC,GACD,MAAMZ,6BAA6B,CAACa;IAClC,OAAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,QAAQ;QAAMC,OAAOJ,MAAMG,QAAQ;IAAK;AACpF;AAEA,OAAO,MAAMhC,SAAS,CAAC,EAAEU,SAAQ,EAAE,GAAGE,OAAoB,iBAAK,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OAAsB;AAE5GV,OAAOS,SAASA;AAChBT,OAAOyB,OAAOA;AACdzB,OAAOiB,UAAUA;AACjBjB,OAAOoB,gBAAgBA;AACvBpB,OAAOuB,kBAAkBA;AACzBvB,OAAOkC,UAAUhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps) => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Dialog/DiscardChangesConfirmationDialog.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Button } from '@mui/material';\nimport { Dialog } from './Dialog';\n\ninterface DiscardChangesConfirmationDialogProps {\n description: string;\n isOpen: boolean;\n onCancel: () => void;\n onDiscardChanges: () => void;\n}\n\nexport const DiscardChangesConfirmationDialog = (props: DiscardChangesConfirmationDialogProps) => {\n const { description, isOpen, onCancel, onDiscardChanges } = props;\n\n return (\n <Dialog open={isOpen} aria-labelledby=\"discard-dialog\">\n <Dialog.Header>Discard Changes</Dialog.Header>\n <Dialog.Content>{description}</Dialog.Content>\n <Dialog.Actions>\n <Button variant=\"contained\" onClick={onDiscardChanges}>\n Discard Changes\n </Button>\n <Button variant=\"outlined\" color=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n"],"names":["Button","Dialog","DiscardChangesConfirmationDialog","props","description","isOpen","onCancel","onDiscardChanges","open","aria-labelledby","Header","Content","Actions","variant","onClick","color"],"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,MAAM,QAAQ,gBAAgB;AACvC,SAASC,MAAM,QAAQ,WAAW;AASlC,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,MAAM,EAAEC,YAAW,EAAEC,OAAM,EAAEC,SAAQ,EAAEC,iBAAgB,EAAE,GAAGJ;IAE5D,qBACE,MAACF;QAAOO,MAAMH;QAAQI,mBAAgB;;0BACpC,KAACR,OAAOS;0BAAO;;0BACf,KAACT,OAAOU;0BAASP;;0BACjB,MAACH,OAAOW;;kCACN,KAACZ;wBAAOa,SAAQ;wBAAYC,SAASP;kCAAkB;;kCAGvD,KAACP;wBAAOa,SAAQ;wBAAWE,OAAM;wBAAYD,SAASR;kCAAU;;;;;;AAMxE,EAAE"}
|
package/dist/Dialog/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Dialog/index.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Dialog';\nexport * from './DiscardChangesConfirmationDialog';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/Dialog/index.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './Dialog';\nexport * from './DiscardChangesConfirmationDialog';\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,WAAW;AACzB,cAAc,qCAAqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Drawer as MuiDrawer, DrawerProps as MuiDrawerProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface DrawerProps extends MuiDrawerProps {\n isOpen: boolean;\n onClose: () => void;\n anchor?: 'left' | 'right';\n}\n\nconst DRAWER_DEFAULT_WIDTH = 1080;\n\nexport const Drawer = ({ anchor = 'right', isOpen, onClose, PaperProps, children, ...rest }: DrawerProps) => {\n return (\n <MuiDrawer\n {...rest}\n open={isOpen}\n onClose={onClose}\n anchor={anchor}\n PaperProps={{\n ...PaperProps,\n sx: combineSx(\n {\n width: `${DRAWER_DEFAULT_WIDTH}px`,\n overflow: 'hidden',\n },\n PaperProps?.sx\n ),\n }}\n >\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["Drawer","MuiDrawer","combineSx","DRAWER_DEFAULT_WIDTH","anchor","isOpen","onClose","PaperProps","children","rest","open","sx","width","overflow"],"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
|
|
1
|
+
{"version":3,"sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Drawer as MuiDrawer, DrawerProps as MuiDrawerProps } from '@mui/material';\nimport { combineSx } from '../utils';\n\nexport interface DrawerProps extends MuiDrawerProps {\n isOpen: boolean;\n onClose: () => void;\n anchor?: 'left' | 'right';\n}\n\nconst DRAWER_DEFAULT_WIDTH = 1080;\n\nexport const Drawer = ({ anchor = 'right', isOpen, onClose, PaperProps, children, ...rest }: DrawerProps) => {\n return (\n <MuiDrawer\n {...rest}\n open={isOpen}\n onClose={onClose}\n anchor={anchor}\n PaperProps={{\n ...PaperProps,\n sx: combineSx(\n {\n width: `${DRAWER_DEFAULT_WIDTH}px`,\n overflow: 'hidden',\n },\n PaperProps?.sx\n ),\n }}\n >\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["Drawer","MuiDrawer","combineSx","DRAWER_DEFAULT_WIDTH","anchor","isOpen","onClose","PaperProps","children","rest","open","sx","width","overflow"],"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,UAAUC,SAAS,QAAuC,gBAAgB;AACnF,SAASC,SAAS,QAAQ,WAAW;AAQrC,MAAMC,uBAAuB;AAE7B,OAAO,MAAMH,SAAS,CAAC,EAAEI,QAAS,QAAO,EAAEC,OAAM,EAAEC,QAAO,EAAEC,WAAU,EAAEC,SAAQ,EAAE,GAAGC,MAAmB;IACtG,qBACE,KAACR;QACE,GAAGQ,IAAI;QACRC,MAAML;QACNC,SAASA;QACTF,QAAQA;QACRG,YAAY;YACV,GAAGA,UAAU;YACbI,IAAIT,UACF;gBACEU,OAAO,CAAC,EAAET,qBAAqB,EAAE,CAAC;gBAClCU,UAAU;YACZ,GACAN,uBAAAA,wBAAAA,KAAAA,IAAAA,WAAYI;QAEhB;kBAECH;;AAGP,EAAE"}
|
package/dist/Drawer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Drawer/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 './Drawer';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/Drawer/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 './Drawer';\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,WAAW"}
|
package/dist/EChart/EChart.js
CHANGED
|
@@ -145,8 +145,8 @@ function bindEvents(instance, events) {
|
|
|
145
145
|
}
|
|
146
146
|
for(const eventName in events){
|
|
147
147
|
if (Object.prototype.hasOwnProperty.call(events, eventName)) {
|
|
148
|
-
var
|
|
149
|
-
const customEvent = (
|
|
148
|
+
var _events_eventName;
|
|
149
|
+
const customEvent = (_events_eventName = events[eventName]) !== null && _events_eventName !== void 0 ? _events_eventName : null;
|
|
150
150
|
if (customEvent) {
|
|
151
151
|
bindEvent(eventName, customEvent);
|
|
152
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EChart/EChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"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;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,cAAc,CAAC;AACzE,SAASC,GAAG,QAAwB,eAAe,CAAC;AACpD,OAAOC,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAOC,QAAQ,MAAM,iBAAiB,CAAC;AAwBvC,MAAMC,WAAW,GAAG;IAClB,OAAO;IACP,UAAU;IACV,WAAW;IACX,WAAW;IAC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AC;AAED,SAASK,YAAY,CAACL,SAAoB,EAA+B;IACvE,OAAO,AAACnC,WAAW,CAAuB8C,QAAQ,CAACX,SAAS,CAAC,CAAC;AAChE,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../src/EChart/EChart.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ECharts, EChartsCoreOption, init, connect } from 'echarts/core';\nimport { Box, SxProps, Theme } from '@mui/material';\nimport isEqual from 'lodash/isEqual';\nimport debounce from 'lodash/debounce';\nimport { EChartsTheme } from '../model';\n\n// see docs for info about each property: https://echarts.apache.org/en/api.html#events\nexport interface MouseEventsParameters<T> {\n componentType: string;\n seriesType: string;\n seriesIndex: number;\n seriesName: string;\n name: string;\n dataIndex: number;\n data: Record<string, unknown> & T;\n dataType: string;\n value: number | number[];\n color: string;\n info: Record<string, unknown>;\n}\n\ntype OnEventFunction<T> = (\n params: MouseEventsParameters<T>,\n // This is potentially undefined for testing purposes\n instance?: ECharts\n) => void;\n\nconst mouseEvents = [\n 'click',\n 'dblclick',\n 'mousedown',\n 'mousemove',\n 'mouseup',\n 'mouseover',\n 'mouseout',\n 'globalout',\n 'contextmenu',\n] as const;\n\nexport type MouseEventName = (typeof mouseEvents)[number];\n\n// batch event types\nexport interface DataZoomPayloadBatchItem {\n dataZoomId: string;\n // start and end not returned unless dataZoom is based on percentProp,\n // which is for cases when a dataZoom component controls multiple axes\n start?: number;\n end?: number;\n // startValue and endValue return data index for 'category' axes,\n // for axis types 'value' and 'time', actual values are returned\n startValue?: number;\n endValue?: number;\n}\n\nexport interface HighlightPayloadBatchItem {\n dataIndex: number;\n dataIndexInside: number;\n seriesIndex: number;\n // highlight action can effect multiple connected charts\n escapeConnect?: boolean;\n // whether blur state was triggered\n notBlur?: boolean;\n}\n\nexport interface BatchEventsParameters {\n type: BatchEventName;\n batch: DataZoomPayloadBatchItem[] & HighlightPayloadBatchItem[];\n}\n\ntype OnBatchEventFunction = (params: BatchEventsParameters) => void;\n\nconst batchEvents = ['datazoom', 'downplay', 'highlight'] as const;\n\nexport type BatchEventName = (typeof batchEvents)[number];\n\ntype ChartEventName = 'finished';\n\ntype EventName = MouseEventName | ChartEventName | BatchEventName;\n\nexport type OnEventsType<T> = {\n [mouseEventName in MouseEventName]?: OnEventFunction<T>;\n} & {\n [batchEventName in BatchEventName]?: OnBatchEventFunction;\n} & {\n [eventName in ChartEventName]?: () => void;\n};\n\nexport interface EChartsProps<T> {\n option: EChartsCoreOption;\n theme?: string | EChartsTheme;\n renderer?: 'canvas' | 'svg';\n sx?: SxProps<Theme>;\n onEvents?: OnEventsType<T>;\n _instance?: React.MutableRefObject<ECharts | undefined>;\n syncGroup?: string;\n onChartInitialized?: (instance: ECharts) => void;\n}\n\nexport const EChart = React.memo(function EChart<T>({\n option,\n theme,\n renderer,\n sx,\n onEvents,\n _instance,\n syncGroup,\n onChartInitialized,\n}: EChartsProps<T>) {\n const initialOption = useRef<EChartsCoreOption>(option);\n const prevOption = useRef<EChartsCoreOption>(option);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const chartElement = useRef<ECharts | null>(null);\n\n // Initialize chart, dispose on unmount\n useLayoutEffect(() => {\n if (containerRef.current === null || chartElement.current !== null) return;\n chartElement.current = init(containerRef.current, theme, { renderer: renderer ?? 'canvas' });\n if (chartElement.current === undefined) return;\n chartElement.current.setOption(initialOption.current, true);\n onChartInitialized?.(chartElement.current);\n if (_instance !== undefined) {\n _instance.current = chartElement.current;\n }\n return () => {\n if (chartElement.current === null) return;\n chartElement.current.dispose();\n chartElement.current = null;\n };\n }, [_instance, onChartInitialized, theme, renderer]);\n\n // When syncGroup is explicitly set, charts within same group share interactions such as crosshair\n useEffect(() => {\n if (!chartElement.current || !syncGroup) return;\n chartElement.current.group = syncGroup;\n connect([chartElement.current]); // more info: https://echarts.apache.org/en/api.html#echarts.connect\n }, [syncGroup, chartElement]);\n\n // Update chart data when option changes\n useEffect(() => {\n if (prevOption.current === undefined || isEqual(prevOption.current, option)) return;\n if (!chartElement.current) return;\n chartElement.current.setOption(option, true);\n prevOption.current = option;\n }, [option]);\n\n // Resize chart, cleanup listener on unmount\n useLayoutEffect(() => {\n const updateSize = debounce(() => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n }, 200);\n window.addEventListener('resize', updateSize);\n updateSize();\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, []);\n\n // Bind and unbind chart events passed as prop\n useEffect(() => {\n const chart = chartElement.current;\n if (!chart || onEvents === undefined) return;\n bindEvents(chart, onEvents);\n return () => {\n if (chart === undefined) return;\n if (chart.isDisposed() === true) return;\n for (const event in onEvents) {\n chart.off(event);\n }\n };\n }, [onEvents]);\n\n // TODO: re-evaluate how this is triggered. It's technically working right\n // now because the sx prop is an object that gets re-created, but that also\n // means it runs unnecessarily some of the time and theoretically might\n // not run in some other cases. Maybe it should use a resize observer?\n useEffect(() => {\n // TODO: fix this debouncing. This likely isn't working as intended because\n // the debounced function is re-created every time this useEffect is called.\n const updateSize = debounce(\n () => {\n if (!chartElement.current) return;\n chartElement.current.resize();\n },\n 200,\n {\n leading: true,\n }\n );\n updateSize();\n }, [sx]);\n\n return <Box ref={containerRef} sx={sx}></Box>;\n});\n\n// Validate event config and bind custom events\nfunction bindEvents<T>(instance: ECharts, events?: OnEventsType<T>) {\n if (events === undefined) return;\n\n function bindEvent(eventName: EventName, OnEventFunction: unknown) {\n if (typeof OnEventFunction === 'function') {\n if (isMouseEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params, instance));\n } else if (isBatchEvent(eventName)) {\n instance.on(eventName, (params) => OnEventFunction(params));\n } else {\n instance.on(eventName, () => OnEventFunction(null, instance));\n }\n }\n }\n\n for (const eventName in events) {\n if (Object.prototype.hasOwnProperty.call(events, eventName)) {\n const customEvent = events[eventName as EventName] ?? null;\n if (customEvent) {\n bindEvent(eventName as EventName, customEvent);\n }\n }\n }\n}\n\nfunction isMouseEvent(eventName: EventName): eventName is MouseEventName {\n return (mouseEvents as readonly string[]).includes(eventName);\n}\n\nfunction isBatchEvent(eventName: EventName): eventName is BatchEventName {\n return (batchEvents as readonly string[]).includes(eventName);\n}\n"],"names":["React","useEffect","useLayoutEffect","useRef","init","connect","Box","isEqual","debounce","mouseEvents","batchEvents","EChart","memo","option","theme","renderer","sx","onEvents","_instance","syncGroup","onChartInitialized","initialOption","prevOption","containerRef","chartElement","current","undefined","setOption","dispose","group","updateSize","resize","window","addEventListener","removeEventListener","chart","bindEvents","isDisposed","event","off","leading","ref","instance","events","bindEvent","eventName","OnEventFunction","isMouseEvent","on","params","isBatchEvent","Object","prototype","hasOwnProperty","call","customEvent","includes"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,QAAQ;AAClE,SAAqCC,IAAI,EAAEC,OAAO,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAwB,gBAAgB;AACpD,OAAOC,aAAa,iBAAiB;AACrC,OAAOC,cAAc,kBAAkB;AAwBvC,MAAMC,cAAc;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAkCD,MAAMC,cAAc;IAAC;IAAY;IAAY;CAAY;AA2BzD,OAAO,MAAMC,uBAASX,MAAMY,KAAK,SAASD,OAAU,EAClDE,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AMY,cAAcZ,CAAAA,oBAAAA,MAAM,CAACE,UAAuB,cAA9BF,+BAAAA,oBAAkC;YACtD,IAAIY,aAAa;gBACfX,UAAUC,WAAwBU;YACpC;QACF;IACF;AACF;AAEA,SAASR,aAAaF,SAAoB;IACxC,OAAO,AAACpC,YAAkC+C,SAASX;AACrD;AAEA,SAASK,aAAaL,SAAoB;IACxC,OAAO,AAACnC,YAAkC8C,SAASX;AACrD"}
|
package/dist/EChart/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EChart/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 './EChart';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/EChart/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 './EChart';\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,WAAW"}
|
package/dist/ErrorAlert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ErrorAlert.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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
|
|
1
|
+
{"version":3,"sources":["../src/ErrorAlert.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Alert } from '@mui/material';\n\nexport interface ErrorAlertProps {\n error: Error;\n}\n\n/**\n * Shows an MUI Alert with the `Error.message` as its contents.\n */\nexport function ErrorAlert(props: ErrorAlertProps) {\n const { error } = props;\n return <Alert severity=\"error\">{error.message}</Alert>;\n}\n"],"names":["Alert","ErrorAlert","props","error","severity","message"],"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,KAAK,QAAQ,gBAAgB;AAMtC;;CAEC,GACD,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,MAAK,EAAE,GAAGD;IAClB,qBAAO,KAACF;QAAMI,UAAS;kBAASD,MAAME;;AACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../src/ErrorBoundary.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\n// Just use react-error-boundary as-is for now\nexport { ErrorBoundary } from 'react-error-boundary';\nexport type { ErrorBoundaryProps } from 'react-error-boundary';\n"],"names":["ErrorBoundary"],"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,8CAA8C;AAC9C,SAASA,aAAa,QAAQ,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFontSizeChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../src/FontSizeSelector/FontSizeSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst FONT_SIZE_OPTIONS = [\n { id: 'default', label: 'Default', value: undefined },\n { id: '12', label: '12', value: 12 },\n { id: '14', label: '14', value: 14 },\n { id: '16', label: '16', value: 16 },\n { id: '20', label: '20', value: 20 },\n { id: '24', label: '24', value: 24 },\n { id: '28', label: '28', value: 28 },\n { id: '32', label: '32', value: 32 },\n { id: '36', label: '36', value: 36 },\n { id: '40', label: '40', value: 40 },\n { id: '48', label: '48', value: 48 },\n { id: '56', label: '56', value: 56 },\n { id: '64', label: '64', value: 64 },\n { id: '72', label: '72', value: 72 },\n { id: '96', label: '96', value: 96 },\n { id: '128', label: '128', value: 128 },\n { id: '160', label: '160', value: 160 },\n { id: '192', label: '192', value: 192 },\n];\n\nexport type FontSizeOption = number | undefined;\n\nexport interface FontSizeSelectorProps {\n value: FontSizeOption;\n onChange: (fontSize: FontSizeOption) => void;\n}\n\nexport function FontSizeSelector({ value, onChange }: FontSizeSelectorProps) {\n const handleFontSizeChange = (_: unknown, { value }: { value: FontSizeOption }) => {\n onChange(value);\n };\n\n return (\n <OptionsEditorControl\n label=\"Font Size\"\n control={\n <SettingsAutocomplete\n value={FONT_SIZE_OPTIONS.find((o) => o.value === value)}\n options={FONT_SIZE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleFontSizeChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","FONT_SIZE_OPTIONS","id","label","value","undefined","FontSizeSelector","onChange","handleFontSizeChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAA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,MAAMC,uBAAuB,CAACC,GAAY,EAAEL,MAAK,EAA6B;QAC5EG,SAASH;IACX;IAEA,qBACE,KAACL;QACCI,OAAM;QACNO,uBACE,KAACV;YACCI,OAAOH,kBAAkBU,KAAK,CAACC,IAAMA,EAAER,UAAUA;YACjDS,SAASZ;YACTa,gBAAgB,CAACF,IAAMA,EAAET;YACzBI,UAAUC;YACVO,gBAAgB;;;AAK1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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,
|
|
1
|
+
{"version":3,"sources":["../../src/FontSizeSelector/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 './FontSizeSelector';\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,qBAAqB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormatOptions } from '@perses-dev/core';
|
|
3
|
+
export interface FormatControlsProps {
|
|
4
|
+
value: FormatOptions;
|
|
5
|
+
onChange: (unit: FormatOptions) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function FormatControls({ value, onChange, disabled }: FormatControlsProps): JSX.Element;
|
|
9
|
+
//# sourceMappingURL=FormatControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormatControls.d.ts","sourceRoot":"","sources":["../../src/FormatControls/FormatControls.tsx"],"names":[],"mappings":";AAaA,OAAO,EAEL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA0BD,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,mBAAmB,eAsExF"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { Switch } from '@mui/material';
|
|
15
|
-
import {
|
|
15
|
+
import { shouldShortenValues, UNIT_CONFIG, isUnitWithDecimalPlaces, isUnitWithShortValues } from '@perses-dev/core';
|
|
16
16
|
import { OptionsEditorControl } from '../OptionsEditorLayout';
|
|
17
17
|
import { SettingsAutocomplete } from '../SettingsAutocomplete';
|
|
18
18
|
const KIND_OPTIONS = Object.entries(UNIT_CONFIG).map(([id, config])=>{
|
|
@@ -25,78 +25,78 @@ const DECIMAL_PLACES_OPTIONS = [
|
|
|
25
25
|
{
|
|
26
26
|
id: 'default',
|
|
27
27
|
label: 'Default',
|
|
28
|
-
|
|
28
|
+
decimalPlaces: undefined
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
id: '0',
|
|
32
32
|
label: '0',
|
|
33
|
-
|
|
33
|
+
decimalPlaces: 0
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
id: '1',
|
|
37
37
|
label: '1',
|
|
38
|
-
|
|
38
|
+
decimalPlaces: 1
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
id: '2',
|
|
42
42
|
label: '2',
|
|
43
|
-
|
|
43
|
+
decimalPlaces: 2
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
id: '3',
|
|
47
47
|
label: '3',
|
|
48
|
-
|
|
48
|
+
decimalPlaces: 3
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
id: '4',
|
|
52
52
|
label: '4',
|
|
53
|
-
|
|
53
|
+
decimalPlaces: 4
|
|
54
54
|
}
|
|
55
55
|
];
|
|
56
|
-
function getOptionByDecimalPlaces(
|
|
57
|
-
return DECIMAL_PLACES_OPTIONS.find((o)=>o.
|
|
56
|
+
function getOptionByDecimalPlaces(decimalPlaces) {
|
|
57
|
+
return DECIMAL_PLACES_OPTIONS.find((o)=>o.decimalPlaces === decimalPlaces);
|
|
58
58
|
}
|
|
59
|
-
export function
|
|
59
|
+
export function FormatControls({ value , onChange , disabled =false }) {
|
|
60
60
|
const hasDecimalPlaces = isUnitWithDecimalPlaces(value);
|
|
61
|
-
const
|
|
61
|
+
const hasShortValues = isUnitWithShortValues(value);
|
|
62
62
|
const handleKindChange = (_, newValue)=>{
|
|
63
63
|
onChange({
|
|
64
|
-
|
|
64
|
+
unit: newValue.id
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
const handleDecimalPlacesChange = (_, {
|
|
67
|
+
const handleDecimalPlacesChange = (_, { decimalPlaces })=>{
|
|
68
68
|
if (hasDecimalPlaces) {
|
|
69
69
|
onChange({
|
|
70
70
|
...value,
|
|
71
|
-
|
|
71
|
+
decimalPlaces: decimalPlaces
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
75
|
+
const handleShortValuesChange = (_, checked)=>{
|
|
76
|
+
if (hasShortValues) {
|
|
77
77
|
onChange({
|
|
78
78
|
...value,
|
|
79
|
-
|
|
79
|
+
shortValues: checked
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
const
|
|
83
|
+
const unitConfig = UNIT_CONFIG[value.unit];
|
|
84
84
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
85
85
|
children: [
|
|
86
86
|
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
87
|
-
label: "
|
|
87
|
+
label: "Short values",
|
|
88
88
|
control: /*#__PURE__*/ _jsx(Switch, {
|
|
89
|
-
checked:
|
|
90
|
-
onChange:
|
|
91
|
-
disabled: !
|
|
89
|
+
checked: hasShortValues ? shouldShortenValues(value.shortValues) : false,
|
|
90
|
+
onChange: handleShortValuesChange,
|
|
91
|
+
disabled: !hasShortValues
|
|
92
92
|
})
|
|
93
93
|
}),
|
|
94
94
|
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
95
95
|
label: "Unit",
|
|
96
96
|
control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
|
|
97
97
|
value: {
|
|
98
|
-
id: value.
|
|
99
|
-
...
|
|
98
|
+
id: value.unit,
|
|
99
|
+
...unitConfig
|
|
100
100
|
},
|
|
101
101
|
options: KIND_OPTIONS,
|
|
102
102
|
groupBy: (option)=>option.group,
|
|
@@ -108,7 +108,7 @@ export function UnitSelector({ value , onChange , disabled =false }) {
|
|
|
108
108
|
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
109
109
|
label: "Decimals",
|
|
110
110
|
control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
|
|
111
|
-
value: getOptionByDecimalPlaces(value.
|
|
111
|
+
value: getOptionByDecimalPlaces(value.decimalPlaces),
|
|
112
112
|
options: DECIMAL_PLACES_OPTIONS,
|
|
113
113
|
getOptionLabel: (o)=>o.label,
|
|
114
114
|
onChange: handleDecimalPlacesChange,
|
|
@@ -120,4 +120,4 @@ export function UnitSelector({ value , onChange , disabled =false }) {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
//# sourceMappingURL=
|
|
123
|
+
//# sourceMappingURL=FormatControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/FormatControls/FormatControls.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { Switch, SwitchProps } from '@mui/material';\nimport {\n shouldShortenValues,\n FormatOptions,\n UNIT_CONFIG,\n UnitConfig,\n isUnitWithDecimalPlaces,\n isUnitWithShortValues,\n} from '@perses-dev/core';\nimport { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nexport interface FormatControlsProps {\n value: FormatOptions;\n onChange: (unit: FormatOptions) => void;\n disabled?: boolean;\n}\n\ntype AutocompleteUnitOption = UnitConfig & { id: FormatOptions['unit'] };\n\nconst KIND_OPTIONS: AutocompleteUnitOption[] = Object.entries(UNIT_CONFIG)\n .map(([id, config]) => {\n return {\n id: id as FormatOptions['unit'],\n ...config,\n };\n })\n .filter((config) => !config.disableSelectorOption);\n\nconst DECIMAL_PLACES_OPTIONS = [\n { id: 'default', label: 'Default', decimalPlaces: undefined },\n { id: '0', label: '0', decimalPlaces: 0 },\n { id: '1', label: '1', decimalPlaces: 1 },\n { id: '2', label: '2', decimalPlaces: 2 },\n { id: '3', label: '3', decimalPlaces: 3 },\n { id: '4', label: '4', decimalPlaces: 4 },\n];\n\nfunction getOptionByDecimalPlaces(decimalPlaces?: number) {\n return DECIMAL_PLACES_OPTIONS.find((o) => o.decimalPlaces === decimalPlaces);\n}\n\nexport function FormatControls({ value, onChange, disabled = false }: FormatControlsProps) {\n const hasDecimalPlaces = isUnitWithDecimalPlaces(value);\n const hasShortValues = isUnitWithShortValues(value);\n\n const handleKindChange = (_: unknown, newValue: AutocompleteUnitOption) => {\n onChange({\n unit: newValue.id,\n });\n };\n\n const handleDecimalPlacesChange = (_: unknown, { decimalPlaces }: { decimalPlaces: number | undefined }) => {\n if (hasDecimalPlaces) {\n onChange({\n ...value,\n decimalPlaces: decimalPlaces,\n });\n }\n };\n\n const handleShortValuesChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n if (hasShortValues) {\n onChange({\n ...value,\n shortValues: checked,\n });\n }\n };\n\n const unitConfig = UNIT_CONFIG[value.unit];\n\n return (\n <>\n <OptionsEditorControl\n label=\"Short values\"\n control={\n <Switch\n checked={hasShortValues ? shouldShortenValues(value.shortValues) : false}\n onChange={handleShortValuesChange}\n disabled={!hasShortValues}\n />\n }\n />\n <OptionsEditorControl\n label=\"Unit\"\n control={\n <SettingsAutocomplete\n value={{ id: value.unit, ...unitConfig }}\n options={KIND_OPTIONS}\n groupBy={(option) => option.group}\n onChange={handleKindChange}\n disableClearable\n disabled={disabled}\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Decimals\"\n control={\n <SettingsAutocomplete\n value={getOptionByDecimalPlaces(value.decimalPlaces)}\n options={DECIMAL_PLACES_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleDecimalPlacesChange}\n disabled={!hasDecimalPlaces}\n disableClearable\n />\n }\n />\n </>\n );\n}\n"],"names":["Switch","shouldShortenValues","UNIT_CONFIG","isUnitWithDecimalPlaces","isUnitWithShortValues","OptionsEditorControl","SettingsAutocomplete","KIND_OPTIONS","Object","entries","map","id","config","filter","disableSelectorOption","DECIMAL_PLACES_OPTIONS","label","decimalPlaces","undefined","getOptionByDecimalPlaces","find","o","FormatControls","value","onChange","disabled","hasDecimalPlaces","hasShortValues","handleKindChange","_","newValue","unit","handleDecimalPlacesChange","handleShortValuesChange","checked","shortValues","unitConfig","control","options","groupBy","option","group","disableClearable","getOptionLabel"],"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;;AACjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SACEC,mBAAmB,EAEnBC,WAAW,EAEXC,uBAAuB,EACvBC,qBAAqB,QAChB,mBAAmB;AAC1B,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAU/D,MAAMC,eAAyCC,OAAOC,QAAQP,aAC3DQ,IAAI,CAAC,CAACC,IAAIC,OAAO;IAChB,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF,GACCC,OAAO,CAACD,SAAW,CAACA,OAAOE;AAE9B,MAAMC,yBAAyB;IAC7B;QAAEJ,IAAI;QAAWK,OAAO;QAAWC,eAAeC;IAAU;IAC5D;QAAEP,IAAI;QAAKK,OAAO;QAAKC,eAAe;IAAE;IACxC;QAAEN,IAAI;QAAKK,OAAO;QAAKC,eAAe;IAAE;IACxC;QAAEN,IAAI;QAAKK,OAAO;QAAKC,eAAe;IAAE;IACxC;QAAEN,IAAI;QAA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oBACzBQ,UAAUQ;oBACVP,UAAU,CAACC;oBACXgB,gBAAgB;;;;;AAM5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormatControls/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './FormatControls';
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/FormatControls/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 './FormatControls';\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,mBAAmB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { FormatOptions } from '@perses-dev/core';
|
|
3
3
|
import { GaugeSeriesOption } from 'echarts/charts';
|
|
4
4
|
export declare type GaugeChartValue = number | null | undefined;
|
|
5
5
|
export declare type GaugeSeries = {
|
|
@@ -10,7 +10,7 @@ export interface GaugeChartProps {
|
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
12
12
|
data: GaugeSeries;
|
|
13
|
-
|
|
13
|
+
format: FormatOptions;
|
|
14
14
|
axisLine: GaugeSeriesOption['axisLine'];
|
|
15
15
|
max?: number;
|
|
16
16
|
}
|
|
@@ -19,5 +19,5 @@ export declare function GaugeChart(props: GaugeChartProps): JSX.Element;
|
|
|
19
19
|
* Responsive font size depending on number of characters, clamp used
|
|
20
20
|
* to ensure size stays within given range
|
|
21
21
|
*/
|
|
22
|
-
export declare function getResponsiveValueSize(value: number | null,
|
|
22
|
+
export declare function getResponsiveValueSize(value: number | null, format: FormatOptions, width: number, height: number): string;
|
|
23
23
|
//# sourceMappingURL=GaugeChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA4B,
|
|
1
|
+
{"version":3,"file":"GaugeChart.d.ts","sourceRoot":"","sources":["../../src/GaugeChart/GaugeChart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA4B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,OAAO,EAAmC,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAapF,oBAAY,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAExD,oBAAY,WAAW,GAAG;IACxB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,eAuJhD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQhH"}
|
|
@@ -16,7 +16,7 @@ import { use } from 'echarts/core';
|
|
|
16
16
|
import { GaugeChart as EChartsGaugeChart } from 'echarts/charts';
|
|
17
17
|
import { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components';
|
|
18
18
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
19
|
-
import { useChartsTheme } from '../context/
|
|
19
|
+
import { useChartsTheme } from '../context/ChartsProvider';
|
|
20
20
|
import { EChart } from '../EChart';
|
|
21
21
|
use([
|
|
22
22
|
EChartsGaugeChart,
|
|
@@ -29,15 +29,15 @@ const PROGRESS_WIDTH = 16;
|
|
|
29
29
|
// adjusts when to show pointer icon
|
|
30
30
|
const GAUGE_SMALL_BREAKPOINT = 170;
|
|
31
31
|
export function GaugeChart(props) {
|
|
32
|
-
const { width , height , data ,
|
|
32
|
+
const { width , height , data , format , axisLine , max } = props;
|
|
33
33
|
const chartsTheme = useChartsTheme();
|
|
34
34
|
// useDeepMemo ensures value size util does not rerun everytime you hover on the chart
|
|
35
35
|
const option = useDeepMemo(()=>{
|
|
36
|
-
var
|
|
36
|
+
var _chartsTheme_echartsTheme_textStyle;
|
|
37
37
|
if (data.value === undefined) return chartsTheme.noDataOption;
|
|
38
38
|
// adjusts fontSize depending on number of characters
|
|
39
|
-
const valueSizeClamp = getResponsiveValueSize(data.value,
|
|
40
|
-
var
|
|
39
|
+
const valueSizeClamp = getResponsiveValueSize(data.value, format, width, height);
|
|
40
|
+
var _chartsTheme_echartsTheme_textStyle_color;
|
|
41
41
|
return {
|
|
42
42
|
title: {
|
|
43
43
|
show: false
|
|
@@ -156,7 +156,7 @@ export function GaugeChart(props) {
|
|
|
156
156
|
// when the value is `null`, making it difficult to differentiate
|
|
157
157
|
// `null` from a true `NaN` case.
|
|
158
158
|
()=>'null' : (value)=>{
|
|
159
|
-
return formatValue(value,
|
|
159
|
+
return formatValue(value, format);
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
data: [
|
|
@@ -167,7 +167,7 @@ export function GaugeChart(props) {
|
|
|
167
167
|
// https://echarts.apache.org/en/option.html#series-gauge.data.title
|
|
168
168
|
title: {
|
|
169
169
|
show: true,
|
|
170
|
-
color: (
|
|
170
|
+
color: (_chartsTheme_echartsTheme_textStyle_color = (_chartsTheme_echartsTheme_textStyle = chartsTheme.echartsTheme.textStyle) === null || _chartsTheme_echartsTheme_textStyle === void 0 ? void 0 : _chartsTheme_echartsTheme_textStyle.color) !== null && _chartsTheme_echartsTheme_textStyle_color !== void 0 ? _chartsTheme_echartsTheme_textStyle_color : 'inherit',
|
|
171
171
|
offsetCenter: [
|
|
172
172
|
0,
|
|
173
173
|
'55%'
|
|
@@ -186,7 +186,7 @@ export function GaugeChart(props) {
|
|
|
186
186
|
width,
|
|
187
187
|
height,
|
|
188
188
|
chartsTheme,
|
|
189
|
-
|
|
189
|
+
format,
|
|
190
190
|
axisLine,
|
|
191
191
|
max
|
|
192
192
|
]);
|
|
@@ -203,13 +203,13 @@ export function GaugeChart(props) {
|
|
|
203
203
|
/**
|
|
204
204
|
* Responsive font size depending on number of characters, clamp used
|
|
205
205
|
* to ensure size stays within given range
|
|
206
|
-
*/ export function getResponsiveValueSize(value,
|
|
206
|
+
*/ export function getResponsiveValueSize(value, format, width, height) {
|
|
207
207
|
const MIN_SIZE = 3;
|
|
208
208
|
const MAX_SIZE = 24;
|
|
209
209
|
const SIZE_MULTIPLIER = 0.7;
|
|
210
|
-
const formattedValue = typeof value === 'number' ? formatValue(value,
|
|
211
|
-
var
|
|
212
|
-
const valueCharacters = (
|
|
210
|
+
const formattedValue = typeof value === 'number' ? formatValue(value, format) : `${value}`;
|
|
211
|
+
var _formattedValue_length;
|
|
212
|
+
const valueCharacters = (_formattedValue_length = formattedValue.length) !== null && _formattedValue_length !== void 0 ? _formattedValue_length : 2;
|
|
213
213
|
const valueSize = Math.min(width, height) / valueCharacters * SIZE_MULTIPLIER;
|
|
214
214
|
return `clamp(${MIN_SIZE}px, ${valueSize}px, ${MAX_SIZE}px)`;
|
|
215
215
|
}
|