@perses-dev/components 0.53.0-rc.0 → 0.53.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlignSelector/AlignSelector.js +1 -1
- 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.js +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ColorPicker/index.js +1 -1
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +1 -1
- 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.js +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.js +1 -1
- 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.js +1 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/Dialog/index.js +1 -1
- package/dist/Dialog/index.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +1 -1
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +1 -1
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +1 -1
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/DragAndDrop/index.js +1 -1
- package/dist/DragAndDrop/index.js.map +1 -1
- package/dist/DragAndDrop/model.js +1 -1
- package/dist/DragAndDrop/model.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- 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.js +1 -1
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/EChart/index.js +1 -1
- package/dist/EChart/index.js.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/ErrorBoundary.js +1 -1
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/FontSizeSelector/FontSizeSelector.js +1 -1
- 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.js +1 -1
- 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.map +1 -1
- package/dist/FormatControls/FormatControls.js +10 -23
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.d.ts +9 -0
- package/dist/FormatControls/UnitSelector.d.ts.map +1 -0
- package/dist/FormatControls/UnitSelector.js +47 -0
- package/dist/FormatControls/UnitSelector.js.map +1 -0
- package/dist/FormatControls/index.d.ts +1 -0
- package/dist/FormatControls/index.d.ts.map +1 -1
- package/dist/FormatControls/index.js +2 -1
- package/dist/FormatControls/index.js.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.js +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +1 -1
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +1 -1
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.js +1 -1
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/index.js +1 -1
- package/dist/Legend/index.js.map +1 -1
- package/dist/Legend/legend-model.js +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +1 -1
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +1 -1
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/LinksEditor/index.js +1 -1
- package/dist/LinksEditor/index.js.map +1 -1
- package/dist/ModeSelector/ModeSelector.js +1 -1
- 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.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +5 -2
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/OptionsEditorLayout/index.js +1 -1
- package/dist/OptionsEditorLayout/index.js.map +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- 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.js +1 -1
- 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/SettingsAutocomplete/SettingsAutocomplete.d.ts +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.d.ts.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +16 -3
- 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.js +1 -1
- package/dist/SortSelector/SortSelector.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +1 -1
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/SortSelector/index.js +1 -1
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/Table/InnerTable.js +1 -1
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +31 -7
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.d.ts +4 -2
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +27 -5
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +1 -1
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.js +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +19 -3
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +1 -1
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.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 +1 -1
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +16 -6
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +4 -3
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
- 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 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +21 -33
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +6 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +140 -19
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeRangeSelector/index.js +1 -1
- package/dist/TimeRangeSelector/index.js.map +1 -1
- package/dist/TimeRangeSelector/utils.js +1 -1
- package/dist/TimeRangeSelector/utils.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +4 -0
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +3 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +6 -3
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/index.js +1 -1
- package/dist/TimeSeriesTooltip/index.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +3 -14
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +80 -58
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js +1 -1
- package/dist/TimeSeriesTooltip/tooltip-model.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +1 -1
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/TimeZoneSelector.d.ts +16 -0
- package/dist/TimeZoneSelector.d.ts.map +1 -0
- package/dist/TimeZoneSelector.js +58 -0
- package/dist/TimeZoneSelector.js.map +1 -0
- package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
- 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.js +1 -1
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +1 -1
- 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.js +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
- 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.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/AlignSelector/AlignSelector.js +1 -1
- package/dist/cjs/AlignSelector/index.js +1 -1
- package/dist/cjs/ColorPicker/ColorPicker.js +1 -1
- package/dist/cjs/ColorPicker/OptionsColorPicker.js +1 -1
- package/dist/cjs/ColorPicker/index.js +1 -1
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +1 -1
- package/dist/cjs/ContentWithLegend/index.js +1 -1
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +1 -1
- package/dist/cjs/DensitySelector/DensitySelector.js +1 -1
- package/dist/cjs/DensitySelector/index.js +1 -1
- package/dist/cjs/Dialog/Dialog.js +1 -1
- package/dist/cjs/Dialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/cjs/Dialog/index.js +1 -1
- package/dist/cjs/DragAndDrop/DragAndDropList.js +1 -1
- package/dist/cjs/DragAndDrop/DragButton.js +1 -1
- package/dist/cjs/DragAndDrop/DropIndicator.js +1 -1
- package/dist/cjs/DragAndDrop/index.js +1 -1
- package/dist/cjs/DragAndDrop/model.js +1 -1
- package/dist/cjs/Drawer/Drawer.js +1 -1
- package/dist/cjs/Drawer/index.js +1 -1
- package/dist/cjs/EChart/EChart.js +1 -1
- package/dist/cjs/EChart/index.js +1 -1
- package/dist/cjs/ErrorAlert.js +1 -1
- package/dist/cjs/ErrorBoundary.js +1 -1
- package/dist/cjs/FontSizeSelector/FontSizeSelector.js +1 -1
- package/dist/cjs/FontSizeSelector/index.js +1 -1
- package/dist/cjs/FormEditor/FormActions.js +1 -1
- package/dist/cjs/FormEditor/index.js +1 -1
- package/dist/cjs/FormatControls/FormatControls.js +9 -22
- package/dist/cjs/FormatControls/UnitSelector.js +55 -0
- package/dist/cjs/FormatControls/index.js +2 -1
- package/dist/cjs/InfoTooltip/InfoTooltip.js +1 -1
- package/dist/cjs/InfoTooltip/index.js +1 -1
- package/dist/cjs/JSONEditor.js +1 -1
- package/dist/cjs/Legend/CompactLegend.js +1 -1
- package/dist/cjs/Legend/Legend.js +1 -1
- package/dist/cjs/Legend/LegendColorBadge.js +1 -1
- package/dist/cjs/Legend/ListLegend.js +1 -1
- package/dist/cjs/Legend/ListLegendItem.js +1 -1
- package/dist/cjs/Legend/TableLegend.js +1 -1
- package/dist/cjs/Legend/index.js +1 -1
- package/dist/cjs/Legend/legend-model.js +1 -1
- package/dist/cjs/LinksEditor/LinkEditorForm.js +1 -1
- package/dist/cjs/LinksEditor/LinksEditor.js +1 -1
- package/dist/cjs/LinksEditor/index.js +1 -1
- package/dist/cjs/ModeSelector/ModeSelector.js +1 -1
- package/dist/cjs/ModeSelector/index.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +5 -2
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/cjs/OptionsEditorLayout/index.js +1 -1
- package/dist/cjs/Overlay/Overlay.js +1 -1
- package/dist/cjs/Overlay/index.js +1 -1
- package/dist/cjs/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
- package/dist/cjs/RefreshIntervalPicker/index.js +1 -1
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +16 -3
- package/dist/cjs/SettingsAutocomplete/index.js +1 -1
- package/dist/cjs/SortSelector/SortSelector.js +1 -1
- package/dist/cjs/SortSelector/SortSelectorButtons.js +1 -1
- package/dist/cjs/SortSelector/index.js +1 -1
- package/dist/cjs/Table/InnerTable.js +1 -1
- package/dist/cjs/Table/Table.js +29 -5
- package/dist/cjs/Table/TableBody.js +1 -1
- package/dist/cjs/Table/TableCell.js +25 -3
- package/dist/cjs/Table/TableCheckbox.js +1 -1
- package/dist/cjs/Table/TableFoot.js +1 -1
- package/dist/cjs/Table/TableHead.js +1 -1
- package/dist/cjs/Table/TableHeaderCell.js +1 -1
- package/dist/cjs/Table/TableRow.js +1 -1
- package/dist/cjs/Table/VirtualizedTable.js +19 -3
- package/dist/cjs/Table/VirtualizedTableContainer.js +1 -1
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +1 -1
- package/dist/cjs/Table/index.js +1 -1
- package/dist/cjs/Table/model/table-model.js +4 -3
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +1 -1
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +1 -1
- package/dist/cjs/ThresholdsEditor/index.js +1 -1
- package/dist/cjs/TimeRangeSelector/DateTimeRangePicker.js +20 -32
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +139 -18
- package/dist/cjs/TimeRangeSelector/index.js +1 -1
- package/dist/cjs/TimeRangeSelector/utils.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/SeriesMarker.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +3 -2
- package/dist/cjs/TimeSeriesTooltip/TooltipContent.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +6 -3
- package/dist/cjs/TimeSeriesTooltip/index.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +80 -58
- package/dist/cjs/TimeSeriesTooltip/tooltip-model.js +1 -1
- package/dist/cjs/TimeSeriesTooltip/utils.js +1 -1
- package/dist/cjs/TimeZoneSelector.js +63 -0
- package/dist/cjs/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/cjs/ToolbarIconButton/index.js +1 -1
- package/dist/cjs/TransformsEditor/TransformEditor.js +1 -1
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +1 -1
- package/dist/cjs/TransformsEditor/TransformsEditor.js +1 -1
- package/dist/cjs/TransformsEditor/index.js +1 -1
- package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +1 -1
- package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +1 -1
- package/dist/cjs/ValueMappingEditor/index.js +1 -1
- package/dist/cjs/YAxisLabel.js +1 -1
- package/dist/cjs/context/ChartsProvider.js +1 -1
- package/dist/cjs/context/ItemActionsProvider.js +111 -0
- package/dist/cjs/context/SelectionProvider.js +128 -0
- package/dist/cjs/context/SnackbarProvider.js +1 -1
- package/dist/cjs/context/TimeZoneProvider.js +1 -1
- package/dist/cjs/context/index.js +3 -1
- package/dist/cjs/controls/TextField.js +1 -1
- package/dist/cjs/controls/index.js +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/model/graph.js +1 -1
- package/dist/cjs/model/index.js +2 -1
- package/dist/cjs/model/theme.js +1 -1
- package/dist/cjs/model/timeOption.js +1 -1
- package/dist/cjs/model/timeZoneOption.js +34 -0
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test-utils/index.js +1 -1
- package/dist/cjs/test-utils/theme.js +1 -1
- package/dist/cjs/theme/component-overrides/alert.js +1 -1
- package/dist/cjs/theme/component-overrides/paper.js +1 -1
- package/dist/cjs/theme/index.js +1 -1
- package/dist/cjs/theme/palette/background.js +1 -1
- package/dist/cjs/theme/palette/colors/blue.js +1 -1
- package/dist/cjs/theme/palette/colors/common.js +1 -1
- package/dist/cjs/theme/palette/colors/green.js +1 -1
- package/dist/cjs/theme/palette/colors/grey.js +1 -1
- package/dist/cjs/theme/palette/colors/index.js +1 -1
- package/dist/cjs/theme/palette/colors/orange.js +1 -1
- package/dist/cjs/theme/palette/colors/purple.js +1 -1
- package/dist/cjs/theme/palette/colors/red.js +1 -1
- package/dist/cjs/theme/palette/colors/types.js +1 -1
- package/dist/cjs/theme/palette/error.js +1 -1
- package/dist/cjs/theme/palette/grey.js +1 -1
- package/dist/cjs/theme/palette/index.js +1 -1
- package/dist/cjs/theme/palette/palette-options.js +1 -1
- package/dist/cjs/theme/palette/primary.js +1 -1
- package/dist/cjs/theme/palette/secondary.js +1 -1
- package/dist/cjs/theme/palette/success.js +1 -1
- package/dist/cjs/theme/palette/text.js +1 -1
- package/dist/cjs/theme/palette/warning.js +1 -1
- package/dist/cjs/theme/theme.js +1 -1
- package/dist/cjs/theme/types/ThemeExtension.d.js +1 -1
- package/dist/cjs/theme/typography.js +1 -1
- package/dist/cjs/utils/axis.js +80 -5
- package/dist/cjs/utils/browser-storage.js +1 -1
- package/dist/cjs/utils/chart-actions.js +1 -1
- package/dist/cjs/utils/combine-sx.js +1 -1
- package/dist/cjs/utils/component-ids.js +1 -1
- package/dist/cjs/utils/data-field-interpolation.js +230 -0
- package/dist/cjs/utils/format.js +1 -1
- package/dist/cjs/utils/index.js +5 -2
- package/dist/cjs/utils/mathjs.js +1 -1
- package/dist/cjs/utils/memo.js +1 -1
- package/dist/cjs/utils/selection-interpolation.js +69 -0
- package/dist/cjs/utils/theme-gen.js +1 -1
- package/dist/cjs/utils/variable-interpolation.js +192 -0
- package/dist/context/ChartsProvider.js +1 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.d.ts +25 -0
- package/dist/context/ItemActionsProvider.d.ts.map +1 -0
- package/dist/context/ItemActionsProvider.js +95 -0
- package/dist/context/ItemActionsProvider.js.map +1 -0
- package/dist/context/SelectionProvider.d.ts +34 -0
- package/dist/context/SelectionProvider.d.ts.map +1 -0
- package/dist/context/SelectionProvider.js +120 -0
- package/dist/context/SelectionProvider.js.map +1 -0
- package/dist/context/SnackbarProvider.js +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- package/dist/context/TimeZoneProvider.js +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +3 -1
- package/dist/context/index.js.map +1 -1
- package/dist/controls/TextField.js +1 -1
- 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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/model/graph.js +1 -1
- package/dist/model/graph.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +2 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/theme.d.ts +1 -0
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/timeOption.js +1 -1
- package/dist/model/timeOption.js.map +1 -1
- package/dist/model/timeZoneOption.d.ts +10 -0
- package/dist/model/timeZoneOption.d.ts.map +1 -0
- package/dist/model/timeZoneOption.js +29 -0
- package/dist/model/timeZoneOption.js.map +1 -0
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- 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.js +1 -1
- package/dist/test-utils/theme.js.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.js +1 -1
- package/dist/theme/component-overrides/paper.js.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/index.js.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.js +1 -1
- package/dist/theme/palette/colors/blue.js.map +1 -1
- package/dist/theme/palette/colors/common.js +1 -1
- package/dist/theme/palette/colors/common.js.map +1 -1
- package/dist/theme/palette/colors/green.js +1 -1
- package/dist/theme/palette/colors/green.js.map +1 -1
- package/dist/theme/palette/colors/grey.js +1 -1
- package/dist/theme/palette/colors/grey.js.map +1 -1
- package/dist/theme/palette/colors/index.js +1 -1
- package/dist/theme/palette/colors/index.js.map +1 -1
- package/dist/theme/palette/colors/orange.js +1 -1
- package/dist/theme/palette/colors/orange.js.map +1 -1
- package/dist/theme/palette/colors/purple.js +1 -1
- package/dist/theme/palette/colors/purple.js.map +1 -1
- package/dist/theme/palette/colors/red.js +1 -1
- package/dist/theme/palette/colors/red.js.map +1 -1
- package/dist/theme/palette/colors/types.js +1 -1
- package/dist/theme/palette/colors/types.js.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.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.js +1 -1
- package/dist/theme/palette/palette-options.js.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.js +1 -1
- package/dist/theme/palette/secondary.js.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.js +1 -1
- package/dist/theme/palette/text.js.map +1 -1
- package/dist/theme/palette/warning.js +1 -1
- package/dist/theme/palette/warning.js.map +1 -1
- package/dist/theme/theme.js +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/types/ThemeExtension.d.js +1 -1
- package/dist/theme/types/ThemeExtension.d.js.map +1 -1
- package/dist/theme/typography.js +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +18 -0
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +79 -3
- 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.js +1 -1
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/combine-sx.js +1 -1
- package/dist/utils/combine-sx.js.map +1 -1
- package/dist/utils/component-ids.js +1 -1
- package/dist/utils/component-ids.js.map +1 -1
- package/dist/utils/data-field-interpolation.d.ts +84 -0
- package/dist/utils/data-field-interpolation.d.ts.map +1 -0
- package/dist/utils/data-field-interpolation.js +239 -0
- package/dist/utils/data-field-interpolation.js.map +1 -0
- package/dist/utils/format.js +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.js +1 -1
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/memo.js +1 -1
- package/dist/utils/memo.js.map +1 -1
- package/dist/utils/selection-interpolation.d.ts +32 -0
- package/dist/utils/selection-interpolation.d.ts.map +1 -0
- package/dist/utils/selection-interpolation.js +77 -0
- package/dist/utils/selection-interpolation.js.map +1 -0
- package/dist/utils/theme-gen.js +1 -1
- package/dist/utils/theme-gen.js.map +1 -1
- package/dist/utils/variable-interpolation.d.ts +71 -0
- package/dist/utils/variable-interpolation.d.ts.map +1 -0
- package/dist/utils/variable-interpolation.js +176 -0
- package/dist/utils/variable-interpolation.js.map +1 -0
- package/package.json +3 -3
package/dist/cjs/utils/axis.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,10 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get getFormattedAxis () {
|
|
20
25
|
return getFormattedAxis;
|
|
26
|
+
},
|
|
27
|
+
get getFormattedMultipleYAxes () {
|
|
28
|
+
return getFormattedMultipleYAxes;
|
|
21
29
|
}
|
|
22
30
|
});
|
|
23
31
|
const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
|
|
@@ -27,8 +35,25 @@ function _interop_require_default(obj) {
|
|
|
27
35
|
default: obj
|
|
28
36
|
};
|
|
29
37
|
}
|
|
38
|
+
// Character width multipliers (approximate for typical UI fonts)
|
|
39
|
+
const CHAR_WIDTH_BASE = 6;
|
|
40
|
+
const AXIS_LABEL_PADDING = 10; // Extra padding to avoid label clipping
|
|
41
|
+
/**
|
|
42
|
+
* Estimate the pixel width needed for an axis label using Canvas API.
|
|
43
|
+
*/ function estimateLabelWidth(format, maxValue) {
|
|
44
|
+
const formattedLabel = (0, _core.formatValue)(maxValue, format);
|
|
45
|
+
// Create a canvas element (reuse if possible for performance)
|
|
46
|
+
const canvas = document.createElement('canvas');
|
|
47
|
+
const context = canvas.getContext('2d');
|
|
48
|
+
if (!context) {
|
|
49
|
+
// Fallback to estimation if canvas not available
|
|
50
|
+
return formattedLabel.length * CHAR_WIDTH_BASE;
|
|
51
|
+
}
|
|
52
|
+
context.font = '12px sans-serif';
|
|
53
|
+
const metrics = context.measureText(formattedLabel);
|
|
54
|
+
return metrics.width;
|
|
55
|
+
}
|
|
30
56
|
function getFormattedAxis(axis, unit) {
|
|
31
|
-
// TODO: support alternate yAxis that shows on right side
|
|
32
57
|
const AXIS_DEFAULT = {
|
|
33
58
|
type: 'value',
|
|
34
59
|
boundaryGap: [
|
|
@@ -45,3 +70,53 @@ function getFormattedAxis(axis, unit) {
|
|
|
45
70
|
(0, _merge.default)(AXIS_DEFAULT, axis)
|
|
46
71
|
];
|
|
47
72
|
}
|
|
73
|
+
function getFormattedMultipleYAxes(baseAxis, baseFormat, additionalFormats, maxValues) {
|
|
74
|
+
const axes = [];
|
|
75
|
+
// Base/default Y axis (left side)
|
|
76
|
+
const baseAxisConfig = (0, _merge.default)({
|
|
77
|
+
type: 'value',
|
|
78
|
+
position: 'left',
|
|
79
|
+
boundaryGap: [
|
|
80
|
+
0,
|
|
81
|
+
'10%'
|
|
82
|
+
],
|
|
83
|
+
axisLabel: {
|
|
84
|
+
formatter: (value)=>{
|
|
85
|
+
return (0, _core.formatValue)(value, baseFormat);
|
|
86
|
+
},
|
|
87
|
+
// Let ECharts handle width automatically
|
|
88
|
+
overflow: 'truncate'
|
|
89
|
+
}
|
|
90
|
+
}, baseAxis);
|
|
91
|
+
axes.push(baseAxisConfig);
|
|
92
|
+
// Calculate cumulative offsets based on actual formatted label widths
|
|
93
|
+
let cumulativeOffset = 0;
|
|
94
|
+
// Additional Y axes (right side) for each unique format
|
|
95
|
+
additionalFormats.forEach((format, index)=>{
|
|
96
|
+
const rightAxisConfig = {
|
|
97
|
+
type: 'value',
|
|
98
|
+
position: 'right',
|
|
99
|
+
// Dynamic offset based on cumulative width of preceding axis labels
|
|
100
|
+
offset: cumulativeOffset,
|
|
101
|
+
boundaryGap: [
|
|
102
|
+
0,
|
|
103
|
+
'10%'
|
|
104
|
+
],
|
|
105
|
+
axisLabel: {
|
|
106
|
+
formatter: (value)=>{
|
|
107
|
+
return (0, _core.formatValue)(value, format);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
splitLine: {
|
|
111
|
+
show: false
|
|
112
|
+
},
|
|
113
|
+
show: baseAxis?.show
|
|
114
|
+
};
|
|
115
|
+
axes.push(rightAxisConfig);
|
|
116
|
+
// For subsequent axes, add the width of the previous axis's labels
|
|
117
|
+
if (maxValues) {
|
|
118
|
+
cumulativeOffset += estimateLabelWidth(format, maxValues[index] ?? 1000) + AXIS_LABEL_PADDING;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return axes;
|
|
122
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get extractFieldNames () {
|
|
25
|
+
return extractFieldNames;
|
|
26
|
+
},
|
|
27
|
+
get hasBatchPatterns () {
|
|
28
|
+
return hasBatchPatterns;
|
|
29
|
+
},
|
|
30
|
+
get hasDataFieldPatterns () {
|
|
31
|
+
return hasDataFieldPatterns;
|
|
32
|
+
},
|
|
33
|
+
get hasIndexedPatterns () {
|
|
34
|
+
return hasIndexedPatterns;
|
|
35
|
+
},
|
|
36
|
+
get parseFormat () {
|
|
37
|
+
return parseFormat;
|
|
38
|
+
},
|
|
39
|
+
get replaceDataFields () {
|
|
40
|
+
return replaceDataFields;
|
|
41
|
+
},
|
|
42
|
+
get replaceDataFieldsBatch () {
|
|
43
|
+
return replaceDataFieldsBatch;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const _variableinterpolation = require("./variable-interpolation");
|
|
47
|
+
// Regex patterns for data field interpolation
|
|
48
|
+
// Matches: ${__data.fields["fieldName"]} or ${__data.fields['fieldName']} or ${__data.fields.fieldName} with optional format ${__data.fields["fieldName"]:format}
|
|
49
|
+
const SINGLE_FIELD_REGEX = /\$\{__data\.fields(?:\[(?:"|')([^"']+)(?:"|')\]|\.([a-zA-Z_][a-zA-Z0-9_]*))(?::([a-z]+))?\}/g;
|
|
50
|
+
// Matches: ${__data[0].fields["fieldName"]} or ${__data[0].fields['fieldName']} for indexed access
|
|
51
|
+
const INDEXED_FIELD_REGEX = /\$\{__data\[(\d+)\]\.fields\[(?:"|')([^"']+)(?:"|')\]\}/g;
|
|
52
|
+
// Matches: ${__data.index}
|
|
53
|
+
const DATA_INDEX_REGEX = /\$\{__data\.index\}/g;
|
|
54
|
+
// Matches: ${__data.count}
|
|
55
|
+
const DATA_COUNT_REGEX = /\$\{__data\.count\}/g;
|
|
56
|
+
// Matches: ${__data} or ${__data:format} or '${__data:format}' or "${__data:format}"
|
|
57
|
+
const FULL_DATA_REGEX = /("|')?\$\{__data(?::([a-z]+))?\}("|')?/g;
|
|
58
|
+
/**
|
|
59
|
+
* Get field value from a data item, converting to string.
|
|
60
|
+
* Supports nested field access using dot notation in field names (e.g., "foo.bar" accesses item.foo.bar).
|
|
61
|
+
* For backward compatibility, first checks if the exact key exists before attempting nested access.
|
|
62
|
+
*/ function getFieldValue(item, fieldName) {
|
|
63
|
+
// First, try direct property access (for backward compatibility with literal dot keys)
|
|
64
|
+
if (Object.prototype.hasOwnProperty.call(item, fieldName)) {
|
|
65
|
+
const value = item[fieldName];
|
|
66
|
+
if (value === undefined || value === null) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
if (typeof value === 'object') {
|
|
70
|
+
return JSON.stringify(value);
|
|
71
|
+
}
|
|
72
|
+
return String(value);
|
|
73
|
+
}
|
|
74
|
+
// If not found and contains dots, try nested access
|
|
75
|
+
if (fieldName.includes('.')) {
|
|
76
|
+
const parts = fieldName.split('.');
|
|
77
|
+
let current = item;
|
|
78
|
+
for (const part of parts){
|
|
79
|
+
if (current === null || current === undefined) {
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
if (typeof current !== 'object') {
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
current = current[part];
|
|
86
|
+
}
|
|
87
|
+
if (current === undefined || current === null) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
if (typeof current === 'object') {
|
|
91
|
+
return JSON.stringify(current);
|
|
92
|
+
}
|
|
93
|
+
return String(current);
|
|
94
|
+
}
|
|
95
|
+
// Field not found
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
function parseFormat(format) {
|
|
99
|
+
if (!format) return undefined;
|
|
100
|
+
const lowerFormat = format.toLowerCase();
|
|
101
|
+
return Object.values(_variableinterpolation.InterpolationFormat).find((f)=>f === lowerFormat);
|
|
102
|
+
}
|
|
103
|
+
function replaceDataFields(template, item, options = {}) {
|
|
104
|
+
const { urlEncode = true, index, count } = options;
|
|
105
|
+
let result = template;
|
|
106
|
+
const errors = [];
|
|
107
|
+
// Replace ${__data.index} if provided
|
|
108
|
+
if (index !== undefined) {
|
|
109
|
+
result = result.replaceAll(DATA_INDEX_REGEX, String(index));
|
|
110
|
+
}
|
|
111
|
+
// Replace ${__data.count} if provided
|
|
112
|
+
if (count !== undefined) {
|
|
113
|
+
result = result.replaceAll(DATA_COUNT_REGEX, String(count));
|
|
114
|
+
}
|
|
115
|
+
// Replace full data placeholder with optional format: ${__data} or ${__data:format}
|
|
116
|
+
result = result.replaceAll(FULL_DATA_REGEX, (_match, _leadingQuote, format, _trailingQuote)=>{
|
|
117
|
+
const interpolationFormat = parseFormat(format) ?? _variableinterpolation.InterpolationFormat.RAW;
|
|
118
|
+
let interpolationResult = '';
|
|
119
|
+
if (interpolationFormat === _variableinterpolation.InterpolationFormat.JSON) {
|
|
120
|
+
interpolationResult = JSON.stringify(item);
|
|
121
|
+
} else {
|
|
122
|
+
interpolationResult = (0, _variableinterpolation.interpolate)(Object.values(item).map((v)=>JSON.stringify(v)), '', interpolationFormat);
|
|
123
|
+
}
|
|
124
|
+
return interpolationResult;
|
|
125
|
+
});
|
|
126
|
+
// Reset regex lastIndex
|
|
127
|
+
SINGLE_FIELD_REGEX.lastIndex = 0;
|
|
128
|
+
// Replace __data.fields["fieldName"] or __data.fields.fieldName patterns
|
|
129
|
+
result = result.replaceAll(SINGLE_FIELD_REGEX, (_match, bracketField, dotField, format)=>{
|
|
130
|
+
const fieldName = bracketField ?? dotField ?? '';
|
|
131
|
+
const value = getFieldValue(item, fieldName);
|
|
132
|
+
if (value === '' && item[fieldName] === undefined) {
|
|
133
|
+
errors.push(`Field "${fieldName}" not found in data`);
|
|
134
|
+
}
|
|
135
|
+
const interpolationFormat = parseFormat(format);
|
|
136
|
+
if (interpolationFormat) {
|
|
137
|
+
return (0, _variableinterpolation.interpolate)([
|
|
138
|
+
value
|
|
139
|
+
], fieldName, interpolationFormat);
|
|
140
|
+
}
|
|
141
|
+
if (urlEncode) {
|
|
142
|
+
// override: disable urlEncode for RAW format
|
|
143
|
+
if (interpolationFormat === _variableinterpolation.InterpolationFormat.RAW) {
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
// avoid double encoding for queryparam and percentencode formats
|
|
147
|
+
if (interpolationFormat !== _variableinterpolation.InterpolationFormat.QUERYPARAM && interpolationFormat !== _variableinterpolation.InterpolationFormat.PERCENTENCODE) {
|
|
148
|
+
return encodeURIComponent(value);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return value;
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
text: result,
|
|
155
|
+
errors: errors.length > 0 ? errors : undefined
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function replaceDataFieldsBatch(template, items, options = {}) {
|
|
159
|
+
const { urlEncode = true } = options;
|
|
160
|
+
let result = template;
|
|
161
|
+
const errors = [];
|
|
162
|
+
// Replace __data.count with items length
|
|
163
|
+
result = result.replaceAll(DATA_COUNT_REGEX, String(items.length));
|
|
164
|
+
// Reset regex lastIndex
|
|
165
|
+
INDEXED_FIELD_REGEX.lastIndex = 0;
|
|
166
|
+
SINGLE_FIELD_REGEX.lastIndex = 0;
|
|
167
|
+
// Replace full data placeholder with optional format
|
|
168
|
+
result = result.replaceAll(FULL_DATA_REGEX, (_match, leadingQuote, format, trailingQuote)=>{
|
|
169
|
+
const interpolationFormat = parseFormat(format) ?? _variableinterpolation.InterpolationFormat.RAW;
|
|
170
|
+
const interpolationResult = (0, _variableinterpolation.interpolate)(Object.values(items).map((e)=>JSON.stringify(e)), '', interpolationFormat);
|
|
171
|
+
if (!leadingQuote || !trailingQuote) {
|
|
172
|
+
// preserve quotes as they were not surrounding the full_data pattern
|
|
173
|
+
return `${leadingQuote ?? ''}${interpolationResult}${trailingQuote ?? ''}`;
|
|
174
|
+
}
|
|
175
|
+
return interpolationResult;
|
|
176
|
+
});
|
|
177
|
+
// Replace indexed access: ${__data[0].fields["fieldName"]} or ${__data[0].fields['fieldName']}
|
|
178
|
+
result = result.replaceAll(INDEXED_FIELD_REGEX, (match, indexStr, fieldName)=>{
|
|
179
|
+
const idx = parseInt(indexStr, 10);
|
|
180
|
+
if (idx < 0 || idx >= items.length) {
|
|
181
|
+
errors.push(`Index ${idx} out of bounds (0-${items.length - 1})`);
|
|
182
|
+
return match;
|
|
183
|
+
}
|
|
184
|
+
const value = getFieldValue(items[idx], fieldName);
|
|
185
|
+
if (value === '' && items[idx][fieldName] === undefined) {
|
|
186
|
+
errors.push(`Field "${fieldName}" not found in data at index ${idx}`);
|
|
187
|
+
}
|
|
188
|
+
return urlEncode ? encodeURIComponent(value) : value;
|
|
189
|
+
});
|
|
190
|
+
// Replace aggregated access with format: ${__data.fields["fieldName"]:csv} or ${__data.fields.fieldName:csv}
|
|
191
|
+
result = result.replaceAll(SINGLE_FIELD_REGEX, (_match, bracketField, dotField, format)=>{
|
|
192
|
+
const fieldName = bracketField ?? dotField ?? '';
|
|
193
|
+
const values = items.map((item)=>getFieldValue(item, fieldName));
|
|
194
|
+
const interpolationFormat = parseFormat(format) || _variableinterpolation.InterpolationFormat.CSV;
|
|
195
|
+
return (0, _variableinterpolation.interpolate)(values, fieldName, interpolationFormat);
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
text: result,
|
|
199
|
+
errors: errors.length > 0 ? errors : undefined
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function hasBatchPatterns(template) {
|
|
203
|
+
// Reset regex lastIndex
|
|
204
|
+
INDEXED_FIELD_REGEX.lastIndex = 0;
|
|
205
|
+
return INDEXED_FIELD_REGEX.test(template) || /\$\{__data\.fields(?:\[["'][^"']+["']\]|\.[a-zA-Z_][a-zA-Z0-9_]*):[a-z]+\}/.test(template);
|
|
206
|
+
}
|
|
207
|
+
function hasIndexedPatterns(template) {
|
|
208
|
+
INDEXED_FIELD_REGEX.lastIndex = 0;
|
|
209
|
+
return INDEXED_FIELD_REGEX.test(template);
|
|
210
|
+
}
|
|
211
|
+
function hasDataFieldPatterns(template) {
|
|
212
|
+
SINGLE_FIELD_REGEX.lastIndex = 0;
|
|
213
|
+
INDEXED_FIELD_REGEX.lastIndex = 0;
|
|
214
|
+
return SINGLE_FIELD_REGEX.test(template) || INDEXED_FIELD_REGEX.test(template);
|
|
215
|
+
}
|
|
216
|
+
function extractFieldNames(template) {
|
|
217
|
+
const fields = new Set();
|
|
218
|
+
// Reset regex lastIndex
|
|
219
|
+
SINGLE_FIELD_REGEX.lastIndex = 0;
|
|
220
|
+
INDEXED_FIELD_REGEX.lastIndex = 0;
|
|
221
|
+
let match;
|
|
222
|
+
while((match = SINGLE_FIELD_REGEX.exec(template)) !== null){
|
|
223
|
+
// Group 1 is bracket notation, group 2 is dot notation
|
|
224
|
+
fields.add(match[1] ?? match[2]);
|
|
225
|
+
}
|
|
226
|
+
while((match = INDEXED_FIELD_REGEX.exec(template)) !== null){
|
|
227
|
+
fields.add(match[2]);
|
|
228
|
+
}
|
|
229
|
+
return Array.from(fields);
|
|
230
|
+
}
|
package/dist/cjs/utils/format.js
CHANGED
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -19,9 +19,12 @@ _export_star(require("./browser-storage"), exports);
|
|
|
19
19
|
_export_star(require("./chart-actions"), exports);
|
|
20
20
|
_export_star(require("./combine-sx"), exports);
|
|
21
21
|
_export_star(require("./component-ids"), exports);
|
|
22
|
+
_export_star(require("./data-field-interpolation"), exports);
|
|
22
23
|
_export_star(require("./format"), exports);
|
|
23
|
-
_export_star(require("./theme-gen"), exports);
|
|
24
24
|
_export_star(require("./memo"), exports);
|
|
25
|
+
_export_star(require("./selection-interpolation"), exports);
|
|
26
|
+
_export_star(require("./theme-gen"), exports);
|
|
27
|
+
_export_star(require("./variable-interpolation"), exports);
|
|
25
28
|
function _export_star(from, to) {
|
|
26
29
|
Object.keys(from).forEach(function(k) {
|
|
27
30
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/utils/mathjs.js
CHANGED
package/dist/cjs/utils/memo.js
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get interpolateSelectionBatch () {
|
|
25
|
+
return interpolateSelectionBatch;
|
|
26
|
+
},
|
|
27
|
+
get interpolateSelectionIndividual () {
|
|
28
|
+
return interpolateSelectionIndividual;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const _datafieldinterpolation = require("./data-field-interpolation");
|
|
32
|
+
const _variableinterpolation = require("./variable-interpolation");
|
|
33
|
+
function interpolateSelectionIndividual(template, item, index, count, variableState) {
|
|
34
|
+
// Replace __data patterns using shared utility (includes __data.index and __data.count)
|
|
35
|
+
const dataFieldResult = (0, _datafieldinterpolation.replaceDataFields)(template, item, {
|
|
36
|
+
index,
|
|
37
|
+
count
|
|
38
|
+
});
|
|
39
|
+
let result = dataFieldResult.text;
|
|
40
|
+
const errors = [];
|
|
41
|
+
if (dataFieldResult.errors) {
|
|
42
|
+
errors.push(...dataFieldResult.errors.map((e)=>e.replace('in data', 'in selection data')));
|
|
43
|
+
}
|
|
44
|
+
// Apply dashboard variable interpolation if provided
|
|
45
|
+
if (variableState) {
|
|
46
|
+
result = (0, _variableinterpolation.replaceVariables)(result, variableState);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
text: result,
|
|
50
|
+
errors: errors.length > 0 ? errors : undefined
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function interpolateSelectionBatch(template, items, variableState) {
|
|
54
|
+
// Replace __data patterns using shared utility (includes __data.count)
|
|
55
|
+
const dataFieldResult = (0, _datafieldinterpolation.replaceDataFieldsBatch)(template, items);
|
|
56
|
+
let result = dataFieldResult.text;
|
|
57
|
+
const errors = [];
|
|
58
|
+
if (dataFieldResult.errors) {
|
|
59
|
+
errors.push(...dataFieldResult.errors.map((e)=>e.replace('in data', 'in selection data')));
|
|
60
|
+
}
|
|
61
|
+
// Apply dashboard variable interpolation if provided
|
|
62
|
+
if (variableState) {
|
|
63
|
+
result = (0, _variableinterpolation.replaceVariables)(result, variableState);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
text: result,
|
|
67
|
+
errors: errors.length > 0 ? errors : undefined
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get InterpolationFormat () {
|
|
25
|
+
return InterpolationFormat;
|
|
26
|
+
},
|
|
27
|
+
get interpolate () {
|
|
28
|
+
return interpolate;
|
|
29
|
+
},
|
|
30
|
+
get parseVariables () {
|
|
31
|
+
return parseVariables;
|
|
32
|
+
},
|
|
33
|
+
get parseVariablesAndFormat () {
|
|
34
|
+
return parseVariablesAndFormat;
|
|
35
|
+
},
|
|
36
|
+
get replaceVariable () {
|
|
37
|
+
return replaceVariable;
|
|
38
|
+
},
|
|
39
|
+
get replaceVariables () {
|
|
40
|
+
return replaceVariables;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
var InterpolationFormat = /*#__PURE__*/ function(InterpolationFormat) {
|
|
44
|
+
InterpolationFormat["CSV"] = "csv";
|
|
45
|
+
InterpolationFormat["DISTRIBUTED"] = "distributed";
|
|
46
|
+
InterpolationFormat["DOUBLEQUOTE"] = "doublequote";
|
|
47
|
+
InterpolationFormat["GLOB"] = "glob";
|
|
48
|
+
InterpolationFormat["JSON"] = "json";
|
|
49
|
+
InterpolationFormat["LUCENE"] = "lucene";
|
|
50
|
+
InterpolationFormat["PERCENTENCODE"] = "percentencode";
|
|
51
|
+
InterpolationFormat["PIPE"] = "pipe";
|
|
52
|
+
InterpolationFormat["PROMETHEUS"] = "prometheus";
|
|
53
|
+
InterpolationFormat["RAW"] = "raw";
|
|
54
|
+
InterpolationFormat["REGEX"] = "regex";
|
|
55
|
+
InterpolationFormat["SINGLEQUOTE"] = "singlequote";
|
|
56
|
+
InterpolationFormat["SQLSTRING"] = "sqlstring";
|
|
57
|
+
InterpolationFormat["TEXT"] = "text";
|
|
58
|
+
InterpolationFormat["QUERYPARAM"] = "queryparam";
|
|
59
|
+
return InterpolationFormat;
|
|
60
|
+
}({});
|
|
61
|
+
function stringToFormat(val) {
|
|
62
|
+
if (!val) return undefined;
|
|
63
|
+
const lowerVal = val.toLowerCase();
|
|
64
|
+
return Object.values(InterpolationFormat).find((format)=>format === lowerVal) || undefined;
|
|
65
|
+
}
|
|
66
|
+
function interpolate(values, name, format) {
|
|
67
|
+
switch(format){
|
|
68
|
+
case "csv":
|
|
69
|
+
case "raw":
|
|
70
|
+
return values.join(',');
|
|
71
|
+
case "distributed":
|
|
72
|
+
{
|
|
73
|
+
const [first, ...rest] = values;
|
|
74
|
+
return `${[
|
|
75
|
+
first,
|
|
76
|
+
...rest.map((v)=>`${name}=${v}`)
|
|
77
|
+
].join(',')}`;
|
|
78
|
+
}
|
|
79
|
+
case "doublequote":
|
|
80
|
+
return values.map((v)=>`"${v}"`).join(',');
|
|
81
|
+
case "glob":
|
|
82
|
+
return `{${values.join(',')}}`;
|
|
83
|
+
case "json":
|
|
84
|
+
{
|
|
85
|
+
// values might contain stringified JSON objects so we need to parse them first
|
|
86
|
+
// and then return a JSON stringified array to return valid JSON
|
|
87
|
+
const parsedValues = values.map((v)=>{
|
|
88
|
+
try {
|
|
89
|
+
return JSON.parse(v);
|
|
90
|
+
} catch {
|
|
91
|
+
return v;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return JSON.stringify(parsedValues);
|
|
95
|
+
}
|
|
96
|
+
case "lucene":
|
|
97
|
+
return `(${values.map((v)=>`"${v}"`).join(' OR ')})`;
|
|
98
|
+
case "percentencode":
|
|
99
|
+
return encodeURIComponent(values.join(','));
|
|
100
|
+
case "pipe":
|
|
101
|
+
return values.join('|');
|
|
102
|
+
case "regex":
|
|
103
|
+
{
|
|
104
|
+
const escapedRegex = values.map((v)=>v.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'));
|
|
105
|
+
return `(${escapedRegex.join('|')})`;
|
|
106
|
+
}
|
|
107
|
+
case "singlequote":
|
|
108
|
+
return values.map((v)=>`'${v}'`).join(',');
|
|
109
|
+
case "sqlstring":
|
|
110
|
+
return values.map((v)=>`'${v.replace(/'/g, "''")}'`).join(',');
|
|
111
|
+
case "text":
|
|
112
|
+
return values.join(' + ');
|
|
113
|
+
case "queryparam":
|
|
114
|
+
return values.map((v)=>`${name}=${encodeURIComponent(v)}`).join('&');
|
|
115
|
+
case "prometheus":
|
|
116
|
+
default:
|
|
117
|
+
return `(${values.join('|')})`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function replaceVariable(text, varName, variableValue, varFormat) {
|
|
121
|
+
const variableSyntax = '$' + varName;
|
|
122
|
+
const alternativeVariableSyntax = '${' + varName + (varFormat ? ':' + varFormat : '') + '}';
|
|
123
|
+
let replaceString = '';
|
|
124
|
+
if (Array.isArray(variableValue)) {
|
|
125
|
+
replaceString = interpolate(variableValue, varName, varFormat || "prometheus");
|
|
126
|
+
}
|
|
127
|
+
if (typeof variableValue === 'string') {
|
|
128
|
+
replaceString = interpolate([
|
|
129
|
+
variableValue
|
|
130
|
+
], varName, varFormat || "raw");
|
|
131
|
+
}
|
|
132
|
+
text = text.replaceAll(variableSyntax, replaceString);
|
|
133
|
+
return text.replaceAll(alternativeVariableSyntax, replaceString);
|
|
134
|
+
}
|
|
135
|
+
// This regular expression is designed to identify variable references in a string.
|
|
136
|
+
// It supports two formats for referencing variables:
|
|
137
|
+
// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\w+ matches one or more word characters).
|
|
138
|
+
// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\w+ matches one or more word characters) in the curly braces.
|
|
139
|
+
// 3. ${variableName:format} - This is a more complex format that allows specifying a format interpolation.
|
|
140
|
+
const VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^}]+))?(?::([^}]+))?}/gm;
|
|
141
|
+
function parseVariables(text) {
|
|
142
|
+
const matches = new Set();
|
|
143
|
+
let match;
|
|
144
|
+
while((match = VARIABLE_REGEX.exec(text)) !== null){
|
|
145
|
+
if (match) {
|
|
146
|
+
if (match[1]) {
|
|
147
|
+
// \$(\w+)\
|
|
148
|
+
matches.add(match[1]);
|
|
149
|
+
} else if (match[2]) {
|
|
150
|
+
// \${(\w+)}\
|
|
151
|
+
matches.add(match[2]);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// return unique matches
|
|
156
|
+
return Array.from(matches.values());
|
|
157
|
+
}
|
|
158
|
+
function parseVariablesAndFormat(text) {
|
|
159
|
+
const matches = new Map();
|
|
160
|
+
let match;
|
|
161
|
+
while((match = VARIABLE_REGEX.exec(text)) !== null){
|
|
162
|
+
if (match) {
|
|
163
|
+
let format = undefined;
|
|
164
|
+
if (match[4]) {
|
|
165
|
+
format = match[4];
|
|
166
|
+
}
|
|
167
|
+
if (match[1]) {
|
|
168
|
+
// \$(\w+)\
|
|
169
|
+
matches.set(match[1], stringToFormat(format));
|
|
170
|
+
} else if (match[2]) {
|
|
171
|
+
// \${(\w+)}\
|
|
172
|
+
matches.set(match[2], stringToFormat(format));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return matches;
|
|
177
|
+
}
|
|
178
|
+
function replaceVariables(text, variableState) {
|
|
179
|
+
const variablesMap = parseVariablesAndFormat(text);
|
|
180
|
+
const variables = Array.from(variablesMap.keys());
|
|
181
|
+
let finalText = text;
|
|
182
|
+
variables// Sorting variables by their length.
|
|
183
|
+
// In order to not have a variable name have contained in another variable name.
|
|
184
|
+
// i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'
|
|
185
|
+
.sort((a, b)=>b.length - a.length).forEach((v)=>{
|
|
186
|
+
const variable = variableState[v];
|
|
187
|
+
if (variable && variable.value !== undefined) {
|
|
188
|
+
finalText = replaceVariable(finalText, v, variable?.value, variablesMap.get(v));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return finalText;
|
|
192
|
+
}
|