@perses-dev/components 0.0.0-snapshot-time-range-height-80d08fc
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/LICENSE +201 -0
- package/README.md +18 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +9 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js +181 -0
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +1 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +12 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +79 -0
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +1 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +17 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +58 -0
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +1 -0
- package/dist/DateTimeRangePicker/index.d.ts +4 -0
- package/dist/DateTimeRangePicker/index.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/index.js +17 -0
- package/dist/DateTimeRangePicker/index.js.map +1 -0
- package/dist/DateTimeRangePicker/utils.d.ts +7 -0
- package/dist/DateTimeRangePicker/utils.d.ts.map +1 -0
- package/dist/DateTimeRangePicker/utils.js +37 -0
- package/dist/DateTimeRangePicker/utils.js.map +1 -0
- package/dist/Drawer/Drawer.d.ts +9 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -0
- package/dist/Drawer/Drawer.js +34 -0
- package/dist/Drawer/Drawer.js.map +1 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/index.d.ts.map +1 -0
- package/dist/Drawer/index.js +15 -0
- package/dist/Drawer/index.js.map +1 -0
- package/dist/EChart.d.ts +61 -0
- package/dist/EChart.d.ts.map +1 -0
- package/dist/EChart.js +143 -0
- package/dist/EChart.js.map +1 -0
- package/dist/ErrorAlert.d.ts +9 -0
- package/dist/ErrorAlert.d.ts.map +1 -0
- package/dist/ErrorAlert.js +25 -0
- package/dist/ErrorAlert.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +3 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +16 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/GaugeChart/GaugeChart.d.ts +15 -0
- package/dist/GaugeChart/GaugeChart.d.ts.map +1 -0
- package/dist/GaugeChart/GaugeChart.js +172 -0
- package/dist/GaugeChart/GaugeChart.js.map +1 -0
- package/dist/GaugeChart/index.d.ts +2 -0
- package/dist/GaugeChart/index.d.ts.map +1 -0
- package/dist/GaugeChart/index.js +15 -0
- package/dist/GaugeChart/index.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.d.ts +17 -0
- package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.js +76 -0
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.test.d.ts +2 -0
- package/dist/InfoTooltip/InfoTooltip.test.d.ts.map +1 -0
- package/dist/InfoTooltip/InfoTooltip.test.js +36 -0
- package/dist/InfoTooltip/InfoTooltip.test.js.map +1 -0
- package/dist/InfoTooltip/index.d.ts +2 -0
- package/dist/InfoTooltip/index.d.ts.map +1 -0
- package/dist/InfoTooltip/index.js +15 -0
- package/dist/InfoTooltip/index.js.map +1 -0
- package/dist/JSONEditor.d.ts +8 -0
- package/dist/JSONEditor.d.ts.map +1 -0
- package/dist/JSONEditor.js +51 -0
- package/dist/JSONEditor.js.map +1 -0
- package/dist/Legend/CompactLegend.d.ts +13 -0
- package/dist/Legend/CompactLegend.d.ts.map +1 -0
- package/dist/Legend/CompactLegend.js +45 -0
- package/dist/Legend/CompactLegend.js.map +1 -0
- package/dist/Legend/Legend.d.ts +11 -0
- package/dist/Legend/Legend.d.ts.map +1 -0
- package/dist/Legend/Legend.js +39 -0
- package/dist/Legend/Legend.js.map +1 -0
- package/dist/Legend/LegendColorBadge.d.ts +7 -0
- package/dist/Legend/LegendColorBadge.d.ts.map +1 -0
- package/dist/Legend/LegendColorBadge.js +31 -0
- package/dist/Legend/LegendColorBadge.js.map +1 -0
- package/dist/Legend/ListLegend.d.ts +11 -0
- package/dist/Legend/ListLegend.d.ts.map +1 -0
- package/dist/Legend/ListLegend.js +40 -0
- package/dist/Legend/ListLegend.js.map +1 -0
- package/dist/Legend/ListLegendItem.d.ts +9 -0
- package/dist/Legend/ListLegendItem.d.ts.map +1 -0
- package/dist/Legend/ListLegendItem.js +47 -0
- package/dist/Legend/ListLegendItem.js.map +1 -0
- package/dist/Legend/index.d.ts +2 -0
- package/dist/Legend/index.d.ts.map +1 -0
- package/dist/Legend/index.js +15 -0
- package/dist/Legend/index.js.map +1 -0
- package/dist/LineChart/LineChart.d.ts +19 -0
- package/dist/LineChart/LineChart.d.ts.map +1 -0
- package/dist/LineChart/LineChart.js +189 -0
- package/dist/LineChart/LineChart.js.map +1 -0
- package/dist/LineChart/index.d.ts +3 -0
- package/dist/LineChart/index.d.ts.map +1 -0
- package/dist/LineChart/index.js +15 -0
- package/dist/LineChart/index.js.map +1 -0
- package/dist/LineChart/utils.d.ts +30 -0
- package/dist/LineChart/utils.d.ts.map +1 -0
- package/dist/LineChart/utils.js +90 -0
- package/dist/LineChart/utils.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +28 -0
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts +5 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +50 -0
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +26 -0
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts +13 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +36 -0
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -0
- package/dist/OptionsEditorLayout/index.d.ts +5 -0
- package/dist/OptionsEditorLayout/index.d.ts.map +1 -0
- package/dist/OptionsEditorLayout/index.js +18 -0
- package/dist/OptionsEditorLayout/index.js.map +1 -0
- package/dist/StatChart/StatChart.d.ts +19 -0
- package/dist/StatChart/StatChart.d.ts.map +1 -0
- package/dist/StatChart/StatChart.js +121 -0
- package/dist/StatChart/StatChart.js.map +1 -0
- package/dist/StatChart/StatChart.test.d.ts +2 -0
- package/dist/StatChart/StatChart.test.d.ts.map +1 -0
- package/dist/StatChart/StatChart.test.js +87 -0
- package/dist/StatChart/StatChart.test.js.map +1 -0
- package/dist/StatChart/index.d.ts +2 -0
- package/dist/StatChart/index.d.ts.map +1 -0
- package/dist/StatChart/index.js +15 -0
- package/dist/StatChart/index.js.map +1 -0
- package/dist/Tooltip/SeriesInfo.d.ts +12 -0
- package/dist/Tooltip/SeriesInfo.d.ts.map +1 -0
- package/dist/Tooltip/SeriesInfo.js +143 -0
- package/dist/Tooltip/SeriesInfo.js.map +1 -0
- package/dist/Tooltip/SeriesMarker.d.ts +7 -0
- package/dist/Tooltip/SeriesMarker.d.ts.map +1 -0
- package/dist/Tooltip/SeriesMarker.js +33 -0
- package/dist/Tooltip/SeriesMarker.js.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts +13 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip/Tooltip.js +72 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/TooltipContent.d.ts +9 -0
- package/dist/Tooltip/TooltipContent.d.ts.map +1 -0
- package/dist/Tooltip/TooltipContent.js +89 -0
- package/dist/Tooltip/TooltipContent.js.map +1 -0
- package/dist/Tooltip/focused-series.d.ts +25 -0
- package/dist/Tooltip/focused-series.d.ts.map +1 -0
- package/dist/Tooltip/focused-series.js +111 -0
- package/dist/Tooltip/focused-series.js.map +1 -0
- package/dist/Tooltip/focused-series.test.d.ts +2 -0
- package/dist/Tooltip/focused-series.test.d.ts.map +1 -0
- package/dist/Tooltip/focused-series.test.js +93 -0
- package/dist/Tooltip/focused-series.test.js.map +1 -0
- package/dist/Tooltip/index.d.ts +3 -0
- package/dist/Tooltip/index.d.ts.map +1 -0
- package/dist/Tooltip/index.js +16 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/Tooltip/tooltip-model.d.ts +79 -0
- package/dist/Tooltip/tooltip-model.d.ts.map +1 -0
- package/dist/Tooltip/tooltip-model.js +80 -0
- package/dist/Tooltip/tooltip-model.js.map +1 -0
- package/dist/Tooltip/utils.d.ts +6 -0
- package/dist/Tooltip/utils.d.ts.map +1 -0
- package/dist/Tooltip/utils.js +46 -0
- package/dist/Tooltip/utils.js.map +1 -0
- package/dist/UnitSelector/UnitSelector.d.ts +8 -0
- package/dist/UnitSelector/UnitSelector.d.ts.map +1 -0
- package/dist/UnitSelector/UnitSelector.js +112 -0
- package/dist/UnitSelector/UnitSelector.js.map +1 -0
- package/dist/UnitSelector/UnitSelector.test.d.ts +2 -0
- package/dist/UnitSelector/UnitSelector.test.d.ts.map +1 -0
- package/dist/UnitSelector/UnitSelector.test.js +205 -0
- package/dist/UnitSelector/UnitSelector.test.js.map +1 -0
- package/dist/UnitSelector/index.d.ts +2 -0
- package/dist/UnitSelector/index.d.ts.map +1 -0
- package/dist/UnitSelector/index.js +15 -0
- package/dist/UnitSelector/index.js.map +1 -0
- package/dist/YAxisLabel.d.ts +8 -0
- package/dist/YAxisLabel.d.ts.map +1 -0
- package/dist/YAxisLabel.js +39 -0
- package/dist/YAxisLabel.js.map +1 -0
- package/dist/cjs/DateTimeRangePicker/AbsoluteTimePicker.js +187 -0
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +85 -0
- package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +69 -0
- package/dist/cjs/DateTimeRangePicker/index.js +30 -0
- package/dist/cjs/DateTimeRangePicker/utils.js +45 -0
- package/dist/cjs/Drawer/Drawer.js +40 -0
- package/dist/cjs/Drawer/index.js +28 -0
- package/dist/cjs/EChart.js +188 -0
- package/dist/cjs/ErrorAlert.js +29 -0
- package/dist/cjs/ErrorBoundary.js +22 -0
- package/dist/cjs/GaugeChart/GaugeChart.js +178 -0
- package/dist/cjs/GaugeChart/index.js +28 -0
- package/dist/cjs/InfoTooltip/InfoTooltip.js +93 -0
- package/dist/cjs/InfoTooltip/InfoTooltip.test.js +43 -0
- package/dist/cjs/InfoTooltip/index.js +28 -0
- package/dist/cjs/JSONEditor.js +57 -0
- package/dist/cjs/Legend/CompactLegend.js +48 -0
- package/dist/cjs/Legend/Legend.js +45 -0
- package/dist/cjs/Legend/LegendColorBadge.js +42 -0
- package/dist/cjs/Legend/ListLegend.js +44 -0
- package/dist/cjs/Legend/ListLegendItem.js +91 -0
- package/dist/cjs/Legend/index.js +28 -0
- package/dist/cjs/LineChart/LineChart.js +195 -0
- package/dist/cjs/LineChart/index.js +28 -0
- package/dist/cjs/LineChart/utils.js +95 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorColumn.js +32 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorControl.js +61 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGrid.js +29 -0
- package/dist/cjs/OptionsEditorLayout/OptionsEditorGroup.js +40 -0
- package/dist/cjs/OptionsEditorLayout/index.js +31 -0
- package/dist/cjs/StatChart/StatChart.js +165 -0
- package/dist/cjs/StatChart/StatChart.test.js +89 -0
- package/dist/cjs/StatChart/index.js +28 -0
- package/dist/cjs/Tooltip/SeriesInfo.js +149 -0
- package/dist/cjs/Tooltip/SeriesMarker.js +39 -0
- package/dist/cjs/Tooltip/Tooltip.js +116 -0
- package/dist/cjs/Tooltip/TooltipContent.js +95 -0
- package/dist/cjs/Tooltip/focused-series.js +117 -0
- package/dist/cjs/Tooltip/focused-series.test.js +95 -0
- package/dist/cjs/Tooltip/index.js +29 -0
- package/dist/cjs/Tooltip/tooltip-model.js +98 -0
- package/dist/cjs/Tooltip/utils.js +50 -0
- package/dist/cjs/UnitSelector/UnitSelector.js +118 -0
- package/dist/cjs/UnitSelector/UnitSelector.test.js +212 -0
- package/dist/cjs/UnitSelector/index.js +28 -0
- package/dist/cjs/YAxisLabel.js +45 -0
- package/dist/cjs/context/ChartsThemeProvider.js +83 -0
- package/dist/cjs/context/TimeZoneProvider.js +90 -0
- package/dist/cjs/index.js +47 -0
- package/dist/cjs/model/graph.js +21 -0
- package/dist/cjs/model/index.js +30 -0
- package/dist/cjs/model/theme.js +16 -0
- package/dist/cjs/model/units/bytes.js +60 -0
- package/dist/cjs/model/units/constants.js +23 -0
- package/dist/cjs/model/units/decimal.js +67 -0
- package/dist/cjs/model/units/index.js +30 -0
- package/dist/cjs/model/units/percent.js +64 -0
- package/dist/cjs/model/units/time.js +102 -0
- package/dist/cjs/model/units/types.js +28 -0
- package/dist/cjs/model/units/units.js +104 -0
- package/dist/cjs/test/index.js +28 -0
- package/dist/cjs/test/render.js +36 -0
- package/dist/cjs/test/setup-tests.js +20 -0
- package/dist/cjs/test-utils/index.js +28 -0
- package/dist/cjs/test-utils/theme.js +28 -0
- package/dist/cjs/theme/index.js +28 -0
- package/dist/cjs/theme/palette/background.js +40 -0
- package/dist/cjs/theme/palette/colors/blue.js +35 -0
- package/dist/cjs/theme/palette/colors/common.js +28 -0
- package/dist/cjs/theme/palette/colors/green.js +35 -0
- package/dist/cjs/theme/palette/colors/grey.js +35 -0
- package/dist/cjs/theme/palette/colors/index.js +35 -0
- package/dist/cjs/theme/palette/colors/orange.js +35 -0
- package/dist/cjs/theme/palette/colors/purple.js +35 -0
- package/dist/cjs/theme/palette/colors/red.js +35 -0
- package/dist/cjs/theme/palette/colors/types.js +16 -0
- package/dist/cjs/theme/palette/error.js +32 -0
- package/dist/cjs/theme/palette/grey.js +44 -0
- package/dist/cjs/theme/palette/index.js +28 -0
- package/dist/cjs/theme/palette/palette-options.js +59 -0
- package/dist/cjs/theme/palette/primary.js +32 -0
- package/dist/cjs/theme/palette/secondary.js +32 -0
- package/dist/cjs/theme/palette/success.js +32 -0
- package/dist/cjs/theme/palette/text.js +42 -0
- package/dist/cjs/theme/palette/warning.js +32 -0
- package/dist/cjs/theme/theme.js +64 -0
- package/dist/cjs/theme/types/ThemeExtension.d.js +17 -0
- package/dist/cjs/theme/typography.js +96 -0
- package/dist/cjs/utils/combine-sx.js +29 -0
- package/dist/cjs/utils/component-ids.js +31 -0
- package/dist/cjs/utils/format.js +56 -0
- package/dist/cjs/utils/format.test.js +47 -0
- package/dist/cjs/utils/index.js +31 -0
- package/dist/cjs/utils/mathjs.js +25 -0
- package/dist/cjs/utils/theme-gen.js +188 -0
- package/dist/cjs/utils/theme-gen.test.js +197 -0
- package/dist/context/ChartsThemeProvider.d.ts +10 -0
- package/dist/context/ChartsThemeProvider.d.ts.map +1 -0
- package/dist/context/ChartsThemeProvider.js +31 -0
- package/dist/context/ChartsThemeProvider.js.map +1 -0
- package/dist/context/TimeZoneProvider.d.ts +13 -0
- package/dist/context/TimeZoneProvider.d.ts.map +1 -0
- package/dist/context/TimeZoneProvider.js +38 -0
- package/dist/context/TimeZoneProvider.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/model/graph.d.ts +34 -0
- package/dist/model/graph.d.ts.map +1 -0
- package/dist/model/graph.js +16 -0
- package/dist/model/graph.js.map +1 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +17 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/theme.d.ts +15 -0
- package/dist/model/theme.d.ts.map +1 -0
- package/dist/model/theme.js +15 -0
- package/dist/model/theme.js.map +1 -0
- package/dist/model/units/bytes.d.ts +12 -0
- package/dist/model/units/bytes.d.ts.map +1 -0
- package/dist/model/units/bytes.js +48 -0
- package/dist/model/units/bytes.js.map +1 -0
- package/dist/model/units/constants.d.ts +2 -0
- package/dist/model/units/constants.d.ts.map +1 -0
- package/dist/model/units/constants.js +17 -0
- package/dist/model/units/constants.js.map +1 -0
- package/dist/model/units/decimal.d.ts +24 -0
- package/dist/model/units/decimal.d.ts.map +1 -0
- package/dist/model/units/decimal.js +59 -0
- package/dist/model/units/decimal.js.map +1 -0
- package/dist/model/units/index.d.ts +4 -0
- package/dist/model/units/index.d.ts.map +1 -0
- package/dist/model/units/index.js +17 -0
- package/dist/model/units/index.js.map +1 -0
- package/dist/model/units/percent.d.ts +12 -0
- package/dist/model/units/percent.d.ts.map +1 -0
- package/dist/model/units/percent.js +51 -0
- package/dist/model/units/percent.js.map +1 -0
- package/dist/model/units/time.d.ts +22 -0
- package/dist/model/units/time.d.ts.map +1 -0
- package/dist/model/units/time.js +88 -0
- package/dist/model/units/time.js.map +1 -0
- package/dist/model/units/types.d.ts +38 -0
- package/dist/model/units/types.d.ts.map +1 -0
- package/dist/model/units/types.js +22 -0
- package/dist/model/units/types.js.map +1 -0
- package/dist/model/units/units.d.ts +40 -0
- package/dist/model/units/units.d.ts.map +1 -0
- package/dist/model/units/units.js +83 -0
- package/dist/model/units/units.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +7 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +32 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +18 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +15 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/theme.d.ts +3 -0
- package/dist/test-utils/theme.d.ts.map +1 -0
- package/dist/test-utils/theme.js +22 -0
- package/dist/test-utils/theme.js.map +1 -0
- package/dist/theme/index.d.ts +37 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +15 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/palette/background.d.ts +3 -0
- package/dist/theme/palette/background.d.ts.map +1 -0
- package/dist/theme/palette/background.js +34 -0
- package/dist/theme/palette/background.js.map +1 -0
- package/dist/theme/palette/colors/blue.d.ts +3 -0
- package/dist/theme/palette/colors/blue.d.ts.map +1 -0
- package/dist/theme/palette/colors/blue.js +29 -0
- package/dist/theme/palette/colors/blue.js.map +1 -0
- package/dist/theme/palette/colors/common.d.ts +3 -0
- package/dist/theme/palette/colors/common.d.ts.map +1 -0
- package/dist/theme/palette/colors/common.js +16 -0
- package/dist/theme/palette/colors/common.js.map +1 -0
- package/dist/theme/palette/colors/green.d.ts +3 -0
- package/dist/theme/palette/colors/green.d.ts.map +1 -0
- package/dist/theme/palette/colors/green.js +29 -0
- package/dist/theme/palette/colors/green.js.map +1 -0
- package/dist/theme/palette/colors/grey.d.ts +3 -0
- package/dist/theme/palette/colors/grey.d.ts.map +1 -0
- package/dist/theme/palette/colors/grey.js +29 -0
- package/dist/theme/palette/colors/grey.js.map +1 -0
- package/dist/theme/palette/colors/index.d.ts +9 -0
- package/dist/theme/palette/colors/index.d.ts.map +1 -0
- package/dist/theme/palette/colors/index.js +22 -0
- package/dist/theme/palette/colors/index.js.map +1 -0
- package/dist/theme/palette/colors/orange.d.ts +3 -0
- package/dist/theme/palette/colors/orange.d.ts.map +1 -0
- package/dist/theme/palette/colors/orange.js +29 -0
- package/dist/theme/palette/colors/orange.js.map +1 -0
- package/dist/theme/palette/colors/purple.d.ts +3 -0
- package/dist/theme/palette/colors/purple.d.ts.map +1 -0
- package/dist/theme/palette/colors/purple.js +29 -0
- package/dist/theme/palette/colors/purple.js.map +1 -0
- package/dist/theme/palette/colors/red.d.ts +3 -0
- package/dist/theme/palette/colors/red.d.ts.map +1 -0
- package/dist/theme/palette/colors/red.js +29 -0
- package/dist/theme/palette/colors/red.js.map +1 -0
- package/dist/theme/palette/colors/types.d.ts +17 -0
- package/dist/theme/palette/colors/types.d.ts.map +1 -0
- package/dist/theme/palette/colors/types.js +15 -0
- package/dist/theme/palette/colors/types.js.map +1 -0
- package/dist/theme/palette/error.d.ts +3 -0
- package/dist/theme/palette/error.d.ts.map +1 -0
- package/dist/theme/palette/error.js +26 -0
- package/dist/theme/palette/error.js.map +1 -0
- package/dist/theme/palette/grey.d.ts +3 -0
- package/dist/theme/palette/grey.d.ts.map +1 -0
- package/dist/theme/palette/grey.js +38 -0
- package/dist/theme/palette/grey.js.map +1 -0
- package/dist/theme/palette/index.d.ts +3 -0
- package/dist/theme/palette/index.d.ts.map +1 -0
- package/dist/theme/palette/index.js +15 -0
- package/dist/theme/palette/index.js.map +1 -0
- package/dist/theme/palette/palette-options.d.ts +6 -0
- package/dist/theme/palette/palette-options.d.ts.map +1 -0
- package/dist/theme/palette/palette-options.js +55 -0
- package/dist/theme/palette/palette-options.js.map +1 -0
- package/dist/theme/palette/primary.d.ts +3 -0
- package/dist/theme/palette/primary.d.ts.map +1 -0
- package/dist/theme/palette/primary.js +26 -0
- package/dist/theme/palette/primary.js.map +1 -0
- package/dist/theme/palette/secondary.d.ts +3 -0
- package/dist/theme/palette/secondary.d.ts.map +1 -0
- package/dist/theme/palette/secondary.js +26 -0
- package/dist/theme/palette/secondary.js.map +1 -0
- package/dist/theme/palette/success.d.ts +3 -0
- package/dist/theme/palette/success.d.ts.map +1 -0
- package/dist/theme/palette/success.js +26 -0
- package/dist/theme/palette/success.js.map +1 -0
- package/dist/theme/palette/text.d.ts +3 -0
- package/dist/theme/palette/text.d.ts.map +1 -0
- package/dist/theme/palette/text.js +36 -0
- package/dist/theme/palette/text.js.map +1 -0
- package/dist/theme/palette/warning.d.ts +3 -0
- package/dist/theme/palette/warning.d.ts.map +1 -0
- package/dist/theme/palette/warning.js +26 -0
- package/dist/theme/palette/warning.js.map +1 -0
- package/dist/theme/theme.d.ts +13 -0
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/theme/theme.js +67 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/theme/types/ThemeExtension.d.js +16 -0
- package/dist/theme/types/ThemeExtension.d.js.map +1 -0
- package/dist/theme/typography.d.ts +10 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +92 -0
- package/dist/theme/typography.js.map +1 -0
- package/dist/utils/combine-sx.d.ts +8 -0
- package/dist/utils/combine-sx.d.ts.map +1 -0
- package/dist/utils/combine-sx.js +27 -0
- package/dist/utils/combine-sx.js.map +1 -0
- package/dist/utils/component-ids.d.ts +8 -0
- package/dist/utils/component-ids.d.ts.map +1 -0
- package/dist/utils/component-ids.js +27 -0
- package/dist/utils/component-ids.js.map +1 -0
- package/dist/utils/format.d.ts +3 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +44 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/format.test.d.ts +2 -0
- package/dist/utils/format.test.d.ts.map +1 -0
- package/dist/utils/format.test.js +45 -0
- package/dist/utils/format.test.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/mathjs.d.ts +6 -0
- package/dist/utils/mathjs.d.ts.map +1 -0
- package/dist/utils/mathjs.js +20 -0
- package/dist/utils/mathjs.js.map +1 -0
- package/dist/utils/theme-gen.d.ts +6 -0
- package/dist/utils/theme-gen.d.ts.map +1 -0
- package/dist/utils/theme-gen.js +182 -0
- package/dist/utils/theme-gen.js.map +1 -0
- package/dist/utils/theme-gen.test.d.ts +2 -0
- package/dist/utils/theme-gen.test.d.ts.map +1 -0
- package/dist/utils/theme-gen.test.js +195 -0
- package/dist/utils/theme-gen.test.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
// adjust display when there are many time series to help with performance
|
|
14
|
+
export const OPTIMIZED_MODE_SERIES_LIMIT = 1000;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/graph.ts"],"sourcesContent":["// Copyright 2022 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 { MouseEventHandler } from 'react';\nimport { LineSeriesOption } from 'echarts/charts';\n\n// adjust display when there are many time series to help with performance\nexport const OPTIMIZED_MODE_SERIES_LIMIT = 1000;\n\nexport type UnixTimeMs = number;\n\nexport type GraphSeriesValueTuple = [timestamp: UnixTimeMs, value: number];\n\nexport interface GraphSeries {\n name: string;\n values: Iterable<GraphSeriesValueTuple>;\n}\n\nexport type EChartsValues = number | null | '-';\n\nexport interface EChartsTimeSeries extends Omit<LineSeriesOption, 'data'> {\n // TODO: support dataset and both category / time xAxis types\n data: Iterable<GraphSeriesValueTuple> | EChartsValues[];\n}\n\nexport type EChartsDataFormat = {\n timeSeries: EChartsTimeSeries[];\n xAxis: number[];\n legendItems?: LegendItem[];\n xAxisMax?: number | string;\n rangeMs?: number;\n};\n\n/**\n * Supported legend options\n */\nexport interface LegendOptions {\n position?: 'bottom' | 'right';\n}\n\nexport interface LegendItem {\n id: string;\n label: string;\n isSelected: boolean;\n color: string;\n onClick: MouseEventHandler<HTMLLIElement>;\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,0EAA0E;AAC1E,OAAO,MAAMA,2BAA2B,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './graph';
|
|
14
|
+
export * from './theme';
|
|
15
|
+
export * from './units';
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2022 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 './graph';\nexport * from './theme';\nexport * from './units';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EChartsOption, EChartsCoreOption, BarSeriesOption, LineSeriesOption, GaugeSeriesOption } from 'echarts';
|
|
2
|
+
export interface PersesChartsTheme {
|
|
3
|
+
echartsTheme: EChartsTheme;
|
|
4
|
+
noDataOption: EChartsCoreOption;
|
|
5
|
+
sparkline: {
|
|
6
|
+
width: number;
|
|
7
|
+
color: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface EChartsTheme extends EChartsOption {
|
|
11
|
+
bar?: BarSeriesOption;
|
|
12
|
+
line?: LineSeriesOption;
|
|
13
|
+
gauge?: GaugeSeriesOption;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/model/theme.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAGD,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/theme.ts"],"sourcesContent":["// Copyright 2022 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 { EChartsOption, EChartsCoreOption, BarSeriesOption, LineSeriesOption, GaugeSeriesOption } from 'echarts';\n\nexport interface PersesChartsTheme {\n echartsTheme: EChartsTheme;\n noDataOption: EChartsCoreOption;\n sparkline: {\n width: number;\n color: string;\n };\n}\n\n// https://github.com/apache/echarts/issues/12489#issuecomment-643185207\nexport interface EChartsTheme extends EChartsOption {\n bar?: BarSeriesOption;\n line?: LineSeriesOption;\n gauge?: GaugeSeriesOption;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAgBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
declare const bytesUnitKinds: readonly ["Bytes"];
|
|
3
|
+
declare type BytesUnitKind = typeof bytesUnitKinds[number];
|
|
4
|
+
export declare type BytesUnitOptions = {
|
|
5
|
+
kind: BytesUnitKind;
|
|
6
|
+
decimal_places?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const BYTES_GROUP_CONFIG: UnitGroupConfig;
|
|
9
|
+
export declare const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>>;
|
|
10
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../src/model/units/bytes.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,cAAc,oBAAqB,CAAC;AAC1C,aAAK,aAAa,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AACnD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,eAGhC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAKzE,CAAC;AAGF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,UAYtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
const bytesUnitKinds = [
|
|
14
|
+
'Bytes'
|
|
15
|
+
];
|
|
16
|
+
export const BYTES_GROUP_CONFIG = {
|
|
17
|
+
label: 'Bytes',
|
|
18
|
+
decimal_places: true
|
|
19
|
+
};
|
|
20
|
+
export const BYTES_UNIT_CONFIG = {
|
|
21
|
+
Bytes: {
|
|
22
|
+
group: 'Bytes',
|
|
23
|
+
label: 'Bytes'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
// https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828
|
|
27
|
+
export function formatBytes(bytes, decimals = 2) {
|
|
28
|
+
if (bytes === 0) return '0 Bytes';
|
|
29
|
+
const k = 1024;
|
|
30
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
31
|
+
const sizes = [
|
|
32
|
+
'Bytes',
|
|
33
|
+
'KB',
|
|
34
|
+
'MB',
|
|
35
|
+
'GB',
|
|
36
|
+
'TB',
|
|
37
|
+
'PB',
|
|
38
|
+
'EB',
|
|
39
|
+
'ZB',
|
|
40
|
+
'YB'
|
|
41
|
+
];
|
|
42
|
+
// Math.max(0, ...) ensures that we don't return -1 as a value for the index.
|
|
43
|
+
// Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.
|
|
44
|
+
const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));
|
|
45
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/bytes.ts"],"sourcesContent":["// Copyright 2022 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 { UnitGroupConfig, UnitConfig } from './types';\n\nconst bytesUnitKinds = ['Bytes'] as const;\ntype BytesUnitKind = typeof bytesUnitKinds[number];\nexport type BytesUnitOptions = {\n kind: BytesUnitKind;\n decimal_places?: number;\n};\nexport const BYTES_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Bytes',\n decimal_places: true,\n};\nexport const BYTES_UNIT_CONFIG: Readonly<Record<BytesUnitKind, UnitConfig>> = {\n Bytes: {\n group: 'Bytes',\n label: 'Bytes',\n },\n};\n\n// https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript/18650828#18650828\nexport function formatBytes(bytes: number, decimals = 2) {\n if (bytes === 0) return '0 Bytes';\n\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n // Math.max(0, ...) ensures that we don't return -1 as a value for the index.\n // Why? When the number of bytes are between -1 and 1, Math.floor(Math.log(bytes)/Math.log(1024)) returns -1.\n const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(k)));\n\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n}\n"],"names":["bytesUnitKinds","BYTES_GROUP_CONFIG","label","decimal_places","BYTES_UNIT_CONFIG","Bytes","group","formatBytes","bytes","decimals","k","dm","sizes","i","Math","max","floor","log","parseFloat","pow","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,MAAMA,cAAc,GAAG;IAAC,OAAO;CAAC,AAAS,AAAC;AAM1C,OAAO,MAAMC,kBAAkB,GAAoB;IACjDC,KAAK,EAAE,OAAO;IACdC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,iBAAiB,GAAgD;IAC5EC,KAAK,EAAE;QACLC,KAAK,EAAE,OAAO;QACdJ,KAAK,EAAE,OAAO;KACf;CACF,CAAC;AAEF,gIAAgI;AAChI,OAAO,SAASK,WAAW,CAACC,KAAa,EAAEC,QAAQ,GAAG,CAAC,EAAE;IACvD,IAAID,KAAK,KAAK,CAAC,EAAE,OAAO,SAAS,CAAC;IAElC,MAAME,CAAC,GAAG,IAAI,AAAC;IACf,MAAMC,EAAE,GAAGF,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAGA,QAAQ,AAAC;IACvC,MAAMG,KAAK,GAAG;QAAC,OAAO;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;QAAE,IAAI;KAAC,AAAC;IAExE,6EAA6E;IAC7E,6GAA6G;IAC7G,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAED,IAAI,CAACE,KAAK,CAACF,IAAI,CAACG,GAAG,CAACT,KAAK,CAAC,GAAGM,IAAI,CAACG,GAAG,CAACP,CAAC,CAAC,CAAC,CAAC,AAAC;IAEjE,OAAOQ,UAAU,CAAC,AAACV,CAAAA,KAAK,GAAGM,IAAI,CAACK,GAAG,CAACT,CAAC,EAAEG,CAAC,CAAC,CAAA,CAAEO,OAAO,CAACT,EAAE,CAAC,CAAC,GAAG,GAAG,GAAGC,KAAK,CAACC,CAAC,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/model/units/constants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,sBAAsB,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
// Common constants needed across individual unit groups and the overall
|
|
14
|
+
// combined units.
|
|
15
|
+
export const DEFAULT_DECIMAL_PLACES = 2;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/constants.ts"],"sourcesContent":["// Copyright 2022 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// Common constants needed across individual unit groups and the overall\n// combined units.\nexport const DEFAULT_DECIMAL_PLACES = 2;\n"],"names":["DEFAULT_DECIMAL_PLACES"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,wEAAwE;AACxE,kBAAkB;AAClB,OAAO,MAAMA,sBAAsB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
declare const decimalUnitKinds: readonly ["Decimal"];
|
|
3
|
+
declare type DecimalUnitKind = typeof decimalUnitKinds[number];
|
|
4
|
+
export declare type DecimalUnitOptions = {
|
|
5
|
+
kind: DecimalUnitKind;
|
|
6
|
+
decimal_places?: number;
|
|
7
|
+
abbreviate?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const PERCENT_GROUP_CONFIG: UnitGroupConfig;
|
|
10
|
+
export declare const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>>;
|
|
11
|
+
export declare function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string;
|
|
12
|
+
/**
|
|
13
|
+
* Takes large numbers and abbreviates them with the appropriate suffix
|
|
14
|
+
* 10123 -> 10.123k
|
|
15
|
+
* 1000000 -> 1M
|
|
16
|
+
*/
|
|
17
|
+
export declare function abbreviateLargeNumber(num: number, decimals?: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Takes large numbers, rounds and abbreviates them with the appropriate suffix
|
|
20
|
+
* Add modifier to run on output value prior to unit being added (defaults to rounding)
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatNumber(num: number, modifier?: (n: number) => number): string;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/model/units/decimal.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,gBAAgB,sBAAuB,CAAC;AAC9C,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAGlC,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAK7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAepF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAI,UAG9D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAYlF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { round } from '../../utils/mathjs';
|
|
14
|
+
import { DEFAULT_DECIMAL_PLACES } from './constants';
|
|
15
|
+
const decimalUnitKinds = [
|
|
16
|
+
'Decimal'
|
|
17
|
+
];
|
|
18
|
+
export const PERCENT_GROUP_CONFIG = {
|
|
19
|
+
label: 'Percent',
|
|
20
|
+
decimal_places: true
|
|
21
|
+
};
|
|
22
|
+
export const DECIMAL_UNIT_CONFIG = {
|
|
23
|
+
Decimal: {
|
|
24
|
+
group: 'Decimal',
|
|
25
|
+
label: 'Decimal'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export function formatDecimal(value, unitOptions) {
|
|
29
|
+
var _decimal_places;
|
|
30
|
+
const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
31
|
+
if (unitOptions.abbreviate === true) {
|
|
32
|
+
return abbreviateLargeNumber(value, decimals);
|
|
33
|
+
}
|
|
34
|
+
const formatParams = {
|
|
35
|
+
style: 'decimal',
|
|
36
|
+
minimumFractionDigits: decimals,
|
|
37
|
+
maximumFractionDigits: decimals,
|
|
38
|
+
useGrouping: true
|
|
39
|
+
};
|
|
40
|
+
const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);
|
|
41
|
+
return decimalFormatter.format(value);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Takes large numbers and abbreviates them with the appropriate suffix
|
|
45
|
+
* 10123 -> 10.123k
|
|
46
|
+
* 1000000 -> 1M
|
|
47
|
+
*/ export function abbreviateLargeNumber(num, decimals = 2) {
|
|
48
|
+
const modifier = (n)=>round(n, decimals);
|
|
49
|
+
return formatNumber(num, modifier);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Takes large numbers, rounds and abbreviates them with the appropriate suffix
|
|
53
|
+
* Add modifier to run on output value prior to unit being added (defaults to rounding)
|
|
54
|
+
*/ export function formatNumber(num, modifier) {
|
|
55
|
+
const fn = modifier !== null && modifier !== void 0 ? modifier : Math.round;
|
|
56
|
+
return num >= 1e12 ? fn(num / 1e12) + 'T' : num >= 1e9 ? fn(num / 1e9) + 'B' : num >= 1e6 ? fn(num / 1e6) + 'M' : num >= 1e3 ? fn(num / 1e3) + 'K' : num.toString();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=decimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/decimal.ts"],"sourcesContent":["// Copyright 2022 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 { round } from '../../utils/mathjs';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst decimalUnitKinds = ['Decimal'] as const;\ntype DecimalUnitKind = typeof decimalUnitKinds[number];\nexport type DecimalUnitOptions = {\n kind: DecimalUnitKind;\n decimal_places?: number;\n abbreviate?: boolean;\n};\nexport const PERCENT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Percent',\n decimal_places: true,\n};\nexport const DECIMAL_UNIT_CONFIG: Readonly<Record<DecimalUnitKind, UnitConfig>> = {\n Decimal: {\n group: 'Decimal',\n label: 'Decimal',\n },\n};\n\nexport function formatDecimal(value: number, unitOptions: DecimalUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.abbreviate === true) {\n return abbreviateLargeNumber(value, decimals);\n }\n\n const formatParams: Intl.NumberFormatOptions = {\n style: 'decimal',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n useGrouping: true,\n };\n const decimalFormatter = new Intl.NumberFormat('en-US', formatParams);\n return decimalFormatter.format(value);\n}\n\n/**\n * Takes large numbers and abbreviates them with the appropriate suffix\n * 10123 -> 10.123k\n * 1000000 -> 1M\n */\nexport function abbreviateLargeNumber(num: number, decimals = 2) {\n const modifier = (n: number) => round(n, decimals);\n return formatNumber(num, modifier);\n}\n\n/**\n * Takes large numbers, rounds and abbreviates them with the appropriate suffix\n * Add modifier to run on output value prior to unit being added (defaults to rounding)\n */\nexport function formatNumber(num: number, modifier?: (n: number) => number): string {\n const fn = modifier ?? Math.round;\n\n return num >= 1e12\n ? fn(num / 1e12) + 'T'\n : num >= 1e9\n ? fn(num / 1e9) + 'B'\n : num >= 1e6\n ? fn(num / 1e6) + 'M'\n : num >= 1e3\n ? fn(num / 1e3) + 'K'\n : num.toString();\n}\n"],"names":["round","DEFAULT_DECIMAL_PLACES","decimalUnitKinds","PERCENT_GROUP_CONFIG","label","decimal_places","DECIMAL_UNIT_CONFIG","Decimal","group","formatDecimal","value","unitOptions","decimals","abbreviate","abbreviateLargeNumber","formatParams","style","minimumFractionDigits","maximumFractionDigits","useGrouping","decimalFormatter","Intl","NumberFormat","format","num","modifier","n","formatNumber","fn","Math","toString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,oBAAoB,CAAC;AAC3C,SAASC,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;CAAC,AAAS,AAAC;AAO9C,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAE,SAAS;QAChBJ,KAAK,EAAE,SAAS;KACjB;CACF,CAAC;AAEF,OAAO,SAASK,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACN,cAAc,cAA1BM,eAA0B,cAA1BA,eAA0B,GAAIV,sBAAsB,AAAC;IAEtE,IAAIU,WAAW,CAACE,UAAU,KAAK,IAAI,EAAE;QACnC,OAAOC,qBAAqB,CAACJ,KAAK,EAAEE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED,MAAMG,YAAY,GAA6B;QAC7CC,KAAK,EAAE,SAAS;QAChBC,qBAAqB,EAAEL,QAAQ;QAC/BM,qBAAqB,EAAEN,QAAQ;QAC/BO,WAAW,EAAE,IAAI;KAClB,AAAC;IACF,MAAMC,gBAAgB,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,OAAO,EAAEP,YAAY,CAAC,AAAC;IACtE,OAAOK,gBAAgB,CAACG,MAAM,CAACb,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;;;CAIC,GACD,OAAO,SAASI,qBAAqB,CAACU,GAAW,EAAEZ,QAAQ,GAAG,CAAC,EAAE;IAC/D,MAAMa,QAAQ,GAAG,CAACC,CAAS,GAAK1B,KAAK,CAAC0B,CAAC,EAAEd,QAAQ,CAAC,AAAC;IACnD,OAAOe,YAAY,CAACH,GAAG,EAAEC,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED;;;CAGC,GACD,OAAO,SAASE,YAAY,CAACH,GAAW,EAAEC,QAAgC,EAAU;IAClF,MAAMG,EAAE,GAAGH,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAII,IAAI,CAAC7B,KAAK,AAAC;IAElC,OAAOwB,GAAG,IAAI,IAAI,GACdI,EAAE,CAACJ,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GACpBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,IAAI,GAAG,GACVI,EAAE,CAACJ,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GACnBA,GAAG,CAACM,QAAQ,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/units/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './units';
|
|
14
|
+
export * from './constants';
|
|
15
|
+
export * from './types';
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/index.ts"],"sourcesContent":["// Copyright 2022 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 './units';\nexport * from './constants';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
declare const percentUnitKinds: readonly ["Percent", "PercentDecimal", "%"];
|
|
3
|
+
declare type PercentUnitKind = typeof percentUnitKinds[number];
|
|
4
|
+
export declare type PercentUnitOptions = {
|
|
5
|
+
kind: PercentUnitKind;
|
|
6
|
+
decimal_places?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const DECIMAL_GROUP_CONFIG: UnitGroupConfig;
|
|
9
|
+
export declare const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>>;
|
|
10
|
+
export declare function formatPercent(value: number, unitOptions: PercentUnitOptions): string;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=percent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../../src/model/units/percent.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,QAAA,MAAM,gBAAgB,6CAA8C,CAAC;AACrE,aAAK,eAAe,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,eAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAgB7E,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAQpF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { DEFAULT_DECIMAL_PLACES } from './constants';
|
|
14
|
+
const percentUnitKinds = [
|
|
15
|
+
'Percent',
|
|
16
|
+
'PercentDecimal',
|
|
17
|
+
'%'
|
|
18
|
+
];
|
|
19
|
+
export const DECIMAL_GROUP_CONFIG = {
|
|
20
|
+
label: 'Decimal',
|
|
21
|
+
decimal_places: true,
|
|
22
|
+
abbreviate: true
|
|
23
|
+
};
|
|
24
|
+
const PERCENT_GROUP = 'Percent';
|
|
25
|
+
export const PERCENT_UNIT_CONFIG = {
|
|
26
|
+
Percent: {
|
|
27
|
+
group: PERCENT_GROUP,
|
|
28
|
+
label: 'Percent (0-100)'
|
|
29
|
+
},
|
|
30
|
+
PercentDecimal: {
|
|
31
|
+
group: PERCENT_GROUP,
|
|
32
|
+
label: 'Percent (0.0-1.0)'
|
|
33
|
+
},
|
|
34
|
+
'%': {
|
|
35
|
+
// This option is not shown in the selector because it is a shorthand
|
|
36
|
+
// duplicate of `Percent`.
|
|
37
|
+
disableSelectorOption: true,
|
|
38
|
+
group: PERCENT_GROUP,
|
|
39
|
+
label: '%'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export function formatPercent(value, unitOptions) {
|
|
43
|
+
var _decimal_places;
|
|
44
|
+
const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
45
|
+
if (unitOptions.kind === 'PercentDecimal') {
|
|
46
|
+
value = value * 100;
|
|
47
|
+
}
|
|
48
|
+
return value.toFixed(decimals) + '%';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=percent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/percent.ts"],"sourcesContent":["// Copyright 2022 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 { UnitGroupConfig, UnitConfig } from './types';\nimport { DEFAULT_DECIMAL_PLACES } from './constants';\n\nconst percentUnitKinds = ['Percent', 'PercentDecimal', '%'] as const;\ntype PercentUnitKind = typeof percentUnitKinds[number];\nexport type PercentUnitOptions = {\n kind: PercentUnitKind;\n decimal_places?: number;\n};\nexport const DECIMAL_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Decimal',\n decimal_places: true,\n abbreviate: true,\n};\nconst PERCENT_GROUP = 'Percent';\nexport const PERCENT_UNIT_CONFIG: Readonly<Record<PercentUnitKind, UnitConfig>> = {\n Percent: {\n group: PERCENT_GROUP,\n label: 'Percent (0-100)',\n },\n PercentDecimal: {\n group: PERCENT_GROUP,\n label: 'Percent (0.0-1.0)',\n },\n '%': {\n // This option is not shown in the selector because it is a shorthand\n // duplicate of `Percent`.\n disableSelectorOption: true,\n group: PERCENT_GROUP,\n label: '%',\n },\n};\n\nexport function formatPercent(value: number, unitOptions: PercentUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n\n if (unitOptions.kind === 'PercentDecimal') {\n value = value * 100;\n }\n\n return value.toFixed(decimals) + '%';\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","percentUnitKinds","DECIMAL_GROUP_CONFIG","label","decimal_places","abbreviate","PERCENT_GROUP","PERCENT_UNIT_CONFIG","Percent","group","PercentDecimal","disableSelectorOption","formatPercent","value","unitOptions","decimals","kind","toFixed"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAErD,MAAMC,gBAAgB,GAAG;IAAC,SAAS;IAAE,gBAAgB;IAAE,GAAG;CAAC,AAAS,AAAC;AAMrE,OAAO,MAAMC,oBAAoB,GAAoB;IACnDC,KAAK,EAAE,SAAS;IAChBC,cAAc,EAAE,IAAI;IACpBC,UAAU,EAAE,IAAI;CACjB,CAAC;AACF,MAAMC,aAAa,GAAG,SAAS,AAAC;AAChC,OAAO,MAAMC,mBAAmB,GAAkD;IAChFC,OAAO,EAAE;QACPC,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,iBAAiB;KACzB;IACDO,cAAc,EAAE;QACdD,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,mBAAmB;KAC3B;IACD,GAAG,EAAE;QACH,qEAAqE;QACrE,0BAA0B;QAC1BQ,qBAAqB,EAAE,IAAI;QAC3BF,KAAK,EAAEH,aAAa;QACpBH,KAAK,EAAE,GAAG;KACX;CACF,CAAC;AAEF,OAAO,SAASS,aAAa,CAACC,KAAa,EAAEC,WAA+B,EAAU;QACnEA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACV,cAAc,cAA1BU,eAA0B,cAA1BA,eAA0B,GAAId,sBAAsB,AAAC;IAEtE,IAAIc,WAAW,CAACE,IAAI,KAAK,gBAAgB,EAAE;QACzCH,KAAK,GAAGA,KAAK,GAAG,GAAG,CAAC;IACtB,CAAC;IAED,OAAOA,KAAK,CAACI,OAAO,CAACF,QAAQ,CAAC,GAAG,GAAG,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
declare const timeUnitKinds: readonly ["Milliseconds", "Seconds", "Minutes", "Hours", "Days", "Weeks", "Months", "Years"];
|
|
3
|
+
declare type TimeUnitKind = typeof timeUnitKinds[number];
|
|
4
|
+
export declare type TimeUnitOptions = {
|
|
5
|
+
kind: TimeUnitKind;
|
|
6
|
+
decimal_places?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const TIME_GROUP_CONFIG: UnitGroupConfig;
|
|
9
|
+
export declare const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>>;
|
|
10
|
+
export declare enum TimeIntlDuration {
|
|
11
|
+
Milliseconds = "millisecond",
|
|
12
|
+
Seconds = "second",
|
|
13
|
+
Minutes = "minute",
|
|
14
|
+
Hours = "hour",
|
|
15
|
+
Days = "day",
|
|
16
|
+
Weeks = "week",
|
|
17
|
+
Months = "month",
|
|
18
|
+
Years = "year"
|
|
19
|
+
}
|
|
20
|
+
export declare function formatTime(value: number, unitOptions: TimeUnitOptions): string;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/model/units/time.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD,QAAA,MAAM,aAAa,8FAA+F,CAAC;AACnH,aAAK,YAAY,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjD,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAG/B,CAAC;AACF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAiCvE,CAAC;AAIF,oBAAY,gBAAgB;IAC1B,YAAY,gBAAgB;IAC5B,OAAO,WAAW;IAClB,OAAO,WAAW;IAClB,KAAK,SAAS;IACd,IAAI,QAAQ;IACZ,KAAK,SAAS;IACd,MAAM,UAAU;IAChB,KAAK,SAAS;CACf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,GAAG,MAAM,CAW9E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { DEFAULT_DECIMAL_PLACES } from './constants';
|
|
14
|
+
const timeUnitKinds = [
|
|
15
|
+
'Milliseconds',
|
|
16
|
+
'Seconds',
|
|
17
|
+
'Minutes',
|
|
18
|
+
'Hours',
|
|
19
|
+
'Days',
|
|
20
|
+
'Weeks',
|
|
21
|
+
'Months',
|
|
22
|
+
'Years'
|
|
23
|
+
];
|
|
24
|
+
const TIME_GROUP = 'Time';
|
|
25
|
+
export const TIME_GROUP_CONFIG = {
|
|
26
|
+
label: 'Time',
|
|
27
|
+
decimal_places: true
|
|
28
|
+
};
|
|
29
|
+
export const TIME_UNIT_CONFIG = {
|
|
30
|
+
Milliseconds: {
|
|
31
|
+
group: TIME_GROUP,
|
|
32
|
+
label: 'Milliseconds'
|
|
33
|
+
},
|
|
34
|
+
Seconds: {
|
|
35
|
+
group: TIME_GROUP,
|
|
36
|
+
label: 'Seconds'
|
|
37
|
+
},
|
|
38
|
+
Minutes: {
|
|
39
|
+
group: TIME_GROUP,
|
|
40
|
+
label: 'Minutes'
|
|
41
|
+
},
|
|
42
|
+
Hours: {
|
|
43
|
+
group: TIME_GROUP,
|
|
44
|
+
label: 'Hours'
|
|
45
|
+
},
|
|
46
|
+
Days: {
|
|
47
|
+
group: TIME_GROUP,
|
|
48
|
+
label: 'Days'
|
|
49
|
+
},
|
|
50
|
+
Weeks: {
|
|
51
|
+
group: TIME_GROUP,
|
|
52
|
+
label: 'Weeks'
|
|
53
|
+
},
|
|
54
|
+
Months: {
|
|
55
|
+
group: TIME_GROUP,
|
|
56
|
+
label: 'Months'
|
|
57
|
+
},
|
|
58
|
+
Years: {
|
|
59
|
+
group: TIME_GROUP,
|
|
60
|
+
label: 'Years'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export var TimeIntlDuration;
|
|
64
|
+
(function(TimeIntlDuration) {
|
|
65
|
+
TimeIntlDuration["Milliseconds"] = 'millisecond';
|
|
66
|
+
TimeIntlDuration["Seconds"] = 'second';
|
|
67
|
+
TimeIntlDuration["Minutes"] = 'minute';
|
|
68
|
+
TimeIntlDuration["Hours"] = 'hour';
|
|
69
|
+
TimeIntlDuration["Days"] = 'day';
|
|
70
|
+
TimeIntlDuration["Weeks"] = 'week';
|
|
71
|
+
TimeIntlDuration["Months"] = 'month';
|
|
72
|
+
TimeIntlDuration["Years"] = 'year';
|
|
73
|
+
})(TimeIntlDuration || (TimeIntlDuration = {}));
|
|
74
|
+
export function formatTime(value, unitOptions) {
|
|
75
|
+
var _decimal_places;
|
|
76
|
+
const decimals = (_decimal_places = unitOptions.decimal_places) !== null && _decimal_places !== void 0 ? _decimal_places : DEFAULT_DECIMAL_PLACES;
|
|
77
|
+
const timeUnit = TimeIntlDuration[unitOptions.kind];
|
|
78
|
+
const formatter = new Intl.NumberFormat('en', {
|
|
79
|
+
style: 'unit',
|
|
80
|
+
unit: timeUnit,
|
|
81
|
+
unitDisplay: 'long',
|
|
82
|
+
minimumFractionDigits: decimals,
|
|
83
|
+
maximumFractionDigits: decimals
|
|
84
|
+
});
|
|
85
|
+
return formatter.format(value);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/time.ts"],"sourcesContent":["// Copyright 2022 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 { DEFAULT_DECIMAL_PLACES } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\n\nconst timeUnitKinds = ['Milliseconds', 'Seconds', 'Minutes', 'Hours', 'Days', 'Weeks', 'Months', 'Years'] as const;\ntype TimeUnitKind = typeof timeUnitKinds[number];\nexport type TimeUnitOptions = {\n kind: TimeUnitKind;\n decimal_places?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimal_places: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnitKind, UnitConfig>> = {\n Milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n Seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n Minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n Hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n Days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n Weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n Months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n Years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum TimeIntlDuration {\n Milliseconds = 'millisecond',\n Seconds = 'second',\n Minutes = 'minute',\n Hours = 'hour',\n Days = 'day',\n Weeks = 'week',\n Months = 'month',\n Years = 'year',\n}\n\nexport function formatTime(value: number, unitOptions: TimeUnitOptions): string {\n const decimals = unitOptions.decimal_places ?? DEFAULT_DECIMAL_PLACES;\n const timeUnit: string = TimeIntlDuration[unitOptions.kind];\n const formatter = new Intl.NumberFormat('en', {\n style: 'unit',\n unit: timeUnit,\n unitDisplay: 'long',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n });\n return formatter.format(value);\n}\n"],"names":["DEFAULT_DECIMAL_PLACES","timeUnitKinds","TIME_GROUP","TIME_GROUP_CONFIG","label","decimal_places","TIME_UNIT_CONFIG","Milliseconds","group","Seconds","Minutes","Hours","Days","Weeks","Months","Years","TimeIntlDuration","formatTime","value","unitOptions","decimals","timeUnit","kind","formatter","Intl","NumberFormat","style","unit","unitDisplay","minimumFractionDigits","maximumFractionDigits","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,aAAa,CAAC;AAGrD,MAAMC,aAAa,GAAG;IAAC,cAAc;IAAE,SAAS;IAAE,SAAS;IAAE,OAAO;IAAE,MAAM;IAAE,OAAO;IAAE,QAAQ;IAAE,OAAO;CAAC,AAAS,AAAC;AAMnH,MAAMC,UAAU,GAAG,MAAM,AAAC;AAC1B,OAAO,MAAMC,iBAAiB,GAAoB;IAChDC,KAAK,EAAE,MAAM;IACbC,cAAc,EAAE,IAAI;CACrB,CAAC;AACF,OAAO,MAAMC,gBAAgB,GAA+C;IAC1EC,YAAY,EAAE;QACZC,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,cAAc;KACtB;IACDK,OAAO,EAAE;QACPD,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDM,OAAO,EAAE;QACPF,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,SAAS;KACjB;IACDO,KAAK,EAAE;QACLH,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDQ,IAAI,EAAE;QACJJ,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,MAAM;KACd;IACDS,KAAK,EAAE;QACLL,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;IACDU,MAAM,EAAE;QACNN,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,QAAQ;KAChB;IACDW,KAAK,EAAE;QACLP,KAAK,EAAEN,UAAU;QACjBE,KAAK,EAAE,OAAO;KACf;CACF,CAAC;WAIK,gBASN;UATWY,gBAAgB;IAAhBA,gBAAgB,CAC1BT,cAAY,IAAG,aAAa;IADlBS,gBAAgB,CAE1BP,SAAO,IAAG,QAAQ;IAFRO,gBAAgB,CAG1BN,SAAO,IAAG,QAAQ;IAHRM,gBAAgB,CAI1BL,OAAK,IAAG,MAAM;IAJJK,gBAAgB,CAK1BJ,MAAI,IAAG,KAAK;IALFI,gBAAgB,CAM1BH,OAAK,IAAG,MAAM;IANJG,gBAAgB,CAO1BF,QAAM,IAAG,OAAO;IAPNE,gBAAgB,CAQ1BD,OAAK,IAAG,MAAM;GARJC,gBAAgB,KAAhBA,gBAAgB;AAW5B,OAAO,SAASC,UAAU,CAACC,KAAa,EAAEC,WAA4B,EAAU;QAC7DA,eAA0B;IAA3C,MAAMC,QAAQ,GAAGD,CAAAA,eAA0B,GAA1BA,WAAW,CAACd,cAAc,cAA1Bc,eAA0B,cAA1BA,eAA0B,GAAInB,sBAAsB,AAAC;IACtE,MAAMqB,QAAQ,GAAWL,gBAAgB,CAACG,WAAW,CAACG,IAAI,CAAC,AAAC;IAC5D,MAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAAC,IAAI,EAAE;QAC5CC,KAAK,EAAE,MAAM;QACbC,IAAI,EAAEN,QAAQ;QACdO,WAAW,EAAE,MAAM;QACnBC,qBAAqB,EAAET,QAAQ;QAC/BU,qBAAqB,EAAEV,QAAQ;KAChC,CAAC,AAAC;IACH,OAAOG,SAAS,CAACQ,MAAM,CAACb,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const UNIT_GROUPS: readonly ["Time", "Percent", "Decimal", "Bytes"];
|
|
2
|
+
export declare type UnitGroup = typeof UNIT_GROUPS[number];
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for rendering units that are part of a group.
|
|
5
|
+
*/
|
|
6
|
+
export declare type UnitGroupConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* The label that is shown in the UI.
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* When true, the unit group supports setting decimal places.
|
|
13
|
+
*/
|
|
14
|
+
decimal_places?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When true, the unit group supports enabling abbreviate.
|
|
17
|
+
*/
|
|
18
|
+
abbreviate?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for rendering a specific unit.
|
|
22
|
+
*/
|
|
23
|
+
export declare type UnitConfig = {
|
|
24
|
+
/**
|
|
25
|
+
* The group the unit is part of. This will inform common rendering behavior.
|
|
26
|
+
*/
|
|
27
|
+
group: UnitGroup;
|
|
28
|
+
/**
|
|
29
|
+
* When true, this unit will not be displayed in the unit selector. This is
|
|
30
|
+
* useful for units that are shorthand variants of other units.
|
|
31
|
+
*/
|
|
32
|
+
disableSelectorOption?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The label that is shown in the UI.
|
|
35
|
+
*/
|
|
36
|
+
label: string;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,WAAW,kDAAmD,CAAC;AAC5E,oBAAY,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEnD;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2022 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
|
+
// Common types needed across individual unit groups and the overall combined
|
|
14
|
+
// units.
|
|
15
|
+
export const UNIT_GROUPS = [
|
|
16
|
+
'Time',
|
|
17
|
+
'Percent',
|
|
18
|
+
'Decimal',
|
|
19
|
+
'Bytes'
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=types.js.map
|