@perses-dev/components 0.55.0-beta.1 → 0.55.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlignSelector/AlignSelector.d.ts +2 -2
- package/dist/AlignSelector/AlignSelector.d.ts.map +1 -1
- package/dist/AlignSelector/AlignSelector.js +2 -2
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/AlignSelector/index.js +1 -1
- package/dist/AlignSelector/index.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/ColorPicker.js +5 -5
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts +1 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +5 -5
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ColorPicker/index.js +2 -2
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.d.ts +2 -2
- package/dist/ContentWithLegend/ContentWithLegend.d.ts.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +5 -5
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/index.js +1 -1
- package/dist/ContentWithLegend/index.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +3 -4
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -2
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.d.ts +1 -1
- package/dist/DensitySelector/DensitySelector.d.ts.map +1 -1
- package/dist/DensitySelector/DensitySelector.js +2 -2
- package/dist/DensitySelector/DensitySelector.js.map +1 -1
- package/dist/DensitySelector/index.js +1 -1
- package/dist/DensitySelector/index.js.map +1 -1
- package/dist/Dialog/Dialog.d.ts +4 -3
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +2 -2
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/Dialog/index.js +2 -2
- package/dist/Dialog/index.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.d.ts +1 -1
- package/dist/DragAndDrop/DragAndDropList.d.ts.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +8 -8
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.d.ts +1 -2
- package/dist/DragAndDrop/DragButton.d.ts.map +1 -1
- package/dist/DragAndDrop/DragButton.js +4 -4
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.d.ts +1 -1
- package/dist/DragAndDrop/DropIndicator.d.ts.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +1 -1
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/DragAndDrop/index.js +3 -3
- package/dist/DragAndDrop/index.js.map +1 -1
- package/dist/DragAndDrop/model.d.ts +1 -1
- package/dist/DragAndDrop/model.d.ts.map +1 -1
- package/dist/DragAndDrop/model.js.map +1 -1
- package/dist/Drawer/Drawer.d.ts +2 -2
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +3 -3
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/Drawer/index.js.map +1 -1
- package/dist/EChart/EChart.d.ts +7 -7
- package/dist/EChart/EChart.d.ts.map +1 -1
- package/dist/EChart/EChart.js +10 -10
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/EChart/index.js +2 -2
- package/dist/EChart/index.js.map +1 -1
- package/dist/EChart/timezone-formatter.js +1 -1
- package/dist/ErrorAlert.d.ts +1 -1
- package/dist/ErrorAlert.d.ts.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js +1 -1
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.d.ts +27 -0
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.d.ts.map +1 -0
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js +239 -0
- package/dist/ExemplarMetadata/ExemplarMetadataTooltip.js.map +1 -0
- package/dist/ExemplarMetadata/index.d.ts +2 -0
- package/dist/ExemplarMetadata/index.d.ts.map +1 -0
- package/dist/{cjs/model/thresholds.js → ExemplarMetadata/index.js} +3 -5
- package/dist/ExemplarMetadata/index.js.map +1 -0
- package/dist/FontSizeSelector/FontSizeSelector.d.ts +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.d.ts.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +2 -2
- package/dist/FontSizeSelector/FontSizeSelector.js.map +1 -1
- package/dist/FontSizeSelector/index.js +1 -1
- package/dist/FontSizeSelector/index.js.map +1 -1
- package/dist/FormEditor/FormActions.d.ts +3 -3
- package/dist/FormEditor/FormActions.d.ts.map +1 -1
- package/dist/FormEditor/FormActions.js +2 -2
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormEditor/index.js +1 -1
- package/dist/FormEditor/index.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +2 -2
- package/dist/FormatControls/FormatControls.d.ts.map +1 -1
- package/dist/FormatControls/FormatControls.js +6 -6
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.d.ts +2 -2
- package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
- package/dist/FormatControls/UnitSelector.js +35 -6
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/FormatControls/index.js +2 -2
- package/dist/FormatControls/index.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.d.ts +1 -1
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +1 -1
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/InfoTooltip/index.js +1 -1
- package/dist/InfoTooltip/index.js.map +1 -1
- package/dist/JSONEditor.d.ts +2 -2
- package/dist/JSONEditor.d.ts.map +1 -1
- package/dist/JSONEditor.js +5 -5
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.d.ts +3 -3
- package/dist/Legend/CompactLegend.d.ts.map +1 -1
- package/dist/Legend/CompactLegend.js +3 -3
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.d.ts +4 -4
- package/dist/Legend/Legend.d.ts.map +1 -1
- package/dist/Legend/Legend.js +6 -6
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.d.ts +3 -3
- package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
- package/dist/Legend/LegendColorBadge.js +4 -4
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.d.ts +3 -3
- package/dist/Legend/ListLegend.d.ts.map +1 -1
- package/dist/Legend/ListLegend.js +7 -6
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.d.ts +3 -3
- package/dist/Legend/ListLegendItem.d.ts.map +1 -1
- package/dist/Legend/ListLegendItem.js +8 -7
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts +3 -3
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +3 -3
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.js +2 -2
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +2 -2
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.d.ts +1 -1
- package/dist/LinksEditor/LinkEditorForm.d.ts.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +2 -2
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/LinksEditor/index.js +1 -1
- package/dist/LinksEditor/index.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.d.ts +1 -1
- package/dist/ModeSelector/ModeSelector.d.ts.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +2 -2
- package/dist/ModeSelector/ModeSelector.js.map +1 -1
- package/dist/ModeSelector/index.js +1 -1
- package/dist/ModeSelector/index.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +6 -6
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +2 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +2 -2
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js +4 -4
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/Overlay/Overlay.d.ts +2 -2
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +2 -2
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Overlay/index.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts +3 -3
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.d.ts.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +2 -2
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/RefreshIntervalPicker/index.js +1 -1
- package/dist/RefreshIntervalPicker/index.js.map +1 -1
- package/dist/RepeatGrid/RepeatGrid.d.ts +15 -0
- package/dist/RepeatGrid/RepeatGrid.d.ts.map +1 -0
- package/dist/RepeatGrid/RepeatGrid.js +68 -0
- package/dist/RepeatGrid/RepeatGrid.js.map +1 -0
- package/dist/RepeatGrid/index.d.ts +2 -0
- package/dist/RepeatGrid/index.d.ts.map +1 -0
- package/dist/{cjs/model/types.js → RepeatGrid/index.js} +3 -4
- package/dist/RepeatGrid/index.js.map +1 -0
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts +2 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +2 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SettingsAutocomplete/index.js +1 -1
- package/dist/SettingsAutocomplete/index.js.map +1 -1
- package/dist/SortSelector/SortSelector.d.ts +1 -1
- package/dist/SortSelector/SortSelector.d.ts.map +1 -1
- package/dist/SortSelector/SortSelector.js +2 -2
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.d.ts +3 -3
- package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +2 -2
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/SortSelector/index.js +2 -2
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/Table/InnerTable.d.ts +2 -3
- package/dist/Table/InnerTable.d.ts.map +1 -1
- package/dist/Table/InnerTable.js +3 -3
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +2 -2
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +7 -7
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.d.ts +1 -2
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +3 -3
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.d.ts +3 -3
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +5 -5
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.d.ts +3 -3
- package/dist/Table/TableCheckbox.d.ts.map +1 -1
- package/dist/Table/TableCheckbox.js +2 -2
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.d.ts +1 -2
- package/dist/Table/TableFoot.d.ts.map +1 -1
- package/dist/Table/TableFoot.js +3 -3
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.d.ts +1 -2
- package/dist/Table/TableHead.d.ts.map +1 -1
- package/dist/Table/TableHead.js +3 -3
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +3 -3
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +2 -2
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.d.ts +2 -3
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +3 -3
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +2 -2
- package/dist/Table/TableToolbar.d.ts.map +1 -1
- package/dist/Table/TableToolbar.js +8 -8
- package/dist/Table/TableToolbar.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts +4 -4
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +14 -14
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts +1 -2
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +4 -4
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +3 -3
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.js +3 -3
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.d.ts +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +4 -4
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts +3 -3
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.d.ts.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/index.js +2 -2
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +5 -5
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +2 -2
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +4 -4
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +2 -2
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +11 -11
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/ThresholdsEditor/index.js +1 -1
- package/dist/ThresholdsEditor/index.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +2 -2
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +8 -8
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +4 -4
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +12 -19
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeRangeSelector/index.js +2 -2
- package/dist/TimeRangeSelector/index.js.map +1 -1
- package/dist/TimeRangeSelector/utils.d.ts +1 -1
- package/dist/TimeRangeSelector/utils.d.ts.map +1 -1
- package/dist/TimeRangeSelector/utils.js +3 -3
- package/dist/TimeRangeSelector/utils.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +4 -4
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +2 -2
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts +2 -2
- package/dist/TimeSeriesTooltip/SeriesMarker.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +3 -3
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +6 -6
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +8 -8
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts +2 -2
- package/dist/TimeSeriesTooltip/TooltipContent.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +4 -4
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +2 -3
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -6
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +10 -10
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +5 -5
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +5 -5
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.d.ts +4 -4
- package/dist/TimeSeriesTooltip/utils.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +1 -1
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/TimeZoneSelector.d.ts +3 -3
- package/dist/TimeZoneSelector.d.ts.map +1 -1
- package/dist/TimeZoneSelector.js +8 -5
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.d.ts +1 -2
- package/dist/ToolbarIconButton/ToolbarIconButton.d.ts.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +3 -3
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/ToolbarIconButton/index.js +1 -1
- package/dist/ToolbarIconButton/index.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts +3 -3
- package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +92 -3
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts +2 -2
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +8 -8
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts +3 -3
- package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +5 -5
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/TransformsEditor/index.js +1 -1
- package/dist/TransformsEditor/index.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +3 -3
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +5 -5
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +2 -2
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +4 -4
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/index.js +1 -1
- package/dist/ValueMappingEditor/index.js.map +1 -1
- package/dist/YAxisLabel.d.ts +1 -1
- package/dist/YAxisLabel.d.ts.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/context/ChartsProvider.d.ts +4 -3
- package/dist/context/ChartsProvider.d.ts.map +1 -1
- package/dist/context/ChartsProvider.js +2 -2
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.d.ts +1 -1
- package/dist/context/ItemActionsProvider.d.ts.map +1 -1
- package/dist/context/ItemActionsProvider.js +2 -2
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.d.ts +1 -1
- package/dist/context/SelectionProvider.d.ts.map +1 -1
- package/dist/context/SelectionProvider.js +2 -2
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.d.ts +2 -1
- package/dist/context/SnackbarProvider.d.ts.map +1 -1
- package/dist/context/SnackbarProvider.js +3 -3
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.d.ts +2 -1
- package/dist/context/TimeZoneProvider.d.ts.map +1 -1
- package/dist/context/TimeZoneProvider.js +3 -3
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/context/index.js +5 -5
- package/dist/context/index.js.map +1 -1
- package/dist/controls/TextField.d.ts +1 -2
- package/dist/controls/TextField.d.ts.map +1 -1
- package/dist/controls/TextField.js +4 -4
- package/dist/controls/TextField.js.map +1 -1
- package/dist/controls/index.js +1 -1
- package/dist/controls/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -38
- package/dist/index.js.map +1 -1
- package/dist/model/action.d.ts +1 -1
- package/dist/model/action.d.ts.map +1 -1
- package/dist/model/action.js.map +1 -1
- package/dist/model/bits.d.ts +1 -1
- package/dist/model/bits.d.ts.map +1 -1
- package/dist/model/bits.js +4 -4
- package/dist/model/bits.js.map +1 -1
- package/dist/model/bytes.d.ts +1 -1
- package/dist/model/bytes.d.ts.map +1 -1
- package/dist/model/bytes.js +4 -4
- package/dist/model/bytes.js.map +1 -1
- package/dist/model/currency.d.ts +1 -1
- package/dist/model/currency.d.ts.map +1 -1
- package/dist/model/currency.js +4 -4
- package/dist/model/currency.js.map +1 -1
- package/dist/model/date.d.ts +1 -1
- package/dist/model/date.d.ts.map +1 -1
- package/dist/model/date.js.map +1 -1
- package/dist/model/decimal.d.ts +1 -1
- package/dist/model/decimal.d.ts.map +1 -1
- package/dist/model/decimal.js +3 -3
- package/dist/model/decimal.js.map +1 -1
- package/dist/model/formatterCache.js.map +1 -1
- package/dist/model/graph.d.ts +3 -3
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.js +21 -21
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +3 -3
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/percent.d.ts +1 -1
- package/dist/model/percent.d.ts.map +1 -1
- package/dist/model/percent.js +3 -3
- package/dist/model/percent.js.map +1 -1
- package/dist/model/temperature.d.ts +1 -1
- package/dist/model/temperature.d.ts.map +1 -1
- package/dist/model/temperature.js +3 -3
- package/dist/model/temperature.js.map +1 -1
- package/dist/model/theme.d.ts +1 -1
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/throughput.d.ts +1 -1
- package/dist/model/throughput.d.ts.map +1 -1
- package/dist/model/throughput.js +5 -5
- package/dist/model/throughput.js.map +1 -1
- package/dist/model/time.d.ts +1 -1
- package/dist/model/time.d.ts.map +1 -1
- package/dist/model/time.js +3 -3
- package/dist/model/time.js.map +1 -1
- package/dist/model/timeOption.d.ts +1 -1
- package/dist/model/timeOption.d.ts.map +1 -1
- package/dist/model/timeOption.js +2 -2
- package/dist/model/timeOption.js.map +1 -1
- package/dist/model/transforms.d.ts +22 -1
- package/dist/model/transforms.d.ts.map +1 -1
- package/dist/model/transforms.js +2 -1
- package/dist/model/transforms.js.map +1 -1
- package/dist/model/types.d.ts +3 -3
- package/dist/model/types.d.ts.map +1 -1
- package/dist/model/types.js.map +1 -1
- package/dist/model/units.d.ts +51 -51
- package/dist/model/units.d.ts.map +1 -1
- package/dist/model/units.js +9 -9
- package/dist/model/units.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.d.ts +2 -2
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +2 -2
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.d.ts +1 -1
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +3 -2
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/theme.d.ts +2 -2
- package/dist/test-utils/theme.d.ts.map +1 -1
- package/dist/test-utils/theme.js +2 -2
- package/dist/test-utils/theme.js.map +1 -1
- package/dist/theme/component-overrides/alert.d.ts +1 -1
- package/dist/theme/component-overrides/alert.d.ts.map +1 -1
- package/dist/theme/component-overrides/alert.js +1 -1
- package/dist/theme/component-overrides/alert.js.map +1 -1
- package/dist/theme/component-overrides/paper.d.ts +1 -1
- package/dist/theme/component-overrides/paper.d.ts.map +1 -1
- package/dist/theme/component-overrides/paper.js.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -2
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/palette/background.d.ts +1 -1
- package/dist/theme/palette/background.d.ts.map +1 -1
- package/dist/theme/palette/background.js +1 -1
- package/dist/theme/palette/background.js.map +1 -1
- package/dist/theme/palette/colors/blue.d.ts +1 -1
- package/dist/theme/palette/colors/blue.d.ts.map +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/green.d.ts +1 -1
- package/dist/theme/palette/colors/green.d.ts.map +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.d.ts +1 -1
- package/dist/theme/palette/colors/grey.d.ts.map +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js +8 -8
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.d.ts +1 -1
- package/dist/theme/palette/colors/orange.d.ts.map +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.d.ts +1 -1
- package/dist/theme/palette/colors/purple.d.ts.map +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.d.ts +1 -1
- package/dist/theme/palette/colors/red.d.ts.map +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/error.d.ts +1 -1
- package/dist/theme/palette/error.d.ts.map +1 -1
- package/dist/theme/palette/error.js +1 -1
- package/dist/theme/palette/error.js.map +1 -1
- package/dist/theme/palette/grey.d.ts +1 -1
- package/dist/theme/palette/grey.d.ts.map +1 -1
- package/dist/theme/palette/grey.js +1 -1
- package/dist/theme/palette/grey.js.map +1 -1
- package/dist/theme/palette/index.js +1 -1
- package/dist/theme/palette/index.js.map +1 -1
- package/dist/theme/palette/palette-options.d.ts +1 -1
- package/dist/theme/palette/palette-options.d.ts.map +1 -1
- package/dist/theme/palette/palette-options.js +10 -10
- package/dist/theme/palette/palette-options.js.map +1 -1
- package/dist/theme/palette/primary.d.ts +1 -1
- package/dist/theme/palette/primary.d.ts.map +1 -1
- package/dist/theme/palette/primary.js +1 -1
- package/dist/theme/palette/primary.js.map +1 -1
- package/dist/theme/palette/secondary.d.ts +1 -1
- package/dist/theme/palette/secondary.d.ts.map +1 -1
- package/dist/theme/palette/secondary.js +1 -1
- package/dist/theme/palette/secondary.js.map +1 -1
- package/dist/theme/palette/success.d.ts +1 -1
- package/dist/theme/palette/success.d.ts.map +1 -1
- package/dist/theme/palette/success.js +1 -1
- package/dist/theme/palette/success.js.map +1 -1
- package/dist/theme/palette/text.d.ts +1 -1
- package/dist/theme/palette/text.d.ts.map +1 -1
- package/dist/theme/palette/text.js +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.d.ts +1 -1
- package/dist/theme/palette/warning.d.ts.map +1 -1
- package/dist/theme/palette/warning.js +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.d.ts +2 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +5 -5
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/types/ThemeExtension.d.js +2 -1
- package/dist/theme/types/ThemeExtension.d.js.map +1 -1
- package/dist/{cjs/model/theme.js → theme/types/fonts.d.js} +2 -4
- package/dist/theme/types/fonts.d.js.map +1 -0
- package/dist/theme/typography.d.ts +1 -1
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +6 -6
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +1 -1
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +2 -2
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/browser-storage.js +1 -1
- package/dist/utils/browser-storage.js.map +1 -1
- package/dist/utils/chart-actions.d.ts +3 -3
- package/dist/utils/chart-actions.d.ts.map +1 -1
- package/dist/utils/chart-actions.js +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/combine-sx.d.ts +1 -1
- package/dist/utils/combine-sx.d.ts.map +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js +1 -1
- package/dist/utils/data-field-interpolation.js +1 -1
- package/dist/utils/data-field-interpolation.js.map +1 -1
- package/dist/utils/format.js +8 -3
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.js +19 -19
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.d.ts +1 -1
- package/dist/utils/mathjs.js +1 -1
- package/dist/utils/memo.d.ts +1 -1
- package/dist/utils/memo.d.ts.map +1 -1
- package/dist/utils/memo.js +2 -2
- package/dist/utils/memo.js.map +1 -1
- package/dist/utils/regexp.js +3 -1
- package/dist/utils/regexp.js.map +1 -1
- package/dist/utils/request-interpolation.d.ts +2 -2
- package/dist/utils/request-interpolation.d.ts.map +1 -1
- package/dist/utils/request-interpolation.js +2 -2
- package/dist/utils/request-interpolation.js.map +1 -1
- package/dist/utils/selection-interpolation.d.ts +2 -2
- package/dist/utils/selection-interpolation.d.ts.map +1 -1
- package/dist/utils/selection-interpolation.js +2 -2
- package/dist/utils/selection-interpolation.js.map +1 -1
- package/dist/utils/text.d.ts +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/theme-gen.d.ts +2 -2
- package/dist/utils/theme-gen.d.ts.map +1 -1
- package/dist/utils/theme-gen.js +1 -1
- package/dist/utils/theme-gen.js.map +1 -1
- package/dist/utils/time-series-data.d.ts +1 -1
- package/dist/utils/time-series-data.d.ts.map +1 -1
- package/dist/utils/time-series-data.js +1 -1
- package/dist/utils/time-series-data.js.map +1 -1
- package/dist/utils/trace-data.d.ts +2 -2
- package/dist/utils/trace-data.d.ts.map +1 -1
- package/dist/utils/trace-data.js.map +1 -1
- package/dist/utils/transform-data.d.ts +6 -1
- package/dist/utils/transform-data.d.ts.map +1 -1
- package/dist/utils/transform-data.js +97 -1
- package/dist/utils/transform-data.js.map +1 -1
- package/dist/utils/value-mapping.d.ts +1 -1
- package/dist/utils/value-mapping.d.ts.map +1 -1
- package/dist/utils/value-mapping.js +1 -1
- package/dist/utils/value-mapping.js.map +1 -1
- package/dist/utils/variable-interpolation.d.ts +20 -1
- package/dist/utils/variable-interpolation.d.ts.map +1 -1
- package/dist/utils/variable-interpolation.js +77 -1
- package/dist/utils/variable-interpolation.js.map +1 -1
- package/package.json +12 -12
- package/dist/cjs/AlignSelector/AlignSelector.js +0 -50
- package/dist/cjs/AlignSelector/index.js +0 -30
- package/dist/cjs/ColorPicker/ColorPicker.js +0 -106
- package/dist/cjs/ColorPicker/OptionsColorPicker.js +0 -92
- package/dist/cjs/ColorPicker/index.js +0 -31
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +0 -71
- package/dist/cjs/ContentWithLegend/index.js +0 -30
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +0 -122
- package/dist/cjs/DensitySelector/DensitySelector.js +0 -54
- package/dist/cjs/DensitySelector/index.js +0 -30
- package/dist/cjs/Dialog/Dialog.js +0 -102
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +0 -55
- package/dist/cjs/Dialog/index.js +0 -31
- package/dist/cjs/DragAndDrop/DragAndDropList.js +0 -159
- package/dist/cjs/DragAndDrop/DragButton.js +0 -123
- package/dist/cjs/DragAndDrop/DropIndicator.js +0 -52
- package/dist/cjs/DragAndDrop/index.js +0 -32
- package/dist/cjs/DragAndDrop/model.js +0 -25
- package/dist/cjs/Drawer/Drawer.js +0 -44
- package/dist/cjs/Drawer/index.js +0 -30
- package/dist/cjs/EChart/EChart.js +0 -203
- package/dist/cjs/EChart/index.js +0 -31
- package/dist/cjs/EChart/timezone-formatter.js +0 -49
- package/dist/cjs/ErrorAlert.js +0 -31
- package/dist/cjs/ErrorBoundary.js +0 -24
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +0 -132
- package/dist/cjs/FontSizeSelector/index.js +0 -30
- package/dist/cjs/FormEditor/FormActions.js +0 -83
- package/dist/cjs/FormEditor/index.js +0 -30
- package/dist/cjs/FormatControls/FormatControls.js +0 -119
- package/dist/cjs/FormatControls/UnitSelector.js +0 -55
- package/dist/cjs/FormatControls/index.js +0 -31
- package/dist/cjs/InfoTooltip/InfoTooltip.js +0 -86
- package/dist/cjs/InfoTooltip/index.js +0 -30
- package/dist/cjs/JSONEditor.js +0 -69
- package/dist/cjs/Legend/CompactLegend.js +0 -56
- package/dist/cjs/Legend/Legend.js +0 -131
- package/dist/cjs/Legend/LegendColorBadge.js +0 -39
- package/dist/cjs/Legend/ListLegend.js +0 -54
- package/dist/cjs/Legend/ListLegendItem.js +0 -84
- package/dist/cjs/Legend/TableLegend.js +0 -98
- package/dist/cjs/Legend/index.js +0 -31
- package/dist/cjs/Legend/legend-model.js +0 -27
- package/dist/cjs/LinksEditor/LinkEditorForm.js +0 -95
- package/dist/cjs/LinksEditor/index.js +0 -30
- package/dist/cjs/ModeSelector/ModeSelector.js +0 -51
- package/dist/cjs/ModeSelector/index.js +0 -30
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +0 -34
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +0 -95
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +0 -31
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +0 -59
- package/dist/cjs/OptionsEditorLayout/index.js +0 -33
- package/dist/cjs/Overlay/Overlay.js +0 -71
- package/dist/cjs/Overlay/index.js +0 -30
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +0 -68
- package/dist/cjs/RefreshIntervalPicker/index.js +0 -30
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +0 -82
- package/dist/cjs/SettingsAutocomplete/index.js +0 -30
- package/dist/cjs/SortSelector/SortSelector.js +0 -50
- package/dist/cjs/SortSelector/SortSelectorButtons.js +0 -50
- package/dist/cjs/SortSelector/index.js +0 -31
- package/dist/cjs/Table/InnerTable.js +0 -47
- package/dist/cjs/Table/Table.js +0 -222
- package/dist/cjs/Table/TableBody.js +0 -31
- package/dist/cjs/Table/TableCell.js +0 -153
- package/dist/cjs/Table/TableCheckbox.js +0 -57
- package/dist/cjs/Table/TableFoot.js +0 -31
- package/dist/cjs/Table/TableHead.js +0 -31
- package/dist/cjs/Table/TableHeaderCell.js +0 -93
- package/dist/cjs/Table/TableRow.js +0 -37
- package/dist/cjs/Table/TableToolbar.js +0 -151
- package/dist/cjs/Table/VirtualizedTable.js +0 -284
- package/dist/cjs/Table/VirtualizedTableContainer.js +0 -36
- package/dist/cjs/Table/hooks/useFuzzySearch.js +0 -67
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +0 -108
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +0 -89
- package/dist/cjs/Table/index.js +0 -31
- package/dist/cjs/Table/model/table-model.js +0 -138
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +0 -80
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +0 -282
- package/dist/cjs/ThresholdsEditor/index.js +0 -30
- package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +0 -204
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +0 -271
- package/dist/cjs/TimeRangeSelector/index.js +0 -31
- package/dist/cjs/TimeRangeSelector/utils.js +0 -72
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +0 -98
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +0 -107
- package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +0 -41
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +0 -113
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +0 -58
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +0 -168
- package/dist/cjs/TimeSeriesTooltip/index.js +0 -39
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +0 -454
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +0 -148
- package/dist/cjs/TimeSeriesTooltip/types.js +0 -16
- package/dist/cjs/TimeSeriesTooltip/utils.js +0 -199
- package/dist/cjs/TimeZoneSelector.js +0 -63
- package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +0 -40
- package/dist/cjs/ToolbarIconButton/index.js +0 -30
- package/dist/cjs/TransformsEditor/TransformEditor.js +0 -297
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +0 -131
- package/dist/cjs/TransformsEditor/TransformsEditor.js +0 -103
- package/dist/cjs/TransformsEditor/index.js +0 -30
- package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +0 -387
- package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +0 -131
- package/dist/cjs/ValueMappingEditor/index.js +0 -30
- package/dist/cjs/YAxisLabel.js +0 -50
- package/dist/cjs/context/ChartsProvider.js +0 -114
- package/dist/cjs/context/ItemActionsProvider.js +0 -111
- package/dist/cjs/context/SelectionProvider.js +0 -128
- package/dist/cjs/context/SnackbarProvider.js +0 -126
- package/dist/cjs/context/TimeZoneProvider.js +0 -98
- package/dist/cjs/context/index.js +0 -34
- package/dist/cjs/controls/TextField.js +0 -54
- package/dist/cjs/controls/index.js +0 -30
- package/dist/cjs/index.js +0 -67
- package/dist/cjs/model/action.js +0 -43
- package/dist/cjs/model/bits.js +0 -113
- package/dist/cjs/model/bytes.js +0 -115
- package/dist/cjs/model/constants.js +0 -23
- package/dist/cjs/model/currency.js +0 -126
- package/dist/cjs/model/date.js +0 -297
- package/dist/cjs/model/decimal.js +0 -72
- package/dist/cjs/model/formatterCache.js +0 -120
- package/dist/cjs/model/graph.js +0 -59
- package/dist/cjs/model/index.js +0 -50
- package/dist/cjs/model/legend.js +0 -101
- package/dist/cjs/model/percent.js +0 -82
- package/dist/cjs/model/temperature.js +0 -72
- package/dist/cjs/model/throughput.js +0 -161
- package/dist/cjs/model/time.js +0 -178
- package/dist/cjs/model/timeOption.js +0 -34
- package/dist/cjs/model/timeZoneOption.js +0 -34
- package/dist/cjs/model/transforms.js +0 -29
- package/dist/cjs/model/units.js +0 -186
- package/dist/cjs/model/utils.js +0 -48
- package/dist/cjs/model/value-mapping.js +0 -16
- package/dist/cjs/test/index.js +0 -30
- package/dist/cjs/test/render.js +0 -38
- package/dist/cjs/test/setup-tests.js +0 -20
- package/dist/cjs/test-utils/index.js +0 -30
- package/dist/cjs/test-utils/theme.js +0 -61
- package/dist/cjs/theme/component-overrides/alert.js +0 -104
- package/dist/cjs/theme/component-overrides/paper.js +0 -29
- package/dist/cjs/theme/index.js +0 -31
- package/dist/cjs/theme/palette/background.js +0 -46
- package/dist/cjs/theme/palette/colors/blue.js +0 -37
- package/dist/cjs/theme/palette/colors/common.js +0 -32
- package/dist/cjs/theme/palette/colors/green.js +0 -37
- package/dist/cjs/theme/palette/colors/grey.js +0 -37
- package/dist/cjs/theme/palette/colors/index.js +0 -37
- package/dist/cjs/theme/palette/colors/orange.js +0 -37
- package/dist/cjs/theme/palette/colors/purple.js +0 -37
- package/dist/cjs/theme/palette/colors/red.js +0 -37
- package/dist/cjs/theme/palette/colors/types.js +0 -16
- package/dist/cjs/theme/palette/error.js +0 -34
- package/dist/cjs/theme/palette/grey.js +0 -50
- package/dist/cjs/theme/palette/index.js +0 -30
- package/dist/cjs/theme/palette/palette-options.js +0 -61
- package/dist/cjs/theme/palette/primary.js +0 -34
- package/dist/cjs/theme/palette/secondary.js +0 -34
- package/dist/cjs/theme/palette/success.js +0 -34
- package/dist/cjs/theme/palette/text.js +0 -44
- package/dist/cjs/theme/palette/warning.js +0 -34
- package/dist/cjs/theme/theme.js +0 -90
- package/dist/cjs/theme/types/ThemeExtension.d.js +0 -17
- package/dist/cjs/theme/typography.js +0 -99
- package/dist/cjs/utils/axis.js +0 -122
- package/dist/cjs/utils/browser-storage.js +0 -62
- package/dist/cjs/utils/chart-actions.js +0 -180
- package/dist/cjs/utils/combine-sx.js +0 -31
- package/dist/cjs/utils/component-ids.js +0 -33
- package/dist/cjs/utils/data-field-interpolation.js +0 -230
- package/dist/cjs/utils/format.js +0 -127
- package/dist/cjs/utils/index.js +0 -48
- package/dist/cjs/utils/mathjs.js +0 -38
- package/dist/cjs/utils/memo.js +0 -64
- package/dist/cjs/utils/regexp.js +0 -54
- package/dist/cjs/utils/request-interpolation.js +0 -99
- package/dist/cjs/utils/selection-interpolation.js +0 -69
- package/dist/cjs/utils/text.js +0 -52
- package/dist/cjs/utils/theme-gen.js +0 -274
- package/dist/cjs/utils/time-series-data.js +0 -141
- package/dist/cjs/utils/trace-data.js +0 -25
- package/dist/cjs/utils/transform-data.js +0 -157
- package/dist/cjs/utils/types.js +0 -16
- package/dist/cjs/utils/value-mapping.js +0 -105
- package/dist/cjs/utils/variable-interpolation.js +0 -198
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DatapointInfo, TimeChartSeriesMapping } from '../model';
|
|
1
|
+
import type { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';
|
|
2
|
+
import type { ECharts as EChartsInstance } from 'echarts/core';
|
|
3
|
+
import type { DatapointInfo, TimeChartSeriesMapping } from '../model';
|
|
4
4
|
export interface ZoomEventData {
|
|
5
5
|
start: number;
|
|
6
6
|
end: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-actions.d.ts","sourceRoot":"","sources":["../../src/utils/chart-actions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chart-actions.d.ts","sourceRoot":"","sources":["../../src/utils/chart-actions.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGtE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAa3D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAKzD;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAYnE;AAOD,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,IAAI,CAYnH;AAOD,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,eAAe,EACtB,mBAAmB,EAAE,MAAM,EAAE,EAC7B,uBAAuB,EAAE,MAAM,EAAE,EACjC,0BAA0B,EAAE,MAAM,EAAE,EACpC,oBAAoB,EAAE,aAAa,EAAE,EACrC,mBAAmB,EAAE,aAAa,EAAE,GACnC,IAAI,CA0DN;AAKD,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,sBAAsB,GAAG,OAAO,CAGzF;AAMD,wBAAgB,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,oBAAoB,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB9G;AAKD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAapG"}
|
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import { PINNED_CROSSHAIR_SERIES_NAME } from
|
|
13
|
+
import { PINNED_CROSSHAIR_SERIES_NAME } from "../model/index.js";
|
|
14
14
|
/**
|
|
15
15
|
* Enable dataZoom without requring user to click toolbox icon.
|
|
16
16
|
* https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport { DatapointInfo, PINNED_CROSSHAIR_SERIES_NAME, TimeChartSeriesMapping } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[]\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Blanket downplay clears axis-triggered emphasis (enlarged \"big point\" markers) before\n // re-applying emphasis to only the winner series.\n // https://echarts.apache.org/en/api.html#action.downplay\n chart.dispatchAction({\n type: 'downplay',\n });\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n if (nonEmphasizedSeriesIndexes.length > 0) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n }\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAAwBA,4BAA4B,QAAgC,WAAW;AAO/F;;;CAGC,GACD,OAAO,SAASC,eAAeC,KAAsB;IACnD,MAAMC,aAAaD,KAAK,CAAC,SAAS;IAClC,IAAIC,eAAeC,WAAW;IAC9B,IAAID,WAAWE,MAAM,CAACC,OAAO,KAAKF,aAAaD,WAAWE,MAAM,CAACC,OAAO,CAACC,MAAM,GAAG,GAAG;QACnF,wGAAwG;QACxG,IAAIJ,WAAWE,MAAM,CAACC,OAAO,CAAC,EAAE,CAACE,OAAO,CAACC,QAAQ,CAACC,UAAU,CAACC,IAAI,KAAK,UAAU;YAC9ET,MAAMU,cAAc,CAAC;gBACnBC,MAAM;gBACNC,KAAK;gBACLC,sBAAsB;YACxB;QACF;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC,aAAad,KAAsB;IACjD,wEAAwE;IACxEA,MAAMU,cAAc,CAAC;QACnBC,MAAM;IACR;AACF;AA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oBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/chart-actions.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\n\nimport type { DatapointInfo, TimeChartSeriesMapping } from '../model';\nimport { PINNED_CROSSHAIR_SERIES_NAME } from '../model';\n\nexport interface ZoomEventData {\n start: number;\n end: number;\n}\n\n/**\n * Enable dataZoom without requring user to click toolbox icon.\n * https://stackoverflow.com/questions/57183297/is-there-a-way-to-use-zoom-of-type-select-without-showing-the-toolbar\n */\nexport function enableDataZoom(chart: EChartsInstance): void {\n const chartModel = chart['_model'];\n if (chartModel === undefined) return;\n if (chartModel.option.toolbox !== undefined && chartModel.option.toolbox.length > 0) {\n // check if hidden data zoom icon is unselected (if selected it would be 'emphasis' instead of 'normal')\n if (chartModel.option.toolbox[0].feature.dataZoom.iconStatus.zoom === 'normal') {\n chart.dispatchAction({\n type: 'takeGlobalCursor',\n key: 'dataZoomSelect',\n dataZoomSelectActive: true,\n });\n }\n }\n}\n\n/**\n * Restore chart to original state before zoom or other actions were dispatched\n */\nexport function restoreChart(chart: EChartsInstance): void {\n // TODO: support incremental unzoom instead of restore to original state\n chart.dispatchAction({\n type: 'restore', // https://echarts.apache.org/en/api.html#events.restore\n });\n}\n\n/*\n * Clear all highlighted series when cursor exits canvas\n * https://echarts.apache.org/en/api.html#action.downplay\n */\nexport function clearHighlightedSeries(chart: EChartsInstance): void {\n if (chart.dispatchAction !== undefined) {\n // Clear any selected data points\n chart.dispatchAction({\n type: 'unselect',\n });\n\n // Clear any highlighted series\n chart.dispatchAction({\n type: 'downplay',\n });\n }\n}\n\n/*\n * Convert a point from pixel coordinate to logical coordinate.\n * Used to determine if cursor is over chart canvas and closest datapoint.\n * https://echarts.apache.org/en/api.html#echartsInstance.convertFromPixel\n */\nexport function getPointInGrid(cursorCoordX: number, cursorCoordY: number, chart?: EChartsInstance): number[] | null {\n if (chart === undefined) {\n return null;\n }\n\n const pointInPixel = [cursorCoordX, cursorCoordY];\n if (!chart.containPixel('grid', pointInPixel)) {\n return null;\n }\n\n const pointInGrid: number[] = chart.convertFromPixel('grid', pointInPixel);\n return pointInGrid;\n}\n\n/*\n * TimeSeriesChart tooltip is built custom to support finding nearby series instead of single or all series.\n * This means ECharts actions need to be dispatched manually for series highlighting, datapoint select state, etc.\n * More info: https://echarts.apache.org/en/api.html#action\n */\nexport function batchDispatchNearbySeriesActions(\n chart: EChartsInstance,\n nearbySeriesIndexes: number[],\n emphasizedSeriesIndexes: number[],\n nonEmphasizedSeriesIndexes: number[],\n emphasizedDatapoints: DatapointInfo[],\n duplicateDatapoints: DatapointInfo[],\n): void {\n // Accounts for multiple series that are rendered direct on top of eachother.\n // Only applies select state to the datapoint that is visible to avoid color mismatch.\n const lastEmphasizedDatapoint =\n duplicateDatapoints.length > 0\n ? duplicateDatapoints[duplicateDatapoints.length - 1]\n : emphasizedDatapoints[emphasizedDatapoints.length - 1];\n if (lastEmphasizedDatapoint !== undefined) {\n // Corresponds to select options inside getTimeSeries util.\n // https://echarts.apache.org/en/option.html#series-line.select.itemStyle\n chart.dispatchAction({\n type: 'select',\n seriesIndex: lastEmphasizedDatapoint.seriesIndex,\n dataIndex: lastEmphasizedDatapoint.dataIndex,\n // Shared crosshair should not emphasize datapoints on adjacent charts.\n escapeConnect: true, // TODO: try to remove escapeConnect and match by seriesName for cross panel correlation\n });\n }\n\n // Blanket downplay clears axis-triggered emphasis (enlarged \"big point\" markers) before\n // re-applying emphasis to only the winner series.\n // https://echarts.apache.org/en/api.html#action.downplay\n chart.dispatchAction({\n type: 'downplay',\n });\n\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n if (nonEmphasizedSeriesIndexes.length > 0) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n }\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n\n // Clears selected datapoints since no bold series in tooltip, restore does not impact highlighting\n chart.dispatchAction({\n type: 'toggleSelect', // https://echarts.apache.org/en/api.html#action.toggleSelect\n });\n }\n}\n\n/*\n * Determine whether a markLine was pushed into the final series, which means crosshair was already pinned onClick\n */\nexport function checkCrosshairPinnedStatus(seriesMapping: TimeChartSeriesMapping): boolean {\n const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === PINNED_CROSSHAIR_SERIES_NAME;\n return isCrosshairPinned;\n}\n\n/*\n * Find closest timestamp to logical x coordinate returned from echartsInstance.convertFromPixel\n * Used to find nearby series in time series tooltip.\n */\nexport function getClosestTimestamp(timeSeriesValues?: TimeSeriesValueTuple[], cursorX?: number): number | null {\n if (timeSeriesValues === undefined || cursorX === undefined) {\n return null;\n }\n\n let currentClosestTimestamp: number | null = null;\n let currentClosestDistance = Infinity;\n\n for (const [timestamp] of timeSeriesValues) {\n const distance = Math.abs(timestamp - cursorX);\n if (distance < currentClosestDistance) {\n currentClosestTimestamp = timestamp;\n currentClosestDistance = distance;\n }\n }\n return currentClosestTimestamp;\n}\n\n/*\n * Find closest timestamp in full dataset, used to snap crosshair into place onClick when tooltip is pinned.\n */\nexport function getClosestTimestampInFullDataset(data: TimeSeries[], cursorX?: number): number | null {\n if (cursorX === undefined) {\n return null;\n }\n const totalSeries = data.length;\n let closestTimestamp = null;\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentDataset = totalSeries > 0 ? data[seriesIdx] : null;\n if (!currentDataset) break;\n const currentValues: TimeSeriesValueTuple[] = currentDataset.values;\n closestTimestamp = getClosestTimestamp(currentValues, cursorX);\n }\n return closestTimestamp;\n}\n"],"names":["PINNED_CROSSHAIR_SERIES_NAME","enableDataZoom","chart","chartModel","undefined","option","toolbox","length","feature","dataZoom","iconStatus","zoom","dispatchAction","type","key","dataZoomSelectActive","restoreChart","clearHighlightedSeries","getPointInGrid","cursorCoordX","cursorCoordY","pointInPixel","containPixel","pointInGrid","convertFromPixel","batchDispatchNearbySeriesActions","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","lastEmphasizedDatapoint","seriesIndex","dataIndex","escapeConnect","notBlur","checkCrosshairPinnedStatus","seriesMapping","isCrosshairPinned","name","getClosestTimestamp","timeSeriesValues","cursorX","currentClosestTimestamp","currentClosestDistance","Infinity","timestamp","distance","Math","abs","getClosestTimestampInFullDataset","data","totalSeries","closestTimestamp","seriesIdx","currentDataset","currentValues","values"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAMjC,SAASA,4BAA4B,QAAQ,oBAAW;AAOxD;;;CAGC,GACD,OAAO,SAASC,e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B;QAC1C,MAAMM,WAAWC,KAAKC,GAAG,CAACH,YAAYJ;QACtC,IAAIK,WAAWH,wBAAwB;YACrCD,0BAA0BG;YAC1BF,yBAAyBG;QAC3B;IACF;IACA,OAAOJ;AACT;AAEA;;CAEC,GACD,OAAO,SAASO,iCAAiCC,IAAkB,EAAET,OAAgB;IACnF,IAAIA,YAAYtC,WAAW;QACzB,OAAO;IACT;IACA,MAAMgD,cAAcD,KAAK5C,MAAM;IAC/B,IAAI8C,mBAAmB;IACvB,IAAK,IAAIC,YAAY,GAAGA,YAAYF,aAAaE,YAAa;QAC5D,MAAMC,iBAAiBH,cAAc,IAAID,IAAI,CAACG,UAAU,GAAG;QAC3D,IAAI,CAACC,gBAAgB;QACrB,MAAMC,gBAAwCD,eAAeE,MAAM;QACnEJ,mBAAmBb,oBAAoBgB,eAAed;IACxD;IACA,OAAOW;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SxProps, Theme } from '@mui/material';
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material';
|
|
2
2
|
/**
|
|
3
3
|
* Combines sx props from multiple sources. Useful when creating a component and
|
|
4
4
|
* you want consumers to be able to provide SxProps that should be combined with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine-sx.d.ts","sourceRoot":"","sources":["../../src/utils/combine-sx.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"combine-sx.d.ts","sourceRoot":"","sources":["../../src/utils/combine-sx.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAMvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/combine-sx.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { SxProps, Theme } from '@mui/material';\n\n/**\n * Combines sx props from multiple sources. Useful when creating a component and\n * you want consumers to be able to provide SxProps that should be combined with\n * some built-in styles.\n */\nexport function combineSx(...sxProps: Array<SxProps<Theme> | undefined>): SxProps<Theme> {\n return sxProps.flatMap((sx) => {\n if (sx === undefined) return [];\n if (Array.isArray(sx)) return sx;\n return [sx];\n });\n}\n"],"names":["combineSx","sxProps","flatMap","sx","undefined","Array","isArray"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;CAIC,GACD,OAAO,SAASA,UAAU,GAAGC,OAA0C;IACrE,OAAOA,QAAQC,OAAO,CAAC,CAACC;QACtB,IAAIA,OAAOC,WAAW,OAAO,EAAE;QAC/B,IAAIC,MAAMC,OAAO,CAACH,KAAK,OAAOA;QAC9B,OAAO;YAACA;SAAG;IACb;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/combine-sx.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { SxProps, Theme } from '@mui/material';\n\n/**\n * Combines sx props from multiple sources. Useful when creating a component and\n * you want consumers to be able to provide SxProps that should be combined with\n * some built-in styles.\n */\nexport function combineSx(...sxProps: Array<SxProps<Theme> | undefined>): SxProps<Theme> {\n return sxProps.flatMap((sx) => {\n if (sx === undefined) return [];\n if (Array.isArray(sx)) return sx;\n return [sx];\n });\n}\n"],"names":["combineSx","sxProps","flatMap","sx","undefined","Array","isArray"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;CAIC,GACD,OAAO,SAASA,UAAU,GAAGC,OAA0C;IACrE,OAAOA,QAAQC,OAAO,CAAC,CAACC;QACtB,IAAIA,OAAOC,WAAW,OAAO,EAAE;QAC/B,IAAIC,MAAMC,OAAO,CAACH,KAAK,OAAOA;QAC9B,OAAO;YAACA;SAAG;IACb;AACF"}
|
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import { useRef } from
|
|
13
|
+
import { useRef } from "react";
|
|
14
14
|
/**
|
|
15
15
|
* Generates a unique (stable) ID for a component. Should be replaced with React.useId once we support only React 18.
|
|
16
16
|
*/ export function useId(prefix) {
|
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import { interpolate, InterpolationFormat } from
|
|
13
|
+
import { interpolate, InterpolationFormat } from "./variable-interpolation.js";
|
|
14
14
|
// Regex patterns for data field interpolation
|
|
15
15
|
// Matches: ${__data.fields["fieldName"]} or ${__data.fields['fieldName']} or ${__data.fields.fieldName} with optional format ${__data.fields["fieldName"]:format}
|
|
16
16
|
const SINGLE_FIELD_REGEX = /\$\{__data\.fields(?:\[(?:"|')([^"']+)(?:"|')\]|\.([a-zA-Z_][a-zA-Z0-9_]*))(?::([a-z]+))?\}/g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/data-field-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { interpolate, InterpolationFormat } from './variable-interpolation';\n\n/**\n * Data item with its fields (used for selection/row data)\n */\nexport type DataItem = Record<string, unknown>;\n\n/**\n * Result of interpolation with data fields\n */\nexport interface InterpolationResult {\n text: string;\n errors?: string[];\n}\n\n/**\n * Options for data field replacement\n */\nexport interface ReplaceDataFieldsOptions {\n /**\n * Whether to URL encode values. Defaults to true.\n */\n urlEncode?: boolean;\n /**\n * Current index (0-based) for ${__data.index} replacement.\n */\n index?: number;\n /**\n * Total count for ${__data.count} replacement.\n */\n count?: number;\n}\n\n// Regex patterns for data field interpolation\n// Matches: ${__data.fields[\"fieldName\"]} or ${__data.fields['fieldName']} or ${__data.fields.fieldName} with optional format ${__data.fields[\"fieldName\"]:format}\nconst SINGLE_FIELD_REGEX =\n /\\$\\{__data\\.fields(?:\\[(?:\"|')([^\"']+)(?:\"|')\\]|\\.([a-zA-Z_][a-zA-Z0-9_]*))(?::([a-z]+))?\\}/g;\n\n// Matches: ${__data[0].fields[\"fieldName\"]} or ${__data[0].fields['fieldName']} for indexed access\nconst INDEXED_FIELD_REGEX = /\\$\\{__data\\[(\\d+)\\]\\.fields\\[(?:\"|')([^\"']+)(?:\"|')\\]\\}/g;\n\n// Matches: ${__data.index}\nconst DATA_INDEX_REGEX = /\\$\\{__data\\.index\\}/g;\n\n// Matches: ${__data.count}\nconst DATA_COUNT_REGEX = /\\$\\{__data\\.count\\}/g;\n\n// Matches: ${__data} or ${__data:format} or '${__data:format}' or \"${__data:format}\"\nconst FULL_DATA_REGEX = /(\"|')?\\$\\{__data(?::([a-z]+))?\\}(\"|')?/g;\n\n/**\n * Get field value from a data item, converting to string.\n * Supports nested field access using dot notation in field names (e.g., \"foo.bar\" accesses item.foo.bar).\n * For backward compatibility, first checks if the exact key exists before attempting nested access.\n */\nfunction getFieldValue(item: DataItem, fieldName: string): string {\n // First, try direct property access (for backward compatibility with literal dot keys)\n if (Object.prototype.hasOwnProperty.call(item, fieldName)) {\n const value = item[fieldName];\n if (value === undefined || value === null) {\n return '';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n return String(value);\n }\n\n // If not found and contains dots, try nested access\n if (fieldName.includes('.')) {\n const parts = fieldName.split('.');\n let current: unknown = item;\n\n for (const part of parts) {\n if (current === null || current === undefined) {\n return '';\n }\n if (typeof current !== 'object') {\n return '';\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n if (current === undefined || current === null) {\n return '';\n }\n if (typeof current === 'object') {\n return JSON.stringify(current);\n }\n return String(current);\n }\n\n // Field not found\n return '';\n}\n\n/**\n * Parse format string to InterpolationFormat enum\n */\nexport function parseFormat(format: string | undefined): InterpolationFormat | undefined {\n if (!format) return undefined;\n const lowerFormat = format.toLowerCase();\n return Object.values(InterpolationFormat).find((f) => f === lowerFormat);\n}\n\n/**\n * Replace data field placeholders in a template string with values from a single data item.\n *\n * Supports:\n * - ${__data.fields[\"fieldName\"]} - field value from the item (URL encoded by default)\n * - ${__data.fields[\"fieldName\"]:format} - field value with format specifier\n * - ${__data.index} - current index (0-based) if provided in options\n * - ${__data.count} - total count if provided in options\n * - ${__data} - full data array\n * - ${__data:format} - full data array with format specifier\n *\n * @param template - The template string with placeholders\n * @param item - The data item containing field values\n * @param options - Optional configuration for replacement behavior\n * @returns InterpolationResult with the interpolated text and any errors\n */\nexport function replaceDataFields(\n template: string,\n item: DataItem,\n options: ReplaceDataFieldsOptions = {}\n): InterpolationResult {\n const { urlEncode = true, index, count } = options;\n let result = template;\n const errors: string[] = [];\n\n // Replace ${__data.index} if provided\n if (index !== undefined) {\n result = result.replaceAll(DATA_INDEX_REGEX, String(index));\n }\n\n // Replace ${__data.count} if provided\n if (count !== undefined) {\n result = result.replaceAll(DATA_COUNT_REGEX, String(count));\n }\n\n // Replace full data placeholder with optional format: ${__data} or ${__data:format}\n result = result.replaceAll(\n FULL_DATA_REGEX,\n (_match, _leadingQuote: string | undefined, format: string | undefined, _trailingQuote: string | undefined) => {\n const interpolationFormat = parseFormat(format) ?? InterpolationFormat.RAW;\n let interpolationResult: string = '';\n\n if (interpolationFormat === InterpolationFormat.JSON) {\n interpolationResult = JSON.stringify(item);\n } else {\n interpolationResult = interpolate(\n Object.values(item).map((v) => JSON.stringify(v)),\n '',\n interpolationFormat\n );\n }\n\n return interpolationResult;\n }\n );\n\n // Reset regex lastIndex\n SINGLE_FIELD_REGEX.lastIndex = 0;\n\n // Replace __data.fields[\"fieldName\"] or __data.fields.fieldName patterns\n result = result.replaceAll(\n SINGLE_FIELD_REGEX,\n (_match, bracketField: string | undefined, dotField: string | undefined, format: string | undefined) => {\n const fieldName = bracketField ?? dotField ?? '';\n const value = getFieldValue(item, fieldName);\n if (value === '' && item[fieldName] === undefined) {\n errors.push(`Field \"${fieldName}\" not found in data`);\n }\n const interpolationFormat = parseFormat(format);\n if (interpolationFormat) {\n return interpolate([value], fieldName, interpolationFormat);\n }\n\n if (urlEncode) {\n // override: disable urlEncode for RAW format\n if (interpolationFormat === InterpolationFormat.RAW) {\n return value;\n }\n\n // avoid double encoding for queryparam and percentencode formats\n if (\n interpolationFormat !== InterpolationFormat.QUERYPARAM &&\n interpolationFormat !== InterpolationFormat.PERCENTENCODE\n ) {\n return encodeURIComponent(value);\n }\n }\n\n return value;\n }\n );\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n\n/**\n * Replace data field placeholders in a template string with values from multiple data items (batch mode).\n *\n * Supports:\n * - ${__data[0].fields[\"fieldName\"]} - field value from specific item by index\n * - ${__data.fields[\"fieldName\"]} - aggregated field values (defaults to CSV format)\n * - ${__data.fields[\"fieldName\"]:csv} - aggregated field values with format specifier\n * - ${__data.count} - total number of items\n * - ${__data} - full data array\n * - ${__data:format} - full data array with format specifier\n *\n * @param template - The template string with placeholders\n * @param items - Array of data items containing field values\n * @param options - Optional configuration for replacement behavior\n * @returns InterpolationResult with the interpolated text and any errors\n */\nexport function replaceDataFieldsBatch(\n template: string,\n items: DataItem[],\n options: ReplaceDataFieldsOptions = {}\n): InterpolationResult {\n const { urlEncode = true } = options;\n let result = template;\n const errors: string[] = [];\n\n // Replace __data.count with items length\n result = result.replaceAll(DATA_COUNT_REGEX, String(items.length));\n\n // Reset regex lastIndex\n INDEXED_FIELD_REGEX.lastIndex = 0;\n SINGLE_FIELD_REGEX.lastIndex = 0;\n\n // Replace full data placeholder with optional format\n result = result.replaceAll(\n FULL_DATA_REGEX,\n (_match, leadingQuote: string | undefined, format: string | undefined, trailingQuote: string | undefined) => {\n const interpolationFormat = parseFormat(format) ?? InterpolationFormat.RAW;\n\n const interpolationResult = interpolate(\n Object.values(items).map((e) => JSON.stringify(e)),\n '',\n interpolationFormat\n );\n\n if (!leadingQuote || !trailingQuote) {\n // preserve quotes as they were not surrounding the full_data pattern\n return `${leadingQuote ?? ''}${interpolationResult}${trailingQuote ?? ''}`;\n }\n\n return interpolationResult;\n }\n );\n\n // Replace indexed access: ${__data[0].fields[\"fieldName\"]} or ${__data[0].fields['fieldName']}\n result = result.replaceAll(INDEXED_FIELD_REGEX, (match, indexStr: string, fieldName: string) => {\n const idx = parseInt(indexStr, 10);\n if (idx < 0 || idx >= items.length) {\n errors.push(`Index ${idx} out of bounds (0-${items.length - 1})`);\n return match;\n }\n const value = getFieldValue(items[idx]!, fieldName);\n if (value === '' && items[idx]![fieldName] === undefined) {\n errors.push(`Field \"${fieldName}\" not found in data at index ${idx}`);\n }\n return urlEncode ? encodeURIComponent(value) : value;\n });\n\n // Replace aggregated access with format: ${__data.fields[\"fieldName\"]:csv} or ${__data.fields.fieldName:csv}\n result = result.replaceAll(\n SINGLE_FIELD_REGEX,\n (_match, bracketField: string | undefined, dotField: string | undefined, format: string | undefined) => {\n const fieldName = bracketField ?? dotField ?? '';\n const values = items.map((item) => getFieldValue(item, fieldName));\n const interpolationFormat = parseFormat(format) || InterpolationFormat.CSV;\n return interpolate(values, fieldName, interpolationFormat);\n }\n );\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n\n/**\n * Check if a template contains batch-only patterns (indexed access or format specifiers)\n */\nexport function hasBatchPatterns(template: string): boolean {\n // Reset regex lastIndex\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return (\n INDEXED_FIELD_REGEX.test(template) ||\n /\\$\\{__data\\.fields(?:\\[[\"'][^\"']+[\"']\\]|\\.[a-zA-Z_][a-zA-Z0-9_]*):[a-z]+\\}/.test(template)\n );\n}\n\n/**\n * Check if a template contains indexed access patterns\n */\nexport function hasIndexedPatterns(template: string): boolean {\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return INDEXED_FIELD_REGEX.test(template);\n}\n\n/**\n * Check if a template contains data field patterns\n */\nexport function hasDataFieldPatterns(template: string): boolean {\n SINGLE_FIELD_REGEX.lastIndex = 0;\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return SINGLE_FIELD_REGEX.test(template) || INDEXED_FIELD_REGEX.test(template);\n}\n\n/**\n * Extract all field names referenced in a template\n */\nexport function extractFieldNames(template: string): string[] {\n const fields = new Set<string>();\n\n // Reset regex lastIndex\n SINGLE_FIELD_REGEX.lastIndex = 0;\n INDEXED_FIELD_REGEX.lastIndex = 0;\n\n let match;\n while ((match = SINGLE_FIELD_REGEX.exec(template)) !== null) {\n // Group 1 is bracket notation, group 2 is dot notation\n fields.add(match[1] ?? match[2]!);\n }\n while ((match = INDEXED_FIELD_REGEX.exec(template)) !== null) {\n fields.add(match[2]!);\n }\n\n return Array.from(fields);\n}\n"],"names":["interpolate","InterpolationFormat","SINGLE_FIELD_REGEX","INDEXED_FIELD_REGEX","DATA_INDEX_REGEX","DATA_COUNT_REGEX","FULL_DATA_REGEX","getFieldValue","item","fieldName","Object","prototype","hasOwnProperty","call","value","undefined","JSON","stringify","String","includes","parts","split","current","part","parseFormat","format","lowerFormat","toLowerCase","values","find","f","replaceDataFields","template","options","urlEncode","index","count","result","errors","replaceAll","_match","_leadingQuote","_trailingQuote","interpolationFormat","RAW","interpolationResult","map","v","lastIndex","bracketField","dotField","push","QUERYPARAM","PERCENTENCODE","encodeURIComponent","text","length","replaceDataFieldsBatch","items","leadingQuote","trailingQuote","e","match","indexStr","idx","parseInt","CSV","hasBatchPatterns","test","hasIndexedPatterns","hasDataFieldPatterns","extractFieldNames","fields","Set","exec","add","Array","from"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,2BAA2B;AAiC5E,8CAA8C;AAC9C,kKAAkK;AAClK,MAAMC,qBACJ;AAEF,mGAAmG;AACnG,MAAMC,sBAAsB;AAE5B,2BAA2B;AAC3B,MAAMC,mBAAmB;AAEzB,2BAA2B;AAC3B,MAAMC,mBAAmB;AAEzB,qFAAqF;AACrF,MAAMC,kBAAkB;A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wBAAwB;IACxBvE,mBAAmB8C,SAAS,GAAG;IAC/B7C,oBAAoB6C,SAAS,GAAG;IAEhC,IAAIc;IACJ,MAAO,AAACA,CAAAA,QAAQ5D,mBAAmBwE,IAAI,CAAC1C,SAAQ,MAAO,KAAM;QAC3D,uDAAuD;QACvDwC,OAAOG,GAAG,CAACb,KAAK,CAAC,EAAE,IAAIA,KAAK,CAAC,EAAE;IACjC;IACA,MAAO,AAACA,CAAAA,QAAQ3D,oBAAoBuE,IAAI,CAAC1C,SAAQ,MAAO,KAAM;QAC5DwC,OAAOG,GAAG,CAACb,KAAK,CAAC,EAAE;IACrB;IAEA,OAAOc,MAAMC,IAAI,CAACL;AACpB"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/data-field-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { interpolate, InterpolationFormat } from './variable-interpolation';\n\n/**\n * Data item with its fields (used for selection/row data)\n */\nexport type DataItem = Record<string, unknown>;\n\n/**\n * Result of interpolation with data fields\n */\nexport interface InterpolationResult {\n text: string;\n errors?: string[];\n}\n\n/**\n * Options for data field replacement\n */\nexport interface ReplaceDataFieldsOptions {\n /**\n * Whether to URL encode values. Defaults to true.\n */\n urlEncode?: boolean;\n /**\n * Current index (0-based) for ${__data.index} replacement.\n */\n index?: number;\n /**\n * Total count for ${__data.count} replacement.\n */\n count?: number;\n}\n\n// Regex patterns for data field interpolation\n// Matches: ${__data.fields[\"fieldName\"]} or ${__data.fields['fieldName']} or ${__data.fields.fieldName} with optional format ${__data.fields[\"fieldName\"]:format}\nconst SINGLE_FIELD_REGEX =\n /\\$\\{__data\\.fields(?:\\[(?:\"|')([^\"']+)(?:\"|')\\]|\\.([a-zA-Z_][a-zA-Z0-9_]*))(?::([a-z]+))?\\}/g;\n\n// Matches: ${__data[0].fields[\"fieldName\"]} or ${__data[0].fields['fieldName']} for indexed access\nconst INDEXED_FIELD_REGEX = /\\$\\{__data\\[(\\d+)\\]\\.fields\\[(?:\"|')([^\"']+)(?:\"|')\\]\\}/g;\n\n// Matches: ${__data.index}\nconst DATA_INDEX_REGEX = /\\$\\{__data\\.index\\}/g;\n\n// Matches: ${__data.count}\nconst DATA_COUNT_REGEX = /\\$\\{__data\\.count\\}/g;\n\n// Matches: ${__data} or ${__data:format} or '${__data:format}' or \"${__data:format}\"\nconst FULL_DATA_REGEX = /(\"|')?\\$\\{__data(?::([a-z]+))?\\}(\"|')?/g;\n\n/**\n * Get field value from a data item, converting to string.\n * Supports nested field access using dot notation in field names (e.g., \"foo.bar\" accesses item.foo.bar).\n * For backward compatibility, first checks if the exact key exists before attempting nested access.\n */\nfunction getFieldValue(item: DataItem, fieldName: string): string {\n // First, try direct property access (for backward compatibility with literal dot keys)\n if (Object.prototype.hasOwnProperty.call(item, fieldName)) {\n const value = item[fieldName];\n if (value === undefined || value === null) {\n return '';\n }\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n return String(value);\n }\n\n // If not found and contains dots, try nested access\n if (fieldName.includes('.')) {\n const parts = fieldName.split('.');\n let current: unknown = item;\n\n for (const part of parts) {\n if (current === null || current === undefined) {\n return '';\n }\n if (typeof current !== 'object') {\n return '';\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n if (current === undefined || current === null) {\n return '';\n }\n if (typeof current === 'object') {\n return JSON.stringify(current);\n }\n return String(current);\n }\n\n // Field not found\n return '';\n}\n\n/**\n * Parse format string to InterpolationFormat enum\n */\nexport function parseFormat(format: string | undefined): InterpolationFormat | undefined {\n if (!format) return undefined;\n const lowerFormat = format.toLowerCase();\n return Object.values(InterpolationFormat).find((f) => f === lowerFormat);\n}\n\n/**\n * Replace data field placeholders in a template string with values from a single data item.\n *\n * Supports:\n * - ${__data.fields[\"fieldName\"]} - field value from the item (URL encoded by default)\n * - ${__data.fields[\"fieldName\"]:format} - field value with format specifier\n * - ${__data.index} - current index (0-based) if provided in options\n * - ${__data.count} - total count if provided in options\n * - ${__data} - full data array\n * - ${__data:format} - full data array with format specifier\n *\n * @param template - The template string with placeholders\n * @param item - The data item containing field values\n * @param options - Optional configuration for replacement behavior\n * @returns InterpolationResult with the interpolated text and any errors\n */\nexport function replaceDataFields(\n template: string,\n item: DataItem,\n options: ReplaceDataFieldsOptions = {},\n): InterpolationResult {\n const { urlEncode = true, index, count } = options;\n let result = template;\n const errors: string[] = [];\n\n // Replace ${__data.index} if provided\n if (index !== undefined) {\n result = result.replaceAll(DATA_INDEX_REGEX, String(index));\n }\n\n // Replace ${__data.count} if provided\n if (count !== undefined) {\n result = result.replaceAll(DATA_COUNT_REGEX, String(count));\n }\n\n // Replace full data placeholder with optional format: ${__data} or ${__data:format}\n result = result.replaceAll(\n FULL_DATA_REGEX,\n (_match, _leadingQuote: string | undefined, format: string | undefined, _trailingQuote: string | undefined) => {\n const interpolationFormat = parseFormat(format) ?? InterpolationFormat.RAW;\n let interpolationResult: string = '';\n\n if (interpolationFormat === InterpolationFormat.JSON) {\n interpolationResult = JSON.stringify(item);\n } else {\n interpolationResult = interpolate(\n Object.values(item).map((v) => JSON.stringify(v)),\n '',\n interpolationFormat,\n );\n }\n\n return interpolationResult;\n },\n );\n\n // Reset regex lastIndex\n SINGLE_FIELD_REGEX.lastIndex = 0;\n\n // Replace __data.fields[\"fieldName\"] or __data.fields.fieldName patterns\n result = result.replaceAll(\n SINGLE_FIELD_REGEX,\n (_match, bracketField: string | undefined, dotField: string | undefined, format: string | undefined) => {\n const fieldName = bracketField ?? dotField ?? '';\n const value = getFieldValue(item, fieldName);\n if (value === '' && item[fieldName] === undefined) {\n errors.push(`Field \"${fieldName}\" not found in data`);\n }\n const interpolationFormat = parseFormat(format);\n if (interpolationFormat) {\n return interpolate([value], fieldName, interpolationFormat);\n }\n\n if (urlEncode) {\n // override: disable urlEncode for RAW format\n if (interpolationFormat === InterpolationFormat.RAW) {\n return value;\n }\n\n // avoid double encoding for queryparam and percentencode formats\n if (\n interpolationFormat !== InterpolationFormat.QUERYPARAM &&\n interpolationFormat !== InterpolationFormat.PERCENTENCODE\n ) {\n return encodeURIComponent(value);\n }\n }\n\n return value;\n },\n );\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n\n/**\n * Replace data field placeholders in a template string with values from multiple data items (batch mode).\n *\n * Supports:\n * - ${__data[0].fields[\"fieldName\"]} - field value from specific item by index\n * - ${__data.fields[\"fieldName\"]} - aggregated field values (defaults to CSV format)\n * - ${__data.fields[\"fieldName\"]:csv} - aggregated field values with format specifier\n * - ${__data.count} - total number of items\n * - ${__data} - full data array\n * - ${__data:format} - full data array with format specifier\n *\n * @param template - The template string with placeholders\n * @param items - Array of data items containing field values\n * @param options - Optional configuration for replacement behavior\n * @returns InterpolationResult with the interpolated text and any errors\n */\nexport function replaceDataFieldsBatch(\n template: string,\n items: DataItem[],\n options: ReplaceDataFieldsOptions = {},\n): InterpolationResult {\n const { urlEncode = true } = options;\n let result = template;\n const errors: string[] = [];\n\n // Replace __data.count with items length\n result = result.replaceAll(DATA_COUNT_REGEX, String(items.length));\n\n // Reset regex lastIndex\n INDEXED_FIELD_REGEX.lastIndex = 0;\n SINGLE_FIELD_REGEX.lastIndex = 0;\n\n // Replace full data placeholder with optional format\n result = result.replaceAll(\n FULL_DATA_REGEX,\n (_match, leadingQuote: string | undefined, format: string | undefined, trailingQuote: string | undefined) => {\n const interpolationFormat = parseFormat(format) ?? InterpolationFormat.RAW;\n\n const interpolationResult = interpolate(\n Object.values(items).map((e) => JSON.stringify(e)),\n '',\n interpolationFormat,\n );\n\n if (!leadingQuote || !trailingQuote) {\n // preserve quotes as they were not surrounding the full_data pattern\n return `${leadingQuote ?? ''}${interpolationResult}${trailingQuote ?? ''}`;\n }\n\n return interpolationResult;\n },\n );\n\n // Replace indexed access: ${__data[0].fields[\"fieldName\"]} or ${__data[0].fields['fieldName']}\n result = result.replaceAll(INDEXED_FIELD_REGEX, (match, indexStr: string, fieldName: string) => {\n const idx = parseInt(indexStr, 10);\n if (idx < 0 || idx >= items.length) {\n errors.push(`Index ${idx} out of bounds (0-${items.length - 1})`);\n return match;\n }\n const value = getFieldValue(items[idx]!, fieldName);\n if (value === '' && items[idx]![fieldName] === undefined) {\n errors.push(`Field \"${fieldName}\" not found in data at index ${idx}`);\n }\n return urlEncode ? encodeURIComponent(value) : value;\n });\n\n // Replace aggregated access with format: ${__data.fields[\"fieldName\"]:csv} or ${__data.fields.fieldName:csv}\n result = result.replaceAll(\n SINGLE_FIELD_REGEX,\n (_match, bracketField: string | undefined, dotField: string | undefined, format: string | undefined) => {\n const fieldName = bracketField ?? dotField ?? '';\n const values = items.map((item) => getFieldValue(item, fieldName));\n const interpolationFormat = parseFormat(format) || InterpolationFormat.CSV;\n return interpolate(values, fieldName, interpolationFormat);\n },\n );\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n\n/**\n * Check if a template contains batch-only patterns (indexed access or format specifiers)\n */\nexport function hasBatchPatterns(template: string): boolean {\n // Reset regex lastIndex\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return (\n INDEXED_FIELD_REGEX.test(template) ||\n /\\$\\{__data\\.fields(?:\\[[\"'][^\"']+[\"']\\]|\\.[a-zA-Z_][a-zA-Z0-9_]*):[a-z]+\\}/.test(template)\n );\n}\n\n/**\n * Check if a template contains indexed access patterns\n */\nexport function hasIndexedPatterns(template: string): boolean {\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return INDEXED_FIELD_REGEX.test(template);\n}\n\n/**\n * Check if a template contains data field patterns\n */\nexport function hasDataFieldPatterns(template: string): boolean {\n SINGLE_FIELD_REGEX.lastIndex = 0;\n INDEXED_FIELD_REGEX.lastIndex = 0;\n return SINGLE_FIELD_REGEX.test(template) || INDEXED_FIELD_REGEX.test(template);\n}\n\n/**\n * Extract all field names referenced in a template\n */\nexport function extractFieldNames(template: string): string[] {\n const fields = new Set<string>();\n\n // Reset regex lastIndex\n SINGLE_FIELD_REGEX.lastIndex = 0;\n INDEXED_FIELD_REGEX.lastIndex = 0;\n\n let match;\n while ((match = SINGLE_FIELD_REGEX.exec(template)) !== null) {\n // Group 1 is bracket notation, group 2 is dot notation\n fields.add(match[1] ?? match[2]!);\n }\n while ((match = INDEXED_FIELD_REGEX.exec(template)) !== null) {\n fields.add(match[2]!);\n }\n\n return Array.from(fields);\n}\n"],"names":["interpolate","InterpolationFormat","SINGLE_FIELD_REGEX","INDEXED_FIELD_REGEX","DATA_INDEX_REGEX","DATA_COUNT_REGEX","FULL_DATA_REGEX","getFieldValue","item","fieldName","Object","prototype","hasOwnProperty","call","value","undefined","JSON","stringify","String","includes","parts","split","current","part","parseFormat","format","lowerFormat","toLowerCase","values","find","f","replaceDataFields","template","options","urlEncode","index","count","result","errors","replaceAll","_match","_leadingQuote","_trailingQuote","interpolationFormat","RAW","interpolationResult","map","v","lastIndex","bracketField","dotField","push","QUERYPARAM","PERCENTENCODE","encodeURIComponent","text","length","replaceDataFieldsBatch","items","leadingQuote","trailingQuote","e","match","indexStr","idx","parseInt","CSV","hasBatchPatterns","test","hasIndexedPatterns","hasDataFieldPatterns","extractFieldNames","fields","Set","exec","add","Array","from"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,mBAAmB,QAAQ,8BAA2B;AAiC5E,8CAA8C;AAC9C,kKAAkK;AAClK,MAAMC,qBACJ;AAEF,mGAAmG;AACnG,MAAMC,sBAAsB;AAE5B,2BAA2B;AAC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AACpC;AACvE;AAEA;;CAEC,GACD,OAAO,SAASuC,kBAAkBvC,QAAgB;IAChD,MAAMwC,SAAS,IAAIC;IAEnB,wBAAwB;IACxBvE,mBAAmB8C,SAAS,GAAG;IAC/B7C,oBAAoB6C,SAAS,GAAG;IAEhC,IAAIc;IACJ,MAAO,AAACA,CAAAA,QAAQ5D,mBAAmBwE,IAAI,CAAC1C,SAAQ,MAAO,KAAM;QAC3D,uDAAuD;QACvDwC,OAAOG,GAAG,CAACb,KAAK,CAAC,EAAE,IAAIA,KAAK,CAAC,EAAE;IACjC;IACA,MAAO,AAACA,CAAAA,QAAQ3D,oBAAoBuE,IAAI,CAAC1C,SAAQ,MAAO,KAAM;QAC5DwC,OAAOG,GAAG,CAACb,KAAK,CAAC,EAAE;IACrB;IAEA,OAAOc,MAAMC,IAAI,CAACL;AACpB"}
|
package/dist/utils/format.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
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
|
-
import { tz } from
|
|
14
|
-
import { format } from
|
|
13
|
+
import { tz } from "@date-fns/tz";
|
|
14
|
+
import { format } from "date-fns";
|
|
15
15
|
export function dateFormatOptionsWithTimeZone(dateFormatOptions, timeZone) {
|
|
16
16
|
/*
|
|
17
17
|
* if timeZone is provided, and is not local|browser,
|
|
@@ -44,7 +44,12 @@ export function formatWithTimeZone(date, formatString, timeZone) {
|
|
|
44
44
|
}
|
|
45
45
|
export function getGMTOffset(timeZone) {
|
|
46
46
|
const lower = timeZone?.toLowerCase();
|
|
47
|
-
|
|
47
|
+
let resolvedTimeZone = timeZone;
|
|
48
|
+
if (!timeZone || lower === 'local' || lower === 'browser') {
|
|
49
|
+
resolvedTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
50
|
+
} else if (lower === 'utc') {
|
|
51
|
+
resolvedTimeZone = 'UTC';
|
|
52
|
+
}
|
|
48
53
|
try {
|
|
49
54
|
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
50
55
|
timeZone: resolvedTimeZone,
|
package/dist/utils/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { tz } from '@date-fns/tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(\n dateFormatOptions: Intl.DateTimeFormatOptions,\n timeZone?: string
|
|
1
|
+
{"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { tz } from '@date-fns/tz';\nimport { format } from 'date-fns';\n\nexport function dateFormatOptionsWithTimeZone(\n dateFormatOptions: Intl.DateTimeFormatOptions,\n timeZone?: string,\n): Intl.DateTimeFormatOptions {\n /*\n * if timeZone is provided, and is not local|browser,\n * then set timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, default to browser timeZone setting\n */\n if (timeZone) {\n const lowerTimeZone = timeZone.toLowerCase();\n if (lowerTimeZone !== 'local' && lowerTimeZone !== 'browser') {\n return {\n ...dateFormatOptions,\n timeZone: lowerTimeZone === 'utc' ? 'UTC' : timeZone,\n };\n }\n }\n return dateFormatOptions;\n}\n\nexport function formatWithTimeZone(date: Date, formatString: string, timeZone?: string): string {\n /*\n * if timeZone is provided, and is not local|browser,\n * then format using timeZone option (recognize UTC regardless of uppercase/lowercase)\n * otherwise, format without timeZone option, defaulting to browser timeZone setting\n */\n const lowerTimeZone = timeZone?.toLowerCase();\n if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {\n return format(date, formatString);\n } else {\n return format(date, formatString, { in: tz(lowerTimeZone === 'utc' ? 'UTC' : timeZone) });\n }\n}\n\nexport function getGMTOffset(timeZone?: string): string {\n const lower = timeZone?.toLowerCase();\n\n let resolvedTimeZone = timeZone;\n if (!timeZone || lower === 'local' || lower === 'browser') {\n resolvedTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n } else if (lower === 'utc') {\n resolvedTimeZone = 'UTC';\n }\n\n try {\n const formatter = new Intl.DateTimeFormat('en-US', {\n timeZone: resolvedTimeZone,\n timeZoneName: 'shortOffset',\n });\n\n const parts = formatter.formatToParts(new Date());\n const tzPart = parts.find((p) => p.type === 'timeZoneName');\n\n const value = tzPart?.value ?? '';\n\n if (value === 'GMT') return 'GMT+0';\n return value;\n } catch {\n return 'GMT+0';\n }\n}\n\n// https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter\nexport function getFormattedAxisLabel(rangeMs: number):\n | string\n | {\n month: '{MMM}';\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}';\n day: '{MM}/{dd}';\n } {\n const dayMs = 86400000;\n const monthMs = 2629440000;\n const yearMs = 31536000000;\n\n // more than 5 years\n if (rangeMs > yearMs * 5) {\n return '{yyyy}';\n }\n\n // more than 2 years\n if (rangeMs > yearMs * 2) {\n return '{MMM} {yyyy}';\n }\n\n // between 5 days to 6 months\n if (rangeMs > dayMs * 5 && rangeMs < monthMs * 6) {\n return '{MM}/{dd}'; // 12/01\n }\n\n // between 2 and 5 days\n if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 5) {\n return '{MM}/{dd} {HH}:{mm}'; // 12/01 12:30\n }\n\n return {\n year: '{yearStyle|{yyyy}}\\n{monthStyle|{MMM}}',\n month: '{MMM}', // Jan, Feb, ...\n day: '{MM}/{dd}',\n };\n}\n\ninterface FormattedDateTime {\n formattedDate: string;\n formattedTime: string;\n}\n\nexport const getDateAndTime = (\n timeMs?: number,\n customFormat?: (date: Date, format: string) => string,\n): FormattedDateTime => {\n if (!timeMs) {\n return { formattedDate: '', formattedTime: '' };\n }\n const date = new Date(timeMs);\n return {\n formattedDate: customFormat ? customFormat(date, 'MMM dd, yyyy') : format(date, 'MMM dd, yyyy'),\n formattedTime: customFormat ? customFormat(date, 'HH:mm:ss') : format(date, 'HH:mm:ss'),\n };\n};\n"],"names":["tz","format","dateFormatOptionsWithTimeZone","dateFormatOptions","timeZone","lowerTimeZone","toLowerCase","formatWithTimeZone","date","formatString","in","getGMTOffset","lower","resolvedTimeZone","Intl","DateTimeFormat","resolvedOptions","formatter","timeZoneName","parts","formatToParts","Date","tzPart","find","p","type","value","getFormattedAxisLabel","rangeMs","dayMs","monthMs","yearMs","year","month","day","getDateAndTime","timeMs","customFormat","formattedDate","formattedTime"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,EAAE,QAAQ,eAAe;AAClC,SAASC,MAAM,QAAQ,WAAW;AAElC,OAAO,SAASC,8BACdC,iBAA6C,EAC7CC,QAAiB;IAEjB;;;;GAIC,GACD,IAAIA,UAAU;QACZ,MAAMC,gBAAgBD,SAASE,WAAW;QAC1C,IAAID,kBAAkB,WAAWA,kBAAkB,WAAW;YAC5D,OAAO;gBACL,GAAGF,iBAAiB;gBACpBC,UA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AUE,UAAU,GAAG;QAChD,OAAO,aAAa,QAAQ;IAC9B;IAEA,uBAAuB;IACvB,IAAIF,UAAUC,QAAQ,KAAKD,WAAWC,QAAQ,GAAG;QAC/C,OAAO,uBAAuB,cAAc;IAC9C;IAEA,OAAO;QACLG,MAAM;QACNC,OAAO;QACPC,KAAK;IACP;AACF;AAOA,OAAO,MAAMC,iBAAiB,CAC5BC,QACAC;IAEA,IAAI,CAACD,QAAQ;QACX,OAAO;YAAEE,eAAe;YAAIC,eAAe;QAAG;IAChD;IACA,MAAM/B,OAAO,IAAIa,KAAKe;IACtB,OAAO;QACLE,eAAeD,eAAeA,aAAa7B,MAAM,kBAAkBP,OAAOO,MAAM;QAChF+B,eAAeF,eAAeA,aAAa7B,MAAM,cAAcP,OAAOO,MAAM;IAC9E;AACF,EAAE"}
|
package/dist/utils/index.js
CHANGED
|
@@ -10,24 +10,24 @@
|
|
|
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
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
13
|
+
export * from "./axis.js";
|
|
14
|
+
export * from "./browser-storage.js";
|
|
15
|
+
export * from "./chart-actions.js";
|
|
16
|
+
export * from "./combine-sx.js";
|
|
17
|
+
export * from "./component-ids.js";
|
|
18
|
+
export * from "./data-field-interpolation.js";
|
|
19
|
+
export * from "./format.js";
|
|
20
|
+
export * from "./memo.js";
|
|
21
|
+
export * from "./request-interpolation.js";
|
|
22
|
+
export * from "./selection-interpolation.js";
|
|
23
|
+
export * from "./theme-gen.js";
|
|
24
|
+
export * from "./variable-interpolation.js";
|
|
25
|
+
export * from "./value-mapping.js";
|
|
26
|
+
export * from "./regexp.js";
|
|
27
|
+
export * from "./transform-data.js";
|
|
28
|
+
export * from "./time-series-data.js";
|
|
29
|
+
export * from "./trace-data.js";
|
|
30
|
+
export * from "./types.js";
|
|
31
|
+
export * from "./text.js";
|
|
32
32
|
|
|
33
33
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './axis';\nexport * from './browser-storage';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './data-field-interpolation';\nexport * from './format';\nexport * from './memo';\nexport * from './request-interpolation';\nexport * from './selection-interpolation';\nexport * from './theme-gen';\nexport * from './variable-interpolation';\nexport * from './value-mapping';\nexport * from './regexp';\nexport * from './transform-data';\nexport * from './time-series-data';\nexport * from './trace-data';\nexport * from './types';\nexport * from './text';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './axis';\nexport * from './browser-storage';\nexport * from './chart-actions';\nexport * from './combine-sx';\nexport * from './component-ids';\nexport * from './data-field-interpolation';\nexport * from './format';\nexport * from './memo';\nexport * from './request-interpolation';\nexport * from './selection-interpolation';\nexport * from './theme-gen';\nexport * from './variable-interpolation';\nexport * from './value-mapping';\nexport * from './regexp';\nexport * from './transform-data';\nexport * from './time-series-data';\nexport * from './trace-data';\nexport * from './types';\nexport * from './text';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,YAAS;AACvB,cAAc,uBAAoB;AAClC,cAAc,qBAAkB;AAChC,cAAc,kBAAe;AAC7B,cAAc,qBAAkB;AAChC,cAAc,gCAA6B;AAC3C,cAAc,cAAW;AACzB,cAAc,YAAS;AACvB,cAAc,6BAA0B;AACxC,cAAc,+BAA4B;AAC1C,cAAc,iBAAc;AAC5B,cAAc,8BAA2B;AACzC,cAAc,qBAAkB;AAChC,cAAc,cAAW;AACzB,cAAc,sBAAmB;AACjC,cAAc,wBAAqB;AACnC,cAAc,kBAAe;AAC7B,cAAc,aAAU;AACxB,cAAc,YAAS"}
|
package/dist/utils/mathjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const round: {
|
|
2
|
-
<T extends import("mathjs").MathNumericType | import("mathjs").MathCollection>(x: T, n?: number | import("mathjs").BigNumber
|
|
2
|
+
<T extends import("mathjs").MathNumericType | import("mathjs").MathCollection>(x: T, n?: number | import("mathjs").BigNumber): T extends number ? number : T extends string ? string : T extends boolean ? boolean : T;
|
|
3
3
|
<U extends import("mathjs").MathCollection>(x: import("mathjs").MathNumericType, n: U): U;
|
|
4
4
|
};
|
|
5
5
|
declare const gcd: {
|
package/dist/utils/mathjs.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
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
|
-
import { roundDependencies, gcdDependencies, create } from
|
|
13
|
+
import { roundDependencies, gcdDependencies, create } from "mathjs";
|
|
14
14
|
// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)
|
|
15
15
|
const { round } = create({
|
|
16
16
|
roundDependencies
|
package/dist/utils/memo.d.ts
CHANGED
package/dist/utils/memo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/utils/memo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memo.d.ts","sourceRoot":"","sources":["../../src/utils/memo.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,GAAG,CAAC,CAgBxE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,GAAG,CAAC,CAMxE"}
|
package/dist/utils/memo.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
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
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import isEqual from "lodash/isEqual";
|
|
14
|
+
import { useRef } from "react";
|
|
15
15
|
/**
|
|
16
16
|
* Like React's useMemo, but guarantees the value will only be recalulated if
|
|
17
17
|
* a dependency changes. Uses strict equality (===) for comparison. (React's
|
package/dist/utils/memo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/memo.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/memo.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport isEqual from 'lodash/isEqual';\nimport type { DependencyList } from 'react';\nimport { useRef } from 'react';\n\ntype MemoRef<T> = {\n value: T;\n deps: DependencyList;\n};\n\n/**\n * Like React's useMemo, but guarantees the value will only be recalulated if\n * a dependency changes. Uses strict equality (===) for comparison. (React's\n * useMemo does not offer this guarantee, it's only a performance optimization).\n */\nexport function useMemoized<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n\n let areEqual = true;\n for (let i = 0; i < deps.length; i++) {\n if (ref.current?.deps[i] !== deps[i]) {\n areEqual = false;\n break;\n }\n }\n\n if (ref.current === undefined || areEqual === false) {\n ref.current = { value: factory(), deps: deps };\n }\n\n return ref.current.value;\n}\n\n/**\n * Like React's useMemo, except it does a deep equality comparison with lodash's\n * isEqual on the dependency list.\n */\nexport function useDeepMemo<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {\n ref.current = { value: factory(), deps };\n }\n return ref.current.value;\n}\n"],"names":["isEqual","useRef","useMemoized","factory","deps","ref","areEqual","i","length","current","undefined","value","useDeepMemo"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,aAAa,iBAAiB;AAErC,SAASC,MAAM,QAAQ,QAAQ;AAO/B;;;;CAIC,GACD,OAAO,SAASC,YAAeC,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAMJ;IAEZ,IAAIK,WAAW;IACf,IAAK,IAAIC,IAAI,GAAGA,IAAIH,KAAKI,MAAM,EAAED,IAAK;QACpC,IAAIF,IAAII,OAAO,EAAEL,IAAI,CAACG,EAAE,KAAKH,IAAI,CAACG,EAAE,EAAE;YACpCD,WAAW;YACX;QACF;IACF;IAEA,IAAID,IAAII,OAAO,KAAKC,aAAaJ,aAAa,OAAO;QACnDD,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC,MAAMA;QAAK;IAC/C;IAEA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B;AAEA;;;CAGC,GACD,OAAO,SAASC,YAAeT,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAMJ;IACZ,IAAII,IAAII,OAAO,KAAKC,aAAaV,QAAQI,MAAMC,IAAII,OAAO,CAACL,IAAI,MAAM,OAAO;QAC1EC,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC;QAAK;IACzC;IACA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B"}
|
package/dist/utils/regexp.js
CHANGED
package/dist/utils/regexp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/regexp.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Checks if a string is a regex pattern.\n */\nexport function isRegexPattern(input: string | null | undefined): boolean {\n return Boolean(input?.startsWith('/'));\n}\n\n/**\n * Converts a string to RegExp. Handles both regular strings and regex patterns.\n * For regular strings, creates exact match regex.\n * For patterns like \"/pattern/flags\", creates corresponding RegExp.\n */\nexport function createRegexFromString(input: string): RegExp {\n if (!input) {\n throw new Error('Input string cannot be empty');\n }\n\n if (!isRegexPattern(input)) {\n return new RegExp(`^${input}$`);\n }\n\n const regexPattern = /^\\/(.+)\\/([gimy]*)$/;\n const matches = input.match(regexPattern);\n\n if (!matches) {\n throw new Error(`Invalid regular expression format: ${input}`);\n }\n\n const [, pattern = '', flags = ''] = matches;\n\n try {\n return new RegExp(pattern, flags);\n } catch (error) {\n throw new Error(`Failed to create RegExp ${error}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/regexp.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Checks if a string is a regex pattern.\n */\nexport function isRegexPattern(input: string | null | undefined): boolean {\n return Boolean(input?.startsWith('/'));\n}\n\n/**\n * Converts a string to RegExp. Handles both regular strings and regex patterns.\n * For regular strings, creates exact match regex.\n * For patterns like \"/pattern/flags\", creates corresponding RegExp.\n */\nexport function createRegexFromString(input: string): RegExp {\n if (!input) {\n throw new Error('Input string cannot be empty');\n }\n\n if (!isRegexPattern(input)) {\n return new RegExp(`^${input}$`);\n }\n\n const regexPattern = /^\\/(.+)\\/([gimy]*)$/;\n const matches = input.match(regexPattern);\n\n if (!matches) {\n throw new Error(`Invalid regular expression format: ${input}`);\n }\n\n const [, pattern = '', flags = ''] = matches;\n\n try {\n return new RegExp(pattern, flags);\n } catch (error) {\n throw new Error(`Failed to create RegExp ${error}`, { cause: error });\n }\n}\n"],"names":["isRegexPattern","input","Boolean","startsWith","createRegexFromString","Error","RegExp","regexPattern","matches","match","pattern","flags","error","cause"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;;CAEC,GACD,OAAO,SAASA,eAAeC,KAAgC;IAC7D,OAAOC,QAAQD,OAAOE,WAAW;AACnC;AAEA;;;;CAIC,GACD,OAAO,SAASC,sBAAsBH,KAAa;IACjD,IAAI,CAACA,OAAO;QACV,MAAM,IAAII,MAAM;IAClB;IAEA,IAAI,CAACL,eAAeC,QAAQ;QAC1B,OAAO,IAAIK,OAAO,CAAC,CAAC,EAAEL,MAAM,CAAC,CAAC;IAChC;IAEA,MAAMM,eAAe;IACrB,MAAMC,UAAUP,MAAMQ,KAAK,CAACF;IAE5B,IAAI,CAACC,SAAS;QACZ,MAAM,IAAIH,MAAM,CAAC,mCAAmC,EAAEJ,OAAO;IAC/D;IAEA,MAAM,GAAGS,UAAU,EAAE,EAAEC,QAAQ,EAAE,CAAC,GAAGH;IAErC,IAAI;QACF,OAAO,IAAIF,OAAOI,SAASC;IAC7B,EAAE,OAAOC,OAAO;QACd,MAAM,IAAIP,MAAM,CAAC,wBAAwB,EAAEO,OAAO,EAAE;YAAEC,OAAOD;QAAM;IACrE;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RequestHeaders } from '@perses-dev/client';
|
|
2
|
-
import { VariableStateMap } from './variable-interpolation';
|
|
1
|
+
import type { RequestHeaders } from '@perses-dev/client';
|
|
2
|
+
import type { VariableStateMap } from './variable-interpolation';
|
|
3
3
|
export type QueryParamValues = Record<string, string | string[]>;
|
|
4
4
|
export declare function interpolateHeaders(headers: Record<string, string>, variableState: VariableStateMap): RequestHeaders;
|
|
5
5
|
export declare function interpolateQueryParams(queryParams: QueryParamValues, variableState: VariableStateMap): QueryParamValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-interpolation.d.ts","sourceRoot":"","sources":["../../src/utils/request-interpolation.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"request-interpolation.d.ts","sourceRoot":"","sources":["../../src/utils/request-interpolation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AA4DjE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,gBAAgB,GAAG,cAAc,CAMnH;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,gBAAgB,EAC7B,aAAa,EAAE,gBAAgB,GAC9B,gBAAgB,CAUlB"}
|
|
@@ -10,8 +10,8 @@
|
|
|
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
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { createRegexFromString } from "./regexp.js";
|
|
14
|
+
import { replaceVariables, parseVariablesAndFormat, InterpolationFormat } from "./variable-interpolation.js";
|
|
15
15
|
function expandQueryParamValue(value, variableState) {
|
|
16
16
|
// If value is an array, process each element
|
|
17
17
|
if (Array.isArray(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/request-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { RequestHeaders } from '@perses-dev/client';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/request-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { RequestHeaders } from '@perses-dev/client';\n\nimport { createRegexFromString } from './regexp';\nimport type { VariableStateMap } from './variable-interpolation';\nimport { replaceVariables, parseVariablesAndFormat, InterpolationFormat } from './variable-interpolation';\n\nexport type QueryParamValues = Record<string, string | string[]>;\n\nfunction expandQueryParamValue(value: string | string[], variableState: VariableStateMap): string | string[] {\n // If value is an array, process each element\n if (Array.isArray(value)) {\n return value.map((v) => expandQueryParamValue(v, variableState) as string);\n }\n\n // Now we know value is a string, so we can safely use string methods\n const valueString = value as string;\n const variablesMap = parseVariablesAndFormat(valueString);\n\n // Find the first multi-value variable that should expand to repeated keys\n for (const [varName, format] of variablesMap) {\n const varState = variableState[varName];\n if (!varState) continue;\n\n const options = varState.options ?? [];\n const allOptionValues = options.map((o) => o.value);\n\n const isArray = Array.isArray(varState.value);\n const isCustomAllValue = varState.customAllValue !== undefined;\n\n let expandValues: string[] | undefined;\n if (isArray) {\n expandValues = varState.value as string[];\n } else if (isCustomAllValue) {\n try {\n const regex = createRegexFromString(varState.customAllValue as string);\n const matched = options.filter((o) => regex.test(o.value)).map((o) => o.value);\n expandValues = matched.length > 0 ? matched : allOptionValues;\n } catch {\n expandValues = allOptionValues;\n }\n }\n if (!expandValues) continue;\n\n // If format is queryparam or not specified (default for query params), expand to array\n if (!format || format === InterpolationFormat.QUERYPARAM) {\n // Build syntax patterns for this variable reference\n const simpleSyntax = '$' + varName;\n const bracketSyntax = format ? '${' + varName + ':' + format + '}' : '${' + varName + '}';\n\n return expandValues.map((singleValue) => {\n let text = valueString;\n // Replace the variable reference with the raw value directly.\n // We cannot use replaceVariables here because it would apply QUERYPARAM format\n // to the single value, producing \"varName=val\" instead of just \"val\".\n text = text.replaceAll(bracketSyntax, singleValue);\n text = text.replaceAll(simpleSyntax, singleValue);\n // Replace any remaining variables (other than the expanded one) using standard interpolation\n return replaceVariables(text, variableState);\n });\n }\n }\n\n // No multi-value expansion needed — use standard interpolation\n return replaceVariables(valueString, variableState);\n}\n\nexport function interpolateHeaders(headers: Record<string, string>, variableState: VariableStateMap): RequestHeaders {\n const result: RequestHeaders = {};\n for (const [key, value] of Object.entries(headers)) {\n result[key] = replaceVariables(value, variableState);\n }\n return result;\n}\n\nexport function interpolateQueryParams(\n queryParams: QueryParamValues,\n variableState: VariableStateMap,\n): QueryParamValues {\n const result: QueryParamValues = {};\n for (const [key, value] of Object.entries(queryParams)) {\n if (Array.isArray(value)) {\n result[key] = value.map((v) => replaceVariables(v, variableState));\n } else {\n result[key] = expandQueryParamValue(value, variableState);\n }\n }\n return result;\n}\n"],"names":["createRegexFromString","replaceVariables","parseVariablesAndFormat","InterpolationFormat","expandQueryParamValue","value","variableState","Array","isArray","map","v","valueString","variablesMap","varName","format","varState","options","allOptionValues","o","isCustomAllValue","customAllValue","undefined","expandValues","regex","matched","filter","test","length","QUERYPARAM","simpleSyntax","bracketSyntax","singleValue","text","replaceAll","interpolateHeaders","headers","result","key","Object","entries","interpolateQueryParams","queryParams"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,qBAAqB,QAAQ,cAAW;AAEjD,SAASC,gBAAgB,EAAEC,uBAAuB,EAAEC,mBAAmB,QAAQ,8BAA2B;AAI1G,SAASC,sBAAsBC,KAAwB,EAAEC,aAA+B;IACtF,6CAA6C;IAC7C,IAAIC,MAAMC,OAAO,CAACH,QAAQ;QACxB,OAAOA,MAAMI,GAAG,CAAC,CAACC,IAAMN,sBAAsBM,GAAGJ;IACnD;IAEA,qEAAqE;IACrE,MAAMK,cAAcN;IACpB,MAAMO,eAAeV,wBAAwBS;IAE7C,0EAA0E;IAC1E,KAAK,MAAM,CAACE,SAASC,OAAO,IAAIF,aAAc;QAC5C,MAAMG,WAAWT,aAAa,CAACO,QA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AAM,CAACC,KAAKhC,MAAM,IAAIiC,OAAOC,OAAO,CAACJ,SAAU;QAClDC,MAAM,CAACC,IAAI,GAAGpC,iBAAiBI,OAAOC;IACxC;IACA,OAAO8B;AACT;AAEA,OAAO,SAASI,uBACdC,WAA6B,EAC7BnC,aAA+B;IAE/B,MAAM8B,SAA2B,CAAC;IAClC,KAAK,MAAM,CAACC,KAAKhC,MAAM,IAAIiC,OAAOC,OAAO,CAACE,aAAc;QACtD,IAAIlC,MAAMC,OAAO,CAACH,QAAQ;YACxB+B,MAAM,CAACC,IAAI,GAAGhC,MAAMI,GAAG,CAAC,CAACC,IAAMT,iBAAiBS,GAAGJ;QACrD,OAAO;YACL8B,MAAM,CAACC,IAAI,GAAGjC,sBAAsBC,OAAOC;QAC7C;IACF;IACA,OAAO8B;AACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataItem, InterpolationResult } from './data-field-interpolation';
|
|
2
|
-
import { VariableStateMap } from './variable-interpolation';
|
|
1
|
+
import type { DataItem, InterpolationResult } from './data-field-interpolation';
|
|
2
|
+
import type { VariableStateMap } from './variable-interpolation';
|
|
3
3
|
export type SelectionItem = DataItem;
|
|
4
4
|
/**
|
|
5
5
|
* Interpolate selection data into a template string for individual mode.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-interpolation.d.ts","sourceRoot":"","sources":["../../src/utils/selection-interpolation.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"selection-interpolation.d.ts","sourceRoot":"","sources":["../../src/utils/selection-interpolation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,gBAAgB,GAC/B,mBAAmB,CAerB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,aAAa,EAAE,EACtB,aAAa,CAAC,EAAE,gBAAgB,GAC/B,mBAAmB,CAerB"}
|
|
@@ -10,8 +10,8 @@
|
|
|
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
|
-
import { replaceDataFields, replaceDataFieldsBatch } from
|
|
14
|
-
import { replaceVariables } from
|
|
13
|
+
import { replaceDataFields, replaceDataFieldsBatch } from "./data-field-interpolation.js";
|
|
14
|
+
import { replaceVariables } from "./variable-interpolation.js";
|
|
15
15
|
/**
|
|
16
16
|
* Interpolate selection data into a template string for individual mode.
|
|
17
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/selection-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DataItem, InterpolationResult
|
|
1
|
+
{"version":3,"sources":["../../src/utils/selection-interpolation.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { DataItem, InterpolationResult } from './data-field-interpolation';\nimport { replaceDataFields, replaceDataFieldsBatch } from './data-field-interpolation';\nimport type { VariableStateMap } from './variable-interpolation';\nimport { replaceVariables } from './variable-interpolation';\n\nexport type SelectionItem = DataItem;\n\n/**\n * Interpolate selection data into a template string for individual mode.\n *\n * Supports:\n * - ${__data.fields[\"fieldName\"]} - field value from the item\n * - ${__data.index} - current selection index (0-based)\n * - ${__data.count} - total number of selections\n *\n * @param template - The template string with placeholders\n * @param item - The current selection item data\n * @param index - The current selection index (0-based)\n * @param count - Total number of selections\n * @param variableState - Optional dashboard variable state for additional interpolation\n */\nexport function interpolateSelectionIndividual(\n template: string,\n item: SelectionItem,\n index: number,\n count: number,\n variableState?: VariableStateMap,\n): InterpolationResult {\n // Replace __data patterns using shared utility (includes __data.index and __data.count)\n const dataFieldResult = replaceDataFields(template, item, { index, count });\n let result = dataFieldResult.text;\n const errors: string[] = [];\n if (dataFieldResult.errors) {\n errors.push(...dataFieldResult.errors.map((e) => e.replace('in data', 'in selection data')));\n }\n\n // Apply dashboard variable interpolation if provided\n if (variableState) {\n result = replaceVariables(result, variableState);\n }\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n\n/**\n * Interpolate selection data into a template string for batch mode.\n *\n * Supports:\n * - ${__data[0].fields[\"fieldName\"]} - field value from specific item by index\n * - ${__data.fields[\"fieldName\"]:csv} - aggregated field values with format specifier\n * - ${__data.count} - total number of selections\n *\n * @param template - The template string with placeholders\n * @param items - Array of all selection items\n * @param variableState - Optional dashboard variable state for additional interpolation\n */\nexport function interpolateSelectionBatch(\n template: string,\n items: SelectionItem[],\n variableState?: VariableStateMap,\n): InterpolationResult {\n // Replace __data patterns using shared utility (includes __data.count)\n const dataFieldResult = replaceDataFieldsBatch(template, items);\n let result = dataFieldResult.text;\n const errors: string[] = [];\n if (dataFieldResult.errors) {\n errors.push(...dataFieldResult.errors.map((e) => e.replace('in data', 'in selection data')));\n }\n\n // Apply dashboard variable interpolation if provided\n if (variableState) {\n result = replaceVariables(result, variableState);\n }\n\n return { text: result, errors: errors.length > 0 ? errors : undefined };\n}\n"],"names":["replaceDataFields","replaceDataFieldsBatch","replaceVariables","interpolateSelectionIndividual","template","item","index","count","variableState","dataFieldResult","result","text","errors","push","map","e","replace","length","undefined","interpolateSelectionBatch","items"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,iBAAiB,EAAEC,sBAAsB,QAAQ,gCAA6B;AAEvF,SAASC,gBAAgB,QAAQ,8BAA2B;AAI5D;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,+BACdC,QAAgB,EAChBC,IAAmB,EACnBC,KAAa,EACbC,KAAa,EACbC,aAAgC;IAEhC,wFAAwF;IACxF,MAAMC,kBAAkBT,kBAAkBI,UAAUC,MAAM;QAAEC;QAAOC;IAAM;IACzE,IAAIG,SAASD,gBAAgBE,IAAI;IACjC,MAAMC,SAAmB,EAAE;IAC3B,IAAIH,gBAAgBG,MAAM,EAAE;QAC1BA,OAAOC,IAAI,IAAIJ,gBAAgBG,MAAM,CAACE,GAAG,CAAC,CAACC,IAAMA,EAAEC,OAAO,CAAC,WAAW;IACxE;IAEA,qDAAqD;IACrD,IAAIR,eAAe;QACjBE,SAASR,iBAAiBQ,QAAQF;IACpC;IAEA,OAAO;QAAEG,MAAMD;QAAQE,QAAQA,OAAOK,MAAM,GAAG,IAAIL,SAASM;IAAU;AACxE;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SA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